2

When the preview package is loaded, the tikzpicture/figure environment that I am trying to isolate becomes set too high, resulting in the top of the image being cut off. (This is similar behavior to the "Side Question" part of Code to ignore all of document except for list environments and sections, so I don't believe it to be directly related to the tikzpicture or figure environments, nor the floats option.)

However, when I load the preview package with the tightpage option, everything comes out fine (so long as I have made the papersize big enough using geometry beforehand, as has been mentioned in this answer). I'd like to be able to have all figures on a common page size, however, so tightpage isn't really what I'm after in this case.

What causes preview to incorrectly place the content and effectively trim off the top?


preview version 11.87, dated 2010/02/14


MWE:

\documentclass[]{article}

\usepackage[a3paper,landscape]{geometry} % Make paper super big, fixes tightpage option cutting off right of image

% This works okay now with tightpage option set once papersize is made bigger
%\usepackage[active,floats,delayed,tightpage,pdftex]{preview} 

% Without tightpage, this form still cuts off the *top* of the image
\usepackage[active,floats,delayed,pdftex]{preview} 

% Define a few styles for use in making the figures
\usepackage{tikz}
\usetikzlibrary{shadows,arrows,positioning}

\tikzstyle{block}=[
    draw, fill=blue!80!black!20,
    anchor=north,
    text width=13.0em, text centered,
    minimum height=1.5em,drop shadow]
\tikzstyle{flowline}=[
    draw, very thick,
    color=black, -latex,
    font=\tt]

\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[]
% Nodes
\path             node  (p1)    [block] {Flowchart Block Text};
\path (p1.south)+(0,-1.5) node  (p2)    [block] {Flowchart Block Text};
\path (p2.south)+(0,-1.5) node  (p3)    [block] {Flowchart Block Text};
\path (p3.south)+(0,-1.5) node  (p4)    [block] {Flowchart Block Text};

% Connectors
\path   [flowline]  (p1.south) -- node [right,align=left] {Flow Label} (p2);
\path   [flowline]  (p2.south) -- node [right] {Flow Label} (p3);
\path   [flowline]  (p3.south) -- node [right] {Flow Label} (p4);

% Alternate Start
\node (p1alt) [block,left=of p1,text width=10em] {Flowchart Block Text};
\path   [flowline, dashed]  (p1alt.south) |- node {} (p2.west);

% Optional Output
\node (next) [block,right=of p4,text width=10em] {Flowchart Block Text};
\path   [flowline, dashed]  (p4.east) -- node {} (next.west);
\end{tikzpicture}%
\label{workflow}%
\end{figure}%
\end{document}
  • 1
    Weird. It almost looks as if it is placing the graphic on the baseline (of what would be the first line of text). – cfr Jun 30 '14 at 21:49
  • 1
    I don't know why this happens, but the option baseline=0 to tikzpicture seems to fix the problem. – giordano Jul 2 '14 at 17:22
  • @giordano : I confirm. – Clément Jul 3 '14 at 10:16
  • @doed This question is about the LaTeX preview package, not about the AUCTeX preview feature (based on the LaTeX preview package and created by the same author). – giordano Jul 5 '14 at 15:58
4
+100

I don't know why this happens, but the option baseline=0 to tikzpicture seems to do the trick:

Without baseline=0 option:

Without <code>baseline=0</code> option

With baseline=0 option:

With <code>baseline=0</code> option

  • This provides a workaround, but it still doesn't answer the original question: why is this behavior seen? Am I doing something wrong? Is there a bug? – cslstr Jul 5 '14 at 17:13
  • @cslstr As I already said: I don't have a clue. If you want to report a bug for the preview package, please write an email to bug-auctex@gnu.org. – giordano Jul 5 '14 at 17:27
  • @giordano interesting. I played with it a bit, and I could be wrong whether it's a bug with that package, but I get the same output as your answer, as long as the figure environment is not in the document. – doed Jul 6 '14 at 13:16
  • @giordano I've awarded you the full bounty (why not?) but have not accepted you answer at this point as I feel like the underlying question still does not have a complete answer. – cslstr Jul 10 '14 at 16:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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