![上次更新后发生错误](https://linux22.com/image/402819/%E4%B8%8A%E6%AC%A1%E6%9B%B4%E6%96%B0%E5%90%8E%E5%8F%91%E7%94%9F%E9%94%99%E8%AF%AF.png)
在 TeXLive2019 最新更新后,我的代码出现错误,之前运行正常。我将此错误与最新更新、可能与软件包发生冲突或其他原因联系hyperref
起来answers
。
\openout4 = `MWE-Answers.tex'.
!错误的空间因子(0)。@savsf l.30 ...rotect\section*{\nameref*{\currfilebase}}} 我这里只允许范围 1..32767 内的值。
\documentclass[]{book}
\usepackage{ntheorem}
\usepackage{answers}
\usepackage{hyperref}
\usepackage{currfile}
\makeatletter
\newtheoremstyle{problemstyle}%
{\hypertarget{problem:##2}{}\item[\theorem@headerfont{\hyperlink{solution:##2}{##2.}}] }
{\hypertarget{problem:##2}{}\item[\theorem@headerfont{\hyperlink{solution:##2}{##2.}}] (##3)}
\makeatother
\theoremstyle{problemstyle}
\newtheorem{problem}{}
%\renewcommand{\theproblem}{\thechapter.\arabic{problem}}
\Newassociation{solution}{Solution}{answer}
\renewenvironment{Solution}[1]{%
\par%
\hypertarget{solution:#1}{\noindent\hyperlink{problem:#1}{\bfseries #1.}}
}{%
\par%
}
\begin{document}
%=========================================================
\chapter{Some Title}\label{\currfilebase}
\Opensolutionfile{answer}[\currfilebase-Answers]
\Writetofile{answer}{\protect\section*{\nameref*{\currfilebase}}}
%=========================================================
\Opensolutionfile{answer}[Answers]
\begin{problem}
Problem with solution
\begin{solution}
Solution
\end{solution}
\end{problem}
\begin{problem}
Problem with NO solution
\end{problem}
\Closesolutionfile{answer}
\newpage
\input{\jobname-Answers}
\end{document}
答案1
如果你把
\makeatletter
\def\nobreak{\penalty\@M}
\makeatother
在文件的开始处,您将恢复行为,我还没有追踪到足够的信息来表明正确的修复应该在哪里。