
Tengo una lista de varias condiciones con un parámetro y me gustaría incluir el parámetro explícitamente en la etiqueta de la condición. Sin embargo, también me gustaría hacer referencia a la definición de cada condición (con el parámetro fijo) más adelante en el texto. (Es un poco difícil de describir, pero si observa el código a continuación, con suerte debería quedar claro a qué me refiero).
¿Se puede lograr esto usando enumitem (o algún otro paquete, con suerte compatible)?
Mwe:
\documentclass{article}
\usepackage{amsthm}
\usepackage{hyperref}
\usepackage{enumitem}
\newtheorem*{theorem}{Theorem}
\begin{document}
Consider the following conditions:
\begin{enumerate}[label=(\roman{*})$_n$]
\item
\label{item:first_condition}
Some condition
\item
\label{item:second_condition}
Some other conditon.
\end{enumerate}
How I would imagine I could type it:
\begin{theorem}
\ref{item:first_condition}[7] holds.
\end{theorem}
\begin{theorem}
If \ref{item:second_condition}[n] holds, then \ref{item:first_condition}[n+2] holds.
\end{theorem}
How I would like it to look like:
\begin{theorem}
(i)$_7$ holds.
\end{theorem}
\begin{theorem}
If (ii)$_n$ holds, then (i)$_{n+2}$ holds.
\end{theorem}
\end{document}
Respuesta1
Puede configurar la etiqueta y la ref
salida por separado en enumitem, usando la tecla label
y la ref
tecla para\begin{enumerate}
. Esto puede usarse para mostrar lanorteen la etiqueta pero no en la referencia. Eso le permite hacer referencia a la ecuación por el número principal y agregar su propio subíndice.
Ahora puede definir un comando de referencia independiente con dos argumentos, la ecuación y el subíndice, utilizando el comando \hyperref[target label]{link text}
.
Para evitar un cuadro de enlace doble, puede desactivar el enlace para \ref
usar la forma de estrella ( \ref*
) y dejar \hyperref
crear el cuadro de enlace (o enlace de color con \usepackage[colorlinks]{hyperref}
) para la etiqueta combinada.
MWE:
\documentclass{article}
\usepackage{amsthm}
\usepackage{hyperref}
\usepackage{enumitem}
\newcommand{\nref}[2]{\hyperref[#1]{\ref*{#1}$_{#2}$}}
\newtheorem*{theorem}{Theorem}
\begin{document}
Consider the following conditions:
\begin{enumerate}[label=(\roman{*})$_n$,ref=(\roman*)]
\item
\label{item:first_condition}
Some condition
\item
\label{item:second_condition}
Some other conditon.
\end{enumerate}
How I would imagine I could type it:
\begin{theorem}
\nref{item:first_condition}{7} holds.
\end{theorem}
\begin{theorem}
If \nref{item:second_condition}{n} holds, then \nref{item:first_condition}{n+2} holds.
\end{theorem}
How I would like it to look like:
\begin{theorem}
(i)$_7$ holds.
\end{theorem}
\begin{theorem}
If (ii)$_n$ holds, then (i)$_{n+2}$ holds.
\end{theorem}
\end{document}
Resultado: