diff options
author | Karl Berry <karl@freefriends.org> | 2015-07-05 22:09:45 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-07-05 22:09:45 +0000 |
commit | b0f3c5dbdee94cfa9a26b96c6d2f41370392df64 (patch) | |
tree | d0cf93aa29ceac864cd09bb63a2eb6b0da68aa83 | |
parent | 71f3d121e83be4220bb0b2c160b0f7f33670650c (diff) |
tex4ebook (5jul15)
git-svn-id: svn://tug.org/texlive/trunk@37771 c570f23f-e606-0410-a88d-b1316a301751
31 files changed, 442 insertions, 103 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/Makefile.am b/Build/source/texk/texlive/linked_scripts/Makefile.am index be0cbe8cbc1..17a15f0eac7 100644 --- a/Build/source/texk/texlive/linked_scripts/Makefile.am +++ b/Build/source/texk/texlive/linked_scripts/Makefile.am @@ -113,16 +113,16 @@ texmf_other_scripts = \ fragmaster/fragmaster.pl \ getmap/getmapdl.lua \ glossaries/makeglossaries \ - jfontmaps/kanji-fontmap-creator.pl \ - jfontmaps/kanji-config-updmap.pl \ jfontmaps/kanji-config-updmap-sys.sh \ + jfontmaps/kanji-config-updmap.pl \ + jfontmaps/kanji-fontmap-creator.pl \ kotex-utils/jamo-normalize.pl \ kotex-utils/komkindex.pl \ kotex-utils/ttf2kotexfont.pl \ latex-git-log/latex-git-log \ latex2man/latex2man \ - latexdiff/latexdiff.pl \ latexdiff/latexdiff-vc.pl \ + latexdiff/latexdiff.pl \ latexdiff/latexrevise.pl \ latexindent/latexindent.pl \ latexmk/latexmk.pl \ @@ -137,8 +137,8 @@ texmf_other_scripts = \ match_parens/match_parens \ mathspic/mathspic.pl \ mf2pt1/mf2pt1.pl \ - mkjobtexmf/mkjobtexmf.pl \ mkgrkindex/mkgrkindex \ + mkjobtexmf/mkjobtexmf.pl \ mkpic/mkpic \ multibibliography/multibibliography.pl \ musixtex/musixflx.lua \ @@ -148,34 +148,35 @@ texmf_other_scripts = \ pdfcrop/pdfcrop.pl \ pedigree-perl/pedigree.pl \ perltex/perltex.pl \ - pfarrei/pfarrei.tlu \ pfarrei/a5toa4.tlu \ - pkfix/pkfix.pl \ + pfarrei/pfarrei.tlu \ pkfix-helper/pkfix-helper \ + pkfix/pkfix.pl \ pmx/pmx2pdf.lua \ pmxchords/pmxchords.lua \ pst2pdf/pst2pdf.pl \ ptex2pdf/ptex2pdf.lua \ purifyeps/purifyeps \ pygmentex/pygmentex.py \ - pythontex/pythontex.py \ pythontex/depythontex.py \ + pythontex/pythontex.py \ rubik/rubikrotation.pl \ splitindex/splitindex.pl \ sty2dtx/sty2dtx.pl \ svn-multi/svn-multi.pl \ - texdoc/texdoc.tlu \ + tex4ebook/tex4ebook \ texcount/texcount.pl \ texdef/texdef.pl \ texdiff/texdiff \ texdirflatten/texdirflatten \ + texdoc/texdoc.tlu \ texfot/texfot.pl \ - texlive/fmtutil.pl \ texlive/fmtutil-sys.sh \ + texlive/fmtutil.pl \ texlive/rungs.tlu \ texlive/tlmgr.pl \ - texlive/updmap.pl \ texlive/updmap-sys.sh \ + texlive/updmap.pl \ texliveonfly/texliveonfly.py \ texloganalyser/texloganalyser \ thumbpdf/thumbpdf.pl \ diff --git a/Build/source/texk/texlive/linked_scripts/Makefile.in b/Build/source/texk/texlive/linked_scripts/Makefile.in index e5b3b051163..572170f8982 100644 --- a/Build/source/texk/texlive/linked_scripts/Makefile.in +++ b/Build/source/texk/texlive/linked_scripts/Makefile.in @@ -329,16 +329,16 @@ texmf_other_scripts = \ fragmaster/fragmaster.pl \ getmap/getmapdl.lua \ glossaries/makeglossaries \ - jfontmaps/kanji-fontmap-creator.pl \ - jfontmaps/kanji-config-updmap.pl \ jfontmaps/kanji-config-updmap-sys.sh \ + jfontmaps/kanji-config-updmap.pl \ + jfontmaps/kanji-fontmap-creator.pl \ kotex-utils/jamo-normalize.pl \ kotex-utils/komkindex.pl \ kotex-utils/ttf2kotexfont.pl \ latex-git-log/latex-git-log \ latex2man/latex2man \ - latexdiff/latexdiff.pl \ latexdiff/latexdiff-vc.pl \ + latexdiff/latexdiff.pl \ latexdiff/latexrevise.pl \ latexindent/latexindent.pl \ latexmk/latexmk.pl \ @@ -353,8 +353,8 @@ texmf_other_scripts = \ match_parens/match_parens \ mathspic/mathspic.pl \ mf2pt1/mf2pt1.pl \ - mkjobtexmf/mkjobtexmf.pl \ mkgrkindex/mkgrkindex \ + mkjobtexmf/mkjobtexmf.pl \ mkpic/mkpic \ multibibliography/multibibliography.pl \ musixtex/musixflx.lua \ @@ -364,34 +364,35 @@ texmf_other_scripts = \ pdfcrop/pdfcrop.pl \ pedigree-perl/pedigree.pl \ perltex/perltex.pl \ - pfarrei/pfarrei.tlu \ pfarrei/a5toa4.tlu \ - pkfix/pkfix.pl \ + pfarrei/pfarrei.tlu \ pkfix-helper/pkfix-helper \ + pkfix/pkfix.pl \ pmx/pmx2pdf.lua \ pmxchords/pmxchords.lua \ pst2pdf/pst2pdf.pl \ ptex2pdf/ptex2pdf.lua \ purifyeps/purifyeps \ pygmentex/pygmentex.py \ - pythontex/pythontex.py \ pythontex/depythontex.py \ + pythontex/pythontex.py \ rubik/rubikrotation.pl \ splitindex/splitindex.pl \ sty2dtx/sty2dtx.pl \ svn-multi/svn-multi.pl \ - texdoc/texdoc.tlu \ + tex4ebook/tex4ebook \ texcount/texcount.pl \ texdef/texdef.pl \ texdiff/texdiff \ texdirflatten/texdirflatten \ + texdoc/texdoc.tlu \ texfot/texfot.pl \ - texlive/fmtutil.pl \ texlive/fmtutil-sys.sh \ + texlive/fmtutil.pl \ texlive/rungs.tlu \ texlive/tlmgr.pl \ - texlive/updmap.pl \ texlive/updmap-sys.sh \ + texlive/updmap.pl \ texliveonfly/texliveonfly.py \ texloganalyser/texloganalyser \ thumbpdf/thumbpdf.pl \ diff --git a/Build/source/texk/texlive/linked_scripts/scripts.lst b/Build/source/texk/texlive/linked_scripts/scripts.lst index b8682c41f9a..881374bee1d 100644 --- a/Build/source/texk/texlive/linked_scripts/scripts.lst +++ b/Build/source/texk/texlive/linked_scripts/scripts.lst @@ -59,16 +59,16 @@ fontools/ot2kpx fragmaster/fragmaster.pl getmap/getmapdl.lua glossaries/makeglossaries -jfontmaps/kanji-fontmap-creator.pl -jfontmaps/kanji-config-updmap.pl jfontmaps/kanji-config-updmap-sys.sh +jfontmaps/kanji-config-updmap.pl +jfontmaps/kanji-fontmap-creator.pl kotex-utils/jamo-normalize.pl kotex-utils/komkindex.pl kotex-utils/ttf2kotexfont.pl latex-git-log/latex-git-log latex2man/latex2man -latexdiff/latexdiff.pl latexdiff/latexdiff-vc.pl +latexdiff/latexdiff.pl latexdiff/latexrevise.pl latexindent/latexindent.pl latexmk/latexmk.pl @@ -83,8 +83,8 @@ make4ht/make4ht match_parens/match_parens mathspic/mathspic.pl mf2pt1/mf2pt1.pl -mkjobtexmf/mkjobtexmf.pl mkgrkindex/mkgrkindex +mkjobtexmf/mkjobtexmf.pl mkpic/mkpic multibibliography/multibibliography.pl musixtex/musixflx.lua @@ -94,34 +94,35 @@ pax/pdfannotextractor.pl pdfcrop/pdfcrop.pl pedigree-perl/pedigree.pl perltex/perltex.pl -pfarrei/pfarrei.tlu pfarrei/a5toa4.tlu -pkfix/pkfix.pl +pfarrei/pfarrei.tlu pkfix-helper/pkfix-helper +pkfix/pkfix.pl pmx/pmx2pdf.lua pmxchords/pmxchords.lua pst2pdf/pst2pdf.pl ptex2pdf/ptex2pdf.lua purifyeps/purifyeps pygmentex/pygmentex.py -pythontex/pythontex.py pythontex/depythontex.py +pythontex/pythontex.py rubik/rubikrotation.pl splitindex/splitindex.pl sty2dtx/sty2dtx.pl svn-multi/svn-multi.pl -texdoc/texdoc.tlu +tex4ebook/tex4ebook texcount/texcount.pl texdef/texdef.pl texdiff/texdiff texdirflatten/texdirflatten +texdoc/texdoc.tlu texfot/texfot.pl -texlive/fmtutil.pl texlive/fmtutil-sys.sh +texlive/fmtutil.pl texlive/rungs.tlu texlive/tlmgr.pl -texlive/updmap.pl texlive/updmap-sys.sh +texlive/updmap.pl texliveonfly/texliveonfly.py texloganalyser/texloganalyser thumbpdf/thumbpdf.pl diff --git a/Build/source/texk/texlive/linked_scripts/tex4ebook/tex4ebook b/Build/source/texk/texlive/linked_scripts/tex4ebook/tex4ebook new file mode 100755 index 00000000000..c43bc330583 --- /dev/null +++ b/Build/source/texk/texlive/linked_scripts/tex4ebook/tex4ebook @@ -0,0 +1,154 @@ +#!/usr/bin/env texlua +kpse.set_program_name("luatex") +require("lapp-mk4") +-- require("ebookutils") +local ebookutils = require "mkutils" + +-- Setting +local latex_cmd="latex" +local copy_cmd="copy" +local move_cmd="move" +local env_param="%%" +local htlatex_call="" +-- These correspond to htlatex parameters +local tex4ht_sty_par="" +local tex4ht_par="" +local t4ht_par="" +local latex_par="" +local output_formats={epub=true,mobi=true,epub3=true} +local executor=nil +local tidy = false +local include_fonts = false +local arg_message = [[ +tex4ebook - ebook generation support for LaTeX +Usage: +tex4ebook [switches] inputfile ["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 +-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! +]] + +-- This option is no longer available, all files must be unicode +-- -u,--utf8 +local args=lapp(arg_message) + +if args[1] == nil then + print(arg_message) + return +else + input_file=args[1] +end + +if args.lua then + print("Mame lua") + latex_cmd="dvilualatex" +end + +--if args.utf8 then +tex4ht_sty_par=tex4ht_sty_par .. ", charset=utf-8" +tex4ht_par=tex4ht_par .. " -cmozhtf -utf8" +--end + +if args["shell-escape"] then + latex_par = latex_par .. " -shell-escape" +end + +if args["include-fonts"] then + include_fonts = true +end + +-- local mathml = "," +-- if args["mathml"] then +-- -- mathml = ",mathml," +-- tex4ht_sty_par = tex4ht_sty_par .. ",mathml" +-- end +local mode = args.mode or "default" + +if os.type=="unix" then + env_param="$" + copy_cmd="cp" + move_cmd="mv" + t4ht_dir_format="%s/" +else + env_param="%%" + copy_cmd="copy" + move_cmd="move" + t4ht_dir_format="%s" +end + +if args.tidy then + tidy = true +else + tidy = false +end +-- Env file copying + +--[[if not ebookutils.file_exists("tex4ht.env") then +local env_file = kpse.find_file("epub2.env") +ebookutils.copy_filter(env_file,"tex4ht.env",function(s) return s % { +move = move_cmd, +copy = copy_cmd, +resolution = args.resolution +} end) +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 +--local sty_args = args[2] and ", " .. args[2] or "" +local sty_args = "" +if args[2] then + sty_args = "," .. args[2] +end +local tex4ht_sty_par = tex4ht_sty_par + sty_args --args[2] +local tex4ht_par = tex4ht_par +args[3] +local t4ht_par = t4ht_par + args[4] +local latex_par = latex_par + args[5] +local params = { + htlatex=latex_cmd + ,input=input + ,format=args.format + ,latex_par=latex_par + ,tex4ht_sty_par=tex4ht_sty_par + ,tex4ht_par=tex4ht_par + ,t4ht_par=t4ht_par + ,mode = mode + ,t4ht_dir_format=t4ht_dir_format + ,tidy = tidy + ,include_fonts = include_fonts + ,resolution=args.resolution + ,mathml=mathml + ,packages="\\RequirePackage{tex4ebook}" +} + +if output_formats[args.format] then + executor=require("exec_"..args.format) + params=executor.prepare(params) +else + print("Unknown output format: "..args.format) + return +end + +local build_file = input.. ".mk4" + +if args["build-file"] and args["build-file"] ~= "nil" then + build_file = args["build-file"] +end + +local config_file = ebookutils.load_config(nil, build_file) + +params["config_file"] = config_file +--config_file.Make:run() +print("${htlatex} ${input} \"${tex4ht_sty_par}\" \"${tex4ht_par}\" \"${t4ht_par}\" \"${latex_par}\"" % params) +executor.run(input,params) +executor.writeContainer() +executor.clean() +--print(args[1]) diff --git a/Master/bin/alpha-linux/tex4ebook b/Master/bin/alpha-linux/tex4ebook new file mode 120000 index 00000000000..892bc9c9d03 --- /dev/null +++ b/Master/bin/alpha-linux/tex4ebook @@ -0,0 +1 @@ +../../texmf-dist/scripts/tex4ebook/tex4ebook
\ No newline at end of file diff --git a/Master/bin/amd64-freebsd/tex4ebook b/Master/bin/amd64-freebsd/tex4ebook new file mode 120000 index 00000000000..892bc9c9d03 --- /dev/null +++ b/Master/bin/amd64-freebsd/tex4ebook @@ -0,0 +1 @@ +../../texmf-dist/scripts/tex4ebook/tex4ebook
\ No newline at end of file diff --git a/Master/bin/amd64-netbsd/tex4ebook b/Master/bin/amd64-netbsd/tex4ebook new file mode 120000 index 00000000000..892bc9c9d03 --- /dev/null +++ b/Master/bin/amd64-netbsd/tex4ebook @@ -0,0 +1 @@ +../../texmf-dist/scripts/tex4ebook/tex4ebook
\ No newline at end of file diff --git a/Master/bin/armel-linux/tex4ebook b/Master/bin/armel-linux/tex4ebook new file mode 120000 index 00000000000..892bc9c9d03 --- /dev/null +++ b/Master/bin/armel-linux/tex4ebook @@ -0,0 +1 @@ +../../texmf-dist/scripts/tex4ebook/tex4ebook
\ No newline at end of file diff --git a/Master/bin/armhf-linux/tex4ebook b/Master/bin/armhf-linux/tex4ebook new file mode 120000 index 00000000000..892bc9c9d03 --- /dev/null +++ b/Master/bin/armhf-linux/tex4ebook @@ -0,0 +1 @@ +../../texmf-dist/scripts/tex4ebook/tex4ebook
\ No newline at end of file diff --git a/Master/bin/i386-cygwin/tex4ebook b/Master/bin/i386-cygwin/tex4ebook new file mode 120000 index 00000000000..892bc9c9d03 --- /dev/null +++ b/Master/bin/i386-cygwin/tex4ebook @@ -0,0 +1 @@ +../../texmf-dist/scripts/tex4ebook/tex4ebook
\ No newline at end of file diff --git a/Master/bin/i386-freebsd/tex4ebook b/Master/bin/i386-freebsd/tex4ebook new file mode 120000 index 00000000000..892bc9c9d03 --- /dev/null +++ b/Master/bin/i386-freebsd/tex4ebook @@ -0,0 +1 @@ +../../texmf-dist/scripts/tex4ebook/tex4ebook
\ No newline at end of file diff --git a/Master/bin/i386-linux/tex4ebook b/Master/bin/i386-linux/tex4ebook new file mode 120000 index 00000000000..892bc9c9d03 --- /dev/null +++ b/Master/bin/i386-linux/tex4ebook @@ -0,0 +1 @@ +../../texmf-dist/scripts/tex4ebook/tex4ebook
\ No newline at end of file diff --git a/Master/bin/i386-netbsd/tex4ebook b/Master/bin/i386-netbsd/tex4ebook new file mode 120000 index 00000000000..892bc9c9d03 --- /dev/null +++ b/Master/bin/i386-netbsd/tex4ebook @@ -0,0 +1 @@ +../../texmf-dist/scripts/tex4ebook/tex4ebook
\ No newline at end of file diff --git a/Master/bin/i386-solaris/tex4ebook b/Master/bin/i386-solaris/tex4ebook new file mode 120000 index 00000000000..892bc9c9d03 --- /dev/null +++ b/Master/bin/i386-solaris/tex4ebook @@ -0,0 +1 @@ +../../texmf-dist/scripts/tex4ebook/tex4ebook
\ No newline at end of file diff --git a/Master/bin/mipsel-linux/tex4ebook b/Master/bin/mipsel-linux/tex4ebook new file mode 120000 index 00000000000..892bc9c9d03 --- /dev/null +++ b/Master/bin/mipsel-linux/tex4ebook @@ -0,0 +1 @@ +../../texmf-dist/scripts/tex4ebook/tex4ebook
\ No newline at end of file diff --git a/Master/bin/powerpc-linux/tex4ebook b/Master/bin/powerpc-linux/tex4ebook new file mode 120000 index 00000000000..892bc9c9d03 --- /dev/null +++ b/Master/bin/powerpc-linux/tex4ebook @@ -0,0 +1 @@ +../../texmf-dist/scripts/tex4ebook/tex4ebook
\ No newline at end of file diff --git a/Master/bin/sparc-solaris/tex4ebook b/Master/bin/sparc-solaris/tex4ebook new file mode 120000 index 00000000000..892bc9c9d03 --- /dev/null +++ b/Master/bin/sparc-solaris/tex4ebook @@ -0,0 +1 @@ +../../texmf-dist/scripts/tex4ebook/tex4ebook
\ No newline at end of file diff --git a/Master/bin/universal-darwin/tex4ebook b/Master/bin/universal-darwin/tex4ebook new file mode 120000 index 00000000000..892bc9c9d03 --- /dev/null +++ b/Master/bin/universal-darwin/tex4ebook @@ -0,0 +1 @@ +../../texmf-dist/scripts/tex4ebook/tex4ebook
\ No newline at end of file diff --git a/Master/bin/win32/tex4ebook.exe b/Master/bin/win32/tex4ebook.exe Binary files differnew file mode 100755 index 00000000000..5777d90a17a --- /dev/null +++ b/Master/bin/win32/tex4ebook.exe diff --git a/Master/bin/x86_64-cygwin/tex4ebook b/Master/bin/x86_64-cygwin/tex4ebook new file mode 120000 index 00000000000..892bc9c9d03 --- /dev/null +++ b/Master/bin/x86_64-cygwin/tex4ebook @@ -0,0 +1 @@ +../../texmf-dist/scripts/tex4ebook/tex4ebook
\ No newline at end of file diff --git a/Master/bin/x86_64-darwin/tex4ebook b/Master/bin/x86_64-darwin/tex4ebook new file mode 120000 index 00000000000..892bc9c9d03 --- /dev/null +++ b/Master/bin/x86_64-darwin/tex4ebook @@ -0,0 +1 @@ +../../texmf-dist/scripts/tex4ebook/tex4ebook
\ No newline at end of file diff --git a/Master/bin/x86_64-linux/tex4ebook b/Master/bin/x86_64-linux/tex4ebook new file mode 120000 index 00000000000..892bc9c9d03 --- /dev/null +++ b/Master/bin/x86_64-linux/tex4ebook @@ -0,0 +1 @@ +../../texmf-dist/scripts/tex4ebook/tex4ebook
\ No newline at end of file diff --git a/Master/bin/x86_64-solaris/tex4ebook b/Master/bin/x86_64-solaris/tex4ebook new file mode 120000 index 00000000000..892bc9c9d03 --- /dev/null +++ b/Master/bin/x86_64-solaris/tex4ebook @@ -0,0 +1 @@ +../../texmf-dist/scripts/tex4ebook/tex4ebook
\ No newline at end of file diff --git a/Master/texmf-dist/doc/support/tex4ebook/README.md b/Master/texmf-dist/doc/support/tex4ebook/README index 86f7c8ee09a..73a4e3f46d9 100644 --- a/Master/texmf-dist/doc/support/tex4ebook/README.md +++ b/Master/texmf-dist/doc/support/tex4ebook/README @@ -1,6 +1,6 @@ # Introduction -`TeX4ebook` is bundle of lua scripts and `LaTeX` packages for conversion of +`TeX4ebook` is bundle of Lua scripts and `LaTeX` packages for conversion of LaTeX files to ebook formats, for example `epub`, `mobi` and `epub3`. `tex4ht` is used as conversion engine. @@ -71,8 +71,8 @@ but it is optional. You shouldn't need to modify your \TeX\ files -e,--build-file (default nil) -: Specify [make4ht build file](https://github.com/michal-h21/make4ht#build-file). - Defaulf build file filename is `filename.mk4`, use this option when it has +: Specify make4ht build file^[\url{https://github.com/michal-h21/make4ht\#build-file}]. + Defaulf build file filename is `filename.mk4`, use this option if you use different filename. -f,--format (default epub) @@ -101,12 +101,12 @@ but it is optional. You shouldn't need to modify your \TeX\ files t,--tidy -: Run tidy on output html files. +: process output html files with `HTML tidy` command^[It needs to be installed separately]. # Configuration -`tex4ebook` uses [tex4ht](http://www.tug.org/tex4ht/) for conversion from LaTeX +`tex4ebook` uses `tex4ht`^[\url{http://www.tug.org/tex4ht/}] for conversion from LaTeX to html. `tex4ht` is highly configurable using config files. Basic config file structure is @@ -117,20 +117,20 @@ 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), + *tex4ht tutorial*^[\url{https://github.com/michal-h21/helpers4ht/wiki/tex4ht-tutorial}] +, *tex4ht documentation*^[\url{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), -[Low level commands](http://www.cvr.cc/?p=482). +*Configure part 1*^[\url{http://www.cvr.cc/?p=323}], +*Configure part 2*^[\url{http://www.cvr.cc/?p=362}], +*Low level commands*^[\url{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*^[\url{http://www.cvr.cc/?p=504}]. -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). +Great source of tips for `tex4ht` configuring is *tex4ht tag on TeX.sx*^[\url{http://tex.stackexchange.com/questions/tagged/tex4ht}], there is also a *tag for tex4ebook*^[\url{http://tex.stackexchange.com/questions/tagged/tex4ebook}]. Examples of interesting questions are -[including images and fonts in ebooks](including images and fonts in ebooks) -or [setting image size in em units instead of pt](http://tex.stackexchange.com/a/195718/2891). +*including images and fonts in ebooks*^[\url{http://tex.stackexchange.com/a/213165/2891}] +or *setting image size in em units instead of pt*^[\url{http://tex.stackexchange.com/a/195718/2891}]. ## Provided configurations @@ -187,15 +187,17 @@ Add xml name space to `xhtml` files. Useful in `EPUB 3` `\OpfAddProperty{property type}` -: add `EPUB3` property for the current file. See [EPUB3 spec](http://www.idpf.org/epub/301/spec/epub-publications.html#sec-item-property-values) +: add `EPUB3` property for the current file. See *EPUB3 spec*^[\url{http://www.idpf.org/epub/301/spec/epub-publications.html\#sec-item-property-values}] `\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) for some details. Note that `<guide>` is deprecated in `EPUB 3`. +: 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?*^[\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 `<guide>` is deprecated in `EPUB 3`. ## Build files -`tex4ebook` uses [make4ht](https://github.com/michal-h21/make4ht) as a build +`tex4ebook` uses `make4ht`^[\url{https://github.com/michal-h21/make4ht}] as a build system. See `make4ht` documentation for details on build files. # Troubleshooting @@ -209,13 +211,13 @@ be caused by some problem in `tex4ht` configuration. Comment out line 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 mailinglist](http://tug.org/mailman/listinfo/tex4ht) or on -[TeX-sx](http://tex.stackexchange.com/). +*tex4ht mailinglist*^[\url{http://tug.org/mailman/listinfo/tex4ht}] or on +*TeX-sx*^[\url{http://tex.stackexchange.com/}]. ## Fontspec `tex4ht` currently doesn't support `fontspec` and open type fonts. At this -moment, workaround for this is to modify your source file and conditionaly +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 `tex4ht`. @@ -236,15 +238,17 @@ Sample: } \makeatother -Drawback is that not all characters of unicode range are supported with -`inputenc`. For some solutions of this limitation, see a thread on [tex4ht -mailinglist](http://tug.org/pipermail/tex4ht/2013q1/000719.html) +Drawback is that not all characters of Unicode range are supported with +`inputenc`. For some solutions of this limitation, see a thread on *tex4ht +mailinglist*^[\url{http://tug.org/pipermail/tex4ht/2013q1/000719.html}] ## Validation -In case of successful compilation, use command line tool `epubcheck` to check +In case of successful compilation, use command line tool `epubcheck`^[you need +to install it separately, see \url{https://github.com/IDPF/epubcheck}] to check whether your document doesn't contain any errors. + Type epubcheck filename.epub @@ -257,7 +261,8 @@ not declared in the OPF file Delete the `filename-(epub|epub3|mobi)` folder and `filename.epub`. Then run `tex4ebook` again. -- WARNING(ACC-009): hsmmt10t.epub/OEBPS/hsmmt10tch17.xhtml(235,15): MathML should either have an alt text attribute or annotation-xml child element. +- WARNING(ACC-009): hsmmt10t.epub/OEBPS/hsmmt10tch17.xhtml(235,15): +MathML should either have an alt text attribute or annotation-xml child element. 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 diff --git a/Master/texmf-dist/doc/support/tex4ebook/changelog.tex b/Master/texmf-dist/doc/support/tex4ebook/changelog.tex index 8748dde1b4a..4cec520fd94 100644 --- a/Master/texmf-dist/doc/support/tex4ebook/changelog.tex +++ b/Master/texmf-dist/doc/support/tex4ebook/changelog.tex @@ -2,6 +2,16 @@ \begin{itemize} \item + 05/07/2015 Version 0.1a + + \begin{itemize} + \itemsep1pt\parskip0pt\parsep0pt + \item + \texttt{tex4ebook} script was missing in the distribution zip file + \item + all links moved to footnotes in the documentation + \end{itemize} +\item 29/06/2015 Version 0.1 \begin{itemize} diff --git a/Master/texmf-dist/doc/support/tex4ebook/readme.tex b/Master/texmf-dist/doc/support/tex4ebook/readme.tex index cf8a11c0b1c..d8b7d485a73 100644 --- a/Master/texmf-dist/doc/support/tex4ebook/readme.tex +++ b/Master/texmf-dist/doc/support/tex4ebook/readme.tex @@ -1,6 +1,6 @@ \section{Introduction}\label{introduction} -\texttt{TeX4ebook} is bundle of lua scripts and \texttt{LaTeX} packages +\texttt{TeX4ebook} is bundle of Lua scripts and \texttt{LaTeX} packages for conversion of LaTeX files to ebook formats, for example \texttt{epub}, \texttt{mobi} and \texttt{epub3}. \texttt{tex4ht} is used as conversion engine. @@ -88,9 +88,9 @@ that this behaviour is default. \begin{description} \item[-e,--build-file (default nil)] -Specify \href{https://github.com/michal-h21/make4ht\#build-file}{make4ht -build file}. Defaulf build file filename is \texttt{filename.mk4}, use -this option when it has different filename. +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[-f,--format (default epub)] Output format. epub, epub3 and mobi are supported. \item[-l,--lua] @@ -107,14 +107,15 @@ resolution of target devices, which is usually about 167 ppi. Enable shell escape in htlatex run. This may be needed if you run external commands from your source files. \item[t,--tidy] -Run tidy on output html files. +process output html files with \texttt{HTML tidy} command\footnote{It + needs to be installed separately}. \end{description} \section{Configuration}\label{configuration} -\texttt{tex4ebook} uses \href{http://www.tug.org/tex4ht/}{tex4ht} for -conversion from LaTeX to html. \texttt{tex4ht} is highly configurable -using config files. Basic config file structure is +\texttt{tex4ebook} uses \texttt{tex4ht}\footnote{\url{http://www.tug.org/tex4ht/}} +for conversion from LaTeX to html. \texttt{tex4ht} is highly +configurable using config files. Basic config file structure is \begin{verbatim} \Preamble{xhtml, comma separated list of options} @@ -125,28 +126,22 @@ using config files. Basic config file structure is \end{verbatim} Basic info about command configurations can be found in a -work-in-progres -\href{https://github.com/michal-h21/helpers4ht/wiki/tex4ht-tutorial}{tex4ht -tutorial} , -\href{http://www.tug.org/applications/tex4ht/mn11.html}{tex4ht -documentation}, and in series of blogposts on CV Radhakrishnan's blog: -\href{http://www.cvr.cc/?p=323}{Configure part 1}, -\href{http://www.cvr.cc/?p=362}{Configure part 2}, -\href{http://www.cvr.cc/?p=482}{Low level commands}. Available options +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 +commands}\footnote{\url{http://www.cvr.cc/?p=482}}. Available options for \texttt{\textbackslash{}Preamble} command are listed in the article -\href{http://www.cvr.cc/?p=504}{TeX4ht: options}. +\emph{TeX4ht: options}\footnote{\url{http://www.cvr.cc/?p=504}}. -Great source of tips for \texttt{tex4ht} configuring is -\href{http://tex.stackexchange.com/questions/tagged/tex4ht}{tex4ht tag -on TeX.sx}, there is also a -\href{http://tex.stackexchange.com/questions/tagged/tex4ebook}{tag for -tex4ebook}. +Great source of tips for \texttt{tex4ht} configuring is \emph{tex4ht tag +on TeX.sx}\footnote{\url{http://tex.stackexchange.com/questions/tagged/tex4ht}}, +there is also a \emph{tag for tex4ebook}\footnote{\url{http://tex.stackexchange.com/questions/tagged/tex4ebook}}. -Examples of interesting questions are -\href{including\%20images\%20and\%20fonts\%20in\%20ebooks}{including -images and fonts in ebooks} or -\href{http://tex.stackexchange.com/a/195718/2891}{setting image size in -em units instead of pt}. +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} @@ -220,24 +215,22 @@ files}\label{commands-available-in-config-files} register file in the \texttt{OPF} file. Current output file is added by default. \item[\texttt{\textbackslash{}OpfAddProperty\{property type\}}] -add \texttt{EPUB3} property for the current file. See -\href{http://www.idpf.org/epub/301/spec/epub-publications.html\#sec-item-property-values}{EPUB3 -spec} +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\}}] Add file to the \texttt{\textless{}guide\textgreater{}} section in the -\texttt{OPF} file. See -\href{http://epubsecrets.com/where-do-you-start-an-epub-and-what-is-the-guide-section-of-the-opf-file.php}{Where -do you start an ePUB and what is the -\texttt{\textless{}guide\textgreater{}} section of the .OPF file?} for -some details. Note that \texttt{\textless{}guide\textgreater{}} is +\texttt{OPF} file. See \emph{Where do you start an ePUB and what is 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}. \end{description} \subsection{Build files}\label{build-files} -\texttt{tex4ebook} uses -\href{https://github.com/michal-h21/make4ht}{make4ht} as a build system. -See \texttt{make4ht} documentation for details on 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} @@ -253,15 +246,15 @@ htlatex filename if same error as in \texttt{tex4ebook} run arises, the problem is in 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 -\href{http://tug.org/mailman/listinfo/tex4ht}{tex4ht mailinglist} or on -\href{http://tex.stackexchange.com/}{TeX-sx}. +showing the error and ask for help either on \emph{tex4ht +mailinglist}\footnote{\url{http://tug.org/mailman/listinfo/tex4ht}} or +on \emph{TeX-sx}\footnote{\url{http://tex.stackexchange.com/}}. \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 conditionaly include fontspec and any other conflicting +file and conditionally include fontspec and any other conflicting packages only when document is not processed with \texttt{tex4ht}. Sample: @@ -283,16 +276,16 @@ Sample: \makeatother \end{verbatim} -Drawback is that not all characters of unicode range are supported with +Drawback is that not all characters of Unicode range are supported with \texttt{inputenc}. For some solutions of this limitation, see a thread -on \href{http://tug.org/pipermail/tex4ht/2013q1/000719.html}{tex4ht -mailinglist} +on \emph{tex4ht mailinglist}\footnote{\url{http://tug.org/pipermail/tex4ht/2013q1/000719.html}} \subsection{Validation}\label{validation} In case of successful compilation, use command line tool -\texttt{epubcheck} to check whether your document doesn't contain any -errors. +\texttt{epubcheck}\footnote{you need to install it separately, see + \url{https://github.com/IDPF/epubcheck}} to check whether your +document doesn't contain any errors. Type 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 0eebc2fdf46..a3a29b25d20 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/doc/support/tex4ebook/tex4ebook-doc.tex b/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.tex index b6c8bfcc4a1..a5f75c7122d 100644 --- a/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.tex +++ b/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.tex @@ -14,7 +14,7 @@ \title{The \texttt{tex4ebook} package} \author{Michal Hoftich\footnote{\url{michal.h21@gmail.com}}} -\date{Version 0.1\\29/06/2015} +\date{Version 0.1a\\05/07/2015} \begin{document} \maketitle \tableofcontents diff --git a/Master/texmf-dist/scripts/tex4ebook/tex4ebook b/Master/texmf-dist/scripts/tex4ebook/tex4ebook new file mode 100755 index 00000000000..c43bc330583 --- /dev/null +++ b/Master/texmf-dist/scripts/tex4ebook/tex4ebook @@ -0,0 +1,154 @@ +#!/usr/bin/env texlua +kpse.set_program_name("luatex") +require("lapp-mk4") +-- require("ebookutils") +local ebookutils = require "mkutils" + +-- Setting +local latex_cmd="latex" +local copy_cmd="copy" +local move_cmd="move" +local env_param="%%" +local htlatex_call="" +-- These correspond to htlatex parameters +local tex4ht_sty_par="" +local tex4ht_par="" +local t4ht_par="" +local latex_par="" +local output_formats={epub=true,mobi=true,epub3=true} +local executor=nil +local tidy = false +local include_fonts = false +local arg_message = [[ +tex4ebook - ebook generation support for LaTeX +Usage: +tex4ebook [switches] inputfile ["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 +-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! +]] + +-- This option is no longer available, all files must be unicode +-- -u,--utf8 +local args=lapp(arg_message) + +if args[1] == nil then + print(arg_message) + return +else + input_file=args[1] +end + +if args.lua then + print("Mame lua") + latex_cmd="dvilualatex" +end + +--if args.utf8 then +tex4ht_sty_par=tex4ht_sty_par .. ", charset=utf-8" +tex4ht_par=tex4ht_par .. " -cmozhtf -utf8" +--end + +if args["shell-escape"] then + latex_par = latex_par .. " -shell-escape" +end + +if args["include-fonts"] then + include_fonts = true +end + +-- local mathml = "," +-- if args["mathml"] then +-- -- mathml = ",mathml," +-- tex4ht_sty_par = tex4ht_sty_par .. ",mathml" +-- end +local mode = args.mode or "default" + +if os.type=="unix" then + env_param="$" + copy_cmd="cp" + move_cmd="mv" + t4ht_dir_format="%s/" +else + env_param="%%" + copy_cmd="copy" + move_cmd="move" + t4ht_dir_format="%s" +end + +if args.tidy then + tidy = true +else + tidy = false +end +-- Env file copying + +--[[if not ebookutils.file_exists("tex4ht.env") then +local env_file = kpse.find_file("epub2.env") +ebookutils.copy_filter(env_file,"tex4ht.env",function(s) return s % { +move = move_cmd, +copy = copy_cmd, +resolution = args.resolution +} end) +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 +--local sty_args = args[2] and ", " .. args[2] or "" +local sty_args = "" +if args[2] then + sty_args = "," .. args[2] +end +local tex4ht_sty_par = tex4ht_sty_par + sty_args --args[2] +local tex4ht_par = tex4ht_par +args[3] +local t4ht_par = t4ht_par + args[4] +local latex_par = latex_par + args[5] +local params = { + htlatex=latex_cmd + ,input=input + ,format=args.format + ,latex_par=latex_par + ,tex4ht_sty_par=tex4ht_sty_par + ,tex4ht_par=tex4ht_par + ,t4ht_par=t4ht_par + ,mode = mode + ,t4ht_dir_format=t4ht_dir_format + ,tidy = tidy + ,include_fonts = include_fonts + ,resolution=args.resolution + ,mathml=mathml + ,packages="\\RequirePackage{tex4ebook}" +} + +if output_formats[args.format] then + executor=require("exec_"..args.format) + params=executor.prepare(params) +else + print("Unknown output format: "..args.format) + return +end + +local build_file = input.. ".mk4" + +if args["build-file"] and args["build-file"] ~= "nil" then + build_file = args["build-file"] +end + +local config_file = ebookutils.load_config(nil, build_file) + +params["config_file"] = config_file +--config_file.Make:run() +print("${htlatex} ${input} \"${tex4ht_sty_par}\" \"${tex4ht_par}\" \"${t4ht_par}\" \"${latex_par}\"" % params) +executor.run(input,params) +executor.writeContainer() +executor.clean() +--print(args[1]) diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds index 8f3c92cb69b..7edfad1ba3b 100755 --- a/Master/tlpkg/libexec/ctan2tds +++ b/Master/tlpkg/libexec/ctan2tds @@ -2661,6 +2661,7 @@ $standardttf = '\.ttf|\.TTC'; 'splitindex' => 'splitindex\.pl$', 'sty2dtx' => '\.pl$', 'svn-multi' => 'svn-multi\.pl$', + 'tex4ebook' => 'tex4ebook$', 'texcount' => '\.pl$', 'texdef' => '\.pl$', 'texdiff' => 'texdiff$', diff --git a/Master/tlpkg/tlpsrc/tex4ebook.tlpsrc b/Master/tlpkg/tlpsrc/tex4ebook.tlpsrc index e69de29bb2d..dca338c719c 100644 --- a/Master/tlpkg/tlpsrc/tex4ebook.tlpsrc +++ b/Master/tlpkg/tlpsrc/tex4ebook.tlpsrc @@ -0,0 +1 @@ +binpattern f bin/${ARCH}/${PKGNAME} |