Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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:


        \Function {$foo$}{$id$}

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

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:


The v-box hack helps:

share|improve this question
You can put your algorithm into a \vbox also with \setlength{\textwidth}{5cm} as a ugly hack. –  percusse Jun 26 '12 at 18:07
For reference, this does not happen with standalone on ScribTeX: 2010/03/27 v0.3a and the most current version of algorithmicx: 2005/04/27 v1.2. –  Werner Jun 26 '12 at 18:15
On windows 7 and texlive 2011, i get the same error as Dennis with standalone. Yes on ScribTex its working normally. Its surprising why this difference. –  texenthusiast Jun 26 '12 at 18:29
Why does the \vbox-hack works? The setlength-hack does not work for me. –  Dennis Jun 26 '12 at 18:42
Put the setlength command 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:59
show 3 more comments

1 Answer

Use either the preview or the varwidth class option of standalone. As described in the manual the default is crop (not preview) since v1.0 and this does not support paragraphs or lists (and the mentioned environments are apparently based on lists).

share|improve this answer
Fyi: the manual for v1.1a says in the Introduction: The class uses by default the preview package –  Dennis Jun 28 '12 at 15:08
@Dennis: Mmm, maybe there is some old sentence somewhere. The description of the options however clearly states that crop is the default. –  Martin Scharrer Jun 28 '12 at 18:59
you're right. Because of that sentence I'm using crop so far. So I can just skip it :) –  Dennis Jun 28 '12 at 21:09
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.