Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
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

1 Answer 1

up vote 9 down vote accepted

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

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.