4

I seek recommendations on how to approach learning Plain Tex. I am just starting my journey with TeX using Knuth’s reference The TeXbook. I Installed TeXlive 3.14 and use the command prompt to run Tex. Here is a sample from chapter 6.

https://i.imgur.com/idYfxFy.png

https://i.imgur.com/fTA4fQm.png

I get a DVI file output. I wonder if I should continue practicing the book this way ?

Answer: yes. Refer to Udo response below.

I also have 3 related questions:

1- When I type Arabic text it doesn’t show in DVI output. How can I make it appear?

Answered by Joseph Wright. Knuth's TeX is strictly 8-bit using it for non-Latin languages is non-trivial and can't be recommended for new users/texts. Instead it is best to use luatex.

2- How can I output a PDF not a DVI?

Answered by David Carlisle - write tex chapter6 rather than tex then chapter6 to the ** prompt. type pdftex chapte6 to get pdf instead of dvi

3- Can I use visual code to edit and debug Plain Tex ?

This thread Good, plain, TeX editor mentions it can be used to run (see reply by user user132925) but when I tried I get this error?

https://i.imgur.com/bpB0mej.png

Answer: It doesn't support plainTex https://github.com/James-Yu/LaTeX-Workshop/issues/2879

I thought my questions will generate related answers/comments so I put them all in one thread.

sorry about that

ِMars
  • 43
  • 5
  • Welcome to TeX-sx! I'm not sure what you've done with your images, but they are not using the standard image upload mechanism and (for me) do no load. In general, the site works best with one issue per question: this allows duplicates to be marked, answers to be focussed, etc. – Joseph Wright Mar 08 '24 at 17:21
  • 1
    For example, if you are using or can use LuaTeX, then https://tex.stackexchange.com/questions/618035/how-to-write-arabic-in-plain-luatex might answer the 'how to write Arabic in plain TeX' aspect. – Joseph Wright Mar 08 '24 at 17:22
  • Please see the post now. I uploaded the images. – ِMars Mar 08 '24 at 17:24
  • 1
    you can write tex chapter6 rather than tex then chapter6 to the ** prompt. If you type pdftex chapte6 you will get pdf instead of dvi – David Carlisle Mar 08 '24 at 17:26
  • 2
    most people use latex rather than plain tex and there are many more tutorials eg https://www.learnlatex.org/ – David Carlisle Mar 08 '24 at 17:28
  • 1
    David Carlisle Thank you. I just tried it. Can you help me with the other questions? No. Please I want to learn Plain Tex first. – ِMars Mar 08 '24 at 17:28
  • 1
    On the VS Code question, I'm not quite sure it's answerable. VS Code is a programmers text editor, so it can certainly edit plain TeX files. You could (presumably) adjust the LaTeX Workshop extension to compile plain files, or you could just use the command line, or ... So this is likely too open-ended to answer. – Joseph Wright Mar 08 '24 at 17:43
  • Do you know how I can adjust LaTeX workshop to compile plain files? – ِMars Mar 08 '24 at 17:50
  • 3
    Try toread "TeX in a Nutshell" (28 pages) in order to know the basics of TeX. http://petr.olsak.net/ftp/olsak/optex/tex-nutshell.pdf IMHO, it is not good idea to start with TeXbook today, because there are many subjects out of date today (accents by composites, for example) and many subject are missing (all extensions used commonly today). TeXbook especially is useful for historians. – wipet Mar 09 '24 at 08:40
  • 1
    My very personal advice: don’t start with the TeXbook. This is what I did long time ago and it was quite frustrating. Fortunately, someone recommended me the “Gentle introduction”: https://ctan.org/tex-archive/info/gentle/?lang=en – Javier Bezos Mar 09 '24 at 09:29

2 Answers2

5

