![如何使 \mathaccent 变得低沉和尖锐?](https://linux22.com/image/438116/%E5%A6%82%E4%BD%95%E4%BD%BF%20%5Cmathaccent%20%E5%8F%98%E5%BE%97%E4%BD%8E%E6%B2%89%E5%92%8C%E5%B0%96%E9%94%90%EF%BC%9F.png)
我试图发出宽大的重音和尖音。以下\widetilde
是\widehat
教科书和https://texwelt.de/fragen/26664/breiter-gravis-fur-pdflatex/26908,我继续说
\documentclass{article}
\pagestyle{empty}
\usepackage{graphicx}
\usepackage[T1]{fontenc}%%% we do wish this if we stick to pdflatex
\usepackage{newtxtext}%%% we do wish this if we stick to pdflatex
\usepackage[slantedGreek,subscriptcorrection]{newtxmath}%%% we do wish if we stick to pdflatex
\newcommand{\widegraveA}{\mathaccent"0012 }
\newcommand{\wideacuteA}{\mathaccent"0013 }
\makeatletter
\newcommand\wideacuteB[1]{%
\mathchoice
{\@wideaccent{\displaystyle}{#1}{\mathchar"7013}{-1.06ex}{1}{1}}
{\@wideaccent{\textstyle}{#1}{\mathchar"7013}{-1.05ex}{1}{1}}
{\@wideaccent{\scriptstyle}{#1}{\mathchar"7013}{-.75ex}{1}{1}}
{\@wideaccent{\scriptscriptstyle}{#1}{\mathchar"7013}{-.54ex}{1}{1}}
}
\newcommand\widegraveB[1]{%
\mathchoice
{\@wideaccent{\displaystyle}{#1}{\mathchar"7012}{-1.06ex}{1}{1}}
{\@wideaccent{\textstyle}{#1}{\mathchar"7012}{-1.05ex}{1}{1}}
{\@wideaccent{\scriptstyle}{#1}{\mathchar"7012}{-.75ex}{1}{1}}
{\@wideaccent{\scriptscriptstyle}{#1}{\mathchar"7012}{-.54ex}{1}{1}}
}
\newcommand{\@wideaccent}[6]{
\setbox\@tempboxa\hbox{$\m@th#1#2$}%
\@tempdima=\ht\@tempboxa
\@tempdimb=\wd\@tempboxa
\ooalign{%
\box\@tempboxa\cr
\hidewidth\raise\dimexpr\@tempdima#4\relax\hbox{\resizebox{#5\@tempdimb}{#6\height}{$\m@th#1#3$}}\hidewidth
}%
}
\makeatother
\begin{document}
\(\widegraveA{\mathit{loop}}, \widegraveA{\mathit{pool}}, \widegraveA{\mathit{buffer}}, \widegraveA{\sigma_k}, \wideacuteA{\mathit{loop}}, \wideacuteA{\mathit{pool}}, \wideacuteA{\mathit{buffer}}, \wideacuteA{\sigma_k}\)\\
\(\widegraveB{\mathit{loop}}, \widegraveB{\mathit{pool}}, \widegraveB{\mathit{buffer}}, \widegraveB{\sigma_k}, \wideacuteB{\mathit{loop}}, \wideacuteB{\mathit{pool}}, \wideacuteB{\mathit{buffer}}, \wideacuteB{\sigma_k}\)
\end{document}
如您所见,根本不要拉长重音符和锐音符,并且\wideacuteA
有时会产生不居中的重音符,太左、太右、太窄、太靠近文本或太远离文本的重音符:\widegraveA
\wideacuteB
\widegraveB
为什么?
如何使
\mathaccent
重音更加突出?如何制作
\widegraveB
和\wideacuteB
产生不丑陋(或至少不那么丑陋)的口音?
PS。在这个特定问题中,我们确实希望使用具有给定选项的 T1 和 NewTX 字体。此外,宽锐音符和重音符下的文本的优先顺序如下,从最重要到最不重要:
\sigma_k
,\mathit{buffer}
,\mathit{loop}
和\mathit{pool}
,\mathit{sum}
,- 所有其他多字母数学。
我们处理unicode引擎TeX Gyre Termes 和 TeX Gyre Termes Math 的宽锐角和宽坟墓。
答案1
在这里,我修改了我的答案非常宽的帽子符号,甚至让它在 中工作\scriptstyle
。
已编辑/修改以便工作更好的在较小的脚本中。
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{scalerel,stackengine}
\stackMath
\newcommand\reallywideacute[1]{%
\ThisStyle{\savestack\tmpA{$\SavedStyle#1$}%
\savestack{\tmpbox}{%
\def\scriptstyleScaleFactor{0.8}% LOCAL CHANGE
\def\scriptscriptstyleScaleFactor{0.68}% LOCAL CHANGE
$\SavedStyle\stretchto{%
\scalerel*[\wd\tmpAcontent]%
{\kern-2.05\LMpt\mathchar"7013\kern-1.1\LMpt}%
{\rule{0ex}{\textheight}}%
}{2.6\LMex}$}%
\stackengine{-7.5\LMpt}{\SavedStyle#1}{\tmpbox}{O}{c}{F}{T}{S}}%
}
\newcommand\reallywidegrave[1]{%
\ThisStyle{\savestack\tmpA{$\SavedStyle#1$}%
\savestack{\tmpbox}{%
\def\scriptstyleScaleFactor{0.8}% LOCAL CHANGE
\def\scriptscriptstyleScaleFactor{0.68}% LOCAL CHANGE
$\SavedStyle\stretchto{%
\scalerel*[\wd\tmpAcontent]%
{\kern-1.1\LMpt\mathchar"7012\kern-2.1\LMpt}%
{\rule{0ex}{\textheight}}%
}{2.6\LMex}$}%
\stackengine{-7.5\LMpt}{\SavedStyle#1}{\tmpbox}{O}{c}{F}{T}{S}}%
}
\def\scriptstyleScaleFactor{0.8}% GLOBAL CHANGE, 0.7 DEFAULT
\def\scriptscriptstyleScaleFactor{0.68}% GLOBAL CHANGE, 0.5 DEFAULT
\parskip 1ex
\begin{document}
$\reallywideacute{zbcdefghijklm}\quad\reallywidegrave{zbcdefghijklm}$
$\reallywideacute{zbcdefghijk}\quad\reallywidegrave{zbcdefghijk}$
$\reallywideacute{zbcdefghi}\quad\reallywidegrave{zbcdefghi}$
$\reallywideacute{zbcdefg}\quad\reallywidegrave{zbcdefg}$
$\reallywideacute{zbcde}\quad\reallywidegrave{zbcde}$
$\reallywideacute{zbc}\quad\reallywidegrave{zbc}$
$\reallywideacute{zb}\quad\reallywidegrave{zb}$
$\scriptstyle
\reallywideacute{zbcdefghijklm}\quad\reallywidegrave{zbcdefghijklm}$
$\scriptstyle
\reallywideacute{zbcdefghijk}\quad\reallywidegrave{zbcdefghijk}$
$\scriptstyle
\reallywideacute{zbcdefghi}\quad\reallywidegrave{zbcdefghi}$
$\scriptstyle
\reallywideacute{zbcdefg}\quad\reallywidegrave{zbcdefg}$
$\scriptstyle
\reallywideacute{zbcde}\quad\reallywidegrave{zbcde}$
$\scriptstyle
\reallywideacute{zbc}\quad\reallywidegrave{zbc}$
$\scriptstyle
\reallywideacute{zb}\quad\reallywidegrave{zb}$
\end{document}
在 中\scriptscriptstyle
,它仍然是可以通过的:
补充
要使用newtxmath
,需要调整字距:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{newtxtext, newtxmath}
\usepackage{scalerel,stackengine}
\stackMath
\newcommand\reallywideacute[1]{%
\ThisStyle{\savestack\tmpA{$\SavedStyle#1$}%
\savestack{\tmpbox}{$\SavedStyle\stretchto{%
\scalerel*[\wd\tmpAcontent]%
{\kern-.95\LMpt\mathchar"7013\kern-.12\LMpt}%
{\rule{0ex}{\textheight}}%
}{2.6\LMex}$}%
\stackengine{-7.5\LMpt}{\SavedStyle#1}{\tmpbox}{O}{c}{F}{T}{S}}%
}
\newcommand\reallywidegrave[1]{%
\ThisStyle{\savestack\tmpA{$\SavedStyle#1$}%
\savestack{\tmpbox}{$\SavedStyle\stretchto{%
\scalerel*[\wd\tmpAcontent]%
{\kern-.12\LMpt\mathchar"7012\kern-.95\LMpt}%
{\rule{0ex}{\textheight}}%
}{2.6\LMex}$}%
\stackengine{-7.5\LMpt}{\SavedStyle#1}{\tmpbox}{O}{c}{F}{T}{S}}%
}
\parskip 1ex
\begin{document}
$\reallywideacute{zbcdefghijklm}\quad\reallywidegrave{zbcdefghijklm}$
$\reallywideacute{zbcdefghijk}\quad\reallywidegrave{zbcdefghijk}$
$\reallywideacute{zbcdefghi}\quad\reallywidegrave{zbcdefghi}$
$\reallywideacute{zbcdefg}\quad\reallywidegrave{zbcdefg}$
$\reallywideacute{zbcde}\quad\reallywidegrave{zbcde}$
$\reallywideacute{zbc}\quad\reallywidegrave{zbc}$
$\reallywideacute{zb}\quad\reallywidegrave{zb}$
$\scriptstyle
\reallywideacute{zbcdefghijklm}\quad\reallywidegrave{zbcdefghijklm}$
$\scriptstyle
\reallywideacute{zbcdefghijk}\quad\reallywidegrave{zbcdefghijk}$
$\scriptstyle
\reallywideacute{zbcdefghi}\quad\reallywidegrave{zbcdefghi}$
$\scriptstyle
\reallywideacute{zbcdefg}\quad\reallywidegrave{zbcdefg}$
$\scriptstyle
\reallywideacute{zbcde}\quad\reallywidegrave{zbcde}$
$\scriptstyle
\reallywideacute{zbc}\quad\reallywidegrave{zbc}$
$\scriptstyle
\reallywideacute{zb}\quad\reallywidegrave{zb}$
\end{document}