I am writing a text which I will review later again and want to comment out only a part of a line (in between), something like this:

Once upon a time, there was %in some galaxy far away%
a nice and cute rabbit...

When I review it again, I could decide if it is better to include that part or not.

Is it possible to do such a thing?


LaTeX/TeX do not support mid-line comments. the % character will start a comment which will end at the start of the new line.

What you can do is split your lines, like so

Start your
% text this
  • 4
    Since LaTeX/TeX allows you to have almost as many linebreaks in your source code as you want, I tend to write very short lines (at least one per sentence). It allows for easy part-comments (like in this answer) and is beneficial to source control (when diff-ing).
    – fheub
    Jul 14 '16 at 16:41
  • 1
    «LaTeX/TeX do not support mid-line comments» is the clear, short answer that I was looking for :)
    – Luis
    Jul 14 '16 at 19:52

You could use a so-called “meta-comment”, something like this:

This is typeset. \iffalse This is not. \fi This is typeset again.

Note the position of the spaces.

  • This idea is really handy. It has the plus that it makes it easy to search for \textit{things that I left unfinished somewhere} later on. I can get used to it :)
    – Luis
    Jul 15 '16 at 16:29

Not the answer you're looking for? Browse other questions tagged or ask your own question.