{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 ...
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 ...
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} ...
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 %. ...
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
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. ...
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 ...
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 ...
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 ...
2
votes
2answers
133 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 ...
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 ...
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 ...
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 ...
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? ...
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 ...
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 ...
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 ...
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 ...
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
49 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 ...
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?
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
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: ...
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 ...
2
votes
1answer
80 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
113 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
37 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 ...
5
votes
1answer
352 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 ...
8
votes
2answers
338 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. ...
2
votes
1answer
414 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 ...
1
vote
0answers
50 views

How can I add annotations at the end of each line of a listing? [closed]

(I'm new to LaTeX.) I'd like to annotate each line of a (Java) listing (typeset with listings) to specify the computation time associated with it. However, I can't simply edit the file and add the ...
2
votes
1answer
49 views

I have included verbatim to show a small section of code, how can I add a comment/caption for this verbatim?

I am writing some documentation on a tool I am using at work and I have included some code that has a comment to explain what a particular line is there for, this comment runs off the page if I leave ...
3
votes
0answers
58 views

More generic tool than TeXdoc?

I'm wondering if there is a more generic tool than TeXdoc to browse (and generate) documentation. With TeXdoc, one retrieves (as far as I know) the documentation .pdf of the package. This requires ...
2
votes
1answer
53 views

Labeled paragraphs

I would like to be able to label some paragraphs in a document and, when I compile the document using PdfLaTeX, choose which labels I want to keep in my document. More clearly, I would like to define ...
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.
5
votes
2answers
122 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 ...
10
votes
2answers
285 views

How to define a macro to make a line of text red?

I'm looking for a way to make a new command that makes text on that and only that line red (or in another way clearly distinguishable). Like the % symbol comments out a line. Are commands that work ...