番号付けを維持しながらセクションの前にテキストを追加するにはどうすればよいですか?

番号付けを維持しながらセクションの前にテキストを追加するにはどうすればよいですか?

titlesec私はドキュメント クラスで パッケージを使用していますscrartcl。セクションを次のようにフォーマットしたいと思います。

講義1. セクション名

今私はコマンドを使っています

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

ただし、必要な結果は得られないようです。番号とラベルは単に無視されます。

答え1

titlesecKOMA-Script クラスと一緒にpackage を使用しないでください。 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}

結果的に

ここに画像の説明を入力してください

関連情報