{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?
41
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
761 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%
...
23
votes
2answers
648 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 ...
43
votes
3answers
619 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 ...
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?
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 ...
20
votes
5answers
864 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 ...
25
votes
2answers
540 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.
...
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 ...
21
votes
3answers
573 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 ...
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 ...
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 ...
7
votes
1answer
322 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 ...
7
votes
5answers
809 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
105 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 ...
5
votes
1answer
195 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 ...
3
votes
1answer
350 views
Compile only outline and comments/ Synopsis view
Since I am about to quit using orgmode for my PHD I am wondering whether something like a synopsis package exists (google didn't give me an answer about that).
What I need:
I have a short synopsis of ...
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 ...
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
...
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 ...
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
...
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 ...
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}
...
8
votes
3answers
581 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 ...
6
votes
1answer
203 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
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
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}
...
4
votes
1answer
160 views
Comment Multi-line Text on Counter Condition
I have a document which I want to print in several (let's say 10) different versions. Some parts are just a draft, others are more or less finished, some are ready for publication and so on. I would ...
3
votes
0answers
54 views
texcl, escapeinside, and single character comments, with listings package
I'm using the excellent listings package to typeset some code in a language very similar to Scheme. The language has one type of comment: when an (un-escaped) semicolon is encountered, the rest of ...
3
votes
1answer
518 views
Align comments in algorithm with package algorithm2e
I am using the package algorithm2e.
When using comments like this
\documentclass[11pt,a4paper,twoside,openright]{book}
\usepackage[algochapter,linesnumbered,ruled,lined,boxed]{algorithm2e}
...
3
votes
1answer
223 views
cleanest way to part answers from questions
I am still typesetting old exams, and I turn to you lads and lassies for help. At the moment I have most of the actual exams typed in, and is currently typing in answers for them.
The problem I run ...
3
votes
2answers
181 views
Problem with \specialcomment-command and equation/align-environments
I'm using the specialcomment-command from the comment package around equation and align environments. This leads to an unwanted blank line after the math environment. When just using the simple ...
1
vote
2answers
557 views
In Lyx turn greyed out text into comments
In Lyx I would like to convert greyed out text into comments. The Lyx environment is lyxgreyedout. I have considered switching to another IDE already and it is not an acceptable solution.
The ...


