Grupos de Google ya no admite nuevas publicaciones ni suscripciones de Usenet. El contenido anterior sigue siendo visible.

Memoir, endnotes per chapter and hyperref

Visto 112 veces
Saltar al primer mensaje no leído

meho_r

no leída,
28 oct 2010, 9:06:1828/10/10
a
Hi,

I've found a nice solution for creating endnotes per chapter provided
by Peter Wilson here: http://bit.ly/bwShRz

1. However, I need endnotes to be hyperlinked too. Can anyone advise
how to do this?

2. Alternatively, I managed to get endnotes hyperlinked using
endnotes.sty and hyperendnote.sty by Ulrich Dirr (code below). But,
the problem is, if I reset counter per chapter, hyperlinks do not
point to the right entries, but, e.g., every endnote "1" in the
document points to the first endnote in the document, not the first
endnote in the corresponding chapter.

%%% hyperendnote.sty
\makeatletter
\newif\ifenotelinks
\newcounter{Hendnote}
% Redefining portions of endnotes-package:
\let\savedhref\href
\let\savedurl\url
\def\endnotemark{%
\@ifnextchar[\@xendnotemark{%
\stepcounter{endnote}%
\protected@xdef\@theenmark{\theendnote}%
\protected@xdef\@theenvalue{\number\c@endnote}%
\@endnotemark
}%
}%
\def\@xendnotemark[#1]{%
\begingroup\c@endnote#1\relax
\unrestored@protected@xdef\@theenmark{\theendnote}%
\unrestored@protected@xdef\@theenvalue{\number\c@endnote}%
\endgroup
\@endnotemark
}%
\def\endnotetext{%
\@ifnextchar[\@xendnotenext{%
\protected@xdef\@theenmark{\theendnote}%
\protected@xdef\@theenvalue{\number\c@endnote}%
\@endnotetext
}%
}%
\def\@xendnotenext[#1]{%
\begingroup
\c@endnote=#1\relax
\unrestored@protected@xdef\@theenmark{\theendnote}%
\unrestored@protected@xdef\@theenvalue{\number\c@endnote}%
\endgroup
\@endnotetext
}%
\def\endnote{%
\@ifnextchar[\@xendnote{%
\stepcounter{endnote}%
\protected@xdef\@theenmark{\theendnote}%
\protected@xdef\@theenvalue{\number\c@endnote}%
\@endnotemark\@endnotetext
}%
}%
\def\@xendnote[#1]{%
\begingroup
\c@endnote=#1\relax
\unrestored@protected@xdef\@theenmark{\theendnote}%
\unrestored@protected@xdef\@theenvalue{\number\c@endnote}%
\show\@theenvalue
\endgroup
\@endnotemark\@endnotetext
}%
\def\@endnotemark{%
\leavevmode
\ifhmode
\edef\@x@sf{\the\spacefactor}\nobreak
\fi
\ifenotelinks
\expandafter\@firstofone
\else
\expandafter\@gobble
\fi
{%
\Hy@raisedlink{%
\hyper@@anchor{Hendnotepage.\@theenvalue}{\empty}%
}%
}%
\hyper@linkstart{link}{Hendnote.\@theenvalue}%
\makeenmark
\hyper@linkend
\ifhmode
\spacefactor\@x@sf
\fi
\relax
}%
\long\def\@endnotetext#1{%
\if@enotesopen
\else
\@openenotes
\fi
\immediate\write\@enotes{%
\@doanenote{\@theenmark}{\@theenvalue}%
}%
\begingroup
\def\next{#1}%
\newlinechar='40
\immediate\write\@enotes{\meaning\next}%
\endgroup
\immediate\write\@enotes{%
\@endanenote
}%
}%
\def\theendnotes{%
\immediate\closeout\@enotes
\global\@enotesopenfalse
\begingroup
\makeatletter
\edef\@tempa{`\string>}%
\ifnum\catcode\@tempa=12
\let\@ResetGT\relax
\else
\edef\@ResetGT{\noexpand\catcode\@tempa=\the\catcode\@tempa}%
\@makeother\>%
\fi
\def\@doanenote##1##2##3>{%
\def\@theenmark{##1}%
\def\@theenvalue{##2}%
\par
\begingroup
\def\href{\expandafter\savedhref}%
\def\url{\expandafter\savedurl}%
\@ResetGT
\edef\@currentlabel{\csname p@endnote\endcsname\@theenmark}%
\enoteformat
}%
\def\@endanenote{%
\par\endgroup
}%
\enoteheading
\enotesize
\input{\jobname.ent}%
\endgroup
}%
\def\enoteformat{%
\rightskip\z@
\leftskip\z@
\parindent=1.8em
\leavevmode\llap{%
\setcounter{Hendnote}{\@theenvalue}%
\addtocounter{Hendnote}{-1}%
\refstepcounter{Hendnote}%
\ifenotelinks
\expandafter\@secondoftwo
\else
\expandafter\@firstoftwo
\fi
{\@firstofone}
{\hyperlink{Hendnotepage.\@theenvalue}}%
{\makeenmark}%
}%
}%
% stop redefining portions of endnotes-package:
\makeatother
% Toggle switch in order to turn on/off back-links in the
% endnote-section:
\enotelinkstrue
%\enotelinksfalse

Lars Madsen

no leída,
28 oct 2010, 9:15:4728/10/10
a
On 2010-10-28 15:06, meho_r wrote:
> Hi,
>
> I've found a nice solution for creating endnotes per chapter provided
> by Peter Wilson here: http://bit.ly/bwShRz
>
> 1. However, I need endnotes to be hyperlinked too. Can anyone advise
> how to do this?
>

could you please provide a minimal example of the use, then we have
something to work with, and do not have to spend a lot of time
constructing something which might not work with your document

it seems to me that some of the counter-links (hyperref has an extra
set) need to be more unique (like containing the endnote counter plus
the chapter counter)

Se ha eliminado el mensaje
Se ha eliminado el mensaje
Se ha eliminado el mensaje

meho_r

no leída,
28 oct 2010, 11:39:5228/10/10
a

Thanks for the reply. I agree that a more unique counter should be
used. I tried with adding chapter number to the endnote number, but
didn't work (\renewcommand{\theendnote}{\arabic{chapter}
{\arabic{endnote}}).

Here are MWE for both cases:

1. Peter Wilson's proposal, for which I need to find a way how to
"activate" hyperlinks: http://mehor.pastebin.com/kk0CcXcP

2. The case with endnotes and hyperendnote packages: http://mehor.pastebin.com/wFzFnUAW

And here's the content of hyperendnote.sty: http://mehor.pastebin.com/cYpjCLr7

P.S. Sorry for external links, but google groups seems to be very
unreliable for pasting code (it shortens lines and made code
uncompilable).

Lars Madsen

no leída,
28 oct 2010, 13:05:5728/10/10
a meho_r

>
> Thanks for the reply. I agree that a more unique counter should be
> used. I tried with adding chapter number to the endnote number, but
> didn't work (\renewcommand{\theendnote}{\arabic{chapter}
> {\arabic{endnote}}).
>
> Here are MWE for both cases:
>
> 1. Peter Wilson's proposal, for which I need to find a way how to
> "activate" hyperlinks: http://mehor.pastebin.com/kk0CcXcP
>
> 2. The case with endnotes and hyperendnote packages: http://mehor.pastebin.com/wFzFnUAW
>
> And here's the content of hyperendnote.sty: http://mehor.pastebin.com/cYpjCLr7
>
> P.S. Sorry for external links, but google groups seems to be very
> unreliable for pasting code (it shortens lines and made code
> uncompilable).

memoir does already provide endnotes, called page notes. So what exactly
is it you need to do here?

Se ha eliminado el mensaje

Rik

no leída,
28 oct 2010, 16:19:5728/10/10
a
On Oct 28, 3:24 pm, I wrote:

> On Oct 28, 1:05 pm, Lars Madsen <dal...@imf.au.dk> wrote:
>
>
>
> > memoir does already provide endnotes, called page notes. So what exactly
> > is it you need to do here?
>
> Perhaps because he got as far as § 15.4.3 in the Memoir manual and
> thought that they had been left as an exercise for the user.
>
> I did exactly that before I saw § 17.4.
>
> Could § 15.4.3 be updated to indicate that pagenotes as described in §
> 17.4 are a rather complete endnote/chapternote implementation, already
> provided in the class?

And now that I am reminded of it, two more issues with page notes. One
is a doc bug, the other another request for doc enhancement.
1. The documentation refers in places to \printnotes and \printnotes*
where what is meant is \printpagenotes and \printpagenotes*
2. The documentation suggests that one can change footnotes to
pagenotes (and vice versa) but could also note that the change does
nothing for \footnotemark and \footnotetext.

--
Rik

Lars Madsen

no leída,
28 oct 2010, 16:31:1228/10/10
a

I'll add that

Lars Madsen

no leída,
28 oct 2010, 16:39:0828/10/10
a

This seems to work, but I'm not sure if it is the right approatch
regarding hyperref

\documentclass{memoir}

\usepackage[hyperfootnotes]{hyperref}


\makepagenote

\makeatletter
\newcounter{memhpn}% making the links really unique

\renewcommand{\m@m@wrpnote}[2][]{%
\stepcounter{memhpn}%
\@ifmtarg{#1}{\refstepcounter{pagenote}%
\notenumintext{pn-\thememhpn}}{}%
\ifm@mpn@new@chap
\global\m@mpn@new@chapfalse
\addtonotes{\string\pagenotesubhead{\@chapapp}{\thechapter}{\pnchap}}%
\fi
\ifm@mpn@new@schap
\global\m@mpn@new@schapfalse
\addtonotes{\string\pagenotesubhead{\@chapapp}{}{\pnschap}}%
\fi
\m@m@pnwrite\@notefile{}
{\string\noteentry{\thepagenote}{#1}{#2}{\thepage}{pn-\thememhpn}}%
\endgroup
\@esphack}

\newcommand\theHpagenote{\arabic{pagenote}-\thememhpn}

\renewcommand{\noteentry}[5]{%
\prenoteinnotes
\noteidinnotes{#1}{#2}\pageinnotes{#4}%

{\hspace{0pt}\edef\@currentlabel{#1}\@currentHref{#5}\hyper@anchor{#5}\label{#5}}\noteinnotes{#3}%
\postnoteinnotes}

\renewcommand{\notenumintext}[1]{%
\textsuperscript{\ref{#1}}}
\makeatother

\begin{document}

\chapter{First chapter}

Some text.\pagenote{First endnote, first chapter}

Some text.\pagenote{Second endnote, first chapter}

\ref{hest}

\chapter{Second chapter}

Some text.\pagenote{First endnote, second chapter}

Some text.\pagenote{First endnote, second chapter}

Some text.\pagenote{First endnote, second chapter}

Some text.\pagenote{First endnote, second chapter}

Some text.\pagenote{First endnote, second chapter}

Some text.\pagenote{First endnote, second chapter}

Some text.\pagenote{First endnote, second chapter}

Some text.\pagenote{First endnote, second chapter}

Some text.\pagenote{First endnote, second chapter}

Some text.\pagenote{First endnote, second chapter}

Some text.\pagenote{First endnote, second chapter}

Some text.\pagenote{First endnote, second chapter}

Some text.\pagenote{First endnote, second chapter}

Some text.\pagenote{First endnote, second chapter}

Some text.\pagenote{First endnote, second chapter}

Some text.\pagenote{First endnote, second chapter}

Some text.\pagenote{First endnote, second chapter}

Some text.\pagenote{First endnote, second chapter}

test\label{hest}

\clearpage

%\printendnotes

\printpagenotes

\end{document}


Lars Madsen

no leída,
28 oct 2010, 17:24:0628/10/10
a

I've removed the example presented in � 15.4.3 and fixed the two
suggestions.

They will be available with the next memoir release.

/daleif

meho_r

no leída,
28 oct 2010, 18:05:1628/10/10
a

I get the error:

[3] [4] (./untitled-1.ent
! Undefined control sequence.
\hyper@anchor #1->\new@pdflink {#1}\anchor@spot
\pdf@endanchor
l.2 ...1}{}{First endnote, first chapter}{1}{pn-1}

?

Lars Madsen

no leída,
28 oct 2010, 18:13:0028/10/10
a

>
> I get the error:
>
> [3] [4] (./untitled-1.ent
> ! Undefined control sequence.
> \hyper@anchor #1->\new@pdflink {#1}\anchor@spot
> \pdf@endanchor
> l.2 ...1}{}{First endnote, first chapter}{1}{pn-1}
>
> ?

which versions are you using, here is my list (Tex Live 2010)

memoir.cls 2010/09/19 v3.6g configurable book, report, article
document cl
ass
ifpdf.sty 2010/01/28 v2.1 Provides the ifpdf switch (HO)
ifxetex.sty 2010/09/12 v0.6 Provides ifxetex conditional
ifluatex.sty 2010/03/01 v1.3 Provides the ifluatex switch (HO)
etex.sty 1998/03/26 v2.0 eTeX basic definition package (PEB)
mem10.clo 2008/01/30 v0.3 memoir class 10pt size option
mempatch.sty 2009/07/24 v6.0f Patches for memoir class v1.6180339
hyperref.sty 2010/10/19 v6.81s Hypertext links for LaTeX
ltxcmds.sty 2010/04/26 v1.7 LaTeX kernel commands for general use (HO)
infwarerr.sty 2010/04/08 v1.3 Providing info/warning/message (HO)
keyval.sty 1999/03/16 v1.13 key=value parser (DPC)
kvsetkeys.sty 2010/03/01 v1.9 Key value parser (HO)
etexcmds.sty 2010/01/28 v1.3 Prefix for e-TeX command names (HO)
pdfescape.sty 2010/03/01 v1.9 Provides hex, PDF name and string
conversions
(HO)
pdftexcmds.sty 2010/04/01 v0.9 Utility functions of pdfTeX for LuaTeX
(HO)
ifvtex.sty 2010/03/01 v1.5 Switches for detecting VTeX and its
modes (HO)
hycolor.sty 2009/12/12 v1.6 Color options of hyperref/bookmark (HO)
xcolor-patch.sty 2009/12/12 xcolor patch
letltxmacro.sty 2008/06/24 v1.3 Let assignment for LaTeX macros (HO)
kvoptions.sty 2010/02/22 v3.7 Keyval support for LaTeX options (HO)
pd1enc.def 2010/10/19 v6.81s Hyperref: PDFDocEncoding definition (HO)
intcalc.sty 2007/09/27 v1.1 Expandable integer calculations (HO)
hyperref.cfg 2002/06/06 v1.2 hyperref configuration of TeXLive
url.sty 2006/04/12 ver 3.3 Verb mode for urls, etc.
bitset.sty 2007/09/28 v1.0 Data type bit set (HO)
bigintcalc.sty 2007/11/11 v1.1 Expandable big integer calculations (HO)
atbegshi.sty 2010/03/25 v1.12 At begin shipout hook (HO)
memhfixc.sty 2010/08/17 v1.15 nameref/hyperref package fixes for
memoir clas
s
hpdftex.def 2010/10/19 v6.81s Hyperref driver for pdfTeX
atveryend.sty 2010/03/24 v1.5 Hooks at very end of document (HO)
rerunfilecheck.sty 2010/03/16 v1.6 Rerun checks for auxiliary files (HO)
uniquecounter.sty 2009/12/18 v1.1 Provides unlimited unique counter (HO)
nameref.sty 2010/04/30 v2.40 Cross-referencing by name of section
refcount.sty 2008/08/11 v3.1 Data extraction from references (HO)
gettitlestring.sty 2009/12/18 v1.3 Cleanup title references (HO)
ctt.out
ctt.out
ctt.ent


meho_r

no leída,
28 oct 2010, 18:21:4228/10/10
a

OK, I updated memoir and hyperref, no this error, but the output isn't
right: http://bit.ly/ajss2S

meho_r

no leída,
28 oct 2010, 18:23:3028/10/10
a

Here's the list of files, TL2010:

*File List*


memoir.cls 2010/09/19 v3.6g configurable book, report, article
document cl
ass
ifpdf.sty 2010/01/28 v2.1 Provides the ifpdf switch (HO)

ifxetex.sty 2009/01/23 v0.5 Provides ifxetex conditional

a.out
a.out
a.ent
***********

Lars Madsen

no leída,
28 oct 2010, 18:43:3728/10/10
a
could you please post your version of the sample file again

/daleif

Lars Madsen

no leída,
28 oct 2010, 18:46:5628/10/10
a
On 2010-10-29 00:43, Lars Madsen wrote:
> could you please post your version of the sample file again
>
> /daleif

oops, I get that as well, give me 5 min

Lars Madsen

no leída,
28 oct 2010, 18:48:3828/10/10
a

replace

\@currentHref

with

\edef\@currentHref

meho_r

no leída,
28 oct 2010, 18:50:4328/10/10
a
On Oct 29, 12:43 am, Lars Madsen <dal...@imf.au.dk> wrote:
> could you please post your version of the sample file again
>
> /daleif

If you mean example file which produced that PDF output, here it is:
http://mehor.pastebin.com/rWJ8DkME

meho_r

no leída,
28 oct 2010, 18:58:5928/10/10
a

Yeah, that works, thanks. One more thing: is there any chance to get
backlinks too? In the example 2: http://mehor.pastebin.com/wFzFnUAW
there are working backlinks, but they get messed if endnote counter is
reset.

Lars Madsen

no leída,
28 oct 2010, 19:01:4628/10/10
a

not now, too late, and other projects need attention

meho_r

no leída,
28 oct 2010, 19:12:1428/10/10
a

:-) OK, no problem. Thanks a lot for your help.

0 mensajes nuevos