4

I used the following code to increase the font size of \section but failed.

\renewcommand\section{\@startsection {section}{1}{\z@}%
                               {-3.5ex \@plus -1ex \@minus -.2ex}%
                               {2.3ex \@plus.2ex}%
                               {\normalfont\Large\bfseries}}

But it gave me a lot of errors.

  • 1
    You need to placed it between \makeatletter .. \makeatother. – Martin Scharrer Jan 4 '12 at 10:07
  • 2
    Did you enclose the redefinition in \makeatletter ... \makeatother? See tex.stackexchange.com/questions/8351/…. – lockstep Jan 4 '12 at 10:07
  • It would be helpful if you described what you mean by "a lot of errors". We aren't psychics… Did it fail to compile? Did the log contain lots of errors? What sorts of errors? – Seamus Jan 4 '12 at 10:21
  • hi now it compiled without any errors but there is no visual increase in font size ? – KiloWatt Jan 4 '12 at 10:25
  • 3
    That's because \sections are \Large by default in the standard document classes. – lockstep Jan 4 '12 at 10:45
9

As already said you have to use \makeatletter and \makeatother because in Tex @ ist used as special character for internal commands. If you really want to change the format this way you have to change the defaults. Here is a minimal working example:

\documentclass{article}

\makeatletter
\renewcommand\section{\@startsection {section}{1}{\z@}%
    {-3.5ex \@plus -1ex \@minus -.2ex}%
    {2.3ex \@plus.2ex}%
    {\normalfont\Huge\bfseries}}
\makeatother

\begin{document}
    \section{test}
\end{document}

It might be easier to use a special package like titlesec

\documentclass{article}

\usepackage{titlesec}
\titleformat{\section}{\Huge\bfseries}{\thesection}{1em}{}

\begin{document}
    \section{test}
\end{document}

or sectsty

\documentclass{article}

\usepackage{sectsty}
\sectionfont{\Huge\bfseries}

\begin{document}
    \section{test}
\end{document}

Or if you are using Koma Script you can eaily do:

\documentclass{scrartcl}

\setkomafont{section}{\Huge\bfseries}
\begin{document}
    \section{test}
\end{document}

I wouldn't recommand to change the section format directly. I would use Koma-Script or titlesec

|improve this answer|||||
  • what it the default font size of the command \section? – Aurelius Jul 20 '12 at 0:14
  • default for standard classes is \Large – someonr Aug 8 '12 at 23:55

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.