This question is related to one of my previous questions: Specifying exact placement of answers in exam tests
I would like to make exam tests that can be compiled without and with answers, and the answers should be placed exactly in the empty spaces between the questions. That is, everything except from the answers should overlap in the two compiled pdf files.
At the moment I achieve this with the following codes:
without answers:
\documentclass{article}
\usepackage{lipsum}
\usepackage{etoolbox}
\newtoggle{wta}
\settoggle{wta}{false}
\usepackage[T1]{fontenc}
\usepackage{enumitem}
\begin{document}
\begin{enumerate}
\item\parbox[t]{\linewidth}{
\lipsum[1][1]\\
\parbox[t][1.5cm][t]{\linewidth}{
\iftoggle{wta}{\lipsum[1][4-5]}{}}
}
\item\parbox[t]{\linewidth}{
\lipsum[1][1]\\
\parbox[t][1.5cm][t]{\linewidth}{
\iftoggle{wta}{\lipsum[1][4-5]}{}}
}
\end{enumerate}
\end{document}
With answers:
\documentclass{article}
\usepackage{lipsum}
\usepackage{etoolbox}
\newtoggle{wta}
\settoggle{wta}{true}
\usepackage[T1]{fontenc}
\usepackage{enumitem}
\begin{document}
\begin{enumerate}
\item\parbox[t]{\linewidth}{
\lipsum[1][1]\\
\parbox[t][1.5cm][t]{\linewidth}{
\iftoggle{wta}{\lipsum[1][4-5]}{}}
}
\item\parbox[t]{\linewidth}{
\lipsum[1][1]\\
\parbox[t][1.5cm][t]{\linewidth}{
\iftoggle{wta}{\lipsum[1][4-5]}{}}
}
\end{enumerate}
\end{document}
This works more or less but still the questions' placements do not overlap in the pdf outputs. I thought that if I put a fixed sized box under the questions and fill it with the answer (\settoggle{wta}{true}) or leave it empty (\settoggle{wta}{false}) it would result in the very same placement of the questions (and boxes), but it doesn't. What do I miss or do I wrong?
X\parbox{3cm}{}XandX\parbox{3cm}{.}X\phantominstead?