5

I want to use TikZ page anchors to draw a sheet with a mix of text and graphics. So I started with a simple rectangle that would cover the entire page:

\fill[red] (current page.north west) rectangle (current page.south east);

Except it doesn't, there's a white space on the left of the pdf.

Here is my MWE:

\documentclass[oneside]{scrartcl}
\usepackage{tikz}
\usepackage[margin=0cm]{geometry}

\begin{document}
\tikz
    \fill[red] (current page.north west) rectangle (current page.south east);
\end{document}

The result is a red rectangle shifted horizontally by a small distance to the right.

My research to a solution led me to this seemingly similar issue on TeX: TikZ current page.north west shifted ~4pts?

But it doesn't seem to apply (I've tried blindly something like, and then with stuff like inner sep=-4pts):

\fill[red] (current page.north west)[inner sep=0pt] rectangle (current page.south east);

A lot of the suggested link also seemed promising but I found no answer after going through them.

So my question is:

Why don't I have a nice red rectangle covering the whole page?

Optional question: Can I fix it to keep a somewhat natural syntax (I want (current page.north west) rectangle (current page.south east); to be the whole page) ?

7

There is a paragraph indentation. The white space is gone with \noindent:

\documentclass[oneside]{scrartcl}
\usepackage{tikz}
\usepackage[margin=0cm]{geometry}

\begin{document}
\noindent
\tikz
    \fill[red] (current page.north west) rectangle (current page.south east);
\end{document}
| improve this answer | |
5

Use the overlay and remember picture key:

\documentclass[oneside]{scrartcl}
\usepackage{tikz}
\usepackage[margin=0cm]{geometry}

\begin{document}
\tikz[remember picture,overlay]
    \fill[red] (current page.north west) rectangle (current page.south east);
\end{document}
| improve this answer | |

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.