From 184236701f0e64b54535b060e9551b21be8d4792 Mon Sep 17 00:00:00 2001 From: Michal Hoftich Date: Tue, 3 Dec 2024 14:16:46 +0100 Subject: [PATCH] fixed epub 3 footnotes --- CHANGELOG.md | 5 +++++ tex4ebook-epub3.4ht | 51 +++++++++++++++++++++++---------------------- 2 files changed, 31 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 539faa3..933b446 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changes +- 2024/12/03 + + - fixed Epub 3 footnotes. + https://tex.stackexchange.com/a/732071/2891 + - 2024/06/16 - fixed support for `--build-dir` that contains dashes. Thanks to Danie-1. diff --git a/tex4ebook-epub3.4ht b/tex4ebook-epub3.4ht index a470e05..a6c58b5 100644 --- a/tex4ebook-epub3.4ht +++ b/tex4ebook-epub3.4ht @@ -29,12 +29,12 @@ \opf:registerfilename{\FileName} \ifnum\:toccount<2 \opf:add:property{nav}\fi }{\usetoclevels{part,appendix,chapter,section,subsection,subsubsection}% - \ifbool{tocnoempty}{}{\HCode{
  • Document
  • }} - \HCode{}} + \ifbool{tocnoempty}{}{\HCode{
  • Document
  • }} + \HCode{}} %%%%%%%%%%% \Configure{NavSection}{% - \booltrue{tocnoempty} - \HCode{
  • }}{\HCode{
      \Hnewline}}{\ }{\Tg
    \Tg
  • } + \booltrue{tocnoempty} + \HCode{
  • }}{\HCode{
      \Hnewline}}{\ }{\Tg
    \Tg
  • } % Disable numbering of the TOC by the reading system, numbers are added by tex4ht \Css{nav.toc ol{list-style: none;}} %%%% End toc nav configuration @@ -68,7 +68,7 @@ \Configure{@HEAD}{} \Configure{@HEAD}{\HCode{\Hnewline}} \Configure{@HEAD}{\HCode{\Hnewline}} + (http://www.cse.ohio-state.edu/\string~gurari/TeX4ht/)" />\Hnewline}} \Configure{@HEAD}{\HCode{\Hnewline}} @@ -85,37 +85,38 @@ % footnotebox - configure box in which footnotes are printed % default configuration doesn't work in ibooks, don't know why \NewConfigure{footnotebox}{2} -\Configure{footnotebox}{\HCode{
    \Hnewline}} -{\HCode{\Hnewline
    \Hnewline}} -\newbox\footnotebox +\Configure{footnotebox}{\ifvmode\IgnorePar\fi\HCode{
    \Hnewline}}% +{\ifvmode\IgnorePar\fi\HCode{\Hnewline
    \Hnewline}}% +\newbox\footnotebox% % We must create new link command, so footnote mark can link to footnote text \LinkCommand\fnlink{aside,href,id,class="footnote" epub:type="footnote"} -\Configure{footnotemark}{\NoFonts\Link[ epub:type="noteref"]{fn\FNnum x\minipageNum}{}}{\EndLink\EndNoFonts} -\Configure{footnotetext}{\global\setbox\footnotebox=\vtop\bgroup\NoFonts% - \ifvoid\footnotebox\else\unvbox\footnotebox\fi% - \IgnorePar% - \bgroup% - \fnlink{}{fn\FNnum x\minipageNum}\Tg

    \AnchorLabel% +\Configure{footnotemark}{\NoFonts\Link[ epub:type="noteref"]{fn\FNnum x\minipageNum}{}}{\EndLink\EndNoFonts}% +\Configure{footnotetext}{\SaveEndP\global\setbox\footnotebox=\vtop\bgroup\NoFonts% + \ifvoid\footnotebox\else\unvbox\footnotebox\fi% + \bgroup% + \IgnorePar% + \fnlink{}{fn\FNnum x\minipageNum}\par\AnchorLabel% }{\EndNoFonts} {% - \HCode{

    \Hnewline} - \Endfnlink\egroup\egroup}% + \ifvmode\IgnorePar\fi\EndP\HCode{\Hnewline}% + \Endfnlink\egroup\egroup\RecallEndP}% \def\printfn{% - \ifvoid\footnotebox\else% - \a:footnotebox% - \box\footnotebox% - \b:footnotebox% - \fi% + \ifvoid\footnotebox\else% + \a:footnotebox% + \box\footnotebox% + \b:footnotebox% + \fi% } % configure HtmlPar to print footnotebox. \Configure{HtmlPar} -{\EndP\HCode{

    }} -{\EndP\HCode{

    }} -{\HCode{

    \Hnewline}\printfn} -{\HCode{

    \Hnewline}\printfn} +{\EndP\printfn\HCode{

    }} +{\EndP\printfn\HCode{

    }} +{\HCode{

    \Hnewline}} +{\HCode{

    \Hnewline}} \Css{.footnote{font-size:small;}} \Css{.footnotes hr{width:30\%;margin:0 auto 0 0;}} +\Css{p + section.footnotes{margin-bottom: 1rem;}} \fi