views:

1081

answers:

6

I use the \todo command from the \todonotes package. I'd like to layout my source to put \todos separately from the previous paragraph:

Some text.

\todo{make note}

But I don't want \todo to start a new paragraph, or it screws up the spacing of the document.

Is there a command to avoid this?

If there were a command/package to consume the whitespace up to it, then I could redefine \todo to use it.

Edit: Adding a % between everything is obviously very irritating. Anything else?

+4  A: 

Try this:

Some text.
%
\todo{make note}
redtuna
Adding a % between everything is obviously very irritating. Anything else?
Paul Biggar
@Paul Biggar Clearly, you and I have different tolerances. ;-)
Sinan Ünür
@Sinan Ünür: Well, I have to do it everywhere. That's why I asked for a command to consume whitespace.
Paul Biggar
+1  A: 

How about

Some text.
%
\todo{make note}
%
some more text
Sinan Ünür
Adding a % between everything is obviously very irritating. Anything else?
Paul Biggar
There must be something wrong with me because I have been doing this since 1993 whenever I wanted to leave some space in the middle of a paragraph without LaTeX creating paragraphs. I was never motivated to even wonder if there is any other way of doing it.
Sinan Ünür
@Sinan Ünür: Clearly, you lacked an important project to procrastinate on ;)
Paul Biggar
+2  A: 

may be you shouldn't leave new line between the text and the todo note or just comment it

Some text.
%
\todo{make note}
stefita
Adding a % between everything is obviously very irritating. Anything else?
Paul Biggar
not sure if this would work but if you want to leave new line between text and note you could try adding a backspace character in front of the todo command\b\todo{make note}
stefita
Just leave out the blank line completely? The only way for latex to start a new paragraph is a blank line
Martijn
well the asker seems to want to avoid new lines in the output, but leave those in the source code (may be for readability reasons)
stefita
@stefita: that's exactly right. Its for readability.
Paul Biggar
Why not indent the \todo instead of leaving the blank line? That should be at least as readable.
las3rjock
+2  A: 

I have to agree with everybody else that you should probably just add the %, but I do find this question interesting. The problem is that as soon as LaTeX reads the empty line, it gets converted into the \par command, which ends the previous paragraph. At the beginning of \todo, that \par command has already been executed, and it's impossible to undo it (I think). So your only hope is to keep that \par from being inserted or from behaving like it normally does. If you want to prevent it from being inserted, you could try reading Chapter 8 of "The TeXbook", which should tell you how an empty line is converted to \par. Alternatively, you could try to make a solution based on the following kind of idea:

Some text.{\let\par\relax

\todo{make note}}

But watch out! You definitely don't want to globally change the behavior of \par, which is why I added an extra pair of curly braces (LaTeX commands are scoped, so the new definition of \par only takes effect within the group where the definition was made). Good luck.

Anton Geraschenko
I think this is as correct an answer as I can get.
Paul Biggar
A: 

just include your \todo right in the middle of your text. no line break, no nothing.

blah blah blah text \todo{Do this now!} more text blah blah blah.

on my computer (win xp, miktex 2.7, texniccenter) this work fine, produces no line break, and puts the todo note in the margin. . .

Mica
I think the original questioner really wants to make the `\todo` visually distinctive in the **source**.
Anton Geraschenko
with the specifier to the todo package, like \todo[inline]{to do text} it adds the to do in the margin with a line connecting it to the text... if you use the [inline] option it will take the whole line and put the background color to orange by default.
Mica
+1  A: 

Set \endlinechar=-1 to make empty lines have no effect. You will need to use \par to separate paragraphs, which I think is a bigger irritation than having to type % on separator lines, but that's what you're asking for.

Jouni K. Seppänen
What I'm really asking for is the ability to say "the last blank line had no effect. But very interesting, thank you.
Paul Biggar
I don't think that's going to be easy. When TeX has already taken the last blank line as a paragraph separator, it has finalized the previous paragraph and added it to the list of boxes for the page, and possibly decided that the page was full and called the output routine for the page. I hesitate to say that undoing this is an impossible request given the tricks that TeX wizards can do, but I do think you need to find someone intimately familiar with TeX to help you with this.
Jouni K. Seppänen