Paquete de ejercicios e hipervínculo ejercicio/solución: ¿ocultar las soluciones vacías?

Paquete de ejercicios e hipervínculo ejercicio/solución: ¿ocultar las soluciones vacías?

Estoy usando el paquete de ejercicios para gestionar ejercicios junto con respuestas. En los siguientes MWE, al principio de cada uno de ellos se crea un hipervínculo que apunta a la respuesta asociada. Si no hay solución, ¿sería posible eliminar el hipervínculo anterior? (consulte el siguiente ejercicio 2 para ver un ejemplo).

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{hyperref}
\hypersetup{breaklinks = true,
            unicode    = true,
            colorlinks = true,
            urlcolor   = red,
            linkcolor  = red}
\usepackage[lastexercise]{exercise}
%
\renewcommand{\ExerciseName}{Exercice}
\renewcommand{\ExerciseHeader}{%
    \noindent
    \textbf{
       \ExerciseName\quad\ExerciseHeaderNB\textit{\ExerciseHeaderTitle}\quad}%
    }
%Environnement exercice
\newenvironment{exo}[1][\unskip]{%
\begin{Exercise}[title={#1},label={\the\value{Exercise}}]
\hfill \texttt{\refAnswer{\ExerciseLabel}}


}{\end{Exercise}}

\newenvironment{sol}
{\begin{Answer}[ref=\ExerciseLabel]
}
{\end{Answer}
}
%%%%%%%%%%%%
\begin{document}

\begin{exo}
A
\end{exo}

\begin{sol}
ABCDE
\end{sol}

\begin{exo}
A
\end{exo}

\shipoutAnswer
\end{document}

ingrese la descripción de la imagen aquí

Respuesta1

Su entorno exoincluye un hipervínculo. Si no le importa usar un nuevo entorno, simplemente defina un nuevo entorno sin el hipervínculo.

\newenvironment{nhexo}[1][\unskip]{%
    \begin{Exercise}[title={#1},label={\the\value{Exercise}}]


    }{\end{Exercise}}

MWE editado:

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{hyperref}
\hypersetup{breaklinks = true,
            unicode    = true,
            colorlinks = true,
            urlcolor   = red,
            linkcolor  = red}
\usepackage[lastexercise]{exercise}
%
\renewcommand{\ExerciseName}{Exercice}
\renewcommand{\ExerciseHeader}{%
    \noindent
    \textbf{
       \ExerciseName\quad\ExerciseHeaderNB\textit{\ExerciseHeaderTitle}\quad}%
    }
%Environment exercise
\newenvironment{exo}[1][\unskip]{%
\begin{Exercise}[title={#1},label={\the\value{Exercise}}]
\hfill \texttt{\refAnswer{\ExerciseLabel}}


}{\end{Exercise}}

\newenvironment{nhexo}[1][\unskip]{%
    \begin{Exercise}[title={#1},label={\the\value{Exercise}}]


    }{\end{Exercise}}

\newenvironment{sol}
{\begin{Answer}[ref=\ExerciseLabel]
}
{\end{Answer}
}
%%%%%%%%%%%%
\begin{document}

\begin{exo}
A
\end{exo}

\begin{sol}
ABCDE
\end{sol}

\begin{nhexo}
A
\end{nhexo}

\shipoutAnswer
\end{document}

ingrese la descripción de la imagen aquí

información relacionada