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 desire to "highlight" in equational proofs the expressions that are substituted for or transformed in each successive step. Since an expression may be transformed in both the prior step and the next step, it could need possibly two highlights in the same equation.

For a simple example see my answer here, on a universal divisibility test. There I'd like to highlight the leading digits being replaced in each step. My first thought was to use a colored under/overline, but I don't know how to color just the overline and not the expression . I can't color the expression too since it may have a different colored overline and underline if it was changed from both the prior and next equation.

Alternatively, I'd be grateful for suggestions on alternative approaches to achieve such highlighting.

share|improve this question
add comment

1 Answer

You can save the current colour using \colorlet from the xcolor package. So, set the colour of the overline, then typeset the object underneath using the stored colour, not forgetting that this happens inside a group, so you also need to restore the original colour at the end.

\documentclass{article}
\usepackage{xcolor}
\newcommand\blueoline[1]{\colorlet{temp}{.}\color{blue}\overline{\color{temp}#1}\color{temp}}
\begin{document}
\[
\blueoline{abc}123
\quad
\blueoline{\textcolor{red}{def}}456
\quad
{ \color{red} \blueoline{ghi}789}
\]
\end{document}
share|improve this answer
1  
Thanks. I found that this works \color{blue}{\underline{\color{red}{\overline{\color{black}{123}}}}}. I'm not sure why it didn't work in the context I tried it in before posting the question. Perhaps a MathJax glitch? Btw, is there some way to get colorlet in MathJax (on Math.SE)? Also, any better ideas on how to do multiple highlights vs. colored lines? –  Bill Dubuque May 23 '12 at 16:33
add 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.