如何在article文档类与kafkanotes包下设置章节编号从4开始?
问题
使用article文档类和kafkanotes宏包时,能否让章节编号从4开始而非默认的1?该如何操作?
我的.sty文件
%==============STYLE DIMULAI==============% \usepackage[marginparwidth=6cm, marginparsep=0.7cm]{geometry} %Package Matematika \usepackage{amsmath} %Style Gambar \usepackage{graphicx} \usepackage{floatrow} \floatsetup[widefigure]{margins=hangright,capposition=beside, capbesideposition={bottom, right},floatwidth=\textwidth} %Package Catatan di Margin \usepackage{sidenotes} %Style \maketitle \usepackage{titlesec} \makeatletter \renewcommand{\maketitle}{\bgroup\setlength{\parindent}{0pt} \begin{flushleft} {\Huge\sffamily\bfseries\@title} \vskip 1.5em {\sffamily\@author} \end{flushleft}\egroup } \makeatother %Header and Footer Package \usepackage{fancyhdr} %Style Abstract \renewenvironment{abstract} {\par{\bfseries \noindent \sffamily \abstractname.}} {\vskip 0.1em \medskip\noindent \rule{\linewidth}{.5pt}} %Font Teks Utama dan Sesi \usepackage{lmodern} \renewcommand*{\familydefault}{\sfdefault} %% Only if the base font of the document is to be sans serif \usepackage[T1]{fontenc} \usepackage{sectsty} \sectionfont{\sffamily\fontsize{15}{15}\selectfont} \subsectionfont{\sffamily\fontsize{10}{5}\selectfont} %Style Hyperlink \usepackage{hyperref} \hypersetup{ colorlinks, citecolor=black, filecolor=black, linkcolor=black, urlcolor=black } %Pembahasaan ke Indonesia \renewcommand{\figurename}{\footnotesize Figure} \renewcommand{\tablename}{\footnotesize Table} \renewcommand{\contentsname}{Outline}
我的.tex文件
\documentclass{article} \usepackage{kafkanotes} \usepackage{booktabs} \usepackage{biblatex} %Imports biblatex package \addbibresource{bibliography.bib} %Import the bibliography file %Judul dan Penulis \title{XYZ} \author{\textbf{ABC}} \begin{document} \begin{titlepage} \thispagestyle{empty} \maketitle \begin{abstract} Lorem \end{abstract} \tableofcontents \end{titlepage} \section{Some section} \printbibliography \end{document}
解答
完全可行,核心思路是修改LaTeX内置的章节计数器,具体操作如下:
- 调整章节计数器初始值
在你的.tex文件中,找到第一个\section命令的位置,在它之前添加以下命令:
\setcounter{section}{3}
LaTeX的计数器从0开始计数,设置为3后,下一个\section就会自动编号为4。
- 修改后的
.tex文件示例
\documentclass{article} \usepackage{kafkanotes} \usepackage{booktabs} \usepackage{biblatex} %Imports biblatex package \addbibresource{bibliography.bib} %Import the bibliography file %Judul dan Penulis \title{XYZ} \author{\textbf{ABC}} \begin{document} \begin{titlepage} \thispagestyle{empty} \maketitle \begin{abstract} Lorem \end{abstract} \tableofcontents \end{titlepage} % 设置章节计数器初始值,让下一个section从4开始 \setcounter{section}{3} \section{Some section} \printbibliography \end{document}
- 额外说明
kafkanotes宏包主要用于添加边栏笔记,不会干扰章节编号的基础机制,因此这个方法完全适用。- 如果需要同步调整子章节(如
subsection)的编号,可类似使用\setcounter{subsection}{n},其中n为子章节计数器的初始值(下一个subsection会显示n+1)。
内容的提问来源于stack exchange,提问作者Thinker
相关产品推荐
相关产品推荐

