Skip to content

Instantly share code, notes, and snippets.

@fbeeper
Created Jun 19, 2013
Embed
What would you like to do?
Conditional (and colorful) comments for a happy LaTeX drafting of your PhD thesis or whatever you're doing :)

Conditional (and colorful) comments for LaTeX drafting

With this simple script you'll be able to add colorful:

  • Comments (Orange): Things that you want to say about the text but are not the text),
  • TODOs (Red): Things you want to note to do in the future keep track), and...
  • Skeleton (Green): Those things that you (or maybe it's just me) write to organize what you are writing.

While editing use:

\comment{Your super-important comment}

\todo{That thing that you are obviously procrastinating}

\skeleton{Comments about dissertation structure}

You'll be able to take them out independently from your text for submission/revision with a simple edition of this script. Just comment out those you want to forget about on your next compilation. E.g. %\toggletrue{comments} will make comments disappear!

% Enable fancy colors for Comments
\usepackage[usenames,dvipsnames]{xcolor}
% Create conditional comments
\usepackage{etoolbox}
\newtoggle{comments}
\newtoggle{skeleton}
\newtoggle{todo}
% All active by default. Because it is what you'll need while drafting!
% Comment them at will before compiling to make them dissappear
\toggletrue{comments}
\toggletrue{skeleton}
\toggletrue{todo}
% Simplified commands for a hassle free edition
\newcommand{\comment}[1]{\iftoggle{comments}{{\color{Orange}#1}}\\}
\newcommand{\skeleton}[1]{\iftoggle{skeleton}{{\color{Green}#1}}\\}
\newcommand{\todo}[1]{\iftoggle{todo}{{\color{Red}#1}}\\}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment