我想将我的阿拉伯语文本版本转换为 ODT 格式。该版本使用的注释应该以较小的字体显示在文本下方的段落中(不是在每页底部)。我希望脚注钩子采用阿拉伯数字 ١٢٣٤٥٦٧٨٩٠,而不是罗马数字 1234567890。理想情况下,我希望能够选择输出字体(Amiri)(目前阿拉伯文本的默认字体是 Tahoma)。
我一直没能弄清楚的是
- 如何使脚注钩子变成阿拉伯风格
- 如何使注释段落的字体大小更小
- 如何删除注释段落中脚注标记后面的虚假空格。
我怎样才能做到这一点?
平均能量损失
myfile.tex
:
\documentclass[12pt,letterpaper,oldfontcommands]{memoir}
\usepackage{fontspec}
\usepackage{xunicode}
\usepackage[T1]{fontenc}
\newcommand{%
\خ%
}[2]{%
\ar{#1}\footnoteA{\ar{#1%
:
#2}}%
}
\newfontfamily\arabicfont[Script=Arabic,Mapping=arabicdigits]{Amiri}
%Arabic
\newcommand{\ar}[1]{#1}
\newenvironment{arab}{}{}
% APPARATUS FOR VARIANTS IN ARABIC TEXT
\usepackage[para]{manyfoot}
\SetFootnoteHook{\setRL}
\DeclareNewFootnote[para]{A}[alph]
%%%%%%%%%%%%%%%%%%%%%%%%%%
% Placing Arabic apparatus at the end of each paragraph
% (WARNING !!! : currently only works if VARIANT commands only come within `arab` environments)
\usepackage[restart]{parnotes} % package
\renewcommand{\parnotefmt}[1]{\tiny\noindent #1}
\renewcommand{\footnoteA}[1]{\parnote{#1}} % mk app fns parnotes
% \renewcommand*{\parnotecusmarkfmt}[1]{\arabicfont\addfontfeature{Mapping=arabicdigits}\textsuperscript{#1}}
\renewcommand*{\parnotecusmarkfmt}[1]{\arabicfont\addfontfeature{Mapping=arabicdigits}\textsuperscript{#1}}
\let\origArab\arab
\renewenvironment{arab}{\begin{origArab}}{\parnotes{}\end{origArab}} % make arab environment print parnotes at the end
%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\begin{arab}
\خ{لكن لما}{ڤ؛ إنني كلما: ي}
\end{arab}
\end{document}
编译为
make4ht -uxm draft -f odt -c myconfig.cfg
哪里myconfig.cfg
:
\Preamble{xhtml}
\ConfigureOO{Footnote}{
<style:style
style:name="Footnote"
style:family="paragraph"
style:parent-style-name="Standard"
style:class="extra">\Hnewline
<style:paragraph-properties
fo:margin-left="0in"
fo:margin-right="0in"
fo:text-indent="0.1in"
style:auto-text-indent="false"/>
<style:text-properties fo:font-size="83.3333333333333333333333\%"
style:font-size-asian="83.3333333333333333333333\%"
style:font-size-complex="83.3333333333333333333333\%" />
</style:style>\Hnewline
<text:notes-configuration text:note-class="footnote"
text:citation-style-name="Footnote_20_Symbol"
text:citation-body-style-name="Footnote_20_anchor"
style:num-format="1" text:start-value="0"
text:footnotes-position="page"
text:start-numbering-at="document" />\Hnewline
<style:style style:name="Footnote_20_Symbol"
style:display-name="Footnote Symbol" style:family="text" >\Hnewline
<style:text-properties style:text-position="super 58\%" />\Hnewline
</style:style>
<style:style style:name="Footnote_20_anchor"
style:display-name="Footnote anchor" style:family="text">
<style:text-properties style:text-position="super 58\%" />\Hnewline
</style:style>\Hnewline
}
\ConfigureOO{verse}{\Hnewline
<style:style style:name="verse"
style:family="paragraph"
style:parent-style-name="Text-body"
style:next-style-name="Text-body">
<style:paragraph-properties fo:margin-left="1.499cm"
fo:margin-right="1cm"
fo:margin-top="0cm"
fo:margin-bottom="0cm"
fo:text-indent="-0.499cm"
style:auto-text-indent="false">
<style:tab-stops/>
</style:paragraph-properties >
</style:style>
\Hnewline}
\xeuniuseblock{Greek}
\xeuniuseblock{Arabic}
\makeatletter
\ConfigureEnv{arab}{\@rltrue}{\@rlfalse}{}{}
\Configure{ref}{\Link}{\EndLink}{}
\makeatother
\begin{document}
\EndPreamble
电流输出
期望输出
答案1
您的原始 TeX 文件无法使用 XeLaTeX 或 LuaLaTeX 正确编译。以下是可以使用它们两者进行编译的修改版本:
% https://tex.stackexchange.com/q/495709/2891
\documentclass[12pt,letterpaper,oldfontcommands]{memoir}
\usepackage{fontspec}
% \usepackage{xunicode}
% \usepackage[T1]{fontenc}
\ifdefined\HCode
\usepackage{babel}
\else
\ifdefined\directlua
\usepackage[nil,bidi=basic-r]{babel}
\babelprovide[import=ar,main]{arabic}
\babelfont[arabic]{rm}{Amiri}
\else
% \usepackage[]{babel}
\usepackage{polyglossia}
\setmainlanguage{arabic}
%\setotherlanguage{arabic}
\fi
\fi
\newcommand{%
\خ%
}[2]{%
\ar{#1}\footnoteA{\ar{#1%
:
#2}}%
}
% \newfontfamily\arabicfont[Script=Arabic,Mapping=arabicdigits]{Amiri}
\newfontfamily\arabicfont[Script=Arabic]{Amiri}
%Arabic
\newcommand{\ar}[1]{\bgroup\arabicfont#1\egroup}
\newenvironment{arab}{}{}
% APPARATUS FOR VARIANTS IN ARABIC TEXT
\usepackage[para]{manyfoot}
\SetFootnoteHook{\setRL}
\DeclareNewFootnote[para]{A}[alph]
%%%%%%%%%%%%%%%%%%%%%%%%%%
% Placing Arabic apparatus at the end of each paragraph
% (WARNING !!! : currently only works if VARIANT commands only come within `arab` environments)
\usepackage[restart]{parnotes} % package
\renewcommand{\parnotefmt}[1]{\tiny\noindent #1}
\renewcommand{\footnoteA}[1]{\parnote{#1}} % mk app fns parnotes
% \renewcommand*{\parnotecusmarkfmt}[1]{\arabicfont\addfontfeature{Mapping=arabicdigits}\textsuperscript{#1}}
\renewcommand*{\parnotecusmarkfmt}[1]{\arabicfont\textsuperscript{\arabicdigits{#1}}}
\let\origArab\arab
\renewenvironment{arab}{\begin{origArab}}{\parnotes{}\end{origArab}} % make arab environment print parnotes at the end
%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\begin{arab}
\خ{لكن لما}{ڤ؛ إنني كلما: ي}
\end{arab}
\end{document}
我做了一些改变:
% \usepackage{xunicode}
% \usepackage[T1]{fontenc}
\ifdefined\HCode
\usepackage{babel}
\else
\ifdefined\directlua
\usepackage[nil,bidi=basic-r]{babel}
\babelprovide[import=ar,main]{arabic}
\babelfont[arabic]{rm}{Amiri}
\else
% \usepackage[]{babel}
\usepackage{polyglossia}
\setmainlanguage{arabic}
%\setotherlanguage{arabic}
\fi
\fi
仅tex4ht
需要babel
包,不需要语言定义,使用 LuaLaTeX 和 XeLaTeX babel
或polyglossia
使用正确文本方向的选项。
另一个变化是注释标记:
\renewcommand*{\parnotecusmarkfmt}[1]{\arabicfont\textsuperscript{\arabicdigits{#1}}}
变化在于它使用\arabicdigits
命令而不是依赖 XeLaTeX 字体映射机制。得益于这一变化,它可以与 LuaLaTeX 配合使用。
配置文件仅需进行微小的修改:
\Preamble{xhtml,ooffice}
\ConfigureOO{Footnote}{
<style:style
style:name="Footnote"
style:family="paragraph"
style:parent-style-name="Standard"
style:class="extra">\Hnewline
<style:paragraph-properties
fo:margin-left="0in"
fo:margin-right="0in"
fo:text-indent="0.1in"
style:auto-text-indent="false"/>
<style:text-properties fo:font-size="83.3333333333333333333333\%"
style:font-size-asian="83.3333333333333333333333\%"
style:font-size-complex="83.3333333333333333333333\%" />
</style:style>\Hnewline
<text:notes-configuration text:note-class="footnote"
text:citation-style-name="Footnote_20_Symbol"
text:citation-body-style-name="Footnote_20_anchor"
style:num-format="1" text:start-value="0"
text:footnotes-position="page"
text:start-numbering-at="document" />\Hnewline
<style:style style:name="Footnote_20_Symbol"
style:display-name="Footnote Symbol" style:family="text" >\Hnewline
<style:text-properties style:text-position="super 58\%" />\Hnewline
</style:style>
<style:style style:name="Footnote_20_anchor"
style:display-name="Footnote anchor" style:family="text">
<style:text-properties style:text-position="super 58\%" />\Hnewline
</style:style>\Hnewline
}
\ConfigureOO{verse}{\Hnewline
<style:style style:name="verse"
style:family="paragraph"
style:parent-style-name="Text-body"
style:next-style-name="Text-body">
<style:paragraph-properties fo:margin-left="1.499cm"
fo:margin-right="1cm"
fo:margin-top="0cm"
fo:margin-bottom="0cm"
fo:text-indent="-0.499cm"
style:auto-text-indent="false">
<style:tab-stops/>
</style:paragraph-properties >
</style:style>
\Hnewline}
\def\loopoverdigits#1{\ifx\relax#1\else%
% Unicode block for Arabic numerals starts at U+0660
% the following special command inserts the XML entity
% for the number, which will be converted to Unicode char
% by tex4ht
\special{t4ht@+&{35}x066#1{59}}x%
\expandafter\loopoverdigits\fi}
\def\arabicdigits#1{\NoFonts\loopoverdigits#1\relax\EndNoFonts}
\ifdefined\xeuniuseblock
\xeuniuseblock{Greek}
\xeuniuseblock{Arabic}
\fi
\makeatletter
\ConfigureEnv{arab}{\@rltrue}{\@rlfalse}{}{}
\Configure{ref}{\Link}{\EndLink}{}
\makeatother
\begin{document}
\EndPreamble
我添加了修改后的定义\arabicdigits
:
\def\loopoverdigits#1{\ifx\relax#1\else%
% Unicode block for Arabic numerals starts at U+0660
% the following special command inserts the XML entity
% for the number, which will be converted to Unicode char
% by tex4ht
\special{t4ht@+&{35}x066#1{59}}x%
\expandafter\loopoverdigits\fi}
\def\arabicdigits#1{\NoFonts\loopoverdigits#1\relax\EndNoFonts}
它循环遍历参数中的所有数字,并使用命令将它们打印为 Unicode 实体\special{t4ht@+&{35}x066#1{59}}x
。它利用了阿拉伯数字从0660
代码点开始的事实,因此我们可以将数字作为代码点中的最后一位数字传递,它将以正确的 Unicode 值结束。
以下是 LO 中的结果: