4

I see many similar posts, but trying all of the suggestions has not solved my problem. I have a tikz picture as the only content in a standalone document. The goal is to produce an image for a printed board based on the template here.

The code I have so far is:

\documentclass[border=0mm]{standalone}

\usepackage{tikz}

\def\cutlinet{38.0/300.0}
\def\cutlinel{42.0/300.0}
\def\cutlineb{3034.0/300.0}
\def\cutliner{4838.0/300.0}

\def\foldlinex{2440.0/300.0}

\def\height{3075.0/300.0}
\def\width{4875.0/300.0}

\newcommand{\drawoverlay}{%
    \node [anchor=south west, inner sep=0mm, outer sep=0mm] at (0,0) {\includegraphics[angle=90, width=16.25in, height=10.25in] {big-mat.png}};
}

\newcommand{\drawguides}{%
    \draw [blue] (\cutlinel,0) -- (\cutlinel,\height);
    \draw [blue] (\cutliner,0) -- (\cutliner,\height);
    \draw [blue] (0,\cutlinet) -- (\width,\cutlinet);
    \draw [blue] (0,\cutlineb) -- (\width,\cutlineb);

    \draw [blue] (\foldlinex,0) -- (\foldlinex,\height);
}


\begin{document}
\noindent\begin{tikzpicture}[x=1in,y=1in]

\drawoverlay
\drawguides

\end{tikzpicture}
\end{document}

You can see many explicit attempts to remove margins and borders from the image. I have no idea which are necessary (I think outer sep and the noindent shouldn't be, but I don't know).

Even with all of these attempts the resulting document is not quite the right size:

$ pdfinfo output.pdf
Creator:         XeTeX output 2018.08.26:2025
Producer:       xdvipdfmx (20180217)
CreationDate:   Sun Aug 26 20:25:04 2018 EDT
Tagged:         no
UserProperties: no
Suspects:       no
Form:           none
JavaScript:     no
Pages:          1
Encrypted:      no
Page size:      1170.4 x 738.4 pts
Page rot:       0
File size:      488406 bytes
Optimized:      no
PDF version:    1.5

Note that the page size is about 16.26x10.256in, while the result should be 16.25x10.25in.

Opening up the document I can clearly see some space above and to the right of it. Is there any way to remove that space?

  • The edit is incorrect. I want to remove the whitespace that tikz creates. The title was to be parsed as "Tikz: Remove whitespace ..." perhaps better would be "Tikz adds whitespace ..." or "Remove added whitespace ... by Tikz" – LambdaBeta Aug 27 '18 at 0:40
  • The white space is part of the PNG you're using. TikZ isn't adding it at all. – cfr Aug 27 '18 at 1:00
5

This is the PNG you are using:

original PNG

Here is the output from your code:

Ti*k*Zed PNG

TikZ isn't adding white space. The white space is in the PNG.

| improve this answer | |
  • That's a little embarrassing. I just assumed that unexpected whitespace had to be a tikz problem since I have that problem so often, but you are right - its hiding in the image! – LambdaBeta Aug 27 '18 at 1:04
  • 1
    @LambdaBeta It does do that, I agree. But, this time, it is not guilty. I guess there's a reason they don't tell juries whether defendants have a criminal record already :-). – cfr Aug 27 '18 at 1:05

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.