From c38f2e3735eb97eaf74132a87ca64c6980519265 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 26 Jul 2021 20:31:33 +0000 Subject: tex4ebook (26jul21) git-svn-id: svn://tug.org/texlive/trunk@60083 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/support/tex4ebook/README | 61 ++++++- .../texmf-dist/doc/support/tex4ebook/changelog.tex | 55 +++++++ Master/texmf-dist/doc/support/tex4ebook/readme.tex | 74 ++++++++- .../doc/support/tex4ebook/tex4ebook-doc.pdf | Bin 79505 -> 83506 bytes Master/texmf-dist/scripts/tex4ebook/tex4ebook | 3 +- .../scripts/tex4ebook/tex4ebook-exec_epub.lua | 8 +- .../texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht | 4 - .../texmf-dist/tex/latex/tex4ebook/tex4ebook.sty | 182 ++++++++++----------- 8 files changed, 278 insertions(+), 109 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/doc/support/tex4ebook/README b/Master/texmf-dist/doc/support/tex4ebook/README index 3634974ab82..f87bd02f422 100644 --- a/Master/texmf-dist/doc/support/tex4ebook/README +++ b/Master/texmf-dist/doc/support/tex4ebook/README @@ -46,7 +46,17 @@ But it is optional. You shouldn't need to modify your \TeX\ files ## Available commands -- `\coverimage{coverimage.name}` - include cover image to the document. +- `\coverimage[]{coverimage.name}` - include cover image to + the document. You can pass the same options as to `\includegraphics` command + in the optional argument. + +For example: + + \thispagestyle{empty} + \begin{document} + \coverimage[scale=0.8]{coverimage.name} % include scaled cover image + ... + \pagestyle{headings} # Command line options @@ -212,6 +222,42 @@ Add item to `` section in the `OPF` file. Add `XML` name space to the generated `XHTML` files. Useful in `EPUB 3`. +### Example config file + + \Preamble{xhtml} + \begin{document} + \Configure{DocumentLanguage}{de} + % Use following lines if your document has ISBN: + % \Configure{OpfScheme}{ISBN} + % \Configure{UniqueIdentifier}{3-0000-1111-X} + % Another possibility is URI that points for example to the ebook homepage: + \Configure{OpfScheme}{URI} + \Configure{UniqueIdentifier} + {https://de.wikipedia.org/wiki/Der_achte_Schöpfungstag} + \Configure{CoverMimeType}{image/jpeg} + % If you don't use \coverimage in the document text, + % add cover image using this command: + \CoverMetadata{coverimage.jpg} + % You can also add more authors to your ebook metadata: + \Configure{OpfMetadata} + {\HCode{Deutscher Bücherbund}} + \Configure{OpfMetadata} + {\HCode{Image Artist}} + \Configure{OpfMetadata} + {\HCode{Trans Lator}} + \Configure{OpfMetadata} + {\HCode{1888}} + \EndPreamble + +Remarks: + +- Leading percent signs in the `.cfg` file introduce comments +- If the unique identifier is a URI which contains diacritical characters, the + equivalent HTML code needs to be inserted. `UTF8` is not recognized at that place. +- `UTF8` characters may be used in the `OpfMetadata` sections. + + + ## Commands available in the config file @@ -229,6 +275,7 @@ Add `XML` name space to the generated `XHTML` files. Useful in `EPUB 3`. *Where do you start an ePUB and what is the `` 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 `` is deprecated in `EPUB 3`. + ## Build files `tex4ebook` uses `make4ht`^[https://github.com/michal-h21/make4ht] as a build @@ -254,10 +301,14 @@ See the `make4ht` documentation for an example and more information. The basic support for the Fixed layout EPUB 3 can be enabled using the following configurations: - \Configure{OpfMetadata}{\HCode{pre-paginated}} - \Configure{OpfMetadata}{\HCode{landscape}} - \Configure{OpfMetadata}{\HCode{none}} - \Configure{@HEAD}{\HCode{\Hnewline}} + \Configure{OpfMetadata} + {\HCode{pre-paginated}} + \Configure{OpfMetadata} + {\HCode{landscape}} + \Configure{OpfMetadata} + {\HCode{none}} + \Configure{@HEAD} + {\HCode{\Hnewline}} Modify the dimensions in the `pre-paginated}} -\Configure{OpfMetadata}{\HCode{landscape}} -\Configure{OpfMetadata}{\HCode{none}} -\Configure{@HEAD}{\HCode{\Hnewline}} +\Configure{OpfMetadata} +{\HCode{pre-paginated}} +\Configure{OpfMetadata} +{\HCode{landscape}} +\Configure{OpfMetadata} +{\HCode{none}} +\Configure{@HEAD} +{\HCode{\Hnewline}} \end{verbatim} Modify the dimensions in the diff --git a/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdf b/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdf index 3546db973f5..170a8fc4f1c 100644 Binary files a/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdf and b/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdf differ diff --git a/Master/texmf-dist/scripts/tex4ebook/tex4ebook b/Master/texmf-dist/scripts/tex4ebook/tex4ebook index 91df031ffb7..2b2b38b1133 100755 --- a/Master/texmf-dist/scripts/tex4ebook/tex4ebook +++ b/Master/texmf-dist/scripts/tex4ebook/tex4ebook @@ -67,7 +67,7 @@ else end if args.version then - print "tex4ebook v0.3c" + print "tex4ebook v0.3d" return end @@ -201,4 +201,5 @@ executor.run(input,params) executor.writeContainer() executor.clean() log:status("Conversion finished") +logging.exit_status() --print(args[1]) diff --git a/Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_epub.lua b/Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_epub.lua index 75304e24942..539cf930ab6 100755 --- a/Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_epub.lua +++ b/Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_epub.lua @@ -157,6 +157,10 @@ function make_opf() local id=table.concat(dir_part,"-")..fname.."_"..ext -- remove invalid characters from id start id = id:gsub("^[%.%-]*","") + -- remove colons + id = id:gsub(":", "_") + -- id cannot start by number, add trailing "x" character + id = id:gsub("^([%d])", "x%1") return "",id end local find_all_files= function(s,r) @@ -277,9 +281,9 @@ function make_opf() end end local function find_zip() - if io.popen("zip -v","r"):close() then + if assert(io.popen("zip -v","r"):close()) then return "zip" - elseif io.popen("miktex-zip -v","r"):close() then + elseif assert(io.popen("miktex-zip -v","r"):close()) then return "miktex-zip" end log:warning "It appears you don't have zip command installed. I can't pack the ebook" diff --git a/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht b/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht index 6ee87ed3aeb..01324639175 100644 --- a/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht +++ b/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht @@ -193,10 +193,6 @@ href="#1" media-type="\a:CoverMimeType" />}} % Support for SVG isn't ready %\Configure{Picture}{.svg} \Configure{Picture}{.png} -\Configure{PicDisplay} - {\edef\MathPar{\ifvmode par-\fi}\IgnorePar\endgraf\EndP - \HCode{
}} - {\HCode{
}} {} {class="\MathPar math-display" } \Configure{()}{$}{$} \fi \:CheckOption{kindle} \if:Option diff --git a/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.sty b/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.sty index 1b0114748c9..4d8cb1db097 100644 --- a/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.sty +++ b/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.sty @@ -11,7 +11,7 @@ \def\opftable{} %Declare RFC3066 language code for babel language name -\def\DeclareLanguage#1#2{% +\def\DeclareLanguageEbook#1#2{% \csgdef{rfclang#1}{#2}% } \def\GetLanguage{% @@ -21,96 +21,96 @@ \fi% } -\DeclareLanguage{UKenglish}{en-GB} -\DeclareLanguage{USenglish}{en-US} -\DeclareLanguage{acadian}{fr} -\DeclareLanguage{albanian}{sq} -\DeclareLanguage{american}{en-US} -\DeclareLanguage{amharic}{am} -\DeclareLanguage{arabic}{ar} -\DeclareLanguage{armenian}{hy} -\DeclareLanguage{australian}{en-US} -\DeclareLanguage{austrian}{de} -\DeclareLanguage{basque}{eu} -\DeclareLanguage{bengali}{bn} -\DeclareLanguage{brazilian}{pt} -\DeclareLanguage{brazil}{pt} -\DeclareLanguage{breton}{br} -\DeclareLanguage{british}{en-GB} -\DeclareLanguage{bulgarian}{bg} -\DeclareLanguage{canadian}{en-US} -\DeclareLanguage{canadien}{fr} -\DeclareLanguage{catalan}{ca} -\DeclareLanguage{croatian}{hr} -\DeclareLanguage{czech}{cs-CZ} -\DeclareLanguage{danish}{da} -\DeclareLanguage{divehi}{dv} -\DeclareLanguage{dutch}{nl} -\DeclareLanguage{english}{en} -\DeclareLanguage{esperanto}{eo} -\DeclareLanguage{estonian}{et} -\DeclareLanguage{finnish}{f\/i} -\DeclareLanguage{francais}{fr} -\DeclareLanguage{french}{fr} -\DeclareLanguage{galician}{gl} -\DeclareLanguage{germanb}{de} -\DeclareLanguage{german}{de} -\DeclareLanguage{greek}{el} -\DeclareLanguage{hebrew}{he} -\DeclareLanguage{hindi}{hi} -\DeclareLanguage{hungarian}{hu} -\DeclareLanguage{icelandic}{is} -\DeclareLanguage{interlingua}{ia} -\DeclareLanguage{irish}{ga} -\DeclareLanguage{italian}{it} -\DeclareLanguage{kannada}{kn} -\DeclareLanguage{khmer}{km} -\DeclareLanguage{korean}{ko} -\DeclareLanguage{lao}{lo} -\DeclareLanguage{latin}{la} -\DeclareLanguage{latvian}{lv} -\DeclareLanguage{lithuanian}{lt} -\DeclareLanguage{lowersorbian}{dsb} -\DeclareLanguage{magyar}{hu} -\DeclareLanguage{malayalam}{ml} -\DeclareLanguage{marathi}{mr} -\DeclareLanguage{naustrian}{de} -\DeclareLanguage{newzealand}{en} -\DeclareLanguage{ngerman}{de} -\DeclareLanguage{norsk}{no} -\DeclareLanguage{norwegiannynorsk}{nn} -\DeclareLanguage{nynorsk}{no} -\DeclareLanguage{occitan}{oc} -\DeclareLanguage{oldchurchslavonic}{cu} -\DeclareLanguage{persian}{fa} -\DeclareLanguage{polish}{pl-PL} -\DeclareLanguage{polutonikogreek}{el} -\DeclareLanguage{portuges}{pt} -\DeclareLanguage{portuguese}{pt} -\DeclareLanguage{romanian}{ro} -\DeclareLanguage{romansh}{rm} -\DeclareLanguage{russian}{ru} -\DeclareLanguage{samin}{se} -\DeclareLanguage{sanskrit}{sa} -\DeclareLanguage{scottish}{gd} -\DeclareLanguage{serbian}{sr} -\DeclareLanguage{serbo-croatian}{sh} -\DeclareLanguage{slovak}{sk} -\DeclareLanguage{slovene}{sl} -\DeclareLanguage{slovenian}{sl} -\DeclareLanguage{spanish}{es} -\DeclareLanguage{swedish}{sv} -\DeclareLanguage{tamil}{ta} -\DeclareLanguage{telugu}{te} -\DeclareLanguage{thai}{th} -\DeclareLanguage{tibetan}{bo} -\DeclareLanguage{turkish}{tr} -\DeclareLanguage{turkmen}{tk} -\DeclareLanguage{ukrainian}{uk} -\DeclareLanguage{uppersorbian}{hsb} -\DeclareLanguage{urdu}{ur} -\DeclareLanguage{vietnamese}{vi} -\DeclareLanguage{welsh}{cy} +\DeclareLanguageEbook{UKenglish}{en-GB} +\DeclareLanguageEbook{USenglish}{en-US} +\DeclareLanguageEbook{acadian}{fr} +\DeclareLanguageEbook{albanian}{sq} +\DeclareLanguageEbook{american}{en-US} +\DeclareLanguageEbook{amharic}{am} +\DeclareLanguageEbook{arabic}{ar} +\DeclareLanguageEbook{armenian}{hy} +\DeclareLanguageEbook{australian}{en-US} +\DeclareLanguageEbook{austrian}{de} +\DeclareLanguageEbook{basque}{eu} +\DeclareLanguageEbook{bengali}{bn} +\DeclareLanguageEbook{brazilian}{pt} +\DeclareLanguageEbook{brazil}{pt} +\DeclareLanguageEbook{breton}{br} +\DeclareLanguageEbook{british}{en-GB} +\DeclareLanguageEbook{bulgarian}{bg} +\DeclareLanguageEbook{canadian}{en-US} +\DeclareLanguageEbook{canadien}{fr} +\DeclareLanguageEbook{catalan}{ca} +\DeclareLanguageEbook{croatian}{hr} +\DeclareLanguageEbook{czech}{cs-CZ} +\DeclareLanguageEbook{danish}{da} +\DeclareLanguageEbook{divehi}{dv} +\DeclareLanguageEbook{dutch}{nl} +\DeclareLanguageEbook{english}{en} +\DeclareLanguageEbook{esperanto}{eo} +\DeclareLanguageEbook{estonian}{et} +\DeclareLanguageEbook{finnish}{f\/i} +\DeclareLanguageEbook{francais}{fr} +\DeclareLanguageEbook{french}{fr} +\DeclareLanguageEbook{galician}{gl} +\DeclareLanguageEbook{germanb}{de} +\DeclareLanguageEbook{german}{de} +\DeclareLanguageEbook{greek}{el} +\DeclareLanguageEbook{hebrew}{he} +\DeclareLanguageEbook{hindi}{hi} +\DeclareLanguageEbook{hungarian}{hu} +\DeclareLanguageEbook{icelandic}{is} +\DeclareLanguageEbook{interlingua}{ia} +\DeclareLanguageEbook{irish}{ga} +\DeclareLanguageEbook{italian}{it} +\DeclareLanguageEbook{kannada}{kn} +\DeclareLanguageEbook{khmer}{km} +\DeclareLanguageEbook{korean}{ko} +\DeclareLanguageEbook{lao}{lo} +\DeclareLanguageEbook{latin}{la} +\DeclareLanguageEbook{latvian}{lv} +\DeclareLanguageEbook{lithuanian}{lt} +\DeclareLanguageEbook{lowersorbian}{dsb} +\DeclareLanguageEbook{magyar}{hu} +\DeclareLanguageEbook{malayalam}{ml} +\DeclareLanguageEbook{marathi}{mr} +\DeclareLanguageEbook{naustrian}{de} +\DeclareLanguageEbook{newzealand}{en} +\DeclareLanguageEbook{ngerman}{de} +\DeclareLanguageEbook{norsk}{no} +\DeclareLanguageEbook{norwegiannynorsk}{nn} +\DeclareLanguageEbook{nynorsk}{no} +\DeclareLanguageEbook{occitan}{oc} +\DeclareLanguageEbook{oldchurchslavonic}{cu} +\DeclareLanguageEbook{persian}{fa} +\DeclareLanguageEbook{polish}{pl-PL} +\DeclareLanguageEbook{polutonikogreek}{el} +\DeclareLanguageEbook{portuges}{pt} +\DeclareLanguageEbook{portuguese}{pt} +\DeclareLanguageEbook{romanian}{ro} +\DeclareLanguageEbook{romansh}{rm} +\DeclareLanguageEbook{russian}{ru} +\DeclareLanguageEbook{samin}{se} +\DeclareLanguageEbook{sanskrit}{sa} +\DeclareLanguageEbook{scottish}{gd} +\DeclareLanguageEbook{serbian}{sr} +\DeclareLanguageEbook{serbo-croatian}{sh} +\DeclareLanguageEbook{slovak}{sk} +\DeclareLanguageEbook{slovene}{sl} +\DeclareLanguageEbook{slovenian}{sl} +\DeclareLanguageEbook{spanish}{es} +\DeclareLanguageEbook{swedish}{sv} +\DeclareLanguageEbook{tamil}{ta} +\DeclareLanguageEbook{telugu}{te} +\DeclareLanguageEbook{thai}{th} +\DeclareLanguageEbook{tibetan}{bo} +\DeclareLanguageEbook{turkish}{tr} +\DeclareLanguageEbook{turkmen}{tk} +\DeclareLanguageEbook{ukrainian}{uk} +\DeclareLanguageEbook{uppersorbian}{hsb} +\DeclareLanguageEbook{urdu}{ur} +\DeclareLanguageEbook{vietnamese}{vi} +\DeclareLanguageEbook{welsh}{cy} \AtEndDocument{% \ncxtable -- cgit v1.2.3