Example: Exam sheet

Published 2007-10-19 | Author: Alain Matthes

Overlays and the special current page node offers precise control of placement on a page. One application is to create exam sheets where candidate details can be hidden using a dog ears technique.

Author: Alain Matthes

Do you have a question regarding this example, TikZ or LaTeX in general? Just ask in the LaTeX Forum.
Oder frag auf Deutsch auf TeXwelt.de. En français: TeXnique.fr.

% Exam sheet
% Author: Alain Matthes
% Requires pdflatex and two compilations to place the overlays correctly
\documentclass{article}
\usepackage{tikz}
\begin{document}
\thispagestyle{empty}
\begin{tikzpicture}[remember picture, overlay]
\node [shift={(-8 cm,-8cm)}]  at (current page.north east)
{%
\begin{tikzpicture}[remember picture, overlay]
\draw(0,0) rectangle (8,8);
\draw [fill=gray] (0,8) -- (8,8) -- (8,0) -- cycle ;
\path[coordinate]
\foreach \k in {1,...,4}{%
(0 pt,8cm -\k *1.2cm) coordinate (d\k)} ;
\path[clip] (0,0) rectangle (8,8);
\foreach \k/\t in {1/Last Name,2/First Name,3/Birthday,4/Date}{%
\node[inner sep=0pt,rotate=-45,%
right=0.5cm,minimum height=12pt](f\k) at (d\k) {\t};
\draw  (f\k.south east)-- (8cm -\k * 1.2cm,-6pt );
}
\end{tikzpicture}
};
% Draw a page border
\draw (current page.north west) rectangle (current page.south east);
\end{tikzpicture}

\end{document}


• #1 Mehdi, January 17, 2012 at 1:13 a.m.

Very well done! I'm going to use this idea for my quizzes this term. :-)

• #2 Hans Linkels, April 15, 2013 at 5:30 p.m.

I downloaded the .tex file and compiled it. The two triangles in the top are drawn correctly. However the page border does not show up. I did not alter anything in the document.

When I include command \lipsum on the line after \end{tikzpicture}, the text is drawn trough the lower triangle, which might be correct becasue of the overlay property of the picture, but still it might not be what one wants.

I don't care much about that, because I am only interested in the page border.