1

In my document, I need all footnotes should come at the end of each chapter, for this I write a cfg file and all the codes are given below:

**test.cfg:**

\Preamble{xhtml,fn-in}

\HAssign\ChapId=0%
\Configure{chapter}{}{}{\ifvmode\IgnorePar\fi\EndP%
\expandafter\ifvoid\csname fn:box\endcsname\else%
\HCode{<div class="footnotes">}\expandafter\box\csname%
fn:box\endcsname\HCode{</div>}\gHAdvance \ChapId by 1\HCode{<!--/EndOfChapter-->}%
\fi%
\HCode{<p class="CN">}\TitleMark\HCode{</p>\Hnewline<p class="CT">}%
}{\HCode{</p>}\IgnoreIndent}%

% PN and PT Changes in CFG %

\Configure{part}{}{}{\ifvmode\IgnorePar\fi\EndP%
\expandafter\ifvoid\csname fn:box\endcsname\else%
\HCode{<div class="footnotes">}\expandafter\box\csname%
fn:box\endcsname\HCode{</div>}%
\fi%
\HCode{<p class="PN">}\partname \ \thepart%
\HCode{</p>\Hnewline<p class="PT">}%
}{\HCode{</p>}\IgnoreIndent}%

% FMH Changes in CFG %

\Configure{likechapter}{}{}{\ifvmode\IgnorePar\fi\EndP%
\expandafter\ifvoid\csname fn:box\endcsname\else%
\HCode{<div class="footnotes">}\expandafter\box\csname%
fn:box\endcsname\HCode{</div>}%
\fi%
\HCode{<p class="FMH">}\TitleMark%
}{\HCode{</p>}\par}%

\begin{document}

\EndPreamble

TeX file content:

\documentclass{book}
\usepackage[toc,page]{appendix}
\begin{document}


\chapter{Chapter One}

Third chapter text goes here\footnote{Footnote text}

\appendix

\begin{appendices}
\chapter{Scalars, Vectors, and Tensors}

Coordinate $,;:.$ systems, or reference frames, are not part of nature.
They are maps introduced by us.  Whenever we project a problem
onto a set of coordinates, we must distinguish features intrinsic
to the physical system from artifacts that arise from the
coordinate system.  Whenever we shift from one coordinate map to
another, we must understand what stays the same and what changes
and how.\footnote{Footnote test}  The principles that tell us how to convert quantities
and relationships between coordinate systems are theories of
relativity.

\chapter{Third Chapter}

This is for test for footnote in Chapter\footnote{Footnote in Chapter}
\end{appendices}

\end{document}

Converting command"

htlatex test "test,xhtml,fn-in" " -cunihft" "-cvalidate -p"

Now all the footnote came end of the last chapter, see the screenshot below:

enter image description here

but my requirement is relevant footnotes to come at the end of the relevant chapters. Note that my requirement is working fine without Appendices, problem happened only Appendix comes. Please suggest...

Now, the Appendix problem solved by using the below tag in .cfg file:

%%Appendix%%
\Configure{appendix}{}{}
   {\ifvmode\IgnorePar\fi\EndP%
\expandafter\ifvoid\csname fn:box\endcsname\else%
\HCode{<div class="footnotes">}\expandafter\box\csname%
fn:box\endcsname\HCode{</div>}\fi%
\HCode{<h2 class="appendixHead"\a:LRdir>}%
    \if@mainmatter \TitleMark{\HCode{<br />}}\fi }
   {\HCode{</h2>}\IgnoreIndent}

Now its coming fine, but the last chapter footnote came after the head "Appendix", also the text "Appendix A", "Appendix B" didn't come, please refer the below screenshot:

enter image description here

How to fix my requirement?

1

First of all, I would put the code that prints the footnotes to macro, in order to make the configurations cleaner. To your actual issue, you print the footnotes only at chapters, but the \begin{appendices} inserts Appendices title before the footnotes for the previous chapters can be printed. So you need to call the footnote printing code as soon as you enter \appendix. For example by patching the \appendix command:

\Preamble{xhtml,fn-in}

\def\printfnbox{%
\expandafter\ifvoid\csname fn:box\endcsname\else%
\HCode{<div class="footnotes">}\expandafter\box\csname%
fn:box\endcsname\HCode{</div>}%
\fi%
}

\HAssign\ChapId=0%
\Configure{chapter}{}{}{\ifvmode\IgnorePar\fi\EndP%
\expandafter\ifvoid\csname fn:box\endcsname\else%
\printfnbox\gHAdvance \ChapId by 1\HCode{<!--/EndOfChapter-->}%
\fi%
\HCode{<p class="CN">}\TitleMark\HCode{</p>\Hnewline<p class="CT">}%
}{\HCode{</p>}\IgnoreIndent}%

% PN and PT Changes in CFG %

\Configure{part}{}{}{\ifvmode\IgnorePar\fi\EndP%
\printfnbox%
\HCode{<p class="PN">}\partname \ \thepart%
\HCode{</p>\Hnewline<p class="PT">}%
}{\HCode{</p>}\IgnoreIndent}%

% FMH Changes in CFG %

\Configure{likechapter}{}{}{\ifvmode\IgnorePar\fi\EndP%
\printfnbox%
\HCode{<p class="FMH">}\TitleMark%
}{\HCode{</p>}\par}%

\Configure{appendix}{}{}
   {\ifvmode\IgnorePar\fi\EndP%
\printfnbox%
\HCode{<h2 class="appendixHead"\csname a:LRdir\endcsname>}%
    \TitleMark{\HCode{<br />}}}
   {\HCode{</h2>}\IgnoreIndent}


\begin{document}

\EndPreamble
\let\oldappendix\appendix
\def\appendix{\ifvmode\IgnorePar\fi\EndP\printfnbox\oldappendix}

This is the result:

enter image description here

Note that \chapter doesn't produce tags for HTML section, but only ordinary paragraphs, so it is not highlighted. I don't know whether this is your intention, but it is configured this way in your code, so I guess that it is correct?

  • Sir, your valuable suggestion is working fine for my requirement, only thing is Appendix number, i.e., "Appendix A" and "Appendix B" was missing, how can I achieve this? – MadyYuvi Aug 17 '17 at 9:53
  • 1
    @MadyYuvi please see the updated answer – michal.h21 Aug 17 '17 at 13:12
  • Sir, you are really great, everything works fine......... – MadyYuvi Aug 18 '17 at 5:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.