Quite fanciful "Beginnings" of Euclid in TeX



    “Some strange antique h██nya written by the Irish kulibin in 1847 well, it’s good that this happens, of course” Misha Verbitsky

    In the 16th year, Euclid's “Beginnings” in the interpretation of Oliver Byrne caught my eye . The feature of this book is that instead of lettering like “ABC triangle”, there are placed directly in the text thumbnails of construction parts, that is, for example, a picture with the corresponding triangle. As far as making such a book, as one could imagine, was hellish work in the middle of the 19th century, just as easily, with the right tools, it should be now. And, in general, I decided to be sure of this.



    The option to simply draw illustrations in the illustrator and make up layout in the design was quickly marked as decadent. To do and edit geometric constructions in Illustrator is not to say that it is terribly convenient, but I never even thought of a beautiful way to automatically link the thumbnails to the main construction. The design, although well suited for this type of layout, promised to depress the view of the link bar with so many pictures. So, having summed up nothing, I turned to the already familiar MetaPost in which geometric constructions are quite easy to do (but not like in a geogebra, of course) and a latex in which it is relatively clear how to make things up. Latech, however, due to incomprehensibility with the libraries for the meta-post, was replaced by ConTeXt, which gets along well with the meta-post directly from the box.

    How does it work in general?


    “Started” in general 13 parts - books, but Byrne processed only the first 6. Books mainly consist of “sentences” - theorems and problems. Each is made of a construction (more often than one) and the text that refers to this construction.

    To describe the constructions, I introduced a macro in ConTeXt, which creates a new instance of the meta-post. In the meta-post, there are all sorts of functions to describe the constructions. It looks like this:

    \defineNewPicture{ % Внутри этой штуки описывается построение
        pair A, B, C, D; % В метапосте есть тип переменных для координат
        numeric d;
        d := 2u;
        A := (0, 0);                %
        B := A shifted (d, 0);      % Здесь задаются координаты точек
        C := A shifted (0, -d);     %
        D := A shifted (d, -d);     %
        byAngleDefine(B, A, C, byblack, 0);     % Здесь описываются углы
        byAngleDefine(D, B, A, byblue, 0);      % сначала точки,
        byAngleDefine(C, D, B, byred, 0);       % потом цвет,
        byAngleDefine(A, C, D, byyellow, 0);    % потом стиль
        draw byNamedAngleResized();     % Эта штука рисует все углы
        byLineDefine(A, B, byred, 0, 0);        % Здесь описываются отрезки
        byLineDefine(B, D, byyellow, 0, 0);     % сначала концы,
        byLineDefine(D, C, byblack, 0, 0);      % потом цвет, потом стиль
        byLineDefine(C, A, byblue, 0, 0);       % потом толщина
        draw byNamedLineSeq(0)(AB,BD,DC,CA);    % Здесь рисуется цепочка отрезков
    }
    \drawCurrentPicture % Эта штука выводит получившуюся картинку
    



    For sentence texts, I wrote macros that draw and display pictures in the same instance as the main construction. They execute, in the general case, an arbitrary metapost code, but most often they take as arguments the names of the necessary elements - angles, segments, etc. For example, like this:

    % Имена отрезкам даются автоматически, но можно назначить и вручную
    Draw $\drawUnitLine{CA} \perp \mbox{ and } = \drawUnitLine{DC}$.\\
    Draw $\drawUnitLine{AB} \parallel \drawUnitLine{DC}$,\\
    and meeting \drawUnitLine{BD} drawn $\parallel \drawUnitLine{CA}$.
    



    Here's how it works together:



    Some features


    Pictures in the book are unpretentious, but some things required special attention.

    If the segments touch each other with their ends, it must be somehow nicely arranged. Now, compounds of only two segments are specially processed, the rest can be put under such a connection. At least two ways of connecting lines are found in the original, but it seemed to me unnecessary to reproduce them.



    Angles are drawn using sectors. If the angle is small enough, then with the same radius, the sector will look too short, and it makes sense to increase it. Now the radius remains constant at angles of 60 degrees, and for smaller angles the formula is as follows:$ r / \ sqrt {a / 60} $.



    The dashed lines, in order to be beautiful, should start and end with filled parts, so that the hatching is slightly scaled to fit an integer number of times into a segment (there is a similar thing in the illustrator, but there are half-length strokes at the beginning and at the end of the line).



    You can display segments in the text in different ways: you can make them all of the same length, changing only the color, but you can play the length one way or another. In Byrne, there are such and such. I have this formula for this:$ L '= L ^ {a} l ^ {1-a} $where $ L '$ - the length of the segment in the text, $ L $ Is the length of the initial segment, $ l $ - the desired length of the segment and $ a $ - a certain number from 0 to 1. If $ a = 0 $then $ L '= l $, that is, any segment will be depicted with a length $ l $. If$ a = 1 $, $ L '= L $. If$ 0 <a <1 $then at $ L <l $, $ L '> L $ and with $ L> l $, $ L '<L $, that is, short segments are lengthened, and long ones are shortened. This is necessary if you want to keep the relative sizes of the segments, but do not want to get segments of half a millimeter next to segments of two centimeters. (In fact, everything is a little more complicated, but the meaning is this).



    Although Byrne refused the lettering, the famous bore Edward Tufte in one of his books spoke on the subject that Byrne was fine, but it would be nice to return the letters . And since all the same, almost everything is automatic, then there was a place for the letters. By default, points are named the same way as variables where their coordinates are stored. Labels can be placed at the vertices of polygons, or at the ends of segments, or in some other way. They, of course, can be turned on and off at will (the layout at the same time, of course, creeps).



    But most of the code is still dedicated to things that are more noticeable to the author / editor than to the reader. This, for example, the correct recognition of synonymous names of angles and segments, the automatic arrangement of letters around several polygons, the automatic drawing of pieces of segments at certain angles in the text, and so on.

    In the original there are initial letters and vignettes. On the one hand, they could be drawn without much work (mental, at least), but I decided to take up the more interesting (albeit hopeless) task - to produce initial letters and vignettes with a random pattern automatically. Firstly, it’s just fun, and secondly, translation into Russian (which is described below) would require adaptation of the initial style of letters to the Cyrillic alphabet, which activity was not included in my plans. So when you build the book, a list of all the letters and vignettes is created, and from this list a separate metapost script draws (very slowly) a complete set of all this stuff. Initial letters are all different and patterns do not repeat.



    The principle is simple: curls, as large as possible, are placed on the parts of the letter and on the frame. This happens several times, and already drawn curlicues are included in the following iterations. Then “leaves” appear in the same way. The shape and properties of different types of processes can be changed.



    I can’t say that I’m quite happy with the result, but gradually I’ll improve the algorithm and hope for the best (however, you can spit and slip pictures with any letters instead of generated ones). As a bonus, the script can generate random tiles from curls.



    Transfer


    To catch mistakes, and indeed, I began to translate into Russian. My reference point was the translation of the "Beginnings" of Morducai-Boltovsky, but pretty quickly it became clear that Byrne had changed too much in the evidence to help a lot. To be honest, at first I translated everything completely after the sleeves, especially the introduction, just to make it, and only recently did my hands reach to smooth out a little roughness.

    Apart from the unpleasant fifth book (which, as it turned out, was framed separately from the rest and somewhat earlier), it was not particularly difficult. Translation (the process itself) really helped to catch a lot of different jambs, both mine and the author. Say the construction to Proposition 9Byrne’s sixth book does not correspond to the text, which is why the proof does not work, so I had to redo everything there.

    From the curiosities: in the introduction, where the author praises his method, he first referred to Horace, citing his poems about the superiority of vision over other feelings as an argument. And a few pages later he decided to add for the sake of convincingness also the "modern poet", whose verses he also quoted. In fact, the "poems of the modern poet" turned out to be another translation of the same lines of Horace. Here, of course, it was necessary to leave everything as it is and in a footnote indicate the author’s mistake, but fortunately the wife found the appropriate versesEnglish and really much more modern Byrne author, who went into business (even if they say that you can’t do this). In the English version left as it was.



    The Russian version is also different in that the small letters in it are included by default and generally more minor changes compared to the original than in the English. True, here someone asked me to make the English version also with letters, and I am thinking of including them there too: without them, this book already exists.

    Another friend began to translate the book into Polish and wrote a lot of valuable things on the way in issues (for example, about scaling angles - this is his suggestion ). Great if you translate.

    Subtotals


    Having tinkered with this book, I have the following to say. Pictures in the text are really easy to read, now I use this technique in other places. Considering that I was engaged in the project in the evenings after the main work for a full day, it turned out pretty quickly: about six months for the first English version, with all the planning and programming, three months for the first edition of the Russian translation. True, I still correct shoals here and there (and more recently, my wife began to read Russian for typos, and I blush, almost like from the first pull request ).

    Since the publication of the first version on the github, the campaign began and endedon a kickstarter to raise funds for “completing Byrne’s work,” that is, as the authors understand, the design of all 13 “Beginnings” books is in the same vein. Apparently, layout in the design, what they draw, is unclear. While the books did not seem to be sent out, but soon they should. I hope it works out well. And more recently, an American designer released a nice web version of the first six books. Judging by the article with the story about the work, he painted everything by hand in illustrator.

    Plans


    У Бирна совсем не было стереометрии, так что и инструментов для нее я с самого начала не предусмотрел, но теперь решил потихоньку бирнифицировать книги «Начал» с 11 по 13, чтобы инструментарий отработать на них. Пока вчерне готово чуть больше половины 11-й книги и, соответственно, уже есть кое-какие функции для описания объемных построений и их проекции на плоскость. Впрочем, объемные построения в среднем намного сложнее плоских, и пока у меня нет четкого представления ни о том, насколько будет работать для них подход Бирна, ни о том, получится ли достаточно удобно создавать их в метапосте.



    Pictures in the text often require kerning. It’s similar, but more complicated: large-sized pictures on adjacent lines spread the lines very wide, which is justified only if they overlap each other. I haven’t yet figured out how to automate these things, and manually catching all this is very boring.



    The metapost can be launched both from the latex and separately. So in the future I plan to make macros for latex, the same as for ConTeXt, so that you can do the same in a more common environment. In theory, no one bothers to use a metapost, for example, with design. This can be done now, just by collecting the pictures separately and linking them manually, but it begs to write a couple of scripts for the ID so that this happens on its own. The latter looks quite like some kind of perversion, but too often comes to mind not to consider such a possibility.

    Well and most importantly - I want to try to apply all this machinery to something more modern and practical than the "Beginnings".

    All good lies here , ready pdfs are in releases.

    Also popular now: