TransWikia.com

Tex4ebook - reference within endnote / footnote reference

TeX - LaTeX Asked by Hartmut on March 15, 2021

I use references to other endnotes within an endnote.

Example:

usepackage{endnotes}
renewcommand{footnote}{endnote}

...

footnote{... siehe Fußnote textsuperscript{ref{org4b3dd1c}}

(tex is generated from org).

If I create the ebook, this gives an error in the epubcheck (in German: "Fragmentbezeichner ist nicht angegeben.") and the linking does not work (the link is not set correctly in the xhtml). I don’t really care about the actual linking (see Fußnote xy is enough), but it would be nice if I could keep the references in my tex/org file and if they appear with the right number. In fact, it is already like that – so ok for me – but I have to get rid of the error due to a submission process.

Kind regards
Hartmut

Sorry, I wasn’t precise enough – it is about a reference to footnote in a footnote. Your modified example:

documentclass{article}

usepackage{endnotes}
renewcommand{footnote}{endnote}

usepackage{lipsum}
begin{document}
title{Hello world}
author{Michal}
maketitle

section{Hello}
lipsum[1-2]

section{Second section}

Some textfootnote{a first footnote label{org4b3dd1c}}

Some textfootnote{second footnote with ref to first onetextsuperscript{ref{org4b3dd1c}}}
lipsum[3-4]

section{Third section}

lipsum[5-6]

theendnotes

end{document}

This leads to an error in the epubcheck.
KR

One Answer

Edit:

The sample TeX document in the updated question contains label inside endnote command. TeX4ht normally supports labels out of the box, but endnote uses low-level way of defining of the labels, so we need to put the destination link by hand. Try the following .cfg file:

Preamble{xhtml}
Configure{enoteformat}
   {Link{enmark-endnoteN}{ennote-endnoteN}} {EndLinkAnchorLabel}
begin{document}
EndPreamble

This is copy of configuration from TeX4ht sources, with the addition of the AnchorLabel command. It will insert the destination link for the current label.

This is the generated HTML code for your endnote with label:

<p class='indent'>   <a href='realsamplese2.html#enmark-1' id='ennote-1'>
<sup><span class='cmr-6'>1</span></sup></a>
<a id='x5-4001x1'></a><span class='cmr-8'>a first footnote</span>
</p>

<a id='x5-4001x1'></a> is the destination, as you can see from the endnote that references it:

<p class='indent'>   <a href='realsamplese2.html#enmark-2' id='ennote-2'><sup><span class='cmr-6'>2</span></sup></a><a id='x5-4002x2'></a><span class='cmr-8'>
second footnote with ref to first one</span>
<sup class='textsuperscript'><a href='#x5-4001x1'><span class='cmr-9'>1</span><!-- tex4ht:ref: org4b3dd1c  --></a></sup>
</p>   

Original answer:

You didn't provide full example, so it is hard to guess. The following example seems to produce a good result:

documentclass{article}

usepackage{endnotes}
renewcommand{footnote}{endnote}

usepackage{lipsum}
begin{document}
title{Hello world}
author{Michal}
maketitle

section{Hello}label{org4b3dd1c}
lipsum[1-2]

section{Second section}

Some textfootnote{siehe Fußnote textsuperscript{ref{org4b3dd1c}}}
lipsum[3-4]

section{Third section}

lipsum[5-6]

theendnotes

end{document}

Epubcheck doesn't find any error for the resulting Epub file and the link to the section works correctly.

The endnotes section looks like this:

enter image description here

Answered by michal.h21 on March 15, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP