summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-11-01 21:03:38 +0000
committerKarl Berry <karl@freefriends.org>2019-11-01 21:03:38 +0000
commit8cd3bed99a3581a336526a347f925d9925ddc0d8 (patch)
tree6cfce368843c4eb60d54d1d880ffd66c5da4fbcd /Master/texmf-dist/tex
parentfdb7d0585af6b9054e895d6f3047766f799b6098 (diff)
tex4ebook (1nov19)
git-svn-id: svn://tug.org/texlive/trunk@52604 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht20
-rw-r--r--Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.sty45
2 files changed, 52 insertions, 13 deletions
diff --git a/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht b/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht
index e4233fc55a4..e623ac8bc24 100644
--- a/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht
+++ b/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht
@@ -178,6 +178,10 @@ href="#1" media-type="\a:CoverMimeType" />}}
\patch:sec:register{likesection}
\patch:sec:register{likesubsection}
\patch:sec:register{likesubsubsection}
+\patch:sec:register{appendix}
+\patch:sec:register{appendixsec}
+\patch:sec:register{appendixsubsec}
+\patch:sec:register{appendixsubsubsec}
\:CheckOption{epub}
\if:Option
@@ -264,7 +268,7 @@ href="#1" media-type="\a:CoverMimeType" />}}
\def\tmp:processlevel#1{
\bgroup
\csxdef{tmp:resettoclevels#1}{}
- \def\do##1{\csxdef{tmp:resettoclevels#1}{\csname tmp:resettoclevels#1\endcsname ##1,like##1,}}
+ \def\do##1{\csxdef{tmp:resettoclevels#1}{\csname tmp:resettoclevels#1\endcsname ##1,like##1,\appendix:type{##1}}}
\def\tmp:parse##1#1##2\nil{
\docsvlist{#1##2}
}
@@ -273,6 +277,8 @@ href="#1" media-type="\a:CoverMimeType" />}}
\navsection{#1}{\csname tmp:resettoclevels#1\endcsname}
% define hierarchy also for starred sections
\navsection{like#1}{\csname tmp:resettoclevels#1\endcsname}
+ % and for appendices
+ \ifcsdef{appendix:type:#1}{\navsection{\csuse{appendix:type:#1}}{\csname tmp:resettoclevels#1\endcsname}}{}
}
% define children levels for each sectioning level
@@ -292,6 +298,14 @@ href="#1" media-type="\a:CoverMimeType" />}}
\ifx\:temp\z@ro\else#1\fi
}
+% to create correct hiearchical NCX for appendices, we register corresponding appendix types
+% for various section types
+\def\appendix:type#1{\ifcsdef{appendix:type:#1}{\csuse{appendix:type:#1},}{}}
+\def\def:appendix:type#1#2{\csdef{appendix:type:#1}{#2}}
+\def:appendix:type{chapter}{appendix}
+\def:appendix:type{section}{appendixsec}
+\def:appendix:type{subsection}{appendixsubsec}
+\def:appendix:type{subsubsection}{appendixsubsubsec}
%
\def\ncx:head{%
@@ -312,7 +326,7 @@ href="#1" media-type="\a:CoverMimeType" />}}
% define toc levels which should be included in the NCX file
\NewConfigure{resettoclevels}{1}
-\Configure{resettoclevels}{part,appendix,chapter,appendixsec,section,appendixsubsec,subsection,appendixsubsubsec,subsubsection,paragraph}
+\Configure{resettoclevels}{part,chapter,section,subsection,subsubsection,paragraph}
\def\:tempa{%
\EndP
@@ -369,6 +383,8 @@ href="#1" media-type="\a:CoverMimeType" />}}
\def\print:opf:scheme#1{ opf:scheme="#1"}
\def\:tempa{%
+% French language definition makes the : character active, which can cause compilation error
+\ifdefined\XeTeXcharclass\XeTeXcharclass `\: \z@\fi%
\bgroup
\setcounter{tocdepth}{3}
% Basic sctructure of the opf file
diff --git a/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.sty b/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.sty
index c3726ee1671..27a46b756ec 100644
--- a/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.sty
+++ b/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.sty
@@ -1,10 +1,10 @@
-% Package odsfile. Author Michal Hoftich <michal.h21@gmail.com>
+% Package tex4ebook. Author Michal Hoftich <michal.h21@gmail.com>
% This package is subject of LPPL license, version 1.3
\ProvidesPackage{tex4ebook}[2016/03/31 version 0.1d]
\RequirePackage{etoolbox}
\RequirePackage{kvoptions}
\RequirePackage{graphicx}
-% Command for generating NCX file. Hard work is odne in the file
+% Command for generating NCX file. The hard work is done in the file
% tex4ebook.4ht
\def\ncxtable{}
% Command for generating OPF file
@@ -122,18 +122,41 @@
\def\Author{Anonymous}
% We need to save values of title, author etc.
-%\AtBeginDocument{
-\let\origtitle\title
-\renewcommand\title[1]{%
- \origtitle{#1}
- \let\Title\@title
+\let\tf@orig@title\title
+
+% normal \title
+\newcommand\tf@title[1]{%
+ \tf@orig@title{#1}%
+ \let\Title\@title%
+}
+
+% \title with optional argument
+\newcommand\tf@opttitle[2][]{%
+ \tf@orig@title[#1]{#2}%
+ \let\Title\@title%
+}
+
+% some classes (amsart) define \title command with optional argument
+\renewcommand\title{%
+\@ifnextchar[\tf@opttitle\tf@title%
}
-\let\origauthor\author
-\renewcommand\author[1]{%
- \origauthor{#1}%
- \let\Author\@author
+\let\tf@orig@author\author
+\newcommand\tf@author[1]{%
+ \tf@orig@author{#1}%
+ \let\Author\@author%
}
+
+\newcommand\tf@optauthor[2][]{%
+ \tf@orig@author[#1]{#2}%
+ \let\Author\@author%
+}
+
+% support optiona argument for \author as well
+\renewcommand\author{%
+\@ifnextchar[\tf@optauthor\tf@author%
+}
+
%\let\Author\@author
\let\Date\today
\let\origdate\date