0

After latest update of TeXLive2019 I get an error with my code, thet previously worked fine. I associate this error with the latest update, possible some conflict of hyperref and answers packages, or something else.

\openout4 = `MWE-Answers.tex'.

! Bad space factor (0). @savsf l.30 ...rotect\section*{\nameref*{\currfilebase}}} I allow only values in the range 1..32767 here.

\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

If you put

\makeatletter
\def\nobreak{\penalty\@M}
\makeatother

at the start of the file you will restore the behaviour, I've not traced enough to say yet where the correct fix should be.

  • 1
    A better fix is to have \chapter after \Opensolutionsfile and \Writetofile. – egreg Oct 7 '19 at 20:28
  • @egreg that is a better fix, but isn't "restoring the old behaviour" (although that might be the correct thing to do for he new behaviour... not sure yet:-) – David Carlisle Oct 7 '19 at 20:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.