I am creating SVG files from different stuff from my LaTeX document. For this, I am using the standalone package followed by pdf2svg.
This compiles:
\documentclass{article}
\usepackage{algorithmicx}
\usepackage{algpseudocode}
\begin{document}
\begin{algorithmic}
\Function {$foo$}{$id$}
\EndFunction
\end{algorithmic}
\end{document}
Using standalone instead of article crashes with:
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.8 \Function
{$foo$}{$id$}
What can I do? I need to export my algorithms to PDF/SVG.
My versions:
- standalone.cls 2012/05/20 v1.1a
- algorithmicx.sty 2005/04/27 v1.2
UPDATE: 27.06.2012 The same is happening with align:
\begin{document}
\begin{align*}
a\\
b
\end{align*}
\end{document}
The v-box hack helps:
\begin{document}
\vbox{
\begin{align*}
a\\
b
\end{align*}
}
\end{document}
\vboxalso with\setlength{\textwidth}{5cm}as a ugly hack. – percusse Jun 26 '12 at 18:07standaloneon ScribTeX:2010/03/27 v0.3aand the most current version ofalgorithmicx:2005/04/27 v1.2. – Werner Jun 26 '12 at 18:15standalone. Yes on ScribTex its working normally. Its surprising why this difference. – texenthusiast Jun 26 '12 at 18:29\vbox-hack works? Thesetlength-hack does not work for me. – Dennis Jun 26 '12 at 18:42setlengthcommand in your preamble after the package declarations to shorten the width. The reason for the functionality is that we hide the linebreaks and other complications into a box such that standalone just sees a box to be shown. And setlength helps to reduce the width of the box. – percusse Jun 26 '12 at 18:59setlengthis working. By mistake I compiled an other file. Thanks for vbox/standalone clarification. – Dennis Jun 26 '12 at 19:06