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'm rather new to LaTeX, I am trying to get my article class document set up so that the section font is 16 pt and bold, the subsection is 14 pt and bold and the subsubsection is 14 pt and not bold. I managed to get all the right fonts and font sizes, I just cant get the subsubsection to be "unbolded".

I heard about the titlesec package, but I am unsure of how to use this to unbold my subsubsection title.

Here is some of my code: (I dont know how to make a minimal example, sorry)

\documentclass[a4paper, 12pt, final]{article}
\usepackage{fancyhdr}
\usepackage{titlesec}
\allsectionsfont{\fontfamily{phv}\selectfont}
\sectionfont{\fontfamily{phv}\fontsize{16pt}{16pt}\selectfont}
\subsectionfont{\fontfamily{phv}\fontsize{14pt}{14pt}\selectfont}
\subsubsectionfont{\fontfamily{phv}\fontsize{14pt}{14pt}\selectfont}
share|improve this question
1  
Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. It is considered a lot better to put in some code that will compile, as it makes it a lot easier for us to copy it into our text editor and work with it, and see exactly what it is you are trying to do. Please follow the link above to learn how to build a MWE ... –  Kurt Nov 24 '12 at 23:02
1  
Did you try with \mdseries instead of \selectfont in the setting for \subsubsectionfont? And loading sectsty instead of titlesec, of course. –  egreg Nov 24 '12 at 23:06

1 Answer 1

up vote 7 down vote accepted

You seem to be using the commands from the sectsty package but loading titlesec. You can use either one of those packages, but using their own commands; the examples below show possible solutions using each package:

Here's one way to achieve it using the extended \titleformat syntax from titlesec package:

\documentclass{article}
\usepackage{titlesec}

\titleformat{\section}
  {\normalfont\fontfamily{phv}\fontsize{16}{19}\bfseries}{\thesection}{1em}{}
\titleformat{\subsection}
  {\normalfont\fontfamily{phv}\fontsize{14}{17}\bfseries}{\thesubsection}{1em}{}
\titleformat{\subsubsection}
  {\normalfont\fontfamily{phv}\fontsize{14}{17}\selectfont}{\thesubsubsection}{1em}{}

\begin{document}

\section{Test Section}
\subsection{Test Subsection}
\subsubsection{Test Subsubsection}

\end{document}

enter image description here

And here's an example using the simplified \titleformat* command:

\documentclass{article}
\usepackage{titlesec}

\titleformat*{\section}{\normalfont\fontfamily{phv}\fontsize{16}{19}\bfseries}
\titleformat*{\subsection}{\normalfont\fontfamily{phv}\fontsize{14}{17}\bfseries}
\titleformat*{\subsubsection}{\normalfont\fontfamily{phv}\fontsize{14}{17}\selectfont}

\begin{document}

\section{Test Section}
\subsection{Test Subsection}
\subsubsection{Test Subsubsection}

 \end{document} 

And here's an example using sectsty:

\documentclass{article}
\usepackage{sectsty}

\sectionfont{\normalfont\fontfamily{phv}\fontsize{16}{19}\bfseries}
\subsectionfont{\normalfont\fontfamily{phv}\fontsize{14}{17}\bfseries}
\subsubsectionfont{\normalfont\fontfamily{phv}\fontsize{14}{17}\selectfont}

\begin{document}

\section{Test Section}
\subsection{Test Subsection}
\subsubsection{Test Subsubsection}

\end{document} 

Just for completeness's sake, here's one solution without additional packages, redefining the original commands:

\documentclass{article}

\makeatletter
\renewcommand\section{\@startsection {section}{1}{\z@}%
                                   {-3.5ex \@plus -1ex \@minus -.2ex}%
                                   {2.3ex \@plus.2ex}%
                                   {\normalfont\fontfamily{phv}\fontsize{16}{19}\bfseries}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\normalfont\fontfamily{phv}\fontsize{14}{17}\bfseries}}
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\normalfont\normalsize\fontfamily{phv}\fontsize{14}{17}\selectfont}}
\makeatother

\begin{document}

\section{Test Section}
\subsection{Test Subsection}
\subsubsection{Test Subsubsection}

 \end{document} 

As egreg mentions in his comment, the presence of \bfseries allows not to specify \selectfont.

share|improve this answer
    
You can get away with \selectfont if \bfseries is used. –  egreg Nov 24 '12 at 23:14
    
@egreg of course; I edited my answer. Thanks. –  Gonzalo Medina Nov 24 '12 at 23:19
    
@All, for some reason when I use the \usepackage{titlesec} it gives out an error saying that package is not found, can someone tell me how to install it.. :) –  uDaY Jul 21 '13 at 22:59
    
@uDaY the process may vary depending on your LaTeX installation. Use the search function of the site ans search for manually installing packages. –  Gonzalo Medina Jul 21 '13 at 23:05

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.