Ask Your Question

James Hefferon's profile - activity

2019-11-08 23:35:24 +0200 commented answer Does sagemath move asterisks down?

Thank you for the help. Like you, I prefer to do code with the fancyvrb package, as minted does, in my case because of copy-and-pastability (although it doesn't include an option for background color, so that is a downside). But sagemath uses listings so there I am. (I am quite keen on sagemath's wonderful sagecommandline environment since I am writing a lab manual and I want to show code and response.)

I'm very glad to hear you can confirm the bug. I had a look at the code and I have to admit that fixing it is beyond my abilities. I'll put reporting that bug on my todo list and see if I can get that done soon. Thanks again. (I apologize but I lack the karma to upvote you.)

2019-11-05 05:22:36 +0200 asked a question Does sagemath move asterisks down?

I am using sagemath.sty. The multiplication asterisks that are shown in the sagecommandline environment are far too low. How can I adjust them?

I am bringing in a TrueType font using fontspec. This is a coding font so the asterisks are lower than in many other fonts. That I can tell, sagemath is moving them vertically and the result is that they fall into the baseline.

Here is my file try.tex. Below I have links to two images showing the output for the two fonts listed. (The coding font ProggyClean.ttf is from a web site called http://proggyfonts.net but I included the images so you needn't download it to see what I mean.)

% -*- coding: utf-8 -*-
\documentclass{article}
\usepackage{xcolor}
\definecolor{pythoncolor}{HTML}{BCD4CE}     
\usepackage[T1]{fontenc}
\usepackage{fontspec}  

\newfontface\listingsfont[Path=../fonts/,
                          Scale=1.05,Color=blue]{ProggyClean.ttf}
% \newfontface\listingsfont[
%                           Color=red]{Charis SIL}

\usepackage{sagetex}

\RequirePackage{listings}
\lstset{basicstyle=\listingsfont,
   columns=flexible, 
}

% Copied and modified from sagetex
\lstdefinestyle{SageInput}{basicstyle=\listingsfont,
}
\lstdefinestyle{SageOutput}{basicstyle=\listingsfont,
}

% Test how it looks under regular verbatim style
\makeatletter
\newcommand{\verbatimfont}[1]{\def\verbatim@font{#1}}%
\makeatother

\begin{document}
% Text in the listings font
{\listingsfont abc**def "jklm" 'nopq'}

% Test under regular verbatim 
\verbatimfont{\listingsfont}
\begin{verbatim}
xyz**xyz
\end{verbatim}

% Text under Sage
\begin{sagecommandline}
sage: 4**3+16
sage: 2-3/4*5
\end{sagecommandline}
\end{document}

The result of using ProggyClean is at i.imgur.com/EcbAtMN.png (I lack the karma to post links) and gives asterisks in the baseline. The result of uncommenting the text font Charis SIL is at i.imgur.com/ltFkamq.png and looks much better, I think because its asterisks started out higher.

How can I adjust the height of these myself? Thank you.