我有以下章节编号
\renewcommand{\thesection}{\Roman{section}.}
我介绍一下
\section{Literature Review}\label{sec:lit}
并得到“II.文献综述”
现在,当我提到它时
In Section~\ref{sec:lit}, we...
输出为“在第二节中,我们......”
我怎样才能将其更改为“在第二部分中,我们...”。因此,删除句号,我希望句号出现在章节标题中,但不出现在交叉引用中。
例子:
\documentclass[leqno,letterpaper,12pt,english]{article}
\renewcommand{\thesection}{\Roman{section}.}
\begin{document}
\section{Introduction}
Here, we talk about Section~\ref{sec:lit},
but we do not want the dot after the numbering.
\section{Literature Review}\label{sec:lit}
This is the literature review.
\end{document}
答案1
这是一个不需要加载包的解决方案。相反,它依赖于低级 LaTeX 宏\@seccntformat
,如本书第 21 页所述LaTeX 伴侣,第 2 版。(hyperref
下面加载的包仅仅是为了直观地突出显示的输出内容\ref
。)
\documentclass[leqno,letterpaper,12pt,english]{article}
\renewcommand{\thesection}{\Roman{section}}
\usepackage[colorlinks,allcolors=blue]{hyperref} % optional
\makeatletter % see p. 21 of "The LaTeX Companion", 2nd ed.
\def\@seccntformat#1{\@ifundefined{#1@cntformat}%
{\csname the#1\endcsname\quad}% default
{\csname #1@cntformat\endcsname}}% enable individual control
\newcommand\section@cntformat{\thesection.\quad} % section level
\makeatother
\begin{document}
\section{Introduction}
We talk about Section~\ref{sec:lit}; observe that there is no dot
(aka ``full stop'') after the Roman numeral.
\section{Literature Review}\label{sec:lit}
This is the literature review.
\end{document}