0

In my project, I want to change fontsize for the subsection and subbsection (include their number) to the same size as what I write in the next line of its (I don't know how to say this in English naturally). How can I do it ? Thanks.

\documentclass[13pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[left=3cm,right=3cm,top=3cm,bottom=3cm]{geometry}
\usepackage{amsfonts}
\usepackage[titles]{tocloft}

\usepackage{sectsty}

% for the chapter \renewcommand{\thechapter}{\arabic{chapter}.} \newlength\mylength \renewcommand\cftchappresnum{\large{\hspace{0.04cm}}} \settowidth\mylength{\bfseries\cftchappresnum\cftchapaftersnum} \addtolength\cftchapnumwidth{\mylength}

% for the section \renewcommand{\thesection}{\arabic{chapter}.\arabic{section}} \renewcommand{\cftsecnumwidth}{2em} \sectionfont{\fontsize{17}{20}\selectfont}

% for the subsection \renewcommand{\thesubsection}{\arabic{chapter}.\arabic{section}.\arabic{subsection}.\hspace{-.45cm} }

% for the subsubsection \renewcommand{\thesubsubsection}{\arabic{chapter}.\arabic{section}.\arabic{subsection}.\arabic{subsubsection}\hspace{-.45cm} }

\begin{document} \large{ \chapter{Knowledge} \section{Algebra}

\subsection{Matrix.} \subsection*{\Large{1.1.1. Matrix.} }

\subsubsection{Definition.} \subsection*{1.1.1.1. Definition.}

} \end{document}

PermQi
  • 187
  • Addings dots/periods/full stops after the sectioning number is also an objective? Please clarify. – Mico Jan 09 '24 at 12:40
  • @Mico yes it's right – PermQi Jan 09 '24 at 15:56
  • @bonk not so much indeed, I tried applying the code which is demonstrated in this link but it was not compatible to my original project – PermQi Jan 09 '24 at 15:58
  • Off-topic: \large is a switch and doesn't take an argument. If you want to limit the scope of \large, you need to write {\large ...}, not \large{...}. – Mico Jan 09 '24 at 16:16
  • @Mico I wIll notes that. How about the size of the subsection and subsubsection ? – PermQi Jan 09 '24 at 16:50
  • "it was not compatible to my original project" What issues were you getting with the linked answer's code? Are you getting errors, or does it not do what you want? I see that you're already using the sectsty package, does the sectsty example in that answer not work? – bonk Jan 09 '24 at 16:57
  • @bonk here is what happened when I applied the code in that link – PermQi Jan 09 '24 at 17:08
  • It looks like it worked as intended. It didn't do exactly what you wanted because that linked question's author isn't trying to do exactly what you want to do. You'll need to read the code, understand what it does, and change it to make it work for your purpose. – bonk Jan 09 '24 at 17:13
  • Also, the linked answer provided multiple solutions. One of them uses sectsty, which you're already using in your example. Why not just use that solution? I had tested it out myself already and it definitely does work. – bonk Jan 09 '24 at 17:14
  • @bonk I have another question, do you know why my code for the subsubsection didn't ouput the section number for the subsubsection ? I don't understand why – PermQi Jan 09 '24 at 17:19

0 Answers0