LaTeX forum ⇒ GeneralChanging section heading font size

LaTeX specific issues not fitting into one of the other forums of this category.
BobQQ
Posts: 1
Joined: Sun Nov 30, 2008 12:16 am

Changing section heading font size

Postby BobQQ » Sun Nov 30, 2008 12:29 am

Hi,

I would like to change the size of font used for section headings (make them smaller to save space). Is there an easy way to do this? I tried \section{\large{Section Title}}, but this doesn't change the size of the section number. \large{\section{Section Title}} completely messes up the formatting. I'm using the standard standard article document class. I suspect I could do something via defining a new command, but this is rather beyond my level of experience. Any help would be much appreciated.

User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Postby Juanjo » Sun Nov 30, 2008 1:50 am

You have several ways to do so:
1.- A direct redefinition of \section:
  1. \makeatletter
  2. \renewcommand\section{\@startsection{section}{1}{\z@}%
  3. {-3.5ex \@plus -1ex \@minus -.2ex}%
  4. {2.3ex \@plus.2ex}%
  5. {\normalfont\large\bfseries}}
  6. \makeatother

2.- By means of the titlesec package:
  1. \usepackage{titlesec}
  2. \titleformat{\section}{\large\bfseries}{\thesection}{1em}{}

3.- By means of the sectsty package:
  1. \usepackage{sectsty}
  2. \sectionfont{\large}

If you want to change more sectioning commands or give them a more sophisticated appearance, it is worthy to load titlesec, or even sectsty. If you only want to reduce the size of section titles, any approach is valid.

By the way, never use formatting commands in the argument of \section and friends. For changing their aspect, redefine those commands as suggested above. Likewise, \large and similar commands does not have an argument. Hence the pair of braces after them are superfluous, that is, \large{text} gives the same result as \large text (with no braces). Braces, however, are frequently used to limit the scope of such a command. If you have a line of code like
  1. text before {\large text inside} text after
\large only affects to "text inside".
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.

User avatar
localghost
Site Moderator
Posts: 9206
Joined: Fri Feb 02, 2007 12:06 pm

Postby localghost » Sun Nov 30, 2008 2:17 pm

From all the possible solutions listed by Juanjo the version by the titlesec package is the preferable one, because the package offers the simplest interface for such modifications.


Thorsten
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

fayez
Posts: 13
Joined: Mon Dec 21, 2009 12:00 am

Postby fayez » Fri Jan 20, 2012 7:40 am

How would you change the numerical section size as well? and maybe add a dot or a dash to the normal latex output

i.e.

\section{introduction}

output

1. introduction

nkal
Posts: 17
Joined: Fri Jul 10, 2009 8:57 pm

Postby nkal » Wed Jul 11, 2012 8:24 pm

Thank you, Juanjo. I was looking for a solution to the same problem and your option 1 worked great.

Cheers,
Nkal


Return to “General”

Who is online

Users browsing this forum: Baidu [Spider] and 6 guests