{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

136
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?
90
votes
9answers
78k 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 % ...
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% ...
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 ...
62
votes
4answers
2k 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 ...
46
votes
5answers
46k 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?
42
votes
4answers
72k 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 ...
9
votes
1answer
290 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} ...
28
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 ...
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 ...
8
votes
1answer
652 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 ...
29
votes
2answers
889 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. ...
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 ...
7
votes
1answer
143 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 ...
34
votes
1answer
15k 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 ...
24
votes
3answers
825 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 ...
60
votes
1answer
23k 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 ...
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
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 ...
6
votes
1answer
12k 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?
9
votes
4answers
434 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
2answers
110 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 ...
5
votes
1answer
287 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 ...
4
votes
2answers
48 views

how to left justify comments to indent same as other text in Algorithmic

How do I left justify my comments in the algorithm. I am using algorithmicx package. What I want is: to pull the comment to left as shown in the attached snapshot. The code for my algorithm is ...
4
votes
1answer
1k 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 ...
4
votes
1answer
568 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 ...
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 ...
31
votes
3answers
27k 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 ...
21
votes
2answers
7k 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
1answer
883 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 ...
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 ...
9
votes
2answers
377 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 ...
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 ...
8
votes
1answer
101 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
1answer
718 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
3k 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 ...
6
votes
1answer
2k 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
455 views

Faulty right alignment for comments in algorithmic package

I'm trying to right align comments in a pseudocode environment using the algorithmic package. So I renewed the algorithmiccomment command. There's a different way to create comments for "normal" ...
4
votes
1answer
241 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
2answers
104 views

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

Properly indent comments with no line-numbering in algorithmicx

Writing comments in pseudocode, I wanted to insert comments to the right side of the line which is commented. This thread help me a lot. The algorithm is line-numbered, however I need the comments ...
3
votes
1answer
107 views

texcl and range prefixes in listings with shorter comments

I'm trying to use the line range markers from the listings package to include sections of code. I'd previously been using actual line numbers, but based on the answer to this question, I've been able ...
3
votes
1answer
4k 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
273 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
334 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 ...
2
votes
1answer
69 views

Hide all but one instances of a custom environment

I have a file containing a number of custom environments numbered by a counter "exercisesheetnumber". I would like to use a second counter "printonly" to hide all instances of the environment but the ...
1
vote
0answers
31 views

Code to ignore all of document except for list environments and sections

I am trying to typeset all of the (description) lists in my document without any of the surrounding text or figures (with the exception of desiring some context by way of section headings). I thought ...
1
vote
2answers
1k 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 ...