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 am using TeXmaker and I am trying to format the section's title. I tried something I had found on the internet but it was clashing with another package. How can I set all section's heading to be written in small caps ?

This is the preamble of my document

\documentclass[11pt,a4paper,twoside,twocolumn]{article}
\usepackage{ucs}
\usepackage[utf8x]{inputenc}
\usepackage[francais]{babel}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{units}
\usepackage{multicol}
\usepackage{textcomp}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage[authoryear]{natbib}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage{lmodern}
\usepackage{tabularx}
\usepackage{caption} 
\captionsetup[table]{skip=10pt}
\setlength{\bibsep}{0pt}
\setlength{\columnsep}{30pt}

\renewcommand{\section}{\smallcaps}

\addto\captionsfrench{\renewcommand{\tablename}{\textsc{Tableau}}}

\bibliographystyle{test}
share|improve this question
add comment

3 Answers

up vote 4 down vote accepted

I recommend using the KOMA replacement to article as it's far more flexible and it makes it much easier to change that kind of thing.

Edit: I've removed lmodern and made the section heading centered and bold.

\documentclass{scrartcl}

%\usepackage{lmodern}
\usepackage[T1]{fontenc}

%\addtokomafont{section}{\mdseries\rmfamily\scshape}
\addtokomafont{section}{\rmfamily\centering\scshape}

\begin{document}

\section{Sample Section}

\end{document}
share|improve this answer
    
There are a lot of vertical spacing that was not there before. How can I center it and make it bold ? –  esmitex Nov 16 '12 at 16:44
1  
@esmitex You can't have bold small-caps with lmodern (which was why I used \mdseries in my example). Use a different font package and remove \mdseries (and add \centering to center it). –  Nicola Talbot Nov 16 '12 at 16:54
    
By the way I get a weird extra space when I use the class {scrartcl} (see the picture): i50.tinypic.com/qz3b54.jpg ; that I don't have with the class {article}: i50.tinypic.com/2d9biq1.jpg –  esmitex Nov 16 '12 at 17:16
    
@esmitex Can you provide a minimal example? (It would be better posted as a separate question.) I can't reproduce that effect. –  Nicola Talbot Nov 16 '12 at 17:27
add comment

Here's an alternative solution:

\documentclass{article}

\usepackage{titlesec}
\titleformat{\section}[hang]{\normalfont\scshape}{\thesection.}{1em}{}

\begin{document}

\section{behold small caps}

\end{document}
share|improve this answer
    
I really don't know why but my document doesn't work with use package{titlesec} –  esmitex Nov 16 '12 at 16:57
    
Several packages are sensitive to the order in which they're loaded relative to other packages. Try putting \usepackage{titlesec} last and then let it percolate upwards until you stop getting compilation complications. –  Daniel Harbour Nov 16 '12 at 16:59
    
Well, it is the last one already. I will put it at the beginning. It seems to be clashing with what I use to make the document with 2 columns. –  esmitex Nov 16 '12 at 17:01
add comment

The titlesec package allows you to do this with the standard article class with the line:

\usepackage[sc]{titlesec}

in your preamble.

share|improve this answer
    
When I use \usepackage[sc]{titlesec} I get the error message : "! LaTeX Error: Something's wrong--perhaps a missing \item." –  esmitex Nov 16 '12 at 16:40
2  
@esmitex Did you remove the wrong line \renewcommand{\section}{\smallcaps}? –  egreg Nov 16 '12 at 17:06
add comment

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.