编辑:我使用 tex4ht 的扩展,
https://github.com/michal-h21/helpers4ht
================================
MYLIST
我在我的中定义了一个自定义列表.tex
。这个列表非常简单:我从文件中MYLIST
复制粘贴了的定义,我将名称更改为,然后添加了行,以便控制标签、空格和枚举的深度,本着这本好书的精神:
enumerate
ltlist.dtx
enumerate
MYLISTerate
http://www.dickimaw-books.com/latex/admin/html/exercises/enumextend.shtml
是否有可能有一个可直接输入到.tex
??中的代码?
我想定义一个考虑到以下因素的html
环境:MYLIST
我个人的枚举深度
我个人的间距,针对每个枚举深度
我的个人标签,针对每个枚举深度
我进入文件html4.4ht
并查找的配置enumerate
,我发现这个,我认为,至少可以编译我的列表而无需提供深度和间距,[您注意到我没有替换任何内容,除了@MYLISTdepth
。]:
\ConfigureList{MYLISTerate}%
{\EndP\HCode{<ol \a:enumerate:\space class="enumerate\expandafter\the\csname @MYLISTdepth\endcsname" \a:LRdir >}\PushMacro\end:itm \global\let\end:itm=\empty}
{\PopMacro\end:itm \global\let\end:itm \end:itm\EndP\HCode{</li></ol>}\ShowPar}
{\end:itm \gdef\end:itm{\EndP\Tg</li>}\DeleteMark}
{{\Configure{Link}{li}{}{ class="enumerate" id=}{}\let\EndLink=\empty \AnchorLabel }}
但当我编译时,我收到错误
Package etoolbox Warning: Patching '\end' failed!
(etoolbox) '\AfterEndEnvironment' will not work.
))) (d:/texlive/texmf-dist/tex/generic/tex4ht/html4.4ht)
(d:/texlive/texmf-dist/tex/generic/tex4ht/html4-math.4ht)) (./alt.aux)
(d:/texlive/texmf-dist/tex/latex/base/ts1cmr.fd) [1]
! TeX capacity exceeded, sorry [input stack size=5000].
\EndP ->\Protect
\par:end
l.209 \item L
orem Ipsum is simply dummy text of the printing and typesetting i...
13385 words of node memory still in use:
15 hlist, 2 rule, 33 disc, 87 glue, 24 kern, 9 penalty, 349 glyph, 58 glue_sp
ec, 1 temp, 4994 if_stack, 1 shape, 4 special, 2 local_par, 1 dir nodes
这是我的工作示例。
\documentclass{article}
%\input{preamble}
\usepackage{alternative4ht}
\altusepackage{polyglossia}
\altusepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text,
SmallCapsFeatures={Renderer=Basic}}
%\altusepackage{etoolbox}
\makeatletter
\newcount\@MYLISTdepth \@MYLISTdepth = 0
\@definecounter{MYLISTi}
\@definecounter{MYLISTii}
\@definecounter{MYLISTiii}
\@definecounter{MYLISTiv}
\def\MYLISTerate{%
\ifnum \@MYLISTdepth >\thr@@\@toodeep\else
\advance\@MYLISTdepth\@ne
\edef\@MYLISTctr{MYLIST\romannumeral\the\@MYLISTdepth}%
\expandafter
\list
\csname label\@MYLISTctr\endcsname
{\usecounter\@MYLISTctr\def\makelabel##1{\hss\llap{##1}}}%
\fi}
\let\endMYLISTerate =\endlist
\newcount\@itemdepth \@itemdepth = 0
\def\itemize{%
\ifnum \@itemdepth >\thr@@\@toodeep\else
\advance\@itemdepth\@ne
\edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
\expandafter
\list
\csname\@itemitem\endcsname
{\def\makelabel##1{\hss\llap{##1}}}%
\fi}
\let\enditemize =\endlist
\makeatother
% Extended MYLISTerate:
%%%\newcounter{MYLISTi}
%%%\setcounter{MYLISTi}{0}
%%%\newcounter{MYLISTii}[MYLISTi]
%%%\newcounter{MYLISTiii}[MYLISTii]
%%%\newcounter{MYLISTiv}[MYLISTiii]
\newcounter{MYLISTv}[MYLISTiv]
\newcounter{MYLISTvi}[MYLISTv]
\newcommand*{\labelMYLISTv}{\theMYLISTv.}
\newcommand*{\labelMYLISTvi}{\theMYLISTvi.}
% Make the left margins a bit bigger for levels 5 and 6
\makeatletter
\renewcommand*{\p@MYLISTi}{}
\renewcommand*{\p@MYLISTii}{}
\renewcommand*{\p@MYLISTiii}{}
\renewcommand*{\p@MYLISTiv}{}
\renewcommand*{\p@MYLISTv}{}
\renewcommand*{\p@MYLISTvi}{}
\renewcommand*{\MYLISTerate}{%
\def\@listi{
\setlength{\leftmargin}{\leftmarginii}
\addtolength{\leftmargin}{-0.33\leftmargini}
\setlength{\labelsep}{0.5ex}
\setlength{\itemindent}{1\parindent}
\setlength{\listparindent}{1\parindent}
\setlength{\parsep}{1\parskip}
\setlength{\itemsep}{0\parskip plus 0.25\parskip minus 0.25\parskip}
\setlength{\topsep}{0\parskip plus 0.25\parskip minus 0.25\parskip}
\setlength{\partopsep}{0\parskip plus 0.25\parskip minus 0.25\parskip}
}
\def\@listii{
\setlength{\leftmargin}{\leftmarginii}
\addtolength{\leftmargin}{-0.33\leftmargini}
\setlength{\labelsep}{0.5ex}
\setlength{\itemindent}{1\parindent}
\setlength{\listparindent}{1\parindent}
\setlength{\parsep}{1\parskip}
\setlength{\itemsep}{0\parskip plus 0.25\parskip minus 0.25\parskip}
\setlength{\topsep}{0\parskip plus 0.25\parskip minus 0.25\parskip}
\setlength{\partopsep}{0\parskip plus 0.25\parskip minus 0.25\parskip}
}
\def\@listiii{
\setlength{\leftmargin}{\leftmarginiii}
\addtolength{\leftmargin}{-0.33\leftmarginii}
\setlength{\labelsep}{0.5ex}
\setlength{\itemindent}{1\parindent}
\setlength{\listparindent}{1\parindent}
\setlength{\parsep}{1\parskip}
\setlength{\itemsep}{0\parskip plus 0.25\parskip minus 0.25\parskip}
\setlength{\topsep}{0\parskip plus 0.25\parskip minus 0.25\parskip}
\setlength{\partopsep}{0\parskip plus 0.25\parskip minus 0.25\parskip}
}
\ifnum \@MYLISTdepth > 5\relax
\@toodeep
\else
\advance\@MYLISTdepth\@ne
\edef\@MYLISTctr{MYLIST\romannumeral\the\@MYLISTdepth}%
\expandafter\list\csname label\@MYLISTctr\endcsname{%
\usecounter\@MYLISTctr
\def\makelabel##1{\hss\llap{##1}}%
}%
\fi
}
\makeatother
\usepackage{textcomp}
% Modify item label formats
\newcommand*{\labelMYLISTi}{
\arabic{MYLISTi}\textdegree\large)\normalsize
}
\newcommand*{\labelMYLISTii}{
\textbf{\alph{MYLISTii}}\large)\normalsize
}
\newcommand*{\labelMYLISTiii}{
\textit{\roman{MYLISTiii}}\large)\normalsize
}
\newcommand*{\labelMYLISTiv}{\theMYLISTiv.}
% Modify the way the item counters are displayed:
\renewcommand*{\theMYLISTi}{\thesection.\arabic{MYLISTi}}
\renewcommand*{\theMYLISTii}{\theMYLISTi.\arabic{MYLISTii}}%
\renewcommand*{\theMYLISTiii}{\theMYLISTii.\arabic{MYLISTiii}}%
\renewcommand*{\theMYLISTiv}{\theMYLISTiii.\arabic{MYLISTiv}}%
% And for the new extended counters:
\renewcommand*{\theMYLISTv}{\theMYLISTiv.\arabic{MYLISTv}}%
\renewcommand*{\theMYLISTvi}{\theMYLISTv.\arabic{MYLISTvi}}%
\ifx\HCode\undefined \else
\AtBeginDocument{
\Tag{TITLE+}{MYTITLE}
}
\fi
\begin{document}
\ifx\HCode\undefined \else
\def\ClosePar{\ifvmode\IgnorePar\fi\EndP}
\def\){$\EndPMath}
\def\({\PMath$}
\def\]{$$\EndPMath}
\def\[{\PMath$$}
\Configure{textit}{\HCode{<italic>}}{\HCode{</italic>}}
\Configure{textbf}{\HCode{<bold>}}{\HCode{</bold>}}
\makeatletter
\ConfigureList{MYLISTerate}%
{\EndP\HCode{<ol \a:enumerate:\space class="enumerate\expandafter\the\csname @MYLISTdepth\endcsname" \a:LRdir >}\PushMacro\end:itm \global\let\end:itm=\empty}
{\PopMacro\end:itm \global\let\end:itm \end:itm\EndP\HCode{</li></ol>}\ShowPar}
{\end:itm \gdef\end:itm{\EndP\Tg</li>}\DeleteMark}
{{\Configure{Link}{li}{}{ class="enumerate" id=}{}\let\EndLink=\empty \AnchorLabel }}
\makeatother
\fi
\hrule
enumerate:
\begin{enumerate}
%\setcounter{list1}{4}
\item Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
\item
\begin{enumerate}
\item if a rational A is in A,
\begin{enumerate}
\item if A is negative, it is in A
\item if A is not negative such that its in A, A is in A; by n; otherwise,
\end{enumerate}
\item for the rLorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
\end{enumerate}
\item Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
\end{enumerate}
\hrule
MYLISTerate:
\begin{MYLISTerate}
%\setcounter{list1}{4}
\item Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
\item
\begin{MYLISTerate}
\item if a rational A is in A,
\begin{MYLISTerate}
\item if A is negative, it is in A
\item if A is not negative such that its in A, A is in A; by n; otherwise,
\end{MYLISTerate}
\item for the rLorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
\end{MYLISTerate}
\item Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
\end{MYLISTerate}
\end{document}