Hacker News new | past | comments | ask | show | jobs | submit login
Fancy Euclid's “Elements” in TeX (habr.com)
345 points by mci on May 27, 2019 | hide | past | favorite | 29 comments



To add some context, this is a version, prepared in ConTeXt and MetaPost by Sergey Slyusarev (@jemmybutton), of Oliver Byrne's 1847 work “The first six books of the elements of Euclid, in which coloured diagrams and symbols are used instead of letters for the greater ease of learners”.

This linked post on habr.com is definitely worth reading; also see the sources on GitHub page here: https://github.com/jemmybutton/byrne-euclid

A scan of Byrne's 1847 original here: https://archive.org/details/firstsixbooksofe00byrn/page/n6

Another person's (Nicholas Rougeux's) reproduction here: https://www.c82.net/euclid/about/

A publisher's attempt to “extend” Byrne's work from 6 to all 13 books here (Kickstarter + preorder; I don't believe it's done yet): https://www.kroneckerwallis.com/product/euclids-elements-com...

There's also a facsimile reproduction of Byrne's original by the publisher Taschen, with a review here that goes into some detail on Euclid editions and on Byrne: https://www.maa.org/publications/maa-reviews/the-first-six-b...


While mentioning ConTeXt, can anyone give me a sell job on when and why it might be nicer than LaTeX?

It's not that I'm super fond of LaTeX, it's just that I assumed its warts were more or less inevitable in a stringy macro framework, and ConTeXt can't avoid that either.


Feature wise, both LaTeX and ConTeXt are similar. Where ConTeXt really shines is the ease of use and consistency of the interface.

1. No need to run `pdflatex; bibtex; pdflatex; pdflatex` multiple times. The wrapper script `context` takes care of that.

2. Easy to add graphic elements to the page and layout in a consistent and _fast_ manner.

3. Export to XML/XHTML/ePub.

4. Can compile XML.

5. Programatically generate documents using a Lua interface (this is different from LuaTeX; ConTeXt has a nice Lua interface called ConTeXt Lua Documents, so it seems that you are writing Lua code rather than a wrapper script).

6 Consistent of interface. See https://tex.stackexchange.com/questions/4987/why-should-i-be...


Does #5 get around my worries about a "stringy-marcro-framework"? I.e. when things get too complicated, you can break out to a Heavy Duty (TM) language (aka Lua).


Depends a bit on what you mean by "string-macro-framework". The thing with ConTeXt is that it has a well defined API, so even when you are processing data using macros, it does not feel awkward.

Let me give a few examples of how I use ConTeXt (not necessary with ConTeXt Lua Documents)

1. Create a simple key-value driven interface for "complex" layouts https://adityam.github.io/context-blog/post/exam-coverpage/ This is still a "string-macro-framework", but ConTeXt has enough (and well named!) macros that it almost appears to be a "normal" template language. The code in ERB or other template languages would not be too different.

