I am making some big documents for my students (around 200 pages). During the lessons, they have to fullfill some blanks (that helps to keep them awake).
Therefore, I need 2 versions of my documents, one with blanks for the students and one with everything filled for me.
I have some macro to do this. They do the job, but they are probably far from clean because I'm not an expert in LaTeX altough I progress every day.
Here is a code sample :
\documentclass[a4paper,11pt]{book}
\usepackage[utf8]{inputenc}
\usepackage[francais]{babel}
\usepackage{ifthen}
\usepackage{lipsum}
\newcounter{ReplicateCount}
\newcommand{\Replicate}[2]{ %repeats #2 as many times as #1
\setcounter{ReplicateCount}{#1}
\whiledo{\value{ReplicateCount}>0}
{#2\addtocounter{ReplicateCount}{-1}}
}
\newcommand{\hide}[2]{
\ifthenelse{\equal{\edition}{E}}{
~\Replicate{#2}{
\pagebreak[3]\vspace*{1cm}}
}
{
#1
}
}
\begin{document}
\def\edition{P}
\hide{\lipsum}{3} %will produce \lipsum
\def\edition{E}
\hide{\lipsum}{3} %will do \hspace*{3cm}, on 2 subsequent pages if necessary
\end{document}
It works this way, at the beginning of my document, I decide which value to set to my variable \edition, and I just have one character to change to switch from student version to teacher version.
But here is my problem : of course, I need to leave more blanks on student version than the place it actually takes on my version. Therefore, the versions have different page numbers and this is unhappy. I would like that my version takes the exact same space than students (even if it leaves a blank at the end of every \hide call). I guess it would require a function that computes how much place a text actually takes on the printed version to adapt it. Also, I would like the macro to be working even if the hidden text is on 2 different pages.
Does anybody have an idea of how to make this work ? Thanks in advance for the help and hoping I could be sufficiently clear and apologizing in advance for my English, Im not native speaker ;-)
Hercule