User Tools

Site Tools


project:texlements:start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
project:texlements:start [2021/11/24 17:17] – created sachyproject:texlements:start [2021/11/26 16:09] (current) sachy
Line 1: Line 1:
 +====== tExlements ======
 +{{template>project:infobox|
 +name=tExlements|
 +image=texlements:41129584-737480dc-6abb-11e8-8f73-7b9a9afcb38a.png?256|
 +founder=[[user:sachy]]|
 +interested=|
 +sw=CC-BY-SA 4.0|
 +}}
 +
 +~~META:
 +status = in progress
 +&relation firstimage = :project:texlements:41129584-737480dc-6abb-11e8-8f73-7b9a9afcb38a.png
 +~~
 +
 +The [[https://en.wikipedia.org/wiki/Euclid%27s_Elements|Euclid's Elements]] is one of the most important books ever written by humanity, given it was first published over 2k years ago and still not forgotten.
 +
 +This project aims to provide the Euclid-Byrne's //Elements// in form suitable for hardcopy/paperback printout.
 +
 +Timeline:
 +  * -300 - Euclid compiles and extends mathematical works based on prior authors
 +  * 1847 - [[https://en.wikipedia.org/wiki/Oliver_Byrne_(mathematician)|Oliver Byrne]] publishes Elements with graphical representation of the referred objects instead of textual representation
 +  * 20xx - Sergey Slyusarev publishes [[https://github.com/jemmybutton/byrne-euclid|TeX implementation]] of Byrne's work
 +  * 2021 - [[user:sachy]] publishes wrapper for printable version of the TeX implementation
 +
 +===== Patching the TeX =====
 +
 +Download the [[https://codeload.github.com/jemmybutton/byrne-euclid/zip/refs/heads/master|current course code]] from the repo, unpack it and "cd" inside. Install all the required dependencies (context, texlive-fonts-extra, fonts-ebgaramond, fonts-ebgaramond-extra)
 +
 +Try to compile the original PDF, debug any errors - probably by installing more tex* packages (depends on distro).
 +
 +<code>
 +cd ./lettrines
 +mpost lettrines.mp
 +cd ..
 +context ./byrne_context.tex
 +</code>
 +
 +Patch the byrne_context.tex with following diff:
 +
 +<code diff byrne_context_print.diff>
 +114,129d113
 +< {\tfa github.com/jemmybutton}
 +< \vskip 0.25\baselineskip
 +
 +< {\tfb 2020 ed.\,0.8a}
 +< \vskip \baselineskip
 +
 +< \symbol[cc][cc] \symbol[cc][by] \symbol[cc][sa]
 +< \vskip 0.25\baselineskip
 +
 +< \startnarrower
 +< \setuplocalinterlinespace[line=2ex]
 +< {\tfx This rendition of Oliver Byrne's \quotation{The first six books of the Elements of Euclid} is made by Slyusarev Sergey and  is distributed under CC-BY-SA 4.0 license}
 +< \stopnarrower
 +
 +< \vskip -\baselineskip
 +
 +136a121
 +
 +13348a13334,13363
 +
 +> \setuplayout[title]
 +> \setupheader [state=stop]
 +
 +> \pagebreak\ \pagebreak
 +
 +> \startalignment[middle]
 +> \ 
 +> \vfill\vfill\vfill
 +
 +> {\tfa github.com/jemmybutton}
 +> \vskip 0.25\baselineskip
 +
 +> {\tfb 2020 ed.\,0.8a}
 +> \vskip \baselineskip
 +
 +> \symbol[cc][cc] \symbol[cc][by] \symbol[cc][sa]
 +> \vskip 0.25\baselineskip
 +
 +> \startnarrower
 +> \setuplocalinterlinespace[line=2ex]
 +> {\tfx This rendition of Oliver Byrne's \quotation{The first six books of the Elements of Euclid} is made by Slyusarev Sergey and  is distributed under CC-BY-SA 4.0 license}
 +> \stopnarrower
 +
 +> \vfill
 +
 +> \vskip -\baselineskip
 +
 +> \stopalignment
 +
 +13349a13365,13367
 +
 +
 +
 +</code>
 +
 +Compile again.
 +
 +===== Booklet =====
 +
 +Depending on the printshop you will need to provide the outer wrapping for the book in a separate file.
 +
 +<code>
 +gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dFirstPage=1 -dLastPage=1 -sOutputFile=./predek.pdf ./byrne_context.pdf
 +gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dFirstPage=276 -dLastPage=276 -sOutputFile=./zadek.pdf ./byrne_context.pdf
 +</code>
 +
 +Start your favorite editor which is able to embed PDF into another PDF WITHOUT rasterizing it and put the predek.pdf and zadek.pdf in the layout provided by the printshop (example suitable for expressprint.cz).
 +
 +The result should look like this:
 +
 +{{:project:texlements:obalka.png?400|}}
 +
 +===== Extending the format ======
 +
 +The original TeX version is not suitable for printing into complete book due to insufficient page margins. While you can easily increase the margin in the TeX file, the print process requires that the margin size is alternating on left/right sided pages. Too much work for manually swapping the margins on each and every page in the source code.
 +
 +But we can generate TeX in bash :) "./margingen.sh >> ./widepage.tex"
 +
 +<code latex widepage.tex>
 +\documentclass[11pt]{article}
 +\usepackage[paperwidth=165mm,paperheight=200mm,left=0mm,right=0mm,top=0mm,bottom=0mm]{geometry}
 +\usepackage[utf8]{inputenc}
 +\usepackage{pdfpages}
 +
 +\begin{document}
 +\includepdf{byrne_blank.pdf}
 +
 +
 +% Move the following lines TO THE VERY END OF THIS FILE
 +\includepdf{byrne_blank.pdf}
 +\includepdf{byrne_blank.pdf}
 +\includepdf{byrne_blank.pdf}
 +\end{document}
 +</code>
 +
 +
 +
 +<code bash margingen.sh>
 +#!/bin/bash
 +for i in {3..274}; do
 +        if [[ "$(($i%2))" == "1" ]]; then
 +                echo "\raggedleft"
 +                echo "\includepdf[pages=$i]{byrne_context.pdf}";
 +        else
 +                echo "\raggedright"
 +                echo "\includepdf[pages=$i]{byrne_context.pdf}";
 +
 +        fi
 +done
 +</code>
 +
 +Edit the generated tex file (move the marked lines to the new end of document) and compile it into PDF.
 +
 +===== Done =====
 +
 +Now you are done, you have separate booklet and content with the proper page facing and alternating margins ready for print and book assembly line.
 +
 +Feel free to download the version suitable for book: {{ :project:texlements:obalka.pdf|booklet}} and {{ :project:texlements:byrne_obsah2.pdf |content}}.