I am cross-posting a message I sent to computer.text.tex, since the problem
affects LyX..
Lars Madsen's (memoir's maintainer) temporary fix is reported at the end.
I think I have stumbled upon an incompatibility between memoir and
Lyx. Memoir uses the \pagenote command to produce endnotes. However,
pagenote fails when the text of the pagenote has a comment sign (i.e.
'%') before the closing brace. Which is exactly how Lyx produces
footnotes:
Minimal example:
\documentclass[a4paper,10pt]{memoir}
\usepackage[english]{babel}
\makepagenote
\begin{document}
1. This works\pagenote{This is a pagenote}
2 This fails\pagenote{This is a pagenote%
}
\printpagenotes
\end{document}
The second format is how Lyx exports to latex.
Any idea on how to solve the problem is welcome.
Cheers,
Stefano
--------------Lars Madsen's reply-----------------------
very interesting it is caused by \...@sanitize which is used when we write
the pagenote to file, so we end up with
\noteentry{2}{}{This is a pagenote% }{1}
which of course crashes everything when LaTeX attempts to run the .ent
file.
Short term fix
\makeatletter
\renewcommand*{\makepagenote}{%
\newwri...@notefile
\immediate\openo...@notefile=\jobname.ent
\mempagenotestrue
\def\pagenot...@bsphack\begingroup
% \...@sanitize
\...@m@wrpnote}%
\typeout{Writing note file \jobname.ent}%
\let\makepageno...@empty}
\makeatother
\makepagenote