3

I am trying the package MATHASTEXT with libertine font. With the "italic" option.

The output seems fine, with an exception: the accents -- I use \tilde and \bar -- are misaligned horizontally (too much to the left).

Here is a MWE:

\documentclass[10pt, a4paper]{amsart}
\usepackage{libertine}
\usepackage[italic]{mathastext}
\begin{document}
The trouble is with $\backslash$\verb|tilde| and $\backslash$\verb|bar|. The 
position is not centered correctly above the letters:
\[ \tilde{A} \tilde{B} \bar{A} \bar{B} \]
\end{document}

Thanks for any help,

Amnon

  • Welcome! I think things are coming from different fonts and the results are predictably poor. – cfr Oct 7 '15 at 3:32
  • to @cfr: I was looking for a workaround for the NEWTXMATH problem. Now that that is solved (thanks to you), I don't think I will need MATHASTEXT. – Amnon Yekutieli Oct 7 '15 at 3:54
3

warning (Nov., 2018)

please note that this answer is a bit senseless as it uses mathastext mechanism to add extra spacing (fine to fix issues with letter f colliding with a ( for example), here necessarily negative spacing, only to fix the accent placement, but clearly this ruins positioning with respect to binary operators etc..

As @Skillmon's answer addresses this issue much more seriously, please don't pay attention to this one.


With version 1.3a of 2013/09/04 or later of mathastext, you can do this:

\documentclass[12pt, a4paper]{amsart}
\usepackage{libertine}
\usepackage[italic]{mathastext}
\begin{document}
The trouble is with $\backslash$\verb|tilde| and $\backslash$\verb|bar|. The 
position is not centered correctly above the letters:
\[ \tilde{A} \tilde{B} \bar{A} \bar{B} \]

Try the following:

\makeatletter
\@for\@tempa:=A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z\do{%
\MTsetmathskips{\@tempa}{-2mu}{2mu}}%
\makeatother


\[ \tilde{A} \tilde{B} \bar{A} \bar{B} \]


\[ \tilde{A}_{ij}^C + \bar{U}\bar{V}\cdot\tilde{B}^{\bar{A}*\bar{B} }\]

\[ \sum_{i=0}^\infty \tilde{A}_i^2\bar{C}^3\]

Read the \texttt{mathastext} documentation for more about
\texttt{\textbackslash MTsetmathskips}.

\end{document}

output of mathastext

  • the image suggests to use \MTsetmathskips for lowercase letters too, like i. – user4686 Oct 7 '15 at 15:27
  • The problem is that this doesn't move the accent but the characters. So you also kill the spacing of binary operators etc. – Skillmon Nov 12 '18 at 13:43
  • @Skillmon right. Perhaps I thought only some letters like f were troublesome and the shift might be good in other contexts. But one could perhaps limit the scope to when \mathaccentV is used, is this what you do, or something altogether distinct from the mathastext letter skips (perhaps you move the accent rather)? (I have not read yet your answer in detail). I feel I should delete mine. (as obviously it is not good as it does not limitin the scope to accented letters) – user4686 Nov 12 '18 at 14:07
  • (I think I did not improve my answer because OP said in a comment he did not need mathastext anymore) – user4686 Nov 12 '18 at 14:11
  • Mine hacks \mathaccentV and then does something like \hat{A\mkern4mu}\mkern-4mu which effectively only moves the accents, but only does so for specific arguments of \hat, etc.. – Skillmon Nov 12 '18 at 14:12
1

Here. I define alt versions of \bar and \tilde using stacks, that work across math styles. In the MWE, I show the original version on the left of each pair, and the alt version on the right of each pair.

\documentclass[10pt, a4paper]{amsart}
\usepackage{libertine}
\usepackage[italic]{mathastext}
\usepackage{stackengine,scalerel}
\stackMath
\newcommand\alttilde[1]{\ThisStyle{\setbox0=\hbox{$\SavedStyle#1$}%
  \stackon[\dimexpr-.5pt-4\LMpt]{\SavedStyle#1}{%
  \SavedStyle\kern.30\ht0\tilde{}}}}
\newcommand\altbar[1]{\ThisStyle{\setbox0=\hbox{$\SavedStyle#1$}%
  \stackon[\dimexpr-1.0pt-3.3\LMpt]{\SavedStyle#1}{%
  \SavedStyle\kern.30\ht0\bar{}}}}
\begin{document}
\def\tmp{\tilde{A} \alttilde{A} \quad
 \tilde{B} \alttilde{B}\quad
 \tilde{c} \alttilde{c}\quad
 \bar{A} \altbar{A}\quad
 \bar{B} \altbar{B}\quad
  \bar{c} \altbar{c}}
\[ \tmp \]
\[ \scriptstyle \tmp \]
\[ \scriptscriptstyle \tmp \]
\end{document}

enter image description here

  • to @StevenBSegletes: Thanks for the code. I tried to run it on my machine, but some packages were missing. Since I can get NEWTXMATH working now, I will not require MATHASTEXT in the near future. – Amnon Yekutieli Oct 7 '15 at 14:41
1

I wrote a package initially for a template I created for the chair I wrote my Bachelor's thesis at. The package loads amsmath and works by redefining \mathaccentV, which is used internally by amsmath in the macros \hat, \check, \tilde, \acute, \grave, \dot, \ddot, \breve, \bar, \vec and \mathring.

It has two modes from which you can choose during load time. The first moves the accents based on the height of the used box. The second has a list of arguments for which shift widths are defined. The first is quick and dirty and the result is always a compromise of best fit for all, while the second needs more work (you'll have to define a shift for each character you'll use once). For the list approach there is a definition list included for the font combination \usepackage{helvet}\renewcommand\familydefault{\sfdefault}\usepackage[italic,defaultmathsizes]{mathastext}.

Both versions have a way to force or prevent the displacement. If you're using height you can enforce it with a * after e.g. \hat, a ! does prevent it. With height the displacement is only applied automatically if the argument is a single token with category code 11.

If you're using the list option, you can specify the used displacement in mu inside an optional argument (e.g. \hat[4mu]{a}) or you can use a known argument inside the optional argument (so using the defined shift of B for A with \hat[B]{A}).

Unfortunately the package is not published to CTAN and therefore not included in any TeX distribution. You can find it here: https://gitlass.de/jonathan/MRTbundle/src/branch/master/MRTsfacc

Documentation is contained in the following PDF in chapter 8 (the documentation is one PDF for each class and package contained in that bundle): https://gitlass.de/jonathan/MRTbundle/src/branch/master/Doc/doc_MRTbundle.pdf

Usage example using the height mode:

\documentclass[10pt, a4paper]{amsart}
\usepackage{libertine}
\usepackage[italic]{mathastext}
% move based on height, the horizontal displacement is <share>*<height>, <share> defaults to 0.25
\usepackage[height]{MRTsfacc}
\begin{document}
The trouble is with $\backslash$\verb|tilde| and $\backslash$\verb|bar|. The 
position is not centered correctly above the letters:
\[ \tilde{A} \tilde{B} \bar{A} \bar{B} \]

Every character in a-zA-Z with {\textbackslash\verb|hat|}:

\parbox{.4\linewidth}
  {%
    $\hat{a}$$\hat{A}$
    $\hat{b}$$\hat{B}$
    $\hat{c}$$\hat{C}$
    $\hat{d}$$\hat{D}$
    $\hat{e}$$\hat{E}$
    $\hat{f}$$\hat{F}$
    $\hat{g}$$\hat{G}$
    $\hat{h}$$\hat{H}$
    $\hat{i}$$\hat{I}$
    $\hat{j}$$\hat{J}$
    $\hat{k}$$\hat{K}$
    $\hat{l}$$\hat{L}$
    $\hat{m}$$\hat{M}$
    $\hat{n}$$\hat{N}$
    $\hat{o}$$\hat{O}$
    $\hat{p}$$\hat{P}$
    $\hat{q}$$\hat{Q}$
    $\hat{r}$$\hat{R}$
    $\hat{s}$$\hat{S}$
    $\hat{t}$$\hat{T}$
    $\hat{u}$$\hat{U}$
    $\hat{v}$$\hat{V}$
    $\hat{w}$$\hat{W}$
    $\hat{x}$$\hat{X}$
    $\hat{y}$$\hat{Y}$
    $\hat{z}$$\hat{Z}$
  }
\end{document}

enter image description here

Usage example using the list mode:

\documentclass[10pt, a4paper]{amsart}
\usepackage{libertine}
\usepackage[italic]{mathastext}
\usepackage[list]{MRTsfacc}
% I'm lazy so I only define shifts for `A` and `B`
\MRTsfaccShift{A}{4mu}
\MRTsfaccShift{B}{2.5mu}
\begin{document}
The trouble is with $\backslash$\verb|tilde| and $\backslash$\verb|bar|. The 
position is not centered correctly above the letters:
\[ \tilde{A} \tilde{B} \bar{A} \bar{B} \]

Every character in a-zA-Z with {\textbackslash\verb|hat|}:

\parbox{.4\linewidth}
  {%
    $\hat{a}$$\hat{A}$
    $\hat{b}$$\hat{B}$
    $\hat{c}$$\hat{C}$
    $\hat{d}$$\hat{D}$
    $\hat{e}$$\hat{E}$
    $\hat{f}$$\hat{F}$
    $\hat{g}$$\hat{G}$
    $\hat{h}$$\hat{H}$
    $\hat{i}$$\hat{I}$
    $\hat{j}$$\hat{J}$
    $\hat{k}$$\hat{K}$
    $\hat{l}$$\hat{L}$
    $\hat{m}$$\hat{M}$
    $\hat{n}$$\hat{N}$
    $\hat{o}$$\hat{O}$
    $\hat{p}$$\hat{P}$
    $\hat{q}$$\hat{Q}$
    $\hat{r}$$\hat{R}$
    $\hat{s}$$\hat{S}$
    $\hat{t}$$\hat{T}$
    $\hat{u}$$\hat{U}$
    $\hat{v}$$\hat{V}$
    $\hat{w}$$\hat{W}$
    $\hat{x}$$\hat{X}$
    $\hat{y}$$\hat{Y}$
    $\hat{z}$$\hat{Z}$
  }
\end{document}

enter image description here

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.