Your screen shots suggest you are using Knuth's TeX, which is strictly 8-bit and produces DVI output. If you want to stay 8-bit but directly generate PDF, using pdftex is the way to go. However, 8-bit input for non-Latin languages is non-trivial and can't be recommended for new users/texts. Instead you would be best looking at luatex: note that an appropriate font setup will still be needed (see e.g. How to write Arabic in plain luatex).

Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036
  • I see. It is not recommended to use Plain Tex with Arabic input. What about my method of practicing the books. Do you think I can continue to the last chapter this way? Any tip from advanced users is appreciated – ِMars Mar 08 '24 at 17:53
  • 1
    I specifically said I would not use an 8-bit engine for Arabic: the choice of plain vs LaTeX is a separate question. I'd use LuaTeX if possible for Arabic text with both plain and LaTeX. – Joseph Wright Mar 08 '24 at 17:57
  • I'm really not sure what you mean about your method for practice: write some code, run it, see what happens ;) – Joseph Wright Mar 08 '24 at 17:58
  • I got your point about Arabic. Now to progress through the book (which is purely in Latin letters), should I just continue typing in a text editor then debugging with command prompt? I couldn't find many resources on how to practice Plain Tex. I hope you understand where am coming. – ِMars Mar 08 '24 at 18:00
  • @mars Seems perfectly reasonably; for short passages when I'm checking expansion, I use a pen and paper but then I know the detail of the primitives, which helps – Joseph Wright Mar 08 '24 at 18:02
  • can you show me how to modify visual code to run Plain Tex? that is the only point left . For me Visual code is easier and is the tool we use in school. – ِMars Mar 08 '24 at 18:07
  • I'm afraid not - I use VS Code but not for typesetting (I use TeXworks for that, or for low-level testing the command prompt) – Joseph Wright Mar 08 '24 at 18:56
3

Yes, I think that your approach to learn TeX is good. But you must follow the advice that Knuth gives in the book: In your first reading don't look at the dangerous-bend paragraphs. Sure, this means that you have to read the book three times (text without all dangerous-bend paragraphs, text without double dangerous-bend paragraphs, complete text) to get the best understanding. Counting the pages that you have to read is probably twice the amount of the book.

Of course, after each reading you can decide if you want to dig deeper and to become familiar with the more advanced topics. (See the last paragraph too.)

The fundamental concepts that you learn from The TeXbook are valid in other engines too: tokens, expansions, category codes, macros, replacement texts, parameter texts, delimited parameters, etc. Moreover, the way how to handle, for example, mathematics, isn't specific to plain TeX. When you decide later that you want to work with another engine (for example, pdftex or luatex or hint) or an other format (for example, LaTeX or OpTeX) your earned skills are valuable although you might have to study new stuff; for example, pdf commands, Lua, or expl3.

Yes, the original TeX works with DVI files and 8-bit fonts. Both are not the current state-of-the-art. But it doesn't hurt to know about the past and the developments that lead to the current state. With DVI you can use dvips thereby leaning a little bit about PostScript, MetaPost if you want to make technical drawings, or even Metafont if you want to create your own font.

As you see from the previous paragraph: A lot of things depend on your interests and for what purpose you want to learn TeX. Are you going to become a user who typesets texts or do you want to make own design projects? Do you want to program TeX macros and write packages for others? Etc., etc. You decide about the path and its length but the better your understanding of the basic concepts that The TeXbook teaches the better you can make your decision.

Udo Wermuth
  • 2,612
  • 1
    I really get annoyed when people discourage me form learning Plain Tex. I want to have a solid understanding of how it all work what projects I can create with it, etc. Thanks for pointing that. Since you know a lot about Plain Tex, am wondering what do you think about Arabic input in plain TeX? I would love to practice the book exercises with Arabic sentences. Do you have an easy way to inject Arabic sentences into Plin TeX file. I referred to this post, but it was too advanced for me: https://tex.stackexchange.com/questions/180094/non-latin-characters-with-plain-tex – ِMars Mar 09 '24 at 13:09
  • 2
    Well, I understand what you want but be aware you are making the second step before the first is finished. I never worked with Arabic scripts and the TeX world is too large to be an expert for all aspects. I would suggest that you look at ArabTeX that can be loaded under plain to typeset Arabic texts. – Udo Wermuth Mar 09 '24 at 15:27