Re: Memoir's pagenotes fail with Lyx



On 2010-12-07 20:28, stefano wrote:
On Dec 7, 9:56 am, Lars Madsen<dal...@xxxxxxxxxxxxxxxxxxxxxx> wrote:
stefano wrote:
On Dec 5, 10:22 am, Lars Madsen<dal...@xxxxxxxxx> wrote:
On 2010-12-03 20:47, stefano wrote:

On Dec 3, 11:25 am, stefano<stefano.fran...@xxxxxxxxx> wrote:
On Dec 3, 11:08 am, Lars Madsen<dal...@xxxxxxxxxxxxxxxxxxxxxx> wrote:
Lars Madsen wrote:
stefano wrote:
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
hmm, that is interesting, I'll see what I can do
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}{%
\newwrite\@notefile
\immediate\openout\@notefile=\jobname.ent
\mempagenotestrue
\def\pagenote{\@bsphack\begingroup
% \@sanitize
\m@m@wrpnote}%
\typeout{Writing note file \jobname.ent}%
\let\makepagenote\@empty}
\makeatother
\makepagenote
--
/daleif (remove RTFSIGNATURE from email address)
LaTeX FAQ: http://www.tex.ac.uk/faq
LaTeX book: http://www.imf.au.dk/system/latex/bog/(in Danish)
Remember to post minimal examples, see URL belowhttp://www.tex.ac.uk/cgi-bin/texfaq2html?label=minxamplhttp://www.min...
Thanks Lars.
Problem solved for now, I guess.
Stefano
I spoke too early. With the \@sanitize line commented out, \pagenote
fails when there is an index command in the note's body. With the
\@sanitize line uncommented, the \index command works fine (but it
fails in Lyx, of course). A \protect command in front of the \index
command seems to work (although it may break something else. I am
never sure with LaTeX).
I confess I have no idea why it fails and why it works with protect.
Stefano
Example:
\documentclass[a4paper,10pt]{memoir}
\usepackage[english]{babel}
\makeatletter
\renewcommand*{\makepagenote}{%
\newwrite\@notefile
\immediate\openout\@notefile=\jobname.ent
\mempagenotestrue
\def\pagenote{\@bsphack\begingroup
% \@sanitize
\m@m@wrpnote}%
\typeout{Writing note file \jobname.ent}%
\let\makepagenote\@empty}
\makeatother
\makeindex
\makepagenote
\begin{document}
1. This note fails unless a protect command is placed in forn of the
index command \pagenote{This is a pagenote\index{instruments, logical}
%
}
\printpagenotes
\printindex
\end{document}
Error:
No file pagenote-test.aux.
! Use of \\m@m@wrpnote doesn't match its definition.
\@ifnextchar ... \reserved@d =#1\def \reserved@a {
#2}\def \reserved@b
{#3}\f...
l.20 }
better solution: sanitize, but not %

\renewcommand*{\makepagenote}{%
\newwrite\@notefile
\immediate\openout\@notefile=\jobname.ent
\mempagenotestrue
\def\pagenote{\@bsphack\begingroup
\rem@special{\%}%<--- added
\@sanitize
\m@m@wrpnote}%

/daleif

Thanks Dale,

that works. I think I have stumbled upon a possibly related
problem, though.
While pagenote works fine if an unprotected \index command is in the
text of the note,
the combinaiton of \foottopagenote and \footnote does not work in the
same situation.

interesting


Something even more interesting
multiparagraph footnotes now fail.
:-(

\documentclass[a4paper,10pt]{memoir}
\usepackage[english]{babel}
\usepackage{lipsum}
%Fix to Lyx export problem, suggested by Lars Madsen on c.t.t. on
12/6/2010
\makeatletter
\renewcommand*{\makepagenote}{%
\newwrite\@notefile
\immediate\openout\@notefile=\jobname.ent
\mempagenotestrue
\def\pagenote{\@bsphack\begingroup
\rem@special{\%}%<--- added
\@sanitize
\m@m@wrpnote}%
\typeout{Writing note file \jobname.ent}%
\let\makepagenote\@empty}

\foottopagenote
\makeindex
\makepagenote
\begin{document}
1. This note works fine\pagenote{\index{word}\lipsum[1]%
}

2. This one fails unless I protect the index command\footnote{\protect
\index{word}\lipsum[2]%

\lipsum[3]}
\printpagenotes
\end{document}

output:

{\protect \index {word}\lipsum [2]
! Paragraph ended before \\footnote was complete.
<to be read again>
\par
l.25



that one is because \foottopagenote mistakenly does not redefine \footnote as \long, I'll fix that

still wondering about the \index stuff


.



Relevant Pages

  • Re: Memoirs pagenotes fail with Lyx
    ... Memoir uses the \pagenote command to produce endnotes. ... pagenote fails when the text of the pagenote has a comment sign (i.e. ... Which is exactly how Lyx produces ...
    (comp.text.tex)
  • Re: Memoirs pagenotes fail with Lyx
    ... Memoir uses the \pagenote command to produce endnotes. ... pagenote fails when the text of the pagenote has a comment sign (i.e. ... Which is exactly how Lyx produces ...
    (comp.text.tex)
  • Re: Memoirs pagenotes fail with Lyx
    ... Memoir uses the \pagenote command to produce endnotes. ... pagenote fails when the text of the pagenote has a comment sign (i.e. ... Which is exactly how Lyx produces ...
    (comp.text.tex)
  • Re: Memoirs pagenotes fail with Lyx
    ... pagenote fails when the text of the pagenote has a comment sign (i.e.. ... Which is exactly how Lyx produces ... fails when there is an index command in the note's body. ...
    (comp.text.tex)
  • Re: Memoirs pagenotes fail with Lyx
    ... pagenote fails when the text of the pagenote has a comment sign (i.e. ... Which is exactly how Lyx produces ... fails when there is an index command in the note's body. ...
    (comp.text.tex)