Multi-line comments for LaTeX.

Google leads me to Cal’s (excuse me, Berkeley’s) Professor Sarah McMains, who has a simple and useful definition for multi-line comments in LaTeX:

In addition to the built-in latex comment command %, I always define a comment command that can deal with comments spanning line breaks.
in the preamble:
usage example:
\comment{This is a comment and it won't show up in the output even if it spans more than one line of the input file or the line breaks move around.}

Nice. I’ve not done much in the way of LaTeX customization, but if it’s that easy, I’m totally there. Rock on, engineer chicks who use LaTeX.


9 thoughts on “Multi-line comments for LaTeX.

  1. why would you want to have multiline comments like this? it’s not actually a comment, it won’t be properly colored in emacs, and it will add extra braces all over the place. the example she/you give will work fine with the regular % comment.
    The % won’t work for something like this:
    but in that case its much better to do this:
    than to do this:
    cause in the last case, your gonna have to manually go through and find braces if you ever decide to uncomment.

  2. Because if you’d like to comment out a sentence in the middle of a paragraph without adding any unwanted line or paragraph breaks, it’s very very useful. \comment{For instance, I could get rid of this,} while keeping this.

  3. sure, but that examples is only for aesthetics inside of your editor, tex ignores line breaks.
    jim points out that the command can’t comment
    general things (e.g \comment{ this string} including
    the close brace} -> including the close brace } ).
    Under emacs the examples I mentioned previously
    are best done with M-x comment-region and
    M-x uncomment-region

  4. I end up calling Berkeley “Cal” occasionally these days. I’m being assimilated. Maybe I should start calling it “the UC.” We could get a TV deal…

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s