3

There are many images I want to generate separately and import into my main tex document using \includegraphics. However, using the standalone documentclass generates an extra blank page after the image produced. If I change to \documentclass{article} (which I do not want as it doesn't crop to the correct size of the image), there is no extra page.

Here is a minimum working example.

\documentclass{standalone} % \documentclass{article} doesn't produce extra empty page
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node[label={left: $x$}] (x) at (0,0) {};
\end{tikzpicture}
\end{document}

How do I generate the image without the extra page? I'm using the command latexmk -dvi <imageName>.tex

Notes:

  • When opening the .dvi file, there is one page (with content), and a second empty page.
  • I run dvips <imageName>.dvi -o <imageName.eps. When opening the .eps file, there is one page (with content), and a second empty page.
  • I use \includegraphics to import the .eps file. This displays without issue in my main document, but the question remains open as to why the output .dvi file has two pages.
10
  • if I run the provided document with pdflatex I just get a single page. but as you say two with latex. hmmm Aug 10, 2021 at 18:49
  • tested at overleaf it gives one page in texlive 2018 but two in texlives from 2019 Aug 10, 2021 at 18:54
  • Interesting, @DavidCarlisle. I tried pdflatex -dvi <imageName>.tex and still had an extra page. My latexmk version is 4.67 and pdflatex is 3.14159265-2.6-1.40.21 (TeX Live 2020) Aug 10, 2021 at 18:55
  • 2
    it would be simpler to use pdflatex here and for your main document and then you could just directly include the pdf. Aug 10, 2021 at 19:00
  • 3
    use \documentclass[tikz]{standalone} or \standaloneenv{tikzpicture}. Then the environment is correctly setup. Aug 10, 2021 at 20:23

1 Answer 1

2

The solution from Ulrike Fischer in comments worked:

use \documentclass[tikz]{standalone} or \standaloneenv{tikzpicture}. Then the environment is correctly setup.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .