Commenting out a few words within a paragraph?

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

• Could you clarify what you mean by "comment[ing] out a word within a sentence"? Please provide us with an example.
– Werner
Nov 5, 2015 at 6:03
• In my case, I wanted to cite a few papers, but I was't sure if one of them was the correct reference. I wanted to leave a note for myself to check that specific reference later.
– Reza
Nov 5, 2015 at 7:33
• I'd suggest looking into using the todo package. Your goal seems different than the question though...
– Werner
Nov 5, 2015 at 11:11

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}


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.)

• You could throw in a \ignorespaces Jul 15, 2016 at 22:35
• Do you mean use \newcommand{\cmmnt}[1]{\ignorespaces} to avoid creating spurious spaces in the text (coming from surrounding the command with actual spaces)?
– alfC
Jul 15, 2016 at 23:41
• Ja. Da. Oui. Si. (Is that 15 letters yet?) Jul 16, 2016 at 3:41
• Perhaps even better than \ignorespaces is \newcommand{\cmmnt}[1]{\@bsphack\@esphack}. The \ignorespaces approach fails with Lorem\cmmnt{ipsum} dolor, while \@bsphack\@esphack don't (these two macros are used by the LaTeX kernel for commands which don't produce typeset output, like \label. See: tex.stackexchange.com/a/201821/134574). Mar 18, 2019 at 20:17

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}


\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.

Source

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.