Adding temporary notes to LaTeX draft compiles
April 13, 2010 at 9:02 am Leave a comment
Suppose you do a LaTeX document, and you want to take notes within the compiled document that should be visible in the drafts but not in the final document.
Here is one way of doing it (but it messes with the page layout as it puts the comments in the document itself instead of at the border):
\usepackage{ifthen}
\usepackage{color}
\newboolean{FinalVersionWithoutNotes}
\newcommand{\NNF}[1]{\ifthenelse{\boolean{FinalVersionWithoutNotes}}{}{\colorbox{yellow}{#1}}}
\setboolean{FinalVersionWithoutNotes}{false}
And within the document you write:
In group theory the left inverse is sometimes equal to the right inverse \NNF{Remember to add a proof of this statement and delete the "someimes" as soon as your done.}, therefore ....
This will just paste the text within the NNF (Notes Non Final) command into the document in a yellow box (that doesn’t care about linebreaks at the end of the line). If you change the boolean:
\setboolean{FinalVersionWithoutNotes}{true}
non of the stuff in the NNF command will be compiled in the document.
Comments:
- There are no line-breaks or no spaces allowed in the newcommand passage.
- If you have a special include-file for all your commands you can put everything from the first block in there. But I guess it makes sense to put the “\setboolean{FinalVersionWithoutNotes}{false}” within your document itself as you want to change this variable regularly.
- It would be better if the box supported line breaks.
- It would be even better if the box wasn’t placed in the document text but to the side of it. In the current version the layout of your documents changes as the amount of flow text changes. So you’ll have to do the layout with the FinalVersionWithoutNotes boolean set to true.
Thanks for LaTeX-Wörterbuch: textcolor and Sunlife: Latex: how to use conditional compilation for the information.
Trackback this post | Subscribe to the comments via RSS Feed