我正在尝试使用 tex4ebook 生成 .epub。我定义的命令之一使用 \ifelsethen 和 \isempty 来检查空参数,并根据存在的参数产生不同的输出:
- 如果第一个参数为空,则应该打印“empty1”。
- 如果第一个参数不为空,但第二个参数为空,则应该打印“parameter#1 empty2”。
- 如果两个参数都存在,则应该打印两个参数。
我还需要能够向任一参数添加脚注,并且我使用 biblatex 来处理引用。但是,如果我使用 biblatex,此命令将无法正常工作,如下面的 mwe 所示。如果您能提供任何有关如何使 xifthen 函数与 biblatex 配合使用的提示,或者有关与 biblatex 兼容的 \ifthenelse 和 \isempty 替代方案的建议,我将不胜感激。
麦格
\documentclass{book}
%\usepackage{biblatex}
\usepackage{xifthen}
\newcommand{\printif}[2]{\ifthenelse{\isempty{#1}}{empty1}{#1\ifthenelse{\isempty{#2}}{ empty2}{ #2}}}
\begin{document}
\printif{apple\footnotemark[1]}{orange}
\printif{pear}{peach}
\footnotetext[1]{This is a footnote.}
\end{document}
如果我不导入 biblatex,mwe 中的两个示例都会按预期工作。
如果我导入 biblatex 并注释掉第一个示例,文档会编译,但输出不正确:第一个参数和如果第一个参数为空则应该打印的文本都存在于 .epub 中。
mwe.log 的一部分(使用 biblatex,仅第二个示例)
Package biblatex Info: Trying to load citation style 'numeric'...
Package biblatex Info: ... file 'numeric.cbx' found.
(/usr/share/texmf-dist/tex/latex/biblatex/cbx/numeric.cbx
File: numeric.cbx 2020/08/23 v3.15a biblatex citation style (PK/MW)
Package biblatex Info: Redefining '\cite'.
Package biblatex Info: Redefining '\parencite'.
Package biblatex Info: Redefining '\footcite'.
Package biblatex Info: Redefining '\footcitetext'.
Package biblatex Info: Redefining '\smartcite'.
Package biblatex Info: Redefining '\supercite'.
Package biblatex Info: Redefining '\textcite'.
Package biblatex Info: Redefining '\textcites'.
Package biblatex Info: Redefining '\cites'.
Package biblatex Info: Redefining '\parencites'.
Package biblatex Info: Redefining '\smartcites'.
)
Package biblatex Info: Trying to load configuration file...
Package biblatex Info: ... file 'biblatex.cfg' found.
(/usr/share/texmf-dist/tex/latex/biblatex/biblatex.cfg
File: biblatex.cfg
)) (/usr/share/texmf-dist/tex/latex/xifthen/xifthen.sty
Package: xifthen 2015/11/05 v1.4.0 Extended ifthen features
(/usr/share/texmf-dist/tex/latex/tools/calc.sty
Package: calc 2017/05/25 v4.3 Infix arithmetic (KKT,FJ)
\calc@Acount=\count382
\calc@Bcount=\count383
\calc@Adimen=\dimen141
\calc@Bdimen=\dimen142
\calc@Askip=\skip71
\calc@Bskip=\skip72
LaTeX Info: Redefining \setlength on input line 80.
LaTeX Info: Redefining \addtolength on input line 81.
\calc@Ccount=\count384
\calc@Cskip=\skip73
) (/usr/share/texmf-dist/tex/latex/ifmtarg/ifmtarg.sty
Package: ifmtarg 2018/04/16 v1.2b check for an empty argument
)) (./mwe.cfg (/usr/share/texmf-dist/tex/generic/tex4ht/tex4ht.4ht
version 2020-03-12-14:03
--------------------------------------
::::::::::::::::::::::::::::::::::::::::::
TeX4ht info is available in the log file
::::::::::::::::::::::::::::::::::::::::::
--------------------------------------
(/usr/share/texmf-dist/tex/generic/tex4ht/html4-uni.4ht)) (/usr/share/texmf-d
ist/tex/generic/tex4ht/biblatex.4ht
version 2020-10-05-15:22
\sv:sec:cnt=\count388
\c@bib=\count389
LaTeX Info: Redefining \MakeUppercase on input line 206.
LaTeX Info: Redefining \MakeLowercase on input line 214.
\blx@unitmark=\skip75
--------------------------------------
Package biblatex Warning: Patching footnotes failed.
(biblatex) Footnote detection will not work.
\@quotelevel=\count390
\@quotereset=\count391
(./mwe.aux)
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 3.
LaTeX Font Info: ... okay on input line 3.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 3.
LaTeX Font Info: ... okay on input line 3.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 3.
LaTeX Font Info: ... okay on input line 3.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 3.
LaTeX Font Info: ... okay on input line 3.
LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 3.
LaTeX Font Info: ... okay on input line 3.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 3.
LaTeX Font Info: ... okay on input line 3.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 3.
LaTeX Font Info: ... okay on input line 3.
Package biblatex Info: Trying to load language 'english'...
Package biblatex Info: ... file 'english.lbx' found.
(/usr/share/texmf-dist/tex/latex/biblatex/lbx/english.lbx
File: english.lbx 2020/08/23 v3.15a biblatex localization (PK/MW)
)
Package biblatex Info: Input encoding 'utf8' detected.
Package biblatex Info: Automatic encoding selection.
(biblatex) Assuming data encoding 'utf8'.
Package biblatex Info: Trying to load bibliographic data...
Package biblatex Info: ... file 'mwe.bbl' not found.
No file mwe.bbl.
Package biblatex Info: Reference section=0 on input line 3.
Package biblatex Info: Reference segment=0 on input line 3.
--- file mwe.css ---
)
! Undefined control sequence.
<inserted text> \isempty
{pear}
l.13 \printif{pear}{peach}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Missing number, treated as zero.
<to be read again>
{
l.13 \printif{pear}{peach}
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Missing = inserted for \ifnum.
<to be read again>
{
l.13 \printif{pear}{peach}
I was expecting to see `<', `=', or `>'. Didn't.
! Missing number, treated as zero.
<to be read again>
{
l.13 \printif{pear}{peach}
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
(./mwe.4ct) [1
] (./mwe.aux)
LaTeX Warning: There were undefined references.
Package biblatex Warning: Please (re)run Biber on the file:
(biblatex) mwe
(biblatex) and rerun LaTeX afterwards.
Package logreq Info: Writing requests to 'mwe.run.xml'.
)
Output written on mwe.dvi (1 page, 15248 bytes).
如果我导入 biblatex 并且不注释掉第一个示例,则文档无法编译。
mwe.log 的一部分(使用 biblatex,仅第一个 \printif 示例)
Package biblatex Info: Trying to load citation style 'numeric'...
Package biblatex Info: ... file 'numeric.cbx' found.
(/usr/share/texmf-dist/tex/latex/biblatex/cbx/numeric.cbx
File: numeric.cbx 2020/08/23 v3.15a biblatex citation style (PK/MW)
Package biblatex Info: Redefining '\cite'.
Package biblatex Info: Redefining '\parencite'.
Package biblatex Info: Redefining '\footcite'.
Package biblatex Info: Redefining '\footcitetext'.
Package biblatex Info: Redefining '\smartcite'.
Package biblatex Info: Redefining '\supercite'.
Package biblatex Info: Redefining '\textcite'.
Package biblatex Info: Redefining '\textcites'.
Package biblatex Info: Redefining '\cites'.
Package biblatex Info: Redefining '\parencites'.
Package biblatex Info: Redefining '\smartcites'.
)
Package biblatex Info: Trying to load configuration file...
Package biblatex Info: ... file 'biblatex.cfg' found.
(/usr/share/texmf-dist/tex/latex/biblatex/biblatex.cfg
File: biblatex.cfg
)) (/usr/share/texmf-dist/tex/latex/xifthen/xifthen.sty
Package: xifthen 2015/11/05 v1.4.0 Extended ifthen features
(/usr/share/texmf-dist/tex/latex/tools/calc.sty
Package: calc 2017/05/25 v4.3 Infix arithmetic (KKT,FJ)
\calc@Acount=\count382
\calc@Bcount=\count383
\calc@Adimen=\dimen141
\calc@Bdimen=\dimen142
\calc@Askip=\skip71
\calc@Bskip=\skip72
LaTeX Info: Redefining \setlength on input line 80.
LaTeX Info: Redefining \addtolength on input line 81.
\calc@Ccount=\count384
\calc@Cskip=\skip73
) (/usr/share/texmf-dist/tex/latex/ifmtarg/ifmtarg.sty
Package: ifmtarg 2018/04/16 v1.2b check for an empty argument
)) (./mwe.cfg (/usr/share/texmf-dist/tex/generic/tex4ht/tex4ht.4ht
version 2020-03-12-14:03
--------------------------------------
::::::::::::::::::::::::::::::::::::::::::
TeX4ht info is available in the log file
::::::::::::::::::::::::::::::::::::::::::
--------------------------------------
(/usr/share/texmf-dist/tex/generic/tex4ht/biblatex.4ht
version 2020-10-05-15:22
\sv:sec:cnt=\count388
\c@bib=\count389
LaTeX Info: Redefining \MakeUppercase on input line 206.
LaTeX Info: Redefining \MakeLowercase on input line 214.
\blx@unitmark=\skip75
Package biblatex Warning: Patching footnotes failed.
(biblatex) Footnote detection will not work.
\@quotelevel=\count390
\@quotereset=\count391
No file mwe.aux.
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 3.
LaTeX Font Info: ... okay on input line 3.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 3.
LaTeX Font Info: ... okay on input line 3.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 3.
LaTeX Font Info: ... okay on input line 3.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 3.
LaTeX Font Info: ... okay on input line 3.
LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 3.
LaTeX Font Info: ... okay on input line 3.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 3.
LaTeX Font Info: ... okay on input line 3.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 3.
LaTeX Font Info: ... okay on input line 3.
Package biblatex Info: Trying to load language 'english'...
Package biblatex Info: ... file 'english.lbx' found.
(/usr/share/texmf-dist/tex/latex/biblatex/lbx/english.lbx
File: english.lbx 2020/08/23 v3.15a biblatex localization (PK/MW)
)
Package biblatex Info: Input encoding 'utf8' detected.
Package biblatex Info: Automatic encoding selection.
(biblatex) Assuming data encoding 'utf8'.
Package biblatex Info: Trying to load bibliographic data...
Package biblatex Info: ... file 'mwe.bbl' not found.
No file mwe.bbl.
Package biblatex Info: Reference section=0 on input line 3.
Package biblatex Info: Reference segment=0 on input line 3.
--- file mwe.css ---
)
! Undefined control sequence.
<inserted text> \isempty
{apple\footnotemark [1]}
l.11 \printif{apple\footnotemark[1]}{orange}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Argument of \:Advance has an extra }.
<inserted text>
\par
l.11 \printif{apple\footnotemark[1]}{orange}
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
! Paragraph ended before \:Advance was complete.
<to be read again>
\par
l.11 \printif{apple\footnotemark[1]}{orange}
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \reserved@a has an extra }.
<inserted text>
\par
l.11 \printif{apple\footnotemark[1]}{orange}
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
]
! Paragraph ended before \reserved@a was complete.
<to be read again>
\par
l.11 \printif{apple\footnotemark[1]}{orange}
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Missing number, treated as zero.
<to be read again>
{
l.11 \printif{apple\footnotemark[1]}{orange}
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Missing = inserted for \ifnum.
<to be read again>
{
l.11 \printif{apple\footnotemark[1]}{orange}
I was expecting to see `<', `=', or `>'. Didn't.
! Missing number, treated as zero.
<to be read again>
{
l.11 \printif{apple\footnotemark[1]}{orange}
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Missing control sequence inserted.
<inserted text>
\inaccessible
l.11 \printif{apple\footnotemark[1]}{orange}
Please don't say `\def cs{...}', say `\def\cs{...}'.
I've inserted an inaccessible control sequence so that your
definition will be completed without mixing me up too badly.
You can recover graciously from this error, if you're
careful; see exercise 27.2 in The TeXbook.
! Missing number, treated as zero.
<to be read again>
\bgroup
l.11 \printif{apple\footnotemark[1]}{orange}
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Missing number, treated as zero.
<to be read again>
\afterassignment
l.11 \printif{apple\footnotemark[1]}{orange}
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Missing number, treated as zero.
<to be read again>
\xdef
l.11 \printif{apple\footnotemark[1]}{orange}
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Missing number, treated as zero.
<to be read again>
\def
l.11 \printif{apple\footnotemark[1]}{orange}
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Missing control sequence inserted.
<inserted text>
\inaccessible
l.11 \printif{apple\footnotemark[1]}{orange}
Please don't say `\def cs{...}', say `\def\cs{...}'.
I've inserted an inaccessible control sequence so that your
definition will be completed without mixing me up too badly.
You can recover graciously from this error, if you're
careful; see exercise 27.2 in The TeXbook.
! Missing number, treated as zero.
<to be read again>
{
l.11 \printif{apple\footnotemark[1]}{orange}
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Missing control sequence inserted.
<inserted text>
\inaccessible
l.11 \printif{apple\footnotemark[1]}{orange}
Please don't say `\def cs{...}', say `\def\cs{...}'.
I've inserted an inaccessible control sequence so that your
definition will be completed without mixing me up too badly.
You can recover graciously from this error, if you're
careful; see exercise 27.2 in The TeXbook.
! Missing { inserted.
\@gtempa ...nt by 1 \let \reserved@d =[\def \par }
\relax \TE@setvaltrue \els...
l.11 \printif{apple\footnotemark[1]}{orange}
Where was the left brace? You said something like `\def\a}',
which I'm going to interpret as `\def\a{}'.
! Use of \let doesn't match its definition.
\TE@valtrue ->\let \ifTE@val
\iftrue
l.11 \printif{apple\footnotemark[1]}{orange}
If you say, e.g., `\def\a1{...}', then you must always
put `1' after `\a', since control sequence names are
made up of letters only. The macro here has not been
followed by the required stuff, so I'm ignoring it.
! Extra \else.
\@gtempa ...def \par }\relax \TE@setvaltrue \else
\TE@setvalfalse \fi \TE@ne...
l.11 \printif{apple\footnotemark[1]}{orange}
I'm ignoring this; it doesn't match any \if.
! Use of \let doesn't match its definition.
\TE@setvalfalse ->\let \ifTE@val
\ifTE@negate
l.11 \printif{apple\footnotemark[1]}{orange}
If you say, e.g., `\def\a1{...}', then you must always
put `1' after `\a', since control sequence names are
made up of letters only. The macro here has not been
followed by the required stuff, so I'm ignoring it.
! Use of \let doesn't match its definition.
\TE@negatefalse ->\let \ifTE@negate
\iffalse
l.11 \printif{apple\footnotemark[1]}{orange}
If you say, e.g., `\def\a1{...}', then you must always
put `1' after `\a', since control sequence names are
made up of letters only. The macro here has not been
followed by the required stuff, so I'm ignoring it.
! Use of \let doesn't match its definition.
\:ssg #1#2->\let \d:fn
#1\def \:var {#2}\futurelet \:temp \:Assgn
l.11 \printif{apple\footnotemark[1]}{orange}
If you say, e.g., `\def\a1{...}', then you must always
put `1' after `\a', since control sequence names are
made up of letters only. The macro here has not been
followed by the required stuff, so I'm ignoring it.
! Use of \let doesn't match its definition.
\ip:op #1#2->\let \mth:op
#1\let \adv:c #2\adv:
l.11 \printif{apple\footnotemark[1]}{orange}
If you say, e.g., `\def\a1{...}', then you must always
put `1' after `\a', since control sequence names are
made up of letters only. The macro here has not been
followed by the required stuff, so I'm ignoring it.
! Use of \let doesn't match its definition.
\ip:op #1#2->\let \mth:op #1\let \adv:c
#2\adv:
l.11 \printif{apple\footnotemark[1]}{orange}
If you say, e.g., `\def\a1{...}', then you must always
put `1' after `\a', since control sequence names are
made up of letters only. The macro here has not been
followed by the required stuff, so I'm ignoring it.
! You can't use `begin-group character {' after \advance.
\:Advance #1->\bgroup
\def \:temp {#1}\tmp:cnt #1\afterassignment \:aplus \m...
l.11 \printif{apple\footnotemark[1]}{orange}
I'm forgetting what you said and not changing anything.
! Use of \def doesn't match its definition.
\:Advance #1->\bgroup \def \:temp
{#1}\tmp:cnt #1\afterassignment \:aplus \m...
l.11 \printif{apple\footnotemark[1]}{orange}
If you say, e.g., `\def\a1{...}', then you must always
put `1' after `\a', since control sequence names are
made up of letters only. The macro here has not been
followed by the required stuff, so I'm ignoring it.
! Argument of \adv: has an extra }.
<inserted text>
\par
l.11 \printif{apple\footnotemark[1]}{orange}
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
! Paragraph ended before \adv: was complete.
<to be read again>
\par
l.11 \printif{apple\footnotemark[1]}{orange}
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Use of \def doesn't match its definition.
\expand:after #1->\def \e:tmp
{#1}\expandafter \e:tmp
l.11 \printif{apple\footnotemark[1]}{orange}
If you say, e.g., `\def\a1{...}', then you must always
put `1' after `\a', since control sequence names are
made up of letters only. The macro here has not been
followed by the required stuff, so I'm ignoring it.
! Use of \def doesn't match its definition.
\adv:c #1->\bgroup \def \:temp
{#1}\tmp:cnt #1\afterassignment \:gplus \mth:...
l.11 \printif{apple\footnotemark[1]}{orange}
If you say, e.g., `\def\a1{...}', then you must always
put `1' after `\a', since control sequence names are
made up of letters only. The macro here has not been
followed by the required stuff, so I'm ignoring it.
! Use of \let doesn't match its definition.
\Protect ->\let \prOteCt
\pr:tc \ifx \prOteCt \pr:tc \let \prOteCt \relax \e...
l.11 \printif{apple\footnotemark[1]}{orange}
If you say, e.g., `\def\a1{...}', then you must always
put `1' after `\a', since control sequence names are
made up of letters only. The macro here has not been
followed by the required stuff, so I'm ignoring it.
! Use of \let doesn't match its definition.
\Protect ->\let \prOteCt
\pr:tc \ifx \prOteCt \pr:tc \let \prOteCt \relax \e...
l.11 \printif{apple\footnotemark[1]}{orange}
If you say, e.g., `\def\a1{...}', then you must always
put `1' after `\a', since control sequence names are
made up of letters only. The macro here has not been
followed by the required stuff, so I'm ignoring it.
! Missing number, treated as zero.
<to be read again>
}
l.11 \printif{apple\footnotemark[1]}{orange}
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Use of \def doesn't match its definition.
\adv:c #1->\bgroup \def \:temp
{#1}\tmp:cnt #1\afterassignment \:gplus \mth:...
l.11 \printif{apple\footnotemark[1]}{orange}
If you say, e.g., `\def\a1{...}', then you must always
put `1' after `\a', since control sequence names are
made up of letters only. The macro here has not been
followed by the required stuff, so I'm ignoring it.
! Missing number, treated as zero.
<to be read again>
\xdef
l.11 \printif{apple\footnotemark[1]}{orange}
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Missing control sequence inserted.
<inserted text>
\inaccessible
l.11 \printif{apple\footnotemark[1]}{orange}
Please don't say `\def cs{...}', say `\def\cs{...}'.
I've inserted an inaccessible control sequence so that your
definition will be completed without mixing me up too badly.
You can recover graciously from this error, if you're
careful; see exercise 27.2 in The TeXbook.
! Use of \def doesn't match its definition.
\:aplus ->\xdef \:temp {\def \expandafter
\noexpand \:temp {\the \tmp:cnt }}...
l.11 \printif{apple\footnotemark[1]}{orange}
If you say, e.g., `\def\a1{...}', then you must always
put `1' after `\a', since control sequence names are
made up of letters only. The macro here has not been
followed by the required stuff, so I'm ignoring it.
! Too many }'s.
\:aplus ...expand \:temp {\the \tmp:cnt }}\egroup
\:temp
l.11 \printif{apple\footnotemark[1]}{orange}
You've closed more groups than you opened.
Such booboos are generally harmless, so keep going.
! TeX capacity exceeded, sorry [input stack size=5000].
\:temp ->\:temp
{0}
l.11 \printif{apple\footnotemark[1]}{orange}
If you really absolutely need more capacity,
you can ask a wizard to enlarge me.
No pages of output.
配置文件
\Preamble{xhtml,fn-in}
\begin{document}
\EndPreamble
答案1
这是由 中的一个错误引起的biblatex.4ht
。请尝试此更新版本:
% biblatex.4ht (2021-01-29-14:14), generated from tex4ht-4ht.tex
% Copyright 2007-2009 Eitan M. Gurari
% Copyright 2009-2021 TeX Users Group
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
% version 1.3c of this license or (at your option) any
% later version. The latest version of this license is in
% http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions
% of LaTeX version 2005/12/01 or later.
%
% This work has the LPPL maintenance status "maintained".
%
% The Current Maintainer of this work
% is the TeX4ht Project <http://tug.org/tex4ht>.
%
% If you modify this program, changing the
% version identification would be appreciated.
\immediate\write-1{version 2021-01-29-14:14}
\def\make:blx:ver#1.#2#3\relax{%
%\ifdim#1pt< 3pt \xdef\blx:ver:no{2}\else\xdef\blx:ver:no{3}\fi%
\gdef\blx:ver:no{#1}
\gdef\blx:subver:no{#2}
}
\expandafter\make:blx:ver\[email protected]\relax
\ifx\a:printshorthands\Undef\let\blx@shorthands\@empty\fi
\ifx\blx@startbib\:UnDef
\pend:def\blx@shorthands{%
\pend:def\blx@bibinit{%
\HAssign\shorthands:cnt=0
\NewConfigure{printfield-shorthand}{2}%
\Configure{printfield-shorthand}%
{\gHAdvance\shorthands:cnt by 1\relax
\ifnum \shorthands:cnt=1 \a:printshorthands
\else \c:printshorthands \fi
}
{\d:printshorthands}%
\append:def\endtheshorthands{\b:printshorthands}%
\csname a:@shorthands\endcsname}
}
\ifx\b:printshorthands\Undef\let\endtheshorthands\@empty\fi
\def\a:entryhead{CVR}
\def\a:entryhead:full{CV Radhakrishnan}
\ifx\bib@macro@entryhead:name\UnDef
\let\bib@macro@entryhead:name\@empty\fi
\ifx\bib@macro@entryhead:full\UnDef
\let\bib@macro@entryhead:full\@empty\fi
\gdef\BibFileName[#1]#2{\expandafter\xdef\csname
BibFileName#1\endcsname{#2}}
\newcount\sv:sec:cnt
\def\bibSecConfigure{%
\let\save:section\section
\global\sv:sec:cnt=\c@secnumdepth
\def\section{\@ifstar
{\c@secnumdepth=0\relax\save:section}%
{\c@secnumdepth=\sv:sec:cnt\save:section}}%
}
\gHAssign\bibN=0
\@ifpackageloaded{hyperref}{}{%
\ifdefined\TE@hook\else%
\def\TE@hook{}%
\fi
}
\AtBeginDocument{%
\Configure{ifthenelse}{\TE@hook}
}
\:CheckOption{ooffice}\if:Option
\def\bibConfigure{\ConfigureList{thebibliography}%
{\IgnorePar\EndP \gHAdvance\bib:N by 1
\HCode{<text:bibliography text:name="bib-\bib:N" >
<text:bibliography-source>\Hnewline
<text:index-title-template>}
\NoFonts\ref:name\EndNoFonts
\HCode{</text:index-title-template>\Hnewline
%
<text:bibliography-entry-template\Hnewline
text:bibliography-type="custom1"
text:style-name="Bibliography11">\Hnewline
%
<text:index-entry-bibliography
text:bibliography-data-field="identifier"/>\Hnewline
%
<text:index-entry-span>: </text:index-entry-span>\Hnewline
<text:index-entry-bibliography
text:bibliography-data-field="author" />\Hnewline
<text:index-entry-span>, </text:index-entry-span>\Hnewline
%
<text:index-entry-bibliography
text:bibliography-data-field="title" />\Hnewline
<text:index-entry-span>, </text:index-entry-span>\Hnewline
%
<text:index-entry-bibliography
text:bibliography-data-field="year" />\Hnewline
</text:bibliography-entry-template>\Hnewline\Hnewline
</text:bibliography-source>\Hnewline
<text:index-body>\Hnewline}%
\let\en:bib=\empty
}%
{\en:bib\HCode{</text:index-body></text:bibliography>}}
{\en:bib\gdef\en:bib{\HCode{</text:p>\Hnewline}}%
\HCode{<text:p text:style-name="p-bibitem">}%
\gHAdvance\bibN by 1
\HCode{<text:reference-mark
text:name="X0-\csname BIB-\bibN\endcsname">%
</text:reference-mark>}%
}%
{}{}
}
\else
\def\bibConfigure{%
\ConfigureList{thebibliography}
{\ifvmode \IgnorePar \fi \EndP \EndP
\HCode {<dl class="thebibliography">}%
%
% This is for linking citations with biblist items which
% are in a different file when output is split into different
% chunks. [CVR 2012-09-27]
%
%
% <biblatex-2.2>
%
\immediate\write\@auxout{%
\string\BibFileName[\therefsection]{\FileName}}%
%
% </biblatex-2.2>
%
\PushMacro \end:itm \global \let \end:itm =\empty}%
{\ifvmode \IgnorePar \fi \EndP
\PopMacro \end:itm \global \let \end:itm \end:itm \EndP
\HCode {</dd></dl>}\ShowPar}%
{\ifvmode \IgnorePar \fi \EndP \gHAdvance \bibN by 1
\end:itm \global \def \end:itm {\EndP \Tg </dd>}%
\HCode {<dt id="X\therefsection-\abx@field@entrykey"
class="thebibliography">}\bgroup \bf}%
{\ifvmode \IgnorePar \fi \EndP
\egroup
\HCode {</dt><dd\Hnewline id="bib-\bibN"
class="thebibliography">}%
\par \ShowPar}%
}
\fi
\NewConfigure{printshorthands}{4}
\NewConfigure{@shorthands}[1]{\concat:config\a:@shorthands{#1}}
\let\a:@shorthands\empty
\def\nolinkurl{\o:url:}
% \def\blx@checksum{\ifx \blx@checksum@old \blx@checksum@new \else
% \blx@warning@noline {Page references have changed.\MessageBreak
% Rerun to get references right}\@tempswatrue \blx@reruntrue \fi
% \@nameuse {blx@rerun}}
\def\blx@checksum#1#2#3{%
\begingroup
\blx@tempcnta\the\numexpr0#2*0#3\relax
\blx@tempcntb\blx@tempcnta
\divide\blx@tempcntb10
\multiply\blx@tempcntb10
\advance\blx@tempcnta-\blx@tempcntb
\xdef#1{#1\the\blx@tempcnta}%
\endgroup}
\@ifpackagelater{biblatex}{2018/03/01}{\let\blx:pend:def\pend:defI}{\let\blx:pend:def\pend:def}
\blx:pend:def\blx@bibliography{\bibSecConfigure%
\pend:def\blx@bibinit{%
\bibConfigure
\csname onthebibliography:list\endcsname
}%
}
\let\en:bib\@empty
\newcounter{bib}
\ifnum\blx:ver:no < 3
\protected\def\blx@bbl@entry#1#2#3{%
\begingroup
\def\texht@bibkey{#1}
\edef\abx@field@entrykey{\detokenize{#1}}%
\global\advance\c@bib 1
\immediate\write\@auxout{\string\expandafter\string\gdef
\string\csname\space BIB-\thebib\string\endcsname
{\expandafter\strip@prefix\meaning\texht@bibkey}}%
\Tag{)QX\therefsection-#1}{\thebib}%
\blx@setoptions@type{#2}%
\blx@bbl@options{#3}%
\blx@setoptions@entry
\edef\blx@bbl@data{blx@data@\the\c@refsection @\abx@field@entrykey}%
\csuse\blx@bbl@data
\cslet\blx@bbl@data\@empty
\blx@bbl@addfield{entrykey}{\abx@field@entrykey}%
\blx@bbl@addfield{entrytype}{#2}%
\blx@imc@iffieldundef{options}
{}
{\blx@bbl@fieldedef{options}{\expandonce\abx@field@options}}}
%
\protected\def\blx@finentry{%
\unspace
\a:finentry
\finentrypunct
\blx@postpunct
\b:finentry
\blx@initunit
}
%
\else
% Biblatex 3.0
%
% Hacks for biblatex
% MakeUppercase is redefined by tex4ht, biblatex tries to redefine it as well, but it relies on original
% LaTeX version:
\DeclareRobustCommand{\MakeUppercase}[1]{{%
\def\i{I}\def\j{J}%
\def\reserved@a##1##2{\let##1##2\reserved@a}%
\expandafter\reserved@a\@uclclist\reserved@b{\reserved@b\@gobble}%
\protected@edef\reserved@a{\uppercase{#1}}%
\reserved@a
}}
% Same applies also for \MakeLowercase
\DeclareRobustCommand{\MakeLowercase}[1]{{%
\def\reserved@a##1##2{\let##2##1\reserved@a}%
\expandafter\reserved@a\@uclclist\reserved@b{\reserved@b\@gobble}%
\protected@edef\reserved@a{\lowercase{#1}}%
\reserved@a
}}
% I don't really understand this, but language processing is broken by default
% with biblatex. It loads language file, but it executes code which should be
% executed only in the case if the language file fails, it displays an error message
% and language handling doesn't work. When we execute following code, the language
% files are loaded before checking of the success and it seems to work.
\AtBeginDocument{%
\@ifpackageloaded{babel}
{% This is required for languages which are never explicitly selected
% It seems this code was executed also with Polyglossia, where it caused compilation error
\@ifpackageloaded{polyglossia}{}{%
\def\do#1{\blx@lbxinput{#1}{}{}}%
\ifx\@empty\bbl@loaded\else%
\expandafter\docsvlist\expandafter{\bbl@loaded}%
\fi}}{}%
}
\fi % end of version boolean
\NewConfigure{finentry}{2}
\def\:tempc[#1]#2{%
\expandafter\ifx \csname a:printfield-#2\endcsname\relax
\NewConfigure{printfield-#2}{2}%
\a:printfield{printfield-#2}%
\fi
\Configure{blx@unit}%
{\csname a:printfield-#2\endcsname}%
{\csname b:printfield-#2\endcsname}%
\csname o:\string\blx@printfield:\endcsname[#1]{#2}%
}
\expandafter\HLet\csname\string\blx@printfield\endcsname\:tempc
\NewConfigure{printfield}[1]{\def\a:printfield##1{#1}}
\Configure{printfield}{%
\Configure{#1}%
{\HCode{<!--#1-->}}%
{\HCode{<!--/#1-->}}%
}
\def\:tempc[#1]#2{%
\expandafter\ifx \csname a:bibstring-#2\endcsname\relax
\NewConfigure{bibstring-#2}{2}%
\a:printfield{bibstring-#2}%
\fi
\Configure{blx@unit}%
{\csname a:bibstring-#2\endcsname}%
{\csname b:bibstring-#2\endcsname}%
\csname o:\string\blx@bibstring:\endcsname[#1]{#2}%
}
\expandafter\HLet\csname\string\blx@bibstring\endcsname\:tempc
\def\:tempc[#1]#2{%
\expandafter\ifx \csname a:bibcpstring-#2\endcsname\relax
\NewConfigure{bibcpstring-#2}{2}%
\a:printfield{bibcpstring-#2}%
\fi
\Configure{blx@unit}%
{\csname a:bibcpstring-#2\endcsname}%
{\csname b:bibcpstring-#2\endcsname}%
\csname o:\string\blx@bibcpstring:\endcsname[#1]{#2}%
}
\expandafter\HLet\csname\string\blx@bibcpstring\endcsname\:tempc
\def\:tempc[#1]#2{%
\expandafter\ifx \csname a:biblcstring-#2\endcsname\relax
\NewConfigure{biblcstring-#2}{2}%
\a:printfield{biblcstring-#2}%
\fi
\Configure{blx@unit}%
{\csname a:biblcstring-#2\endcsname}%
{\csname b:biblcstring-#2\endcsname}%
\csname o:\string\blx@biblcstring:\endcsname[#1]{#2}%
}
\expandafter\HLet\csname\string\blx@biblcstring\endcsname\:tempc
\def\:tempc[#1]#2{%
\expandafter\ifx \csname a:bibucstring-#2\endcsname\relax
\NewConfigure{bibucstring-#2}{2}%
\a:printfield{bibucstring-#2}%
\fi
\Configure{blx@unit}%
{\csname a:bibucstring-#2\endcsname}%
{\csname b:bibucstring-#2\endcsname}%
\csname o:\string\blx@bibucstring:\endcsname[#1]{#2}%
}
\expandafter\HLet\csname\string\blx@bibucstring\endcsname\:tempc
\NewConfigure{biblatex-style}[2]{%
\def\:temp{#1}%
\ifx \:temp\blx@cbxfile
#2%
\global\let\biblatex:style\def
\fi
}
\def\biblatex:style{}
\Configure{biblatex-style}{}{}
\pend:def\at:docend{%
\ifx \UnDef\biblatex:style
\:warning{\string\Configure{biblatex-style}{\blx@cbxfile}{...}
not available}%
\fi
}
\let\blx:item\@item
\def\@item[#1]{%
\blx:item[#1]%
\ifhmode \spacefactor\blx@sf@par\fi
}
\let\blx@resetpuncthook\@empty
\let\blx@csq@ifkernmark\@empty
\newskip\blx@unitmark
\blx@unitmark=10pt plus 1pt minus 1pt
\let\abx@aux@page\@gobbletwo
\let\abx@aux@fnpage\@gobbletwo
\let\abx@aux@refsection\@gobbletwo
%
% <[email protected]> reported that After updating
% biblatex and biblatex.ht to versions 2.2 respectively
% 2012-09-28-17:49 (using MiKTeX 2.9 64 bit), tex4ht seemed no longer
% respected the defernumbers option in biblatex.sty: When applied to
% the attached file tex4hterror.tex.
%
% The problem was due to nullifying \abx@aux@number which in fact
% should have been redefined to \blx@aux@number when defernumbers
% option is true.
%
% This is done now and as per Kristian, the fix works fine now.
%
\ifnum\blx:ver:no < 3
%
\protected\def\blx@aux@number#1#2#3#4{%
\blx@bbl@addentryfield{\detokenize{#2}}{#3}{localnumber}{#4}%
\ifblank{#4}%
{}%
{\csgdef{blx@labelnumber@#3}{#4}%
%\blx@addchecksum{#1}{#4} % this can cause a nodocument error!
}}
%
\iftoggle{blx@defernumbers}%
{\setkeys{blx@opt@pre}{labelnumber}%
\let\blx@thelabelnumber\blx@addlabelnumber
\let\abx@aux@number\blx@aux@number}%
{\let\blx@thelabelnumber\relax
\let\abx@aux@number\@gobblefour}
%
\else
\def\@gobblefive#1#2#3#4#5{}%
\protected\def\blx@aux@number#1#2#3#4#5{%
\blx@bbl@addentryfield{\detokenize{#2}}{#3}{localnumber}{#4}{#5}%
\blx@bbl@addentryfield{\detokenize{#2}}{#3}{labelnumber}{#4}{#5}%
\global\toggletrue{blx@localnumber}%
\ifblank{#5}
{}
{\csgdef{blx@labelnumber@#3@#4}{#5}}}
\iftoggle{blx@defernumbers}%
{\setkeys{blx@opt@pre}{labelnumber}%
\let\blx@thelabelnumber\blx@addlabelnumber
\let\abx@aux@number\blx@aux@number}%
{\let\blx@thelabelnumber\relax
\let\abx@aux@number\@gobblefive}
\fi % end of version boolean
%
\AtEndDocument{%
\def\abx@aux@page#1#2{\blx@addpagesum{#1}{#2}}%
\def\abx@aux@fnpage#1#2{\blx@addpagesum{#1}{#2}}%
}
%
\def\blx@begunit{%
\toggletrue{blx@tempa}%
\iftoggle{blx@insert}%
{\iftoggle{blx@unit}%
{\begingroup
\let\blx@begunit\@empty
\let\blx@endunit\@empty
\let\blx@endnounit\@empty
\blx@unitpunct\blx@postpunct
\endgroup
\global\togglefalse{blx@unit}%
\togglefalse{blx@tempa}}
{\blx@postpunct}%
\iftoggle{blx@block}%
{\begingroup
\let\blx@begunit\@empty
\let\blx@endunit\@empty
\let\blx@endnounit\@empty
\newblockpunct
\endgroup
\global\togglefalse{blx@block}%
\togglefalse{blx@tempa}}%
{}}%
{}%
\blx@postpunct
\blx@resetpuncthook
\iftoggle{blx@tempa}%
{}%
{\global\togglefalse{blx@insert}}%
\csname a:blx@unit\endcsname
\blx@leavevmode
\blx@csq@ifkernmark
{}%
{\penalty\@M
\hskip-\blx@unitmark\relax
\hskip\blx@unitmark\relax
}%
\begingroup
\Configure{blx@unit}{}{}%
}
\def\blx@endunit{%
\endgroup
\csname b:blx@unit\endcsname
\Configure{blx@unit}{}{}%
\ifdim\lastskip=\blx@unitmark
\unskip\unskip\unpenalty
\global\togglefalse{blx@lastins}%
\else
\global\toggletrue{blx@insert}%
\global\toggletrue{blx@lastins}%
\fi
}
\NewConfigure{blx@unit}{2}
%
\else
\fi
\ifdefined\XeTeXversion
\def\abx@aux@defaultrefcontext#1#2#3{%
\global\boolfalse{refcontextdefaults}%
\csxdef{blx@assignedrefcontextbib@#1@\detokenize{#2}}{\detokenize{#3}}}
\fi
\NewConfigure{thebibliography}{4}
\append:def\blx@bibinit{\a:bibinit}%
\NewConfigure{bibinit}{1}%
\let\blx@anchors\@empty
\let\bib@field@entrykey\@empty
\protected\def\blx@anchor{%
\xifinlist{X\the\c@refsection -%@
\bib@field@entrykey}{\blx@anchors}%
{}%
{\listxadd\blx@anchors{X\the\c@refsection -%@
\bib@field@entrykey}%
\hyper:natanchorstart{X\the\c@refsection -%@
\bib@field@entrykey}%
\hyper:natanchorend}}
\protected\def\blx@bibhyperref{%
\@ifnextchar[%]
{\blx@bibhyperref@i}%
{\blx@bibhyperref@i[\bib@field@entrykey]}}%
\long\def\blx@bibhyperref@i[#1]#2{%
\hyper:natlinkstart{X\the\c@refsection -%@
#1}%
#2\hyper:natlinkend}%
\protected\long\def\blx@bibhyperlink#1#2{%
\hyper:natlinkstart{X\the\c@refsection -%:
#1}%
#2\hyper:natlinkend}%
\protected\long\def\blx@bibhypertarget#1#2{%
\@bsphack
\hyper:natanchorstart{X\the\c@refsection -%:
#1}%
\@esphack
#2\hyper:natanchorend}%
\let\blx@ifhyperref\@firstoftwo
% Oleg Domanov [email protected] reports:
% tex4ht ends with an error when compiles biblatex files. I'm on
% Windows, texlive 2012. I put here a minimal example and files
% generated with the command latexmk test && mk4ht oolatex test
%
% https://www.dropbox.com/s/hn1zm40htqs13mf/t4htlink.zip
%
% There is a superfluous \relax in the file test.tmp, line 65 which
% seems to cause the error.
%
% Changes to cope with biblatex upgrade caused this problem. It is now
% fixed. --CVR 2012/10/26
%
\:CheckOption{ooffice}\if:Option
\def\hyper:natanchorstart#1{\Link{}{#1}\EndLink}%
\def\hyper:natlinkstart#1{\Link{#1}{}}%
\else
\def\hyper:natanchorstart#1{%
\expandafter\ifx\csname QXpage.\thepage\endcsname\relax%
\Tag{)Qpage.\thepage}{\file:id}%
\HCode{<a id="page.\thepage"></a>}%
\expandafter\xdef\csname QXpage.\thepage\endcsname{0}%
\fi
\Link[\csname BibFileName\therefsection\endcsname]{}{#1}\EndLink}
\def\hyper:natlinkstart#1{%
\expandafter\ifx\csname QXpage.\thepage\endcsname\relax%
\Tag{)Qpage.\thepage}{\file:id}%
\HCode{<a id="page.\thepage"></a>}%
\expandafter\xdef\csname QXpage.\thepage\endcsname{0}%
\fi
\Link[\csname BibFileName\therefsection\endcsname]{#1}{}}
\fi
\def\hyper:natanchorend{}
\def\hyper:natlinkend{\EndLink}
\def\writeCiteLink#1{\immediate\write\@mainaux{%
\string\@namedef{#1.\thepage}{\FileName}}}
\let\blx@addpagesum\@gobbletwo
\let\nolinkurl\relax
\ifx\blx:ver:no < 3
%
% biblatex 2.9a
%
% Newly added to process {keylist} environment (CVR)
%
\let\keylist\description
\let\endkeylist\enddescription
\def\keyitem#1{\item[#1]}%
%
%
\else
%
% biblatex 3.0
%
\let\keylist\Un:def
\let\endkeylist\Un:def
\newenvironment*{keylist}
{\list{}{%
\setlength{\labelwidth}{1.25in}%
\setlength{\labelsep}{10pt}%
\setlength{\leftmargin}{0pt}%
\setlength{\itemsep}{0pt}%
\raggedright%
\renewcommand*{\makelabel}[1]{\hss\bfseries##1}}}
{\endlist}
%
\def\keyitem#1{%
\item[#1]
\begingroup
\keyitemhook%
\blx@bibinit%
\midsentence\ifbibstring{#1}{}{\latintext}\biblstring{#1}%
\expandafter\lbx@initnamehook\lsmartoftext%
\par\nobreak
\midsentence\ifbibstring{#1}{}{\latintext}\bibsstring{#1}%
\expandafter\lbx@initnamehook\ssmartoftext%
\endgroup
\par\nobreak}
\fi % End of version boolean
\ConfigureList{keylist}%
{\EndP\HCode{<dl \a:LRdir class="description">}%
\PushMacro\end:itm
\global\let\end:itm=\empty}%
{\PopMacro\end:itm \global\let\end:itm \end:itm
\EndP\HCode{</dd></dl>}\ShowPar}%
{\end:itm \global\def\end:itm{\EndP\Tg</dd>}\HCode{<dt
class="description">}\bgroup \bf}%
{\egroup\EndP\HCode{</dt><dd\Hnewline class="description">}}
\let\:temp\do
\def\do#1{%
\patchcmd#1%
{\color@begingroup}%
{\color@begingroup\toggletrue{blx@footnote}}%
{\togglefalse{blx@tempa}\listbreak}%
{}}%
\docsvlist{%
\@footnotetext,% latex
\H@@footnotetext,% hyperref
\scr@saved@footnotetext,% koma-script 3.x
\l@dold@footnotetext,% ledmac
\l@doldold@footnotetext,% ledmac
\@fntORI}% frenchle
\let\do\:temp
\Hinput{biblatex}
\endinput
问题是它重新定义了TE@hook
Biblatex 和 Xifthen 都使用的宏。biblatex.4ht
如果它已经存在,则不应该定义它。
结果如下: