Bug#881216: sagemath: Not using standard LaTeX fonts with plots using text()

Ximin Luo infinity0 at debian.org
Sun Mar 11 15:17:00 UTC 2018


Hi Jaimos, you can force use of the latex fonts by passing typeset="latex" as a parameter to any one of the three functions plot(), text() or show() that you're using.

The documentation for sage.plot.graphics.show() says:

        - ``typeset`` -- (default: ``"default"``) string. The type of
          font rendering that should be used for the text. The possible
          values are

          - ``"default"`` -- Uses matplotlib's internal text rendering
            engine called Mathtext ( see
            https://matplotlib.org/users/mathtext.html ). If you have
            modified the default matplotlib settings, for instance via
            a matplotlibrc file, then this option will not change any of
            those settings.
          - ``"latex"`` -- LaTeX is used for rendering the fonts. This
            requires LaTeX, dvipng and Ghostscript to be installed.
          - ``"type1"`` -- Type 1 fonts are used by matplotlib in the text
            in the figure.  This requires LaTeX, dvipng and Ghostscript to
            be installed.

implying that the "default" setting is based on whatever matplotlib does. Looking at sage's own patches for their matplotlib package, I see nothing relevant that suggests they are forcing latex specifically. Neither do I see anything relevant in Debian's matplotlib package forcing non-latex:

- https://git.sagemath.org/sage.git/tree/build/pkgs/matplotlib
- https://sources.debian.org/src/matplotlib/2.1.1-2/debian/patches/

We are doing nothing specific in the Debian sagemath package either.

Feel free to investigate further; I am unlikely to do that but would be happy to leave this bug open for documentation purposes. Arguably it could be reassigned to the python-matplotlib package but I am unsure if it is really their issue, or our issue.

X

Jaimos Skriletz wrote:
> Package: sagemath
> Version: 7.4-9
> Severity: minor
> 
> Dear Maintainer,
> 
> In upgrading to stretch from jessie I am trying to switch to using the
> Debian package for sagemath from using the packages from upstream.
> In switching I noticed the following issue:
> 
> I use sagemath, via the notebook(), to mostly draw images and label
> them. For example to label a function I would use something like:
> 
> P = plot( sqrt(4-x), (x,0,4) )
> P += text( r"$y=\sqrt{4-x}$", (3.2,1.5), fontsize=16, color="black" )
> P.show(figsize=[3,3])
> 
> The upstream version of sagemath (either the version pre-compiled for
> Debian 8 or a version I compiled on stretch use the standard LaTeX
> math fonts for formulas, while the Debian package does not.
> Images attached.
> 
> I am not sure if this is an issue with how sagemath was built or a
> configuration option, but I have not been able to figure out how
> to get the Debian package to use the standard LaTeX fonts that
> I am use to.
> 

-- 
GPG: ed25519/56034877E1F87C35
GPG: rsa4096/1318EFAC5FBBDBCE
https://github.com/infinity0/pubkeys.git



More information about the debian-science-maintainers mailing list