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}
1

1 Answer 1

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}
1
  • I prefer this solution than the one suggested on the comments, it works perfectly, thank you !
    – Hibou
    Commented May 27, 2020 at 9:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .