I would like to do redefine the section title command by enclosing it with ornaments like the following:

~ornament~ SectionTitle ~ornament~

I had looked up the titlesec documentation and many more example on how to redefine titles without any clues on how to add text after the title.

The aim is to add text in the section title after the \thesection command.


I find out how to redefine \section to do that:

~ornament~ SectionTitle

but not how to do that:

~ornament~ SectionTitle ~ornament~

2 Answers 2


The last mandatory argument of \titlesec may end with a one argument command, which the title is passed to.





\section{A section}
\section*{Unnumbered section}


enter image description here

  • Thank you both for your answers that was exactly what I wanted ! I prefer egreg's answer which is simpler.
    – tugdual
    Commented Dec 12, 2018 at 22:51

The following seems to be what you're after; you can redefine \secornament to be/use whatever you want.

enter image description here




\RenewDocumentCommand{\section}{ s o m }{%
    {\oldsection*{\secornamentstyle{#3}}}% \section*{...}
       {\oldsection[#2]{\secornamentstyle{#3}}}% \section[..]{...}
       {\oldsection[#3]{\secornamentstyle{#3}}}% \section{...}


% Keep \secornamentstyle to do nothing, otherwise \tableofcontents would set
% \section*{Contents} using the ornaments

\section{A section}
\section*{Unnumbered section}


\section is redefined using xparse for ease of distinguishing between the optional starred * version and optional arguments.

You must log in to answer this question.

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