Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to mark portions of my text that requires special attention during the review process. This marking won't be in the final document, so would like to be able to add these marks without affecting the spacing or alignment of the text. I don't want to change the color of the text, or add highlighting as that would be too distracting.

The MWE below results in additional spacing which I want to avoid. I attempted to use \kern-\widthof{} but could not get that to work.

I am not stuck on this approach so if someone has an alternative way to do this that is fine.

\documentclass{article}
\usepackage{amsmath}
\usepackage{mathabx}
\usepackage{xcolor}
\usepackage{calc}

\DeclareRobustCommand{\MarkStart}{\textcolor{green}{\raisebox{5pt}[0pt][0pt]{$\Rsh$}}}%
\DeclareRobustCommand{\MarkEnd}{\textcolor{green}{\raisebox{5pt}[0pt][0pt]{$\Lsh$}}}%

\newcommand*{\KernMarkStart}{\kern-\widthof{\MarkStart}}%
\newcommand*{\KernMarkEnd}{\kern-\widthof{\MarkEnd}}%

\newcommand*{\MarkStartWithKern}{\MarkStart\KernMarkStart}%
\newcommand*{\MarkEndWithKern}{\MarkEnd\KernMarkEnd}%

\newcommand*{\Mark}[1]{\MarkStart#1\MarkEnd}%
%\newcommand*{\Mark}[1]{\MarkStartWithKern#1\MarkEndWithKern}%
\begin{document}

Without changing the spacing, I want to mark
this word.

Without changing the spacing, I want to mark
\Mark{this} word.

\bigskip
Similary with inline math, I want to mark the $y^2$ term:

$x^2 + y^2 = z^2$.

$x^2 + \Mark{y^2} = z^2$.

\bigskip
With display mode math things should also be marked similarily:
\begin{align*}
a &= b\\
x^2 + y^2 &= z^2\\
x^2 + \Mark{y^2} &= z^2\\
c &= d
\end{align*}

and should be able to mark entire equation as:
\begin{align*}
a &= b\\
\Mark{x^2 + y^2 &= z^2}\\
c &= d
\end{align*}

The above should align with:
\begin{align*}
a &= b\\
x^2 + y^2 &= z^2\\
c &= d
\end{align*}
\end{document}

I am using the solution from Changbars to indicate location of conditional text so that the location of these markings is easy to locate so the fact that these markings don't stand out is ok.

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted
\DeclareRobustCommand{\MarkStart}{{%
  \setbox0=\llap{\raisebox{5pt}{\color{green}$\Rsh$\kern-6pt}}%
  \ht0=0pt \dp0=0pt \leavevmode\box0
}}
\DeclareRobustCommand{\MarkEnd}{{%
  \setbox0=\rlap{\raisebox{5pt}{\color{green}\kern-6pt$\Lsh$}}%
  \ht0=0pt \dp0=0pt \leavevmode\box0
}}
\newcommand*{\Mark}[1]{\MarkStart#1\MarkEnd}

I set the symbols in a box that's given zero width (via \llap or \rlap), height and depth, which is then typeset. Beware that in math mode it behaves as an ordinary symbol, so it can affect spacing.

share|improve this answer
    
Thanks. Seems to have no problems in math mode at least with the MWE above. But, how did you figure out the \kern-6pt? Is that just trial and error? It seems that that'll have to be adjusted if the symbol is changed? –  Peter Grill Jul 26 '11 at 21:10
    
Trial and error; adjust it at will. It might have problems in cases such as \sin\Mark{(x+y)}, where the Ord takes the place of an Open atom. –  egreg Jul 26 '11 at 21:18
    
Yep, also has issues with \Mark{\sin(x+y)}. Any idea why \kern-\widthof{} didn't work? I guess that should probably be a separate question. –  Peter Grill Jul 26 '11 at 22:04
    
With my macros, \MarkStart and \MarkEnd have width zero. The two objects should stay next to an ordinary symbol, in order not to affect math spacing. Even if they had width the \kern would have the same problem. –  egreg Jul 26 '11 at 22:13
1  
Letters in any alphabet are ordinary symbols (Ord). Conversely \sin is an operator (Op) and ( is an opening (Open). TeX inserts no space between an Op and an Open; instead it inserts a thin space between an Op and an Ord. There are also Rel (<) and Bin (+) atoms. I wouldn't worry too much of some slightly incorrect space: when the paper will be final, the commands will be deleted. –  egreg Jul 26 '11 at 22:34
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.