1

I would like to obtain consistent spacing of symbols obtained with a \stackrel when they are next to a \mathrel operator such as the colon (:). Out of the box, the \stackrel symbols have their spacing relative to operators reduced.

MWE:

\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage{mathtools}
\everymath{\displaystyle}
\begin{document}
\[\begin{array}{ll}
Hc
\\
H\stackrel{\triangledown}{c} &\text{ spacing increased}
\\
-
\\
H:c
\\
H:\stackrel{\triangledown}{c} &\text{ spacing reduced!}
\\
H\mathbin{:}\stackrel{\triangledown}{c} &\text{ with mathbin}
\]
\end{document}

result

Turing the colon into a mathbin isn't any better, as spacing is not symmetric either.

Alternatively, if there's a better way (including for vertical positioning) than \stackrel to produce these symbols, this is welcome.

1
  • 1
    You don't want \stackrel, but rather \overset.
    – egreg
    Dec 20, 2023 at 15:43

1 Answer 1

3

You want \overset rather than \stackrel (the latter always makes a relation symbol).

\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage{mathtools}

%%%%%%%\everymath{\displaystyle}%%%% DON'T!!!!

\begin{document}

\[
\begin{array}{l}
Hc\\
H\overset{\triangledown}{c}
\\
H:c
\\
H:\overset{\triangledown}{c}
\end{array}
\]
\end{document}

enter image description here

On the other hand, accents does a better job.

\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage{mathtools}
\usepackage{accents}

%%%%%%%\everymath{\displaystyle}%%%% DON'T!!!!

\begin{document}

\[
\begin{array}{l}
Hc\\
H\accentset{\triangledown}{c}
\\
H:c
\\
H:\accentset{\triangledown}{c}
\end{array}
\]
\end{document}

enter image description here

Don't do \everymath{\displaystyle}.

2
  • Thanks for this. accents is interesting, but I run into problems when I use it within comments I produce with todonotes or even within figure captions: is there a way to make it robust wrt such inclusions?
    – Joce
    Dec 21, 2023 at 8:54
  • 1
    @Joce Add \NewDocumentCommand{\trdown}{m}{\accentset{\triangledown}{#1}} to your preamble and use \trdown{c} in the document (choose a name you like for the command).
    – egreg
    Dec 21, 2023 at 9:20

You must log in to answer this question.

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