2. Generate Lab assignments for an undergraduate linear control systems course where the students learn how to interface MATLAB with real-time hardware. We create the lab in Matlab (`.m` file) and convert it to Matlab live script (which is Matlab's version of jupyter notebooks) which the students have to fill in. But, the live script notebooks are not convenient for browsing (say, for students who want to view the lab on their phone). Matlab offers a PDF as well as LaTeX export, which look ugly IMHO. So, we convert the `.m` to XML (Matlab does an XML export), and then use context to convert XML to PDF. The code is written using "stringy-macro-framework" but again the interface is nice enough that it would have looked similar in any other XSLT framework in any high-level language.

3. As an academic, I need to generate various versions of my CV (full publication record, pubs in the last `n` years for various values of `n`, etc.). I store my pubs in an XML file, use the XML parsing lib in ConTeXt to convert the data to Lua tables, and then use ConTeXt Lua Document syntax to generate different versions of my CV (depending on the command line flags to the `context` compiler. Once the data is converted to a Lua table, it is trivial to do things like group pubs by year, group pubs by research areas, etc.


It's generally better designed, but from own experience, harder to actually get something done with unless you are going to learn it from first principles — which hardly anyone does because while simpler than LaTeX it's still has cthulu-esque levels of complexity due to the TeX heritage.

One reason for the practical gap is that there is an order of magnitude more info on LaTeX online. Googling for ConTeXt is a miserable experience and the official documentation is far from enough.

On the other hand, if you do master it — well then it's easier to do the kind of things the OP does, which I think is really impressive.


I backed the Kickstarter, it’s gone to print and is due mid-year if memory serves.


> To add some context, this is a version, prepared in ConTeXt ...

Nice (un)intended pun. :-)


Maybe not as fancy, but here's a version with Greek and English side by side: http://farside.ph.utexas.edu/Books/Euclid/Elements.pdf


You might wanna try Heath's translation, here:

https://archive.org/details/euclid_heath_2nd_ed

It's the most detailed and complete translation, addressing numerous issues. Not all, thought, there's one grave translation error unaddressed in pretty much all translations, and more importantly, repeated in ALMOST all translations:

http://cgm.cs.mcgill.ca/~godfried/teaching/dm-reading-assign...

Even today, most mathematicians aren't aware of the difference. (And this despite the fact that the Wikipedia article on the axiom DOES mention it.)

I wish we'd have Byrne-style drawings of The Elements as implemented in this paper, albeit the authors of it & the various precursor papers to it seem unaware of the above, too—and hence (almost) reinvent the wheel:

https://link.springer.com/article/10.1007/s10472-018-9603-0

(Note: There exists a 'secret' sequel to that paper, which one can find here: http://t-news.cn/Floc2018/FLoC2018-pages/preprint_cX1w.pdf — I say 'secret' as they only cite the above indirectly, by citing "Mark Bickford, Rich Eaton, and Ariel Kellison. Nuprl Theory: euclidean plane geometry, 2018.", which makes the connection between them undiscoverable via services like citationgecko.com & Google Scholar.)


I have a reproduction copy of this book, and always intended to find some time to recreate a few pages of it in SVG as a way of expanding my knowledge of that technology. This is far beyond anything I even dreamt of doing. Really great stuff.


The randomized initials/dropcaps are fun. But it seems that this doesn't replicate the original Bryne use of the Rose Caps (https://wiki.obormot.net/Main/BonusFontsDemo?demo_font_one=R...), and uses a random sans serif font? It'd be cooler if it was generating randomized versions of the original initials.


I am in awe at the beauty of this thing


Yes, I just want to yell "wow" out loud. My LaTex phd thesis was so ugly.


MetaPost is so underrated. Glad, this project shows the strength of the language.


It is gaining a bit of traction with LuaLaTeX and the luamplib library, but unfortunately PGF/tikZ seems to be the preferred library for many projects.


I often wonder how hard it will be to have a metapost backend for PGF.


I hope LaTeX 3 will be released soon, to address many problems of the 2nd version.



This was actually done with ConTeXt, not LaTeX.


Interesting, how do Tex Live, LaTeX and ConTeXt related to each other?


LaTeX and ConTeXt are two packages that provide sets of macros for the base TeX typesetting system. LaTeX provides macros for things like sectioning, tables of contents, figures, and so on, and the configurable styling of everything separately from the content; ConTeXt's macros are more focused on precise page layout than semantic document structure.

TeX Live is a TeX distribution, meaning it contains TeX, LaTeX, ConTeXt, and a variety of other macro packages (including packages building on top of LaTeX, for example), fonts, and so on.


TeX live is a distribution and it comes with many things (TeX, LaTeX, ConTeXt, fonts, ...). Both LaTeX and ConTeXt are built on top of bare TeX and add lots of features. I have used ConTeXt a quite a bit, and it seems to be more designed to typeset whole books, whereas LaTeX is very good at scientific papers.


This is a bit random, but there are some formal systems for Euclid's elements out there (see, for example https://arxiv.org/abs/0810.4315).

I think it should be possible to implement this in a dependently typed language like Idris, but haven't really worked on this (yet). Any thoughts?


Also see this: http://www.michaelbeeson.com/research/CheckEuclid/index.php

It seems a dependently typed language might be overkill, "The proofs described in this paper only need a rather weak logic. There are no function symbols", "only existential quantifiers; universal quantification over the free variables is left implicit."

They wrote a translator then to convert the proofs to HOL, and Coq, you could presumably do the same for e.g. idris


Awesome, this was exactly the type of comment I was hoping for!


I like this style for formulae, though it can be not straightforward to translate into regular text or speech. And in this case there's another issue caused by color-coding: it's tricky to read with altered colors and/or on monochrome displays. Maybe the latter can be solved by using different styles for lines and filling, in addition to colors.


Simply gorgeous


Couldn't agree more. I'm in awe.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: