sagemath / sagetex

Embed code, results of computations, and plots from the Sage mathematics software suite (https://www.sagemath.org) into LaTeX documents. Source repository for https://pypi.org/project/sagetex/ and https://ctan.org/pkg/sagetex
https://ctan.org/pkg/sagetex
Other
58 stars 22 forks source link

Update example.tex #43

Open 927589452 opened 5 years ago

927589452 commented 5 years ago

use the internal \ST command to typeset SageTeX

927589452 commented 5 years ago

as the example.tex seems to be the easiest reference for sagetex, extending it to showcase all commands seems useful

kcrisman commented 5 years ago

This is a nice idea. Since there is nice history of Dan documenting the code (and since it's likely people will read it to know how to do things), probably there should be a comment saying what that is for immediately before it. Also, what is your opinion on the later occurrence of Sage\TeX? I notice that one doesn't have the \textsf; I wonder if that was intentional because it was in a section not a title.

Finally, if you would like "official" recognition as a contributor we don't mind real names and do like acknowledging all contributors when possible. Thanks for pointing this change out!

927589452 commented 5 years ago

@kcrisman I just moved them all to ST and added a comment at the first use

kcrisman commented 5 years ago

You have a \textsf{\ST} which I'm not sure how that would look, but at any rate is redundant somehow.

Other than that, once of of us maintainers has a chance to build the file with ST and make sure it still looks good (which I assume is the case) I'm sure we can merge this.

927589452 commented 4 years ago

@kcrisman I prefer attribution to my handle (is the same on SE, trac, etc)

dimpase commented 4 years ago

This needs some work in the installation department: the problem is that somehow on the 1st run of make one ends up with

 Undefined control sequence.
\@title ...f embedding Sage in \LaTeX {} with \ST 

l.32 

which is due to the package not quite being ready at this point. If I re-run make, without cleaning, then things work.

kcrisman commented 4 years ago

Is it more of a race condition or more of a structural problem, do you think?

dimpase commented 4 years ago

sorry, it's a just the style file problem. There is no \ST macro in sagetex.sty:

I get the same error as in https://github.com/sagemath/sagetex/pull/43#issuecomment-553183410 if I just run latex example.tex (after I ran make enough times so that it completes without an error).

kcrisman commented 4 years ago

I see the issue now. All the .dtx files use this macro (where it's defined, I don't know), but example.tex is not this format. Maybe the Python preprocessor replaces it?

I could see several outcomes to this ticket - closing it as unneeded, making a new macro, perhaps others. I guess I'm leaning toward the former, since Dan probably would have done so if he had thought it helped. Dima, do you know offhand what the generated .tex files have for the \ST macro?

dimpase commented 4 years ago

I see the issue now. All the .dtx files use this macro (where it's defined, I don't know), but example.tex is not this format. Maybe the Python preprocessor replaces it?

I gather Python has nothing to do with it; indeed, one can run

latex sagetex.ins
latex sagetex.dtx

and get something ready to be run through Sage, no errors reported. No idea why this works with \ST.

dimpase commented 4 years ago

No idea why this works with \ST.

in fact, the macro is here: https://github.com/sagemath/sagetex/blob/6dbe41ac3c2e97f3b766914a727cded51854efd4/sagetex.dtx#L162

to make it go into the style file, one needs to tag it with <latex>.

%<latex> \newcommand{\ST}{\textsf{Sage\TeX}\xspace}

not sure we want such a short named macro to potentially clash with what people might use. I'd instead have something like

%<latex> \newcommand{\SageTeX}{\textsf{Sage\TeX}\xspace}

for the general public (and, naturally, example.tex)

kcrisman commented 4 years ago

That seems reasonable, though certainly not a high priority.