0

MWE:

\documentclass[11pt]{article}
\usepackage[margin=1in]{geometry}

%landscape
\usepackage{pdflscape}

%tikz
%https://www.sharelatex.com/blog/2013/08/29/tikz-series-pt3.html
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}
\tikzstyle{file} = [rectangle, rounded corners, minimum width=4cm, minimum height=1cm,text centered, draw=black, fill=blue!30]
\tikzset{trapezium stretches=true} % http://tex.stackexchange.com/questions/58555/how-to-control-text-margin-in-tikz-shapes
\tikzstyle{output} = [trapezium, trapezium left angle=70, trapezium right angle=70, minimum width=1cm, minimum height=1cm, text centered, draw=black, fill=green!30]
\tikzstyle{arrow} = [thick,->,>=stealth]


\begin{document}

\begin{landscape}

\begin{center}

\begin{tikzpicture}[node distance=7cm]

\useasboundingbox (current page.south west) rectangle (current page.north east);
\node (A) [file, xshift = 2cm] at (current bounding box.north west) {A};
\node (B) [file, right of=A] {B};
\node (C) [file, right of=B] {C};
\node (D) [file, below of=B, yshift = 5cm] {D};
\node (E) [output, below of=D, yshift = 5cm] {E};
\draw [red] (current bounding box.south east) rectangle (current bounding box.north west);

\draw [arrow] (A) -- (B);

\draw [arrow] (B) -- (C);
\draw [arrow] (B) -- (D);
\draw [arrow] (D) -- (E);

\end{tikzpicture}

\end{center}

\end{landscape}

\end{document}

enter image description here

This is particularly problematic, as it creates a blank page prior to the image. How can I fix this? The main reason for using the bounding box was to start the image on the top left of the landscape page.

3
  • @JohnKormylo Doing \rule{\textheight}{0pt} \begin{tikzpicture}[remember picture, overlay, node distance=7cm] after \begin{center} gave me a "Dimension too large" error. Dec 6, 2016 at 15:53
  • In landscape all the (current page) anchors are messed up. Dec 6, 2016 at 16:04
  • @JohnKormylo If the current page anchors cannot be used, what would be a workaround? Dec 6, 2016 at 16:08

2 Answers 2

1

This will get you started. It creates node (page) which is set up for landscape.

\documentclass[11pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage{tikz}

%landscape
\usepackage{pdflscape}

\begin{document}

\begin{landscape}
\thispagestyle{empty}
\noindent\begin{tikzpicture}[remember picture,overlay]
\ifodd\value{page}
  \coordinate (nw) at (1in+\topmargin+\headheight+\headsep+\linewidth-\paperheight,1in+\oddsidemargin+\topskip);
\else
  \coordinate (nw) at (1in+\topmargin+\headheight+\headsep+\linewidth-\paperheight,1in+\evensidemargin+\topskip);
\fi
\node (page) [anchor=north west,inner sep=0pt,outer sep=0pt,text height=\paperwidth,text width=\paperheight] at (nw) {};

\draw[red] (page.south west) -- (page.north east);
\draw[black] (page.north west) -- (page.south east);

\end{tikzpicture}
\end{landscape}

\end{document}
0

Thank you to John Kormylo for guidance.

\documentclass[11pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}
\tikzstyle{file} = [rectangle, rounded corners, minimum width=4cm, minimum height=1cm,text centered, draw=black, fill=blue!30]
\tikzset{trapezium stretches=true} % http://tex.stackexchange.com/questions/58555/how-to-control-text-margin-in-tikz-shapes
\tikzstyle{output} = [trapezium, trapezium left angle=70, trapezium right angle=70, minimum width=1cm, minimum height=1cm, text centered, draw=black, fill=green!30]
\tikzstyle{arrow} = [thick,->,>=stealth]

%landscape
\usepackage{pdflscape}

\begin{document}

\begin{landscape}
\thispagestyle{empty}
\noindent\begin{tikzpicture}[remember picture,overlay,node distance=7cm]
\ifodd\value{page}
  \coordinate (nw) at (1in+\topmargin+\headheight+\headsep+\linewidth-\paperheight,1in+\oddsidemargin+\topskip);
\else
  \coordinate (nw) at (1in+\topmargin+\headheight+\headsep+\linewidth-\paperheight,1in+\evensidemargin+\topskip);
\fi
\node (page) [anchor=north west,inner sep=0pt,text height=\paperwidth,text width=\paperheight] at (nw) {};

\node (A) [file, xshift = 2in, yshift = -1in] at (page.north west) {A};
\node (B) [file, right of=A] {B};
\node (C) [file, right of=B] {C};
\node (D) [file, below of=B, yshift = 5cm] {D};
\node (E) [output, below of=D, yshift = 5cm] {E};

\draw [arrow] (A) -- (B);

\draw [arrow] (B) -- (C);
\draw [arrow] (B) -- (D);
\draw [arrow] (D) -- (E);

\draw[red] (page.south west) -- (page.north east);
\draw[black] (page.north west) -- (page.south east);

\end{tikzpicture}
\end{landscape}

\end{document}

enter image description here

You must log in to answer this question.

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