# What is a terminal in LaTeX? And why are there so many?

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?

• the terminal in latex is just where messages are sent so if you use a cmd window in windows or an xterm or other terminal emulators in other operating systems. It usually has a subset of the information sent to the log. It is unrelated to latex packages such as tikz. gnuplot is a graph plotting program that has a terminal type setting pehaps that is your real question, but gnuplot is mostly off topic here it is a separate plotting application, only connected to latex as it can generate images that latex can include. – David Carlisle Feb 17 '16 at 11:53
• Can you explain what you mean by terminal? It is a very generic term – Bordaigorl Feb 17 '16 at 13:32
• the term "terminal" in the tex world got its start before personal computers, when tex was available only on shared systems, and the terminal was the connection/interface point for a user. the name has stuck, although now it would probably be more appropriate to refer to this as "monitor" or "screen". – barbara beeton Feb 17 '16 at 14:10
• If you refer to gnuplot, probably this is the result of a long evolution during time. For what is worth, if you want a LaTeX output and unless you are interested in a tikz, I strongly suggest to use the epslatex terminal. – giordano Feb 17 '16 at 22:32
• @cfr what's not clear about "if you refer to gnuplot"? – giordano Feb 17 '16 at 23:26

## 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$


(*) 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).

• I'm not sure this really answers the question, which seems more oriented to the “terminal types” defined for gnuplot output. – egreg Feb 17 '16 at 17:10
• @egreg You may be right. It appeared that any question about gnuplot etc., stemmed from confusion at a basic level about what the terminal was and how it is connected to LaTeX. – musarithmia Feb 17 '16 at 17:15
• er, um, i first learned tex on the sail computer at stanford, and that setup had actual screens (green), no paper tape or console printout. "paper" interaction is possible, but tex would never have become nearly as popular if that had been the only option. – barbara beeton Feb 17 '16 at 18:52
• rlwrap gives a whole new meaning to using latex on the command line ... at last you can go back and delete your input errors etc... – user4686 Feb 17 '16 at 22:10