4

I can format h_y using the command $\overline{h_y}$, but I want to type h_y,max where y,max is subscript but the horizontal line of overline only cover h_y.

Thank you

2
  • Probably not ideal, but what about $\overline{h_y}{}_{,max}$? – leandriis Jun 5 '19 at 7:13
  • Can you explain what the notation should mean? I would suspect something like $(\overline{h_y})_{\max}$ would be more appropriate, but the context matters. – Andrew Swann Jun 5 '19 at 7:56
4

Though I think this notation might confuse the reader, here is a solution which makes the max part have zero width by using \mathrlap. The following \hphantom puts (nearly) the same amount of space back in.

\documentclass{article}
\usepackage{mathtools}

\begin{document}
$\overline{h_{y,\mathrm{max}}} = 1$
\medskip

$\overline{h_{y\mathrlap{,\mathrm{max}}}}_{\hphantom{,\mathrm{max}}} = 1$
\end{document}

enter image description here

2
\documentclass{article}
\usepackage{mathtools}
\begin{document}

$\overline{h_{y\mathrlap{,\max}}}$ \qquad foo

\end{document}

enter image description here

1
  • Why \qquad? That's arbitrary. – egreg Jun 5 '19 at 22:54
2

The simplest strategy is to add an overline with the desired width (but occupying no horizontal space) and then typeset the symbol to be partially overlined.

\documentclass{article}
\usepackage{mathtools}

\newcommand{\partialoverline}[1]{%
  \mathrlap{\overline{\phantom{#1}}}%
}

\begin{document}

$\partialoverline{h_y}h_{y,\max}$

\end{document}

enter image description here

1
  • Great short macro code. – Sebastiano Jun 5 '19 at 23:05
1

My proposal is to use a spartan macro called \oversize.

enter image description here

\documentclass[a4paper,12pt]{article}
\newcommand{\oversize}[1]{\mkern-1.5mu\overline{\mkern-1.5mu#1\mkern-28mu}\mkern30mu}
\begin{document}
$\oversize{h_{y,\mathrm{max}}}= 1$
\end{document}

Changhing the values of two \mkern of \overline{\mkern0mu#1\mkern-10mu} you can increase the lenght of \overline. The last \mkern10mu it is only to bring closer to the code equality and 1. See the example below.

enter image description here

\documentclass[a4paper,12pt]{article}
    \newcommand{\oversize}[1]{\mkern-1.5mu\overline{\mkern0mu#1\mkern-10mu}\mkern10mu}
    \begin{document}
    $\oversize{h_{y,\mathrm{max}}}= 1$
    \end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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