GeneralPage Numbers in endnotes

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
paulanormannz
Posts: 2
Joined: Thu Apr 08, 2010 3:34 pm

Page Numbers in endnotes

Post by paulanormannz »

Dear Latex Community,

I am trying to get back refence page numbers into endnotes, so that the original page of the entry appears in the end note.

So far I have tried looking at redefining the relvent part of endnote.sty in my preample, but that is in TeX and quite new to me. So working in TeXWorks I have tried someting along these lines instead (this inserts the footnote/endnote number in the main text and then puts a url with notes in the end note sucessfully - its the back ref to the page that i can not get right - any help appreciated please):

Code: Select all

\RequirePackage{endnotes}
\let\footnote=\endnote
%: urlNote
\newcounter{thisPageRef}%
\setcounter{thisPageRef}{0}%
%
\newcommand{\urlNote}[2]{% #1 - url, then #2 - Notes
\refstepcounter{thisPageRef}\label{TN-\thethisPageRef}}
\href{#1}{#2}\footnote{P. \pageref{TN-\thethisPageRef}} \ #2 - \url{#1}}%
}% tn is an arbitary prefix I've tried \arabic{} and \value{}
%
%: -- reset endnotes  // old information now redundant endnote.sty has been revised
%\makendnote takes two arguments (the superscripted endnote number and the text of the endnote)
%
%the default format is 
%
%\long\def\makendnote#1#2{%
%\edef\@currentlabel{\csname p@footnote\endcsname#1}%
%\indent$^{#1}$#2} 
Paul

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

paulanormannz
Posts: 2
Joined: Thu Apr 08, 2010 3:34 pm

Page Numbers in endnotes

Post by paulanormannz »

Ok then reluctantly I looked at hacking code from the endnotes.sty TeX code.

And this seems to work and so far gives me the right page numbers:
(encourages me to look at learnig TeX!) Put this in your preamble after you have called
\usepackage{endnotes}
or in your own .sty after
\RequirePackage{endnotes}

\makeatletter
%from endnotes.sty ADDED: \ [pg \thepage] as below
\long\def\@endnotetext#1{%
\if@enotesopen \else \@openenotes \fi
\immediate\write\@enotes{\@doanenote{\@theenmark \ [pg \thepage]}}
\begingroup
\def\next{#1}
\newlinechar='40
\immediate\write\@enotes{\meaning\next}%
\endgroup
\immediate\write\@enotes{\@endanenote}}
\makeatother
%
Post Reply