0

Im having troubles in formatting chapter headings. Im doing it with the package titlesec. My goal is to have the chapter number on the left, than a line with above the chapter name. I achieved this with the following minimal working example. But I can not figure out how to increase the size of the chapter name in this code?

\RequirePackage{filecontents}
\begin{filecontents*}{test1.tex}
    \chapter{Chapter One}
    Text123\\
    Text123\\
    Text123
\end{filecontents*}

\documentclass[a4paper, liststotoc, bibtotoc, 12pt, numbers=noenddot, twoside]{book} 

\usepackage{fancyhdr}

\usepackage[explicit]{titlesec}
\newlength\chapnumb
\setlength\chapnumb{4cm}
\titleformat{\chapter}[block]
{\normalfont\sffamily}{}{0pt}
{\parbox[b]{\chapnumb}{%
        \fontsize{100}{10}\selectfont\thechapter}%fontsize number
    \parbox[b]{\dimexpr\textwidth-\chapnumb\relax}{%
        \raggedleft%
        \hfill{\LARGE#1}\\
        \rule{\dimexpr\textwidth-\chapnumb\relax}{0.4pt}}}
\titleformat{name=\chapter,numberless}[block]
{\normalfont\sffamily}{}{0pt}
{\parbox[b]{\chapnumb}{%
        \mbox{}}%
    \parbox[b]{\dimexpr\textwidth-\chapnumb\relax}{%
        \raggedleft%
        \hfill{\LARGE#1}\\
        \rule{\dimexpr\textwidth-\chapnumb\relax}{0.4pt}}}

\begin{document}
    \include{test1}
\end{document}

Many thanks for your help!!

4
  • You need a continuously scalable font to make \fontsize work as you expect. For example: \usepackage{lmodern} – Ivan Jan 13 at 14:13
  • @Ivan: Many thanks for your suggestion. If I insert \usepackage{lmodern} to the code, I can change the size of the chapter number with \fontsize . But where I can change the fontsize of the chapter name?? There is no \fontsize there – Markus Jan 13 at 14:25
  • For example, change \hfill{\LARGE#1} in \hfill{\fontsize{50}{60}\selectfont #1} – Ivan Jan 13 at 14:41
  • @Ivan: THANKS a lot! That solved my problem. – Markus Jan 13 at 16:02
0

It was already suggested by Ivan, so credits for him.

x1

x2

\RequirePackage{filecontents}
\begin{filecontents*}[overwrite]{test1.tex}
    \chapter{Chapter One}
    Text123\\
    Text123\\
    Text123
        \chapter*{Chapter Two}
    Text123\\
    Text123\\
    Text123
    
\end{filecontents*}

\documentclass[a4paper, liststotoc, bibtotoc, 12pt, numbers=noenddot, twoside]{book} 

\usepackage{fancyhdr}

\usepackage[explicit]{titlesec}
\newlength\chapnumb
\setlength\chapnumb{4cm}
\titleformat{\chapter}[block]
{\normalfont\sffamily}{}{0pt}
{\parbox[b]{\chapnumb}{%
        \fontsize{100}{10}\selectfont\thechapter}%fontsize number
    \parbox[b]{\dimexpr\textwidth-\chapnumb\relax}{%
        \raggedleft%
        \hfill{\fontsize{50}{10}\selectfont #1}\\  % <<<<<<<<<<<<<<<<<<
        \rule{\dimexpr\textwidth-\chapnumb\relax}{0.4pt}}}
\titleformat{name=\chapter,numberless}[block]
{\normalfont\sffamily}{}{0pt}
{\parbox[b]{\chapnumb}{%
        \mbox{}}%
    \parbox[b]{\dimexpr\textwidth-\chapnumb\relax}{%
        \raggedleft%
        \hfill{\fontsize{50}{10}\selectfont #1}\\ % <<<<<<<<<<<<<<<<<<
        \rule{\dimexpr\textwidth-\chapnumb\relax}{0.4pt}}}

\begin{document}
    \include{test1}
\end{document}

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.