{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.
84
votes
4answers
2k 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?
43
votes
3answers
610 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 ...
40
votes
5answers
13k 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 % ...
34
votes
3answers
760 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%
...
32
votes
2answers
594 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,
% ...
30
votes
1answer
7k 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 ...
25
votes
2answers
539 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.
...
24
votes
6answers
2k 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 ...
24
votes
4answers
7k 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?
23
votes
2answers
641 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 ...
21
votes
3answers
571 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 ...
20
votes
5answers
862 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 ...
20
votes
2answers
8k 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
...
15
votes
1answer
6k 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 ...
15
votes
2answers
5k 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
...
14
votes
2answers
200 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
...
13
votes
5answers
864 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 ...
12
votes
3answers
3k 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 ...
11
votes
1answer
3k 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
565 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 ...
9
votes
2answers
133 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
2answers
70 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
261 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
121 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
3answers
572 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 ...
8
votes
4answers
122 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 ...
8
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 ...
8
votes
1answer
80 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
4answers
1k 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 ...
7
votes
5answers
808 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 ...
7
votes
1answer
102 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
550 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
691 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:
...
7
votes
2answers
361 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
...
7
votes
2answers
296 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 ...
7
votes
1answer
316 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 ...
6
votes
3answers
209 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 ...
6
votes
1answer
198 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 ...
6
votes
1answer
87 views
Percent signs disappearing from verbatim block (ltxdoc class)
Is the following expected:
\documentclass{ltxdoc}
\begin{document}
\begin{verbatim}
% why is my percent sign gone?
\relax % not here
\end{verbatim}
\end{document}
6
votes
1answer
287 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 ...
6
votes
1answer
633 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 ...
6
votes
1answer
2k views
How can I escape % in a lstlisting?
I have a little lstlisting to show a snippet of code but since the code has % in it for modulo calculation the listing breaks down. How can I escape it?
I have tried the backslash, verbatim and \text ...
5
votes
1answer
194 views
Suppressing remarks when not needed
I have written some remarks in some of my works that are somewhat informal and repetitive in nature (mainly for my own clarification). I was wondering if there is a way of suppressing them when I ...
5
votes
4answers
866 views
How to comment in an R-chunk?
I'm quite new to both R and LaTeX, but I'm trying to work with both, using Sweave.
I know you can comment in R using # and in LaTeX by using %. However, when I write a #comment in an R-chunk (between ...
5
votes
1answer
1k views
\excludecomment and \newcommand using it
I have a problem with \excludecomment from comment package and a \newcommand.
The following codes work good, which means, it can generate the desired pdf output.
\documentclass{article}
...
5
votes
1answer
113 views
ConTeXt: Enumeration, Comments cause undefined control sequence startformula error
I'm a LaTeX user working through some ConTeXt tutorials, and hit a brick wall pretty early. It makes me wonder if something is wrong with my setup, or if I'm not understanding something pretty ...
5
votes
1answer
135 views
Can latexmk be told to ignore specific intermediate files completely?
One latex run suffices to generate the DVI/PDF version of the LaTeX document
\documentclass{article}
\usepackage{comment}
\includecomment{comment}
\begin{document}
\begin{comment}
\noindent
...
5
votes
1answer
59 views
Highlight / color parts of text
LaTex newbie here. Currently using vim with solarized color scheme to edit .tex documents.
When writing I often jump around to different parts of the document, leaving gaps behind to work on later. ...
4
votes
4answers
3k views
How do you add a comment to pseudocode in LaTeX?
Is there a special formatting to add comments to code? I mean I want to show comments in pseudocode that I write in LaTeX.
this is code // this is comment part (the part that I want)
Edit: To be ...
4
votes
1answer
81 views
How to change an environment into newcommand?
Suppose that I want to create a new command named step, which functionally add Step 1., Step 2., and so on in the proof. This can be done by:
\newcounter{stepnum}
...

