Generala simple \todo tag

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
eknight
Posts: 3
Joined: Wed Mar 26, 2008 11:08 am

a simple \todo tag

Post by eknight »

Hi there,

I realize there's many libraries out there with a \todo tag already. Some even with really cool floating boxes that don't disturb the text flow and stuff. I'm just learning LaTeX myself and so I'm trying to build a few of these tools on my own, just to learn.

What I would like is a simple \todo[1] command that places the argument text in a box and bolds it. At the moment I've got:

\newcommand{\todo}[1]{\mbox{}\\\fbox{\parbox{\textwidth}{\textbf{Todo: #1}}}\\}

which I found somewhere on the net. The problem is that this box is always the full width of the page and regardless of if I use \textwidth or \linewidth. If I place a todo in a table it completely disrupts the table.

I've tried taking out the \parbox, \fbox or \mbox but then I receive tons of errors further down the line which seem like I've got brackets missing or something.

thanks in advance for any advice,

eknight

P.S. what does the \\} mean at the end of the above statement? I can't seem to find a reference to explain what that is?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

balf
Posts: 158
Joined: Sat Jan 12, 2008 1:11 am

Re: a simple \todo tag

Post by balf »

You should try the marginnote package and define something like:
\newcommand{\todo}[1]{\marginnote{\fbox{\bfseries #1}}}%

You can set the \marginnotetextwidth parameter in the preamble and several other parameters (see the doc of the package).

As for \\, this is basic LaTeX: it denotes a newline.

B.A.
eknight
Posts: 3
Joined: Wed Mar 26, 2008 11:08 am

Re: a simple \todo tag

Post by eknight »

ach!! right \\ is just a new line :oops:

Thanks I'll try out the package you mentioned.
eknight
Posts: 3
Joined: Wed Mar 26, 2008 11:08 am

Re: a simple \todo tag

Post by eknight »

I've tried using the marginnote package, unfortunately I'm getting errors that the compiler can't find the marginnote.sty. I'm using the TeXnicCenter editor and just need to figure out how to configure it properly.

Does anyone have any suggestions for a simple todo command that doesn't require any additional packages?

Ideally it would simply add the text "TODO:", bold and draw a box around the entire todo text. Other than that it would remain consistent within the flow of the text. Ie. it wouldn't create it's own line. It would wrap (either as a complete box or break the box). It would flow current paragraph conventions (ie. if it's in a list or not).

Thanks again in advance
balf
Posts: 158
Joined: Sat Jan 12, 2008 1:11 am

Re: a simple \todo tag

Post by balf »

You also might use the \marginpar command (basic LaTeX), but it has some problems : it may appear not exactly where it should, and can't be used inside a float. No problem for ordinary text.

Anyway, it is strange that the compiler doesn't find marginnote.sty. Did you install marginnote manually or with MiKTeX's package manager? In the first case,did you think of refreshing the filename database? That might be the reason.

B.A.
Post Reply