User Tools

Site Tools


project:texlements:start

This is an old revision of the document!


tExlements

tExlements
img.jpg
founder: sachy
depends on:
interested:
software license:
hardware license:

~~META: status = in progress &relation firstimage = :project:texlements:img.jpg ~~

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.

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
 

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=274 -dLastPage=274 -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.

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
project/texlements/start.1637774237.txt.gz · Last modified: 2021/11/24 17:17 by sachy