Tell me more ×
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.

In tex there is a way to do a comment multiline like in C, C++ /* comment */ or in HTML <!-- comment -->? I'm currently using \ifx

\ifx true false
My multiline comment
that will not be in the
output pdf
\fi

but this may create a problem if I put inside the comment something like \someundefcommand. I wish something like the standard % comment so I can put inside the comment I want.

share|improve this question
4  
Possible duplicate: Commenting out large sections – diabonas Feb 12 '12 at 21:01

2 Answers

up vote 23 down vote accepted

Use the verbatim package.

\documentclass{article}
\usepackage{verbatim}
\begin{document}
\begin{comment}
some comment
\someundefinedcommand
\end{comment}
a
\end{document}
share|improve this answer
2  
Hmm. Why does verbatim provide this? I would expect to find it in its own package. Did the functionality fall out as a natural by-product of verbatim's implementation? – Todd Lehman Feb 13 '12 at 12:24

Instead \ifx true false you may use the shorter

\iffalse
dsaads
fdfdfds
\fi

If you ever want to have to 'activate' your comments later, you may define your own if:

\documentclass{article}

\newif\ifcomment
%\commenttrue # Show comments
\begin{document}

b

\ifcomment
dsaads
fdfdfds
\fi

a
\end{document}

But I would not recommend the \ifcomment. There are packages for this (the already mentioned verbatim or comment or version or versions).

Another interesting approach could be todonotes. Just don't show the todos. If you need them, you may define, where you get them (margin, footnote, own pages...)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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