{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

2
votes
0answers
24 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. ...
67
votes
5answers
129k 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
39 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
68 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
21k 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
52 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
99 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
64 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
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 ...
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
64 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
35 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
26 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 ...
2
votes
0answers
55 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 ...
34
votes
8answers
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 ...
5
votes
1answer
52 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
26 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
41 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
43 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
40 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
45 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}{ ...
108
votes
10answers
131k 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 % ...
0
votes
1answer
44 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
79 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
163 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
69 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
96 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 ...
62
votes
5answers
71k 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
25 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
65 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?
8
votes
0answers
162 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 ...
4
votes
1answer
115 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
70 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
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 ...
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
110 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 ...
2
votes
1answer
78 views

Is there an in-line comment system, convention or program?

When writing papers such as this one https://github.com/geneura-papers/2015-Evostar/blob/b9474f66cd45aee316136831c4a9b4acaef4e89f/GPbot/GPbot-evostar2015.tex, we use LaTeX comments for, well, ...
2
votes
0answers
106 views

Is there a better package to add comment / annotations into your LaTeX pdf than pdfcomment today?

I am aware of the How to annotate PDF files generated by pdflatex? thread where the pdfcomment package is suggested. So this question is simply about whether you think this is still the best option ...
4
votes
1answer
290 views

Make Notes from Lyx into Annotations on the PDF

Lyx Supports Notes. It would be great to have any notes in lyx show up as Annotations in a draft produced PDF. For example: LyX: PDF: The use case I have in mind is when showing this draft ...
4
votes
1answer
36 views

Tagging and new environment

I am using the tagging package in my document to "customize it. To include/exclude some parts of my document using a taglist, I could use the following : \begin{taggedblock}{<taglist>} and ...
31
votes
1answer
2k 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] ...
9
votes
1answer
1k 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
2answers
330 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. ...
6
votes
4answers
267 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. ...
2
votes
1answer
335 views

Algorithm2e comment line alignment problem

I would like to align a comment within the algorithm environment of algorithm2e in such a way that each line of a multi line comment is left aligned. See the following MWE. In this MWE the second and ...