如何在節前保持編號並添加文字?

如何在節前保持編號並添加文字?

titlesec我正在使用帶有 文檔類的包scrartcl。我希望我的部分格式是:

第一講 章節名稱

現在我正在使用命令

\titleformat{\section}{\fontsize{13}{13}\bfseries\sffamily}{Lecture \thesection}{1em}{} 

儘管它似乎沒有產生我需要的結果。編號和標籤將被忽略。

答案1

不要將套件titlesec與 KOMA-Script 類別一起使用。您可以重新定義 KOMA-Script 指令\sectionformat來插入前綴Lecture

\renewcommand\sectionformat
  {Lecture\enskip\thesection\autodot\hspace{1em}}

例子:

\documentclass[numbers=withenddot]{scrartcl}
\renewcommand\sectionformat
  {Lecture\enskip\thesection\autodot\hspace{1em}}
\addtokomafont{section}{\large}

\usepackage{lipsum}
\begin{document}
\section{Section name}
\lipsum
\end{document}

結果是

在此輸入影像描述

相關內容