On the question Is it possible to keep my translation together with original text? I learned how to do an if, however when I use it like on this document:
\documentclass[10pt,a5paper,twoside]{memoir}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[brazil]{babel}
\usepackage[showframe,pass]{geometry}
\newif\ifdebug
\debugfalse
\debugtrue
\begin{document}
Arquivo compilado \ifdebug22:00\else\currenttime\fi h do dia \ifdebugTODAY\else\today\if.
\end{document}
It throws the error:
! Undefined control sequence.
l.81 ...else\currenttime\fi h do dia \ifdebugTODAY
\else\today\if.
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Extra \else.
l.81 ...currenttime\fi h do dia \ifdebugTODAY\else
\today\if.
I'm ignoring this; it doesn't match any \if.
)
! Incomplete \if; all text was ignored after line 81.
<inserted text>
\fi
<*> ./test2.tex
The file ended while I was skipping conditional text.
This kind of error happens when you say `\if...' and forget
the matching `\fi'. I've inserted a `\fi'; this might work.
! Emergency stop.
<*> ./test2.tex
*** (job aborted, no legal \end found)
But if I change the if line adding some spaces:
Arquivo \ifdebug 22:00 \else \currenttime \fi h do dia \ifdebug TODAY \else \today \if .
The error became:
! Incomplete \iftrue; all text was ignored after line 81.
<inserted text>
\fi
<*> ./test2.tex
The file ended while I was skipping conditional text.
This kind of error happens when you say `\if...' and forget
the matching `\fi'. I've inserted a `\fi'; this might work.
! Emergency stop.
<*> ./test2.tex
*** (job aborted, no legal \end found)
Related: