On Sat, 03 Dec 2011 at 09:16AM -0800, Mark wrote:
> I'm trying to represent Sage non-native elements in a LaTeX document
> using SageTeX.  Sage generates the representation without complaint,
> but the result does not compile properly on the second LaTeX step
> (LaTeX-Sage-LaTeX*).  Latex complains about missing $ inserted.  I've
> included a simple illustration below with a numpy array.

The first place to look for these kind of problems is the .sagetex.sout
file, which in this case, has

newlabel{@sageinline1}{{%
\begin{array}{l}
\verb|[[1|\phantom{x}\verb|2]|\\
\phantom{x}\verb|[3|\phantom{x}\verb|4]]|
\end{array}}{}{}{}{}}

What strikes me there is \verb -- verbatim stuff does not play nicely
as the argument to another command.

The problem here is that NumPy matrices emit goofy LaTeX code. As a
workaround, you should convert your NumPy matrices to Sage matrices.
Here's one way to do it; perhaps someone else knows a better way:

\sage{matrix(npmatrix.tolist())}


Dan

--
---  Dan Drake
-----  http://mathsci.kaist.ac.kr/~drake
-------

Attachment: signature.asc
Description: Digital signature

Reply via email to