Pacote de exercícios e hiperlink exercício/solução: ocultar as soluções vazias?

Pacote de exercícios e hiperlink exercício/solução: ocultar as soluções vazias?

Estou usando o pacote de exercícios para gerenciar exercícios junto com respostas. No MWE seguinte, um hiperlink apontando para a resposta associada é criado no início de cada um deles. Se não houver solução, seria possível excluir o hiperlink anterior? (veja abaixo o exercício 2 para um exemplo).

\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}

insira a descrição da imagem aqui

Responder1

Seu ambiente exoinclui um hiperlink. Se você não se importa em usar um novo ambiente, basta definir um novo ambiente sem o hiperlink

\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}

insira a descrição da imagem aqui

informação relacionada