Width and positioning of \bar, \hat and \tilde
Here is a solution using the accents
package.
First, define the accent marks from scratch:
\newcommand{\newbar}{\scalebox{.9}[.85]{\trimbox{0pt .55ex}{\textminus}}}
\newcommand{\newtilde}{\scalebox{.9}[1]{\trimbox{0pt .6ex}{\textasciitilde}}}
\newcommand{\newhat}{\scalebox{1.5}[.75]{\trimbox{0pt 1.1ex}{\textasciicircum}}}
The arguments in \scalebox
control the width and thickness respectively. For example, if you want the bar to be thicker, increase the [.85]
in the \newbar
command. To make the bar less wide, decrease the {.9}
. The \trimbox
command comes from the trimclip
package. It is needed to accommodate whitespace (vertically) around the accent marks. The nonzero argument controls the height of the accent mark above the symbol. To raise the accents, trim less. For example, to raise the bar, decrease the .55ex
.
Once the accents are defined, they are called using the commands
\newcommand{\stretchedbar}[1]{\accentset{\newbar}{#1}}
\newcommand{\stretchedtilde}[1]{\accentset{\newtilde}{#1}}
\newcommand{\stretchedhat}[1]{\accentset{\newhat}{#1}}
Here is the complete code:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[p,osf]{cochineal}
\usepackage[varqu,varl,var0]{inconsolata}
\usepackage[scale=.95,type1]{cabin}
\usepackage[cochineal,vvarbb]{newtxmath}
\usepackage[cal=boondoxo]{mathalfa}
\usepackage{accents}
\usepackage{trimclip}
\newcommand{\newbar}{\scalebox{.9}[.85]{\trimbox{0pt .55ex}{\textminus}}}
\newcommand{\newtilde}{\scalebox{.9}[1]{\trimbox{0pt .6ex}{\textasciitilde}}}
\newcommand{\newhat}{\scalebox{1.5}[.75]{\trimbox{0pt 1.1ex}{\textasciicircum}}}
\newcommand{\stretchedbar}[1]{\accentset{\newbar}{#1}}
\newcommand{\stretchedtilde}[1]{\accentset{\newtilde}{#1}}
\newcommand{\stretchedhat}[1]{\accentset{\newhat}{#1}}
\begin{document}
$\bar{e},\hat{e},\tilde{e}\quad\bar{y},\hat{y},\tilde{y}\quad\bar{A},\hat{A},\tilde{A}\quad\bar{\Omega},\hat{\Omega},\tilde{\Omega}\quad$
$\stretchedbar{e},\stretchedhat{e},\stretchedtilde{e}\quad\stretchedbar{y},\stretchedhat{y},\stretchedtilde{y}\quad\stretchedbar{A},\stretchedhat{A},\stretchedtilde{A}\quad\stretchedbar{\Omega},\stretchedhat{\Omega},\stretchedtilde{\Omega}\quad$
\end{document}
If you will need the symbols in sub/superscripts you will need to use \mathchoice
. Combine the macros as follows:
\newcommand{\stretchedhat}[1]{\mathchoice
{\accentset{\scalebox{1.5}[.75]{\trimbox{0pt 1.1ex}{\textasciicircum}}}{#1}}
{\accentset{\scalebox{1.5}[.75]{\trimbox{0pt 1.1ex}{\textasciicircum}}}{#1}}
{\accentset{\scalebox{1}[.5]{\trimbox{0pt 1.2ex}{\textasciicircum}}}{#1}}
{\accentset{\scalebox{.8}[.4]{\trimbox{0pt 1.3ex}{\textasciicircum}}}{#1}}
}
\newcommand{\stretchedtilde}[1]{\mathchoice
{\accentset{\scalebox{.9}[1]{\trimbox{0pt .6ex}{\textasciitilde}}}{#1}}
{\accentset{\scalebox{.9}[1]{\trimbox{0pt .6ex}{\textasciitilde}}}{#1}}
{\accentset{\scalebox{.7}[.8]{\trimbox{0pt .7ex}{\textasciitilde}}}{#1}}
{\accentset{\scalebox{.5}[.6]{\trimbox{0pt .8ex}{\textasciitilde}}}{#1}}
}
\newcommand{\stretchedbar}[1]{\mathchoice
{\accentset{\scalebox{.9}[.85]{\trimbox{0pt .55ex}{\textminus}}}{#1}}
{\accentset{\scalebox{.9}[.85]{\trimbox{0pt .55ex}{\textminus}}}{#1}}
{\accentset{\scalebox{.7}[.7]{\trimbox{0pt .65ex}{\textminus}}}{#1}}
{\accentset{\scalebox{.5}[.6]{\trimbox{0pt .75ex}{\textminus}}}{#1}}
}
You can adjust the spacing and sizing to your liking.
$\stretchedhat{e}_{\stretchedhat{e}_{\stretchedhat{e}}}$
$\stretchedbar{e}_{\stretchedbar{e}_{\stretchedbar{e}}}$
$\stretchedtilde{e}_{\stretchedtilde{e}_{\stretchedtilde{e}}}$
Note that you must \protect
these if you want to use them in \section
, \paragraph
, etc. There is a workaround for using hyperref
with \texorpdfstring
in the comments.