# Understand how to change the style of chapters numbering with *.cls and *.sty files

I have downloaded an archive with inside a *.cls and *.sty file. I want to get a similar result like the style of the chapter numbering below. Is it a simple image the style on the number in this screenshot, or should i look inside the files that i have mentioned, before to understand how it has been generated?

Edit 1: The class that i am currently using is:

\documentclass[12pt,a4paper,openright,oneside]{book}

• Yesterday my car did not start. It is a blue car. Can you tell me why it did not start? ;-)
– user31729
Mar 24, 2018 at 22:23
• If they're short .cls and .sty files, you can try your luck and see if you can figure out how it was done. Longer files can be tough to understand. But it would be easier to forget the .cls and .sty files, and just go to "I'd like to format my document like so". Google how to adjust the section titles (titling package, IIRC), and then come to us with any questions you may still have. Mar 24, 2018 at 22:24
• @Teepeemm The titling package is for customizing the \title command. For chapter and section headings use titlesec. See Change size of section, subsection, subsubsection, paragraph and subparagraph title Mar 24, 2018 at 22:34
• Chances are, both cls and sty files, are bad. Mar 25, 2018 at 1:46
• @decimal: Exactly ;-)
– user31729
Mar 25, 2018 at 8:30

Something similar can be achieved by redefining the standard definition for the chapterhead.

\documentclass{book}
\usepackage{xcolor,blindtext}
\usepackage{lmodern}
\makeatletter
\vspace*{20pt}%
{\setlength{\parindent}{0pt} \raggedleft \normalfont
\ifnum \value{secnumdepth} >-1
\if@mainmatter
{\fontsize{56pt}{0pt}\color{red!50!black}\bfseries\thechapter
\par}\nobreak
\fi
\fi
\interlinepenalty\@M
\Huge \bfseries #1\par\nobreak
\vskip 40pt
}}
\makeatother
\begin{document}
\chapter{Wombat and Alpaca}
\blindtext
\end{document}

• Thank you for the example. Could i change separetely, with the redefinition of the \makechapterhead command(of the book class) the font or size of the chapter number from that of his title? With the \chapterfont command of the secsty package it change both as stated in the documentation. Mar 25, 2018 at 12:29
• @decimal The size is different in the example given. Try 140pt instead of just 56pt. Mar 25, 2018 at 12:31
• Yes, didn't noticed that because i am a beginner with commands. I though it was much easier to get this type of customization but obviously i need to learn more about this things. For those of you who are interested, here there are good examples of chapter styling with the memoir class ctan.mirror.garr.it/mirrors/CTAN/info/latex-samples/…. Because the memoir class it's based on the book class i will try to switch to it for my thesis hoping it doesn't change a lot of what i did. Mar 25, 2018 at 12:46
• @decimal memoir is an alternative to a standard class, not based on it. The redefinition from above won't work with memoir. Here is what i was talking about earlier: tex.stackexchange.com/a/423045/37907 Mar 25, 2018 at 12:50
• yes, the redefinition of the commands(that didn't exist) that you wrote below, should work if i use the memoir class. Mar 25, 2018 at 12:54