LaTeX Problem with latex todonotes package

  • Thread starter Thread starter DrDu
  • Start date Start date
  • Tags Tags
    Latex
AI Thread Summary
The discussion revolves around using the LaTeX todonotes package to create custom inline notes with adjusted line spacing. The user encountered an error message related to a runaway argument when defining a new command for tiny todo notes. The issue arises from the use of \renewcommand within the command, which causes problems in the document. A suggested workaround is to replace \renewcommand{\baselinestretch}{0.5} with \linespread{0.5}, which resolves the error without affecting the PDF output. However, the user noted that adjusting line spacing did not produce the expected results, particularly when increasing it. The discussion also highlights that the issue may be influenced by the document class being used, as one participant successfully implemented the changes without errors in a different setup.
DrDu
Science Advisor
Messages
6,421
Reaction score
1,003
I tried out the latex todonotes package. Specifically I defined in the preamble:

\usepackage{todonotes}
\newcommand{\tinytodo}[2][]
{\todo[size=\small,inline]{\renewcommand{\baselinestretch}{0.5}%
\selectfont%
[\uppercase{#1}]:~#2%
\par
}}

In the body I use:

\tinytodo[A]{``accute'' vs. ``protracted'' }

I get the following error message in the log:

Runaway argument?
{\@firstoftwo {\let \l@ngrel@x \relax \renew@command }}\def \reserved@b \ETC.
! Paragraph ended before \reserved@a was complete.
<to be read again>
\par
l.82 ...``accute'' vs. ``protracted'' }

?
[2]

Although ignoring it yields a correct pdf, I would like to get rid of it. Any ideas?
 
Physics news on Phys.org
The problem seems to be that the "renewcommand" ends up soewhere it shouldn't be.
If you change
\renewcommand{\baselinestretch}{0.5}%
to
\linespread{0.5}%
(which has the same effect) the error message goes away.

FWIW trying to reduce the line spacing this way doesn't seem to do much, but increasing it with say \linespread{2.0} works for me.
 
Thank you. I shall try it out on monday.
 
I tried it out. linespace did not change the interline spacing and I still get the same error messages.
 
Hmm... this works for me, in TeXLive on Windows, and no error messages.
Code:
\documentclass{article}
\usepackage{todonotes}
\newcommand{\tinytodo}[2][]
{\todo[size=\small,inline]{\linespread{2.0}%
\selectfont%
[\uppercase{#1}]:~#2%
\par
}}

\begin{document}
Some  text. \\
Line two
\tinytodo[A]
{A note with two lines\\
A note with two lines}
Line three \\
Line four
\end{document}
PDF output attached.
 

Attachments

I am using not article but svjour3.cls. Maybe that's the problem. I'll try it out.
Thanx for your help!
 

Similar threads

Replies
3
Views
2K
Replies
8
Views
12K
Replies
4
Views
3K
Replies
1
Views
5K
Replies
766
Views
738K
Back
Top