Diferentes etiquetas para títulos de subsecciones y referencias.

Diferentes etiquetas para títulos de subsecciones y referencias.

Estoy construyendo mi tesis y estoy usando una variante de la clase de informe. Tengo capítulos, secciones, subsecciones y subsecciones en algunos lugares. Al leer el texto, tener una larga cadena de números, letras y números romanos en el título de las subsecciones y subsecciones resulta desagradable. Preferiría que estos títulos solo tuvieran el título de subsección o subsubsección relevante, y hacerlo usando:

\renewcommand\thesubsection{\Roman{subsection}}

(Dependiendo de cómo terminen viéndose las cosas, puedo incluir el contador de secciones, pero definitivamente eliminaré el contador de capítulos). Sin embargo, cuando hago referencia a la subsección o subsubsección, prefiero toda la cadena de números. para ser utilizado, de lo contrario la referencia está mal definida. ¿Alguien puede comentar sobre cómo hacer esto?

He aquí un ejemplo mínimo.

\documentclass{report}

\begin{document}

\renewcommand\thesection{\arabic{chapter}.\arabic{section}}
\renewcommand\thesubsection{\Roman{subsection}}

\chapter{Chapter}

\section{Section}

\subsection{Subsection}\label{subsection}

\noindent I have the subsections labelled in Roman in the title, because 1.1.I would just be long.
\\

\noindent Here is a reference to the subsection: (\ref{subsection})
\\

\noindent I would like references to the subsection to be (1.1.I), however.

\end{document}

Respuesta1

Redefinir \p@subsection(el prefijo que se utiliza para las referencias a subsecciones):

\documentclass{report}

\renewcommand\thesection{\arabic{chapter}.\arabic{section}}
\renewcommand\thesubsection{\Roman{subsection}}
\makeatletter
\renewcommand\p@subsection{\thesection.}
\makeatother

\begin{document}

\chapter{Chapter}

\section{Section}

\subsection{Subsection}\label{subsection}

\noindent I have the subsections labelled in Roman in the title, because 1.1.I would just be long.

\noindent Here is a reference to the subsection: (\ref{subsection})

\end{document}

ingrese la descripción de la imagen aquí

Por cierto, nunca uses la combinación \\ + blank line; esto generará advertencias de casillas insuficientemente llenas.

Respuesta2

Las referencias pueden tener automáticamente el prefijo \p@<counter>, ver ejemplo:

\documentclass{report}
\usepackage{parskip}

\renewcommand\thesection{\arabic{chapter}.\arabic{section}}
\renewcommand\thesubsection{\Roman{subsection}}

\makeatletter
\renewcommand*{\p@subsection}{\thesection.}
\makeatother

\begin{document}
\chapter{Chapter}

Here is a reference to the subsection: \ref{subsection}

\section{Section}

\subsection{Subsection}\label{subsection}

\end{document}

Resultado:

Resultado

información relacionada