Here I use the stackengine
package to develop the macros \markabove
and \markbelow
that uses text lapping to achieve an edit, without affecting the layout of the original document, if you are careful with your %
signs. It works in footnotes, too, as shown.
EDITED to allow a TODO like functionality, when your comments are too long to stick directly into the text.
\documentclass{article}
\textheight=6in
\usepackage{xcolor}
\usepackage{stackengine}
\setstackgap{L}{.5\baselineskip}
\newcommand\markabove[2]{{\sffamily\color{red}\hsmash{$\uparrow$}%
\smash{\toplap{#1}{\scriptsize\bfseries#2}}}}
\newcommand\markbelow[2]{{\sffamily\color{red}\hsmash{$\downarrow$}%
\smash{\bottomlap{#1}{\scriptsize\bfseries#2}}}}
\usepackage{ifthen}
\newcounter{todoindex}
\setcounter{todoindex}{0}
\newcommand\TODO[1]{%
\addtocounter{todoindex}{1}%
\expandafter\def\csname todo\roman{todoindex}\endcsname{#1}%
\markabove{c}{\Alph{todoindex}}%
}
\newcounter{index}
\newcommand\showTODOs{%
\vspace{5ex}%
\rule{10ex}{.5ex}\textcolor{red}{TO-DO LIST}\rule{10ex}{.5ex}\\%
\setcounter{index}{0}%
\whiledo{\value{index} < \value{todoindex}}{%
\addtocounter{index}{1}%
\markabove{c}{\Alph{index}} \csname todo\roman{index}\endcsname\\%
}%
}
\begin{document}
When writing documents\footnote{Note, this is a copy of the OP's
\markbelow{c}{That is the name for the questioner}%
text}, I like to 'mark up'
\markabove{c}{Do you mean like this?}%
draft/partial text (e.g., short summaries
\TODO{I am using the TODO macro for longer notes that do not fit into a single
line, or are otherwise inconvenient to make short}%
of what will go in a section) so that I can clearly see what needs to be adjusted. I know that things like the todonotes package exist (see this question, for example), but I want something
\markbelow{r}{, anything actually,}%
that can span arbitrary parts of the document (e.g., multiple paragraphs or even sections with whatever text is in there).
I have been using the color package's \verb|\color| 'switch'
\TODO{I presume you actually meant that you are using the \textsf{xcolor}
package, since it improves upon the functionality of the former package.}%
to do this (with an alternate \verb|\textcolor| based command for short inline bits of text), with commands like this:
\begin{verbatim}
\usepackage[usenames,dvips]{color}
\newcommand{\todo}[1]{\textcolor{Purple}{#1}}
\newcommand{\startToDo}{\color{Purple}}
\newcommand{\stopToDo}{\color{Black}}
\end{verbatim}
However, this has problems in various situations (such as footnotes, URLs, tables), some dependent on the particular other packages used. (See this question and this one.)
\markabove{r}{I'm sorry, but the links didn't show}%
Does anyone have any ideas on a robust alternative I could use? I would prefer not to use marginal lines (as used to indicate changes) so that it is clear exactly which bits of text, figures, etc. are included. Differently-coloured
\markbelow{l}{and lapped, I think}%
text was the obvious choice for me.
There's a chance that my outstanding question will get an answer that 'fixes' my explicit \verb|\color| usage (though I imagine with lots of very arcane low-level TeX) but obviously a pre-existing package or simple LaTeX that achieves the same or similar effect would be better.
\showTODOs
\end{document}
Best Answer
Spaces are ignored in the arguments of
\mathbf
and\mathit
, but not in the arguments of\textbf
and\textit
.Also, you can't combine
\mathbf
and\mathit
. E.g.,\mathbf{\mathit{xyz}}
produces xyz rather than xyz.And, of course, the outputs of
\mathbf
and\textbf
will differ if you use different fonts for math-mode and text-mode material.