# AMS symbols in PDF, HTML documentation

17 views

### Rob Beezer

Jun 3, 2010, 4:04:52 PM6/3/10
to sage-devel
Mitesh Patel discovered that the tex macro "\leqslant" (a slanted
inequality) breaks the PDF reference manual, while it survives just
fine in the HTML version. (Introduced at Trac #8030, which is merged,
fixed at Trac #9102, awaiting review.) This symbol seems to be
provided by the AMS packages amssymb and/or amsfonts. On my tex
installation, both are provided in texmf-texlive/tex/latex/amsfonts/,
so I think these are fairly standard packages to expect a user/
developer to have.

Limited poking around shows:

(1) In doc/common/macros.tex, there is the line

\usepackage{amsmath}

but this file makes no mention of amssymb or amsfonts

(2) In doc/common/conf.py (which looks Sphinx-specific?) there is the
line

latex_elements['preamble'] = '\usepackage{amsmath}\n
\usepackage{amsfonts}\n'

Questions:

(a) Is the distinction conscious, or is this an omission of AMS
symbols on the PDF side?

(b) If in need of fixing, is macros.tex the place to add?

(c) And if so, is amsfonts superior to amssymb, or vice versa (or
both?)? I always have good luck with amssymb only. I would assume we
want the same macros available for both HTML and PDF versions of the
docs?

Thanks for any history, input, advice.

Rob

### Jason B Hill

Jun 3, 2010, 4:52:36 PM6/3/10

amssymb is a subset of amsfonts, and is only required when the font used isn't otherwise defined as a math-capable font. So, it isn't surprising that this is working fine when building to HTML... although I'm not as familiar with the latex -> html process.

amsfonts/amssymb should most likely only be included when building to PDF is my guess. If you reference symbol paths multiple times, latex gets unhappy. I.e.,

\usepackage{amssymb}
\usepackage[T1]{fontenc}
\usepackage[bitstream-charter]{mathdesign}

will return an error, since then \leqslant, for instance, is defined twice.

--
To post to this group, send an email to sage-...@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

### Jason B Hill

Jun 3, 2010, 4:57:44 PM6/3/10

I should be more clear. I'd try including \usepackage{amssymb} in macros.tex and see if you can build to HTML without errors. If errors occur, then try limiting the include to non-HTML output. It is curious that other symbols are rendering perfectly given this lack of inclusion for amssymb... but this may have to do with the loading of OT2?

Jason

### John H Palmieri

Jun 3, 2010, 7:45:48 PM6/3/10
to sage-devel
On Jun 3, 1:04 pm, Rob Beezer <goo...@beezer.cotse.net> wrote:
> Mitesh Patel discovered that the tex macro "\leqslant" (a slanted
> inequality) breaks the PDF reference manual, while it survives just
> fine in the HTML version.  (Introduced at Trac #8030, which is merged,
> fixed at Trac #9102, awaiting review.)  This symbol seems to be
> provided by the AMS packages  amssymb  and/or  amsfonts.  On my tex
> installation, both are provided in  texmf-texlive/tex/latex/amsfonts/,
> so I think these are fairly standard packages to expect a user/
> developer to have.
>
> Limited poking around shows:
>
> (1) In  doc/common/macros.tex, there is the line

As far as I know, the file macros.tex is unused. See below. (I think
it is still around because it has occasionally been useful to know
what macros used to be included in the documentation. Perhaps it has
served its purpose and should die a graceful death...)

> \usepackage{amsmath}
>
> but this file makes no mention of amssymb or amsfonts
>
> (2) In doc/common/conf.py (which looks Sphinx-specific?) there is the
> line
>
> latex_elements['preamble'] = '\usepackage{amsmath}\n
> \usepackage{amsfonts}\n'

This should be the relevant line.

You can test this: prepare the pdf (or the latex) documentation, for
example

sage -docbuild tutorial latex (or pdf)

and look at the file in SAGE_ROOT/devel/sage/doc/output/latex/en/
tutorial/. Its preamble should include the lines from
latex_elements['preamble'], along with various macros imported from
sage/misc/latex_macros.py, but should not include anything from
macros.tex.

> Questions:
>
> (a) Is the distinction conscious, or is this an omission of AMS
> symbols on the PDF side?

The distinction is irrelevant, because the file macros.tex is unused.

> (b) If in need of fixing, is macros.tex the place to add?

No.

> (c) And if so, is  amsfonts  superior to  amssymb, or vice versa (or
> both?)?  I always have good luck with amssymb only.  I would assume we
> want the same macros available for both HTML and PDF versions of the
> docs?

If I make a test file which just includes \$\leqslant\$, it bombs if I
use the amsfonts package, but if works if I use amssymb. So that's
what I would try.

--
John

### John H Palmieri

Jun 3, 2010, 7:57:08 PM6/3/10
to sage-devel
On Jun 3, 4:45 pm, John H Palmieri <jhpalmier...@gmail.com> wrote:

> If I make a test file which just includes \$\leqslant\$, it bombs if I
> use the amsfonts package, but if works if I use amssymb.  So that's
> what I would try.

By "that's what I would try", I mean "that's the package I would add
to latex_elements['preamble']".

--
John

### Rob Beezer

Jun 3, 2010, 7:59:34 PM6/3/10
to sage-devel
John and Jason,

Thanks for all the advice and clarifications. I'll run the suggested
experiments and report a ticket number here once its up.

Rob

On Jun 3, 4:45 pm, John H Palmieri <jhpalmier...@gmail.com> wrote:

### Rob Beezer

Jun 4, 2010, 1:13:20 AM6/4/10
to sage-devel
In amssymb.sty, I find:

\RequirePackage{amsfonts}[1995/01/01]

\DeclareMathSymbol{\leqslant} {\mathrel}{AMSa}{"36}

so if I understand right, modifying the preamble string in conf.py to
replace \usepackage{amsfonts} by \usepackage{amssymb} will still pull
in the amsfonts package, plus add some new macros for other symbols.

This seems to work fine in limited testing (including handling
\leqslant properly) and I'll run some full-scale tests (including
trashing macros.tex) on a fresh install.

Rob