diff options
author | Karl Berry <karl@freefriends.org> | 2019-01-10 22:21:28 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-01-10 22:21:28 +0000 |
commit | 0446755d9f93d095627779097695fa3468811b93 (patch) | |
tree | 31b8f58994f6d3c32a58fb54e238ee0472646543 /Master/texmf-dist | |
parent | 8368bb1a1e80c128b441a121a8fda08f0e32d5ae (diff) |
tex4ebook (10jan19)
git-svn-id: svn://tug.org/texlive/trunk@49665 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/support/tex4ebook/README | 32 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/tex4ebook/changelog.tex | 77 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/tex4ebook/readme.tex | 58 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdf | bin | 72915 -> 72222 bytes | |||
-rwxr-xr-x | Master/texmf-dist/scripts/tex4ebook/exec_epub.lua | 9 | ||||
-rwxr-xr-x | Master/texmf-dist/scripts/tex4ebook/exec_mobi.lua | 13 | ||||
-rwxr-xr-x | Master/texmf-dist/scripts/tex4ebook/tex4ebook | 41 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/tex4ebook/tex4ebook-epub3.4ht | 6 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht | 4 |
9 files changed, 160 insertions, 80 deletions
diff --git a/Master/texmf-dist/doc/support/tex4ebook/README b/Master/texmf-dist/doc/support/tex4ebook/README index d6ba3c51f23..228fe58df6f 100644 --- a/Master/texmf-dist/doc/support/tex4ebook/README +++ b/Master/texmf-dist/doc/support/tex4ebook/README @@ -35,16 +35,15 @@ Run on the command line: tex4ebook [options] filename You don't have to modify your source files unless you want to use commands -defined by `tex4ebook` in the document, or when your document uses some -unsupported package like `fontspec` (see details bellow how to solve this -issue). +defined by `tex4ebook` in the document, or when your document uses a +package which causes a compilation error. If you want to use `tex4ebook` commands, add this line to your document preamble: \usepackage{tex4ebook} -but it is optional. You shouldn't need to modify your \TeX\ files +But it is optional. You shouldn't need to modify your \TeX\ files ## Available commands @@ -79,11 +78,11 @@ but it is optional. You shouldn't need to modify your \TeX\ files `-f,--format (default epub)` -: Output format. epub, epub3 and mobi are supported. +: Output format. Epub, Epub3 and Mobi formats are supported. `-l,--lua` -: Runs htlualatex instead of htlatex. +: Use LuaLaTeX as TeX engine. `-m,--mode (default default)` @@ -105,9 +104,14 @@ but it is optional. You shouldn't need to modify your \TeX\ files : process output html files with `HTML tidy` command^[It needs to be installed separately]. +`-x,--xetex` + +: Use xelatex for document compilation + + `-v,--version` -: print version number +: Print the version number. # Configuration @@ -122,9 +126,9 @@ structure is ... \EndPreamble -Basic info about command configurations can be found in a work-in-progres - *tex4ht tutorial*^[https://github.com/michal-h21/helpers4ht/wiki/tex4ht-tutorial] -, *tex4ht documentation*^[http://www.tug.org/applications/tex4ht/mn11.html], +Basic info about command configurations can be found in a +work-in-progres *tex4ht tutorial*^[https://github.com/michal-h21/helpers4ht/wiki/tex4ht-tutorial], +*tex4ht documentation*^[http://www.tug.org/applications/tex4ht/mn11.html], and in series of blogposts on CV Radhakrishnan's blog: *Configure part 1*^[http://www.cvr.cc/?p=323], *Configure part 2*^[http://www.cvr.cc/?p=362], @@ -209,8 +213,8 @@ Add xml name space to `xhtml` files. Useful in `EPUB 3` `\OpfGuide[filename]{title}{type}` -: Add file to the `<guide>` section in the `OPF` file. See *Where do you start an ePUB and what is the `<guide>` section of the .OPF - file?*^[http://epubsecrets.com/where-do-you-start-an-epub-and-what-is-the-guide-section-of-the-opf-file.php] +: Add file to the `<guide>` section in the `OPF` file. See + *Where do you start an ePUB and what is the `<guide>` section of the `.OPF` file?*^[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 `<guide>` is deprecated in `EPUB 3`. ## Build files @@ -244,8 +248,9 @@ if same error as in `tex4ebook` run arises, the problem is in some `tex4ht` configuration. Try to identify the source of problem and if you cannot find the solution, make minimal example showing the error and ask for help either on *tex4ht mailing list*^[http://tug.org/mailman/listinfo/tex4ht] or on -*TeX-sx*^[http://tex.stackexchange.com/]. +*TeX.sx*^[http://tex.stackexchange.com/]. +<!-- ## Fontspec `tex4ht` currently doesn't support `fontspec` and open type fonts. At this @@ -278,6 +283,7 @@ Other approach is to use `alternative4ht` package from [helpers4ht](https://gith bundle. It 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 [example](http://michal-h21.github.io/samples/helpers4ht/fontspec.html). +--> ## Validation diff --git a/Master/texmf-dist/doc/support/tex4ebook/changelog.tex b/Master/texmf-dist/doc/support/tex4ebook/changelog.tex index a7df4b691b6..ebec6ca8175 100644 --- a/Master/texmf-dist/doc/support/tex4ebook/changelog.tex +++ b/Master/texmf-dist/doc/support/tex4ebook/changelog.tex @@ -3,6 +3,83 @@ \begin{itemize} \item + 2019/01/10 + + \begin{itemize} + \tightlist + \item + released version \texttt{0.2b} + \end{itemize} +\item + 28/11/2018 + + \begin{itemize} + \tightlist + \item + added support for appendix sections to the NCX file + \end{itemize} +\item + 27/11/2018 + + \begin{itemize} + \tightlist + \item + use the \texttt{uni-html4} option by default. It will convert some + math characters as Unicode chars. + \end{itemize} +\item + 13/11/2018 + + \begin{itemize} + \tightlist + \item + added --xetex option to the README + \end{itemize} +\item + 30/10/2018 + + \begin{itemize} + \tightlist + \item + use the original section numbering in TOC in the Epub 3 output. The + numbering of the \texttt{\textless{}ol\textgreater{}} list is + disabled by CSS. + \end{itemize} +\item + 18/10/2018 + + \begin{itemize} + \tightlist + \item + fixed the executable installation + \end{itemize} +\item + 03/09/2018 + + \begin{itemize} + \tightlist + \item + updated the \texttt{-\/-help} message + \end{itemize} +\item + 30/08/2018 + + \begin{itemize} + \tightlist + \item + removed spurious \texttt{\textbackslash{}NoFonts} command in the + footnote configuration, it caused formating issues in the document + following a footnote + \end{itemize} +\item + 22/06/2018 + + \begin{itemize} + \tightlist + \item + added support for the output directory selection + \end{itemize} +\item 09/05/2018 \begin{itemize} diff --git a/Master/texmf-dist/doc/support/tex4ebook/readme.tex b/Master/texmf-dist/doc/support/tex4ebook/readme.tex index e8ef08d4df8..75db5437183 100644 --- a/Master/texmf-dist/doc/support/tex4ebook/readme.tex +++ b/Master/texmf-dist/doc/support/tex4ebook/readme.tex @@ -42,8 +42,7 @@ tex4ebook [options] filename You don't have to modify your source files unless you want to use commands defined by \texttt{tex4ebook} in the document, or when your -document uses some unsupported package like \texttt{fontspec} (see -details bellow how to solve this issue). +document uses a package which causes a compilation error. If you want to use \texttt{tex4ebook} commands, add this line to your document preamble: @@ -52,7 +51,7 @@ document preamble: \usepackage{tex4ebook} \end{verbatim} -but it is optional. You shouldn't need to modify your \TeX~files +But it is optional. You shouldn't need to modify your \TeX~files \hypertarget{available-commands}{% \subsection{Available commands}\label{available-commands}} @@ -96,9 +95,9 @@ Specify make4ht build file\footnote{\url{https://github.com/michal-h21/make4ht\# Defaulf build file filename is \texttt{filename.mk4}, use this option if you use different filename. \item[\texttt{-f,-\/-format\ (default\ epub)}] -Output format. epub, epub3 and mobi are supported. +Output format. Epub, Epub3 and Mobi formats are supported. \item[\texttt{-l,-\/-lua}] -Runs htlualatex instead of htlatex. +Use LuaLaTeX as TeX engine. \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 @@ -113,8 +112,10 @@ external commands from your source files. \item[\texttt{-t,-\/-tidy}] process output html files with \texttt{HTML\ tidy} command\footnote{It needs to be installed separately}. +\item[\texttt{-x,-\/-xetex}] +Use xelatex for document compilation \item[\texttt{-v,-\/-version}] -print version number +Print the version number. \end{description} \hypertarget{configuration}{% @@ -133,8 +134,8 @@ configurable using config files. Basic config file structure is \end{verbatim} Basic info about command configurations can be found in a -work-in-progres \emph{tex4ht tutorial}\footnote{\url{https://github.com/michal-h21/helpers4ht/wiki/tex4ht-tutorial}} -, \emph{tex4ht documentation}\footnote{\url{http://www.tug.org/applications/tex4ht/mn11.html}}, +work-in-progres \emph{tex4ht tutorial}\footnote{\url{https://github.com/michal-h21/helpers4ht/wiki/tex4ht-tutorial}}, +\emph{tex4ht documentation}\footnote{\url{http://www.tug.org/applications/tex4ht/mn11.html}}, and in series of blogposts on CV Radhakrishnan's blog: \emph{Configure part 1}\footnote{\url{http://www.cvr.cc/?p=323}}, \emph{Configure part 2}\footnote{\url{http://www.cvr.cc/?p=362}}, \emph{Low level @@ -248,7 +249,7 @@ spec}\footnote{\url{http://www.idpf.org/epub/301/spec/epub-publications.html\#se \item[\texttt{\textbackslash{}OpfGuide{[}filename{]}\{title\}\{type\}}] Add file to the \texttt{\textless{}guide\textgreater{}} section in the \texttt{OPF} file. See \emph{Where do you start an ePUB and what is the -\texttt{\textless{}guide\textgreater{}} section of the .OPF +\texttt{\textless{}guide\textgreater{}} section of the \texttt{.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}. @@ -296,44 +297,7 @@ some \texttt{tex4ht} configuration. Try to identify the source of problem and if you cannot find the solution, make minimal example 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/}}. - -\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 -file and conditionally include fontspec and any other conflicting -packages only when document is not processed with \texttt{tex4ht}. - -Sample: - -\begin{verbatim} -\documentclass{article} -\makeatletter -\@ifpackageloaded{tex4ht}{% -% Packages for tex4ht unicode support -\usepackage[utf8]{inputenc} -\usepackage[T1]{fontenc} -\usepackage[english,czech]{babel} -}{% -% Packages for xelatex -\usepackage{fontspec} -\usepackage{polyglossia} -\setmainfont{Latin Modern Roman} -} -\makeatother -\end{verbatim} - -The drawback is that not all characters of the Unicode range are -supported with \texttt{inputenc}. For some solutions of this limitation, -see a thread on \emph{tex4ht mailing list}\footnote{\url{http://tug.org/pipermail/tex4ht/2013q1/000719.html}} - -Other approach is to use \texttt{alternative4ht} package from -\href{https://github.com/michal-h21/helpers4ht}{helpers4ht} bundle. It -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}. +\emph{TeX.sx}\footnote{\url{http://tex.stackexchange.com/}}. \hypertarget{validation}{% \subsection{Validation}\label{validation}} diff --git a/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdf b/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdf Binary files differindex 8942a088e64..42f18620c0a 100644 --- a/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdf +++ b/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdf diff --git a/Master/texmf-dist/scripts/tex4ebook/exec_epub.lua b/Master/texmf-dist/scripts/tex4ebook/exec_epub.lua index d556c10ef55..8502f280597 100755 --- a/Master/texmf-dist/scripts/tex4ebook/exec_epub.lua +++ b/Master/texmf-dist/scripts/tex4ebook/exec_epub.lua @@ -13,6 +13,8 @@ local mimetype_name="mimetype" outputdir="" outputfile="" outputfilename="" +-- the directory where the epub file should be moved to +destdir="" basedir = "" tidy = false local include_fonts = false @@ -45,6 +47,10 @@ function prepare(params) --ebookutils.mkdirectories(ebookutils.prepare_path(outputdir.."/")) metadir = basedir .."/" .. metadir_name --"metadir-"..randname makedir(metadir) + if params.outdir ~= "" then + destdir = params.outdir .. "/" + makedir(destdir) + end --local dd = ebookutils.prepare_path(metadir.."/") --for _,d in pairs(dd) do print("metadir path: "..d) end -- lfs.mkdir(metadir) @@ -56,6 +62,7 @@ function prepare(params) tidy = params.tidy include_fonts = params.include_fonts params["t4ht_par"] = params["t4ht_par"] -- + "-d"..string.format(params["t4ht_dir_format"],outputdir) + params.tex4ht_sty_par = params.tex4ht_sty_par .. ",uni-html4" return(params) end @@ -311,7 +318,7 @@ function make_opf() print("Pack metadir " .. os.execute("cd "..basedir.." && "..zip.." -qXr9D " .. outputfile.." "..metadir_name)) print("Pack outputdir " .. os.execute("cd "..basedir.." && "..zip.." -qXr9D " .. outputfile.." "..outputdir_name)) print("Copy generated epub ") - ebookutils.cp(basedir .."/"..outputfile, outputfile) + ebookutils.cp(basedir .."/"..outputfile, destdir .. outputfile) end diff --git a/Master/texmf-dist/scripts/tex4ebook/exec_mobi.lua b/Master/texmf-dist/scripts/tex4ebook/exec_mobi.lua index be9148b5a10..11871ade769 100755 --- a/Master/texmf-dist/scripts/tex4ebook/exec_mobi.lua +++ b/Master/texmf-dist/scripts/tex4ebook/exec_mobi.lua @@ -1,5 +1,6 @@ module(...,package.seeall) local eb = require("exec_epub") +local ebookutils = require("mkutils") function prepare(params) return eb.prepare(params) @@ -11,7 +12,17 @@ end function writeContainer() local ret = eb.writeContainer() - print("Pack mobi "..os.execute("kindlegen " .. eb.outputfile)) + -- convert the epub file to mobi + local epubpath = eb.basedir .. "/" .. eb.outputfile + print("Pack mobi "..os.execute("kindlegen " .. epubpath)) + -- find the mobi filename + local mobifile = epubpath:gsub("epub$", "mobi") + local mobidist = eb.destdir .. eb.outputfile:gsub("epub$", "mobi") + -- copy the mobi file to the destination directory + -- the destination directory will be created by the epub writer, so it is possible to use + -- the cp function which doesn't try to create directory + ebookutils.cp(mobifile, mobidist) + return ret end diff --git a/Master/texmf-dist/scripts/tex4ebook/tex4ebook b/Master/texmf-dist/scripts/tex4ebook/tex4ebook index b6ac969b50c..9e396ffc3f8 100755 --- a/Master/texmf-dist/scripts/tex4ebook/tex4ebook +++ b/Master/texmf-dist/scripts/tex4ebook/tex4ebook @@ -27,19 +27,31 @@ local include_fonts = false local arg_message = [[ tex4ebook - ebook generation support for LaTeX Usage: -tex4ebook [switches] filename ["tex4ht.sty op." "tex4ht op." "t4ht op" "latex op"] --c,--config (default xhtml) Custom config file --e,--build-file (default nil) If build file is different than `filename`.mk4 --f,--format (default epub) Output format. Supported values: epub, epub3, mobi --h,--help Display help message --l,--lua Runs htlualatex instead of htlatex --m,--mode (default default) Switch which can be used in the makefile --r,--resolution (default 167) --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 +tex4ebook [switches] filename ["tex4ht.sty op."] ["tex4ht op."] ["t4ht op"] ["latex op"] + -c,--config (default xhtml) Custom config file + -d,--output-dir (default nil) Output directory + -e,--build-file (default nil) If build file is different than `filename`.mk4 + -f,--format (default epub) Output format. Supported values: epub, epub3, mobi + -h,--help Display help message + -l,--lua Use lualatex for document compilation + -m,--mode (default default) Switch which can be used in the makefile + -r,--resolution (default 167) + -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 + +Positional optional argumens: + ["tex4ht.sty op."] Additional parameters for tex4ht.sty + ["tex4ht op."] Options for tex4ht command + ["t4ht op"] Options for t4ht command + ["latex op"] Additional options for LaTeX + +Documentation: https://tug.org/applications/tex4ht/mn.html +Issue tracker for tex4ht bugs: https://puszcza.gnu.org.ua/bugs/?group=tex4ht +Issue tracker for tex4ebook bugs: https://github.com/michal-h21/tex4ebook/issues ]] -- This option is no longer available, all files must be unicode @@ -54,7 +66,7 @@ else end if args.version then - print "tex4ebook v0.2a" + print "tex4ebook v0.2b" return end @@ -111,6 +123,7 @@ end--]] --print ("nazdar ${world}" % {world="svete"}) --print(args.config) + local input = ebookutils.remove_extension(input_file) local config=ebookutils.remove_extension(args.config) -- local tex4ht_sty_par = config ..tex4ht_sty_par..","+args.format diff --git a/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook-epub3.4ht b/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook-epub3.4ht index d7f470552cb..b30e1c3ef15 100644 --- a/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook-epub3.4ht +++ b/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook-epub3.4ht @@ -32,7 +32,9 @@ %%%%%%%%%%% \Configure{NavSection}{% \booltrue{tocnoempty} - \HCode{<li>}\setbox0=\hbox\bgroup}{\HCode{<ol>\Hnewline}}{\egroup}{\Tg</ol>\Tg</li>} + \HCode{<li>}}{\HCode{<ol>\Hnewline}}{}{\Tg</ol>\Tg</li>} +% Disable numbering of the TOC by the reading system, numbers are added by tex4ht +\Css{nav\#toc ol{list-style: none;}} %%%% End toc nav configuration \def\CoverMetadata#1{% \special{t4ht+@File: #1}% @@ -88,7 +90,7 @@ \ifvoid\footnotebox\else\unvbox\footnotebox\fi% \IgnorePar% \bgroup% - \fnlink{}{fn\FNnum x\minipageNum}\NoFonts\Tg<p>% + \fnlink{}{fn\FNnum x\minipageNum}\Tg<p>% }{\EndNoFonts} {% \HCode{</p>\Hnewline} diff --git a/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht b/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht index 6cea65ee653..82d03df3100 100644 --- a/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht +++ b/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht @@ -309,7 +309,7 @@ href="#1" media-type="\a:CoverMimeType" />}} % define toc levels which should be included in the NCX file \NewConfigure{resettoclevels}{1} -\Configure{resettoclevels}{part,chapter,section,subsection,subsubsection,paragraph} +\Configure{resettoclevels}{part,appendix,chapter,appendixsec,section,appendixsubsec,subsection,appendixsubsubsec,subsubsection,paragraph} \def\:tempa{% \EndP @@ -326,7 +326,7 @@ href="#1" media-type="\a:CoverMimeType" />}} % so: \let\contentsname=\empty \Configure{tableofcontents}{\boolfalse{tocnoempty}\Tg<navMap>}{% - \usetoclevels{part,chapter,likechapter,section,likesection,subsection,likesubsection,subsubsection,likesubsubsection,subsubsubsection,paragraph}% + \usetoclevels{part,appendix,chapter,likechapter,appendixsec,section,likesection,subsection,appendixsubsec,likesubsection,subsubsection,likesubsubsection,appendixsubsubsec,subsubsubsection,paragraph}% \ifbool{tocnoempty}{}% {\HCode{<navPoint id="mainentry" playOrder="1"> <navLabel><text>Document</text></navLabel> |