我有以下命令,
\def\thesection{\Roman{section}}
但我需要将其居中,将其设置为正常字体,并在标题中添加点 (.)。目前它是这样的:
一、引言
我想要的是
I. 介绍(NTRODUCTION)的尺寸应该比“I”小,并且应该居中。
提前致谢。
答案1
根据报告的章节,我对部分进行了重新定义。
\documentclass[12pt, a4paper]{report}
\def\thesection{\Roman{section}}
\makeatletter
\renewcommand\section{\secdef\@section\@ssection}
\def\@section[#1]#2{%
\ifnum \c@secnumdepth >\m@ne
\refstepcounter{section}%
\addcontentsline{toc}{section}%
{\protect\numberline{\thesection}#1}%
\else
\addcontentsline{toc}{section}{#1}%
\fi
\sectionmark{#1}%
\addtocontents{lof}{\protect\addvspace{10\p@}}%
\addtocontents{lot}{\protect\addvspace{10\p@}}%
\if@twocolumn
\@topnewpage[\@makesectionhead{#2}]%
\else
\@makesectionhead{#2}%
\@afterheading
\fi}
\def\@makesectionhead#1{%
\vskip -3.5ex \@plus -1ex \@minus -.2ex%
{\centering \normalfont\bfseries
\ifnum \c@secnumdepth >\m@ne
{\huge\thesection.}\space{\Large #1}\par\nobreak
\fi
\vskip 2.3ex \@plus.2ex
}}
\def\@ssection#1{\if@twocolumn
\@topnewpage[\@makessectionhead{#1}]%
\else
\@makessectionhead{#1}%
\@afterheading
\fi}
\def\@makessectionhead#1{%
\vskip -3.5ex \@plus -1ex \@minus -.2ex%
{\centering \normalfont\bfseries{\Large #1}\par\nobreak
\vskip 2.3ex \@plus.2ex
}}
\makeatother
\begin{document}
\section{Introduction}
\end{document}
编辑
仅修改定义\thesection
。
这不是一个好选择如下图所示。
\documentclass[12pt, a4paper]{report}
\def\thesection{\normalfont\Roman{section}.}
\usepackage{cleveref}
\begin{document}
\section{Introduction}\label{sec:intro}
See \cref{sec:intro} or \emph{with emphasis \cref{sec:intro} vs. I.}. And adding the point leads to two consecutive dots at the end of previous phrase (ugly).
I you want to put the ref in bold: {\bfseries \cref{sec:intro} vs. I.}, it doesn't work too.
\end{document}