In the previous article, I talked a little about the layout of the newspaper using the direct generation of postscript files from separate ready-made layouts. Commentators drew my attention to LaTeX. It was obvious to me that in the case I described, LaTeX was excessive, but the sediment remained. And I went to look for details in Yandex.
LaTeX struck me first of all with the size of the texlive-full package. Then - the complexity of inserting quotes, Christmas trees: you have to switch to the Latin alphabet every time. I tried to start writing this article in LaTeX, and I realized that it was not necessary. Because a) Habr has other requirements (for example, Habr makes quotes himself), and b) I also have other requirements: if the article is not for Habr, I will still put regular quotes, and then replace them with Christmas trees with a macro in Wime.
I think that I’m not the only one to argue - that it’s more convenient to put some simple tags at the time of writing the text to indicate quotes, links, boldness, a numbered list ... And then replace these tags with universal markup like HTML using, say, Markdown.pl.
To this idea, to clearly designate supersegmental units when typing, humanity arrived quite a long time ago. For example, when placing a stress mark over certain words, or when designating ascending intonation using an exclamation mark.
Then people began to type texts in the computer, and gradually invented TeX. But who and where he saw in the era of stagnation? Markdown blossomed into a truly wild color when the broad masses of former Soviet citizens began to impose newspapers on the Xerox Ventura Publisher program. It was a tool that anticipated not only the modern concept of markdown, but also HTML - CSS: texts with markup were stored in some files, the structure of the publication - in others, the description of styles - in the third.
Then a fashionable “visual” Aldus Pagemaker appeared and the layout turned into hell, and the newspaper pages became a mockery of the mind and feelings of the readers. Adobe Indesign further mixed the content with the design. Because the desire to format the text “visually” is indestructible, and corporations will always be happy to earn on this desire.
In the same way, the desire of some people to organize everything, arrange it on shelves, and calculate the layout of text and pictures strictly mathematically, is also indestructible. I think these people are much smaller than the "visuals." This tells us a huge number of editors WIZIVIG - including on sites (even Wikipedia has sunk).
And the salt seems to cease to be salty: After twenty years of struggle for "semantic markup", it was rather strange to see on the IBM website (!) An example for LaTeX in the style of HTML 3.2:
2. begin{titlepage} \begin{center} \large \\
The situation, of course, is ambiguous. If we have to hand over the document electronically, then this center is a particular evil: the recipient will not be able to manage printing using external styles. If we ourselves have to print the document, then ... I would still expect from the host side the file with the settings for the titlepage entity, and not the instructions “format it yourself, so that everything is in the center”.
From this example, I see that the desire to directly format the text cannot be destroyed by any LaTeX.
One of the first articles in the search in Yandex was found, of course, an article on Habré. Do not write in LaTeX! . There, in particular, it is argued that the Word is not so bad - that we simply “do not know how to cook it”:
If someone lays out section headings in a text editor, choosing a bold font or increasing the font size, then he incorrectly uses the functions of a text editor. A person should show [...]
I think this “someone” uses the editor quite correctly. Because this editor is made for this purpose. And nothing we can neither show nor prove to this person. Because at first the desire of this person was born to color the text arbitrarily, and only then the Word appeared, as an answer to a consumer request.
After all, it was quite possible in the Word itself to limit the arbitrariness of users. But how many of them after that would be left? Most likely, the Vord would now be in the same place as the unforgettable Ventura.
Discussion of the article showed me that opposing a LaTeX to a Word is unproductive :
She understood that this was the title. And in the Word, she did not distinguish the title from the text which is bold and with a font size larger than usual.
In Word, of course, you can also distinguish the title from just a bold text. But here it is precisely the question in which representation it is more convenient for a person. And the one who is more comfortable to work with external tags, and so on (by nature), will choose NOT the Word. And not Indesign. But what?
For a long time working with different office documents, “bare” text, all sorts of “markdown”, I gradually realized that I feel confident and calm with only one format - HTML. When I receive a “dirty” .doc file for me, the first instinctive movement is Ctrl + a, Ctrl + m in LibreOffice (clearing direct formatting). The second step is to copy the text into a specially designed for this VIZIVIG-form on the site with the button "Clear".
It is clear that the second way can also be cleaned and “dirty” HTML, in the form of which the majority of information gets to us today.
Cleaning up after converting to HTML leaves only bare tags (the class attributes and some important for the tables are also preserved - like rowspan). This, in particular, solves the problem with the "spreading" of tables. Then the resulting pure HTML can be inserted back into the text editor and finalized before the form is normal, with styles (if someone else needs it in that form). Or leave it in HTML and fine-tune right there.
This bundle - Markdown - HTML - is quite possible, in my opinion, to be opposed to LaTeX, there is already something to discuss. That is, my final idea is this: every text should be started to be typed and drawn up on the “dialect” of some simplified Markdown, close to you, and towards the end, make a decision: HTML or LaTeX. And it’s not at all necessary, by the way, HTML should always remain on the screen - it is quite possible to create pdf from it or finish it in the form of odt.
You will probably argue with many things, even scolding me about something. Because always when writing an article, the writer thinks about one thing, and the person who reads the article afterwards writes about the other. To reduce this discrepancy a little, let me be frank: I think now (and always) first of all about computer science lessons. We have already taken the first step from “immediate visuality” to thinking with styles in these lessons: after drawing up an educational document in LibreOffice, students themselves are in a hurry to check their work with Ctrl + m, not waiting for the teacher to do it.
At the next stage, the choice of a strategy arises in front of me: how to teach a person to think with external marks when designing a text.
I recall that somewhere two paragraphs above, I argued something incompatible with this task - that there are people who are naturally thinking "markup", but there are natural "visuals", and you can’t do anything about it. This was a polemical exaggeration. We, of course, do not consist only of “black” and “white”, in each person, both of them are dormant, something a little more. Both can be awakened by deliberate actions - this opportunity, in particular, is successfully exploited by the sellers of Word and Indizayna.
And I think the school should develop resistance to such manipulations among those students who at least to some extent show a propensity for analytical thinking. And for this, it turns out, it is more important to study in languages, not programming languages, but markup languages.
However, programming also develops observation in the right direction: any program consists of "commands" and data, from operators and operands , it constantly reminds us of this heterogeneity of code - about the material and its "processors". And there is, by the way, a programming language that is also a markup language at the same time.
The correctness of his choice for computer science lessons was confirmed for me, in particular, by the article (again on Habré) Learn Postscript for five minutes . The article itself is not very informative, but it has two useful links to “postscript lessons”.
In five minutes, of course, it will not be possible to study Postscript even in yours; especially in schoolchildren. For people who do not work constantly with the reverse Polish notation, five minutes may not even be enough to represent the expression 3 - 2 * 7
in Postscript - even if you have a list of operators before your eyes and you already know what to “multiply” there looks like mul , and “take away” - like sub . Pupils usually need about 20 minutes for one of them to solve this problem at least with the help of the additional operator neg .
In fact, the first 25 to 50 minutes will take you to attempt to organize debugging programs for Postscript - for some reason, this place in training articles is usually silenced. In fact, we have only one debugger (interpreter) - Ghostscript, it is easy to find. But then there will be this: you type in the Linux console the gs command ( gswin32c.exe for Windows) and very quickly find that it is almost as easy to get out of this environment as ... from Vim. However, gs is friendlier in this regard - not only the magic word quit works there, but also Ctrl+c
. And even Ctrl+d
.
The next step: we type in the interactive mode gs command 3 14 sub
, press Enter, and ... nothing happens. Because the sub operator took two numbers from the stack, calculated the difference between them and put it back on the stack. And where does the screen seem to be?
To extract the last value from the stack to the standard output, you need to enter a special command. Guess from three times what: = (equal sign). That is, our team should look like this: 3 14 sub =
.
After five minutes of “interactive” study of operators in the Ghostscript environment, you will become bored and want to write at least a small program so that it draws the Malevich square and multiplies the numbers at the same time. With squares, everything is standard. With numbers harder. You will write, for example:
(3 - 2 * 7 = ) show
(In ps, the text to be printed should not be placed in quotation marks, but in parentheses). But this is not enough, it is necessary to specify the font, the place on the page to start printing and at the end give the command to display the page:
%%BoundingBox: 0 0 600 600 /Times-Roman findfont 40 scalefont setfont 100 500 moveto (3 - 2 * 7 = ) show showpage
We specified the second coordinate more - 500, because the origin in ps is below. This text should be saved to a file, for example, 1.ps. And then the lucky owners of the okular program will be able to see the result of their programming by double clicking on the name of this file. If okular is not installed, the file will open in some other viewer or even in Gimp. Or it won't open at all - then install okular after all.
gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16m -r120 \ -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sOutputFile=1.png 1.ps
We printed (on the screen) in capital letters the inscription "3 - 2 * 7 =". Now at the end of this expression you need to print the calculated result. To do this, before the showpage instruction, insert the line:
3 2 7 mul sub 20 string cvs show
In this line to the left of the number 20 are the actual calculations. The cvs command converts a numeric data type to a string. As a second argument, this command needs an empty string of fixed length — we create this empty string with the command 20 string
. Now you can experiment with arithmetic in ps by changing the numbers and operators on the left side of the string. Only you need to make sure that the result does not work longer than 20 characters.
I think after such a shake-up HTML will seem to students easy and enjoyable to learn.
Both HTML and LaTeX are standards, but in the daily life of a student, student, teacher, LaTeX programmer is not needed - rather, it is a festive tool used for a special occasion: for printing a diploma, an article in a scientific journal. Every day, right now, we, people who do not work with three-level formulas, like air need HTML (although you can also insert formulas from LaTeX there ).
Because there are fewer and fewer paper sources of information; increasingly, we read from the screens and write using the keyboard. For literature lessons, you need to read War and Peace. Do many volumes have these volumes at home? Or, say, a social studies teacher found an interesting article on economics. Or he wrote. What should he print on all students? Or dictate in the form of a lecture?
In all cases, the most convenient standard is HTML: we filter, clean, upload to the school's local network (or share via email). Unfortunately, precisely what “will be”: now it is not. But I will try to teach the basics of markup and students, and teachers.
There is no goal at all to make of every professional typesetter. But to learn to think in terms of computer layout is simply necessary for every person involved in the learning process and dealing daily with hundreds of information. Then LibreOffice will also become a normal standard - because after studying HTML, people will begin to see (and want) not the “big and bold type”, but the Section Title, and to consider italics not as decoration, but for semantic highlighting. May be.
Source: https://habr.com/ru/post/347234/
All Articles