
我對 LaTex 相當陌生,目前正在使用它來撰寫論文。在我的論文中,我的內容清單之前有一個前言、致謝和所用縮寫清單的頁面。內容清單後面是我的論文簡介。這裡的“問題”是,我希望目錄之前的每一章都列為“第一章”、“第二章”等(羅馬字母),而目錄之後的每一章都顯示為“第一章” 」、「第二章」等。
有什麼辦法可以做到這一點嗎?
MWE是怎樣的現在作品:
\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage{lipsum} % just for dummy text
\begin{document}
\pagenumbering{arabic}
\chapter{Abbreviations}
\lipsum[1-2]
\section{Some extra special abbreviations}
\lipsum[1-2]
\subsection{Some math}
\lipsum[1-2]
\tableofcontents
\chapter{Introduction}
\lipsum[1-2]
\end{document}
列出的 MWE 是目前的樣子,但我想要更改的是「縮寫」章節中的「第 1 章」。我會用羅馬字母來表示各節/小節,並從「引言」一章開始使用「正常」編號(第 1 章、第 1 節、第 1.1 小節等)。
我知道我可以從縮寫中刪除第一章部分
\chapter*
但我仍然不知道如何添加“第二章”。
答案1
在 frontmatter 中定義\thechapter
要執行的操作,然後重置計數器並重新定義為標準。我還添加了相容性程式碼。\Roman{chapter}
chapter
\thechapter
\arabic{chapter}
hyperref
\documentclass{report}
\usepackage[utf8]{inputenc}
%\usepackage{hyperref} % if you want it
\usepackage{lipsum} % just for dummy text
% uncomment the following line if using hyperref
%\renewcommand{\theHchapter}{\arabic{chapter}\thechapter}
\begin{document}
\renewcommand{\thechapter}{\Roman{chapter}}
\chapter{Preface}
\lipsum[1-2]
\chapter{Acknowledgments}
\lipsum[1-2]
\chapter{Abbreviations}
\lipsum[1-2]
\section{Some extra special abbreviations}
\lipsum[1-2]
\subsection{Some math}
\lipsum[1-2]
\tableofcontents
\renewcommand{\thechapter}{\arabic{chapter}}
\setcounter{chapter}{0}
\chapter{Introduction}
\lipsum[1-2]
\end{document}
為了也為下級計數器取得羅馬數字,請執行以下操作
\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand{\thesection}{\thechapter.\Roman{section}}
\renewcommand{\thesubsection}{\thesection.\Roman{subsection}}
在開始時和
\renewcommand{\thechapter}{\arabic{chapter}}
\renewcommand{\thesection}{\thechapter.\arabic{section}}
\renewcommand{\thesubsection}{\thesection.\arabic{subsection}}
\setcounter{chapter}{0}
第 1 章之前。