[Tex/LaTex] a terminal in LaTeX? And why are there so many

latex-miscterminal-output

As I am reading through the LaTeX literature available on the net I am comming across all this different terminal names, such as: latex, tikz, eepic, gnuplot, epslatex, cairolatex, emtex, pslatex, pstricks, etc.

I have also read the term terminal type on the documentation, which makes it even more entagled to me.

I sense that there might be a big relationship between the terminals and the packages you include on your document. However I am not sure.

There is probably a good reason for having all this different elements, though it may be not intuitive to me.

Can anybody shed some light on this?

Best Answer

There is no one terminal or editor for LaTeX*

LaTeX, the document-preparation system, is both a language and a set of programs that process (technically, "interpret") that language and produce digitally typeset files in DVI or PDF format. One of the strengths of the system is that you can create the input files using many different programs, and you can process them in a variety of ways, depending on your operating system and preferences.

You can invoke the LaTeX interpreter through a program or directly, at the terminal

A LaTeX input file is just a plain text file written in the LaTeX language, and therefore you can create it using any text editor. To process this file you have to invoke a TeX program, which for LaTeX is usually pdflatex. Many editors like TeXShop do this for you behind the scenes---you just click "Typeset" and you're done. But if you use the terminal, you can do the same thing manually.

Modern terminals emulate old teletype-and-paper-roll terminals

Imagine connecting to a mainframe computer using a teletype machine that produces a paper printout of all the commands you entered and the computer's responses. By the late 1970s and 80s when Donald Knuth designed TeX, terminals had already become keyboards and screens in many places. The terminal (or console, or command line) application on modern systems is an emulation of this. Instead of a typewriter you have your keyboard; instead of a paper tape you have the terminal emulator application on your screen.

Using LaTeX at the terminal

Through a terminal emulator you can interact with the TeX program directly. First you type and save your input file (say, file.tex). If you want to do this at the terminal you could use nano, vim, or emacs. Then you enter a command like pdflatex file, and then the computer prints out a long report of what it is doing, and produces a PDF file from your .tex file.

Creating a LaTeX file without an editor

You can even create a file at the command line without using an editor, as in the transcript below of a session on the terminal (on a Debian GNU/Linux system). This isn't a very practical way to use the program, but it makes a good demonstration of what is happening at the terminal, which is you interacting with the computer running the TeX program.

In this example I move to the /tmp directory and invoke pdflatex without an argument, which puts it in interactive mode. The command \relax signals that I will enter the text of the file at the command line. The text I type is preceded with an asterisk. I enter the minimal commands for a LaTeX document, and the program responds after each of these. After the last command, pdflatex generates a PDF file, which I can view by calling a PDF viewer.

andrew@pax:~$ cd /tmp
andrew@pax:/tmp$ pdflatex
This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015) (preloaded format=pdflatex)
 restricted \write18 enabled.
**\relax
entering extended mode
LaTeX2e <2016/02/01>
Babel <3.9n> and hyphenation patterns for 79 languages loaded.

*\documentclass{article}

*\begin{document}
(/usr/local/texlive/2015/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2015/texmf-dist/tex/latex/base/size10.clo))
No file texput.aux.

*This is a test of using \TeX\ at the terminal.

*\end{document}
[1{/usr/local/texlive/2015/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./texput.aux)</usr/local/texlive/2015/texmf-dist/fonts/type1/public/amsfonts/c
m/cmr10.pfb></usr/local/texlive/2015/texmf-dist/fonts/type1/public/amsfonts/cm/
cmr7.pfb>
Output written on texput.pdf (1 page, 21581 bytes).
Transcript written on texput.log.
andrew@pax:/tmp$ mupdf texput.pdf
andrew@pax:/tmp$ 

enter image description here


(*) Everything here applies equally to any variant of TeX language and TeX program (e.g., using Plain TeX format with tex, pdftex or xetex programs).