Título da subseção em negrito e itálico com tamanho de fonte personalizado

Título da subseção em negrito e itálico com tamanho de fonte personalizado

Eu defini o tamanho da fonte e mesmo com a ajuda da sua pergunta respondida resolvi a situação desta forma:

\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}{}

Agora tenho que adicionar apenas à subseção um estilo itálico. Como posso fazer? Muito obrigado pela atenção e pela preciosa ajuda!

Responder1

\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}{}

Por exemplo:

\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}

Formatação de seção

Observe que uma fonte oblíqua é substituída por itálico, pois nenhuma forma de itálico está disponível para esta família.

Responder2

Você deve evitar \fontfamilyinstruções explícitas pelo maior tempo possível. É melhor declarar uma fonte sem serifa e depois usar \sffamily; para tipo inclinado, adicione \slshape. Se você usar Helvetica para títulos, deverá usá-la sempre que uma fonte sem serifa for solicitada no documento.

\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}

Observe que o código, conforme você o formatou, não é compilado. Prefiro este layout para o \titleformatcomando, que mostra claramente os vários argumentos.

insira a descrição da imagem aqui

informação relacionada