I want to place a tikzpicture in landscape mode in the center of an A4 page. However, I can't use the \textwidth and \textheight commands because this will result in overfull \hbox... or overfull \vbox... errors and an empty first page. I assume there is some tiny margin or indentation somewhere somehow?

I've looked at a couple of threads here, but nothing worked so far. MWE:



  \draw (0, 0) rectangle (0.999\textwidth,0.999\textheight);

  % this will give "overfull \hbox..." or "overfull \vbox..." errors
  % and create an empty first page
  % \draw (0, 0) rectangle (\textwidth,\textheight);

enter image description here

Thank you!


Welcome! You need to take into account the line width. (I switched to article, as suggested by fractal.) On each end, the bounding box will be increased by \pgflinewidth/2, so you need to correct for that.


%\begin{center} %<- not needed
  \draw (0, 0) rectangle (\textwidth-\pgflinewidth,\textheight-\pgflinewidth);
|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.