Could we create a titlesec to KOMA-script lexicon? Or, in other words, how to emulate titlesec commands with native KOMA ones?

The point would be to define "\titleseccommand[<a>]{<b>}{<c>} is emulated by \KOMAcommand1{<b>}\KOMAcommand2{<c>}{<a>}" for each titlesec commands.


titlesec is a great package to easily customize your titles. KOMA-script classes are great too.

However, there are incompatibilities between KOMA classes and titlesec. Even if the clash is not crippling in most cases, you still get this nice warning:

Class scrartcl Warning: Usage of package `titlesec' together
(scrartcl)              with a KOMA-Script class is not recommended.
(scrartcl)              I'd suggest to use the package only
(scrartcl)              if you really need it, because it breaks several
(scrartcl)              KOMA-Script features, i.e., option `headings' and
(scrartcl)              the extended optional argument of the section
(scrartcl)              commands .

Indeed, KOMA classes have their own commands to pimp your titles. You thus find here several questions (1, 2, 3, etc.) asking to "translate" a personnalized title/heading using titlesec macros into KOMA-script native commands.

Since there are only case-specific answers, it is hard to generalize and adapt to your own problem.


Here is a sum-up of titlesec commands and options.

  • \titlelabel{<A:label-format>}

Defines what is printed as label (~number) for (sub)sections. E.g. to add an em dash (---) after the section number (\thesection)): \titlelabel{\thesection---\quad}

  • \titleformat*{<B:sectionning-command>}{<C:format>}

(Light-version of \titleformat) Changes the format (\itshape, \bfseries...) of a sectionning command (\title, \section...). E.g. to make paragraph titles bold : \titleformat*{\paragraph}{\bfseries}

  • \titleformat{D:command}[E:shape]{F:format}{G:label}{H:sep}{I:before-code}{J:after-code}
    Redefines the "internal" format of a title (i.e. how it looks -- fontshape, label, etc.). Here are the arguments of options:

    • D:command : a sectionning command (\part,\section, etc.)
    • E:shape : hang, block, display, runin, leftmargin, fightmargin, drop, or wrap. See definition in titlesec documentation, p. 3.
    • F:format : text layout of the label and the title (e.g. \bfseries, \itshape)
    • G:label : defines what is printed as label (~number). E.g. to add an em dash after the section number {\thesection---\quad}
    • H:sep : the horizontalspace between the label and the title. Must be a length (2em, 1cm, .1\linewidth...) (Defined differently for display, and frame shapes.)
    • I:before-code : code executed before the title body. (E.g. for a text shape different than the label's one)
    • J:after-code : code executed after the title body.
  • \titlespacing{K:command}{L:left}{M:before-sep}{N:after-sep}[O:right-sep]
    Redefines the "external" format of a title (i.e. how it is regarding the rest of the text -- indentation, spacing, etc.). The starred version (\titlespacing*) kills the indentation of the text following the paragraph. Here are the argument options

    • K:command : a sectionning command (\part,\section, etc.)
    • L:left : increases the left margin
    • M:before-sep : vertical space before the title (e.g. 2\parskip)
    • N:after-sep : vertical (or horizontal regarding the shape used) space after the title (e.g. 5pc plus 2pt minus 3pt).
    • O:right-sep : increases the right-sep margin in case of using hang, block of diplay shape.
  • 1
    Doesn't this defeat the whole purpose of KOMA (replacing every LaTeX command with a different name)? ;-) Commented Apr 13, 2016 at 14:56

1 Answer 1


This is not really a answer to the question. I think it is not possible to "translate" the titlesec commands in a general way to KOMA-Script commands. They are using different approaches. So here is only an overview of some possible ways.

The relevant KOMA-Script commands and options are

  • \RedeclareSectionCommand, \RedeclareSectionCommands, \DeclareSectionCommand etc.
  • \partformat, \chapterformat, \sectionformat etc.
  • \raggedchapter and \raggedsection
  • \addtokomafont and \setkomatfont
  • chapterprefix and appendixprefix
  • headings=<value> with a <value> like big, normal, small, onelineappendix, twolineappendix, onelinechapter, twolinechapter etc.
  • \sectionlinesformat, \sectioncatchphraseformat, \chapterlinesformat and \chapterlineswithprefixformat

See the KOMA-Script documentation for more informations.

\titlelabel (from package titlesec)

You can redefine the KOMA-Script commands \partformat, \chapterformat, \sectionformat etc. Example:


\titleformat* (from package titlesec)

Use KOMA-Script commands \addtokomafont or \setkomafont or \RedeclareSectionCommand or \RedeclareSectionCommands to change the font settings for section headings. Note that font element dispostion is used for all section levels before their own font element. The settings of disposition can only be changed with \addtokomafont or \setkomafont. Examples:


\titlespacing (from package titlesec)

Use options indent (not available for part and chapter styles), beforeskip and afterskip of commands \RedeclareSectionCommand and \RedeclareSectionCommands. Examples:


Note there are more options for these commands like font, level, style, counterwithin, prefixfont, innerskip etc. depending on option style that could be section, chapter or part.

If you want to change the right margin (and/or the left margin of chapters and parts) you have to redefine \sectionlinesformat, \chapterlinesformat or \chapterlineswithprefixformat.

\titleformat (from package titlesec)

You have to use a combination of commands mentioned in the list above. This combination depends for a example from the desired shape. So I think this could not be answered in a short general way. Here are only some possibilities.

  • shape like hang: Default layout for chapter, section, subsection and subsubsection headings. To change paragraph and subparagraph headings to hang set a positive value to option afterskip by using \RedeclareSectionCommand. Example: \RedeclareSectionCommand[afterskip=1sp]{paragraph}. Then you can redefine \sectionlinesformat or \chapterlinesformat.

  • shape like runin: Default layout for paragraph and subparagraph. To change other headings (with style=section) to runin set a negative value to option afterskip using \RedeclareSectionCommand. Example:\RedeclareSectionCommand[afterskip=-1em]{subsubsection}. Then you can redefine \sectioncatchphraseformat. If you want to change the shape of chapter heading to a runin like you have to set its style to section.

  • shape like display: Default layout for headings with style=part. To use a prefix line for chapters set option chapterprefixline or headings=twolinechapter. Note that you can switch the prefix line for appendix chapters separatly by option appendixprefixline or headings=twolinechapter etc. Then you can redefine \chapterlineswithprefixformat. If you want to use a twoline heading for other section levels one possibility is redefining \sectionlinesformat.

Note that the style option of a section level can be changed using \RedeclareSectionCommand. Example: \RedeclareSectionCommand[style=section,indent=0pt]{chapter}

Shapes block, frame, leftmargin and rightmargin should be also possible by redefining \sectionlinesformat, \sectioncatchphraseformat, \chapterlinesformat and/or \chapterlineswithprefixformat.

  • If you want to execute code after or before the sectioning title, redefine the appropriate linesformat
    – marczellm
    Commented Dec 29, 2018 at 12:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .