# Overlines, delimiters, and overlines again

Follow-up question to: Stretchable delimiters ignoring overline

Consider the following code:

$\left\{ f \right\} \; \left\{ \overline{f} \right\}$


The output in this case is not very satisfying, since braces in the right-hand example are extended to cover the overline, producing different brace height. In the mentioned question, a solution was proposed by @Steven B. Segletes:

\newcommand\noverline[1]{\vphantom{#1}\smash{\overline{#1}}}
$\left\{ f \right\} \; \left\{ \noverline{f} \right\}$


So far so good. Now I want to introduce an overline above the whole braced set, but the two overlines are typeset at the same height, so the outer one (which I would like to be slightly above) fully covers the inner one:

\newcommand\noverline[1]{\vphantom{#1}\smash{\overline{#1}}}
$\noverline{\left\{ f \right\} \; \left\{ \noverline{f} \right\}}$


Any clue how to obtain this? In the document I am currently typesetting I need to nest delimiters and overlines up to 3 levels, so I am afraid a one-shot solution will not cut it. Thanks in advance!

• In my application, it is. – Jaeya Jul 7 '16 at 14:09
• I don't know a simple, general fix, but the particular situation can be addressed by introducing a \vphantom exponent, as in $\noverline{\left\{ f \right\}^{\vphantom{x}} \; \left\{ \noverline{f} \right\}}$. Change the x to something else to affect the offset. – Steven B. Segletes Jul 7 '16 at 15:15
• For something more general, a stackengine approach, such as \myoverline at tex.stackexchange.com/questions/167954/overline-thickness/… allows offsets to be specified, and may help you in this case. – Steven B. Segletes Jul 7 '16 at 15:22

Here I show it 5 times. 1st example shows the \left...\right problem, example 2 shows the fix for that from Stretchable delimiters ignoring overline.

The current problem is shown in example 3, with a \vphantom fix given in example 4 and the \myoverline fix in example 5,as referenced in Overline thickness, and modified to take an optional real number for the overline offset.

\documentclass{book}
\usepackage{stackengine}
\usepackage{scalerel}
\parskip 1ex \relax
\parindent 0pt\relax
\newcommand\noverline[1]{\vphantom{#1}\smash{\overline{#1}}}
\newcommand\myoverline[2][1.2]{\ThisStyle{%
\setbox0=\hbox{$\SavedStyle#2$}%
\stackengine{#1\LMpt}{$\SavedStyle#2$}{\rule{\wd0}{.4\LMpt}}{O}{c}{F}{F}{S}%
}}
\begin{document}
Original, with problem:\\
$\left\{ f \right\} \; \left\{ \overline{f} \right\}$

Referenced \verb|\noverline|:\\
$\left\{ f \right\} \; \left\{ \noverline{f} \right\}$

problem in current question:\\
$\noverline{\left\{ f \right\} \; \left\{ \noverline{f} \right\}}$

Vphantom superscript:\\
$\noverline{\left\{ f \right\}^{\vphantom{x}} \; \left\{ \noverline{f} \right\}}$

With \verb|\myoverline| and \verb|\noverline|:\\
$\myoverline[1.9]{\left\{ f \right\} \; \left\{ \noverline{f} \right\}}$
\end{document}


The net result is that we can now dispense with \overline and replace the reference to it in \noverline with \myoverline, so that \noverline can now take the optional argument of \myoverline (and works across math styles).

\documentclass{book}
\usepackage{stackengine}
\usepackage{scalerel}
\newcommand\noverline[2][1.2]{\vphantom{#2}\smash{\myoverline[#1]{#2}}}
\newcommand\myoverline[2][1.2]{\ThisStyle{%
\setbox0=\hbox{$\SavedStyle#2$}%
\stackengine{#1\LMpt}{$\SavedStyle#2$}{\rule{\wd0}{.4\LMpt}}{O}{c}{F}{F}{S}%
}}
\begin{document}
$\noverline[1.9]{\left\{ f \right\} \; \left\{ \noverline{f} \right\}}$

$\scriptscriptstyle\noverline[1.9]{\left\{ f \right\} \; \left\{ \noverline{f} \right\}}$
\end{document}


Note: If one wants the smaller math style overline to remain as thick as in display style (which is the case for the original \overline), then one need merely change the .4\LMpt length to .4pt, in the definition of \myoverline.

• This works awesome, and it gave me quite a lot of insight on how to do a few other things. Thank you so much! – Jaeya Jul 12 '16 at 8:45
• @Jaeya Glad to have been of some assistance. – Steven B. Segletes Jul 12 '16 at 10:15