6

Could someone kindly help me how I can correctly display the following formula?

(\pi\rho\overline{\Gamma_\theta}\overline{R_\theta}^2)

The output is shown below.

enter image description here

However, the overline should not be continuously extending over both \Gamma_\theta and R_\theta. I would expect something like the following, which is the edited version of the above picture using Microsoft Paint.

enter image description here

6
  • 3
    \overline{\Gamma}_{\theta}\overline{R}_{\theta}^{2}
    – egreg
    Commented Jul 7, 2014 at 17:56
  • I actually want to show that the averaging is on \Gamma_\theta and not on \Gamma. Please let me know of your thoughts. Commented Jul 7, 2014 at 18:07
  • You could insert a "thinspace", \,, between the two groups of variables. However, I think the expression looks a lot better if you do not extend the overline over the subscript \thetas, i.e., if you follow @egreg`s advice.
    – Mico
    Commented Jul 7, 2014 at 18:11
  • 2
    i think this looks better still: (\pi\rho\overline{\Gamma_{\!\theta}} \,\overline{\!R_\theta}^2) with a few more space adjustments. Commented Jul 7, 2014 at 18:15
  • Thank you @barbara beeton, @egreg, and @mico. Barbara's solution is exactly what I want. I also agree that @egreg's solution is simpler and nicer. It would be great to have your thoughts on what this \overline{\Gamma}_{\theta} implies? Does it imply averaging over \Gamma or \Gamma_theta? Commented Jul 7, 2014 at 18:21

1 Answer 1

4

Shortening the overline on the right when a subscript is involved seems the best thing to do; it won't completely cover the subscript, but it doesn't seem really necessary:

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\newcommand{\average}[2][0]{{%
  \mspace{#1mu}%
  \overline{\mspace{-#1mu}\average@check#2\relax}%
}}
\newcommand\average@check[1]{%
  #1\@ifnextchar_{\average@sub}{}%
}
\newcommand{\average@sub}[2]{% #1 is _
  _{#2}\mspace{-2mu}\aftergroup\average@compensate
}
\newcommand{\average@compensate}{\mspace{2mu}}
\makeatother

\begin{document}

$(\pi\rho\overline{\Gamma_\theta}\overline{R_\theta}^2)$

$(\pi\rho\average{\Gamma_\theta}\average[2.5]{R_\theta}^2)$

$\average[2.5]{R}$

\end{document}

The optional argument is meant to shorten the overline on the left when the argument is slanted. The first line is the original \overline.

enter image description here

2
  • Errors and other odd things happen for $\average{\mathrm{R}_\theta}$.
    – Dan
    Commented Jul 7, 2014 at 20:48
  • 1
    @Dan Surely so; complex arguments like this should be input as \average{{\mathrm{R}}_\theta}. The alternative is to have separate macros for variable with or without subscripts.
    – egreg
    Commented Jul 7, 2014 at 21:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .