Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Possible Duplicate:
How to write hidden notes in a LaTeX file?

\documentclass{article}

\def\hide{\iffalse}

\def\show{\hi}

\begin{document}

111111

\hide

222222

\show

333333

\hide

444444

\show

555555

\end{document}
share|improve this question
1  
Can you please explicitly state the problem? –  Gonzalo Medina Apr 19 '12 at 3:02
    
Welcome to TeX.SE. If you replace the \show with \fi I think you will get the desired results. While you are at it, you might as well replace the \show with \iffalse. –  Peter Grill Apr 19 '12 at 3:03
    
Great.Thank You! –  wu guiping Apr 19 '12 at 4:31
3  
Note that \show is already defined by (La)TeX and you have a typo in your code: \hi instead of \fi. Your code doesn't work, because the \fi is hidden inside the \show. When text is ignored after a \iffalse, macros are not expanded, so the \fi is never found. See also What is an \if? for more info about it. Also How to write hidden notes in a LaTeX file? should be interesting for you. –  Martin Scharrer Apr 19 '12 at 6:46
add comment

marked as duplicate by Joseph Wright Apr 20 '12 at 16:34

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

You can use

\let\hide\iffalse
\let\unhide\fi% rather than \show

to achieve your desired result:

enter image description here

\documentclass{article}
\let\hide\iffalse
\let\unhide\fi
\begin{document}
111111 \par
\hide
222222 \par
\unhide
333333 \par
\hide
444444 \par
\unhide
555555
\end{document}

However, the same result is possible using a more controlled approach provided by the comment package:

\documentclass{article}
\usepackage{comment}% http://ctan.org/pkg/comment
\begin{document}
111111 \par
\begin{comment}
222222 \par
\end{comment}
333333 \par
\begin{comment}
444444 \par
\end{comment}
555555
\end{document}

comment allows version control of comment environments.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.