L A T E X week 2: Basics for Writing a Document University of California Berkeley September 13, 2007
Example Latex Document \documentclass{class here} \usepackage{package 1,package 2} \setlength{\oddsidemargin}{0in} \setlength{\textwidth}{6.5in} \setlength{\topmargin}{-.7in} \setlength{\textheight}{9.0in} \title{the title} \author{we expect you know your own name} \date{the day} \begin{document} \maketitle Hello World \end{document}
Document Class At the top of every latex document you have to tell it what class you are using. Definition A class is like a template which tells latex what to do with the rest of the text that you input. Here are some document classes: article report book letter resume (to be installed) beamer (to be installed)
oddsidemargin Definition oddsidemargin refers to the space between the text and the left edge of the page. Default is 1in Positive value pushes to the right Negative value pushes to the left
topmargin Definition topmargin refers to the space between the text and the top edge of the page. Default is 1in positive value pushes down Negative value pushes up
textwidth and textheight Definition textwidth is the amount of characters per line. Basically the width of the text. It effects the right margin. Definition textheight refers to the number of lines on a page. The height of the text. it effects the bottom margin.
Setting Margins The Idea 1in margins Piece of U. S. letterpaper is 8.5inX11in.
Margin Specifications for 1in margins \setlength{\oddsidemargin}{0in} \setlength{\textwidth}{6.5in} \setlength{\topmargin}{-.7in} \setlength{\textheight}{9.0in}
Latex Commands Commands Use backslash to begin a latex command. There are two different categories of latex commands. They are: 1 Inline 2 Environment
Inline Commands Structure of Inline Commands \command[optional]{required} Example Here are some examples of inline commands: \documentclass[12pt]{article} \usepackage{package name} \emph{emphasized text}
Environment Commands Definition Environment commands tell latex what to do with specific blocks of text. They always include begin and end commands. Here are some examples of environment commands. \begin/end{document} \begin/end{itemize} \begin/end{enumerate} \begin/end{center} \begin/end{singlespace} \begin/end{quote}
Document Divisions Document divisions help you organize a document Such examples may include section, subsection, subsubsection, part, chapter, paragraph, or subparagraph. Ability to use some of the above may be contingent upon the documentclass. You can easily make a table of contents with a document that includes divisions.
What it looks like Example \chapter{chapter name} \part{part name} \section{section name} \subsection{section name} \tableofcontents
Bulleted and Numbered Lists list commands Bulleted and numbered lists are done with itemize and enumerate environments respectively. item 1 item 2 item 3 1 number 1 2 number 2 3 number 3
Source Example Here is the source of the materials on the last slide. \begin{itemize} \item item 1 \item item 2 \item item 3 \end{itemize} \begin{enumerate} \item number 1 \item number 2 \item number 3 \end{enumerate}
Different Text Styles Here are some text styles that you can use in your latex document. Bold Italicized underlined bold italicized \textbf{bold} \textit{italicized} \underline{underlined} \textbf{\textit{text}}
Text Sizes You select between 12pt and 10 pt fonts in the documentclass command. For other font sizes here are some useful commands. \tiny = 5pt \scriptsize = 7pt \footnotesize = 8pt \small = 9pt \normalsize = 10pt \large = 12pt \Large = 14pt \LARGE = 18pt \huge = 20pt \Huge = 24pt
Sources to look up For fonts: http: //web.image.ufl.edu/help/latex/fonts.shtml for margins: http: //web.image.ufl.edu/help/latex/margins.shtml