我正在尝试使用setkomafont
和thesection
来将节字体设置为小写字母。虽然这样可以正确设置字体,但节编号的缩放比例不正确。请参阅所附屏幕截图。如何将节编号缩放为节文本?
\documentclass{scrartcl}
% this works
\setkomafont{section}{\normalfont\large\scshape}
% tried this but doesnt work
\renewcommand{\thesection}{\large\scshape\Roman{section}}
\usepackage[protrusion=allmath,tracking=smallcaps]{microtype}
\usepackage{lipsum}
\begin{document}
\section{i. the mighty introduction}
\lipsum
\section{ii method}
\lipsum
\end{document}
答案1
字体大小已经相同,无需在 的定义中添加\large
和。区别在于小写字母中的大写字母和小写字母中的小写字母之间的区别。因此,似乎您想要的是而不是:\scshape
\thesection
\roman{section}
\Roman{section}
\documentclass{scrartcl}
% this works
\setkomafont{section}{\normalfont\large\scshape}
% tried this but doesnt work
\renewcommand{\thesection}{\roman{section}}
\usepackage[protrusion=allmath,tracking=smallcaps]{microtype}
\usepackage{lipsum}
\begin{document}
\section{i. the mighty introduction}
\lipsum
\section{ii method}
\lipsum
\end{document}
顺便说一句:如果您愿意,您可以强制将章节标题文本自动改为小写:
\documentclass{scrartcl}
% this works
\setkomafont{section}{\normalfont\large\scshape}
% tried this but doesnt work
\renewcommand{\thesection}{\roman{section}}% using \roman instead of \Roman still needed!
\makeatletter
\renewcommand*{\sectionlinesformat}[4]{%
\Ifstr{#1}{section}{%
\@hangfrom{\hskip #2\MakeLowercase{#3}}\MakeLowercase{#4}%
}{%
\@hangfrom{\hskip #2#3}#4%
}%
}
\makeatother
\usepackage[protrusion=allmath,tracking=smallcaps]{microtype}
\usepackage{lipsum}
\begin{document}
\tableofcontents
\section{The Mighty Introduction}% will be automatically changed to lower case in section title (but not in running head or ToC)
\lipsum
\section{Method}
\lipsum
\end{document}