LaTeX forum ⇒ Math & ScienceHow to produce wide grave and wide acute accents?

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Posts: 64
Joined: Wed Apr 17, 2019 12:51 pm

How to produce wide grave and wide acute accents?

Postby user49915 » Fri Sep 06, 2019 6:07 pm

Consider the input

Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. \RequirePackage{ifthen}
  2. \RequirePackage{ifxetex,ifluatex}
  3. \newif\ifxetexorluatex
  4. \ifxetex
  5. \xetexorluatextrue
  6. \else
  7. \ifluatex
  8. \xetexorluatextrue
  9. \else
  10. \xetexorluatexfalse
  11. \fi
  12. \fi
  14. \documentclass{standalone}
  15. \ifxetexorluatex
  16. \tracinglostchars=2
  17. \usepackage{fontspec}
  18. \usepackage[ngerman]{babel}
  19. \usepackage{mathtools}\mathtoolsset{mathic=true}
  20. \usepackage{amssymb}
  21. \usepackage[math-style=ISO]{unicode-math}
  22. \setmainfont[Ligatures=TeX]{TeX Gyre Termes}
  23. \setsansfont{TeX Gyre Heros}[Scale=0.88]
  24. \setmonofont{TeX Gyre Cursor}
  25. \setmathfont[Ligatures=TeX]{TeX Gyre Termes Math}
  26. \else
  27. \usepackage[T2A,T1]{fontenc}
  28. \usepackage[utf8]{inputenc}
  29. \usepackage[ngerman]{babel}
  30. \usepackage{newtxtext}
  31. \usepackage[slantedGreek]{newtxmath}
  32. \usepackage{courier}
  33. \usepackage{mathtools}\mathtoolsset{mathic=true}
  34. \usepackage{amssymb}
  35. \usepackage{stmaryrd}
  36. \fi
  37. \usepackage[babel=true,verbose=errors]{microtype}
  38. \usepackage{csquotes}
  39. \begin{document}
  40. \(\grave{x}\) \(\acute{x}\) \(\grave{\mathsf{sum}}\) \(\acute{\mathsf{sum}}\)
  41. \end{document}

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

1E5Ty.jpg (11.76 KiB) Viewed 713 times

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: ... te-accents

Return to “Math & Science”

Who is online

Users browsing this forum: No registered users and 2 guests