TransWikia.com

Commenting out a few words within a paragraph?

TeX - LaTeX Asked on April 21, 2021

Is there anyway by which I can comment out a word within a sentence?

4 Answers

This is probably the easiest way.

documentclass{article}
begin{document}

I like bacon, sausage,
% pork chops,
and ham.

% Note to self... try pork chops

end{document}

Correct answer by James on April 21, 2021

You can do this:

newcommand{cmmnt}[1]{}
...
begin{document}

Hello cmmnt{commented text} bye.

end{document}

A comment suggests eliminating undesired spaces around the comment:

newcommand{cmmnt}[1]{ignorespaces}
...

(This should be part of some "comment" package, if it is not already.)

Answered by alfC on April 21, 2021

I like the other solutions, but sometimes I wish that my comments would also appear in the output file. I tend to forget important comments that are buried in my source code.

I include

usepackage[colorinlistoftodos]{todonotes}

in the preamble and can then add in-line comments with

todo{This is a comment that will appear in the margin}

The result is beautiful "sticky note" comments which appear in the margins of my pdf. I can them remove them when I'm done with my draft.

See https://tex.stackexchange.com/a/178806/212801

Source

Answered by abrac on April 21, 2021

You can put a phantom in a vbox without any height.

vbox to0pt{phantom{Some wise words.}}

The problem with this is, that the comment gets parsed and typeset and therefor must be valid TeX code.

Answered by ceving on April 21, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP