我正在使用练习包来管理练习和答案。在下面的 MWE 中,每个练习的开头都会创建一个指向相关答案的超链接。如果没有解决方案,是否可以删除前一个超链接?(请参阅下面的练习 2 中的示例)。
\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}
答案1
您的环境exo
包含超链接。如果您不介意使用新环境,只需定义一个不带超链接的新环境即可
\newenvironment{nhexo}[1][\unskip]{%
\begin{Exercise}[title={#1},label={\the\value{Exercise}}]
}{\end{Exercise}}
编辑的MWE:
\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}