{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

5
votes
2answers
122 views

Comment-like environments and spacing

I often need to "turn off" environments. One way I do this is below in my minimal working example: \documentclass{article} \newenvironment{nothing}{\setbox0\vbox\bgroup} {\egroup} \begin{document} ...
0
votes
0answers
49 views

Percent sign in URL without hyperref

Suppose you want to create a URL that has embedded % signs. One option is to just use \%, but you don't get the benefit of nice line breaks. Another option is to use the hyperref package and its ...
1
vote
1answer
12 views

How to disable pdfmarkupcomment?

I filled my thesis with lot of pdfmarkupcomments which come as a part of the package pdfcomment. Is there a way to disable this comments globally. Or should I go manually to every place I made it and ...
4
votes
1answer
80 views

Setting style for Python docstrings in lstinputlisting environment

I am using the listings package for source code in my LaTeX document. I am trying to set the style for docstrings in the Python programming language: \documentclass{article} \usepackage{listings} ...
0
votes
1answer
24 views

How to enable unicode within comment section? (package “comment”) [duplicate]

In following MWE, letters with an accent that are within the personalized comment environment are generating following errors while compiling with pdflatex: ! Package inputenc Error: Unicode char ...
0
votes
0answers
16 views

Changing footnotes/endnotes into hidden comments or annotations

So I have a rather large dissertation that currently contains footnotes and endnotes (using \makepagenote). The final document can only contain footnotes. Some of the \pagenote{ ... } material will ...
2
votes
0answers
36 views

Knitr Plot Tooltips for ADA Compliance

I would like to use Knitr to generate plots in R that have hover-over tooltips. Here is a working example without an R tooltip: \documentclass{article} \usepackage{pdfcomment} ...
15
votes
2answers
445 views

Does the comment symbol % remove the carriage return at the end of the line?

I find LaTeX a little bit inconsistent on this. Do the following experiments: The code a.% b will produce a.b, while the code a. b will produce a. b. Looks like the comment symbol % has ...
3
votes
2answers
85 views

Commenting out a few words within a paragraph?

Is there anyway by which I can comment out a word within a sentence?
0
votes
1answer
34 views

How to use the comment package within a footnote?

The comment package provides for different comment environments which one can selectively in- or exclude via a switch in the preamble. I haven't found out yet how to get it to work in footnotes yet ...
3
votes
1answer
24 views

Hide indented amsthm environment using comment package

I use amsthm to define a "Solution" environment. I want to be able to hide it. Following this comment I tried using the comment package: \documentclass{article} \usepackage{amsthm} ...
2
votes
1answer
66 views

When to use % and when to not [duplicate]

I have recently falled into an error because I didn't use % when I was supposed to. My question is now: When do I have to use % at the end of the line and when should I leave it out?
3
votes
0answers
35 views

Unrecognized special character with comment package [duplicate]

Why are the character with accent not recognized ? \documentclass[a4paper]{article} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage[french]{babel} \usepackage{comment} ...
4
votes
1answer
33 views

How to nest comment and theorem in one environment?

I'm using comment and amsthm packages for comments and theorems. I'd like to skip some theorems. I've tried to create a new environment with theorem nested in a comment: \documentclass{book} ...
9
votes
2answers
197 views

Ghost environment

I am trying to do the following. I would like a part of my source to be compiled normally by to generate no output. In particlular, I would like references made to the ghosted parts to be produce the ...
0
votes
0answers
38 views

How to fix comment indentation of code using the listings package?

My problem is that the code itself is indented correctly, but the comments (e.g. //comment) are not. In my source file, I aligned comments in one column by using tabs. In the pdf produced by LaTeX, ...
7
votes
1answer
108 views

Problems with comment package when comment contains diacritical characters

I often use comment package to include various comments to have possibility of creating output with omitting various temporarily comments However, recently I found out that I have problems when ...
2
votes
2answers
56 views

Framed minipage and `comments` package

I am preparing a classroom workbook with two versions: one with answers and one without. The student version has big, empty, framed boxes to handwrite their answers. The teacher version has suggested ...
8
votes
2answers
154 views

'Missing \begin{document}' when using the \lowercase trick

Mostly for fun, I'm trying to make % comments manipulatable using the \lowercase trick. For some reason, I'm getting a strange (to me) error: ERROR: LaTeX Error: Missing \begin{document}. --- TeX ...
6
votes
4answers
138 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
29 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
270 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
44 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
91 views

Texmaker magic comment

Is there any similar magic comment in Texmaker like those in Texstudio? Example:% !TeX program = xelatex
2
votes
0answers
42 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
114 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
114 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
65 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
363 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
70 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
23 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
73 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
49 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
39 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
113 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
70 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
87 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
89 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
42 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
65 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
45 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
85 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
67 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
128 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 ...
7
votes
2answers
182 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
183 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
196 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 ...