I have the same problem like here: How to create custom section titles with a "<title> <number>" format in ConTeXt?

But I would like to solve it in LaTeX. Is there a simple way to adapt code from the @phg's answer?

1 Answer 1


You can easily format as you wish with titlesec. Here is an example:

\titleformat{\section}[hang]{\sffamily\color{IndianRed3}\bfseries\scshape\filleft\lsstyle}{}{2em}{#1\quad\rule[-0.25cm]{1.5pt}{1cm}\rlap{\qquad\Huge \thesection}}%


\section{Tweedledum And Tweedledee}

They were standing under a tree, each with an arm round the other's neck, and Alice knew which was which in a moment, because one of them had 'DUM' embroidered on his collar, and the other 'DEE.' 'I suppose they've each got ”TWEEDLE” round at the back of the collar,' she said to herself.

They stood so still that she quite forgot they were alive, and she was just looking round to see if the word ”TWEEDLE” was written at the back of each collar, when she was startled by a voice coming from the one marked 'DUM.'

'If you think we're wax-works,' he said, 'you ought to pay, you know. Wax-works weren't made to be looked at for nothing, nohow!'

'Contrariwise,' added the one marked 'DEE,' 'if you think we're alive, you ought to speak.'


enter image description here

You must log in to answer this question.

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