Use of \Bold in latex methods, and SageTeX

60 views
Skip to first unread message

John Cremona

unread,
May 8, 2017, 3:25:12 PM5/8/17
to SAGE support
In Sage 7.6:

sage: latex(QQ)
\Bold{Q}

but \Bold is not a standard LaTeX macro. However,

sage: show(QQ)
\newcommand{\Bold}[1]{\mathbf{#1}}\Bold{Q}

shows that the macro is defined somewhere in Sage itself.

Next, if I create a file mini.tex containing

\documentclass{article}
\usepackage{sagetex}
\begin{document}
\title{A Sage\TeX\ document}
The rational field is \sage{QQ}.
\end{document}

and run

pdflatex mini
sage mini.sagetex.sage
pdflatex mini

then the second time pdflatex runs there's an error when it encounters
the undefined \Bold macro. This can be fixed by adding the line
\newcommand{\Bold}[1]{\mathbf{#1}}
into the preamble, but surely this should not be necessary, and there
might be more "missing" macros.

I checked that the version of sagetex.sty being used is exactly the
one in the Sage version I was running.

John

John H Palmieri

unread,
May 8, 2017, 3:45:48 PM5/8/17
to sage-support
Hi John,

Within Sage, you can get the appropriate command with


sage: from sage.misc.latex_macros import sage_configurable_latex_macros
sage: sage_configurable_latex_macros
['\\newcommand{\\Bold}[1]{\\mathbf{#1}}']
sage: print(sage_configurable_latex_macros[0])

\newcommand{\Bold}[1]{\mathbf{#1}}


I'm not sure how SageTeX is supposed to handle this, and I'm surprised that it hasn't come up before. The use of \Bold{...} in Sage dates back to 2009: see sage/misc/latex_macros.py.

--
John

John Cremona

unread,
May 8, 2017, 3:54:21 PM5/8/17
to SAGE support
Thanks John.

On 8 May 2017 at 20:45, John H Palmieri <jhpalm...@gmail.com> wrote:
> Hi John,
>
> Within Sage, you can get the appropriate command with
>
>
> sage: from sage.misc.latex_macros import sage_configurable_latex_macros
> sage: sage_configurable_latex_macros
> ['\\newcommand{\\Bold}[1]{\\mathbf{#1}}']
> sage: print(sage_configurable_latex_macros[0])
> \newcommand{\Bold}[1]{\mathbf{#1}}
>
>
> I'm not sure how SageTeX is supposed to handle this, and I'm surprised that
> it hasn't come up before. The use of \Bold{...} in Sage dates back to 2009:
> see sage/misc/latex_macros.py.

I am also surprised since I have used SageTeX before without this
problem! In fact I was running it on a tex file which used to work.
On a different computer though...

John
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support...@googlegroups.com.
> To post to this group, send email to sage-s...@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages