10

The short question is:

How do I progress with this book? What tools should I download? A step by step explanation would be deeply appreciated ..

The experience I had: Am a computer science student and have read several programming books. I was able to follow through them by practicing and putting effort. One of my recent goals was to learn TeX.

I believed I got the best book to learn -correct me if am wrong- the TeXbook by Knuth himself-. I wanted to make it my friend and spend tens of hours practicing but I could not manage to do it. TeXbook is really a different type of read. It starts right a way with the syntax and doesn’t introduce any tools or software that you need to prepare in order to practice. I knew the book was published before I was even born hence, the tools might no longer be the same so I searched a lot.

The search led me to CTAN and Tug sites where I was able to read lots of materials and develop superficial understanding of what a distribution is? what is macro? . I also read a lot of questions and answers in this site .

What is the difference between TeX and LaTeX?

Eventually I downloaded MikTex distribution I started typing some of the syntax in the second chapter, [Book Printing Versus Ordinary Typing]. I was able to generate my first pdf!!! The book didn’t mention that I need to put \end at the end of the document. I obtained this information from your site.

enter image description here

I continued to chapter 4 where I was stuck with font changing command

chapter 4

controlling font size

\ninerm and smaller\eightrm and smaller \sevenrm and smaller \sixrm and smaller \fiverm and smaller \tenrm

\tenrm Ulrich Dieter, {\sl Journal f"ur die reine und angewandte Mathematik} {\bf 201} (1959), 37–70.

to be {\bf bold} or to {\sl emphasize} something.

\tt this will be in a \bf typewriter font format

\it this is an italic font. I want to learn \rm I get the below error ..

enter image description here

I change the drop down list option to luaTex and the PDF magically generates. magical to me because I have no clue why it is happening : )

enter image description here

I hope you understand the challenge am facing as total clueless beginner. I became frustrated to the point where I stopped trying to practice and just continued reading and absorbing as much as I can in hope that I will be able to understand with time.

Yesterday, I reached chapter 6 Running TeX! Knuth was amazingly funny in this paragraph

OK, let’s suppose that you’re rested and excited about having a trial run of TEX. Step-by-step instructions for using it appear in this chapter. First do this: Go to the lab where the graphic output device is, since you will be wanting to see the output that you get—it won’t really be satisfactory to run TEX from a remote location, where you can’t hold the generated documents in your own hands. Then log in; and start TEX. (You may have to ask somebody how to do this on your local computer. Usually the operating system prompts you for a command and you type ‘tex’ or ‘run tex’ or something like that.) When you’re successful, TEX will welcome you with a message.

There are no diagrams there is no explanation of the underlying concepts. I searched online hoping that somebody has put a step by step tutorial with screenshot but no luck.

Please advise about the tools I should use and how to move forwards with this book

please feel free to attack my learning style to improve it and have better outcome.

Sorry for my English & thanks

jarnosc
  • 4,266
TeXNewbie
  • 101
  • 4
    Some people think the TeXbook is the best book ever written. Others think it's the worst. The following link provides some alternatives: https://tex.stackexchange.com/questions/53/what-is-the-best-way-to-learn-tex/62 . – Javier Bezos Jun 25 '21 at 14:40
  • 5
    @JavierBezos Best or worst, it gives great insight into the mind of a highly influential man of the era. – Steven B. Segletes Jun 25 '21 at 14:46
  • 3
    You've fooled yourself (or your editor has). pdftex vs luatex both should produce errors with this code since \ninerm and \eightrm are undefined. The reason the luatex compile appeared to work was because it ran in non-stop mode and pushed through the errors producing some output (but not the intended output). If you look at the log file for either of the runs, they should show the errors. – Alan Munn Jun 25 '21 at 14:56
  • 2
    You should have read a little further to Exercise 4.5... – Werner Jun 25 '21 at 15:08
  • @StevenB.Segletes That’s out of question . I just wanted to say, more or less emphatically, that for some it may be the ideal book and for others quite the opposite. – Javier Bezos Jun 25 '21 at 15:39
  • @JavierBezos I understand your point completely! – Steven B. Segletes Jun 25 '21 at 15:46
  • 3
    I had great difficulty with the TeXbook; Knuth order of thinking was not mine. I think that the best way to learn TeX is to first use LaTeX which in a way gets you to do some macro programming plus producing well set documents. After this go back to the TeXbook which tells you all the gory details behind the macro language – Peter Wilson Jun 25 '21 at 16:38
  • 2
    I also found the TeXBook daunting, but I knew of no other "textbook" until much later, with Wynter Snow's TeX for the Beginner, which I found exhilarating. I wish she could publish it today under CC or something like that, just like TeX for the Impatient, by Abrahams, Hargreaves, and Berry. – jarnosc Jun 25 '21 at 17:08
  • 2
    @TT_MM -- The TeXbook is certainly idiosyncratic, but a lot can be learned from it that you might not expect, but wait until you have a little more experience. Look for the file manmac.tex (Knuth's "style file" for the Computers & Typesetting series), and texbook.tex (the TeXbook source), and then work your way through the source with the actual book on your knee for reference. Knuth does recommend separating content from style, although I don't remember whether that's stated in the TeXbook. Here's the evidence. – barbara beeton Jun 25 '21 at 19:27
  • 5
    note it's usual to end a plain tex document with \bye not the primitive \end – David Carlisle Jun 25 '21 at 19:39
  • 5
    The TeXbook offers a lot of information in a very compressed way. No half-sentence, no phrase, no word in it is somehow superfluous. Think of each phrase as a part of a sum that is more than just the sum of its parts: often phrases that are far apart in the book form a connection/implication. Read the book like a picky lawyer reviewing a contract for potential pitfalls, and therefore needing to grasp the meaning of each phrase and the implications that arise in context with the rest. ... – Ulrich Diez Jun 25 '21 at 19:40
  • 2
    ... in context with the rest. There is a reason why Knuth recommends reading the book more than once. :-) If you don't understand a phrase or a term or a concept or anything else, ask here. With time, a meaningful picture will emerge. – Ulrich Diez Jun 25 '21 at 19:40
  • 1
    "... a meaningful picture will emerge." That's also why Knuth recommends avoiding the "dangerous bends" on the first reading; though I confess that the flat landscape left me still somewhat mesmerized in the beginning. T_T – jarnosc Jun 25 '21 at 21:44
  • Irrelevant, but I've wanted to say this for a while; I don't get why everyone uses the graphical IDE thing. Isn't 'vim file.tex; tex file.tex' just better? – defunct-user Jun 25 '21 at 23:19
  • What is your objective for learning TeX? If you want to create documents using modern fonts and modern international character sets, modern computer hardware, etc, learning plain TeX is as relevant as learning to ride a horse in order commute to work every day. If you wanted to learn the C programming language, would you start by learning the original Kernighan and Ritchie dialect from their book written more than 40 years ago, or would you start by learning the latest ISO standard version of the language? – alephzero Jun 26 '21 at 01:42
  • 2
    I wouldn't mind commuting to work on horseback... ^_^ I wouldn't mind to learn to sail or to get a helicopter license either. – jarnosc Jun 26 '21 at 02:13
  • @ArchitChoudhary I think in many cases it has to do with what you are already used to when you start using TeX. Nowadays, many people don't even come into contact with command line/shell/prompt and are used to graphical user interfaces with microphone, touch-display/mouse, graphical desktop and window-based applications and see the whole GUI stuff as a way to control things in a way they are familiar with. In beginner courses, I often see that people like to lean on what they already know. This affects not only whether they want a GUI as an editor from which they can click ... – Ulrich Diez Jun 26 '21 at 23:38
  • @ArchitChoudhary ... from which they can click to invoke (La)TeX. It also affects the process of learning (La)TeX: I often see that beginners -- when I was a beginner I did it myself, but I didn't realize that I did it -- have enormous difficulties because they try to transfer terms and concepts already known from object-oriented or procedural programming languages 1: 1 to TeX in order to keep things mentally in tracks they are already familiar with, instead of getting involved with the idea that they are just learning something different and new to them, and that they might find it easier... – Ulrich Diez Jun 26 '21 at 23:39
  • @ArchitChoudhary ... and that they might find it easier to get started if they first leave behind everything they know from somewhere else and get involved in thinking about things from scratch using the concepts and terminology introduced by Knuth in the TeXbook. Once one has mastered TeX in the terminology that Knuth introduces and uses in the TeXbook, one will recognize the similarities and differences to other programming systems - e.g., regarding the respective programming paradigms, and then one will also know how the transfer to (La)TeX works. – Ulrich Diez Jun 26 '21 at 23:39
  • 1
    @jarnosz The dangerous bend paragraphs - often they can only be understood when you got used and familiar to the terminology and concepts introduced by Knuth for explaining things. At first reading one usually is not used to that terminology and not familiar to these concepts yet. :-)) Maybe someone already from other programming languages knows about case-forking via if-constructs. But s/he is not yet familiar to TeX's expansion and there also is the likelihood that s/he was not yet confronted with subtle problems related not to programming in general but related to typesetting in general... – Ulrich Diez Jun 27 '21 at 00:07
  • @alephzero Surely one cannot compare C and TeX, right? I don't know about C, but if I am not mistaken TeX has remained more or less the same for a pretty long time. – defunct-user Jun 27 '21 at 09:05

1 Answers1

9

Hello, newbie!

In my rather long and somewhat uneducated experience, a feasible way to understand what is going on (and experience TeX as a beginner) goes first through understanding that the program may be considered a hybrid between an interpreter (like Perl or Python) and a compiler (like Pascal or C): the interface is, in principle, interactive, so you put stuff through a console, and after executing the instruction, the program comes back to the input prompt; but the product is always an object, if successful: in this case, your formatted document, in a DVI (device independent) format; nowadays, PDF for the most part.

Second: originally, there were perhaps at least six programs to run and/or master to get into the guts of the system. The typesetter TeX (and its sister font designer MetaFont) came in two flavors, ini and production (and the latter in virgin or preloaded versions; but I'll skip those details): the first did not load anything but itself, and had to be taught to do everything from scratch; but it had the ability do \dump a precompiled memory snapshot as object, which the "production" versions could load automagically as "formats" to save time at initialization. After a not very long but somewhat convoluted history, they both are integrated in today's binaries, and the default behavior is the production system: to enter the "ini" TeX you should tell the compiler to run with the flag "tex -ini", to avoid preloading the precompiled format.

Finally, you need to understand that the object produced with early systems (a file with the extension .dvi) had to be processed through a driver to send the output to the device of choice, screen (ega or vga, for instance) or printer (dot matrix or laserjet, for instance), so you had to run perhaps two different programs to do that: one for the screen and another for the printer.

The development of newer document formats allowed for some normalization in the dvi drivers. A popular one, DVIWin, ran on MSWin, which took care of the screen or printer detailes thereon. Now, for PostScript output, you may run dvips on your console, and then send the output to the PostScript screen driver or printer depending on the system, or save it as a file for further processing. Another driver, dvipdfm produces PDF directly from the original DVI object, so you may view it or print it from the PDF viewer of your choice. Over the course of time, the original engine has been extended to produce PDF directly; but this approach has evolved in several, sometimes parallel, sometimes incompatible systems: PDFTeX, XeTeX or LuaTeX, so you save one step (you don't need the DVI format and drivers anymore) at the expense of deciding which "engine" (typesetter model) you want to use.

Today's systems assume you want to typeset LaTeX documents, not Plain or any other existing formats; so they provide an IDE like the one you see, and the IDE defaults to tell the typesetter to run pdfLaTeX, not Plain DVITeX, in "nonstopmode", more akin to a compiler. This is the case as well with at least one OnLine LaTeX service available, which may save you the pain of trying to install a TeX system on your computer.

So this rather long explanation works as a preface for the simple instructions: if you want to try the experience of Plain TeX, the one described in the TeXBook, from scratch, you may use the IDE or any text editor of your choice, but run the typesetter from a console/terminal (on Windoze, typically cmd) with the command pdftex <filename[.tex]>; this way the program will run pdfTeX in "production" mode, with the (slightly extended) Plain format preloaded, and produce PDF files directly, so you may skip the process of learning how to use dvi drivers for the time being.

Addendum From the statement of your question, I collect now that you may have realized that the TeXbook has a rather steep learning curve, and you may have run a little impatient with this system; so I recommend to you to read the first three sections (chapters) of TeX for the Impatient, which you may find at CTAN. This may give you a good grasp of the whole; and then you may get back and start the TeXbook all over. You may find a tutorial on the early interaction with the system in the first section of A Gentle Introduction to TeX, which is a rather good "manual for self study" for Plain TeX as well.

Good luck, and happy TeXing.

jarnosc
  • 4,266
  • 1
    +1 for the use of "automagically" – Steven B. Segletes Jun 25 '21 at 15:49
  • 3
    Good "pre-introduction" to the TeXbook. A few things it doesn't say are that (1) the book was written long before personal computers, laser printers, PostScript, etc., and (2) that bias of the book hasn't been updated. It was tacitly assumed that someone learning TeX from the TeXbook had the benefit of a "local expert" who had brought TeX inhouse and would be available to answer questions. In the early 1980s that was definitely true, and it remained essentially true for some years thereafter. – barbara beeton Jun 25 '21 at 16:15
  • Indeed, PostScript and PortableDocumentFormat came years later, but dvips and dvipdf are examples of early dvi drivers which produce some modern "device independent" output formats too, as PS/PDF files have their own "drivers" (gs or Adobe Acrobat) which may display documents onscreen and send them to printers, regardless of the model of either screen or printer; so they are somehow "device independent". That's one of the reasons why [pdf|Xe|Lua]TeX have de facto replaced pure "DVITeX" systems, like TeX, eTeX, MLTeX or encTeX, which still need additional drivers for different devices. – jarnosc Jun 25 '21 at 16:56
  • As for the need for "local" experts, they may be found in the local machine, just by surfing the 'net! (^_~) – jarnosc Jun 25 '21 at 16:58
  • 3
    @jarnosz -- Just because something is on the net doesn't mean it's either truthful or the best answer. The last time I looked at some pages in the LaTeX Wikibook, there were a number of recommendations that were not "best practices". I tried to edit them but was "shot down". (I guess I should look again, but am not enthusiastic.) On the other hand, this forum is inhabited by enough people who know what they're talking about, so recommendations are pretty reliable. YMMV. – barbara beeton Jun 25 '21 at 17:23
  • Moreover, @barbarabeeton, (3) the book assumes that we are running TeX from a console, not from within an IDE, as most modern systems do. – jarnosc Jun 25 '21 at 17:23
  • 1
    @jarnosz -- Re console, good point. (I still always run from the console; this is partly habit, but also the fact that my day job, before I retired, was TeX support for authors and a production shop, and conditions not being uniform, I had to be able to work from the "least common denominator". This has resulted in my being unfamiliar with most IDEs, so if you see an answer by me about one of those, do take it with a good dose of salt.) – barbara beeton Jun 25 '21 at 17:28
  • So I can continue with the MikTeX installation to practice Knuth's manual ? I simply use any text editor to produce File.Tex then run it from cmd ?and that's it? by the way "Hello, newbie!" was hurtful and funny : ) – TeXNewbie Jun 25 '21 at 19:03
  • @barbarabeeton, re local texperts, you're right: you have to look for the right places and avoid the dark corners of the net; but once you found a reliable site, like this one, there are enough eyes to spot the bugs. – jarnosc Jun 25 '21 at 19:12
  • @TT_MM, re the basic editor/binary/shell setup, that's indeed the case (for the record, I still keep editv/pdfTeX/DOSBox on my android, in case of need); re the greeting, would Welcome, newbie! be better (^_~)? – jarnosc Jun 25 '21 at 19:17
  • 2
    One nitpick. iniTeX and "virgin" TeX are not quite the same thing (although the distinction is less important since ca 1989 or so). Initially iniTeX was TeX with the inittini blocks active. virTeX was TeX with those same blocks commented out and not format pre-loaded, TeX was virTeX with the plain format preloaded (e.g., a shortcut to virtex &plain) while LaTeX would be virTeX with LaTeX preloaded. In practice, I don't know anybody ever ran virTeX directly. Before TeX 3.0, only iniTeX could load hyphenation patterns, but that was changed at that time. – Don Hosek Jun 25 '21 at 19:30
  • 2
    A bit before the TeX 3.0 release, IIRC, I modified the VMS port of TeX to make iniTeX a run-time setting (I also did the same with the debuggubed blocks) on the TeX executable. Around that same time, I had a conversation with DEK where he mentioned that he regularly just used initex &plain as his main TeX executable. – Don Hosek Jun 25 '21 at 19:33
  • @DonHosek, re the ini/vir distinction: so, virtex was a "production" version, without a preloaded format; a full "production" tex may had plain preloaded; and initex was the uninitialized, unpreloaded version of all? Please, feel free to edit the answer to make that fine distinction; although, as you say, it may be a little nitty nowadays. – jarnosc Jun 25 '21 at 19:45
  • @DonHosek re the VMS port: perhaps that's why I never managed to make the Plain TeX in my school's VAX machine load the spanish hyphenation patterns: it did not have the initex version installed. –Or more likely, as I recall now, it never occurred to me to find that switch to turn initex on. – jarnosc Jun 25 '21 at 19:54
  • Can you clarify more about plain TeX not being used anymore ? https://www.texpad.com/docs/tutorials/tex/advanced/tex-vs-latex this editor mentions support of plain TeX. By the way I have no difficulty learning LaTeX and there are handful of tutorials and lectures in my college. Cannot say the same for Plain TeX however. @jarnosz very thankful for your post. I will make a diagram using your explanation and share later. – TeXNewbie Jun 25 '21 at 20:03
  • 2
    It's not that plain TeX isn't used anymore in a strict basis, but that the vast majority of activity in the TeX ecosystem happens around using LaTeX for document preparation. When I first started using TeX (35 years ago(!)), the system that I was on wasn't even capable of supporting LaTeX. It wasn't immediately clear at that time that LaTeX was going to be the future of TeX. Now, anything non-LaTeX is pretty much in the margins. The best analogy would be the JavaScript ecosystem where very little JS work is done without one of the major JS frameworks. – Don Hosek Jun 25 '21 at 20:14
  • @TeXNewbie: scuze, but who said that Plain is not used anymore? – jarnosc Jun 25 '21 at 20:23
  • @jarnosz it is in the link I shared .. if I understood correctly : "TeX: Knuth’s original, unused today" – TeXNewbie Jun 25 '21 at 20:28
  • @jarnosz thanks for sharing TeX for the impatient book. I am not impatient but rather lost . I will read it definitely. I posted this question to approach the book with best advice and insights from experienced users. I guess I have always had "big picture" learning issues or as Jesse Liberty better put it "Sometimes it can seems that in order to understand anything we must understand everything" – TeXNewbie Jun 25 '21 at 20:45
  • 1
    I see: re the claim "Plain TeX being not used anymore", there might be a confusion here at work: the program "TeX" (let's call it tex.exe, in DOS format) as Knuth left it, is seldom used nowadays, because it is very limited in terms of memory, for instance, and it produces only DVI files, which require dvi drivers as I said; Plain TeX (plain.tex in DOS format as well) is a set of macros which initialize tex.exe to make it somewhat usable, and it is very limited in terms of capabilities as well: not even the TeXbook has ever been typeset with tex.exe+plain.tex+hyphen.tex+cm*.tfm alone/> – jarnosc Jun 25 '21 at 21:20
  • /> so, yes: tex.exe is seldom used nowadays, though it is still available, while plain.tex is still used nowadays, though to a lesser extent than latex.ltx, its most successful competitor. plain.tex almost always requires some macro extensions to do a better job (eplain.tex or plnfss.tex, for instance, my tools of choice; though I can foresee @wipet jumping in, promoting his clever opmac.tex macros to "inspire"). However, I still regard plain.tex as a pretty good starting point to get into the guts of any TeX system in depth; somehow it works as a "lowest common denominator". – jarnosc Jun 25 '21 at 21:45
  • @TeXNewbie re your learning style, let me paraphrase Peirce/Wittgen/Quine: we always start from a whole; but the whole may keep growing larger over time, and it will never become everything. – jarnosc Jun 25 '21 at 22:09
  • 2
    Learning Plain/PDFTeX has the additional advantage of starting from the stable base: they have been "frozen", so they won't change save for bugfixes; LuaTeX+LaTeX (LuaLaTeX), on the other hand, are changing (in "active development") all the time. – jarnosc Jun 25 '21 at 22:45