Ask Your Question

Revision history [back]

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 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.