0

I am getting some sort of undesirable left bleed despite my attempts to eradicate it when I try to use geometry together with TikZ:

\documentclass{article}

\usepackage{tikz}
\pagestyle{empty}
\setlength{\topskip}{0in}

\usepackage[%
        margin=0in,
    paperwidth= 8in,
    paperheight= 10in
        ]{geometry}

\begin{document}

\pagecolor{blue}

\begin{tikzpicture}[overlay]
  \draw[color=yellow, fill=yellow,opacity=0.5] (0in,0in) rectangle (8in,-10in);
\end{tikzpicture}

\end{document}

The result is below. This must be an obvious error, probably some magic parameter incantation that I am missing, but I am not sure where to look.

unwilling blue blocks

1
  • 2
    What you wanna achieve from this? Adding background color to the page? If you set the margin to be zero what is the rest of the document layout should be?
    – Tom
    Jun 20 at 6:51

1 Answer 1

1

This simply happens because of the indentation. Compare

Lorem ipsum

\noindent
Lorem ipsum

enter image description here

Thus, the solution is simply to add \noindent before your tikz

\documentclass{article}

\usepackage{tikz}
\pagestyle{empty}
\setlength{\topskip}{0in}

\usepackage[%
        margin=0in,
    paperwidth= 8in,
    paperheight= 10in
        ]{geometry}

\begin{document}

\pagecolor{blue}

\noindent
\begin{tikzpicture}[overlay]
  \draw[color=yellow, fill=yellow,opacity=0.5] (0in,0in) rectangle (8in,-10in);
\end{tikzpicture}

\end{document}

enter image description here

1
  • dumb me...I should have realized this! probably the 6,000th version of this error on tex.stackexchange.
    – ivo Welch
    Jun 20 at 18:21

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.