0

I want to draw this page (without the dots) on a landscape page, I found out how to draw from extreme points of a page but it doesn't work for landscape page.

My try to draw an horizontal line on top :

\usepackage{pdflscape}
\usepackage{tikz}

\pagestyle{empty}

\begin{document}
\begin{landscape}
\begin{tikzpicture}[remember picture, overlay]

\draw [thick, cap=round] ([yshift=-5mm] current page.north west) -- ([yshift=-5mm] current page.north east);
\end{tikzpicture}
\end{landscape}
\end{document}
Hibou
  • 591
  • This is an old problem (see https://tex.stackexchange.com/questions/226678/how-can-i-maintain-the-current-page-nodes-for-portrait-when-temporarily-entering). The easy solution is to not use landscape and just rotate all the nodes. – John Kormylo May 27 '20 at 02:43

1 Answers1

1

This solution takes a normal tikzpicture and centers it in landscape page. To fill the page, all you have to do is make sure it is \paperheight wide and \paperwidth high.

\documentclass{article}
%\pdfpagewidth=\paperwidth
%\pdfpageheight=\paperheight
\usepackage{pdflscape}
\usepackage{tikz}

\newlength{\margin}

\begin{document}

\begin{landscape}
\pagestyle{empty}%
\ifodd\value{page}\relax
  \margin=\oddsidemargin
\else
  \margin=\evensidemargin
\fi
\noindent\hspace{\dimexpr 1in+\topmargin+\headheight+\headsep+\linewidth-\paperheight}% left side of page
\rlap{\raisebox{\dimexpr 1in+\margin+\topskip-\height}[0pt][0pt]{%
\parbox[c][\paperwidth][c]{\paperheight}{\centering% center contents
\begin{tikzpicture}
  \draw[red] (0,0) -- (\paperheight,\paperwidth);
  \draw[blue] (\paperheight,0) -- (0,\paperwidth);
\end{tikzpicture}%
}}}
\end{landscape}
\end{document}

To make it easier to use, I created environment LSpage. The lrbox is used just to put the contents inside \raisebox etc.

\documentclass{article}
\usepackage{pdflscape}
\usepackage{tikz}

\newsavebox{\LSbox}

\newenvironment{LSpage}{\begin{lrbox}{\LSbox}\ignorespaces}% BODY goes here
{\end{lrbox}%
\begin{landscape}%
  \thispagestyle{empty}%
  \ifodd\value{page}\relax
    \dimen0=\oddsidemargin
  \else
    \dimen0=\evensidemargin
  \fi
  \noindent\hspace{\dimexpr 1in+\topmargin+\headheight+\headsep+\linewidth-\paperheight}% left side of page
  \rlap{\raisebox{\dimexpr 1in+\dimen0+\topskip-\height}[0pt][0pt]{%
  \parbox[c][\paperwidth][c]{\paperheight}{\centering\usebox\LSbox}}}
\end{landscape}}

\begin{document}
\begin{LSpage}
\begin{tikzpicture}
  \draw[red] (0,0) -- (\paperheight,\paperwidth);
  \draw[blue] (\paperheight,0) -- (0,\paperwidth);
\end{tikzpicture}
\end{LSpage}
\end{document}
John Kormylo
  • 79,712
  • 3
  • 50
  • 120
  • I prefer this solution than the one suggested on the comments, it works perfectly, thank you ! – Hibou May 27 '20 at 09:43