修改节、小节和子小节样式

修改节、小节和子小节样式

我想知道是否有人知道我如何修改具有乳胶文档的一般样式以便该section部分subsection遵循subsubsection我在下图中显示的规范。

在此处输入图片描述

目前,我对sectionsubsection部分所做的事情是这样的:

\section{\underline{THIS IS THE SECTION TITLE}}
\subsection{\textit{This is the subsection title}}

据我所知,对于使用 Times New Roman 的部分subsubsection,不可能使用小写字母,因此大写字母就可以了。

- - - 模板。

\documentclass[a4paper,12pt]{exam}

% PAQUETES PRINCIPALES
% ----------------------------------------------------------------------------------------
% ----------------------------------------------------------------------------------------
\usepackage[bitstream-charter]{mathdesign}  % Paquete de fuentes matemáticas.
\usepackage[spanish, es-tabla]{babel}       % Paquete de caracteres y títulos en español
\usepackage[utf8]{inputenc}                 % Permite escribir con acentos.
\usepackage{newtxtext,newtxmath}            % Permite cambiar el tipo de letra a Times New Roman
\usepackage{lipsum}                         % Permite añadir texto LIPSUM. 

\usepackage{ragged2e}           % Paquete de alineación del texto.
\usepackage{amsmath}            % Paquete para insertar símbolos matemáticos
\usepackage{hyperref}           % Paquete para insertar referencias en el texto
\hypersetup{                    % Establecer las propiedades para las referencias.  
     colorlinks     = true,
     linkcolor      = matlab_blue,
     urlcolor       = matlab_blue,
     citecolor      = matlab_blue
}
\usepackage{textcomp,gensymb}   % Paquetes que permiten agregar símbolos al texto. 
\usepackage{float}              % Paquete para tratar figuras y tablas como flotantes
\usepackage{lipsum}             % Paquete para insertar texto mudo
\usepackage[none]{hyphenat}     % Eliminar la división de palabras en el texto.
\setlength{\parindent}{0pt}
% Permite definir el símbolo de diámetro
\usepackage{wasysym}
\usepackage{enumitem}

% PAQUETES PARA LA DEFINICIÓN DE COLORES.
% ----------------------------------------------------------------------------------------
% ----------------------------------------------------------------------------------------
\usepackage[dvipsnames,table,xcdraw]{xcolor}
\definecolor{airforceblue}{rgb}{0.36, 0.54, 0.66}
\definecolor{matlab_blue}{rgb}{0, 0.447 0.741}

% MODIFICAR LA ZONA EN LA QUE SE INCUYE EL RESUMEN
% ----------------------------------------------------------------------------------------
% ----------------------------------------------------------------------------------------
\renewenvironment{abstract}     % Modifica la alineación del resumen.
 {\par\noindent\textbf{\abstractname}\ \ignorespaces \\}
 {\par\noindent\medskip}

% PAQUETES PARA TRABAJAR CON FIGURAS.
% ----------------------------------------------------------------------------------------
% ----------------------------------------------------------------------------------------
\usepackage{graphicx}           % Paquete para insertar imágenes en latex.
\graphicspath{ {images/} }      % Ruta para buscar las imágenes.
\usepackage{caption}            % Modificaciones en el título de las figuras.
\usepackage{subcaption}         % Modificaciones independientes en los títulos.

% - Permite cambiar la numeración de las figuras para incluir el número de la sección
% - y también cambia el estilo del texto
\setcounter{figure}{0}
\renewcommand{\thefigure}{\arabic{section}.\arabic{figure}}
\captionsetup[figure]{labelfont={it},textfont=it,labelsep=period,font=small}

% - Permite cambiar la numeración de las tablas para incluir el número de la sección
% - y también cambia el estilo del texto
\renewcommand{\thetable}{\arabic{section}.\arabic{table}}
\captionsetup[table]{labelfont={it},textfont=it,labelsep=period,font=small}

% - Código que permite eliminar la línea en blanco de forma previa a 
% - incluir una enumeración
\setlist[itemize]{noitemsep, topsep=-12pt, after=\vspace{\baselineskip}}

\usepackage{array}
\newenvironment{conditions}
  {\par\vspace{\abovedisplayskip}\noindent\begin{tabular}{>{$}l<{$} @{${}={}$} l}}
  {\end{tabular}\par\vspace{\belowdisplayskip}}

% ESTABLECER LOS MÁRGENES DEL DOCUMENTO
% ----------------------------------------------------------------------------------------
% ----------------------------------------------------------------------------------------
\usepackage[a4paper,top=20mm,left=25mm,right=20mm,bottom=20mm,headheight=20mm]{geometry}

% CAMBIAR EL INTERLINEADO DEL DOCUMENTO
% ----------------------------------------------------------------------------------------
% ----------------------------------------------------------------------------------------
\usepackage{setspace}
\spacing{1}

% CREAR PÁGINAS EN BLANCO HASTA LLEGAR A PÁGINA PAR
% ----------------------------------------------------------------------------------------
% ----------------------------------------------------------------------------------------
\usepackage{changepage,ifthen}
\newcommand\skiptoevenpage{%
   \checkoddpage
   \ifthenelse{\boolean{oddpage}}%
      {\null\clearpage}%
      {\null\clearpage \null \clearpage}%
}

