如何防止 newtx 更改“\section{}”和“\subsection{}”中的字体格式?

如何防止 newtx 更改“\section{}”和“\subsection{}”中的字体格式?

https://tex.stackexchange.com/a/659813/127048;我被推荐使用newtx

如果你使用IEEEtran,我建议使用newtx以便在数学中也获得 Times 字体

当我添加\usepackage{newtx}到以下模板(第 2 行)时,字体格式会发生变化,其中的文本\section{*}也会\subsection{*}发生\lstinputlisting[]变化,变得更粗。我不确定这些更改是否会被相应的期刊接受。

是否可以防止newtx更改和的字体\section{}格式\subsection{}

模板链接:https://ieeecs-media.computer.org/assets/tar/ieeetran-final_sub.tar;删除注释的版本:

\documentclass[10pt,journal,compsoc]{IEEEtran}
\begin{document}
\title{Bare Demo of IEEEtran.cls for\\ IEEE Computer Society Journals}
\author{alper}
\markboth{Journal of \LaTeX\ Class Files,~Vol.~14, No.~8, August~2015}%
{Shell \MakeLowercase{\textit{et al.}}: Bare Demo of IEEEtran.cls for Computer Society Journals}
\IEEEtitleabstractindextext{%
\begin{abstract}
The abstract goes here.
\end{abstract}
\begin{IEEEkeywords}
Computer Society, IEEE, IEEEtran, journal, \LaTeX, paper, template.
\end{IEEEkeywords}}
\maketitle
\IEEEdisplaynontitleabstractindextext
\IEEEpeerreviewmaketitle
\IEEEraisesectionheading{\section{Introduction}\label{sec:introduction}}
\IEEEPARstart{T}{his} demo file is intended to serve as a ``starter file''
for IEEE Computer Society journal papers produced under \LaTeX\ using
IEEEtran.cls version 1.8b and later.
I wish you the best of success.
\hfill mds
\hfill August 26, 2015
\subsection{Subsection Heading Here}
Subsection text here.
\subsubsection{Subsubsection Heading Here}
Subsubsection text here.
\section{Conclusion}
The conclusion goes here.
\appendices
\section{Proof of the First Zonklar Equation}
Appendix one text goes here.
\section{}
Appendix two text goes here.
\ifCLASSOPTIONcompsoc
  \section*{Acknowledgments}
\else
  \section*{Acknowledgment}
\fi
The authors would like to thank...
\ifCLASSOPTIONcaptionsoff
  \newpage
\fi
\begin{thebibliography}{1}
\bibitem{IEEEhowto:kopka}
H.~Kopka and P.~W. Daly, \emph{A Guide to \LaTeX}, 3rd~ed.\hskip 1em plus
  0.5em minus 0.4em\relax Harlow, England: Addison-Wesley, 1999.
\end{thebibliography}
\end{document}

答案1

IEEEtran比较一下有和没有得到的结果newtx

沒有 newtx

使用 newtx

您可以清楚地看到,上图中的小型大写字母是通过缩放大写字母获得的,这使得垂直笔划比大写字母更细。下图中没有出现这种情况,因为下图使用的是真正的小型大写字体,您可以看到垂直笔划的宽度相同。

首字下沉字母附近的小型大写字母也是如此。

无论如何,如果你喜欢较差的输出,那就这么做吧

\usepackage{newtxmath}

这只会使数学与 Times 兼容,并修复IEEEtran使用 Computer Modern 进行数学运算的难看的默认行为,这在视觉上与 Times 冲突。

稍微复杂一点的是在标题中获取内衬数字\section

\documentclass[10pt,journal,compsoc]{IEEEtran}
\usepackage{newtx}

\makeatletter
% standard way to add commands for printing the section number
\renewcommand{\@seccntformat}[1]{%
  % if \numberfont@<level> is defined, use it in a group
  \ifcsname numberfont@#1\endcsname
    % if \numberfont@<level> is defined, use it in a group
    {\@nameuse{numberfont@#1}\@nameuse{the#1}}%
  \else
    % otherwise do the standard
    \@nameuse{the#1}%
  \fi
  % add the standard space
  \quad
}
\newcommand{\definenumberfont}[2]{%
  \@namedef{numberfont@#1}{#2}%
}
\makeatother

% we want to add \upshape for the \section level, so the figures are lining
\definenumberfont{section}{\upshape}

\begin{document}

\title{Bare Demo of IEEEtran.cls for\\ IEEE Computer Society Journals}
\author{alper}

\markboth{Journal of \LaTeX\ Class Files,~Vol.~14, No.~8, August~2015}%
{Shell \MakeLowercase{\textit{et al.}}: Bare Demo of IEEEtran.cls for Computer Society Journals}
\IEEEtitleabstractindextext{%

\begin{abstract}
The abstract goes here.
\end{abstract}

\begin{IEEEkeywords}
Computer Society, IEEE, IEEEtran, journal, \LaTeX, paper, template.
\end{IEEEkeywords}}

\maketitle

\IEEEdisplaynontitleabstractindextext
\IEEEpeerreviewmaketitle
\IEEEraisesectionheading{\section{Introduction}\label{sec:introduction}}
\IEEEPARstart{T}{his} demo file is intended to serve as a ``starter file''
for IEEE Computer Society journal papers produced under \LaTeX\ using
IEEEtran.cls version 1.8b and later.
I wish you the best of success.
\hfill mds
\hfill August 26, 2015

\subsection{Subsection Heading Here}

Subsection text here.
\subsubsection{Subsubsection Heading Here}
Subsubsection text here.
\section{Conclusion}
The conclusion goes here.
\appendices
\section{Proof of the First Zonklar Equation}
Appendix one text goes here.
\section{}
Appendix two text goes here.
\ifCLASSOPTIONcompsoc
  \section*{Acknowledgments}
\else
  \section*{Acknowledgment}
\fi
The authors would like to thank...
\ifCLASSOPTIONcaptionsoff
  \newpage
\fi
\begin{thebibliography}{1}
\bibitem{IEEEhowto:kopka}
H.~Kopka and P.~W. Daly, \emph{A Guide to \LaTeX}, 3rd~ed.\hskip 1em plus
  0.5em minus 0.4em\relax Harlow, England: Addison-Wesley, 1999.
\end{thebibliography}
\end{document}

在此处输入图片描述

相关内容