Skip to content

\halign in TikZ and image generation #760

Description

@matteosecli

Hi all, I've encountered a couple of problems in processing a simple TikZ picture. My MWE is

\documentclass[tikz]{standalone}
\usepackage{tikz}
\definecolor{myred}{rgb}{0.7,0.1,0.1}
\definecolor{myblue}{rgb}{0,0.447,0.741}    
\begin{document}
    \begin{tikzpicture}
        \tikzset{>=latex}

        %1,0,0
        \draw [ultra thick] (-1,-3) -- (1,-3) node[midway,below,align=center] {\null \\ \scriptsize $|1,0,0\rangle$};
        \draw [very thick, myblue, ->] (-0.5,-3.5) -- (-0.5,-2.5);
        \draw [very thick, myblue, ->] (0.5,-2.5) -- (0.5,-3.5);

        %2,0,0
        \draw [ultra thick] (-1,0.5) -- (1,0.5) node[midway,below,align=center] {\null \\ \scriptsize $|2,0,0\rangle$};
        \draw [very thick, myblue, ->] (-0.5,0) -- (-0.5,1);
        \draw [very thick, myblue, ->] (0.5,1) -- (0.5,0);

        %2,1,-1
        \draw [ultra thick] (-4,2) -- (-2,2) node[midway,below,align=center] {\null \\ \scriptsize $|2,1,-1\rangle$};
        \draw [very thick, myblue, ->] (-3.5,1.5) -- (-3.5,2.5);
        \draw [very thick, myblue, ->] (-2.5,2.5) -- (-2.5,1.5);

        %2,1,0
        \draw [ultra thick] (-1,2) -- (1,2) node[midway,below,align=center] {\null \\ \scriptsize $|2,1,0\rangle$};
        \draw [very thick, myblue, ->] (-0.5,1.5) -- (-0.5,2.5);
        \draw [very thick, myblue, ->] (0.5,2.5) -- (0.5,1.5);

        %2,1,+1
        \draw [ultra thick] (4,2) -- (2,2) node[midway,below,align=center] {\null \\ \scriptsize $|2,1,1\rangle$};
        \draw [very thick, myblue, ->] (2.5,1.5) -- (2.5,2.5);
        \draw [very thick, myblue, ->] (3.5,2.5) -- (3.5,1.5);
    \end{tikzpicture}
\end{document}

The output, as processed by PDFLaTeX, is MWE.pdf. I've avoided here to use the braket package (which I normally use for this picture, anyway) just to focus on the problem. When I convert using latexml MWE.tex --destination=MWE.xml, it keeps spitting out errors of the kind

Error:malformed:ltx:Math <ltx:Math> isn't allowed here
    at /home/cloud/Dropbox/UNI/MANY_BODY_THEORY/Exercises/ALL_EXERCISES_LATEXML/BUG/MWE.tex; line 10 col 111
    Currently in ...<svg:g _font="Font[nullfont,medium,upright,1..." stroke-width="1.6pt" _box="LaTeXML::Core::Whatsit=HASH(0x...">...<svg:g _font="Font[nullfont,medium,upright,1..." transform="matrix(1 0 0 1 -26.98 -173.64)" _box="LaTeXML::Core::Whatsit=HASH(0x...">...<svg:g _box="LaTeXML::Core::Alignment=HASH(..." _font="Font[serif,medium,upright,10,b..." class="ltx_tikzmatrix">...<svg:g _box="LaTeXML::Core::Alignment=HASH(..." _font="Font[serif,medium,upright,10,b..." class="ltx_tikzmatrix_row">...<svg:g _box="LaTeXML::Core::Alignment=HASH(..." _font="Font[serif,medium,upright,10,b..." class="ltx_tikzmatrix_col ltx_align_center"/>
    In Core::Document[@0x71888d0] at /home/cloud/Dropbox/UNI/MANY_BODY_THEORY/Exercises/ALL_EXERCISES_LATEXML/BUG/MWE.tex; line 10 col 111
     <= Core::Definition::Constructor[$] <= Whatsit[\@@BEGININLINEMATH,Core::List... <= Core::Document[@0x71888d0] <= ...
..

which seems to show that LaTeXML doesn't like my math labels in the picture. Then, by doing latexmlpost --svg --format=html5 --verbose --destination=MWE.html MWE.xml I almost get the correct output, but without the labels '|x,y,z>'. And here my first question: is it possible to have an SVG output to an external file, i.e. generate some 'picture1.svg' by direct LaTeX compilation and then include the image file in the html? I've tried with multiple options, but I haven't figured out a way to do that.

So, I've tried to generate a PNG file instead (because I know that LaTeXML uses LaTeX to generate PNG images) by using latexmlpost --pictureimages --verbose --destination=MWE.html MWE.xml but here LaTeX completely fails the compilation, and it gives me errors of the kind

! Package xcolor Error: Undefined color `myblue'.

See the xcolor package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.60 ...pgfsys@setlinewidth{1.2pt}{}\color{myblue}
                                                  \colorlet{pgf@tempcolor}{....

The DVI output in the log folder is completely empty, apart from a small square in the upper left corner.

I'm on Ubuntu 14.04, with TeXLive 2013 (TeX 3.1415926-2.5-1.40.14), and the latest Git version of LaTeXML (Oh, btw, I've set up a PPA that builds everyday the master branch of this repo and produces Debian packages for different versions of Ubuntu. If you want to do some tests of the packages or leave me a feedback about them, this is the PPA.)

Thanks in advance for your help! 😄

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions