[英]Remove section number but display the number in table of contents in LaTeX
titlesec
軟件包對於修改章節標題非常有用。 一個重要的命令是\\titleformat
,在手冊的第4頁上進行了描述。 該命令如下所示:
\titleformat{⟨command⟩}[⟨shape⟩]{⟨format⟩}{⟨label⟩}{⟨sep⟩}{⟨before-code⟩}[⟨after-code⟩]
在這里,我們要更改\\section
命令,即<command>
是\\section
。 <shape>
設置是可選的-我們將保留默認值。 在<format>
,我們定義標題的格式。 \\section
的默認值為\\normalfont\\Large\\bfseries
,因此我們將其設置為該值。 如果要更改外觀,可以在此處進行。 現在,有趣的部分: <label>
是節號-我們不想將其打印出來,因此我們將該字段留空。 <sep>
是標簽和標題之間的分隔符,如果沒有標簽,則應為零。 最后,使用<before-code>
和<after-code>
我們可以添加應該在打印標題之前或之后運行的任何代碼。 我們也不需要。 因此,我們的命令是:
\titleformat{\section}{\normalfont\Large\bfseries}{}{0pt}{}
在這里,對此進行了演示:
\documentclass{article}
\usepackage{titlesec}
\titleformat{\section}{\normalfont\Large\bfseries}{}{0pt}{}
\begin{document}
\tableofcontents
\section{Introduction to Company}
This is the company.
\section{Introduction to Project}
My project is very nice.
\end{document}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.