The short version: Sage code in Ximera won't display strings correctly, regardless of method used.
The long version:
Sage with Sagetex has two different mechanisms for displaying a string written in sage.
First method: \sage call of a variable that is a string;
MWE:
If you compile the above, the PDF looks normal, albeit a little goofy (for reasons I will describe in the moment) outputting a block-text of a string. However, if you publish it to a website with Ximera, you end up getting the string \texttt{a{ }string} displayed.
If you dig through the .sout file you will see that, weirdly, sage processes strings that are called via \sage by wrapping them in \text{\texttt{STRINGHERE}} with { } used to inject spaces. Presumably this is because \sage is only callable within mathemode, so they want the \text to denote it as text, and to make it line up nicely with other choices in display/math mode they wrap the internal mechanics with \texttt, which is a block-text style that uses uniform width text. However; weirdly, Ximera seems to be interpreting that \text command almost like a verbatim, so it is inputting the entire contents of the \text, including the \texttt command and all the associated braces.
Luckily, the guys that make sage realized we'd like to call strings outside of mathemode, and gave us the \sagestr command, which is callable in or out of mathemode. This simply displays the string of the variable as is, so if you compile the content of the top you will see "astring", a string and a string, where the first one looks goofy because it's text in mathemode, so latex interprets it as variables and removes whitespace.
Again, however, Ximera seems to not like the idea of sending sage text that isn't in mathemode out to be processed, so the line not in mathemode just gets left as some weird @sageinline type reference, the one in the top comes out looking like a sequence of variables (ie not intelligible) and the last one comes out as \sagestr{string} because, again, text seems to turn it into verbatim for some reason.
For reference, I am running the Xronos version of this, which is the release right before the .dtx release, but this has been an ongoing problem since sage was released (for us at UF anyway) as supported in Ximera. I'm using the content of "Optional Packages" folder, specifically the "PackageLoader.sty", the "Useful-Sage-Macros.tex" and the "Useful-Validators.tex" file to produce this issue.
The short version: Sage code in Ximera won't display strings correctly, regardless of method used. The long version: Sage with Sagetex has two different mechanisms for displaying a string written in sage.
First method: \sage call of a variable that is a string; MWE:
If you compile the above, the PDF looks normal, albeit a little goofy (for reasons I will describe in the moment) outputting a block-text of
a string
. However, if you publish it to a website with Ximera, you end up getting the string\texttt{a{ }string}
displayed. If you dig through the .sout file you will see that, weirdly, sage processes strings that are called via\sage
by wrapping them in\text{\texttt{STRINGHERE}}
with{ }
used to inject spaces. Presumably this is because\sage
is only callable within mathemode, so they want the\text
to denote it as text, and to make it line up nicely with other choices in display/math mode they wrap the internal mechanics with\texttt
, which is a block-text style that uses uniform width text. However; weirdly, Ximera seems to be interpreting that\text
command almost like a verbatim, so it is inputting the entire contents of the\text
, including the\texttt
command and all the associated braces.Method 2: \sagestr command MWE:
Luckily, the guys that make sage realized we'd like to call strings outside of mathemode, and gave us the
\sagestr
command, which is callable in or out of mathemode. This simply displays the string of the variable as is, so if you compile the content of the top you will see "astring",a string
anda string
, where the first one looks goofy because it's text in mathemode, so latex interprets it as variables and removes whitespace. Again, however, Ximera seems to not like the idea of sending sage text that isn't in mathemode out to be processed, so the line not in mathemode just gets left as some weird@sageinline
type reference, the one in the top comes out looking like a sequence of variables (ie not intelligible) and the last one comes out as\sagestr{string}
because, again, text seems to turn it into verbatim for some reason.For reference, I am running the Xronos version of this, which is the release right before the .dtx release, but this has been an ongoing problem since sage was released (for us at UF anyway) as supported in Ximera. I'm using the content of "Optional Packages" folder, specifically the "PackageLoader.sty", the "Useful-Sage-Macros.tex" and the "Useful-Validators.tex" file to produce this issue.