在我的文档中,我需要所有脚注都位于每章的末尾,为此我编写了一个cfg
文件,所有代码如下所示:
**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 文件内容:
\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}
转换命令”
htlatex test "test,xhtml,fn-in" " -cunihft" "-cvalidate -p"
现在所有脚注都到了上一章的结尾,见下面的截图:
但我的要求是相关脚注出现在相关章节的末尾。请注意,我的需求在没有附录的情况下也能正常工作,只有附录出现问题。请提出建议...
现在,附录问题已通过在 .cfg 文件中使用以下标签解决:
%%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}
现在一切正常,但最后一章的脚注出现在标题“附录”之后,而且文本“附录 A”、“附录 B”也没有出现,请参考下面的截图:
如何满足我的需求?
答案1
首先,我会把打印脚注的代码放到宏中,以使配置更简洁。对于您的实际问题,您只在章节中打印脚注,但可以打印前几章脚注前的\begin{appendices}
插入Appendices
标题。因此,您需要在输入后立即调用脚注打印代码\appendix
。例如通过修补\appendix
命令:
\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}
结果如下:
请注意,\chapter
不会为 HTML 部分生成标签,而只会生成普通段落,因此不会突出显示。我不知道这是否是您的意图,但您的代码中是这样配置的,所以我猜这是正确的?