is it possible to swap the numbering of the section block with it's title.



Section 1

instead of

1 Section

I use

  • This depends on the documentclass you are using. Can provide that information? Oct 12, 2016 at 14:21
  • A priori, if the class is compatible, it's easy with titlesec.
    – Bernard
    Oct 12, 2016 at 14:31
  • This means you don't want to specify a title for the section, just "Section 1"?
    – egreg
    Oct 12, 2016 at 14:33
  • To echo egreg, I think "My Section Title 1" looks stranger than "1 My Section Title". Is that what you really want?
    – Teepeemm
    Oct 12, 2016 at 14:36
  • 2
    To format sections: tex.stackexchange.com/questions/36609/formatting-section-titles if you want every \section statement to issue Problem Nº you can put the word 'Problem' before the \thesection and then issue \section{}. Or if a Problem has a name then \section{Name} and change the separator 1em to something like -- or whatever pleases you the most. Oct 12, 2016 at 14:58

1 Answer 1


By using the titlesec package with the explicit package option should give you what you want. You need to add #1 to the <before code> part of the \titleformat command:


\section{My First Section}
\section{My Second Section}

enter image description here

#1 represents the words of the title and does not work when explicit is not used, \thesection is the number of the section, and \quad is spacing.

A simpler version would be:


    \section{My First Section}
    \section{My Second Section}

enter image description here

The form of titlesec formatting is as so:


This is similar to the question asked here:

Adding section number after section title with titlesec package

Edit, I'll try and break it down a little. The documentation is a bit vague regarding the label section.


\titleformat{<command>} is the part were you override an existing title command, such as \section or \chapter

[<shape>] defines the shape of the title, hang is the same as a normal title using display for example would yield a result similar to the standard chapter title format.

{<format>} defines the format of the title text and takes most standard latex values such as \Huge or \bfseries.

{<label>} defines the label of the section title but is no longer needed with the explicit package option and will be defined with #1 later.

{<sep>} is the separation between the title and the first paragraph and takes any standard latex length such as 1em or 12pt.

{<before-code>} this is where we define the position of the title text with #1 and then the number with \thesection giving a spacing between them with \quad (though you could use \hspace{<len>}).

[<after-code>] could be used to define underlines or such but isn't necessary in this example.

  • Is \thesection a counter, and \quad a spacing unit ? And what is the label, I couldn't find any definitions in the documentation.
    – jam
    Oct 13, 2016 at 18:25
  • I've updated my post with more information, please let me know if that helps @jam
    – onekanban
    Oct 13, 2016 at 21:12

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