100% found this document useful (1 vote)
84 views35 pages

Introduction To LaTeX

thesis writing in latex

Uploaded by

Soberly Mohanty
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
84 views35 pages

Introduction To LaTeX

thesis writing in latex

Uploaded by

Soberly Mohanty
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

Introduction to

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

• Written by Donald Knuth in 1970’s as TeX.


• LaTeX is an extension of TeX
-Macro packages to make TeX easy to use.
• Markup language (like HTML, XML, etc): Document is compiled from a
code.
• Case sensitive.
• Output is a PDF (Portable Document Format).
ADVANTAGES DISADVANTAGES
• Professional layouts. • Steep Learning curve.
• Consistent formatting for • Maths is slow and difficult.
complex documents that include
equation editing, tables, figures,
and referencing.
• Portable across platforms and
systems.
• Free and open-source software.
LaTeX

Code Editor: Compiler


Tex studio, Tex .tex file → PDF file
maker, Kile, Winedit
CONTENTS

• 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

• Collection of Additional commands.


• Imported into the LaTeX document.
• Supports pictures, links and bibliography.
• Included in the preamble only.
• Non-inclusion throws an error.
• Any no. of packages can be used.
COMMON PACKAGES

• \usepackage{geometry} – configures paper size, margins, footnote, header,


orientation, etc.
• \usepackage{amsmath} Incorporates mathematical fonts and
• \usepackage{amssymb} symbols
• \usepackage{amsfont}
• \usepackage{graphicx} – integrates pictures and images
• \usepackage{multicol,multirow} – enables merging table rows and columns
• \usepackage{hyperref} – allows hyperlinks in the document
• \usepackage{biblatex} – alters bibliography style
TEXT
• Included inside the Body of the text.
• Bold \textbf { }
• Italics \textit { }
• Spaces: n number of spaces are treated as a single space only.
• Line breaks: n number of line breaks are treated as one line break only.
• \\ or \newline - start in a new line
• \quad – introduces indent of line.
• \noindent – removes indent of line.
• \par or a line break– starts new paragraph.
• \hspace – horizontal space between words.
• \vspace – vertical space between lines.
ALIGNMENT OF TEXT
• \begin{flushleft}
\end{flushleft} – left-aligned text
• \begin{flushright}
\end{flushright} – right-aligned text
• \begin{centre}
\end{centre} – centre-aligned text
• Text is justified by default
COMMENT

• % - codes for commenting a command.


• Precedes a command.
• LaTeX ignores the whole line following the % symbol.
• Used to write inputs that need not be printed in the output.
• %\maketitle – ignores the command
• \maketitle % uses the title, author, date mentioned in the preamble
to generate the title of the document.
PREAMBLE COMMANDS
1. \documentclass{class}
• First command.
• Specifies the type of the document.
2. \usepackages{ }
3. \title{ }
- Intended title of the document.

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

• Generate online Latex Codes for tables:


https://www.tablesgenerator.com/
UPLOAD FIGURES
• Upload the desired pictures into Overleaf before insertion.
• Upload option: Top left corner.
INSERT FIGURES
• ENVIRONMENT: \begin{figure}[H]
\includegraphics[width=\linewidth]{Image name.extension}
\caption{ABC} \label{F1}
\end{figure}
• More figures: \usepackage{subfigure}
\begin{figure}[H]
\subfigure[caption]{
\includegraphics [width=\linewidth]{Image name.extension}
}
\caption{ABC} \label{F2}
\end{figure}
NOTE FOR INSERTING FIGURES
• Package: \usepackage{graphicx} for figures
\usepackage{subfigures} for sub figures.
• Extensions supported are :
JPEG, JPG, PNP, PNG, EPS.
• Alignments can be altered: \flushleft
\centering
\flushright
CROSS REFERENCES
• \usepackage {hyperref}
• Include [hidelinks] in the document class command to remove
coloured boxes.
• \label {X1}
• \ref {X1}
BIBLIOGRAPHY
• Create a new file with .bib extension.
• Copy the bibTeX reference for articles from Google Scholar.
• Commands: \cite is used where a reference needs to be inserted in the line.
- Choose the {unique code of the paper}from the dropdown box.
\citep{ } - paranthesis
\bibliographystyle{plain} – numbered references.
{plainnat} – Author Year style.
\bibliography{name of the reference file}
REFERENCES
• https://guides.nyu.edu/LaTeX/home
• Beginners Guide to LaTeX:
https://www.cs.princeton.edu/courses/archive/spr10/cos433/Latex/latex-
guide.pdf
• The Not So Short Introduction to LaTeX:https://tobi.oetiker.ch/lshort/lshort.pdf
• https://en.wikibooks.org/wiki/LaTeX
• https://www.tablesgenerator.com/
THANK YOU

You might also like