2

I want to reduce the vertical space between a symbol and a letter that are above each other. I have the following code, using a new command $\oset$ that gives exactly the output I need. But unfortunately I get a compiling error, namely: missing $ inserted. When I use $\overset$ the output is wrong, but the compiler works..

\documentclass{article}
\usepackage{amsmath}
\makeatletter
\newcommand{\oset}[2]{%
   {\mathop{#2}\limits^{\vbox to -.5\ex@{\kern-\tw@\ex@
    \hbox{\scriptsize #1}\vss}}}}
\makeatother

\begin{document}
$\oset{\sim}{t}$ gives a compiling error.
$\overset{\sim}{t}$ works, but the $\sim$ too high. 
\end{document}
| improve this question | | | | |
  • 2
    \hbox{$\scriptstyle #1$} – egreg Oct 29 '19 at 15:51
4

It should be \hbox{$\scriptstyle#1$}. However, there's a better way:

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\newcommand{\oset}[2]{{\mathpalette\o@set{{#1}{#2}}}}
\newcommand{\o@set}[2]{\o@@set{#1}#2}
\newcommand{\o@@set}[3]{%
  \vbox{\offinterlineskip
    \ialign{\hfil##\hfil\cr
      $\m@th\o@set@demote{#1}#2$\cr
      \noalign{\vskip0.2pt}
      $\m@th#1#3$\cr
    }%
  }%
}
\newcommand{\o@set@demote}[1]{%
  \ifx#1\displaystyle\scriptstyle\else
  \ifx#1\textstyle\scriptstyle\else
  \scriptscriptstyle\fi\fi
}
\makeatother

\begin{document}

$\oset{\sim}{t}$ versus $\tilde{t}$

\end{document}

On the other hand, \tilde{t} seems much better.

enter image description here

| improve this answer | | | | |
3

Remember: it is possible to use also mtpro2 (I like very much this package), lite version. Here there are several examples in relation to your tastes for the lenghts of the tilde symbol. The vertical spacing is automatic.

enter image description here

\documentclass{article}
\usepackage[lite]{mtpro2}
\begin{document}
\[
\tilde t+\wtilde t +\wwtilde t+\widetilde t
\]
\end{document}
| improve this answer | | | | |
2

Why not use the \accentset command?

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

\begin{document}

$\accentset{\sim}{t}$ compared to $ \tilde{t} $ and to $\widetilde{t}$

\end{document} 

enter image description here

| improve this answer | | | | |

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.