# Why is \Cline increasing the font size in my equations?

The Problem

When I use \Cline to underline a symbol in my equation, it increases the font size of that symbol. Edit: I don't want this to happen, rather, I would like all of my subscripts to be the same size, regardless of whether they are underlined or not.

Minimum Working Example

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{xcolor}
\newsavebox\MBox
\newcommand\Cline[2][red]{{\sbox\MBox{$#2$}%
\rlap{\usebox\MBox}\color{#1}\rule[-1.2\dp\MBox]{\wd\MBox}{0.85pt}}}

\begin{document}
$$\bar{\nabla}_{\!\mu}h_{\Cline{\rho\sigma}}$$
\end{document}


Edit - Follow-up Question: The Cherry on the Cake

Would it be possible to achieve the right-hand-side of the following image?

At the moment, egreg's code (see below) will give the left-hand-side output for the code

$$\bar{R}_{\tau\Cline{\sigma}\nu\Cline{\rho}}$$


This is a marked improvement on the look to the output of the MWE above. However, I think it looks nicer if all the Cline lines are 'at the same level to the eye'.

-
You're basically using a construction with \mbox that uses by default the main text font size. –  egreg Feb 1 '13 at 13:37
Pardon me, I forgot to ask the actual question, which is "how can I change the font size of the underlined symbol to match that of the other subscripts?" –  User 17670 Feb 1 '13 at 13:42
For the "cherry" problem you need to say \Cline{\vphantom{\rho}\sigma}. I'm not sure if the result is really better. –  egreg Feb 2 '13 at 13:36

You can exploit \text that will do the right font size selection:

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{xcolor}
\newsavebox\MBox
\newcommand\Cline[2][red]{%
\text{% We use \text so the size will be the right one
\sbox\MBox{$#2$}% We typeset the argument
\rlap{\color{#1}\rule[-\dimexpr\dp\MBox+1pt\relax]{\wd\MBox}{0.85pt}}% the rule
\usebox{\MBox}% the text
}% end of \text
}

\begin{document}
$$\bar{\nabla}_{\!\mu}h_{\Cline{\rho\sigma}}$$
\end{document}


By setting the depth of the rule with \dimexpr we can be sure that the text will not be overwritten, because there will be 0.15pt between the text and the rule.

A different implementation without doing any measurement:

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{xcolor}

\newcommand{\Cline}[2][red]{%
\text{%
\oalign{$#2$\cr\color{#1}\leaders\hrule height 0.85pt\hfil\cr}%
}%
}

\begin{document}
$$\bar{\nabla}_{\!\mu}h_{\Cline{\rho\sigma}}$$
\end{document}


You can adjust the vertical spacing between text and rule by adding a suitable

\noalign{\vskip-??pt}


(where ?? is some number) just after the first \cr.

Using a fixed rule thickness can be viewed as wrong; so here's a different specification:

\newcommand{\Cline}[2][red]{%
\text{%
\oalign{$#2$\cr\color{#1}\leaders\hrule height 0.2ex\hfil\cr}%
}%
}


At 10pt size, 0.2ex is 0.86pt, so this is the same as your setting; but this will be slightly less in subscripts; with

$$\bar{\nabla}_{\!\mu}h_{\Cline{\sigma}}\Cline{aaa}$$


we would get the preferable1 output

1 Thanks to David Carlisle for insisting in recommending this variable thickness as preferable.

-
ah I was all ready to post a \mathpallete version as well:-( shouldn't that .85pt be .085em (which is a bit easier using \text than using \mathpallete as the em size will change) –  David Carlisle Feb 1 '13 at 13:54