{"id":221,"date":"2015-01-19T12:28:56","date_gmt":"2015-01-19T11:28:56","guid":{"rendered":"https:\/\/d800fotos.wordpress.com\/?p=221"},"modified":"2015-01-19T12:28:56","modified_gmt":"2015-01-19T11:28:56","slug":"create-e-books-from-latex-tex-files-ebook-aus-latex-tex-dateien-erstellen","status":"publish","type":"post","link":"https:\/\/blog.d80fotos.de\/?p=221","title":{"rendered":"Create eBooks from Latex tex files &#8211; E-Book aus Latex tex Dateien erstellen"},"content":{"rendered":"<p><a href=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/vgo_6993_1000.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-240\" src=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/vgo_6993_1000.jpg\" alt=\"VGO_6993_1000\" width=\"584\" height=\"390\" srcset=\"https:\/\/blog.d80fotos.de\/wp-content\/uploads\/2015\/01\/vgo_6993_1000.jpg 1000w, https:\/\/blog.d80fotos.de\/wp-content\/uploads\/2015\/01\/vgo_6993_1000-300x200.jpg 300w, https:\/\/blog.d80fotos.de\/wp-content\/uploads\/2015\/01\/vgo_6993_1000-768x512.jpg 768w\" sizes=\"auto, (max-width: 584px) 100vw, 584px\" \/><\/a><\/p>\n<p><em>English below. Click on &#8222;weiterlesen&#8220;.<\/em><\/p>\n<p>Dieser Artikel hat nicht direkt etwas mit Fotografie zu tun, aber indirekt. Als Fotograf m\u00f6chte man ja seine Bilder auch ver\u00f6ffentlichen und das kann man heute ja auch als Buch oder E-Book ganz preiswert. B\u00fccher habe ich bisher mit dem Text-System <a title=\"Latex bei Wikipedia\" href=\"http:\/\/de.wikipedia.org\/wiki\/LaTeXhttp:\/\/\" target=\"_blank\" rel=\"noopener\">Latex<\/a> erstellt. Dabei nutze ich die Software TexLive und den Editor WinEdt.<\/p>\n<p>Ich habe in den letzten Wochen experimentiert und getestet, wie man am besten aus einer tex Datei ein ebook machen kann. Zuerst hatte ich Softcover probiert, das aber nur f\u00fcr einfache Sachen geeignet war. Abbildungen schlecht und Bibliografie funktioniert gar nicht.<\/p>\n<p><!--more--><\/p>\n<p>Dann bin ich auf tex4ebook gesto\u00dfen, das es hier gibt: https:\/\/github.com\/michal-h21\/tex4ebook. Nach einer Woche Test und Konfiguration, (zuerst mit Linux und dann Windows) bei der der Entwickler Michal sehr hilfreich war, bin ich mit dem Ergebnis sehr zufrieden. Es geht mit einem Klick aus dem Texteditor (ich nutze WinEdt) eine PDF Datei zu erstellen und mit der selben Datei mit dem n\u00e4chsten klick ein E-Book. So hatte ich mir das vorgestellt. Als Latex Distribution nutze ich TexLive. Mit MikTex wollte es nicht funktionieren. Es geht das Normale, graphicx, fontspec, bibliography, Fu\u00dfnoten, Formeln.<\/p>\n<p>F\u00fcr mich ist das die beste L\u00f6sung, die ich bisher gesehen habe.<\/p>\n<p>Hier sind die <a href=\"http:\/\/www.kreartiv.com\/pdf\/indien-tex.pdf\" target=\"_blank\" rel=\"noopener\">PDF Datei<\/a> und das <a href=\"http:\/\/www.kreartiv.com\/pdf\/indien-tex.epub\" target=\"_blank\" rel=\"noopener\">E-Book<\/a> zum anschauen und vergleichen. Beide sind nur als Beispiel gedacht. (Als E-Book Reader f\u00fcr Andoid habe ich <a href=\"https:\/\/play.google.com\/store\/apps\/details?id=com.gitden.epub.reader.app&amp;hl=de\" target=\"_blank\" rel=\"noopener\">Gitden <\/a>getestet, der sehr gut funktioniert. F\u00fcr Windows ist <a href=\"http:\/\/calibre-ebook.com\/\" target=\"_blank\" rel=\"noopener\">Calibre <\/a>geeignet.) <a href=\"http:\/\/www.kreartiv.com\/pdf\/indien-tex.tex\" target=\"_blank\" rel=\"noopener\">Hier<\/a> der Link zur Quelldatei.<\/p>\n<p>Weiter unten gibt es eine Anleitung dazu in Englisch, f\u00fcr die, die vor der gleichen Herausforderung stehen und noch nicht wissen, wie es geht. Englisch, um eine breitere Leserschaft zu erreichen.<\/p>\n<h1>Create e-Books from Latex tex files<\/h1>\n<p><span id=\"result_box\" class=\"\" lang=\"en\"><span class=\"hps\">This article has<\/span> <span class=\"hps\">nothing directly<\/span> <span class=\"hps\">to do with photography<\/span>, <span class=\"hps\">but<\/span> <span class=\"hps\">indirectly.<\/span> <span class=\"hps\">As a photographer,<\/span> <span class=\"hps\">one would like to<\/span> <span class=\"hps\">publish<\/span> <span class=\"hps\">his pictures. Y<\/span><span class=\"hps\">ou can indeed<\/span> do this <span class=\"hps\">today<\/span> <span class=\"hps\">quite<\/span> <span class=\"hps\">inexpensive<\/span> <span class=\"hps\">as a book<\/span> <span class=\"hps\">or<\/span> <span class=\"hps\">e-book<\/span><span class=\"hps\">.<\/span> <span class=\"hps\">Books<\/span> <span class=\"hps\">I&#8217;ve<\/span> <span class=\"hps\">created with the<\/span> <span class=\"hps\">Texsystem<\/span> L<span class=\"hps\">atex.<\/span> <span class=\"hps\">Here<\/span> <span class=\"hps\">I use the<\/span> <span class=\"hps\">software<\/span> T<span class=\"hps\">exLive<\/span> <span class=\"hps\">and<\/span> <span class=\"hps\">the editor<\/span> <span class=\"hps\">WinEdt<\/span>.<\/span><\/p>\n<p>I<span class=\"hps\">n recent weeks\u00a0<\/span><span class=\"hps\">I have experimented<\/span> <span class=\"hps\">and tested<\/span> <span class=\"hps\">on how to<\/span> <span class=\"hps\">best<\/span> <span class=\"hps\">create <\/span><span class=\"hps\">an ebook<\/span> from a tex file. <span class=\"hps\">Initiallyt I<\/span> <span class=\"hps\">had tried<\/span> S<span class=\"hps\">oftcover,<\/span> <span class=\"hps\">but that was<\/span> <span class=\"hps\">only suitable for<\/span> <span class=\"hps\">simple books, p<\/span><span class=\"hps\">ictures where positioned<\/span> <span class=\"hps\">poorly<\/span> <span class=\"hps\">and bibliography<\/span> <span class=\"hps\">does<\/span> <span class=\"hps\">not work.<\/span><\/p>\n<p><span class=\"hps\">Then<\/span> <span class=\"hps\">I came across<\/span> <span class=\"hps\">tex4ebook<\/span>, which <span class=\"hps\">is available here:<\/span> <span class=\"hps\">https:\/\/github.com\/michal-h21\/tex4ebook<\/span>. <span class=\"hps\">After<\/span> <span class=\"hps\">one week of testing<\/span> <span class=\"hps\">and<\/span> <span class=\"hps\">configuration<\/span> <span class=\"hps\">(first with<\/span> <span class=\"hps\">Linux<\/span> <span class=\"hps\">and then<\/span> <span class=\"hps\">Windows<\/span>) at which the <span class=\"hps\">developer<\/span> <span class=\"hps\">Michal<\/span> <span class=\"hps\">was very<\/span> <span class=\"hps\">helpful, I<\/span> <span class=\"hps\">am very satisfied<\/span> <span class=\"hps\">with the result.<\/span> W<span class=\"hps\">ith one click<\/span> <span class=\"hps\">from the text editor<\/span> <span class=\"hps atn\">(<\/span>I use <span class=\"hps\">WinEdt<\/span>) you are able <span class=\"hps\">to<\/span> <span class=\"hps\">create a PDF<\/span> <span class=\"hps\">file and<\/span> <span class=\"hps\">the next<\/span> <span class=\"hps\">click<\/span> creates an e-Book from the same source. Just as <span class=\"hps\">I<\/span> <span class=\"hps\">had imagined<\/span>. <span class=\"hps\">I use<\/span> the L<span class=\"hps\">atex<\/span> T<span class=\"hps\">exLive<\/span> <span class=\"hps\">distribution<\/span>. Initially\u00a0<span class=\"hps\">it<\/span> <span class=\"hps\">did not<\/span> <span class=\"hps\">work with MikTex, later I managed this also. All the <\/span><span class=\"hps\">normal commands plus<\/span> <span class=\"hps\">graphicx<\/span>, <span class=\"hps\">fontspec<\/span>, <span class=\"hps\">bibliography<\/span>, footnotes, <span class=\"hps\">formulas work very well.<\/span><\/p>\n<p><span class=\"hps\">For me<\/span> <span class=\"hps\">this is the best<\/span> <span class=\"hps\">solution I<\/span>&#8218;ve seen so far.<\/p>\n<p>Here are small samples: a <a href=\"http:\/\/www.kreartiv.com\/pdf\/indien-tex.pdf\" target=\"_blank\" rel=\"noopener\">PDF file<\/a> and the same as <a href=\"http:\/\/www.kreartiv.com\/pdf\/indien-tex.epub\" target=\"_blank\" rel=\"noopener\">eBook<\/a> for viewing, reading and comparison. (As an eBook Reader for Andoid I&#8217;ve tested <a href=\"https:\/\/play.google.com\/store\/apps\/details?id=com.gitden.epub.reader.app&amp;hl=de\" target=\"_blank\" rel=\"noopener\">Gitden<\/a>, which works well. On\u00a0 Windows I use <a href=\"http:\/\/calibre-ebook.com\/\" target=\"_blank\" rel=\"noopener\">Calibre<\/a>.) <a href=\"http:\/\/www.kreartiv.com\/pdf\/indien-tex.tex\" target=\"_blank\" rel=\"noopener\">Here <\/a>is the Link to the source file.<\/p>\n<p>A sample of a larger project (and files) can be viewed here:<\/p>\n<ul>\n<li><a href=\"http:\/\/www.pro-barhuf.de\/pdf\/Hufbuch_Auflage3.epub\" target=\"_blank\" rel=\"noopener\">eBook<\/a> (a complete 277 pages book about hoof care, 48 MB )<\/li>\n<li><a href=\"http:\/\/www.pro-barhuf.de\/pdf\/Hufbuch_Auflage3_gross.pdf\" target=\"_blank\" rel=\"noopener\">PDF file<\/a> (the same book from the identical source, 15 MB)<\/li>\n<\/ul>\n<p>Please respect the <a href=\"http:\/\/creativecommons.org\/licenses\/by-nd\/3.0\/de\/\" target=\"_blank\" rel=\"noopener\">copyrights<\/a> for this book. In case you want this book in a printed version, it&#8217;s available from <a href=\"http:\/\/www.lulu.com\/commerce\/index.php?fBuyContent=11975632%22%3E%3Cimg%20src=%22http:\/\/static.lulu.com\/images\/services\/buy_now_buttons\/de\/book_blue2.gif?20120131141155%22%20border=%220%22%20alt=%22Support%20independent%20publishing:%20Buy%20this%20book%20on%20Lulu.%22%3E\" target=\"_blank\" rel=\"noopener\">lulu.com<\/a>.<\/p>\n<h1>Content<\/h1>\n<ul>\n<li style=\"padding-left:30px;\">Instructions<\/li>\n<li style=\"padding-left:30px;text-align:left;\">Installation\n<ul>\n<li style=\"padding-left:30px;text-align:left;\">Install TexLive first<\/li>\n<li style=\"padding-left:30px;text-align:left;\">Alternatively install MiKTeX<\/li>\n<li style=\"padding-left:30px;text-align:left;\">Install tex4ebook<\/li>\n<li style=\"padding-left:30px;text-align:left;\">Creating an eBook with TexLive and TexWorks<\/li>\n<li style=\"padding-left:30px;text-align:left;\">Creating an eBook with MiKTeXand WinEdt<\/li>\n<\/ul>\n<\/li>\n<li style=\"padding-left:30px;text-align:left;\">Important settings for e-books\n<ul>\n<li style=\"padding-left:30px;text-align:left;\">Preamble<\/li>\n<li style=\"padding-left:30px;text-align:left;\">Cover Images<\/li>\n<li style=\"padding-left:30px;text-align:left;\">Images<\/li>\n<li style=\"padding-left:30px;text-align:left;\">Ligatures<\/li>\n<\/ul>\n<\/li>\n<li style=\"padding-left:30px;text-align:left;\">Additional remarks for designing the book\n<ul>\n<li style=\"padding-left:30px;text-align:left;\">Language<\/li>\n<li style=\"padding-left:30px;text-align:left;\">Special characters<\/li>\n<li style=\"padding-left:30px;text-align:left;\">Too long lines<\/li>\n<li style=\"padding-left:30px;text-align:left;\">Images<\/li>\n<li style=\"padding-left:30px;text-align:left;\">EBook Readers<\/li>\n<li style=\"padding-left:30px;text-align:left;\">Creating epub3 files<\/li>\n<li style=\"padding-left:30px;text-align:left;\">Using Tidy to clean-up html files<\/li>\n<li style=\"padding-left:30px;text-align:left;\">Creating mobi files for Amazon Readers<\/li>\n<li style=\"padding-left:30px;text-align:left;\">Mathematical Formulas<\/li>\n<li style=\"padding-left:30px;text-align:left;\">Advanced use of the preamble<\/li>\n<li style=\"padding-left:30px;text-align:left;\">Using the HTML-Files produced and styling for html and epub<\/li>\n<li style=\"padding-left:30px;text-align:left;\">Creating good looking tables<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h1>Important<\/h1>\n<p><strong><em>Please read the full article to the end before you start experimenting. Then read it again and follow the instructions step by step. I&#8217;ve received feedback that combining the TexLive and Miktex instructions into one document makes it difficult to read and follow. I plan to change this soon<\/em>.<\/strong><\/p>\n<h1>Instructions<\/h1>\n<p>last updated 2.3.2015<\/p>\n<ul>\n<li>Added links to new sample files<\/li>\n<\/ul>\n<p>Update 23.2.2015<\/p>\n<ul>\n<li>Added instructions on how to create good looking tables<\/li>\n<\/ul>\n<p>Update 4.2.2015<\/p>\n<ul>\n<li>Added instruction for MiKTeX and some minor changes according to changes in tex4ebook.<\/li>\n<\/ul>\n<p>To create ebooks from new or existing Latex (.tex) files on a Windows PC you need<\/p>\n<ul>\n<li>A Linux-Distribution. I have tested it with TexLive, it might work with MikTex also.<br \/>\n(Download TexLive from https:\/\/www.tug.org\/texlive\/acquire-netinstall.html. Save the file where you find it again for later use.<br \/>\nAlternatively you can use MiKTeX. My first tests with MiKTeX failed, but with some help from Michal Hoftich and Ulrike Fischer I managed to make it work. See the details below.<br \/>\n<strong>Warning<\/strong>: With both packages &#8211; MikTex and TexLive &#8211; installed at the same computer at the same time you will run into problems. Unless you want to spend time to find out how to resolve the issues, work with one package only. I picked TexLive as my favourite.<\/li>\n<li>The Software Tex4ebook from Michal Hoftich. (Download the zip file from https:\/\/github.com\/michal-h21\/tex4ebook and then click on the icon \u201cDownload ZIP\u201d or directly from here https:\/\/github.com\/michal-h21\/tex4ebook\/archive\/master.zip. Save the file where you find it again for later use.<\/li>\n<li>The Software Make4ht from Michal Hoftich<br \/>\n(Download the zip file from https:\/\/github.com\/michal-h21\/make4ht and then click on the icon \u201cDownload ZIP\u201d or directly from here https:\/\/github.com\/michal-h21\/make4ht\/archive\/master.zip. Save the file where you find it again for later use.<\/li>\n<\/ul>\n<h2>Installation<\/h2>\n<p><strong>Install TexLive first<\/strong><\/p>\n<p>Open the file \u201cinstall-tl-windows.exe\u201d from you PC. Follow the instructions given. The installation may take 60 minutes or more depending on your internet connection. Also allow to install the Editor that comes with the package. Compiling the tex-files is easier with a good editor.<\/p>\n<p>After a successful installation you should see this:<\/p>\n<p><a href=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/tex4ebook_1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-238\" src=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/tex4ebook_1.png?w=584\" alt=\"tex4ebook_1\" width=\"584\" height=\"406\" srcset=\"https:\/\/blog.d80fotos.de\/wp-content\/uploads\/2015\/01\/tex4ebook_1.png 746w, https:\/\/blog.d80fotos.de\/wp-content\/uploads\/2015\/01\/tex4ebook_1-300x209.png 300w\" sizes=\"auto, (max-width: 584px) 100vw, 584px\" \/><\/a><\/p>\n<h2>Alternatively Install MiKTeX<\/h2>\n<p>Download the software from <a href=\"http:\/\/miktex.org\/download\" target=\"_blank\" rel=\"noopener\">here<\/a> and run the installer. I used the complete installation. The best editor for MiKTeX is WinEdt. It&#8217;s not free, but worth every cent. It plays well together with TexLive also. Download WinEdt from <a href=\"http:\/\/www.winedt.com\/download.html\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/p>\n<h2>Install tex4ebook<\/h2>\n<p>This is more to \u201ccopy\u201d files to the correct location than \u201cinstalling\u201d anything. Extract the two downloaded zip files where you stored your download.<br \/>\nThis will create two directories<\/p>\n<p>make4htmaster<\/p>\n<p><a href=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/tex4ebook_2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-237\" src=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/tex4ebook_2.png\" alt=\"tex4ebook_2\" width=\"584\" height=\"146\" srcset=\"https:\/\/blog.d80fotos.de\/wp-content\/uploads\/2015\/01\/tex4ebook_2.png 889w, https:\/\/blog.d80fotos.de\/wp-content\/uploads\/2015\/01\/tex4ebook_2-300x75.png 300w, https:\/\/blog.d80fotos.de\/wp-content\/uploads\/2015\/01\/tex4ebook_2-768x193.png 768w\" sizes=\"auto, (max-width: 584px) 100vw, 584px\" \/><\/a><\/p>\n<p>and tex4ebook-master<\/p>\n<p><a href=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/tex4ebook_3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-236\" src=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/tex4ebook_3.png\" alt=\"tex4ebook_3\" width=\"584\" height=\"216\" srcset=\"https:\/\/blog.d80fotos.de\/wp-content\/uploads\/2015\/01\/tex4ebook_3.png 903w, https:\/\/blog.d80fotos.de\/wp-content\/uploads\/2015\/01\/tex4ebook_3-300x111.png 300w, https:\/\/blog.d80fotos.de\/wp-content\/uploads\/2015\/01\/tex4ebook_3-768x284.png 768w\" sizes=\"auto, (max-width: 584px) 100vw, 584px\" \/><\/a><\/p>\n<p>After TexLive is installed go to the Command Line interface (cmd) and enter<\/p>\n<pre>kpsewhich -var-value TEXMFHOME.<\/pre>\n<p>Depending on your Windows Installation and language you will see different output from this command.<\/p>\n<p><a href=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/tex4ebook_4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-235\" src=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/tex4ebook_4.png\" alt=\"tex4ebook_4\" width=\"584\" height=\"296\" srcset=\"https:\/\/blog.d80fotos.de\/wp-content\/uploads\/2015\/01\/tex4ebook_4.png 677w, https:\/\/blog.d80fotos.de\/wp-content\/uploads\/2015\/01\/tex4ebook_4-300x152.png 300w\" sizes=\"auto, (max-width: 584px) 100vw, 584px\" \/><\/a><\/p>\n<p>In my case it was<\/p>\n<pre>C:\/Users\/Volker\/texmf<\/pre>\n<p>You may need to create this directory if it does not exist. Also you need to create the subdirectory<\/p>\n<ul>\n<li>scripts\/lua below texmf and<\/li>\n<li>tex\/latex\/ below texmf<\/li>\n<\/ul>\n<p>Copy the files extracted from the two links above into this directory. In case you decide to copy the directory as from your download storage area you need to rename the directories from<\/p>\n<ul>\n<li>make4ht-master to make4ht and<\/li>\n<li>tex4ebook-master to tex4ebook<\/li>\n<\/ul>\n<p>Then<\/p>\n<ul>\n<li>Copy the directory make4ht with it\u2019s content to texmf\/scripts\/lua<\/li>\n<li>Copy the directory tex4ebook with it\u2019s content to texmf\/tex\/latex\/<\/li>\n<\/ul>\n<p>Finally it should look like this on your PC<br \/>\nBelow the directory C:\/Benutzer\/Volker (resp. your personal settings)<\/p>\n<p><a href=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/tex4ebook_5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-234\" src=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/tex4ebook_5.png\" alt=\"tex4ebook_5\" width=\"168\" height=\"153\" \/><\/a><\/p>\n<p>You should see the texmf directory like this<\/p>\n<p><a href=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/tex4ebook_6.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-233\" src=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/tex4ebook_6.png\" alt=\"tex4ebook_6\" width=\"206\" height=\"149\" \/><\/a><\/p>\n<h2>Creating an eBook with TexLive and TexWorks<\/h2>\n<p>Open Texworks and create a little testfile like this one<\/p>\n<pre>\\documentclass{article}\n \\begin{document}\n hello world\n \\end{document}<\/pre>\n<p>Create a PDF file form this with Xelatex for example and see if your Latex installation works.<\/p>\n<p><a href=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/tex4ebook_7.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-232\" src=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/tex4ebook_7.png\" alt=\"tex4ebook_7\" width=\"294\" height=\"219\" \/><\/a><\/p>\n<p>As a result a PDF file should open in a separate window. Now you can proceed to create an e-book from this file.<\/p>\n<p><strong>Note:<\/strong> With more complicated files like for the examples below and the source file you find on this page I have recognized that you best use <strong>LuaLatex <\/strong>to compile your tex file and create the PDF.<\/p>\n<p>To make this easy without using the command line and bat files open \u201cbearbeiten\u201d and click on \u201cEinstellungen\u201d<\/p>\n<p><a href=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/tex4ebook_8.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-231\" src=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/tex4ebook_8.png\" alt=\"tex4ebook_8\" width=\"428\" height=\"333\" srcset=\"https:\/\/blog.d80fotos.de\/wp-content\/uploads\/2015\/01\/tex4ebook_8.png 428w, https:\/\/blog.d80fotos.de\/wp-content\/uploads\/2015\/01\/tex4ebook_8-300x233.png 300w\" sizes=\"auto, (max-width: 428px) 100vw, 428px\" \/><\/a><\/p>\n<p>This window will open<\/p>\n<p><a href=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/tex4ebook_9.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-230\" src=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/tex4ebook_9.png\" alt=\"tex4ebook_9\" width=\"584\" height=\"484\" srcset=\"https:\/\/blog.d80fotos.de\/wp-content\/uploads\/2015\/01\/tex4ebook_9.png 692w, https:\/\/blog.d80fotos.de\/wp-content\/uploads\/2015\/01\/tex4ebook_9-300x248.png 300w\" sizes=\"auto, (max-width: 584px) 100vw, 584px\" \/><\/a><\/p>\n<p>Click on the plus sign to create a new entry<\/p>\n<p><a href=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/tex4ebook_10.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-229\" src=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/tex4ebook_10.png\" alt=\"tex4ebook_10\" width=\"480\" height=\"318\" srcset=\"https:\/\/blog.d80fotos.de\/wp-content\/uploads\/2015\/01\/tex4ebook_10.png 480w, https:\/\/blog.d80fotos.de\/wp-content\/uploads\/2015\/01\/tex4ebook_10-300x199.png 300w\" sizes=\"auto, (max-width: 480px) 100vw, 480px\" \/><\/a><\/p>\n<p>Enter a Name like \u201cE-Book\u201d (or whatever you like) and enter the command \u201ctexlua\u201d in the field below.<\/p>\n<p>Next click on the + sign for adding arguments to this command. Enter<\/p>\n<pre>C:\\Users\\Volker\\texmf\\tex\\latex\\tex4ebook\\tex4ebook.lua<\/pre>\n<p>As first argument (This is exactly the location of the tex4ebbook.lua file on your PC. Your location might be different according to you Windows installation). As second argument enter<\/p>\n<pre>$fullname<\/pre>\n<p><a href=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/tex4ebook_11.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-228\" src=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/tex4ebook_11.png\" alt=\"tex4ebook_11\" width=\"480\" height=\"318\" srcset=\"https:\/\/blog.d80fotos.de\/wp-content\/uploads\/2015\/01\/tex4ebook_11.png 480w, https:\/\/blog.d80fotos.de\/wp-content\/uploads\/2015\/01\/tex4ebook_11-300x199.png 300w\" sizes=\"auto, (max-width: 480px) 100vw, 480px\" \/><\/a><\/p>\n<p>Finally click on OK for each open window (2) to close and save your changes.<br \/>\nFrom the menu select E-Book as the \u201cCompiler\u201d and click on the green \u201crun\u201d button.<\/p>\n<p><a href=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/tex4ebook_12.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-227\" src=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/tex4ebook_12.png\" alt=\"tex4ebook_12\" width=\"222\" height=\"230\" \/><\/a><\/p>\n<p>In later tests I have recognized that TexWorks has problems in working with additional arguments, at least I did not manage to make it work and did not want to spend more time in finding it out. I strongly recommend to use WinEdt. It&#8217;s a far more advanced Editor and it works. So, if you want to use the advantages of advanced styling of your ebook chnage from here on to WinEdt.<\/p>\n<p>Other Tex-Editors may have other ways of adding these execution commands. I have managed this in WinEdt also. If you use WinEdt, you may know how to do this, if not you find some hints in the help file.<\/p>\n<p>I have used the Luatex entry of the execution modes and mis-used it for creating ebooks<br \/>\nThat\u2019s how it looks in WinEdt 8.<\/p>\n<p><a href=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/tex4ebook_13.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-226\" src=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/tex4ebook_13.png\" alt=\"tex4ebook_13\" width=\"584\" height=\"462\" srcset=\"https:\/\/blog.d80fotos.de\/wp-content\/uploads\/2015\/01\/tex4ebook_13.png 701w, https:\/\/blog.d80fotos.de\/wp-content\/uploads\/2015\/01\/tex4ebook_13-300x238.png 300w\" sizes=\"auto, (max-width: 584px) 100vw, 584px\" \/><\/a><\/p>\n<p>At the end of the document is an example of a full featured setting for the parameters.<\/p>\n<p>The creation of the e-book should run without error messages and if so, you will find the ebook in an subdirectory of the original tex-file location with the name [filename]-epub and inside you have your e-book named [filename].epub<\/p>\n<p><a href=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/tex4ebook_14.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-225\" src=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/tex4ebook_14.png\" alt=\"tex4ebook_14\" width=\"584\" height=\"103\" srcset=\"https:\/\/blog.d80fotos.de\/wp-content\/uploads\/2015\/01\/tex4ebook_14.png 761w, https:\/\/blog.d80fotos.de\/wp-content\/uploads\/2015\/01\/tex4ebook_14-300x53.png 300w\" sizes=\"auto, (max-width: 584px) 100vw, 584px\" \/><\/a><\/p>\n<p>If you have Calibre installed, you can open the book and check the content.<\/p>\n<p><a href=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/tex4ebook_15.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-224\" src=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/tex4ebook_15.png\" alt=\"tex4ebook_15\" width=\"584\" height=\"689\" srcset=\"https:\/\/blog.d80fotos.de\/wp-content\/uploads\/2015\/01\/tex4ebook_15.png 664w, https:\/\/blog.d80fotos.de\/wp-content\/uploads\/2015\/01\/tex4ebook_15-254x300.png 254w\" sizes=\"auto, (max-width: 584px) 100vw, 584px\" \/><\/a><\/p>\n<p>From here you can experiment with different tex-files that you already have and\/or add commands to your current file to learn more how the eBook compares with PDF files for printing.<\/p>\n<p>I have tested<\/p>\n<ul>\n<li>The normal tex stuff<\/li>\n<li>Including a cover page<\/li>\n<li>Title<\/li>\n<li>Index<\/li>\n<li>Using fonts with fontspec<\/li>\n<li>Bibligraphy<\/li>\n<li>Footnotes<\/li>\n<li>Ligatures (resp. not using them in html\/epub)<\/li>\n<li>Math formulas<\/li>\n<li>Special charactes like those \u00fc\u00e4\u00f6\u00dc\u00c4\u00d6\u00df\u0169\u0129\u00f5\u00e3\u00a0 and the inverted \u01dd<\/li>\n<\/ul>\n<p>All that works!<\/p>\n<p><strong>Reminder:<\/strong> You should use <strong>LuaLatex <\/strong>to compile your tex file and create the PDF from this same file. With XeLatex it did not work for me.<\/p>\n<h2>Creating an eBook with MikTex and WinEdt<\/h2>\n<p>Creating the eBook with MiKTeX has some hurdles due to &#8211; as it seems &#8211; a software bug in MiKTeX. After the successful installation of MiKTeX you should perform a quick test, if creating PDF files works. If this is OK you need to install tex4ebook. Different to TexLive MiKTex does not give you a texmf path with the command<\/p>\n<pre>kpsewhich -var-value TEXMFHOME.<\/pre>\n<p>The result is like this and not very helpful<\/p>\n<p><a href=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/2015-02-04_09-55-08.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-283\" src=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/2015-02-04_09-55-08.jpg\" alt=\"2015-02-04_09-55-08\" width=\"660\" height=\"167\" \/><\/a><\/p>\n<p>So you have to do it manually. Create a directory texmf in C:\/Users\/[user name]\/texmf. In my case I created:<\/p>\n<pre>C:\/Users\/vg\/texmf<\/pre>\n<p>You now need to tell MiKTeX to be able to find this directory to execute tex4ebook. WinEdt has a great tool to do this. In case you know more about Latex then I do, you may find different ways of achieving this. I used WinEdt. So open WinEdt and select Tex\/MiKTeX\/MiKTeX Options from the menu.<\/p>\n<p><a href=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/2015-02-04_18-28-34.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-284\" src=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/2015-02-04_18-28-34.jpg\" alt=\"2015-02-04_18-28-34\" width=\"660\" height=\"760\" \/><\/a><\/p>\n<p>The below windows will open. Click on &#8222;Add..-&#8220; and add the directory c:\\Users\\vg\\texmf resp. your exact directory to the list.<\/p>\n<p><a href=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/2015-02-04_09-54-12.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-285\" src=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/2015-02-04_09-54-12.jpg\" alt=\"2015-02-04_09-54-12\" width=\"615\" height=\"689\" \/><\/a><\/p>\n<p>Next change the settings in Options\/Execution Modes exactly as described above for TexLive.<\/p>\n<p><a href=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/2015-02-04_18-43-43.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-287\" src=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/2015-02-04_18-43-43.jpg\" alt=\"2015-02-04_18-43-43\" width=\"660\" height=\"518\" \/><\/a><\/p>\n<p>The Text in the &#8222;Parameters&#8220; field is like this<\/p>\n<pre>\"C:\\Users\\vg\\texmf\\tex\\latex\\tex4ebook\\tex4ebook.lua\" \"%N%T\"<\/pre>\n<p>Next is a correction of a software bug in MiKTex. If you would create an eBook now, you will get an error message like this one, unless MiKTeX has updated the software by the time you read this. (Thanks to Ulrike Fischer for finding this out).<\/p>\n<pre>(C:\/Program Files\/MiKTeX\n 2.9\/tex4ht\/ht-fonts\/unicode\/lm\/lm-rep-cmrm.htf)\n--- error --- Illegal storage address\nMake4ht: Fatal error. Command tex4ht returned exit code 1<\/pre>\n<p>This is a problem of tex4ht in MiKTeX: it doesn&#8217;t find the unicode.4hf file. The workaround is to move unicode.4hf &#8222;one folder down&#8220;, so that miktex can find it. Locate the file here<\/p>\n<pre>D:\/MiKTeX2.9\/tex4ht\/ht-fonts\/unicode\/unicode.4hf<\/pre>\n<p>Create a directory below ..\/unicode\/charset and call it ..\/unicode\/charset\/uni and copy the file unicode.4hf to this directory.<\/p>\n<p><a href=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/2015-02-04_19-08-35.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-290\" src=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/2015-02-04_19-08-35.jpg\" alt=\"2015-02-04_19-08-35\" width=\"525\" height=\"386\" \/><\/a><\/p>\n<p>Now you can start compiling an eBook by selecting &#8222;LuaTeX&#8220; from the drop down menu. If you are a fan of command lines you know how to do this anyhow.<\/p>\n<p><a href=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/2015-02-04_18-49-06.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-288\" src=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/2015-02-04_18-49-06.jpg\" alt=\"2015-02-04_18-49-06\" width=\"303\" height=\"529\" \/><\/a><\/p>\n<p>You now should have your test epub file in the same folder as your tex file. There are two errors to correct still. One is to install tidy. This is explained below and not different to TexLive.<\/p>\n<p>The second issue is that MiKTeX complains not beeing able to find &#8222;zip&#8220;. This is due to a different naming of the file compared to TexLive. MiKTeX calls the file miktex-zip.exe, TexLive calls it zip.exe. So just locate the file in the directory<\/p>\n<pre>D:\/MiKTeX2.9\/miktex\/bin<\/pre>\n<p>Copy the file miktex-zip.exe, paste it in the same place and call it zip.exe. Done.<\/p>\n<p>The following instructions are valid for both TexLive and MiKTeX.<\/p>\n<h1>Important settings for e-books<\/h1>\n<h2>Preamble<\/h2>\n<p>In case you want to use special fonts with the fontspec package of Latex you need to have the following lines of code in your preamble of the tex file after declaring the document class<\/p>\n<pre>\\ifdefined\\HCode\n \\usepackage[ngerman]{babel}\n \\usepackage[T1]{fontenc}\n \\usepackage[utf8]{inputenc}\n \\else\n \\usepackage{polyglossia} %includes fontspec package\n \\setmainfont[Ligatures=TeX]{DejaVu Serif Condensed} \n%or any font you like to use\n \\setsansfont[Ligatures=TeX]{DejaVu Sans}\n \\fi<\/pre>\n<p>The first part is used for the ebook, the second part for your PDF file. Below these lines you may add commands and include packages that can\/must be used for both output formats.<\/p>\n<p>Some packages don&#8217;t work well with tex4ht (used to create the html file and then the epub file with tx4ht) and at the same time they don&#8217;t have much sense to be used in html. Some examples of such packages are fancyhdr or pdfpages. You should put them into \\else branch of the preamble<\/p>\n<h2>Cover Image<\/h2>\n<p>In case you want to include a cover image for your e-Book you have to add the command<\/p>\n<pre>\\usepackage{tex4ebook}<\/pre>\n<p>to the preamble of your tex-file. Additionally as the first line after \\begin{document} add<\/p>\n<pre>\\coverimage[width=1\\textwidth]{filelocation\/filename}<\/pre>\n<p>By that the cover image will only be added to the E-Book and the PDF file. This is helpful, if you want to distribute the PDF file with a cover. For printed books you mostly need a separate cover file and would not need this.<\/p>\n<p><strong>Note:<\/strong> If you use the document class<\/p>\n<pre>\\documentclass[12pt,twoside]{scrbook}<\/pre>\n<p>for your PDF file and try to create an eBook in epub3 format with it, the cover page will most probably move to the end of the book, which is not desired. To prevent that from happening you could use different document classes for books and eBooks like this:<\/p>\n<pre>\\ifdefined\\HCode\n\u00a0\u00a0\u00a0 \\documentclass[12pt,oneside]{book}\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 .... more definitions ...\n\\else\n\u00a0\u00a0\u00a0\u00a0 \\documentclass[12pt,twoside]{scrbook\n\u00a0\u00a0\u00a0\u00a0 .... more definitions ...\n\\fi<\/pre>\n<p>Below you find an other way of achieving this. Read &#8222;Advanced use of the preamble&#8220;.<\/p>\n<h2>Images<\/h2>\n<p>Images \u2013 different to only producing PDF files \u2013 must be stored in the same directory as the tex file or better in a directory below e.g. \\images.<\/p>\n<p>If this is not modified in existing tex files, the image will not be displayed in the ebook or the html file. You then access the images with this command:<\/p>\n<pre>\\includegraphics[width=1\\textwidth]{images\/image.jpg}<\/pre>\n<p>Or any other image placing command you might be using.<\/p>\n<h2>Ligatures<\/h2>\n<p>Tex supports <a href=\"http:\/\/en.wikipedia.org\/wiki\/Typographic_ligature\" target=\"_blank\" rel=\"noopener\">Ligatures<\/a> when the fonts used have them as glyphs. Most standard fonts used in html and e-books do not have ligatures. In consequence you will see a blank space instead of an \u201cff\u201d or \u201cfl\u201d or similar combinations that normally are converted to ligatures.<br \/>\nTo prevent this from happening in e-Books you need to create file with following content:<\/p>\n<pre>local filter = require \"make4ht-filter\"\n local process = filter{ \"fixligatures\", \"hruletohr\"}\n Make:htlatex()\n Make:htlatex()\n Make:htlatex()\n Make:match(\"html$\",process)<\/pre>\n<p>Save it in the same directory as your tex-file with the name of your tex-file and the extension .mk4 (eg.: mytexfile.mk4).<\/p>\n<p>This file will be used by tex4ebook automatically when creating the e-Book and removes the ligatures resp. replaces them with standard characters.<\/p>\n<h1>Additional remarks for designing the book<\/h1>\n<h2>Language<\/h2>\n<p>To use the right language for words like \u201eChapter\u201c and the corrrect hyphenation you need to declare the language to be used.<\/p>\n<pre>\\usepackage{polyglossia} %l\u00e4dt auch fontspec\n %\\usepackage{fontspec}\n \\setdefaultlanguage [spelling=new]{german}<\/pre>\n<h2>Special charters<\/h2>\n<p>To use special characters that are supported by fontspec for creating PDF files but not by tex4ht you need to include some special commands in the preamble after<\/p>\n<pre>\\ifdefined\\HCode\n<\/pre>\n<pre>\\usepackage{newunicodechar}\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \\newunicodechar{\u0169}{\\~{u}}\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \\newunicodechar{\u00ad}{--}\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \\newunicodechar{\u0129}{\\~{i}}\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \\newunicodechar{\u2013}{--}\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \\newcommand\\utfentity[2]{\\newunicodechar{#1}\n {\\HCode{\\string&amp;\\#x#2;}}}\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \\utfentity{\u01dd}{01DD}<\/pre>\n<p>and before<\/p>\n<pre> \\else<\/pre>\n<p>By this you can print the above defined characters in html and in the ebook as long as they are available in the font you are using. To test it: Arial has them all, otherwise it&#8217;s a boring font. You may need more and different ones depending on you language and needs. There is more information one the new unicode character package <a href=\"http:\/\/www.ctan.org\/pkg\/newunicodecharhttp:\/\/\" target=\"_blank\" rel=\"noopener\">here<\/a>. Michal has been a great help in this area.<\/p>\n<h2>Too long lines<\/h2>\n<p>If you lines are getting too long because hyphenation does not work, use this<\/p>\n<pre>\\sloppy<\/pre>\n<p>This is applied to the complete book. If you need this for a paragraph only do this:<\/p>\n<pre>\\begin{sloppypar}\n Text\n \\end{sloppypar}<\/pre>\n<h2>Images<\/h2>\n<p>General remark: To print a good looking image on the maximum width of an A4 page (21cm) with 300 dpi you need an image width of appr. 2.500 pixels. In consequence your images don\u2019t have to be larger than this or even smaller if your book is smaller and you do not use the full size of the page. Fitting the image size to the maximum need reduces the time for compilation for each image and the size of you PDF file.<\/p>\n<p>To get to the maximum size needed do this calculation: Convert the image width to inches, by dividing the cm with 2.54. Multiply this with 300, e.g. (16 cm \/ 2.54) x 300 dpi = 1.889 (pixels for the image). This also means: don\u2019t use smaller images. They will not look good in your book.<\/p>\n<p>Images for the full width of the print area look good with these commands:<\/p>\n<pre>\\begin{figure}\n \\includegraphics[width=1\\textwidth]{images\/VGO_0250.jpg}\n \\caption{irgendwas}\n \\label{irgendwas}<\/pre>\n<p>Images with a caption left or right look good like this. You may want to modify the width of the image by changing the number 0.5 to a higher or lower value depending on what you want to show.<\/p>\n<pre>\\begin{figure} [t]\n \\begin{captionbeside}{Peter und Luise}[i]\n \\includegraphics [width=0.5\\textwidth] {images\/ewald-u1_009.jpg}\n \\end{captionbeside}\n \\label{Peter_und_Luise}\n \\end{figure}<\/pre>\n<p>Images in block of four (2 x 2) look good like this:<\/p>\n<pre>\\begin{figure}\n \\subfigure[Bildtext 1] {\\includegraphics[width=0.5\\textwidth]\n{images\/bell1.jpg}}\n \\subfigure[Bildtext 2] {\\includegraphics[width=0.5\\textwidth]\n{images\/bell1.jpg}}\n \\subfigure[Bildtext 3] {\\includegraphics[width=0.5\\textwidth]\n{images\/bell1.jpg}}\n \\subfigure[Bildtext 4] {\\includegraphics[width=0.5\\textwidth]\n{images\/bell1.jpg}}\n \\caption{Vier Bilder im Block}\n \\label{Bell}\n \\end{figure}<\/pre>\n<p>Images in a block of two next to each other look good like this:<\/p>\n<pre>\\begin{figure}\n \\subfigure[Bildtext 1] {\\includegraphics[width=0.5\\textwidth] \n{images\/ewald-u1_009.jpg}}\n \\subfigure[Bildtext 2] {\\includegraphics[width=0.5\\textwidth] \n{images\/ewald-u1_009.jpg}}\n \\caption{Zwei Bilder nebeneinander}\n \\label{Bell}\n \\end{figure}<\/pre>\n<p>All these images are converted to eBooks very well.<\/p>\n<h2>E-Book reader<\/h2>\n<p>To test your e-Book on Windows you may use <a href=\"http:\/\/calibre-ebook.com\/\">Calibre<\/a>.<br \/>\nTo test it on an Android Smartphone or Tablet best use the free <a href=\"https:\/\/play.google.com\/store\/apps\/details?id=com.gitden.epub.reader.app&amp;hl=dehttp:\/\/\">Gitden Reader<\/a> available in Googles PlayStore.<\/p>\n<h2>Creating epub3 files<\/h2>\n<p>The format <a href=\"http:\/\/idpf.org\/epub\/30http:\/\/\" target=\"_blank\" rel=\"noopener\">epub3<\/a> is more advanced and creates better looking eBooks. The above reader can handle this file format, some older reader will not open epub3 files. In case you decide to create epub 3 files you need to add a parameter to the compilation command:<\/p>\n<pre>-f epub3<\/pre>\n<p>The full command may look like this (in on eline of course):<\/p>\n<pre>\"C:\\Users\\Volker\\texmf\\tex\\latex\\tex4ebook\\tex4ebook.lua\" \n-c config.cfg\u00a0 -i -f epub3 \"%N%T\"<\/pre>\n<h2>Using Tidy to clean-up html files<\/h2>\n<p>To create &#8222;clean&#8220; html files that create &#8222;clean&#8220; eBooks you may include the software <strong>tidy <\/strong>in the command for compiling the book. You do this by adding the parameter t like this<\/p>\n<pre>-t<\/pre>\n<p>The complete command looks like this<\/p>\n<pre>\"C:\\Users\\Volker\\texmf\\tex\\latex\\tex4ebook\\tex4ebook.lua\" \n-c config.cfg\u00a0 -i -f epub3 -t \"%N%T\"<\/pre>\n<p>To make it work you need to download and install tidy first. Download the file from <a href=\"http:\/\/www.paehl.com\/open_source\/?HTML_Tidy_for_Windows\" target=\"_blank\" rel=\"noopener\">here<\/a>. Unzip the file to get tidy.exe. Create a directory &#8222;tidy&#8220; below C:\/Programme(x86). Copy the file tidy.exe to this directory.<\/p>\n<p>Using the tool Path Editor, that you can download from <a href=\"\/\/patheditor2.codeplex.com\/\" target=\"_blank\" rel=\"noopener\">here, <\/a>add the path &#8222;\\tidy&#8220; to the system settings so that the script is able to find the file.<\/p>\n<h2>Creating mobi files for Amazon Readers<\/h2>\n<p>Tex4ebook allows to directly create mobi files by adding the parameter<\/p>\n<pre>-mobi<\/pre>\n<p>to the command. The full command in thsi case looks like this<\/p>\n<pre>\"C:\\Users\\Volker\\texmf\\tex\\latex\\tex4ebook\\tex4ebook.lua\" \n-c config.cfg\u00a0 -i -f mobi -t \"%N%T\"<\/pre>\n<p>To make this work you need to download and install &#8222;kindlegen&#8220;. Download kindlegen from <a href=\"http:\/\/www.amazon.com\/gp\/feature.html?docId=1000765211\" target=\"_blank\" rel=\"noopener\">here<\/a>. Next extract the files to a known directory, then copy them to a directory called &#8222;kindlegen&#8220; below C:\/Programme(x86). The important file is kindlegen.exe.<\/p>\n<p>Using the tool Path Editor, that you can download from <a href=\"\/\/patheditor2.codeplex.com\/\" target=\"_blank\" rel=\"noopener\">here, <\/a>add the path &#8222;\\kindlegen&#8220; to the system settings so that the script is able to find the file.<\/p>\n<p><strong>Note on the mobi format: <\/strong>Mobi is not as advanced as epub3 and not really good for mathematical formulas. It currently does not support mathml. So if you need this, stay away from mobi. It&#8217;s good for &#8222;normal&#8220; books.<\/p>\n<h2>Mathematical Formulas<\/h2>\n<p>To make use of the advanced presentation of mathematical formulas with epub3 in your ebook you finally cann add<\/p>\n<pre>mathml<\/pre>\n<p>as a parameter to you compilation command:<\/p>\n<pre>\"C:\\Users\\Volker\\texmf\\tex\\latex\\tex4ebook\\tex4ebook.lua\" \n-c config.cfg\u00a0 -i -f epub3 \"%N%T\" mathml<\/pre>\n<p>Here is an example screenshot from an Android smartphone using the Gitden reader.<\/p>\n<p><a href=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/screen_20150122_1818.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-270\" src=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/screen_20150122_1818.jpg?w=576\" alt=\"screen_20150122_1818\" width=\"576\" height=\"1024\" srcset=\"https:\/\/blog.d80fotos.de\/wp-content\/uploads\/2015\/01\/screen_20150122_1818.jpg 1080w, https:\/\/blog.d80fotos.de\/wp-content\/uploads\/2015\/01\/screen_20150122_1818-169x300.jpg 169w, https:\/\/blog.d80fotos.de\/wp-content\/uploads\/2015\/01\/screen_20150122_1818-576x1024.jpg 576w, https:\/\/blog.d80fotos.de\/wp-content\/uploads\/2015\/01\/screen_20150122_1818-768x1365.jpg 768w, https:\/\/blog.d80fotos.de\/wp-content\/uploads\/2015\/01\/screen_20150122_1818-864x1536.jpg 864w\" sizes=\"auto, (max-width: 576px) 100vw, 576px\" \/><\/a><\/p>\n<h1>Advanced use of the preamble<\/h1>\n<p>You may have recognized that the preamble has some large modifications. You might find it easier to seperate the files into one preamble for the PDF-Book and one for the eBook and from there use the same file for the main content of the book. Like this:<\/p>\n<p>for PDF<\/p>\n<pre>\\documentclass{scrbook}\n\\usepackage{fontspec}\n...and more ...\n\\begin{document}\n\\input{text}\n\\end{document}<\/pre>\n<p>for eBook\/epub<\/p>\n<pre>documentclass{book}\n\\usepackage{...}\n\\begin{document}\n\\input{text}\n\\end{document}<\/pre>\n<p>The common file text.tex will look like this<\/p>\n<pre>\\maketitle\n\\tableofcontents\n\\chapter{...}<\/pre>\n<h2>Using the HTML-Files produced and styling for html and epub<\/h2>\n<p>The html file created as a side product of the conversion process from tex to eBook can be used to create a website of your book. If you know a little about modifying the look of a html file with css style sheets it is easy to achieve.<\/p>\n<p>The software creates \u2013 depending on the number of chapters in your book \u2013 various html files all starting with the name of your original tex-file. You can combine them in one file or leave them as single chapter files and put them on a webserver. By opening the single files you\u2019ll quickly identify it\u2019s content and put them in the correct order.<\/p>\n<p>To make cusstomized css work you need to create a file config.cfg stored in the same directory as your tex file with this content:<\/p>\n<pre>\\Preamble{xhtml}\n\\begin{document}\n\\CssFile[custom.css] \n\/* css.sty *\/\n\\EndCssFile\n\\Configure{CoverMimeType}{image\/jpg}\n\\EndPreamble<\/pre>\n<p>The custom css will be used by adding a parameter to the compiling command like this:<\/p>\n<pre>\"C:\\Users\\Volker\\texmf\\tex\\latex\\tex4ebook\\tex4ebook.lua\"\n -c config.cfg \"%N%T\"<\/pre>\n<p>Next you create a style sheet and call it custom.css. Inside this file you can add the style definitions like this one<\/p>\n<pre>div.figure img {\ntext-align:center; \nwidth: 100%\n}<\/pre>\n<p>This is for displaying all images as wide as the page is like on the book page<\/p>\n<pre>body {\nfont-family: \"Georgia\", Times, serif; \nfont-size: 1em; \nline-height: 1.35em; \nwidth: 19cm; \npadding-left: 2.5cm; \npadding-right: 2cm; \npadding-top: 2cm;\n}<\/pre>\n<p>This is for selecting a different font, if you like and adjusting the line space for better legibility. It is also for limiting the width of the page and good margins. By this your web-page looks more like a book page.<\/p>\n<p>If you want the text in your eBook with full justification (Blocksatz in German) but not the heading you can add &#8222;text-align: justify&#8220; to the body and &#8222;text-align: left&#8220; to the headings like this in custom.css<\/p>\n<pre>body\n\u00a0\u00a0 \u00a0{\n\u00a0\u00a0 \u00a0font-family: \"Georgia\", serif; \n\u00a0\u00a0 \u00a0font-size: 1em; \n\u00a0\u00a0 \u00a0line-height: 1.35em;\n\u00a0\u00a0 \u00a0hyphens: auto; \n\u00a0\u00a0 \u00a0text-align: justify;\n    }\n\nh2.titleHead\n\u00a0\u00a0 \u00a0{\n\u00a0\u00a0 \u00a0line-height: 1.5em;\n\u00a0\u00a0 \u00a0}\n\nh1,\nh2,\nh3,\nh4\n\u00a0\u00a0 \u00a0{\n\u00a0\u00a0 \u00a0text-align: left;\n\u00a0\u00a0 \u00a0}<\/pre>\n<p><strong>Note:<\/strong> The page-width and padding commands do not work well with eBook files. So if your priority is on eBook, do not use the width and padding styles. If you want to use it for html website, have a second run after your eBook is finished with the width and padding set to the correct values.<\/p>\n<p>One other thing that might not look in your eBook like in the PDF file is how lists are displayed. This can also be modified in the custom css file.<\/p>\n<p>Also instead of putting all single html files into one large file you can create a file named index.asp (or similar if you use php) to combine the single html files into one document. Here is an asp example:<\/p>\n<pre>&lt;!DOCTYPE HTML PUBLIC \"-\/\/W3C\/\/DTD HTML 4.01 Transitional\/\/EN\" \n\"http:\/\/www.w3.org\/TR\/html4\/loose.dtd\"&gt;\n&lt;html&gt;\n\u00a0&lt;head&gt;\n\u00a0 &lt;title&gt; test ebook &lt;\/title&gt;\n\u00a0 &lt;meta name=\"Generator\" content=\"EditPlus\"&gt;\n\u00a0 &lt;meta name=\"Author\" content=\"\"&gt;\n\u00a0 &lt;meta name=\"Keywords\" content=\"\"&gt;\n\u00a0 &lt;meta name=\"Description\" content=\"\"&gt;\n\u00a0 &lt;link rel=\"stylesheet\" type=\"text\/css\" href=\"test-fontspec.css\" \/&gt; \n\u00a0&lt;\/head&gt;\n\u00a0&lt;body&gt;\n\u00a0 &lt;div class=\"page-wrap\"&gt;\n&lt;!--#include file=\"test-fontspec.html\"--&gt;\n&lt;!--#include file=\"test-fontspecli1.html\"--&gt;\n&lt;!--#include file=\"test-fontspecch1.html\"--&gt;\n&lt;!--#include file=\"test-fontspecli2.html\"--&gt;\n&lt;!--#include file=\"test-fontspec4.html\"--&gt;\n&lt;!--#include file=\"test-fontspec5.html\"--&gt;\n&lt;!--#include file=\"test-fontspec6.html\"--&gt;\n&lt;\/div&gt;\n\u00a0&lt;\/body&gt;\n&lt;\/html&gt;<\/pre>\n<h1>Creating good looking tables<\/h1>\n<p>Tables are difficult in any word processing software. And Latex is very special. Here is a way how I think you could create good looking tables with Latex for your PDF file and your eBook.<\/p>\n<p>I decided to use the package tabularx for this. Consequently you need to add a few more lines to you preamble before \\begin{document}. For detailed information and complete documention of the package look <a href=\"https:\/\/www.ctan.org\/pkg\/tabularx\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/p>\n<pre>\\usepackage{booktabs} %Professionelle Tabellen\n\\usepackage[para]{threeparttable} %Tabellen mit Legenden\n\\usepackage{tabularx} %automatische Zeilenumbruch erm\u00f6glicht\n\\usepackage{colortbl}% http:\/\/ctan.org\/pkg\/colortbl\n\\usepackage{xcolor}% http:\/\/ctan.org\/pkg\/xcolor\n\\usepackage{caption}\n\\captionsetup{labelsep=colon,justification=raggedright,\nsinglelinecheck=off}<\/pre>\n<p>After you have done this you can include a table like this:<\/p>\n<pre>\\chapter{A Table for eBooks}\n\u00a0\u00a0 {\\renewcommand{\\arraystretch}{2}\n\u00a0\u00a0 \\begin{table}[th]\n\u00a0\u00a0\u00a0\u00a0\u00a0 \\caption {\\textbf{This could be a nice looking table}}\n\u00a0\u00a0\u00a0\u00a0\u00a0 \\label{uebersicht}\n\u00a0\u00a0\u00a0\u00a0\u00a0 \\newcolumntype{Y}{&gt;{\\raggedright\\arraybackslash\\hsize=.25\\hsize}X} % 25% line width\n\u00a0\u00a0\u00a0\u00a0\u00a0 \\newcolumntype{Z}{&gt;{\\raggedright\\arraybackslash\\hsize=.50\\hsize}X} % 50% line width\n\u00a0\u00a0\u00a0\u00a0\u00a0 \\newcolumntype{Q}{&gt;{\\raggedright\\arraybackslash}X} % line width default\n\u00a0\u00a0\u00a0\u00a0\u00a0 \\begin{tabularx}{\\textwidth}{ZYY}\n\u00a0\u00a0\u00a0\u00a0\u00a0 \\rowcolor{gray!30} \\textbf{Lorem} &amp;\u00a0 \\textbf{Ipsum}\u00a0 &amp;\u00a0 \\textbf{Dolor}\u00a0\u00a0 \\\\ \\midrule %table header\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.\u00a0 &amp; Lorem ipsum\u00a0 &amp;\u00a0\u00a0\u00a0 Aenean massa.\u00a0 \\\\ \\midrule\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Lorem ipsum dolor sit amet\u00a0 &amp; Consectetuer adipiscing elit. &amp;\u00a0 Nascetur ridiculus mus.\u00a0 \\\\ \\midrule\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 4711 &amp; 0815 &amp; 200.000\u00a0 \\\\\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \\bottomrule\n\u00a0\u00a0\u00a0\u00a0\u00a0 \\end{tabularx}\n\u00a0\u00a0 \\end{table}\n<\/pre>\n<p>The first command<\/p>\n<pre>{\\renewcommand{\\arraystretch}{2}<\/pre>\n<p>takes care of increasing the white space between tables rows. The number is a factor to increase it. You may want to play with it to fit your taste.<\/p>\n<p>These three lines define new column types. You may add more definitions according to your needs and the requirements of your table.<\/p>\n<pre>\\newcolumntype{Y}{&gt;{\\raggedright\\arraybackslash\\hsize=.25\\hsize}X} \n\\newcolumntype{Z}{&gt;{\\raggedright\\arraybackslash\\hsize=.50\\hsize}X} \n\\newcolumntype{Q}{&gt;{\\raggedright\\arraybackslash}X}<\/pre>\n<ul>\n<li>The first line defines a column of 25% width of the table width and is called Y.<\/li>\n<li>The second line defines a column of 50% width of the table width and is called Z.<\/li>\n<li>The third line defines a default column width and is called Q.<\/li>\n<\/ul>\n<p>This helps to control the look of your table according to it&#8217;s content. By changing \\raggedright to \\raggedleft or \\justify you can also adopt the justification of text in the columns.<\/p>\n<p>This defines the start of the table:<\/p>\n<pre>\\begin{tabularx}{\\textwidth}{ZYY}<\/pre>\n<p>This line defines the table header. In this example with a gray background and bold text:<\/p>\n<pre>\\rowcolor{gray!30} \\textbf{Lorem} &amp;\u00a0 \\textbf{Ipsum}\u00a0 &amp;\u00a0 \\textbf{Dolor}<\/pre>\n<p>Following these commands you add the content itself with \\midrule and close the table with a \\bottomrule.<\/p>\n<p>The final table in PDF looks like this:<\/p>\n<p><a href=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/table_test_pdf.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-326\" src=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/table_test_pdf.jpg\" alt=\"table_test_pdf\" width=\"660\" height=\"446\" \/><\/a><\/p>\n<p>And the table in the eBook opened with Calubre looks like this:<\/p>\n<p><a href=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/table_test_ebook-jpg.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-325\" src=\"https:\/\/d800fotos.files.wordpress.com\/2015\/01\/table_test_ebook-jpg.png\" alt=\"table_test_ebook.jpg\" width=\"419\" height=\"868\" \/><\/a><\/p>\n<p>To create this look of the table you need to add a few commands in the file custom.css that we have used earlier already.<\/p>\n<pre>#TBL-5-1-1, \/* table head col 1 *\/\n#TBL-5-1-2, \/* table head col 2 *\/\n#TBL-5-1-3 \/* table head col 3\u00a0 add more as required *\/\n\u00a0\u00a0 \u00a0{\n\u00a0\u00a0 \u00a0background-color: #E6E6E6;\n\u00a0\u00a0 \u00a0line-height: 2em;\n\u00a0\u00a0 \u00a0}\n\n#TBL-5-1g \/* table background excl. table head*\/\n\u00a0\u00a0 \u00a0{\n\u00a0\u00a0 \u00a0background-color: #F2FAFC;\n\u00a0\u00a0 \u00a0}\u00a0\u00a0 \u00a0\n\ntable\n\u00a0\u00a0 \u00a0{\n\u00a0\u00a0 \u00a0width: 100%\n\u00a0\u00a0 \u00a0margin-top: 1em;\n\u00a0\u00a0 \u00a0margin-bottom: 1em;\n\u00a0\u00a0 \u00a0\/*font-family: \"Arial Narrow\";\u00a0 use a narrow font, if space is an issue*\/\n\u00a0\u00a0 \u00a0}\n\ndiv.caption\n\u00a0\u00a0 \u00a0{\n\u00a0\u00a0 \u00a0margin-bottom: 1em;\n\u00a0\u00a0 \u00a0font-style: italic;\n\u00a0\u00a0 \u00a0}<\/pre>\n<p>The first digit in the ID #TBL-<strong>5<\/strong>-1-1 may be different in your files. Check this in your html file which is created during the process of creating the eBook.<\/p>\n<p>Find a working tex file and sample pdf, eBook and custom.css <a href=\"http:\/\/www.kreartiv.com\/pdf\/table-test.zip\" target=\"_blank\" rel=\"noopener\">here<\/a> in one zip file.<\/p>\n<h1>Finally<\/h1>\n<p>In case you find any errors, typos or something you do not understand in this instruction let me know and send me a note. I also appreciate any remarks if and how you managed to create eBooks.<\/p>\n<p>My current parameters for compiling the eBook are these (in one line):<\/p>\n<pre>\"C:\\Users\\Volker\\texmf\\tex\\latex\\tex4ebook\\tex4ebook.lua\" \n-c config.cfg\u00a0 -f epub3 -t \"%N%T\" mathml<\/pre>\n<p>They work well in WinEdt.<\/p>\n<p>Have fun testing!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>English below. Click on &#8222;weiterlesen&#8220;. Dieser Artikel hat nicht direkt etwas mit Fotografie zu tun, aber indirekt. Als Fotograf m\u00f6chte man ja seine Bilder auch ver\u00f6ffentlichen und das kann man heute ja auch als Buch oder E-Book ganz preiswert. B\u00fccher &hellip; <a href=\"https:\/\/blog.d80fotos.de\/?p=221\">Weiterlesen <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[5],"tags":[24,33,35,36,63,74,77,78,125,126,130,131,132,133,144,145],"class_list":["post-221","post","type-post","status-publish","format-standard","hentry","category-tipps","tag-css","tag-ebook","tag-epub","tag-epub3","tag-html","tag-latex","tag-miktex","tag-mobi","tag-tables","tag-tabularx","tag-tex","tag-tex4ebook","tag-texlive","tag-tidy","tag-windows","tag-winedt"],"_links":{"self":[{"href":"https:\/\/blog.d80fotos.de\/index.php?rest_route=\/wp\/v2\/posts\/221","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.d80fotos.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.d80fotos.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.d80fotos.de\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.d80fotos.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=221"}],"version-history":[{"count":0,"href":"https:\/\/blog.d80fotos.de\/index.php?rest_route=\/wp\/v2\/posts\/221\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.d80fotos.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=221"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.d80fotos.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=221"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.d80fotos.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=221"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}