# Does sagetex require math environment around \sage{}?

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?

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