3

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

6

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

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{microtype}
\usepackage{fourier}
\usepackage{cabin}
\usepackage[x11names]{xcolor}
%
\usepackage[explicit]{titlesec}
\titleformat{\section}[hang]{\sffamily\color{IndianRed3}\bfseries\scshape\filleft\lsstyle}{}{2em}{#1\quad\rule[-0.25cm]{1.5pt}{1cm}\rlap{\qquad\Huge \thesection}}%
\setcounter{section}{3}

\begin{document}

\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.'

\end{document} 

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.