summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/tex4ebook
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-07-03 23:26:48 +0000
committerKarl Berry <karl@freefriends.org>2015-07-03 23:26:48 +0000
commitf71a40ca0224f4683054fbb9e1cf9fa26561f829 (patch)
tree62f2c1cda8a9743edfeb4b4634355f9cdf6ef951 /Master/texmf-dist/tex/latex/tex4ebook
parentf1073f0dfaaeabd2edda00c472a3d814fad132fa (diff)
tex4ebook (29jul15)
git-svn-id: svn://tug.org/texlive/trunk@37751 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/tex4ebook')
-rw-r--r--Master/texmf-dist/tex/latex/tex4ebook/tex4ebook-epub3.4ht113
-rw-r--r--Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht404
-rw-r--r--Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.sty113
3 files changed, 630 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook-epub3.4ht b/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook-epub3.4ht
new file mode 100644
index 00000000000..e7d75821123
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook-epub3.4ht
@@ -0,0 +1,113 @@
+%\typeout{!!!!!!!!!!!!!!!!!!!!!!!!!!!epub3!!!!!!!!!!!!}
+\Configure{NcxDoctype}{}
+\Configure{VERSION}{}
+
+% we must remove attributes from opf namespace
+\def\print:opf:scheme#1{}
+\Configure{OpfScheme}{}
+
+\Configure{OpfMetadata}{\HCode{<meta property="dcterms:modified">}\:iso:date\HCode{</meta>}}
+
+%%%%%%%%%%%%%%%%%%%%%%%
+%% Configure toc nav %%
+%%%%%%%%%%%%%%%%%%%%%%%
+\Configure{tableofcontents}{
+ \a:NavMap
+ \resettoclevels{part,chapter,section,subsection,subsubsection}
+ \navsection{part}{part,chapter,section,subsection,subsubsection}
+ \navsection{chapter}{chapter,section,subsection,subsubsection}
+ \navsection{section}{section,subsection,subsubsection}
+ \navsection{subsection}{subsection,subsubsection}
+ \navsection{subsubsection}{subsubsection}
+ %\HtmlParOff
+ \Configure{toTocLink}{}{}
+}{\b:NavMap}{}{}{}
+%%%%%%%%%%%
+\Configure{NavMap}{\ifvmode\IgnorePar\fi\EndP\boolfalse{tocnoempty}\HCode{<nav id="toc" epub:type="toc">\Hnewline<ol>}%
+\opf:registerfilename{\FileName}
+\opf:add:property{nav}
+}{\usetoclevels{part,chapter,section,subsection,subsubsection}%
+ \ifbool{tocnoempty}{}{\HCode{<li><a href="\jobname.\:html">Document</a></li>}}
+ \HCode{</ol></nav>}}
+%%%%%%%%%%%
+\Configure{NavSection}{%
+ \booltrue{tocnoempty}
+ \HCode{<li>}\setbox0=\hbox\bgroup}{\HCode{<ol>\Hnewline}}{\egroup}{\Tg</ol>\Tg</li>}
+%%%% End toc nav configuration
+\def\CoverMetadata#1{%
+\special{t4ht+@File: #1}%
+\Configure{OpfManifest}{\HCode{<item id="cover-image" properties="cover-image" href="#1" media-type="\a:CoverMimeType" />}}%
+}
+%\Configure{CoverImage}{%
+% \HPage{}%
+% \Configure{OpfManifest}{\HCode{<item id="cover-image" properties="cover-image" href="}\CoverImageName\HCode{" media-type="\a:CoverMimeType" />}}%
+ %\box0=\hbox\bgroup
+% \ifvmode \IgnorePar\fi \EndP%
+% \HCode{<section epub:type="cover">\Hnewline}}
+%}
+% {%\ifvmode \IgnorePar\fi \EndP%
+ %\HCode{</section>\Hnewline}%
+ %\EndHPage{}
+ %\egroup
+%}
+%\:CheckOption{mathml}
+%\if:Option
+\apptocmd{\a:DviMath}{\opf:registerfilename{\FileName}\opf:add:property{mathml}}{}{}
+%\fi
+\Configure{DOCTYPE}{\HCode{<!DOCTYPE html>\Hnewline}}
+\Configure{xmlns}{}{http://www.w3.org/1999/xhtml}
+\Configure{xmlns}{epub}{http://www.idpf.org/2007/ops}
+%\Configure{xmlns}{m}{http://www.w3.org/1998/Math/MathML}
+%\Configure{HTML}{\HCode{<html\t4ht:xmlns lang=\"}\GetLanguage\HCode{">\Hnewline}}{\HCode{\Hnewline</html>}}
+\Configure{HTML}{\HCode{<html\t4ht:xmlns lang="}\NoFonts\GetLanguage\EndNoFonts
+\HCode{">\Hnewline}}{\HCode{\Hnewline</html>}}
+\Configure{@HEAD}{}
+\Configure{@HEAD}{\HCode{<meta charset="UTF-8" />\Hnewline}}
+\Configure{@HEAD}{\HCode{<meta name="generator" content="TeX4ht
+ (http://www.cse.ohio-state.edu/\string~gurari/TeX4ht/)" />\Hnewline}}
+\Configure{@HEAD}{\HCode{<link
+ rel="stylesheet" type="text/css"
+ href="\expandafter\csname aa:CssFile\endcsname" />\Hnewline}}
+\Configure{EpubVersion}{3.0}
+\Configure{OpfItemProperties}{properties="}{"}
+
+% Structural elements
+
+% Foootnote configuration for epub3
+% Footnotes are printed directly after the paragraph they appeared in
+% footnotebox - configure box in which footnotes are printed
+% default configuration doesn't work in ibooks, don't know why
+\NewConfigure{footnotebox}{2}
+\Configure{footnotebox}{\HCode{<section epub:type="footnotes" class="footnotes">\Hnewline}}
+{\HCode{\Hnewline</section>\Hnewline}}
+\newbox\footnotebox
+% We must create new link command, so footnote mark can link to footnote text
+\LinkCommand\fnlink{aside,href,id,class="footnote" epub:type="footnote"}
+\Configure{footnotemark}{\NoFonts\Link[ epub:type="noteref"]{fn\FNnum x\minipageNum}{}}{\EndLink\EndNoFonts}
+\Configure{footnotetext}{\global\setbox\footnotebox=\vtop\bgroup\NoFonts%
+ \ifvoid\footnotebox\else\unvbox\footnotebox\fi%
+ \IgnorePar%
+ \bgroup%
+ \fnlink{}{fn\FNnum x\minipageNum}\NoFonts\Tg<p>%
+}{\EndNoFonts}
+{%
+ \HCode{</p>\Hnewline}
+ \Endfnlink\egroup\egroup}%
+
+\def\printfn{%
+ \ifvoid\footnotebox\else%
+ \a:footnotebox%
+ \box\footnotebox%
+ \b:footnotebox%
+ \fi%
+}
+
+% configure HtmlPar to print footnotebox.
+\Configure{HtmlPar}
+{\EndP\HCode{<p class="noindent">}}
+{\EndP\HCode{<p class="indent">}}
+{\HCode{</p>\Hnewline}\printfn}
+{\HCode{</p>\Hnewline}\printfn}
+
+\Css{.footnote{font-size:small;}}
+\Css{.footnotes hr{width:30\%;margin:0 auto 0 0;}}
diff --git a/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht b/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht
new file mode 100644
index 00000000000..81d137a8abb
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht
@@ -0,0 +1,404 @@
+%\NewConfigure{ncxtable}{}
+
+%Configure date meta info
+\def\:zeropadtwo#1{%
+ \ifnum #1<10 0\fi
+ #1% Then output the argument
+}% --- \zeroPadTwo ---
+\def\time:round:corr{\ifnum\the\numexpr\the\time-\the\time/60*60\relax<0 1\else 0\fi}
+\def\:iso:date{%
+ \the\year-%
+ \:zeropadtwo{\the\month}-%
+ \:zeropadtwo{\the\day}%
+ %Timestamp will be zero seconds
+ T\:zeropadtwo{\the\numexpr(\the\time/60)-\time:round:corr\relax}:%
+ \:zeropadtwo{\the\numexpr\the\time-((\the\time/60)-\time:round:corr)*60\relax}:%
+ 00Z}
+
+%General configuration
+\Configure{DOCTYPE}{\HCode{<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">}}
+
+\NewConfigure{EpubVersion}{1}
+\Configure{EpubVersion}{2.0}
+
+\NewConfigure{UniqueIdentifier}{1}
+\Configure{UniqueIdentifier}{http://example.com/\jobname}
+
+
+\NewConfigure{OpfScheme}{1}
+\Configure{OpfScheme}{URI}
+
+\NewConfigure{OpfMetadata}[1]{
+ \ifx\relax#1\relax%
+ \edef\a:OpfMetadata{}
+ \else
+ \edef\a:OpfMetadata{\a:OpfMetadata\HCode{\Hnewline}#1}
+ \fi
+}
+\Configure{OpfMetadata}{}
+
+% This commands add filenames to opf item list and spine
+\edef\opf:htmlfiles{}
+\newcount\opf:htmlid
+\def\opf:registerfilename#1{%
+ \ifcsdef{opf:entry#1}{}{%
+ \global\advance\opf:htmlid by1\relax
+ %\ifcsdef{opf:entry#1}{}{\csxdef{opf:entry#1}{Neni opf}}
+ \csxdef{opf:entry#1}{file\the\opf:htmlid}
+ \xdef\opf:htmlfiles{\opf:htmlfiles, #1}
+ }
+}
+
+\newcommand\OpfRegisterFile[1][\FileName]{\opf:registerfilename{#1}}
+
+\NewConfigure{OpfManifest}[1]{%
+ \ifx\relax#1\relax%
+ \edef\a:OpfManifest{}
+ \else
+ \edef\a:OpfManifest{\a:OpfManifest\HCode{\Hnewline}#1}
+ \fi
+}
+\Configure{OpfManifest}{}
+
+% This is for add properties like toc or cover image in opf manifest
+% Property must be added from document usinf \opf:add:property, current output filename is used
+\NewConfigure{OpfItemProperties}{2}
+\Configure{OpfItemProperties}{}{}
+\def\opf:properties#1{%
+\ifcsdef{opf:properties:#1}{
+\a:OpfItemProperties\csuse{opf:properties:#1}\b:OpfItemProperties%
+}{}%
+}
+\def\opf:add:property#1{%
+ \ifcsdef{opf:properties:\FileName #1}{}{%
+ \csxdef{opf:properties:\FileName #1}{#1}%
+ \ifcsdef{opf:properties:\FileName}{%
+ \edef\:opf:prop:tmp{\csuse{opf:properties:\FileName}}
+ \csxdef{opf:properties:\FileName}{\:opf:prop:tmp\space #1}
+ }{\csxdef{opf:properties:\FileName}{#1}}
+ }
+}
+
+% enable simple configuration from the .cfg file
+\newcommand\OpfAddProperty[1]{\opf:add:property{#1}}
+
+%Set property only once
+\def\opf:set:property#1{}
+
+% This code will refister \maketitle page to the opf file list
+\let\oldmktl\a:mktl
+\def\a:mktl{\oldmktl\opf:registerfilename{\FileName}}
+
+% guide element is used in epub2, it is similar to epub3 properties
+% in epub3, it is deprecated, but it can be present
+\edef\opf:guide{\HCode{<guide>\Hnewline}}
+
+% register file to the guide. first argument is optional filename, current
+% output name is used when empty. second is title and third type
+
+\NewConfigure{OpfGuide}{4}
+\newcommand\OpfGuide[3][]{%
+ \ifx\relax#1\relax \let\opf:guide:file\FileName\else\def\opf:guide:file{#1}\fi
+ \edef\opf:guide{\opf:guide\a:OpfGuide#3\b:OpfGuide#2\c:OpfGuide\opf:guide:file\d:OpfGuide}
+}
+
+\Configure{OpfGuide}{\HCode{<reference type="}}{\HCode{" title="}}{\HCode{" href="}}{\HCode{" />\Hnewline}}
+
+% is NavMap used anywhere?
+\NewConfigure{NavMap}{2}
+\NewConfigure{NavSection}{4}
+%Interface for setting xmlns
+\edef\t4ht:xmlns{}
+\NewConfigure{xmlns}[2]{%
+ \ifx\relax#2\relax%
+ \edef\t4ht:xmlns{}%
+ \else%
+ %\def\:prefix:xmlns{\ifx\relax#1\relax\else:#1\fi}
+ \edef\t4ht:xmlns{\t4ht:xmlns xmlns\ifx\relax#1\relax\else :#1\fi="#2"}%
+ \fi%
+}
+
+\NewConfigure{CoverImage}{2}
+\Configure{CoverImage}{%
+\ifvmode\IgnorePar\fi\EndP\HCode{<div class="cover-image">\Hnewline}
+}{\HCode{</div>\Hnewline}\par}
+\def\CoverMetadata#1{%
+\special{t4ht+@File: #1}%
+\Configure{OpfMetadata}
+{\HCode{<meta name="cover" content="cover-image" />\Hnewline}}
+\Configure{OpfManifest}
+{\HCode{<item id="cover-image"
+href="#1" media-type="\a:CoverMimeType" />}}
+}
+\renewcommand\coverimage[2][]{%
+\edef\CoverImageName{#2}%
+\CoverMetadata{#2}
+\a:CoverImage%
+\includegraphics[#1]{#2}%
+\b:CoverImage%
+}
+
+\NewConfigure{CoverMimeType}{1}
+\Configure{CoverMimeType}{image/png}
+
+\TocAt-{part,chapter,section,subsection,subsubsection}
+\Configure{crosslinks*}{}
+
+\NewConfigure{NcxDoctype}{1}
+\Configure{NcxDoctype}{\HCode{<!DOCTYPE ncx PUBLIC "-//NISO//DTD ncx 2005-1//EN"\Hnewline
+ "http://www.daisy.org/z3986/2005/ncx-2005-1.dtd">\Hnewline}}
+
+%Get sanitized value of \title
+%\def\Title{\Ref{TITLE+}}
+% If title contains macros, SafeTitle should be configured
+% in the custom cfg file
+\NewConfigure{SafeTitle}[1]{\gdef\Title{#1}}
+
+% add main html as first file in the OPF
+\opf:registerfilename{\jobname.\:html} %
+\:CheckOption{epub}
+\if:Option
+%\Configure{crosslinks+}{}{}{}{}
+
+% add explicit table of contents to OPF
+\let\old:toc\a:tableofcontents
+\def\a:tableofcontents{\old:toc\OpfRegisterFile}
+
+
+\def\patch:sec:register#1{%
+\csgappto{c:#1}{\OpfRegisterFile}%
+}
+\patch:sec:register{part}
+\patch:sec:register{chapter}
+\patch:sec:register{section}
+\patch:sec:register{subsection}
+\patch:sec:register{subsubsection}
+\patch:sec:register{likechapter}
+\patch:sec:register{likesection}
+\patch:sec:register{likesubsection}
+\patch:sec:register{likesubsubsection}
+
+% Support for SVG isn't ready
+%\Configure{Picture}{.svg}
+\Configure{Picture}{.png}
+\Configure{PicDisplay}
+ {\edef\MathPar{\ifvmode par-\fi}\IgnorePar\endgraf\EndP
+ \HCode{<div class="\MathPar math-display">}}
+ {\HCode{</div>}} {} {class="\MathPar math-display" }
+\Configure{()}{$}{$}
+\fi
+\:CheckOption{kindle} \if:Option
+\Configure{Picture}{.png}
+\fi
+
+%%
+% We must test, it tableofcontents is empty, if yes, we must take special care to navmap
+\newbool{tocnoempty}
+
+\newcount\navpoint
+\def\stepnavpoint{\advance\navpoint by1\relax\the\navpoint}
+
+% define points for breaking section units to html pages
+% we need to break long documents to smaller chunks, because e-readers are
+% generally pretty weak devices
+% use no-cut option if you don't want to break sections, or if you
+% use your own cutting scheme in your .cfg file
+\:CheckOption{no-cut}\if:Option\else
+\ifdef\chapter{%
+ %\CutAt{chapter}\CutAt{likechapter}
+ % copied from tex4ht-html4.tex
+ \CutAt{chapter,likechapter,appendix,part}
+ \CutAt{likechapter,appendix,part}
+ \CutAt{appendix,chapter,likechapter,part}
+}{%
+ %\CutAt{section}\CutAt{likesection}}
+ \CutAt{section,likesection,part}
+ \CutAt{likesection,part}
+
+}
+\fi
+
+% Commands for support of hiearchical table of contents
+% Support for: chapter, section, subsection
+
+\def\resettoclevels#1{%
+ \def\do##1{\csgdef{nav##1finish}{}}
+ \docsvlist{#1}
+}
+\def\usetoclevels#1{%
+ \def\do##1{\csuse{nav##1finish}}%
+ \docsvlist{#1}%
+}
+\def\finishtoclevel#1{%
+ \csgdef{nav#1finish}{\d:NavSection}
+}
+\def\closelevels#1{
+ \usetoclevels{#1}
+ \resettoclevels{#1}
+}
+% 1 - section type 2 - closed sections
+
+\def\navsection#1#2{
+ \ConfigureToc{#1}%
+ {\closelevels{#2}%
+ \a:NavSection\Ncx:Mark}
+ {\c:NavSection}
+ {}
+ {\b:NavSection%
+ \finishtoclevel{#1}%
+ }
+}
+
+% As reported by Nat Kuhn on http://tex.stackexchange.com/q/209312/2891
+% zeroes were printed as section numbers when secnumdepth counter was set to negative value
+% so just strip then out
+% \TitleMark does similar thing, but this solution is simpler, I hope it works correctly
+\def\Ncx:Mark#1{%
+ \edef\:temp{#1}
+ \def\z@ro{0}
+ \ifx\:temp\z@ro\else#1\fi
+}
+
+
+%
+\def\ncx:head{%
+\HCode{<head>\Hnewline}
+\HCode{<meta name="dtb:uid" content="\a:UniqueIdentifier"/>\Hnewline}
+\HCode{<meta name="dtb:depth" content="3"/>\Hnewline}
+\HCode{<meta name="dtb:totalPageCount" content="0"/>\Hnewline}
+\HCode{<meta name="dtb:maxPageNumber" content="0"/>\Hnewline}
+\HCode{</head>\Hnewline}
+}
+
+\def\ncx:title{%
+ \HCode{<docTitle>\Hnewline<text>}\Title\HCode{</text>\Hnewline</docTitle>\Hnewline}
+}
+
+% Get filename from tableofcontents anchor
+\def\ncx:hfile#1{\Ref{)F\Ref{)Q#1}F-}}
+
+\def\:tempa{%
+\EndP
+\HtmlParOff
+\setcounter{tocdepth}{3}
+\special{t4ht>\jobname.ncx}
+% We don't want crosslinks in xml
+% Basic sctructure of the ncx file
+\NoFonts
+{\HCode{<?xml version="1.0"?>\Hnewline}}
+{\a:NcxDoctype}
+{\Tg<ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1">}{}
+% To print document map, we customize the tableofcontents. We don't want TOC title,
+% so:
+\let\contentsname=\empty
+\Configure{tableofcontents}{\boolfalse{tocnoempty}\Tg<navMap>}{%
+ \usetoclevels{part,chapter,likechapter,section,likesection,subsection,likesubsection,subsubsection,likesubsubsection}%
+ \ifbool{tocnoempty}{}%
+ {\HCode{<navPoint id="mainentry" playOrder=1>
+ <navLabel><text>Document</text></navLabel>
+ <content src="\jobname.\:html" />
+ </navPoint>}}%
+ \Tg</navMap>}{}{}{}
+% We need to configure TocLink
+% in navmapsrc is link to the file and anchor, where chapter or section is located
+\def\navmapsrc{}
+\Configure{TocLink}{\def\navmapsrc{\ncx:hfile{##2}\:sharp ##2}\opf:registerfilename{\ncx:hfile{##2}}##4}
+% Configuraion of entries
+\resettoclevels{part,chapter,section,subsection,subsubsection}
+\navsection{part}{part,chapter,likechapter,section,likesection,subsection,likesubsection,subsubsection,likesubsubsection}
+\navsection{chapter}{chapter,likechapter,section,likesection,subsection,likesubsection,subsubsection,likesubsubsection}
+\navsection{likechapter}{chapter,likechapter,section,likesection,subsection,likesubsection,subsubsection,likesubsubsection}
+\navsection{section}{section,likesection,subsection,likesubsection,subsubsection,likesubsubsection}
+\navsection{likesection}{section,likesection,subsection,likesubsection,subsubsection,likesubsubsection}
+\navsection{subsection}{subsection,likesubsection,subsubsection,likesubsubsection}
+\navsection{likesubsection}{subsection,likesubsection,subsubsection,likesubsubsection}
+\navsection{subsubsection}{subsubsection,likesubsubsection}
+\navsection{likesubsubsection}{subsubsection,likesubsubsection}
+ \HtmlParOff
+ \Configure{toTocLink}{}{}
+ \Configure{NavSection}{\booltrue{tocnoempty}\HCode{\Hnewline<navPoint id="navPoint-}%
+ \stepnavpoint\HCode{" playOrder="}%
+ \the\navpoint\HCode{">\Hnewline<navLabel>\Hnewline<text>}%
+}{\HCode{</text>\Hnewline%
+ </navLabel>\Hnewline}%
+ \HCode{<content src="\navmapsrc" />}%
+}{ }{\HCode{</navPoint>\Hnewline}}
+% Meta inf
+\ncx:head
+% Book title
+\ncx:title
+\tableofcontents%[part,chapter,likechapter,section,likesection,subsection,likesubsection]%
+%Hack to get close tag working
+\HCode{</ncx>}
+\EndNoFonts
+\special{t4ht<\jobname.ncx}
+ \HtmlParOn
+}
+\let\ncxtable\:tempa
+%\else
+%\fi
+
+\def\print:opf:scheme#1{ opf:scheme="#1"}
+\def\:tempa{%
+\bgroup
+\setcounter{tocdepth}{3}
+% Basic sctructure of the opf file
+\special{t4ht>content.opf}
+\NoFonts
+\HtmlParOff
+{\HCode{<?xml version="1.0"?>\Hnewline}}
+\HCode{<package xmlns="http://www.idpf.org/2007/opf" unique-identifier="dcidid"
+ version="\a:EpubVersion">\Hnewline}
+{\HCode{<metadata\Hnewline xmlns:dc="http://purl.org/dc/elements/1.1/"\Hnewline xmlns:opf="http://www.idpf.org/2007/opf">\Hnewline}}
+{\HCode{<dc:title>}\Title\HCode{</dc:title>\Hnewline}}
+{\HCode{<dc:language>}\GetLanguage\HCode{</dc:language>\Hnewline}}
+%Add interface for such things
+{\HCode{<dc:identifier id="dcidid" \print:opf:scheme\a:OpfScheme>\a:UniqueIdentifier}\HCode{</dc:identifier>\Hnewline}}
+\def\and{<\HCode{/dc:creator>\Hnewline<dc:creator>}}
+{\HCode{<dc:creator>}\Author\HCode{</dc:creator>\Hnewline}}
+%{\HCode{<dc:contributor>\HP:file</dc:contributor>\Hnewline}}
+{\HCode{<dc:date>}\:iso:date\HCode{</dc:date>}}
+\a:OpfMetadata
+\Tg</metadata>
+% To print document map, we customize the tableofcontents. We don't want TOC title,
+% so:
+\let\contentsname=\empty
+%\Configure{tableofcontents}{\Tg<navMap>}{\usetoclevels{part,chapter,section,subsection,subsubsection}\Tg</navMap>}{}{}{}
+% We need to configure TocLink
+% in navmapsrc is link to the file and anchor, where chapter or section is located
+\def\navmapsrc{}
+\HCode{\Hnewline<manifest>\Hnewline}
+\HCode{<item id="ncx" href="\jobname.ncx" media-type="application/x-dtbncx+xml" />\Hnewline}
+\HCode{<item id="stylesheet" href="\jobname.css" media-type="text/css"/>\Hnewline}
+\renewcommand\do[1]{\HCode{<item id="\csuse{opf:entry##1}" \opf:properties{##1} href="##1" media-type="application/xhtml+xml" />\Hnewline}}
+\expandafter\docsvlist\expandafter{\opf:htmlfiles}
+\a:OpfManifest
+%\Tg<manifest>
+\special{t4ht<content.opf}
+\special{t4ht>content-part2.opf}
+\HCode{</manifest>\Hnewline}
+\renewcommand\do[1]{\HCode{<itemref idref="\csuse{opf:entry##1}" />\Hnewline}}
+\HCode{\Hnewline<spine toc="ncx">\Hnewline}
+\expandafter\docsvlist\expandafter{\opf:htmlfiles}
+% Next line is pattern to be replaced by lua code
+\HCode{\Hnewline$\string{spine\string}\Hnewline}
+\HCode{</spine>\Hnewline}
+% insert guide
+\opf:guide
+\HCode{</guide>}
+% Hack to get close tag working
+\HCode{</package>}
+\special{t4ht<content-part2.opf}
+\HtmlParOn
+\EndNoFonts
+\egroup
+%Hack!!
+%\Configure{BODY}{}{\Tg</body>}
+%\Configure{HTML}{}{\HCode{\Hnewline</html>\Hnewline}}%<!-- -->\Hnewline}}
+}
+\let\opftable\:tempa
+
+\:CheckOption{epub3}
+\if:Option
+\input tex4ebook-epub3.4ht
+\fi
diff --git a/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.sty b/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.sty
new file mode 100644
index 00000000000..965a470bac5
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.sty
@@ -0,0 +1,113 @@
+\ProvidesPackage{tex4ebook}
+\RequirePackage{etoolbox}
+\RequirePackage{kvoptions}
+\RequirePackage{graphicx}
+% Command for generating NCX file. Hard work is odne in the file
+% tex4ebook.4ht
+\def\ncxtable{}
+% Command for generating OPF file
+\def\opftable{}
+
+%Declare RFC3066 language code for babel language name
+\def\DeclareLanguage#1#2{%
+\csgdef{rfclang#1}{#2}%
+}
+\def\GetLanguage{%
+\ifx\bbl@main@language\@undefined en-US%
+\else%
+\ifcsdef{rfclang\bbl@main@language}{\csuse{rfclang\bbl@main@language}}{}%
+\fi%
+}
+
+\DeclareLanguage{english}{en-US}
+\DeclareLanguage{czech}{cs-CZ}
+\DeclareLanguage{french}{fr}
+\DeclareLanguage{polish}{pl-PL}
+\DeclareLanguage{german}{de}
+\DeclareLanguage{bulgarian}{bg}
+\DeclareLanguage{catalan}{ca}
+\DeclareLanguage{croatian}{hr}
+\DeclareLanguage{danish}{da}
+\DeclareLanguage{dutch}{nl}
+\DeclareLanguage{USenglish}{en-US}
+\DeclareLanguage{american}{en-US}
+\DeclareLanguage{UKenglish}{en-GB}
+\DeclareLanguage{british}{en-GB}
+\DeclareLanguage{canadian}{en-US}
+\DeclareLanguage{australian}{en-US}
+\DeclareLanguage{newzealand}{en-US}
+\DeclareLanguage{esperanto}{eo}
+\DeclareLanguage{estonian}{et}
+\DeclareLanguage{finnish}{f\/i}
+\DeclareLanguage{francais}{fr}
+\DeclareLanguage{canadien}{fr}
+\DeclareLanguage{acadian}{fr}
+\DeclareLanguage{galician}{gl}
+\DeclareLanguage{austrian}{de}
+\DeclareLanguage{german}{de}
+\DeclareLanguage{germanb}{de}
+\DeclareLanguage{ngerman}{de}
+\DeclareLanguage{naustrian}{de}
+\DeclareLanguage{greek}{el}
+\DeclareLanguage{polutonikogreek}{el}
+\DeclareLanguage{hebrew}{he}
+\DeclareLanguage{magyar}{hu}
+\DeclareLanguage{hungarian}{hu}
+\DeclareLanguage{icelandic}{is}
+\DeclareLanguage{interlingua}{ie}
+\DeclareLanguage{irish}{ga}
+\DeclareLanguage{italian}{it}
+\DeclareLanguage{latin}{la}
+%\DeclareLanguage{lowersorbian}{no code?}
+%\DeclareLanguage{samin}{no code?}
+\DeclareLanguage{norsk}{no}
+\DeclareLanguage{nynorsk}{no}
+\DeclareLanguage{portuges}{pt}
+\DeclareLanguage{portuguese}{pt}
+\DeclareLanguage{brazilian}{pt}
+\DeclareLanguage{brazil}{pt}
+\DeclareLanguage{romanian}{ro}
+\DeclareLanguage{russian}{ru}
+%\DeclareLanguage{scottish}{no code?}
+\DeclareLanguage{spanish}{es}
+\DeclareLanguage{slovak}{sk}
+\DeclareLanguage{slovene}{sl}
+\DeclareLanguage{swedish}{sv}
+\DeclareLanguage{serbian}{sr}
+\DeclareLanguage{turkish}{tr}
+\DeclareLanguage{ukrainian}{uk}
+%\DeclareLanguage{uppersorbian}{no code?}
+\DeclareLanguage{welsh}{cy}
+
+\AtEndDocument{%
+\ncxtable
+\opftable
+}
+
+% Default empty values
+\def\Title{Unnamed}
+\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\origauthor\author
+\renewcommand\author[1]{%
+ \origauthor{#1}%
+ \let\Author\@author
+}
+%\let\Author\@author
+\let\Date\today
+\let\origdate\date
+\renewcommand\date[1]{%
+ \origdate{#1}%
+ \let\Date\@date%
+}
+%}
+
+\newcommand\coverimage[2][]{\includegraphics[#1]{#2}}