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.

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

1 Answers1

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

someonr
  • 8,531