
繼續TeX Gyre Termes 和 TeX Gyre Termes Math 的寬銳角和寬墳墓,我們嘗試使寬重音和尖音重音\smaller
與 TeX Gyre Termes(數學)字體和 UTF-8 引擎(用於 NewTX 和pdflatex
,參見使用 NewTX 和 pdflatex 時,如何讓寬重音和尖銳重音在 \smaller 中也準確?):
\documentclass{article}
\pagestyle{empty}
\usepackage{unicode-math}
\setmainfont[Ligatures=TeX]{TeX Gyre Termes}
\setsansfont{TeX Gyre Heros}[Scale=0.88]%%% Somewhat ok.
\setmonofont{TeX Gyre Cursor}%%% No explicit turning on ligatures for the monospaced font.
\setmathfont[Ligatures=TeX]{TeX Gyre Termes Math}
\usepackage{scalerel,stackengine}\stackMath
\usepackage{relsize}
%%% thanks to http://tex.stackexchange.com/a/611030
\newcommand\wideacute[1]{%
\ThisStyle{\savestack\tmpA{$\SavedStyle#1$}%
\savestack{\tmpbox}{$\SavedStyle\stretchto{%
\scalerel*[\wd\tmpAcontent]%
{\kern-.83\LMpt\Umathchar"7"0"00B4\kern-.12\LMpt}%
{\rule{0ex}{\textheight}}%
}{2\LMex}$}%
\stackengine{-6.3\LMpt}{\SavedStyle#1}{\tmpbox}{O}{c}{F}{T}{S}}%
}
\newcommand\widegrave[1]{%
\ThisStyle{\savestack\tmpA{$\SavedStyle#1$}%
\savestack{\tmpbox}{$\SavedStyle\stretchto{%
\scalerel*[\wd\tmpAcontent]%
{\kern-.43\LMpt\char"0060%
\kern-.9\LMpt}%
{\rule{0ex}{\textheight}}%
}{1.05\LMex}$}%
\stackengine{-2.3\LMpt}{\SavedStyle#1}{\tmpbox}{O}{c}{F}{T}{S}}%
}
\begin{document}
\newcommand{\test}[1]{\(\displaystyle \wideacute{#1}\ \widegrave{#1}\) \(\textstyle \wideacute{#1}\ \widegrave{#1}\) \(\scriptstyle \wideacute{#1}\ \widegrave{#1}\) \(\scriptscriptstyle \wideacute{{#1}}\ \widegrave{#1}\)}%
\newcommand{\ttest}[1]{\test{#1}\\{\smaller\test{#1}}}%
\newcommand{\tttest}[1]{\ttest{\mathit{#1}}}%
\noindent
\tttest{sum}\\
\tttest{loop}\\
\tttest{pool}\\
\tttest{buffer}\\
\ttest{\sigma_k}
\end{document}
將其提供給lualatex
結果
正如您所看到的,在正常大小的字體中,單字與其重音之間的距離在某種程度上是可以接受的(儘管您也可能會抱怨在墳墓的“循環”和尖銳的“池”中這個距離太大) 。然而,在版本中\smaller
這兩部分重疊,這是不可取的。如何引入對字體大小的依賴,以便正常大小的版本仍然看起來不錯(或至少不比現在差,即重音仍應位於單字上方)和較小大小的版本看起來更好(即重音不應該與單字重疊)?
答案1
使用
\stackengine{-1.3\LMex}{\SavedStyle#1}{\tmpbox}{O}{c}{F}{T}{S}}%
\wideacute
在和的定義中
\stackengine{-.4\LMex}{\SavedStyle#1}{\tmpbox}{O}{c}{F}{T}{S}}%
在 的定義中\widegrave
。