I have a summer “To Do” list, and I’ve defined a completed item as
\newcommand{\doneItem}[1]{{ \color{black} \item{#1~\checkmark} }}(The rest of the items are in red.) What I’ve recently come across is that if a completed item’s text (the argument of the command) is just long enough, the
\checkmark gets orphaned on the next line, despite being separated by a
~!
I’ve concluded that what’s going on is that the argument of
\doneItem is being grouped as one box and then the
~\checkmark is being parsed. Thus, the line breaking cannot occur earlier in the sentence. I’m not exactly sure why TeX decides it’s better to break the line at the non-breaking space, rather than allow an overfull hbox.
Regardless of the details of why TeX decides what it does (though I’d be interested in knowing this, too), this raises two questions:
- How can I get TeX to break the line at an earlier point when necessary, so that the checkmark will always follow at least one word?
- The
\item command doesn’t work quite like most LaTeX commands, and so I’ve basically done a dirty deed here. It would be more appropriate to define something like two commands: \toDo and \done, which each emulate \item’s behavior within the list. How should this most appropriately be done? And, of course, once done, how can I ensure that the final check mark is never separated from the word preceding it
I’ve had a look at Lamport’s
LaTeX, but I didn’t find an answer. It must be in there somewhere, right? Or maybe some package like “enum” is what I need?
Edit: The simple answer is the correct one, in this case. I had left a trailing space at the end of the argument of
\doneItem. TeX was breaking the line there. Removing it did the trick.