Click [slideshow] to begin presentation.

 

Page Zero

Fundamentals of (La)TeX

  • LaTeX source files
  • The edit, compile, view cycle
  • GUIs
  • Commandline LaTeX
  • Warnings and Errors




 

TeX Source Files

Type in your LaTeX source: GUI or your favourite editor. . .

White space:
  • single space same as many;
  • blank line is new paragraph (except verbatim mode).
Macros and Curly Brackets (Braces)
  • macros (commands) control format: \macro
  • braces (curly brackets), control grouping: {\bf this will be bold} or \section{A Section Title}

Example Document




 

The Edit, Compile, View Cycle

Three Steps: edit, compile, view (run), just like a C or Fortran programme

All from GUI/menus (or command-line/Makefile):

  1. Edit (La)TeX source file.
  2. Compile — use pdflatex command to generate PDF
  3. Preview using Acrobat Reader, Evince, xpdf. . .
  4. Print in usual way.



Changes to source file?

  • re-compile;
  • reload/refresh in viewer — no need to start another viewer.




 

Command-line vs GUIs

Old School: favourite editor plus command-line tools
  • cross-platform;
  • flexible, powerful: make use of BASH and Makefiles. . .
A Choice of GUI IDEs exist for [La]TeX:
  • mostly platform/OS-specific;
  • good for those unfamiliar with the command-line.


More:




 

Kile

KDE's Kile — a fancy GUI for Linux Users

More

  • Kile Website
  • Designed for KDE, but works on GNOME, etc.




 

TeXMaker

A cross-platform, free LaTeX GUI editor

More

  • TeXMaker Website
  • Linux, Mac OS-X and MS Windows




 

TeXnicCenter

More





 

Example Kile Session

1.Start Kile (menu or commandline) to get the opening graphical shell.
2.Open a document: File, New.
3.Edit the template provided.
4.Build, Quick Build, or Build, Compile, PDFLaTeX to check syntax and preview.
5.Print in the obvious way: File, Print.




 

Example Command-Line Session

Demos!

LaTeX:


Plain TeX — hardcore only:
Plain TeX with Postscript-related tricks — just for fun:




 

Compilation Errors: Types

Types of Errors

When you create a (La)TeX source file you will make mistakes:

Those that (La)TeX notices
(La)TeX will report an error and stop to await instruction, for example
  LaTeX error.  See LaTeX manual for explanation.
                Type  H <return>  for immediate help.
  ! Environment itemie undefined.
  \@latexerr ...for immediate help.}\errmessage {#1}
                                                    \endgroup
  l.140 \begin{itemie}

  ?
Those that it doesn't
Your document won't look as you intended!




 

Compilation Errors: Messages

The Error Message

  • The third line (beginning with a "!") is the error indicator (what the error is).
  • Next two lines tell what (La)TeX was doing.
  • Next, the error locator
    • Sometimes (La)TeX has passed the true error. . .

Your Options

  • Type "X" or "x" and "return" to stop compilation.
  • Hit "return" to allow the compiler to continue. . .
    • Isolated errors. . .
    • Error cascades. . .




 

Warning: Font generation

Its possible that you may see something like. . .

kpathsea: Running mktexpk --mfmode ljfour --bdpi 600 --mag 1+264/600 
     --dpi 864 cmti10
mktexpk: Running mf \mode:=ljfour; mag:=1+264/600; nonstopmode; input cmti10
This is METAFONT, Version 2.7182 (Web2C 7.3.1)

(/usr/share/texmf/fonts/source/public/cm/cmti10.mf
(/usr/share/texmf/fonts/source/public/cm/cmbase.mf)
(/usr/share/texmf/fonts/source/public/cm/textit.mf
(/usr/share/texmf/fonts/source/public/cm/itall.mf [97] [98] [99] [100] [101]
[102] [103] [104] [105] [106] [107] [108] [109] [110] [111] [112] [113]
[114] [115] [116] [117] [118] [119] [120] [121] [122])


  • This is TeX (really METAFONT) building fonts. . .
  • Just ignore it. . .




 

Hands-On Sessions in this Course

Download files
  • All required LaTeX source files downloaded;
    • right-click on the link and choose "Save link as. . ."
Use the command line and your favourite editor, or Kile
  • vi, emacs. . . — gedit is a good bet, it's on the menu;
  • Kile has a built-in.

Possible Alternative Options:

  • Use your own laptop if you wish.




 

Using the Linux Command-Line

Ampersand
  • used to background programs, e.g.,
        gedit &
  • list backgrounded jobs with jobs;
  • alternatively, if started without a &, then Ctrl-z then bg.
History
  • use up and down arrows;
  • or type history and choose !<command-num> (N.B. the "!")
Command Completion — TAB
  • Hit the TAB key once or sometimes twice. . .




 

Hands-On

The aims of this hands-on session are for you to:

  • compile and (pre-)view (La)TeX documents;
  • make simple changes to a (La)TeX source-file (using a text editor), compile the resulting changed source and (pre-)view it;
  • appreciate how well (La)TeX handles mathematics.