# \underline and \overline spacing problem in the definition of mathematical operators

Disclaimer: I searched the TEX.SE before deciding to post this question since, despite having see several question addressing the spacing behavior of the \overline and \underline operators, no one of them seems giving me some advice on how to solve the problem described below. However, due to tight timing, I may have missed to find the right Q&A.

I want to define a set of symbols for the integral analogues of usual vector operators \DeclareMathOperator{\nabla}, \DeclareMathOperator{\nabla\cdot}, \DeclareMathOperator{\nabla\times} and finally \DeclareMathOperator{\Delta} that Claus Müller used in his1969 monograph Foundations of the Mathematical Theory of Electromagnetic Waves (pp. 20-22): since they are integral analogues, I thought to \overline the usual del operator and \underline the Laplace operator symbols, in order to construct all other these basic symbols by vaguely recalling a "mean value" concept. So I tried the following, simple code

\documentclass{article}
\usepackage{amsmath}
%\usepackage{fouriernc}
%\usepackage{stix}
\DeclareMathOperator{\inabla}{\overline\nabla}
\DeclareMathOperator{\privalov}{\underline\Delta}
\begin{document}
$\inabla\quad\privalov$
\end{document}


However, while being nearly satisfied of the result when using the Computer Modern fonts,

1. I would like to reduce further the spacing between the symbols and the lines over/below them, in order to make them appear as unique symbol, not merely the juxtaposition of two, and

2. I noticed that the above defined operators does not behave well under font changes from the point of view of point 1, as shown in the following picture since the spacing increases too much (obviously fro my aesthetic point of view)

Thus my question is: is it possible to reduce the spacing between \overline and \underline operators and the \nabla and \Delta symbols while maintaining the triangular shape and expressing the spacing as a fraction of the symbol height, in order to maintain the feel "font change invariant"?

• Why are you using \DeclareMathOperator? – GuM Jul 10 '19 at 23:49
• @GuM just because I currently do not write TEX/LaTEX code on a daily basis, so I use methods taken from manuals when I do my writing experiments. For example I have borrowed this way of defining a mathematical operator from from the standard Goossens & Mittelbach The LaTEX Companion (2nd ed.), pp. 500-ff. If you want to suggest a better way to doing things, you are welcome. – Daniele Tampieri Jul 11 '19 at 4:12
• @GuM nice observation: so, in order to keep the correct horizontal spacing, particularly the feel of the binary operator which is usually associated to the vector notation for the gradient, the divergence and the curl is advisable to use the \newcommand declaration. Thank you for sharing your insight. – Daniele Tampieri Jul 11 '19 at 15:28

The answer is yes or no (depending on your point of view) the texbook says

\rule 10. If the current item is an Under atom (from ^|\underline|), set box~$x$ to the nucleus in style $C$. Then replace the nucleus by a vtop made from box~$x$, kern~$3\theta$, and hrule of~height~$\theta$, where $\theta=\xi_8$ is the default rule thickness; and add $\theta$ to the

so the separation and the rule thickness are bound together if I make it over-large for effect you see:

\documentclass{article}
\usepackage{amsmath}
\usepackage{amsmath}
%\usepackage{fouriernc}
%\usepackage{stix}
\DeclareMathOperator{\inabla}{\overline\nabla}
\DeclareMathOperator{\privalov}{\underline\Delta}
\begin{document}
aaa
$\inabla\quad\privalov$
bbb\fontdimen8\textfont3=10pt
$\inabla\quad\privalov$
\end{document}


So it may be that by reducing fontdimen8 you get an acceptable setting, but that may make the actual bars too thin, depending on what you want.

The alternative is to avoid the underline primitive and construct the bars by hand using explicit rules.