LaTeX

From the Linux and Unix Users Group at Virginia Teck Wiki
Revision as of 22:34, 3 January 2019 by Pew (talk | contribs) (Paul moved page LaTex to LaTeX)
Jump to: navigation, search

LaTeX is a markup language and typesetting system for producing high-quality documents. The X symbol is supposed to represent the Greek character chi, making the proper pronunciation lah-tech or lay-tech.

Sample LaTeX Stub

\documentclass{article}

\usepackage{fullpage}

\author{Hokie Hackman}
\title{My Favorite Class\\Homework 1}

\begin{document}

\maketitle

\end{document}

Formatting Assignments

LaTeX is probably the best tool available for typesetting documents involving math. Below are some pointers on formatting school assignments.

Smaller Margins

The article class defaults to rather large margins. An easy way to make the margins smaller is to include the fullpage package.

\documentclass{article}
\usepackage{fullpage}
\begin{document}
Hello, and welcome to a paragraph that begins much closer than usual to the left side of the page.
\end{document}

Upper Right-Hand Corner

For some assignments you may be required to put your name, ID number, the date, or other elements at the top right-hand corner of the first page. The flushright environment can accomplish this.

\documentclass{article}
\begin{document}
\begin{flushright}
Hokie Hackman\\
905001337\\
My Favorite Class\\
\today
\end{flushright}
\end{document}

Nonsequential Enumerated Items

The enumerate environment is useful for numbered lists, and while the enumerate offers a quick way to change the counter for a whole list of sequential items, no extra package is necessary to number \items individually. Passing an argument to each \item is probably the easiest way to number homework problems that aren't sequential in LaTeX.

\documentclass{article}
\begin{document}
\begin{enumerate}
\item[4.10] What is $1+1$?

\[ 1+1=2 \]

\item[4.12] What are the first two prime numbers?

The first two prime numbers are two and three.

\item[4.25] In what year was the Free Software Foundation formed?

The FSF was founded in 1985.

\end{enumerate}
\end{document}

Karnaugh Maps

There are a couple k-map packages available. We should document which one is better, and what it's packaged with (science?).

Spell Checking

The following command can be used to spell check (La)TeX documents.

aspell -c -t document.tex

Error Messages

  • The line with the bang (!) on it is the error message.
  • The number after l. is the line number where the error occurred.

Extra alignment tab has been changed to \cr

! Extra alignment tab has been changed to \cr.
<template> \egroup \endtemplate

This can happen when a line of your eqnarray is missing its endline mark: \\.

Missing $ inserted

! Missing $ inserted.
<inserted text>

This can happen when you leave out a closing inline equation mark: $.