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
.
\vphantom
exponent, as in$\noverline{\left\{ f \right\}^{\vphantom{x}} \; \left\{ \noverline{f} \right\}}$
. Change thex
to something else to affect the offset.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.