3

I would like to create section style like in the attached picture, but I didn't find any way how to do it. Usually I'm using titlesec package for section style customizing.

section style

Is there any way how to move the section number to the right edge and make it larger than 'Huge'?

Thank you for your answers.

Jane

2
  • Hi and welcome, what documentclass are you using? Why do you want to make it with titlesec, and not something that might be more suited for the class you are using (which i don't know, hence the questin above)?
    – Johannes_B
    Feb 17 '15 at 17:41
  • Hi, I thought I would use 'article', therefore I asked about section style. But then I decided to use 'book'. I'm not much skilled in LaTeX and titlesec is the only package I used in the past for these changes.
    – Jaja
    Feb 18 '15 at 18:29
6

Here's one possibility using the titlesec package; adjust the settings according to your needs:

\documentclass{book}
\usepackage[explicit]{titlesec}
\usepackage{fix-cm}
\usepackage{lipsum}

% numbered
\titleformat{\chapter}
  {\normalfont\LARGE\bfseries\filleft}
  {}
  {0em}
  {%
    \parbox[b]{\dimexpr\linewidth-2.5cm\relax}{#1}\hfill%
    \parbox[b]{2cm}{\hfill{\fontsize{80}{96}\selectfont\thechapter}}%
  }
% unnumbered
\titleformat{name=\chapter,numberless}
  {\normalfont\LARGE\bfseries\filleft}
  {}
  {0em}
  {\parbox[b]{\dimexpr\linewidth-2.5cm\relax}{#1}}
% spacing
\titlespacing*{\chapter}
  {0pt}{50pt}{40pt}

\begin{document}

\chapter{Introduction}
\lipsum[4]
\chapter*{Unnumbered chapter}
\lipsum[4]

\end{document}

enter image description here

Remarks

  • The question mentions sections, but the image suggests chapters; in any case, to have the formatting for sections, change chapter to section everywhere in my code.

  • To have larger font sizes, you need an scalable font, and then you can use

      \fontsize{<size>}{<baselineskip>}\selectfont
    
  • Two side-by-side \parboxes were used for numbered chapter titles; the first one for the title (accessed through #1 with the explicit option for titlesec) and the second one for the number. The boxes are bottom aligned so, for longer titles, the baseline of the number will be aligned with the baseline of the last line of the title.

1
  • Thank you very much for your help, this does exactly what I need.
    – Jaja
    Feb 17 '15 at 18:27

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.