3.5 LaTeX and PyXPlot

The text command can straightforwardly be used to render simple one-line LaTeX strings, but sometimes the need arises to place more substantial blocks of text onto a plot. For this purpose, it can be useful to use the LaTeparbox or minipage environments1. For example:

text '\parbox[t]{6cm}{\setlength{\parindent}{1cm} \
\noindent There once was a lady from Hyde, \newline \
Who ate a green apple and died, \newline \
\indent While her lover lamented, \newline \
\indent The apple fermented, \newline \
and made cider inside her inside.}'
\includegraphics{examples/eps/ex_text1}

If unusual mathematical symbols are required, for example those in the amsmath package, such a package can be loaded using the set preamble command. For example:

set preamble \usepackage{marvosym}
text "{\Huge\Dontwash\ \NoIroning\ \NoTumbler}$\;$ Do not \
wash, iron or tumble-dry this plot."
\includegraphics{examples/eps/ex_text2}

Footnotes

  1. Remember, any valid LaTeX string can be passed to the text command and set label command.