% CREAR PÁGINAS EN BLANCO HASTA LLEGAR A PÁGINA IMPAR
% ----------------------------------------------------------------------------------------
% ----------------------------------------------------------------------------------------
\newcommand\skiptooddpage{%
   \checkoddpage
   \ifthenelse{\boolean{oddpage}}%
      {\null\clearpage \null \clearpage}%
      {\null\clearpage}%
}

% CREAR EL ENCABEZADO DEL DOCUMENTO
% ----------------------------------------------------------------------------------------
% ----------------------------------------------------------------------------------------
\header{}{}{HEADER}
\headrule

% ----------------------------------------------------------------------------------------
% ----------------------------------------------------------------------------------------
% ----------------------------------------------------------------------------------------
% ----------------------------------------------------------------------------------------
\begin{document} \sloppy    

\section{\underline{THIS IS THE SECTION TITLE}} %% THIS IS WRONG!!
\lipsum[2-4]

\textit{\subsection{\underline{This is the subsection title}}}  %% THIS IS WRONG!!
\lipsum[1]

\textit{\subsubsection{\underline{This is the subsubsection title}}}    %% THIS IS WRONG!!
\lipsum[1]

\end{document}

答案1

以下定义了您的章节格式。我稍微整理了一下您的序言(删除了与章节格式无关的所有内容)。

请注意,一旦加载,\usepackage[bitstream-charter]{mathdesign}斜体小写字母将不再起作用。你真的需要那个包吗?你还可以加载newtxmath以更改你的数学字体。

\documentclass[a4paper,12pt]{exam}

% PAQUETES PRINCIPALES
% ----------------------------------------------------------------------------------------
% ----------------------------------------------------------------------------------------
\usepackage[spanish, es-tabla]{babel}       % Paquete de caracteres y títulos en español
\usepackage{newtxtext,newtxmath}            % Permite cambiar el tipo de letra a Times New Roman
\usepackage{ragged2e}

\setlength{\parindent}{0pt}% BAD PRACTICE!

% ESTABLECER LOS MÁRGENES DEL DOCUMENTO
% ----------------------------------------------------------------------------------------
% ----------------------------------------------------------------------------------------
\usepackage[a4paper,top=20mm,left=25mm,right=20mm,bottom=20mm,headheight=20mm]{geometry}

% stuff necessary for the headings
\usepackage[explicit]{titlesec}
\usepackage[normalem]{ulem}
\usepackage{xfp}
\newlength\TitleUnderlineSeg
\setlength\TitleUnderlineSeg{.05pt}
\newcommand*\TitleUnderlineThickness{.15ex}% not a length to get re-evaluated
\newcommand\TitleUnderline[1]
  {%
    \bgroup
    \markoverwith
      {%
        \rule
          [-.7ex]
          {\TitleUnderlineSeg}
          {\TitleUnderlineThickness}%
      }%
    \ULon{#1}%
  }
\makeatletter
\ExplSyntaxOn
\cs_new_eq:NN \TextUppercase \text_uppercase:n
\ExplSyntaxOff
\newcommand\setuptitleformat[1]
  {%
    \expandafter\setuptitleformat@\csname #1\endcsname{#1}%
  }
\newcommand*\setuptitleformat@[7]
  {%
    \begingroup
    \edef\tmp
      {%
        \endgroup
        \unexpanded{\titleformat{#1}}%
          {%
            \noexpand\fontsize{#3pt}{\fpeval{1.6*#3}pt}%
            \unexpanded{\raggedright\bfseries#7}%
          }%
      }%
    \tmp
      {\leavevmode\kern#4\csname the#2\endcsname.#5}
      {0pt}
      {\begingroup\edef\tmp{\endgroup\noexpand\TitleUnderline{#6}}\tmp}%
    \begingroup
    \edef\tmp
      {%
        \endgroup
        \unexpanded{\titleformat{name=#1,numberless}}%
          {%
            \noexpand\fontsize{#3pt}{\fpeval{1.6*#3}pt}%
            \unexpanded{\raggedright\bfseries#7}%
          }%
      }%
    \tmp
      {}
      {0pt}
      {\begingroup\edef\tmp{\endgroup\noexpand\TitleUnderline{#6}}\tmp}%
  }
%                 level        size   indent separation           formatting
\setuptitleformat{section}      {18}{-.63cm}{ \space}{\TextUppercase{#1}}{}
\setuptitleformat{subsection}   {14}   {0pt}{ }      {\unexpanded{#1}}   {\itshape}
\setuptitleformat{subsubsection}{12}   {0pt}{}       {\unexpanded{#1}}   {\itshape\scshape}
% undefine the helper macros
\let\setuptitleformat \@undefined
\let\setuptitleformat@\@undefined
\makeatother

\usepackage{lipsum} % dummy text

\begin{document}

\section{This is the section title}

\subsection{This is the subsection title}

\subsubsection{This is the subsubsection title}

\lipsum[1]

\section{Really long section title that is really long, so long it needs more
than one line to be fully printed}
\subsection{Really long subsection title that is really long, so long it needs
more than one line to be fully printed}
\subsubsection{Really long subsubsection title that is really long, so long it
needs more than one line to be fully printed}

\section*{Really long section title that is really long, so long it needs more
than one line to be fully printed}
\subsection*{Really long subsection title that is really long, so long it needs
more than one line to be fully printed}
\subsubsection*{Really long subsubsection title that is really long, so long it
needs more than one line to be fully printed}

\end{document}

在此处输入图片描述

相关内容