LATEX COURSE
To Create first latex document
1. https://youtu.be/UaLVP_q5ksM
Code
\documentclass{article}
\title{LaTeX Document}
\author{Firuza}
\date{\today}
\begin{document}
\maketitle
hello this is my first document in LaTeX
\end{document}
2. \documentclass{book}
\title{Mass}
\author{Wikipedia, the free encyclopedia}
\date{\today}
\begin{document}
\maketitle
Topic 1: Introduction / Session: Section levels and ToC ( LaTeX Code in the Session )
2. \documentclass{book}
\title{LaTeX Document}
\author{Wikipedia \\ Collated by Firuza}
\date{\today}
\begin{document}
\maketitle
\tableofcontents
\chapter{Overview}
\section{Overall Description}
\section{Introduction}
\paragraph{}
Dhansak is a popular Indian dish, originating among the Parsi
Zoroastrian community.[1] It combines elements of Persian and Gujarati
cuisine. Dhansak is made by cooking mutton or goat meat with a mixture of
lentils and vegetables. This is served with caramelised brown rice, which is
rice cooked in caramel water to give it a typical taste and colour. The dal
cooked with mutton and vegetables served with brown rice, altogether is
called dhansak.
\subsection{Purpose}
\subsection{Scope}
\end{document}
Extra Reading Material
Bookmark this page
Avoid entry in ToC
Whenever we write commands like \chapter{...}, \section{...}, the title is mentioned
in the table of contents that is generated. There are situations when you would not like the
entry in ToC. This is achieved by appending a * to the command. For example, consider
the commands \chapter*{Introduction} or \subsection*{Time-Table}. There will not
be any entry of Introduction and Time-Table in the Table of Contents.
Special Characters
Special characters like ! @ * ( ) - + = ? [ ] / can be written as is in the document.
Unlike them, there are certain characters which need to be written with an escape
character (\), else they either throw an error or do not display the way we want. Some of
them are $ & % _ { } # which are thus are written as \$ \& \% \_ \{ \} \#
Dashes
1. Hyphen (-) is mostly used in between two words, e.g. (two-sided).
2. En dash (\textendash) is mostly used when specifying range of pages, years, etc.
E.g. pages 5 -- 7 explain XYZ
3. Em dash (\textemdash) (longer than En dash) is mostly used in place of
parentheses or colon. E.g. Where there is love there is life --- Mahatma Gandhi
Quotes
Single and double quotes in a document are usually written
using '...' and "..." respectively. LaTeX, on the other hand, denotes different
characters for representing the opening and closing of quotes. ` symbol (usually present
before the Number 1 key on a standard keyboard) represents the opening of quotes
while ' represents the closing of quotes.
Summary of LaTeX Commands (introduction)
\documentclass{article}
\title{...}
\author{...}
\date{...}
\today
\begin{document} ... \end{document}
\maketitle
Session 4
\chapter{...}
\section{...}
\subsection{...}
\subsubsection{...}
\paragraph{...}
\tableofcontents
Some Basics Command Vs Environment
\begin{...}
...
\end{...}
For example, landscape is an environment in LaTeX and is written as
\begin{landscape}
...
\end{landscape}
Topic: Topic 2: Styling Pages / Session: Paper size and Margins (LaTeX Code
in the Session)
\documentclass{book}
\usepackage[a4paper, inner=2in, outer=1in]{geometry}
\begin{document}
\chapter{Overview}
\section{title}
\end{document}
Enhanced Article
\documentclass{book}
\usepackage[inner=1.25in, outer=1in, top=1in, bottom=1in]{geometry}
\title{Mass}
\author{Wikipedia, the free encyclopedia}
\date{2019}
\begin{document}
\maketitle
\chapter*{Preface}
\paragraph{}
\tableofcontents
\chapter{Phenomena}
\paragraph{}
\chapter{Units of mass}
\paragraph{}
Figure: images/220px-SIbaseunit.png
Table: Newtonian Mass
\section{Newton's Canonball}
\paragraph{}
Figure: images/Universalgravitationalmass.png
Figure: images/CavendishExperiment.png
\subsection{Cavendish Experiment}
\subsection{Definitions of terms}
Table: Cavendish terms
\section{Inertial Mass}
\paragraph{}
Figure: images/rollercoaster.jpg
\end{document}
Topic: Topic 2: Styling Pages / Session: Page Styles (Header and footer)
(LaTeX Code in the Session)
\documentclass{book}
\begin{document}
\pagenumbering{roman}
\tableofcontents
\chapter{Overview}
\pagenumbering{arabic}
\setcounter{page}{1}
% \pagestyle{empty}
\section{title}
\chapter{Annexure}
\pagenumbering{Alph}
\setcounter{page}{1}
this is the annexure of my document
\end{document}
Fancy Page Style
Apart from the usual page style that we use, LaTeX gives us a facility to customize the
page using 'fancyhdr' package. To style the page, one must write \pagestyle{fancy}.
Given below are the commands for setting header and footer.
Align Header Footer
Left \lhead{...} \lfoot
Center \chead{...} \cfoot
Right \rhead{...} \rfoot
Document Information
Some document information like section name, chapter name, the total number of pages,
etc. one might need to mention in the header and footer. These are given below along
with their LaTeX commands.
Information LaTeX Command
Current page number \thepage
title ‘Chapter’ \chaptername
Chapter number \thechapter
Section number \thesection
Total number of pages \usepackage{lastpage}
\pageref{LastPage}
Horizontal line after header and before footer
\renewcommand{\headrulewidth}{Xpt}
\renewcommand{\footrulewidth}{Xpt}
Here, X denotes the width of the line
LaTeX Code
\documentclass{article}
% Packages
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{lastpage}
% Define Header
\lhead{\today}
\chead{}
\rhead{Draft}
% Define Footer
\lfoot{Firuza, Nagesh}
\cfoot{Sample.pdf}
\rfoot{Page \thepage of \pageref{LastPage}}
%Define width of horizontal line in the header
\renewcommand{\headrulewidth}{0.4pt}
%Define width of horizontal line in the footer
\renewcommand{\footrulewidth}{0.4pt}
\begin{document}
Some random content. Just copy paste some text over here so that the
document spans more than 1 page. This will give a clear picture.
\end{document}
Fancy Page Style
Apart from the usual page style that we use, LaTeX gives us a facility to customize the
page using 'fancyhdr' package. To style the page, one must write \pagestyle{fancy}.
Given below are the commands for setting header and footer.
Align Header Footer
Left \lhead{...} \lfoot{...}
Center \chead{...} \cfoot{...}
Right \rhead{...} \rfoot{...}
Document Information
Some document information like section name, chapter name, the total number of pages,
etc. one might need to mention in the header and footer. These are given below along
with their LaTeX commands.
Information LaTeX Command
Current page number \thepage
title ‘Chapter’ \chaptername
Chapter number \thechapter
Section number \thesection
Total number of pages \usepackage{lastpage}
\pageref{LastPage}
Horizontal line after header and before footer
\renewcommand{\headrulewidth}{Xpt}
\renewcommand{\footrulewidth}{Xpt}
Here, X denotes the width of the line
LaTeX Code
\documentclass{article}
% Packages
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{lastpage}
% Define Header
\lhead{\today}
\chead{}
\rhead{Draft}
% Define Footer
\lfoot{Firuza, Nagesh}
\cfoot{Sample.pdf}
\rfoot{Page \thepage of \pageref{LastPage}}
%Define width of horizontal line in the header
\renewcommand{\headrulewidth}{0.4pt}
%Define width of horizontal line in the footer
\renewcommand{\footrulewidth}{0.4pt}
\begin{document}
Some random content. Just copy paste some text over here so that the
document spans more than 1 page. This will give a clear picture.
\end{document}
LaTeX Code
\documentclass{article}
% Packages
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{lastpage}
% Define Header
\lhead{\today}
\chead{}
\rhead{Draft}
% Define Footer
\lfoot{Firuza, Nagesh}
\cfoot{Sample.pdf}
\rfoot{Page \thepage of \pageref{LastPage}}
%Define width of horizontal line in the header
\renewcommand{\headrulewidth}{0.4pt}
%Define width of horizontal line in the footer
\renewcommand{\footrulewidth}{0.4pt}
\begin{document}
Some random content. Just copy paste some text over here so that the
document spans more than 1 page. This will give a clear picture.
\end{document