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.

This is not a major problem but all the same I would like to confirm that I am not doing anything wrong. Geometry package with showframe=true option is used to see if all the figures are within the margins. Also, tikz external library is used and the plot shows some spurious horizontal and vertical lines.

wrong plot

This happens only if showframe=true is set in geometry and the tikz external library is used. If external is switched off, the plot is drawn correctly. As I said earlier, since I am not going to display frame in the final draft, this is not a major issue.

MWE

\documentclass{report}
\usepackage[showframe=true,hmargin=3cm,vmargin=2cm]{geometry}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.7}

%Comment out to not use external library and get correct figure.
\usetikzlibrary{external}
\tikzexternalize

\begin{document}
  \begin{figure}
    \centering
    \begin{tikzpicture}
      \begin{axis}
      \end{axis}
    \end{tikzpicture}
  \end{figure}
\end{document}
share|improve this question
    
I think the comment of @JLDiaz should become an answer. Apparently, both packages change the TeX \shipout routine. As long as the resulting bounding box is correct... –  Christian Feuersänger Jan 3 '13 at 19:34
    
@JLDiaz Can you convert your comment to an answer? –  percusse Mar 11 '13 at 21:05
    
@percusse Done. –  JLDiaz Mar 12 '13 at 0:33

2 Answers 2

up vote 4 down vote accepted

Those spurious lines are the ones drawn by geometry package to delimit the position of the header and the main body.

Apparently when external mode is used, tikz draws the figure in the upper left corner of the page, and crops it at the appropiate size, but the layout marks are still visible.

share|improve this answer

I had the same problem and fixed it by writing the following after the \tikzexternalize command:

\tikzifexternalizing{\setkeys{Gm}{showframe=false}}{}
share|improve this answer

Your Answer

 
discard

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.