User Tools

Site Tools


project:texlements:start

tExlements

tExlements
founder: sachy
depends on:
interested:
software license: CC-BY-SA 4.0
hardware license:

~~META: status = in progress &relation firstimage = :project:texlements:41129584-737480dc-6abb-11e8-8f73-7b9a9afcb38a.png ~~

The 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 - Oliver Byrne publishes Elements with graphical representation of the referred objects instead of textual representation
  • 20xx - Sergey Slyusarev publishes TeX implementation of Byrne's work
  • 2021 - sachy publishes wrapper for printable version of the TeX implementation

Patching the TeX

Download the 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).

cd ./lettrines
mpost lettrines.mp
cd ..
context ./byrne_context.tex

Patch the byrne_context.tex with following 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
> 
> 
> 

Compile again.

Booklet

Depending on the printshop you will need to provide the outer wrapping for the book in a separate file.

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

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:

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”

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}
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

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: booklet and content.

project/texlements/start.txt · Last modified: 2021/11/26 16:09 by sachy