2

What I want

Graph paper as a background on every page with one margin:

  • on odd pages the margin should be on the right
  • on even pages the margin should be on the left

What I got

So far I managed to get a margin on the right side of every page.

enter image description here

MWE

\documentclass{article}

\usepackage{tikz}

\usepackage{eso-pic}

\AddToShipoutPicture{%
  \begin{tikzpicture}[remember picture, overlay]

  \tikzset{normal lines/.style={black!20, very thin}} 
  \tikzset{margin lines/.style={black!20, thick}} 

  \node at (current page.south west){
    \begin{tikzpicture}[remember picture, overlay]

      \draw[style=normal lines,step=0.5cm] (0,0) grid +(210mm,297mm); 

      \draw[style=margin lines] (180mm,0)--(180mm,297mm); % odd page

    \end{tikzpicture}
  };
  \end{tikzpicture}
}

\usepackage{blindtext}

\begin{document}

\blindtext[20]

\end{document}

1 Answer 1

5

Is an \ifodd\value{page} <odd page> \else <even page> \fi conditional:

enter image description here

\ifodd\value{page}
  \draw[style=margin lines] (180mm,0)--(180mm,297mm); % odd page
\else
  \draw[style=margin lines] (30mm,0)--(30mm,297); % even page
\fi

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.