Questions tagged [comments]

{comments} are annotations written by a user to document their code. A common package used for comments in code, apart from the traditional use of %, is the comment package.

are annotations written by a user to document their code. A common package used for comments in code, apart from the traditional use of %, is the comment package.

enter image description here

\documentclass{article}
\usepackage{comment}% http://ctan.org/pkg/comment
\begin{document}
Some regular text that will appear in the document.

% This is a comment.
% Anything following a '%' will not be visible in the output
\begin{comment}
  Here is another comment, provided by the comment environment
  from the comment package. Other environments may also be defined
  as needed, to provide version-based comments.
\end{comment}

Some more text within the document body.
\end{document}
393 questions
451
votes
12 answers

Commenting out large sections

To "comment out" a line, I need to insert a % at the beginning of the line (so that the line will not be compiled). Is there a way to comment out a large section without having to manually place % in front of each line?
BeauGeste
  • 4,613
346
votes
7 answers

Multi-line (block) comments in LaTeX

In LaTeX, % can be used for single-line comments. For multi-line comments, the following command is available in the verbatim package. \begin{comment} Commented code \end{comment} But is there a simple command like /* code */ in C?
Arindam Pal
  • 3,821
98
votes
3 answers

Multiline comment

In tex there is a way to do a comment multiline like in C, C++ /* comment */ or in HTML ? I'm currently using \ifx \ifx true false My multiline comment that will not be in the output pdf \fi but this may create a problem if I put…
Alberto
  • 1,887
44
votes
2 answers

How to comment part of a line?

I am writing a text which I will review later again and want to comment out only a part of a line (in between), something like this: Once upon a time, there was %in some galaxy far away% a nice and cute rabbit... When I review it again, I could…
Luis
  • 587
33
votes
4 answers

Commenting out a few words within a paragraph?

Is there anyway by which I can comment out a word within a sentence?
Reza
  • 433
17
votes
2 answers

File ended while scanning use of \next with comment package

When using the comment package, one can get a very strange error Runaway argument? ! File ended while scanning use of \next. when compiling a file that excludes some…
ysalmon
  • 1,160
17
votes
2 answers

Does the comment symbol % remove the carriage return at the end of the line?

I find LaTeX a little bit inconsistent on this. Do the following experiments: The code a.% b will produce a.b, while the code a. b will produce a. b. Looks like the comment symbol % has removed the carriage return at the end of the line.…
user92080
  • 173
16
votes
3 answers

Skip compilation of parts of a document

Possible Duplicate: Commenting out large sections I have a long document where sometimes I need to omit some parts for the compilation, and sometimes other parts. I do it by just commenting with % the necessary lines, but sometimes it gets…
Open the way
  • 2,217
11
votes
2 answers

Why does starting a %-type comment after "\end{comment}" cause problems?

Not that big a deal, but why does putting a %-type comment in the same line after \end{comment} cause problems? \documentclass[12pt]{article} \usepackage{comment} % \usepackage{thmtools, thm-restate} …
Hao S
  • 858
10
votes
1 answer

Comment package not working

I have added the package \usepackage{comment} in my .tex file. But when I am adding \begin{comment} and \end{comment} it is not commenting the text I want to comment. What to do?
RIchard Williams
  • 1,219
  • 3
  • 14
  • 18
10
votes
1 answer

Difference between % and %%

I was looking through some tutorials recently and some of them used % and others used %%, both seemed to behave like comments though. I just wanted to know if there was a difference between the two and if there is, when to use % and when to use %%.
user77039
  • 101
9
votes
2 answers

How to manage comments in lecture notes?

In the university I'm currently attending a lecture where no lecture notes exist. I want to tex what the professor has written on the blackboard. I'm gonna include comments (things that my professor said, but didn't write down) that I've written…
citronas
  • 1,085
  • 2
  • 11
  • 17
7
votes
2 answers

Is there a way to toggle comments?

I'm looking for a way to turn toggle the "comment" status of certain comments within a latex document. The idea is that throughout the document, including the preamble, there are specific commented-out lines that I can effectively toggle on and off,…
DavidR
  • 1,107
7
votes
2 answers

Nested block comments?

Is there any way to get nestable block comments in LaTeX? I am using the comment package to get block comments, but nesting one comment inside another with \begin{comment}...\begin{comment}...\end{comment}...\end{comment} doesn't seem to work. (I…
BrenBarn
  • 212
7
votes
1 answer

comment package: Show/hide comments Inside a section title

I'm pretty close to being a LaTeX beginner. I'm hoping to use the comment package to indicate author's names (i.e. who's responsible for writing) on each section of a shared paper. This could then temporarily be shown in the TOC. But in the manual:…
mfolkes
  • 103
1
2 3 4 5