I'm trying to condition comments. I got some information about if/else structures in Latex and here is my first idea :
\newcounter{student}
\setcounter{student}{1}
\ifnum \value{student}=1 {\begin{comment}}\fi
text
\ifnum \value{student}=1 {\end{comment}}\fi
The compilation fails when I try to execute this code. I think it's because when the first condition is verified being true, the second one has not been processed yet. So the \end{comment} is not in the document yet. I guess Latex is scanning the document to search where is the \end{document} before executing the second \ifnum. As it doesn't find it, it crashes.
With really little hope, I tried :
\ifnum \value{student}=1 {%}\fi text
but it fails for obvious reasons.
Do you have some ideas to condition the inclusion of parts of a document please ?
Thank you in advance !
\begin{comment}
is found, TeX is operating normally, so it expands the\ifnum
test. But once\begin{comment}
starts, it looks at the document line by line looking for exactly\end{comment}
. As that isn't found, chaos ensues. See the\includecomment
and\excludecomment
commands of thecomment
package.