Does sagetex require math environment around \sage{}?

asked 2016-09-04 06:53:11 -0500

qwfwq gravatar image

updated 2017-08-01 12:17:48 -0500

FrédéricC gravatar image

I have problems in typesetting the sagetex example file example.tex with the sage engine in TeXShop 3.71. Namely, the output of the command \sage{pascals_triangle(n)} near the end is a string containing LaTeX code, which should then be processed as LaTeX input by LaTeX. However, the typesetter complains that the $$ around the sage output are missing. Putting them results in the string be reproduced verbatim in the output, which is not the expected behavior. I checked that at least in my current version of sagetex.sty ALL output of \sage{} is expected to be placed in a math environment, otherwise a LaTeX error is raised. In the documentation, it is mentioned that it is useful, but not generally required, to put \sage{} commands in a math environment. I remember that the file was smoothly typeset a year or two ago. Has anything changed in the meantime?

edit retag flag offensive close merge delete


Please provide more detail: version of Sage, version of SageTeX, operating system.

slelievre gravatar imageslelievre ( 2016-09-05 08:11:49 -0500 )edit