1

Consider the input

\RequirePackage{ifthen}
\RequirePackage{ifxetex,ifluatex}
\newif\ifxetexorluatex
\ifxetex
  \xetexorluatextrue
\else
  \ifluatex
    \xetexorluatextrue
  \else
    \xetexorluatexfalse
  \fi
\fi

\documentclass{standalone}
\ifxetexorluatex
\tracinglostchars=2
\usepackage{fontspec}
\usepackage[ngerman]{babel}
\usepackage{mathtools}\mathtoolsset{mathic=true}
\usepackage{amssymb}
\usepackage[math-style=ISO]{unicode-math}
\setmainfont[Ligatures=TeX]{TeX Gyre Termes}
\setsansfont{TeX Gyre Heros}[Scale=0.88]
\setmonofont{TeX Gyre Cursor}
\setmathfont[Ligatures=TeX]{TeX Gyre Termes Math}
\else
\usepackage[T2A,T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{newtxtext}
\usepackage[slantedGreek]{newtxmath}
\usepackage{courier}
\usepackage{mathtools}\mathtoolsset{mathic=true}
\usepackage{amssymb}
\usepackage{stmaryrd}
\fi
\usepackage[babel=true,verbose=errors]{microtype}
\usepackage{csquotes}
\begin{document}
\(\grave{x}\) \(\acute{x}\) \(\grave{\mathsf{sum}}\) \(\acute{\mathsf{sum}}\)
\end{document}

When running xelatex or pdflatex, we get an output such as

x̀, x́, sùm, súm

output

Lualatex puts the accent on m rather than centered.

How to get the grave and acute accents such that

  • they are slightly wider and extend with the width of the argument (similar to \widehat or \widetilde, e.g.) if the argument has at least two letters and

  • they default to the standard \grave and \acute if the argument is a single letter

?

This question asks for macros \widegrave{...} and \wideacute{...}. A solution has to work with all three engines {pdf|xe|lua}latex, produce centered accents in any case, and work with the packages listed in the MWE. How much the accents should be extended is a matter of taste, but two rules definitely make sense:

  • The accents should clearly not extend beyond the left and right bounds of the argument in case it has 2 letters or more.

  • The accents should be at least as wide as the standard grave/acute accents in any case.

Crosspost: http://latex.org/forum/viewtopic.php?f=46&t=32820&p=110399

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.