{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

6
votes
4answers
97 views

Conditional choice of version

I have a document with several sets of questions clustered in different versions. I would like to be able to choose which version to generate with a single parameter. The document is updated ...
5
votes
1answer
103 views

Are comments discouraged in a BibTeX file?

biber complains about "junk" in what should be seen rather as commented-out lines in a BibTeX file. I was wondering if comments are discouraged in BibTeX at all. \documentclass {article} ...
3
votes
0answers
23 views

Can I force a pre-process action on all commands or environments without having to redefine them all manually?

I am trying to preserve a history of the latex commands and environment initializations I use in a typeset html or pdf file. Is there a way where I can force a pre-process action on all commands ...
9
votes
0answers
180 views

What kind of data can be gleaned from a PDF created in LaTeX?

As I use LaTeX for the creation of many of my business instruments, and since I send these all over the world to different clients I just wanted to know if there are any data embedded in a PDF that ...
82
votes
1answer
33k 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 ...
9
votes
1answer
108 views

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 ...
2
votes
1answer
138 views

Add comment/explnation at the end of the page

How can I add a comment at the end of the page like this: Thank you.
0
votes
0answers
20 views

Any way to color in gray/red the text between \iffalse and \fi (like comments)?

Is there a way to change the color of the text between \iffalse.. and \fi, so to make it more (or less) visible? I mean something like the gray color which is given to comments when using %. ...
40
votes
1answer
20k 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 ...
0
votes
0answers
15 views

directlua : misinterpretation of % as latex comments [duplicate]

What is the good way to avoid LaTeX interprete % as comments in \directlua ? Or in this case one must use an auxiliary file ?
2
votes
0answers
30 views

Texmaker magic comment

Is there any similar magic comment in Texmaker like those in Texstudio? Example:% !TeX program = xelatex
119
votes
10answers
141k 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 % ...
2
votes
0answers
34 views

Listings - Getting the colors right for custom language

I have lots of bookkeeping transactions that I would like to typeset in a color coded format. I am using the listings package to accomplish what I want. I tried the following code. ...
72
votes
5answers
138k 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 ...
1
vote
2answers
53 views

TexStudio Special Comments for math mode over highlighting in minted environment

Latex sudo noob here. I had a question regarding the answer to the question TeXstudio recognize $ in R code as that of the math mode How does one create the special comment listed in the answer? It ...
5
votes
2answers
77 views

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 ...
9
votes
2answers
23k 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?
0
votes
2answers
56 views

Is it possible to hide long comments within the editor?

LyX has a great feature of being able to hide the content of comments from the editor, leaving only a mark that there's a comment at that area. I'm now trying to write directly in Latex rather than ...
2
votes
2answers
134 views

Commenting a single line comments the whole block

So there are paragraphs in my document, and even if I try to comment a single line using % I find that all the rest of the paragraph is also commented. I know this since the color changes to grey ...
4
votes
1answer
1k views

Enable PDF commenting with TexShop

I'm using TexShop (Mac OS 10.5) to typeset a manuscript and I would like to share the generated PDF with some colleagues. In the process, I would like to add some comments to the generated PDF and ...
0
votes
0answers
23 views

How to remove protection to comments in the document .pdf, generated latex? [duplicate]

How to remove protection to comments in the document .pdf, generated latex? I'm working on my thesis in latex, but today my partner need to discuss the pdf, and can not do for the protection of the ...
3
votes
4answers
65 views

How can I redefine a command to omit the material on the line that starts with the command?

I have designed a quiz with hundreds of questions and answers in a list. The answer to a given question is on the line immediately below it, but not all questions have answers provided. The LaTeX ...
66
votes
4answers
4k 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 ...
3
votes
1answer
17 views

modification to comment environment

I'm using the comment package, in my preamble I have \specialcomment{notes}{\begingroup \color{Blue}}{\endgroup} so that when I want to comment my text I write \begin{notes}...\end{notes} to get a ...
5
votes
4answers
69 views

How to conditionally uncomment only one portion of code?

I'm trying to design a tex file that could store multiple colour schemes (which I would define once and for all), which I could "activate" one at a time to assign quickly a colour scheme to my ...
4
votes
1answer
37 views

How to set a newenvironment to skip words by flag?

I want to create a environment to include some words, but hide it when a flag is set up. However, I cannot put \begin{comment} \end{comment} into \newenvironment for some reason. How should I do this? ...
0
votes
0answers
27 views

Short way of using comment character `%` in multilines [duplicate]

I have a long calculation in my document that starts and ends with several \align environments. But now, I want to make all these lines to appear as a comment since there is a possibility for them to ...
1
vote
1answer
33 views

Environment that eats up (ignores) text inside it [duplicate]

I want to replicate the environment comment from the comment package: \begin{comment} Hidden stuff. \end{comment} which prints just nothing, instead of using % to comment things out. I can do it ...
34
votes
8answers
4k 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 ...
5
votes
1answer
56 views

How to work around a bug in listings package for parsing (Java) comments

When using the listings package (v1.5e; though v1.3 exhibits the same behavior) to put some Java source code on slides, I run into the following weird problem (bug?). I minimized the files to help ...
1
vote
1answer
35 views

How to add comments in align environment [duplicate]

I find it is necessary to add some explanation in a series of equations. Ideally, I would like to get something like the following picture (Resnick 1999). As you can see, the equations are still ...
3
votes
2answers
50 views

Commenting out specific environments

I'm working on a large document which contains several figures. Due to the figures it takes a long time to compile. I would like to comment out all the figures while I'm working and then put them ...
0
votes
0answers
54 views

How to ignore undefined references (e.g. when temporarily commenting out whole chapters)?

I'm working on a fairly large document, and compilation times are somewhat annoying. My general workflow is to use: latexmk in continuous mode to compile the document (pdflatex), and rubber-info on ...
1
vote
0answers
41 views

How to turn on and off some parts of a TeX file? [duplicate]

I would simply like to have the possibility to turn on and off some parts of a TeX file. For example, when writing a course assignment, it should be possible to hide the solutions to my students, but ...
2
votes
0answers
37 views

How to ignore comments when comparing LaTeX files with TextWrangler?

In developing a text, I obviously go through numbered versions. But, when trying variants of just a sentence or sometimes a paragraph, I just comment out the previous one as I try the next phrasing. ...
1
vote
1answer
50 views

Listings doesn't recognize Pascal // comment

listings doesn't seem to recognize the Pascal comment syntax '//' ({...} works fine). The text isn't formatted correctly. A minimum example to reproduce: \lstdefinestyle{pascalstyle}{ ...
0
votes
1answer
48 views

Is it possible to hide a section or comment out a whole section? [duplicate]

I want to comment out a whole section in order to save the text but not render it in the PDF. Is this possible?
3
votes
2answers
84 views

Adding \comment or \begin{comment} to \AtBeginDocument?

For Partial compilation commands/environment?, I would like to add \begin{comment} or \comment at the start of the document (so I could turn it off elsewhere in the code). So, even if in the larger ...
6
votes
2answers
165 views

Is it possible to comment out an already defined environment?

I have defined the following environment for producing problem statements: \newcounter{psctr} \newcounter{probctr}[psctr] \NewDocumentEnvironment{prob}{o}{% \addtocounter{probctr}{1} \vspace{.15in} ...
3
votes
1answer
81 views

algorithm2e style comments in algorithmicx

I want to use \tcc and \tcp commands in algorithmicx package. Is there any way to do this? \documentclass[12pt,a4paper]{report} \usepackage[english]{babel} \usepackage[utf8]{inputenc} ...
2
votes
1answer
115 views

(TeXShop) Magic comment in a subfile that runs the main file but including only this subfile

Disclaimer: This question is a bit specific to TeXShop because I have to help somebody who's using this editor I don't know as I don't own a Mac. Nevertheless, it could be helpful to others. The aim ...
66
votes
5answers
75k 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?
4
votes
1answer
26 views

How do I define an excludecomment environment in a for loop?

I'm using the forloop and comment packages to define environments prob1 through prob5 that exclude portions of my document. Here's a MWE: \documentclass[12pt]{article} \usepackage{comment} ...
1
vote
1answer
81 views

Folding commented sections in Texstudio 2.6.6

I want to know, if and how can I apply code folding to commented out sections in Texstudio 2.6.6?
4
votes
1answer
117 views

How to avoid the compilation of some of my newcommands in latex

I'm writing an exam for my students, and have defined 3 commands to insert spaces with \dotfill permitting them to write their responses: \rep,\replarge, \repLarge for short and large responses: ...
3
votes
0answers
77 views

Listing sourcecode - two columns, associations with colored background

I stumbeled over a way of formatting sourcecode in a book I am currently reading. It looks like this: So basically we have a following structure: There are two columns. Left column contains the ...
4
votes
2answers
5k 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} ...
17
votes
5answers
3k 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 ...
0
votes
0answers
27 views

How do I comment big part of a code that i do not want to compile. [duplicate]

I m tired to comment line by line the things I desired to comment, is there a a way of selecting part of the code, and get it inmediatly in comment?
2
votes
1answer
146 views

listings - use different style for normal comments /* and doxygen comments /**

listings package allows setting basicstyle, keywordstyle, identifierstyle, commentstyle, stringstyle. Is it possible to set different style for comments that start from /** not just /*? To make my ...