Your support for our advertisers helps cover the cost of hosting, research, and maintenance of this document

Formatting Information — An introduction to typesetting with LATEX

Appendix C: Commands, errors, and viewing

Section 1: Terminals and windows

Originally a terminal was a screen and a keyboard, looking very much like a standard desktop computer in the days before flat screens and windowing systems. There are still a surprising number of these around. The important point is that it was (is) a text-only interface to the computer. You got 25 lines of 80 fixed-width white-on-black or green-on-black characters, no fonts, no colours, and no mouse; maybe reverse-video as a form of highlighting (see Figure C.1).

Figure C.1: Text-only display terminals

IBM-3279-display DEC-VT100-terminal 

Images courtesy of Wikipedia. Left: IBM 3279 display by Retro-Computing Society of Rhode Island (CC BY-SA 3.0); Right: DEC VT100 terminal by Jason Scott (Flickr IMG_9976, CC BY 2.0), at the Living Computer Museum (apparently connected to the museum’s DEC PDP-11/70).

Nowadays the word usually means a ‘virtual terminal’: a window that behaves like a terminal — 25 lines of 80 fixed-width characters in monochrome (see Figure C.2). It’s window into the heart of your computer. Even though you still have all your other windows visible, it knows nothing about them and can’t interact with them (much; maybe copy and paste). But instead of being a padded cell, most terminals can do things many other windows can’t, like handling files in bulk, or to a schedule, or unattended, even forcing things to happen even when the graphical world outside has got itself jammed solid.

C.1.1 So where is the terminal window?

Apple Macintosh OS X

Click on FinderApplicationsUtilitiesTerminal;

Microsoft Windows

Click on the Windows or Start button, All ProgramsAccessoriesTerminal (in older versions it’s called Command Prompt)

UNIX and GNU/Linux

In most graphical interfaces, click on the menu ApplicationsAccessoriesTerminal (in some systems it’s called Console)

When you have finished using the terminal, it’s good practice to type exit (and press Enter).

C.1.2 Using the terminal window

On a physical terminal you usually have to log in first (very much like today: username and password). In a terminal window this isn’t usually necessary (see Figure C.2).

Figure C.2: Virtual terminal in a window

terminal 

In this example I’m logged into a computer called nimrod with my username peter. The system prompt is the directory name plus a dollar sign (the tilde indicates that I’m in my home directory system). For visibility, I underlined in red here the commands I typed, one to change to my Documents folder, and one to run XƎLATEX on the quickstart.tex document.

The first thing you see is the prompt (usually a dollar sign or percent sign, or maybe a greater-than pointer C:\> like MS-DOS used to use). When the prompt appears, you can type an instruction (command) and press the Enter key at the end of the line to send if off to the computer for processing. Until you press  Enter, the computer has no idea you’ve finished typing: you MUST press Enter at the end of each line of command for it to take effect.

The results, if any, are displayed on the screen, and the prompt is displayed again ready for your next command. Some commands don’t have any output: if you change directory or delete a file, for example, you just get another prompt. There’s no message confirming the action, and no check to see if you really meant it. You said to do it, and it’s done.

C.1.3 How do I know what commands to type?

You have to learn or be told, or you have to look up what you want to do in a manual (or on the web). Terminals don’t have menus (there are simply far too many commands to fit in menus), and while UNIX and GNU/Linux systems (including Apple Macintosh OS X) have an online manual, it’s not searchable in the normal meaning of the word: you have to know in advance the name of the program command you want to look up.

Having said that, unless you plan on using the terminal for a lot of other work, there are really only half a dozen commands you need to be familiar with. The most important of these are the obvious ones: latex, pdflatex, xelatex, or latexmk; plus makeindex and biber or bibtex depending on whether or not you have an index, and how you want your bibliography formatted. Each command is the single-word short name of a program, and is followed by the name of the LATEX file you want to typeset.

A few other commands are pretty essential: they have nothing to do with LATEX — these are housekeeping or file-management commands and are built into every computer. There are a lot more of them but these are the ones you will likely need.

cd

Change Directory, followed by the name of a folder or directory. This makes sure you are in the right directory (folder) for what you want to do. Terminals always start up in your Home or Login directory, so you will almost always want to type this as your first command, eg

$ cd Documents/reports/quarterly
	      

Note that you have to know which directory you need to change into: the computer cannot know or guess. In Windows systems you have to use the backslash instead of the normal slash to separate folders and filenames.

more

This command shows you the contents of a file, screen by screen. It’s not an editor, so you can’t change the contents, but it’s a fast way to have a quick look at a small file without editing it. You press the spacebar to go to the next page, or the Enter key to move line by line. Press  q to stop the program and get back to the command prompt.

$ more mythesis.aux
	      
del or rm

DELete or ReMove, followed by the name of the file or folder you want to get rid of — del is the Windows command and rm is for all other desktop systems.

C:\Documents\reports\quarterly> del mythesis.aux
	      

There is no check or safety-catch, and no Trash or Wastebasket to retrieve accidentally-deleted files from. When you delete a file, it’s really gone, immediately and forever.

exit

Finishes your terminal session and closes the window.