3

Circumflexes looks too small and they are to close to the symbol in the PDF generated by XeLaTeX from UTF-8 source with Asana Math font for mathematics:

enter image description here

Source:

\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{fontspec}
\usepackage[math-style=ISO,bold-style=ISO,nabla=upright,partial=upright,vargreek-shape=unicode]{unicode-math}
\setmathfont{[Asana-Math]}

\newcommand*{\op}[1]{\hat{\mathup{#1}}}

\begin{document}

\begin{equation}
    \op{H} = \op{T} + \op{V} 
\end{equation}

\end{document}

I want to make circumflexes wider to be more clearly separated from the symbols underneath them, but \widehat is not an option since it produces circumflexes of variable size. The solution in How can I manually choose the size of a wide accent? (math mode) doesn't work for me. Seems like there is some incompatibility between the accents package and UTF-8 encoding.

I really like Asana Math, so I don't want to change the font.

1
  • 1
    Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
    – Anke
    Apr 10, 2013 at 9:05

2 Answers 2

6

Maybe it might be worth a try to introduce two commands via the xparse package:

\DeclareDocumentCommand{\operator}{ s m }{
    \IfBooleanTF{#1}{
                    \widehat{#2}
            }{
                    \hat{#2}}
            }
    }

Then \operator{H} gives the "normal" output and \operator*{H} stretches the circumflex.

Maybe you want to look also at the following post: Really wide hat symbol where the scalerel package is used. You might think of defining a command with two inputs, the first one giving then the width of the hat, and the second as the character

Edit:

I think I have now a solution after looking at source2e.pdf and encguide.pdf.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{fontspec}
\usepackage[math-style=ISO,bold-style=ISO,nabla=upright,partial=upright,vargreek-shape=unicode]{unicode-math}
\setmathfont{[Asana-Math]}
\DeclareSymbolFont{mylargesymbols}{OMX}{cmex}{m}{n}
\DeclareMathAccent{\mywidehat}{\mathord}{mylargesymbols}{"62}
\begin{document}
$\hat{\mathrm{H}} = \hat{\mathrm{T}} + \hat{\mathrm{V}} +\hat{abcdefgh}$

$ \widehat{\mathrm{H}} = \widehat{\mathrm{T}} + \widehat{\mathrm{V}} +\widehat{abcdefgh}$

$ \mywidehat{\mathrm{H}} = \mywidehat{\mathrm{T}} + \mywidehat{\mathrm{V}} +\mywidehat{abcdefgh}$
\end{document}

will give the following result

enter image description here

The hat still expands, but not so dramatic as case before.

2
  • Magnificent! :)
    – Wildcat
    Apr 13, 2013 at 6:43
  • Great solution - it turns out this is useful with the Neo Euler font as well. The otf version seems to lack stretchy accents, so it's very handy to have this method to pick the accents up from cmex.
    – Thruston
    Apr 14, 2015 at 20:48
1

[NOTE: Edit 1 for better vertical positioning; Edit 2 for "hat" not "wedge"] I don't have access to your particular fonts, so I address the problem for the default LaTeX font. You will have to reparameterize my solution. It involves using the scalerel package for stretching the \hat symbol (\char'136). I show the unmodified result and then the result for one parameters-set of stretches. Once you calibrate the three parameters for your font, lock those values into the definition. \Ht defines the vertical stretch; \Wd defines the horizontal stretch; and \Dp defines the vertical separation multiplier between letter and overhat.

\documentclass{article}
\usepackage{amsmath}
\usepackage{scalerel}
\usepackage{adjustbox}

\newlength\svarraycolsep
\newcommand\althat[1]{%
\renewcommand\arraystretch{\Dp}%
\setlength\svarraycolsep{\arraycolsep}%
\setlength\arraycolsep{0in}%
\begin{array}{c}%
  \vstretch{\Ht}{%
    \hstretch{\Wd}{%
      \trimbox{.15ex .75ex .15ex .2ex}{\scalerel*{\char'136}{\rule{1ex}{1ex}}}%
    }%
  }\\%
  #1\\%
\rule{1ex}{0ex}\\%
\end{array}%
\renewcommand\arraystretch{1.0}%
\setlength\arraycolsep{\svarraycolsep}%
}

\parindent 0in
\begin{document}

Hat:

\( \hat{\mathrm{H}} = \hat{\mathrm{T}} + \hat{\mathrm{V}} \)

Carat(char'136):


\def\Ht{1.8}
\def\Wd{4.5}
\def\Dp{.3}
\( \althat {\mathrm{H}} = \althat {\mathrm{T}} + \althat {\mathrm{V}} \)

\end{document}

enter image description here

0

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.