summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-04-09 21:19:50 +0000
committerKarl Berry <karl@freefriends.org>2018-04-09 21:19:50 +0000
commit9b15e307f4036a19f6e40fc2672ddc90ed1d5812 (patch)
tree432ba6ea3a93304f45a2752e873fd593cbe6b324 /Master
parent2ab2eba6c86168c5190e2aae2e521821ea624728 (diff)
tex4ebook (9apr18)
git-svn-id: svn://tug.org/texlive/trunk@47414 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/support/tex4ebook/README18
-rw-r--r--Master/texmf-dist/doc/support/tex4ebook/changelog.tex200
-rw-r--r--Master/texmf-dist/doc/support/tex4ebook/readme.tex103
-rw-r--r--Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdfbin69209 -> 72637 bytes
-rw-r--r--Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.tex6
-rwxr-xr-xMaster/texmf-dist/scripts/tex4ebook/exec_epub.lua4
-rwxr-xr-xMaster/texmf-dist/scripts/tex4ebook/exec_epub3.lua68
-rwxr-xr-xMaster/texmf-dist/scripts/tex4ebook/tex4ebook37
8 files changed, 302 insertions, 134 deletions
diff --git a/Master/texmf-dist/doc/support/tex4ebook/README b/Master/texmf-dist/doc/support/tex4ebook/README
index 2314aa3478b..d6ba3c51f23 100644
--- a/Master/texmf-dist/doc/support/tex4ebook/README
+++ b/Master/texmf-dist/doc/support/tex4ebook/README
@@ -1,3 +1,5 @@
+% [![Build Status](https://travis-ci.org/michal-h21/tex4ebook.svg?branch=master)](https://travis-ci.org/michal-h21/tex4ebook)
+
# Introduction
`TeX4ebook` is bundle of Lua scripts and `LaTeX` packages for conversion of
@@ -128,7 +130,7 @@ and in series of blogposts on CV Radhakrishnan's blog:
*Configure part 2*^[http://www.cvr.cc/?p=362],
*Low level commands*^[http://www.cvr.cc/?p=482].
Available options for `\Preamble` command are listed in the article
-*TeX4ht: options*^[http://www.cvr.cc/?p=504].
+*TeX4ht: options*^[http://www.cvr.cc/?p=504]. *Comparison of tex4ebook and Pandoc output*^[https://github.com/richelbilderbeek/travis_tex_to_epub_example_1]
Great source of tips for `tex4ht` configuring is *tex4ht tag on TeX.sx*^[http://tex.stackexchange.com/questions/tagged/tex4ht], there is also a *tag for tex4ebook*^[http://tex.stackexchange.com/questions/tagged/tex4ebook].
@@ -216,6 +218,20 @@ Add xml name space to `xhtml` files. Useful in `EPUB 3`
`tex4ebook` uses `make4ht`^[https://github.com/michal-h21/make4ht] as a build
system. See `make4ht` documentation for details on build files.
+## `.tex4ebook` configuration file
+
+It is possible to globally modify the build settings using the configuration
+file. New compilation commands can be added, extensions can be loaded or
+disabled and settings can be set.
+
+### Location
+
+The configuration file can be saved either in
+`$HOME/.config/tex4ebook/config.lua` or in `.tex4ebook` in the current directory or
+it's parents (up to `$HOME`).
+
+See the `make4ht` documentation for an example and more information.
+
# Troubleshooting
When compilation of the document breaks with error during `LaTeX` run, it may
diff --git a/Master/texmf-dist/doc/support/tex4ebook/changelog.tex b/Master/texmf-dist/doc/support/tex4ebook/changelog.tex
index 1b59f20d4ad..a331c7b3db3 100644
--- a/Master/texmf-dist/doc/support/tex4ebook/changelog.tex
+++ b/Master/texmf-dist/doc/support/tex4ebook/changelog.tex
@@ -1,11 +1,52 @@
-\section{Changes}\label{changes}
+\hypertarget{changes}{%
+\section{Changes}\label{changes}}
\begin{itemize}
\item
+ 06/04/2018
+
+ \begin{itemize}
+ \tightlist
+ \item
+ documented the configuration file
+ \end{itemize}
+\item
+ 02/03/2018
+
+ \begin{itemize}
+ \tightlist
+ \item
+ added support for \texttt{.tex4ebook} configuration file
+ \end{itemize}
+\item
+ 28/02/2018
+
+ \begin{itemize}
+ \tightlist
+ \item
+ added media overlays handling
+ \end{itemize}
+\item
+ 19/10/2017
+
+ \begin{itemize}
+ \tightlist
+ \item
+ added support for XeTeX
+ \end{itemize}
+\item
+ 06/10/2017
+
+ \begin{itemize}
+ \tightlist
+ \item
+ added support for Make4ht extensions
+ \end{itemize}
+\item
27/04/2017 Version 0.1e
\begin{itemize}
- \itemsep1pt\parskip0pt\parsep0pt
+ \tightlist
\item
pack the accumulated changes for distribution
\item
@@ -15,7 +56,7 @@
17/01/2017
\begin{itemize}
- \itemsep1pt\parskip0pt\parsep0pt
+ \tightlist
\item
process duplicate images only once
\item
@@ -25,7 +66,7 @@
11/01/2017
\begin{itemize}
- \itemsep1pt\parskip0pt\parsep0pt
+ \tightlist
\item
pass \texttt{settings} table to the build file.
\end{itemize}
@@ -33,16 +74,16 @@
19/12/2016
\begin{itemize}
- \itemsep1pt\parskip0pt\parsep0pt
+ \tightlist
\item
new configuration:
- \texttt{\textbackslash{}Configure\{resettoclevels\}\{list of sectioning levels to be included in the NCX\}}
+ \texttt{\textbackslash{}Configure\{resettoclevels\}\{list\ of\ sectioning\ levels\ to\ be\ included\ in\ the\ NCX\}}
\end{itemize}
\item
31/10/2016
\begin{itemize}
- \itemsep1pt\parskip0pt\parsep0pt
+ \tightlist
\item
added tidyconf.conf to the Makefile
\end{itemize}
@@ -50,7 +91,7 @@
22/10/2016
\begin{itemize}
- \itemsep1pt\parskip0pt\parsep0pt
+ \tightlist
\item
added support for new Make4ht command \texttt{Make:add\_file}
\end{itemize}
@@ -58,7 +99,7 @@
22/08/2016
\begin{itemize}
- \itemsep1pt\parskip0pt\parsep0pt
+ \tightlist
\item
fixed incorrect \texttt{\textless{}dc:creator\textgreater{}}
generated by \texttt{\textbackslash{}author}
@@ -70,7 +111,7 @@
31/07/2016
\begin{itemize}
- \itemsep1pt\parskip0pt\parsep0pt
+ \tightlist
\item
use monospace font for command line options in order to prevent
double hyphens to become dashes by ligaturing
@@ -79,15 +120,15 @@
22/07/2016
\begin{itemize}
- \itemsep1pt\parskip0pt\parsep0pt
+ \tightlist
\item
- removed debugging message when \texttt{-{}-lua} option is used
+ removed debugging message when \texttt{-\/-lua} option is used
\end{itemize}
\item
07/04/2016
\begin{itemize}
- \itemsep1pt\parskip0pt\parsep0pt
+ \tightlist
\item
Cut \texttt{\textbackslash{}part} commands to standalone pages
\end{itemize}
@@ -95,7 +136,7 @@
05/04/2016
\begin{itemize}
- \itemsep1pt\parskip0pt\parsep0pt
+ \tightlist
\item
bug fix: pages which contained math were arranged before other pages
\end{itemize}
@@ -103,7 +144,7 @@
31/03/2016 Version 0.1d
\begin{itemize}
- \itemsep1pt\parskip0pt\parsep0pt
+ \tightlist
\item
bug fix: Unicode wasn't used by default
\item
@@ -113,16 +154,16 @@
06/12/2015 Version 0.1c
\begin{itemize}
- \itemsep1pt\parskip0pt\parsep0pt
+ \tightlist
\item
- added \texttt{-{}-help} and \texttt{-{}-version} command line
+ added \texttt{-\/-help} and \texttt{-\/-version} command line
options
\end{itemize}
\item
25/11/2015
\begin{itemize}
- \itemsep1pt\parskip0pt\parsep0pt
+ \tightlist
\item
added missing language codes
\item
@@ -133,7 +174,7 @@
17/11/2015
\begin{itemize}
- \itemsep1pt\parskip0pt\parsep0pt
+ \tightlist
\item
use mkparams for cli arguments handling.
\item
@@ -144,7 +185,7 @@
24/09/2015 Version 0.1b
\begin{itemize}
- \itemsep1pt\parskip0pt\parsep0pt
+ \tightlist
\item
info about new workaround for \texttt{fontspec} package
\end{itemize}
@@ -152,7 +193,7 @@
25/08/2015
\begin{itemize}
- \itemsep1pt\parskip0pt\parsep0pt
+ \tightlist
\item
fatal error happened with epub3 when the document didn't contain the
TOC
@@ -161,7 +202,7 @@
23/08/2015
\begin{itemize}
- \itemsep1pt\parskip0pt\parsep0pt
+ \tightlist
\item
simple cleaning of the ncx file if tidy command isn't available
\end{itemize}
@@ -169,7 +210,7 @@
05/07/2015 Version 0.1a
\begin{itemize}
- \itemsep1pt\parskip0pt\parsep0pt
+ \tightlist
\item
\texttt{tex4ebook} script was missing in the distribution zip file
\item
@@ -179,7 +220,7 @@
29/06/2015 Version 0.1
\begin{itemize}
- \itemsep1pt\parskip0pt\parsep0pt
+ \tightlist
\item
fixes in documentation
\end{itemize}
@@ -187,7 +228,7 @@
22/06/2015
\begin{itemize}
- \itemsep1pt\parskip0pt\parsep0pt
+ \tightlist
\item
changes moved from README.md to CHANGELOG.md
\end{itemize}
@@ -195,9 +236,9 @@
18/06/2015
\begin{itemize}
- \itemsep1pt\parskip0pt\parsep0pt
+ \tightlist
\item
- replaced \texttt{-{}-mathml} option with \texttt{-{}-mode}. For
+ replaced \texttt{-\/-mathml} option with \texttt{-\/-mode}. For
\texttt{mathml} support, use\texttt{mathml} option for
\texttt{tex4ht.sty}.
\item
@@ -208,82 +249,61 @@
\item
14/01/2015
- \begin{itemize}
- \itemsep1pt\parskip0pt\parsep0pt
- \item
- thanks Volker Gottwald for guide on
- \href{https://d800fotos.wordpress.com/2015/01/19/create-e-books-from-latex-tex-files-ebook-aus-latex-tex-dateien-erstellen/}{installing
- and using tex4ebook} on Windows
- \end{itemize}
+\begin{verbatim}
+- thanks Volker Gottwald for guide on [installing and using
+ tex4ebook](https://d800fotos.wordpress.com/2015/01/19/create-e-books-from-latex-tex-files-ebook-aus-latex-tex-dateien-erstellen/)
+ on Windows
+\end{verbatim}
\item
23/11/2014
- \begin{itemize}
- \item
- added new command \texttt{\textbackslash{}OpfGuide}, for adding
- items to \texttt{\textless{}guide\textgreater{}} section in the
- \texttt{opf} file. This is useful for \texttt{epub} and
- \texttt{mobi} formats.
+\begin{verbatim}
+- added new command `\OpfGuide`, for adding items to `<guide>`
+ section in the `opf` file. This is useful for `epub` and `mobi` formats.
- Usage:
+ Usage:
-\begin{verbatim}
- \OpfGuide[filename]{title}{reference type}
-\end{verbatim}
+ \OpfGuide[filename]{title}{reference type}
- \texttt{filename} is optional, current file name is used when empty.
- See
- \href{http://epubsecrets.com/where-do-you-start-an-epub-and-what-is-the-guide-section-of-the-opf-file.php}{epub
- secrets} article
- \end{itemize}
+ `filename` is optional, current file name is used when empty. See
+ [epub
+ secrets](http://epubsecrets.com/where-do-you-start-an-epub-and-what-is-the-guide-section-of-the-opf-file.php)
+ article
+\end{verbatim}
\item
20/10/2014
- \begin{itemize}
- \item
- fixed issues with starred sections
- \item
- files created with starred sectioning commands
- (\texttt{\textbackslash{}chapter*},
- \texttt{\textbackslash{}section*}) should be included in correct
- reading order now
- \end{itemize}
+\begin{verbatim}
+ - fixed issues with starred sections
+
+ - files created with starred sectioning commands (`\chapter*`,
+ `\section*`) should be included in correct reading order now
+\end{verbatim}
\item
16/09/2014
- \begin{itemize}
- \itemsep1pt\parskip0pt\parsep0pt
- \item
- new features added
- \item
- new configuration file for \texttt{-{}-tidy} option, mathml and
- html5 elements are supported. This means that many validation errors
- in \texttt{mathml} output can be fixed with \texttt{-{}-tidy} option
- \item
- added configuration for all languages supported by \texttt{babel}
- \item
- \texttt{woff} and \texttt{ttf} fonts are supported
- \item
- added inline footlines in \texttt{epub3} format
- \item
- added \texttt{no-cut} command line option for breaking sections and
- chapters into standalone pages
- \item
- Please support
- \href{http://www.ulule.com/mathematics-ebooks/}{iniciative for
- improving mathml support} in Gecko and Webkit engines. This will
- hopefully improve also Epub3 readers.
- \end{itemize}
+\begin{verbatim}
+ - new features added
+ - new configuration file for `--tidy` option, mathml and html5 elements
+ are supported. This means that many validation errors in `mathml`
+ output can be fixed with `--tidy` option
+ - added configuration for all languages supported by `babel`
+ - `woff` and `ttf` fonts are supported
+ - added inline footlines in `epub3` format
+ - added `no-cut` command line option for breaking sections and chapters
+ into standalone pages
+ - Please support [iniciative for improving mathml
+ support](http://www.ulule.com/mathematics-ebooks/) in Gecko and Webkit
+ engines. This will hopefully improve also Epub3 readers.
+\end{verbatim}
\item
10/08/2013
- \begin{itemize}
- \itemsep1pt\parskip0pt\parsep0pt
- \item
- \href{https://github.com/michal-h21/make4ht}{\texttt{make4ht}} is
- now standalone application which \texttt{tex4ebook} depends on. You
- must
- \href{https://github.com/michal-h21/make4ht\#instalation}{install
- it} in order to use current \texttt{tex4ebook} version.
- \end{itemize}
+\begin{verbatim}
+ - [`make4ht`](https://github.com/michal-h21/make4ht) is now standalone
+ application which `tex4ebook` depends on. You must [install
+\end{verbatim}
+
+ it{]}(https://github.com/michal-h21/make4ht\#instalation) in order to
+ use current \texttt{tex4ebook} version.
\end{itemize}
diff --git a/Master/texmf-dist/doc/support/tex4ebook/readme.tex b/Master/texmf-dist/doc/support/tex4ebook/readme.tex
index e5078cfe866..e8ef08d4df8 100644
--- a/Master/texmf-dist/doc/support/tex4ebook/readme.tex
+++ b/Master/texmf-dist/doc/support/tex4ebook/readme.tex
@@ -1,4 +1,5 @@
-\section{Introduction}\label{introduction}
+\hypertarget{introduction}{%
+\section{Introduction}\label{introduction}}
\texttt{TeX4ebook} is bundle of Lua scripts and \texttt{LaTeX} packages
for conversion of LaTeX files to ebook formats, for example
@@ -24,12 +25,14 @@ well, but you should use custom configurations if you want to make the
document more visually appealing. You can include custom \texttt{CSS} or
fonts in configuration files.
-\subsection{License}\label{license}
+\hypertarget{license}{%
+\subsection{License}\label{license}}
Permission is granted to copy, distribute and/or modify this software
under the terms of the LaTeX Project Public License, version 1.3.
-\section{Usage}\label{usage}
+\hypertarget{usage}{%
+\section{Usage}\label{usage}}
Run on the command line:
@@ -51,20 +54,21 @@ document preamble:
but it is optional. You shouldn't need to modify your \TeX~files
-\subsection{Available commands}\label{available-commands}
+\hypertarget{available-commands}{%
+\subsection{Available commands}\label{available-commands}}
\begin{itemize}
-\itemsep1pt\parskip0pt\parsep0pt
+\tightlist
\item
\texttt{\textbackslash{}coverimage\{coverimage.name\}} - include cover
image to the document.
\end{itemize}
-\section{Command line options}\label{command-line-options}
+\hypertarget{command-line-options}{%
+\section{Command line options}\label{command-line-options}}
\begin{description}
-\itemsep1pt\parskip0pt\parsep0pt
-\item[\texttt{-c,-{}-config}]
+\item[\texttt{-c,-\/-config}]
specify custom config file for \texttt{tex4ht}
\end{description}
@@ -87,33 +91,34 @@ This config file will create \texttt{xhtml} file for every section. Note
that this behaviour is default.
\begin{description}
-\item[\texttt{-e,-{}-build-file (default nil)}]
+\item[\texttt{-e,-\/-build-file\ (default\ nil)}]
Specify make4ht build file\footnote{\url{https://github.com/michal-h21/make4ht\#build-file}}.
Defaulf build file filename is \texttt{filename.mk4}, use this option if
you use different filename.
-\item[\texttt{-f,-{}-format (default epub)}]
+\item[\texttt{-f,-\/-format\ (default\ epub)}]
Output format. epub, epub3 and mobi are supported.
-\item[\texttt{-l,-{}-lua}]
+\item[\texttt{-l,-\/-lua}]
Runs htlualatex instead of htlatex.
-\item[\texttt{-m,-{}-mode (default default)}]
+\item[\texttt{-m,-\/-mode\ (default\ default)}]
This set \texttt{mode} variable, accessible in the build file. Default
supported values are \texttt{default} and \texttt{draft}. In
\texttt{draft} mode, document is compiled only once, instead of three
times.
-\item[\texttt{-r,-{}-resolution}]
+\item[\texttt{-r,-\/-resolution}]
Resolution of generated images, for example math. It should meet
resolution of target devices, which is usually about 167 ppi.
-\item[\texttt{-s,-{}-shell-escape}]
+\item[\texttt{-s,-\/-shell-escape}]
Enable shell escape in htlatex run. This may be needed if you run
external commands from your source files.
-\item[\texttt{-t,-{}-tidy}]
-process output html files with \texttt{HTML tidy} command\footnote{It
+\item[\texttt{-t,-\/-tidy}]
+process output html files with \texttt{HTML\ tidy} command\footnote{It
needs to be installed separately}.
-\item[\texttt{-v,-{}-version}]
+\item[\texttt{-v,-\/-version}]
print version number
\end{description}
-\section{Configuration}\label{configuration}
+\hypertarget{configuration}{%
+\section{Configuration}\label{configuration}}
\texttt{tex4ebook} uses \texttt{tex4ht}\footnote{\url{http://www.tug.org/tex4ht/}}
for conversion from LaTeX to html. \texttt{tex4ht} is highly
@@ -136,6 +141,7 @@ part 1}\footnote{\url{http://www.cvr.cc/?p=323}}, \emph{Configure part
commands}\footnote{\url{http://www.cvr.cc/?p=482}}. Available options
for \texttt{\textbackslash{}Preamble} command are listed in the article
\emph{TeX4ht: options}\footnote{\url{http://www.cvr.cc/?p=504}}.
+\emph{Comparison of tex4ebook and Pandoc output}\footnote{\url{https://github.com/richelbilderbeek/travis_tex_to_epub_example_1}}
Great source of tips for \texttt{tex4ht} configuring is \emph{tex4ht tag
on TeX.sx}\footnote{\url{http://tex.stackexchange.com/questions/tagged/tex4ht}},
@@ -145,7 +151,8 @@ Examples of interesting questions are \emph{including images and fonts
in ebooks}\footnote{\url{http://tex.stackexchange.com/a/213165/2891}} or
\emph{setting image size in em units instead of pt}\footnote{\url{http://tex.stackexchange.com/a/195718/2891}}.
-\subsection{Provided configurations}\label{provided-configurations}
+\hypertarget{provided-configurations}{%
+\subsection{Provided configurations}\label{provided-configurations}}
\texttt{tex4ebook} provides some configurations for your usage:
@@ -178,7 +185,7 @@ file. Default value is the whole document hiearchy, from
Each epub must declare the document language. It is inferred from
\texttt{babel} main language by default, but you can configure it when
-it doesn't work correctly. The \texttt{language code} should be in
+it doesn't work correctly. The \texttt{language\ code} should be in
\href{https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes}{ISO 639-1}
form.
@@ -187,7 +194,7 @@ form.
\end{verbatim}
By default, cover image is inserted in
-\texttt{\textless{}div class="cover-image"\textgreater{}} element, you
+\texttt{\textless{}div\ class="cover-image"\textgreater{}} element, you
may use this configuration option to insert different markup, or even to
place the cover image to standalone page.
@@ -225,16 +232,17 @@ Add item to \texttt{\textless{}manifest\textgreater{}} section in the
\Configure{xmlns}{prefix}{uri}
\end{verbatim}
-Add xml name space to \texttt{xhtml} files. Useful in \texttt{EPUB 3}
+Add xml name space to \texttt{xhtml} files. Useful in \texttt{EPUB\ 3}
+\hypertarget{commands-available-in-config-files}{%
\subsection{Commands available in config
-files}\label{commands-available-in-config-files}
+files}\label{commands-available-in-config-files}}
\begin{description}
\item[\texttt{\textbackslash{}OpfRegisterFile{[}filename{]}}]
register file in the \texttt{OPF} file. Current output file is added by
default.
-\item[\texttt{\textbackslash{}OpfAddProperty\{property type\}}]
+\item[\texttt{\textbackslash{}OpfAddProperty\{property\ type\}}]
add \texttt{EPUB3} property for the current file. See \emph{EPUB3
spec}\footnote{\url{http://www.idpf.org/epub/301/spec/epub-publications.html\#sec-item-property-values}}
\item[\texttt{\textbackslash{}OpfGuide{[}filename{]}\{title\}\{type\}}]
@@ -243,16 +251,36 @@ Add file to the \texttt{\textless{}guide\textgreater{}} section in the
\texttt{\textless{}guide\textgreater{}} section of the .OPF
file?}\footnote{\url{http://epubsecrets.com/where-do-you-start-an-epub-and-what-is-the-guide-section-of-the-opf-file.php}}
for some details. Note that \texttt{\textless{}guide\textgreater{}} is
-deprecated in \texttt{EPUB 3}.
+deprecated in \texttt{EPUB\ 3}.
\end{description}
-\subsection{Build files}\label{build-files}
+\hypertarget{build-files}{%
+\subsection{Build files}\label{build-files}}
\texttt{tex4ebook} uses \texttt{make4ht}\footnote{\url{https://github.com/michal-h21/make4ht}}
as a build system. See \texttt{make4ht} documentation for details on
build files.
-\section{Troubleshooting}\label{troubleshooting}
+\hypertarget{tex4ebook-configuration-file}{%
+\subsection{\texorpdfstring{\texttt{.tex4ebook} configuration
+file}{.tex4ebook configuration file}}\label{tex4ebook-configuration-file}}
+
+It is possible to globally modify the build settings using the
+configuration file. New compilation commands can be added, extensions
+can be loaded or disabled and settings can be set.
+
+\hypertarget{location}{%
+\subsubsection{Location}\label{location}}
+
+The configuration file can be saved either in
+\texttt{\$HOME/.config/tex4ebook/config.lua} or in \texttt{.tex4ebook}
+in the current directory or it's parents (up to \texttt{\$HOME}).
+
+See the \texttt{make4ht} documentation for an example and more
+information.
+
+\hypertarget{troubleshooting}{%
+\section{Troubleshooting}\label{troubleshooting}}
When compilation of the document breaks with error during \texttt{LaTeX}
run, it may be caused by some problem in \texttt{tex4ht} configuration.
@@ -270,7 +298,8 @@ showing the error and ask for help either on \emph{tex4ht mailing
list}\footnote{\url{http://tug.org/mailman/listinfo/tex4ht}} or on
\emph{TeX-sx}\footnote{\url{http://tex.stackexchange.com/}}.
-\subsection{Fontspec}\label{fontspec}
+\hypertarget{fontspec}{%
+\subsection{Fontspec}\label{fontspec}}
\texttt{tex4ht} currently doesn't support \texttt{fontspec} and open
type fonts. At this moment, workaround for this is to modify your source
@@ -306,7 +335,8 @@ works only with Lua backend, but it supports full unicode and you don't
have to use conditional package inclusion in your document. See an
\href{http://michal-h21.github.io/samples/helpers4ht/fontspec.html}{example}.
-\subsection{Validation}\label{validation}
+\hypertarget{validation}{%
+\subsection{Validation}\label{validation}}
In case of successful compilation, use command line tool
\texttt{epubcheck}\footnote{you need to install it separately, see
@@ -319,11 +349,12 @@ Type
epubcheck filename.epub
\end{verbatim}
+\hypertarget{common-validation-issues}{%
\subsubsection{Common validation
-issues:}\label{common-validation-issues}
+issues:}\label{common-validation-issues}}
\begin{itemize}
-\itemsep1pt\parskip0pt\parsep0pt
+\tightlist
\item
WARNING: filename.epub: item (OEBPS/foo.boo) exists in the zip file,
but is not declared in the OPF file
@@ -333,13 +364,13 @@ Delete the \texttt{filename-(epub\textbar{}epub3\textbar{}mobi)} folder
and \texttt{filename.epub}. Then run \texttt{tex4ebook} again.
\begin{itemize}
-\itemsep1pt\parskip0pt\parsep0pt
\item
WARNING(ACC-009): hsmmt10t.epub/OEBPS/hsmmt10tch17.xhtml(235,15):
MathML should either have an alt text attribute or annotation-xml
child element.
-\end{itemize}
-This is accessibility message. Unless you use some macro with
-annotations for each math instance, you will get lot of these messages.
-Try to use \texttt{epubcheck -e} to print only serious errors.
+ This is accessibility message. Unless you use some macro with
+ annotations for each math instance, you will get lot of these
+ messages. Try to use \texttt{epubcheck\ -e} to print only serious
+ errors.
+\end{itemize}
diff --git a/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdf b/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdf
index 55ff450ede8..bb0bcf3c14e 100644
--- a/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdf
+++ b/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.tex b/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.tex
index 073d81d7ac2..0486abec3d3 100644
--- a/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.tex
+++ b/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.tex
@@ -6,15 +6,19 @@
\ifdefined\HCode
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
+\author{\href{mailto:michal.h21@gmail.com}{Michal Hoftich}}
\else
\usepackage{fontspec}
\setmainfont{TeX Gyre Schola}
+\author{Michal Hoftich\footnote{\url{michal.h21@gmail.com}}}
\fi
\usepackage{microtype}
\providecommand\tightlist{\relax}
+\ifdefined\gitdate\else\def\gitdate{Date undefined}\fi
+\ifdefined\version\else\def\version{Version undefined}\fi
\title{The \texttt{tex4ebook} package}
-\author{Michal Hoftich\footnote{\url{michal.h21@gmail.com}}}
+% \author{Michal Hoftich\thanks{\url{michal.h21@gmail.com}}}
\date{Version \version\\\gitdate}
\begin{document}
\maketitle
diff --git a/Master/texmf-dist/scripts/tex4ebook/exec_epub.lua b/Master/texmf-dist/scripts/tex4ebook/exec_epub.lua
index 1311516bfb6..d556c10ef55 100755
--- a/Master/texmf-dist/scripts/tex4ebook/exec_epub.lua
+++ b/Master/texmf-dist/scripts/tex4ebook/exec_epub.lua
@@ -119,7 +119,9 @@ local mimetypes = {
otf = "application/opentype",
ttf = "application/truetype",
woff = "application/font-woff",
- js = "text/javascript"
+ js = "text/javascript",
+ mp3 = "audio/mpeg",
+ smil = "application/smil+xml"
}
function make_opf()
diff --git a/Master/texmf-dist/scripts/tex4ebook/exec_epub3.lua b/Master/texmf-dist/scripts/tex4ebook/exec_epub3.lua
index eb829284b59..56eff3f341c 100755
--- a/Master/texmf-dist/scripts/tex4ebook/exec_epub3.lua
+++ b/Master/texmf-dist/scripts/tex4ebook/exec_epub3.lua
@@ -1,5 +1,6 @@
module(...,package.seeall)
local eb = require("exec_epub")
+local dom = require("luaxml-domobject")
local ext = "xhtml"
local outputdir = nil
@@ -42,6 +43,72 @@ local function makeTOC(document)
return template
end
+local function add_media_overlays(content)
+ local add_meta = function(package, attributes, text)
+ local meta = package:create_element("meta",attributes)
+ local dur_el = meta:create_text_node(text)
+ meta:add_child_node(dur_el)
+ package:add_child_node(meta)
+ end
+ -- calculate total audio time
+ local calc_times = function(times)
+ local time = 0
+ for _, curr in ipairs(times) do
+ -- smil file contains timestamps in the H:M:S format, we need to parse it
+ local hours, minutes, seconds = curr:match("(%d+):(%d+):(%d+)")
+ time = time + os.time({year=1970, day=1, month=1, hour=hours, min=minutes, sec=seconds})
+ end
+ return os.date("%H:%M:%S",time)
+ end
+ local opfdom = dom.parse(content)
+ local items = opfdom:query_selector("manifest item")
+ local ref = {}
+ local times = {}
+ local package = opfdom:query_selector("metadata")[1]
+ -- we must read all smil files and find references to html files
+ -- it is necessary to add media-overlay attribute to the referenced items
+ for _, item in ipairs(items) do
+ local href = item:get_attribute("href")
+ ref[href] = item
+ -- we must read audio length from the smil file and add it as a <meta> property
+ if href:match("smil$") then
+ local f = io.open(outputdir .. "/" .. href, "r")
+ if not f then break end
+ local smil = f:read("*all")
+ f:close()
+ local smildom = dom.parse(smil)
+ local audios = smildom:query_selector("audio")
+ local last = audios[#audios]
+ -- add audio duration to the metadata section
+ if last then
+ local duration = last:get_attribute("clipend")
+ if duration then
+ -- todo: calculate total audio length
+ table.insert(times, duration)
+ local audio_id = item:get_attribute("id")
+ add_meta(package, {property="media:duration", refines="#"..audio_id}, duration)
+ end
+ end
+
+ -- add the media-overlay attribute
+ local textref = smil:match('epub:textref="(.-)"')
+ local id = item:get_attribute("id")
+ local referenced = ref[textref]
+ if referenced then
+ referenced:set_attribute("media-overlay", id)
+ end
+ end
+ end
+ -- calculate length of all media overlay audio files
+ if #times > 0 then
+ local totaltime = calc_times(times)
+ add_meta(package,{property="media:duration"}, totaltime)
+ end
+ local serialized = opfdom:serialize()
+ return serialized
+end
+
+
local function cleanOPF()
-- in epub3, there must be table of contents
-- if there is no toc in the document, we must add generic one
@@ -72,6 +139,7 @@ local function cleanOPF()
-- remove empty guide element
end
content = content:gsub("<guide>%s*</guide>","")
+ content = add_media_overlays(content)
f = io.open(outputdir .. "/" ..opf,"w")
f:write(content)
f:close()
diff --git a/Master/texmf-dist/scripts/tex4ebook/tex4ebook b/Master/texmf-dist/scripts/tex4ebook/tex4ebook
index 5c9f65573f7..02906427453 100755
--- a/Master/texmf-dist/scripts/tex4ebook/tex4ebook
+++ b/Master/texmf-dist/scripts/tex4ebook/tex4ebook
@@ -7,6 +7,7 @@ require("lapp-mk4")
-- require("ebookutils")
local ebookutils = require "mkutils"
local mkparams = require "mkparams"
+local mk_config = require "make4ht-config"
-- Setting
local latex_cmd="latex"
@@ -37,6 +38,7 @@ tex4ebook [switches] filename ["tex4ht.sty op." "tex4ht op." "t4ht op" "latex op
-s,--shell-escape Enable shell escape in htlatex run
-t,--tidy Run html tidy on html output. May result in wrong spacing!
-v,--version Display version number
+-x,--xetex Use xelatex for document compilation
<filename> (string) Input file name
]]
@@ -52,12 +54,14 @@ else
end
if args.version then
- print "tex4ebook v0.1e"
+ print "tex4ebook v0.2"
return
end
if args.lua then
latex_cmd="dvilualatex"
+elseif args.xetex then
+ latex_cmd="xelatex --no-pdf"
end
@@ -125,12 +129,17 @@ local latex_par = latex_par + args[5]
args.filename=input_file
local params = mkparams.process_args(args)
+
+local output_format = params.output_format --args.format
+-- use epub as default output_format
+output_format = output_format or "epub"
+local extensions = ebookutils.load_extensions(params.extensions, output_format)
-- but also support tex4ebook!s own parameters
local oldparams = {
-- htlatex=latex_cmd
-- ,input=input
-- ,tex_file = tex_file
- format=args.format
+ format= output_format
-- ,latex_par=latex_par
-- ,tex4ht_sty_par=tex4ht_sty_par
-- ,tex4ht_par=tex4ht_par
@@ -152,14 +161,28 @@ end
params.tex4ht_sty_par=params.tex4ht_sty_par .. ",charset=utf-8,"..args.format
params.tex4ht_par= " -cmozhtf -utf8" .. params.tex4ht_par
-if output_formats[args.format] then
- executor=require("exec_"..args.format)
+
+if output_formats[output_format] then
+ executor=require("exec_"..output_format)
params=executor.prepare(params)
+ if #extensions > 0 then
+ params = ebookutils.extensions_prepare_parameters(extensions,params)
+ end
else
- print("Unknown output format: "..args.format)
+ print("Unknown output format: "..output_format)
return
end
+-- find tex4ebook configuration file
+local configname = "tex4ebook"
+local conffile = mk_config.find_config(configname) or mk_config.find_xdg_config(configname)
+if conffile then
+ print("Using configuration file: " .. conffile)
+ ebookutils.load_config(params, conffile)
+else
+ print "No conffile"
+end
+
local build_file = input.. ".mk4"
if args["build-file"] and args["build-file"] ~= "nil" then
@@ -171,6 +194,10 @@ local config_file = ebookutils.load_config(params, build_file)
params["config_file"] = config_file
--config_file.Make:run()
print("${htlatex} ${input} \"${tex4ht_sty_par}\" \"${tex4ht_par}\" \"${t4ht_par}\" \"${latex_par}\"" % params)
+if #extensions > 0 then
+ config_file.Make = ebookutils.extensions_modify_build(extensions, config_file.Make)
+end
+
executor.run(input,params)
executor.writeContainer()
executor.clean()