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 have defined fontsize, and even with your answered question help I solved the situation in this way:

\usepackage{titlesec}

\titleformat{\chapter}

       {\normalfont\fontfamily{phv}\fontsize{16}{19}\bfseries}{\thechapter}{1em}{}

\titleformat{\section}

       {\normalfont\fontfamily{phv}\fontsize{12}{17}\bfseries}{\thesection}{1em}{}

\titleformat{\subsection}

       {\normalfont\fontfamily{phv}\fontsize{12}{17}\bfseries}{\thesubsection}{1em}{}

Now i have to add only to the subsection an italic style .How can I do?? Thank you so much for your attention and your precious help!

share|improve this question
    
Please always post a complete Minimal (non-)Working Example demonstrating the issue. That at least means adding \documentclass..., \begin{document}... \end{document} etc. That said, just add \itshape after \bfseries to the format for \subsection. –  cfr Mar 16 at 19:25
2  
Welcome to TeX.SE! –  Mico Mar 16 at 19:32
add comment

2 Answers 2

You should avoid explicit \fontfamily instructions as long as possible. You're better declaring a sans serif font and then use \sffamily; for slanted type, add \slshape. If you use Helvetica for titles, you should use it in every case a sans serif font is requested in the document.

\documentclass{book}
\usepackage{helvet}
\usepackage{titlesec}

\titleformat{\chapter}
  {\normalfont\fontsize{16}{19}\sffamily\bfseries}
  {\thechapter}
  {1em}
  {}

\titleformat{\section}
  {\normalfont\fontsize{12}{17}\sffamily\bfseries}
  {\thesection}
  {1em}
  {}

\titleformat{\subsection}
  {\normalfont\fontsize{12}{17}\sffamily\bfseries\slshape}
  {\thesubsection}
  {1em}
  {}

\begin{document}
\chapter{Something}
\section{Title}
\subsection{Again}
\end{document}

Note that the code, as you formatted it, doesn't compile. I prefer this layout for the \titleformat command, that clearly shows the various arguments.

enter image description here

share|improve this answer
    
Could you please explain why one should avoid explicit \fontfamily instructions as long as possible. –  Gonzalo Medina Mar 17 at 0:00
    
@GonzaloMedina This ensures better independence of the document's code from things that might change. Instead of Helvetica one might prefer TeX Gyre Heros and this could be obtained by just modifying \usepackage{helvet} into \usepackage{tgheros}. Also a scaled option can be given (to both packages). –  egreg Mar 17 at 0:06
add comment
\usepackage{titlesec}

\titleformat{\chapter}    
       {\normalfont\fontfamily{phv}\fontsize{16}{19}\bfseries}{\thechapter}{1em}{}

\titleformat{\section}    
       {\normalfont\fontfamily{phv}\fontsize{12}{17}\bfseries}{\thesection}{1em}{}

\titleformat{\subsection}    
       {\normalfont\fontfamily{phv}\fontsize{12}{17}\bfseries\itshape}{\thesubsection}{1em}{}

For example:

\documentclass{book}
\usepackage{titlesec}

\titleformat{\chapter}
       {\normalfont\fontfamily{phv}\fontsize{16}{19}\bfseries}{\thechapter}{1em}{}

\titleformat{\section}
       {\normalfont\fontfamily{phv}\fontsize{12}{17}\bfseries}{\thesection}{1em}{}

\titleformat{\subsection}
       {\normalfont\fontfamily{phv}\fontsize{12}{17}\bfseries\itshape}{\thesubsection}{1em}{}


\begin{document}

\chapter{Chapter}
\section{Section}
\subsection{Subsection}

\end{document}

Section formatting

Note that an oblique font is substituted for italic as no italic shape is available for this family.

share|improve this answer
    
@egreg Ah, true. Of course, it obviously wouldn't compile anyway. –  cfr Mar 16 at 22:01
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.