
Tengo un problema de optimización con mi propia etiqueta (P). Sin embargo, \ref{e}
se refiere al problema de optimización y no a la ecuación. Sin \tag(P) todo funciona. ¿Alguna forma de abordar esto?
\documentclass[11pt,a4paper]{scrreprt}
\usepackage{amsmath}
\usepackage{optidef}
\usepackage{hyperref}
\begin{document}
\begin{mini}|s|
{}{c^\top x}
{\tag{P}\label{P}}
{}
\addConstraint{Ax}{=b}
\addConstraint{x}{\geq 0}.
\end{mini}
\begin{align}
1+e^{i \pi} = 0 \label{e}
\end{align}
Reference to \ref{P}
Reference to \ref{e}
\end{document}
Respuesta1
Puedes arreglarlo \theHequation
dentro de un mini
entorno.
\documentclass[11pt,a4paper]{scrreprt}
\usepackage{amsmath}
\usepackage{optidef}
\usepackage{hyperref}
\newcommand{\ui}{\mathrm{i}}% if you really want upright
\AddToHook{env/mini/begin}{%
\edef\theHequation{mini\unexpanded\expandafter{\theequation}}%
}
\begin{document}
\begin{mini}|s|
{}{c^\top x}
{\tag{P}\label{P}}
{}
\addConstraint{Ax}{=b}
\addConstraint{x}{\geq 0}.
\end{mini}
\begin{align}
1+\exp(\ui \pi) = 0 \label{e}
\end{align}
Reference to \ref{P}
Reference to \ref{e}
\end{document}
Los enlaces apuntarán a los lugares correctos.
Aparte: \i
no funciona en modo matemático (y de todos modos produce una i sin puntos). Si está redefiniendo \i
en su documento real, no lo haga.