Introduction To LaTeX
Introduction To LaTeX
LaTeX
Evangeline Lawrence
23PHD 0087
LaTeX
• Pronounced as Lay-tech.
• Typesetting software - the process of arranging text and symbols for
printing or digital display
• Prepare Technical and Scientific documents
• Publication quality documents
• Supported on Windows, Macs, Linux and Online services
• Free software
INTRODUCTION
• Margins alignment
• Alignment of Text
• Inserting Tables
• Inserting Figures
• Cross References
• Bibiliography
LATEX STRUCTURES
• COMMANDS
• Basic unit of creating any document in LaTeX.
• Determine LaTeX behaviour.
• Made up of arguments: function to be performed.
• Format: Always starts with a \ - backslash.
- Starts with the \document - Environment
class command. /begin{document}
- Packages and tile goes in /end{document}
here - Main Text is entered
SYNTAX
COMMANDS ENVIRONMENTS
• Made up of arguments. • Applies specific effects to a
• Arguments are written: section of the document.
• After \ • Made up of a pair of arguments.
• Within { } – Mandatory • Has a \begin { }
arguments \end { }
• Within [ ] – Optional
arguments
• \command [ ] { }
PACKAGES
4. \author{ }
- Author of the document
5. \date{ }
- \today – mentions that day’s date
- Leaving the brackets empty will produce no date.
- Not mentioning the date command will mention the date the
document was prepared.
BODY COMMANDS
1. \maketitle
2. \begin{document}
\end{document}
- main environment that hold the entire text of the document.
1. \section, \tableofcontents, etc.
2. All Environments.
RESERVED CHARACTERS
• Have a specific function in LaTex.
• Entering them directly will not get printed in the output.
• The word ‘Latex’
• Symbols like : %, ^, _, &, { }, [ ], $ Preceded by a backslash
• Greek characters
• \backslash
• Symbols are considered to be Mathematical hence Use of Math Mode
is also needed : $ \% $
THROW AN ERROR
• Error Messages: Description of the error along with line number.
• Too many }’s, spaces, line breaks, unnecessary codes.
• Undefined control sequence: Mistyping spellings.
• Not in Math mode
• Runaway argument: Missing closing brackets.
• Missing packages.
CODE CHECKERS
• nag (www.ctan.org/tex-archive/macros/latex/contrib/nag): obsolete
commands.
• lacheck (www.ctan.org/tex-archive/support/lacheck): to spot mistakes
in code. It is compiled for Windows and OS/2
FLOAT
• Content of a document that cannot be broken over a page.
• ‘Tables’ and ‘Figures’ are recognized as floats.
• Given captions (\caption), labels (\labels) and \ref for cross
referencing.
• Packages used: graphicx, float, multicol,multirow, subfigure,
subcaption, hyperref
SPECIFICATIONS FOR POSITIONING
Specifier Permission
Place the float here, i.e., approximately at the same point it occurs in the source text
h
(however, not exactly at the spot)
t Position at the top of the page.
b Position at the bottom of the page.
p Put on a special page for floats only.
! Override internal parameters LaTeX uses for determining "good" float positions.
Places the float at precisely the location in the LaTeX code. Requires
H
the float package,[1] i.e., \usepackage{float}.
INSERTING TABLES
• Tabular Environment
\begin{table}[h]
\centering Output
\begin{tabular}{|c|c|} st column nd
\hline 1 2 column
1st column & 2nd column \\ a b
\hline
a & b \\
\hline
\end{tabular}
\caption{Example} Package : \usepackage{subcaption}
\label{T1}
\end{table}
Breakdown of the code
• {|c|} : denotes alignment of entries
- right (r), center (c), and left (l).
• More columns: Type more alignment commands {|c|c|c|c|}
• Vertical bar |: indicates that a vertical line should be drawn
between those columns.
• Amberstand &: separates the column entries
• \\ double backslash: signifies the end of each line of the
table.
• \hline: indicates a horizontal line should be inserted.
COMPLEX TABLES