我的最后的例子:
ideje.tex 和 mypackage.tex
我需要完成这个枚举环境,从阿拉伯语、罗马语到包括灰分
begin{enumerate}[label=\roman{enumi}--\arabic{enumi}--\large\ngg\symbol{\numexpr "13000+\value{enumi}}--]%\hgnum{\value{enumi}}]
艾迪杰平均能量损失
\documentclass{article}
\usepackage{amssymb,amsmath}
\usepackage{fontspec}
\usepackage{mypackage}
\usepackage[czech]{babel}
\newfontfamily\ngg{Segoe UI Historic}
\usepackage{enumitem}
\begin{document}
\underline{motto:}{ každý den $\pm$ nový princip }\hfill{$\square$} \\
\\ \begin{enumerate}[
label=\roman{enumi}--\arabic{enumi}--\large\ngg\symbol{\numexpr
"13000+\value{enumi}}--]%\hgnum{\value{enumi}}]
\item rozhodovat se na hraně zajímavého
\item *vždycky to tam máš (data v matematice) K{\hg \hgunits{5}}L
\item svoboda a volnost
\item \hgnum{152123}
\item
\end{enumerate}
\end{document}
我的包.tex
% this is my first package
%
% (c) Buffalo Bill
%
%% This program can be redistributed and/or modified under the terms
%% of the LaTeX Project Public License Distributed from CTAN archives
%% in directory macros/latex/base/lppl.txt.
%
\NeedsTeXFormat{LaTeX2e}[2994/06/01]
\ProvidesPackage{mypackage}
[2011/01/11 v0.01 LaTeX package for my own purpose]
\usepackage{fontspec}
\usepackage{fontspec}
\newfontfamily\hg{Segoe UI Historic}
\def\hgunits#1{\ifcase#1\relax\or
^^^^^^0133fa\or
^^^^^^0133fb\or
^^^^^^0133fc\or
^^^^^^0133fd\or
^^^^^^0133fe\or
^^^^^^0133ff\or
^^^^^^013400\or
^^^^^^013401\or
^^^^^^013402\else
?\fi}
\def\hgtens#1{\ifcase#1\relax\or
^^^^^^013386\or
^^^^^^013387\or
^^^^^^013388\or
^^^^^^013389\or
^^^^^^01338a\or
^^^^^^01338b\or
^^^^^^01348c\or
^^^^^^01348d\or
^^^^^^01348e\else
?\fi}
\def\hghundreds#1{\ifcase#1\relax\or
^^^^^^013362\or
^^^^^^013363\or
^^^^^^013364\or
^^^^^^013365\or
^^^^^^013366\or
^^^^^^013367\or
^^^^^^013368\or
^^^^^^013369\or
^^^^^^01336a\else
?\fi}
\def\hgthousands#1{\ifcase#1\relax\or
^^^^^^0131bc\or
^^^^^^0131bd\or
^^^^^^0131be\or
^^^^^^0131bf\or
^^^^^^0131c0\or
^^^^^^0131c1\or
^^^^^^0131c2\or
^^^^^^0131c3\or
^^^^^^0131c4\else
?\fi}
\def\hgtenthousands#1{\ifcase#1\relax\or
^^^^^^0130ad\or
^^^^^^0130ae\or
^^^^^^0130af\or
^^^^^^0130b0\or
^^^^^^0130b1\or
^^^^^^0130b2\or
^^^^^^0130b3\or
^^^^^^0130b4\or
^^^^^^0130b5\else
?\fi}
\def\hghundredthousands#1{\ifcase#1\relax\or
^^^^^^013190\or
^^^^^^013190^^^^^^013190\or
^^^^^^013190^^^^^^013190^^^^^^013190\or
^^^^^^013190^^^^^^013190^^^^^^013190^^^^^^013190\or
^^^^^^013190^^^^^^013190^^^^^^013190^^^^^^013190^^^^^^013190\else
?\fi}
\def\hgnum#1{{\hg\expandafter\hgnumx\the\numexpr10000000+#1\relax}}
\def\hgnumx#1#2#3#4#5#6#7#8{%
\hghundredthousands{#3}%
\hgtenthousands{#4}%
\hgthousands{#5}%
\hghundreds{#6}%
\hgtens{#7}%
\hgunits{#8}%
}
%\RequirePackage{whateverwe need}
\def\hi{Hello, this is my own package}
\let\myDate\date
\newcommand\GoodBye[1][\bfseries]{{#1Good Bye}}
\endinput
%%
%% End of file `mypackage.sty'.
答案1
声明\hgnum
为强有力的命令,改变
\def\hgnum#1{{\hg\expandafter\hgnumx\the\numexpr10000000+#1\relax}}
到
\DeclareRobustCommand\hgnum[1]{{\hg\expandafter\hgnumx\the\numexpr10000000+#1\relax}}
无关,但您应该删除\\
产生错误输出和警告的错误:
Underfull \hbox (badness 10000) in paragraph at lines 19--22
Underfull \hbox (badness 10000) in paragraph at lines 19--22