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.

5
  • 1
    You need to placed it between \makeatletter .. \makeatother. Jan 4, 2012 at 10:07
  • 2
    Did you enclose the redefinition in \makeatletter ... \makeatother? See tex.stackexchange.com/questions/8351/….
    – lockstep
    Jan 4, 2012 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, 2012 at 10:21
  • hi now it compiled without any errors but there is no visual increase in font size ?
    – KiloWatt
    Jan 4, 2012 at 10:25
  • 3
    That's because \sections are \Large by default in the standard document classes.
    – lockstep
    Jan 4, 2012 at 10:45

1 Answer 1

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

2
  • what it the default font size of the command \section?
    – Aurelius
    Jul 20, 2012 at 0:14
  • default for standard classes is \Large
    – someonr
    Aug 8, 2012 at 23:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .