Home > English, Linux & Programming > Conditional Commenting in LaTeX

## Conditional Commenting in LaTeX

In my Ph.D. thesis are quite a lot of comments/reminders for myself. I defined two commands for this, one for a red footnote and one for red bold text. But if someone else is to read parts of the document, he shouldn’t necessarily see all my comments, so I was searching for a method to suppress all comments with a single flag. I found the package ifthen and it’s exactly what I was looking for. If you need to use comments for yourself in a document you’re writing, consider using the following:

Categories: Tags:
1. May 14th, 2009 at 15:37 | #1

I think there are some “\” backslashes missing. I will figure it out where to put them

2. May 14th, 2009 at 15:43 | #2

Thanks for the hint! I will test it myself again (with time), if you see any problems, please do tell.

3. May 14th, 2009 at 15:57 | #3

I tried

\usepackage{ifthen}
% If set to true, comments will be inserted, otherwise ignored
% Internal command
\newcommand{\todocmd}[1]{{\bftextcolor{red}{#1}}}
% use todo{text} for a comment within your page/section

…..
\todo{xxxxx}

but I get

! Undefined control sequence.
\todocmd #1->{\bftextcolor
{red}{#1}}
l.113 \todo{xxxxx}

still some error somewhere

4. May 14th, 2009 at 16:15 | #4

Indeed, the WordPress editor took away all backslashes, hopefully I added all. Also, the package {color} was missing, my mistake. Thanks for trying it out!
You should change two things in your code to get it working:
Make a backslash between \bf and \textcolor in \newcommand{\todocmd}:
\newcommand{\todocmd}[1]{{\bf\textcolor{red}{#1}}}

Hope it’s running fine now and you find it useful. If there are any other problems, please let me know.

5. May 14th, 2009 at 16:21 | #5

It works. Thanks a lot!

6. January 31st, 2011 at 16:08 | #6

Thanks a lot Daniel. Works really good, no problems at all.

7. April 27th, 2011 at 17:07 | #7

+1

ERROR: si-captcha.php plugin: GD image support not detected in PHP!

Contact your web host and ask them to enable GD image support for PHP.

ERROR: si-captcha.php plugin: imagepng function not detected in PHP!

Contact your web host and ask them to enable imagepng for PHP.