Open fuysgit opened 1 week ago
\documentclass[a4paper]{ctexart}
\usepackage{mathtools}
\newfontfamily\EngTwo{Times New Roman}
\renewtagform{default}[\EngTwo]{\EngTwo(}{\EngTwo)}
\usetagform{default}
\begin{document}
\begin{equation}
E = mc^2 \label{a}
\end{equation}
\end{document}
我想把公式右边编号和编号两边的括号的字体都设置为 新罗马。 我通过
\theequation
修改了参数,但最后只实现了编号和编号右边的括号的字体改成了新罗马字体,编号左边的括号的字体没变,如下图所示 [图片] 修改\theequation
参数的代码如下:\newfontfamily\EngTwo{Times New Roman} \renewcommand{\theequation}{\EngTwo{\arabic{equation}}}
公式编号的排版相当于用了 (\theequation)
,左侧括号出现在 \theequation
之前,所以在 \theequation
里影响不到左侧括号的字体。具体是由 amsmath
里的 \tagform@
控制的
% amsmath.sty v2.17q (2024/05/23), line 1218:
\def\tagform@#1{\maketag@@@{(\ignorespaces#1\unskip\@@italiccorr)}}
@SwitWu 的回答使用 mathtools
提供的修改 tag form 的用户接口,避免了直接修改 amsmath
内部宏。mathtools
v1.30 (2024/03/11) 的实现,相当于
\hbox{\m@th\normalfont
<left paren>\ignorespaces{<tag format>{\theequation}}\unskip\@@italiccorr <right paren>}
所以只把切换字族的命令应用在 <left paren>
之前,也能整体修改 (\theequation)
的字体(也许不够稳妥),见 https://github.com/latex3/mathtools/issues/54 。
\newfontfamily\EngTwo{Times New Roman}
\renewtagform{default}{\EngTwo(}{)}
注意,这样定义的 \EngTwo
的语法和 \rmfamily
类似,都不接受参数,所以 \EngTwo{text}
和 \EngTwo text
的效果相同,不推荐第一种用法。
我想把公式右边编号和编号两边的括号的字体都设置为 新罗马。 我通过
\theequation
修改了参数,但最后只实现了编号和编号右边的括号的字体改成了新罗马字体,编号左边的括号的字体没变,如下图所示 [图片] 修改\theequation
参数的代码如下:\newfontfamily\EngTwo{Times New Roman} \renewcommand{\theequation}{\EngTwo{\arabic{equation}}}
公式编号的排版相当于用了
(\theequation)
,左侧括号出现在\theequation
之前,所以在\theequation
里影响不到左侧括号的字体。具体是由amsmath
里的\tagform@
控制的% amsmath.sty v2.17q (2024/05/23), line 1218: \def\tagform@#1{\maketag@@@{(\ignorespaces#1\unskip\@@italiccorr)}}
@SwitWu 的回答使用
mathtools
提供的修改 tag form 的用户接口,避免了直接修改amsmath
内部宏。mathtools
v1.30 (2024/03/11) 的实现,相当于\hbox{\m@th\normalfont <left paren>\ignorespaces{<tag format>{\theequation}}\unskip\@@italiccorr <right paren>}
所以只把切换字族的命令应用在
<left paren>
之前,也能整体修改(\theequation)
的字体(也许不够稳妥),见 latex3/mathtools#54 。\newfontfamily\EngTwo{Times New Roman} \renewtagform{default}{\EngTwo(}{)}
注意,这样定义的
\EngTwo
的语法和\rmfamily
类似,都不接受参数,所以\EngTwo{text}
和\EngTwo text
的效果相同,不推荐第一种用法。
非常感谢!
\documentclass[a4paper]{ctexart} \usepackage{mathtools} \newfontfamily\EngTwo{Times New Roman} \renewtagform{default}[\EngTwo]{\EngTwo(}{\EngTwo)} \usetagform{default} \begin{document} \begin{equation} E = mc^2 \label{a} \end{equation} \end{document}
非常感谢
检查清单
操作系统
win11
TeX 发行版
TexLive2024 CTeX3.0.215.2
描述问题
我想把公式右边编号和编号两边的括号的字体都设置为 新罗马。 我通过![示例1](https://github.com/CTeX-org/forum/assets/93901766/26daca0c-8d36-4ee4-9f5a-07e7bca89616)
\theequation
修改了参数,但最后只实现了编号和编号右边的括号的字体改成了新罗马字体,编号左边的括号的字体没变,如下图所示修改
\theequation
参数的代码如下:谢谢帮助!
最小工作示例(MWE)
链接
其他信息
No response
附件
No response