Posts Tagged ‘LaTeX’

Conditional Commenting in LaTeX

April 22nd, 2009 7 comments

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:

% If set to true, comments will be inserted, otherwise ignored
% Internal command
% use \todo{text} for a comment within your page/section
\newcommand{\todo}[1]{\ifthenelse {\boolean{showComments}} {\todocmd{#1}} {}}
% use todof{text} for a footnote
\newcommand{\todof}[1]{\ifthenelse {\boolean{showComments}} {\footnote{\todocmd{#1}}} {}}
Categories: English, Linux & Programming Tags: