{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.

learn more… | top users | synonyms

138
votes
4answers
6k views

What is the use of percent signs (%) at the end of lines?

I see that the code in many packages and examples contains percent signs % at the end of (many) lines. What are they used for? Do they affect the parsing of those lines?
93
votes
10answers
90k views

Commenting out large sections

So to "comment out" a line, I need to insert a % at the beginning of the line (so that line will not be compiled). Is there way to comment out a large section without having to manually putting a % ...
62
votes
4answers
3k views

When and why should I use % !TEX TS-program and % !TEX encoding?

Occasionally, I see other people's documents starting with two lines like that: % !TEX TS-program = xelatex % !TEX encoding = UTF-8 Unicode It's clear to me that the first line declares the engine ...
62
votes
1answer
25k views

Comments in BibTex

Basic question (though I haven't found it here): How do I comment out parts (some lines within an entry which I would like to save for later) of a BibTex file? Apparently, @ can be used to comment ...
48
votes
5answers
51k views

How to write hidden notes in a LaTeX file?

How can I write notes in a LaTeX file, that don't appear in the PDF file?
47
votes
4answers
85k views

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 ...
42
votes
3answers
1k views

Where are the necessary places to be appended with % to remove unwanted spaces?

I have experience where empty spaces cause unwanted effects. It is not easy to trace the cause of these unwanted effects. In order to eliminate any doubt, I often overuse % as follows. \usepackage% ...
36
votes
2answers
663 views

When or why should I use %% as opposed to %?

I've noticed that many (all?) style and class files have "documentation blocks" with a double comment character at the beginning of the line, %% like so instead of the usual style of comments, % ...
34
votes
1answer
16k views

Personal notes when preparing a talk with LaTeX-beamer class

Suppose I prepare a talk using the beamer class. To each slides I want to take personal notes (what I exactly want to say, frequently asked questions etc.). So is there a smart way to write those ...
32
votes
3answers
30k views

Multiline comment

In tex there is a way to do a comment multiline like in C, C++ /* comment */ or in HTML <!-- comment -->? I'm currently using \ifx \ifx true false My multiline comment that will not be in the ...
31
votes
1answer
1k views

Best practice for writing comments in LaTeX documents

I would like to find out about recommended practices when using comments in LaTeX documents. Some programming languages are quite clear about how to use comments in source code: for instance, [here] ...
29
votes
7answers
3k views

What is a good strategy for obtaining comments on a LaTeX document from non-LaTeX using collaborators?

Context: I prepare my scientific documents using LaTeX and compile to a PDF. I often need to seek comments on drafts from collaborators who do not use LaTeX. Most of these collaborators use Windows ...
29
votes
2answers
921 views

Are comments safely hidden once the document is compiled?

This is kind of similar to some of the pdf to latex questions but from a different angle. I'm not looking for a complete LaTeX reconstruction method, I want to know if the comments are safely hidden. ...
26
votes
2answers
2k views

Mouseover events in beamer: hovering on \eqref and a comment containing the original equation popping up

This idea came into my mind while I was listening to a speaker presenting his results in a seminar, he used lots of equation references in his later slides, however I can't remember which equation he ...
24
votes
3answers
854 views

Seeking review on a document with people unfamiliar with TeX

I am a great fan of TeX, LaTeX and LyX, but recently I wrote some minutes and then tried to send them off for other people to review. There was no way I could send a TeX file; no-one would know what ...
23
votes
2answers
8k views

Comment out sections of text in bib file

What's the correct way to comment out sections of explanatory text (included for humans to read) in a .bib file? I would like biber/biblatex to simply ignore this text. When I put in text like ...
20
votes
5answers
2k views

Comment out lines without using % and comment enviroment

I would like to ask something which will greatly facilitate my work. But before, I introduce you to the problem I face. In my attempt to gather my notes for my students and give them something more ...
17
votes
2answers
8k views

Block comments with *% and %*

I know the package comment which allows to use : \begin{comment} Lines to comment \end{comment} This is not very friendly to use. I would like to have the following possibility: *% Lines to ...
16
votes
5answers
2k views

Utility to Strip Comments from LaTeX Source

I've a LaTeX source. I'm ready %for submission %But first I would like to strip its comments. So I hope there are 100\% auto ways to get this done. \begin{comment} Because there are subtle ways ...
15
votes
1answer
223 views

Strange behaviour of \sbox

This question consists of two related parts. I already solved the original problem but still don't understand where it came from or why the solution works. I use the subcaption package so I can place ...
14
votes
2answers
605 views

Remove everything that is in math mode

The package comment.sty allows one to typeset \begin{comment} stuff that will be suppressed from output file \end{comment} or \begin{myCustomEnv} stuff that will be suppressed from output file ...
14
votes
1answer
1k views

Source Code Margin Comments

In the paper "Beautiful Code Compelling Evidence", by J.R. Heard -- Code is formated in a particular way which includes margin comments. I am looking for a way to do this as I think it is a very clear ...
13
votes
5answers
1k views

Including parts of a LaTeX document in another document WITHOUT splitting up original document

I'm working on a paper with some collaborators. At the same time, I'm writing my dissertation for my defense next month. I need to include the paper in the dissertation, but it doesn't just become a ...
13
votes
1answer
242 views

Equations with comment bubbles

Is it possible to have write equations accompanied with explanatory bubbles and comments? I am familiar with underbracket, overbracket, underbrace and overbrace but I have terms close together and I ...
11
votes
3answers
2k views

Skip compilation of parts of a document [duplicate]

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 ...
11
votes
2answers
641 views

Create an annotation for table text on the page border

I have a table with 2 columns (for vocables, but also complete sentences) and for one of these 2 columns I want to add annotations on the page border. It must however be possible to associate the ...
11
votes
1answer
6k views

LaTeX Listings Package, No Line Number for Comments

I am trying to get only the actual code to be line numbered rather than both code and comments. Example: \lstset{basicstyle=\footnotesize, xleftmargin=40pt, frame = single, numbers = left,caption = ...
10
votes
2answers
246 views

How to define a macro to make a line of text red?

I'm looking for a way to make a new command that makes text on that and only that line red (or in another way clearly distinguishable). Like the % symbol comments out a line. Are commands that work ...
10
votes
2answers
1k views

'Dummy' LaTeX environment

I have a big LaTeX file which I would like to compile so that certain environments like figure are not shown. To that end I wanted to make use of the renewenvironment command. But the facilities of ...
9
votes
2answers
414 views

macro that defines a comment

The Wikibooks book on LaTeX mentions the following way of defining a macro for (possibly multi-line) comments: \newcommand{\comment}[2]{#2} with the argument that \newcommand{\comment}[1]{} can ...
9
votes
5answers
1k views

\newenvironment issues with environment comment

I am trying to setup the formatting for a LaTeX document (it's got the class memoir), so that it would be fairly simple to add to it in the future. Two of the features I'd like are: Be able to mark ...
9
votes
4answers
484 views

How to redefine an environment to produce no output?

I am using the verbatim environment with \begin{verbatim} XXXX \end{verbatim} I would like the option of redefining the verbatim environment so that nothing between \begin{verbatim} and ...
9
votes
1answer
374 views

comment.sty and UTF8 encoding

I noted that if I use comment.sty and a there is a block of text containing UTF8 characters inside a comment environment, the compilation aborts! Minimal Example \documentclass{article} ...
9
votes
2answers
114 views

Do assignments need to be appended by % to remove the trailing white spaces?

The following shows code snippet taken from multido.tex. I noticed assignments are not ended with %. See \dimen@=#1\advance\dimen@#2 in \def\multido@step@d#1#2{% \dimen@=#1\advance\dimen@#2 ...
9
votes
2answers
368 views

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 ...
9
votes
1answer
3k views

Vertical spacing before and after equation environment: empty line or not?

The vertical spacing in front of and behind the amsmath equation environment is different whether I insert a blank line or not (im using KOMA-Script with parskip=half if this is important). I'd like ...
9
votes
1answer
134 views

Add area for readers to write comments on a page

I would expect this question to have already been answered, but I could not find an answer on point, so I am looking for thoughts and suggestions. The problem is as follows: I have a document which I ...
8
votes
4answers
2k views

Latex tag for making a comment appear or disappear in pdf?

Is it possible to tag sections of your .tex file so that you can make text appear or not? I have a long document and would like to be able to comment a certain section in each chapter, and produce ...
8
votes
3answers
9k views

Percent signs - “comment” and “active” both at once?

I convert documents from Word a lot, and I often forget to escape %, which leads to pieces of text missing. So I would like the following to happen in the main document body: escaped \% working as ...
8
votes
1answer
804 views

Delete comments in tex file with Emacs+Auctex

I am working with other people LaTeX files and sometimes they look very messed up. I am looking for a way to delete all comments without changing the code. The problem is that I want to preserve all ...
8
votes
1answer
679 views

hide proof environment for restructuring

I am writing my thesis, and i am in restructuring phase - sorting theorems where they should belong thematically. And it would be helpful to have all the proofs hidden so i am not laden with the ...
8
votes
1answer
569 views

Comment package does not work in beamer

I want to use the comment package in my presentation. I read that it does not always work in some very complicated contexts, but here it fails even in a very simple example: \documentclass{beamer} ...
8
votes
1answer
1k views

Inline comments in LaTeX

Is it possible to make inline comments in LaTeX that do not extend until the end of the line? The actual problem I'm trying to solve is vim's annoying highlighting of the non-curly end-bracket here: ...
8
votes
2answers
297 views

“Smart commenting” in LaTeX

Is there any package that lets me insert "smart comments" in a LaTeX document? What I mean by "smart commenting": I have a source (.tex) file of notes of the lecture that happened in the classroom. ...
8
votes
1answer
102 views

Why do I have to place % at the end of line preceding \pstVerb?

Please consider the position of the red dots. First Case When I don't activate \pstVerb{/xxx 1 def}, the red dot is properly positioned. \documentclass[border=12pt]{standalone} ...
7
votes
1answer
14k views

How can I comment out a block of text in texmaker?

I use texmaker and some time ago I found, by chance, a way to comment many lines at once, but I can't remember it now. Can somebody remind me of that?
7
votes
1answer
146 views

Environment prints same character at beginning of each output line

I am writing a Latex document with pseudocode interspersed with theorems and discussion. Some of the comments in the pseudocode are long. I would like to automatically start (and end) each output line ...
7
votes
2answers
2k views

Add comments to bibliography

In chemistry journals one often notices bibliography entries which contain a comment, cf. attachment. How to get such results using BibTeX/LaTeX?
7
votes
1answer
102 views

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 ...
7
votes
4answers
275 views

turning printing of parts of text off and on?

This question: Turning parts of text on and off deals with turning some portions of the text off and on completely -- but the method it uses (commenting) causes the labels in earlier parts of the text ...