How to define a custom \footref

by King Chung Lo   Last Updated January 14, 2018 07:23 AM

Here is a minimal example of my work:

\documentclass[12pt,oneside,openany,openbib]{book} 
\usepackage[total={5in, 8in}]{geometry} 
\usepackage{xeCJK}
\usepackage[ruled]{bigfoot}
\usepackage{tabularx}
\newcounter{footalt}
\def\thefootalt{\fnsymbol{footalt}}
\usepackage[hang]{footmisc}  
\renewcommand {\thefootnote}{\alph{footnote}}
\MakeSortedPerPage{footnote}
\DeclareNewFootnote{A}[arabic]
\DeclareNewFootnote[para]{B}[alph]
\DeclareNewFootnote[para]{C}[roman]
\DeclareNewFootnote[para]{D}[Alph]
\DeclareNewFootnote[para]{E}[Roman]
\DeclareNewFootnote[para]{F}[fnsymbol]
\MakeSortedPerPage{footnoteB}
\MakeSortedPerPage{footnoteC}
\MakeSortedPerPage{footnoteD}
\MakeSortedPerPage{footnoteE}
\MakeSortedPerPage{footnoteF}

\setlength{\footnotemargin}{5mm}
\usepackage{endnotes,chngcntr}
\let\footnote=\endnote

\makeatletter         %<-- these lines add the page numbering
\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

\renewcommand{\notesname}{Footnotes of Chapter \thechapter} %<-- this is for the title of the footnotes at the end of the chapter
\counterwithin*{endnote}{chapter} %<-- this restarts the numbering of the footnotes for each chapter, requires the package "chngcntr"
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

    \mainmatter
    \part{part 1}
    \chapter{chapter 1}

    Testing \footref{001}FFFF\footnote{\label{001}footnote 1 ootnote 1\footnoteB{footnote 2\footnoteC{footnote 3\footnoteD{footnote 4 footnote 4 footnote 4 footnote 4 } footnote 3 footnote 3 footnote 3 } footnote 2 footnote 2 } footnote 1 ootnote 1 ootnote 1 } Testing Testing Testing Testing Testing Testing Testing Testing 
\newpage
\begingroup
\parindent 0pt
\parskip 2ex
\def\enotesize{\normalsize}
\theendnotes %<---- this prints all the footnotes together
\endgroup


\end{document}

In this work, the critical footnote \footref{001}FFFF\footnote{\label{001}... turns in the result with a page number like this: enter image description here I don't want this "[pg 2]" appearing in the foot-reference (but remains in footnote). How can I make this? By the way, you are also appreciated if you can help me to make more space between the footnote mark and footnote on the first level of footnote. (I can make the others with command \setlength{\footnotemargin}{5mm}.



Related Questions