-1

I'm using a customised class file (not written by me, I'm just being kind of forced to use it) and I was asked to change the size of the sections and subsections' title fonts. This class loads as its base scrartcl and in its body I've found this, referent to the sections and subsections

\renewcommand\thesection{\Roman{section}}
\renewcommand\thesubsection{\thesection.\alph{subsection}}
%
\allsectionsfont{ 
\usefont{T1}{lmr}{b}{n} 
\color{PrussianBlue}
\shadowtext
}
\subsectionfont{ 
\usefont{T1}{lmr}{b}{n}
\color{PrussianBlue}
\shadowtext
}

How can I change the font size for the sections and subsections' titles, be it in the class file or in the .tex directly?

Thank you very much.

5

Disclaimer: Maybe the unknown class does other strange things. So it is possible that the following suggestions do not work for you. I can only simulate the class with the informations given in the question:

\documentclass{scrartcl}
%%%% the following lines are only to simulate the settings of the unknown class of the OP
\usepackage{shadowtext}
\definecolor{PrussianBlue}{RGB}{0,39,124}
\usepackage{sectsty}
\renewcommand\thesection{\Roman{section}}
\renewcommand\thesubsection{\thesection.\alph{subsection}}
%
\allsectionsfont{ 
\usefont{T1}{lmr}{b}{n} 
\color{PrussianBlue}
\shadowtext
}
\subsectionfont{ 
\usefont{T1}{lmr}{b}{n}
\color{PrussianBlue}
\shadowtext
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage{blindtext}% dummy text
\begin{document}
\blinddocument
\end{document}

The class uses \shadowtext for the titles of all section levels. So there is no line break allowed inside the titles, i.e. the titles have to be single lined.

With KOMA-Script commands

Using

\RedeclareSectionCommands
  [font=\usefont{T1}{lmr}{b}{n}\normalsize\color{PrussianBlue}]
  {part,section,subsection,subsubsection,paragraph,subparagraph}

in the preamle of your document KOMA-Script controlls the section headings again. Additionally the font settings for all levels are changed.

Then you can use

\addtokomafont{section}{\huge}
\addtokomafont{subsection}{\small}

to change the fontsize of section and subsection.

If you still want the section titles shaded add the following redefinition to the preamble of your document:

\renewcommand\sectionlinesformat[4]{%
  \shadowtext{\hskip#2#3#4}%
}

To shade the text for part titles too, you have to use

\addtokomafont{part}{\shadowtext}
\addtokomafont{partnumber}{\usekomafont{part}}

Because \shadowtext takes an argument, it must be the last of commands which are added to a font element.

enter image description here

Code:

\documentclass{scrartcl}
%% the following lines are only to simulate the settings of the unknown class of the OP
\usepackage{shadowtext}
\definecolor{PrussianBlue}{RGB}{0,39,124}
\usepackage{sectsty}
\renewcommand\thesection{\Roman{section}}
\renewcommand\thesubsection{\thesection.\alph{subsection}}
%
\allsectionsfont{ 
\usefont{T1}{lmr}{b}{n} 
\color{PrussianBlue}
\shadowtext
}
\subsectionfont{ 
\usefont{T1}{lmr}{b}{n}
\color{PrussianBlue}
\shadowtext
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\RedeclareSectionCommands
  [font=\usefont{T1}{lmr}{b}{n}\normalsize\color{PrussianBlue}]
  {part,section,subsection,subsubsection,paragraph,subparagraph}

\addtokomafont{section}{\huge}
\addtokomafont{subsection}{\small}
\addtokomafont{part}{\shadowtext}
\addtokomafont{partnumber}{\usekomafont{part}}

\renewcommand\sectionlinesformat[4]{%
  \shadowtext{\hskip#2#3#4}%
}

\usepackage{blindtext}% dummy text
\begin{document}
\blinddocument
\end{document}

With package sectsty

Note that the usage of package sectsty with a KOMA-Script class is not recommended because it breaks some features of these classes. Nevertheless it should be possible.

You only have to repeat all settings for all levels that should be changed. Again \shadowtext must be the last command.

\documentclass{scrartcl}
%% the following lines are only to simulate the settings of the unknown class of the OP
\usepackage{shadowtext}
\definecolor{PrussianBlue}{RGB}{0,39,124}
\usepackage{sectsty}
\renewcommand\thesection{\Roman{section}}
\renewcommand\thesubsection{\thesection.\alph{subsection}}
%
\allsectionsfont{ 
\usefont{T1}{lmr}{b}{n} 
\color{PrussianBlue}
\shadowtext
}
\subsectionfont{ 
\usefont{T1}{lmr}{b}{n}
\color{PrussianBlue}
\shadowtext
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\sectionfont{ 
\usefont{T1}{lmr}{b}{n}
\color{PrussianBlue}
\huge
\shadowtext
}
\subsectionfont{ 
\usefont{T1}{lmr}{b}{n}
\color{PrussianBlue}
\small
\shadowtext
}

\usepackage{blindtext}% dummy text
\begin{document}
\blinddocument
\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.