Título de subsección en negrita y cursiva con tamaño de fuente personalizado

Título de subsección en negrita y cursiva con tamaño de fuente personalizado

He definido el tamaño de fuente, e incluso con la ayuda de su pregunta respondida resolví la situación de esta manera:

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

Ahora tengo que agregar solo a la subsección un estilo en cursiva. ¿Cómo puedo hacerlo? ¡Muchas gracias por su atención y su valiosa ayuda!

Respuesta1

\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 ejemplo:

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

Formato de sección

Tenga en cuenta que la cursiva se sustituye por una fuente oblicua, ya que no hay ninguna forma de cursiva disponible para esta familia.

Respuesta2

Debe evitar \fontfamilylas instrucciones explícitas en la medida de lo posible. Es mejor declarar una fuente sans serif y luego usar \sffamily; para tipo inclinado, agregue \slshape. Si utiliza Helvética para los títulos, deberá utilizarla siempre que se solicite una fuente sans serif en el 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}

Tenga en cuenta que el código, tal como lo formateó, no se compila. Prefiero este diseño para el \titleformatcomando, que muestra claramente los distintos argumentos.

ingrese la descripción de la imagen aquí

información relacionada