0% found this document useful (0 votes)
4 views

Lecture 3

Uploaded by

Srijani Goswami
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Lecture 3

Uploaded by

Srijani Goswami
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 59

Technical document preparation with LaTeX?

With hands on experience

Kaushik Roy

West Bengal State University, Barasat


[email protected]

May 28, 2024

Kaushik Roy (WBSU) LaTeX May 28, 2024 1 / 30


Outline

1 Introduction to LATEX

2 Text formatting
Font, List, Comments & Spacing, Special Characters

3 Figure & Tables

4 Mathematics & Algorithm

5 Reference & Cross Reference

6 Advanced features of LATEX

7 Presentation using LATEX

8 Drawing Figures

Kaushik Roy (WBSU) LaTeX May 28, 2024 2 / 30


Commands & Environments
LATEX uses a series of Commands & Environments.

Kaushik Roy (WBSU) LaTeX May 28, 2024 3 / 30


Commands & Environments
LATEX uses a series of Commands & Environments.

Commands: LATEXdocuments behaviour can be controlled by using


specific command. Typical command structure is as following:

\commandname[optional argument]{main argument}

Kaushik Roy (WBSU) LaTeX May 28, 2024 3 / 30


Commands & Environments
LATEX uses a series of Commands & Environments.

Commands: LATEXdocuments behaviour can be controlled by using


specific command. Typical command structure is as following:

\commandname[optional argument]{main argument}

Environments: A special type of command is the environment. Typical


environment structure is as following:

\begin{environmentname}
content
\end{environmentname}

Kaushik Roy (WBSU) LaTeX May 28, 2024 3 / 30


Commands & Environments
LATEX uses a series of Commands & Environments.

Commands: LATEXdocuments behaviour can be controlled by using


specific command. Typical command structure is as following:

\commandname[optional argument]{main argument}

Environments: A special type of command is the environment. Typical


environment structure is as following:

\begin{environmentname}
content
\end{environmentname}

Some environments take arguments and optional arguments, like


commands. e.g Figure
Kaushik Roy (WBSU) LaTeX May 28, 2024 3 / 30
Body of Text

• Start with \begin{document}


• End with \end{document}

Kaushik Roy (WBSU) LaTeX May 28, 2024 4 / 30


Body of Text

• Start with \begin{document}


• End with \end{document}
• Typesetting Text
• \\ or \newline and
• Quotations
• Bold \textbf{. . . . . . . . . . . . . . . } or \bf
• Italics \emph{. . . . . . . . . . . . } or \textit{. . . . . . . . . } or \it
• Underline \underline{. . . . . . . . . . . . } or \ul

Kaushik Roy (WBSU) LaTeX May 28, 2024 4 / 30


Body of Text

• Start with \begin{document}


• End with \end{document}
• Typesetting Text
• \\ or \newline and
• Quotations
• Bold \textbf{. . . . . . . . . . . . . . . } or \bf
• Italics \emph{. . . . . . . . . . . . } or \textit{. . . . . . . . . } or \it
• Underline \underline{. . . . . . . . . . . . } or \ul
• Including Multiple Files
• \input{filename.tex}

Kaushik Roy (WBSU) LaTeX May 28, 2024 4 / 30


Page Layout

\documentclass{report}

\begin{document}

So we are able to generate the equivalent text document.

\end{document}

Output
So we are able to generate the equivalent text document.

Kaushik Roy (WBSU) LaTeX May 28, 2024 5 / 30


Fragile and Robust commands
LaTeX commands are either robust or fragile.
Fragile commands need special care if they are part of a moving
argument.
Some fragile commands
The following list is not exhaustive, but illustrates the kind of
commands which are fragile
• All commands that have an optional argument are fragile.
• Environments delimited by \begin ... \end are fragile.
• Display math environment delimited by \[ . . . \]
• Math environment \( . . . \)
• However, . . . (\ldots) is robust
• Line breaks, \ \
• \item commands
• \footnote commands

Kaushik Roy (WBSU) LaTeX May 28, 2024 6 / 30


Lengths

A length is a measure of distance. Many LaTeX commands take a


length as an argument. A length of one inch is specified by typing 1in
or, to specify the same length using metric units, by typing 2.54cm.
Units LaTeX knows about the following common units.
• in - inches
• mm - millimeters
• cm - centimeters
• pt - points (about 1/72 inch)
• em - approximately the width of an ”M” in the current font
• ex - approximately the height of an ”x” in the current font

Kaushik Roy (WBSU) LaTeX May 28, 2024 7 / 30


Length commands
A length may also be specified by a length command. An example is
\parindent whose value specifies the current width of the indentation
which begins paragraphs. Multiples of such length commands may be
specified, for example by writing 2.5\parindent or -0.1\parindent.
Some length commands are
• \parindent - normal paragraph indentation
• \baselineskip - normal vertical distance between lines in a
paragraph
• \baselinestretch - multiplies \baselineskip
• \parskip - the extra vertical space between paragraphs
• \textwidth - the width of text on the page
• \linewidth - width of a line in the local environment
• \extheight - the height of text on the page
• \unitlength - units of lenght in Picture Environment

Kaushik Roy (WBSU) LaTeX May 28, 2024 8 / 30


Space

To create white space we can use the following commands:


• Horizontal space
• \hfill
• \hspace

• Vertical Space
• \addvspace
• \smallskip
• \medskip
• \bigskip
• \vfill
• \vspace

Kaushik Roy (WBSU) LaTeX May 28, 2024 9 / 30


Special Characters

The following characters play a special role in LATEXand are called


special printing characters, or simply special characters.
• # Used to define use of arguments,
• $ used to delineate math and displaymath Enviroments.
• % used to insert Comments in the input file,
• & used to separate items in the array and tabular Enviroments.
• ˜ generates a nonbreaking space
• used to create subscripts
• ˆ used to create superscripts
• \ used in command definitions
• { } for enclosing command arguments

Kaushik Roy (WBSU) LaTeX May 28, 2024 10 / 30


Page numbering

\pagenumbering command is used

\pagenumbering{num style}

Specifies the style of page numbers. Possible values of num style are:
• arabic Arabic numerals
• roman Lowercase roman numerals
• Roman Uppercase roman numerals
• alph Lowercase letters
• Alph Uppercase letters

Kaushik Roy (WBSU) LaTeX May 28, 2024 11 / 30


Font
\documentclass{article}
\begin{document}
\begin{Huge}
Output
\textbf{Technical Institute}
\end{Huge}
\begin{Large}
\textsc{Certification}
\end{Large}
This to certify that Prof. Pal has undergone a course in this
institute and is qualified to be Technical Expert.
\begin{flushright}
\textsf{The Director}
Technical Institute \end{flushright}
%used for aligning to the right \end{document}

Kaushik Roy (WBSU) LaTeX May 28, 2024 12 / 30


Subscript

Can be used only in math mode.


So, for a simple expression this can be a part of the running text:

To get an expression, exp , to appear as a subscript, you just type


{exp}.

Output
H2 O is the formula for water

Subscripts are normally displayed in a different font JRoman ; to change


we can use standard fonts like Roman. $J { \rm Roman}$

Output
$J { \rm Roman}$ will produce JRoman not JRoman

Kaushik Roy (WBSU) LaTeX May 28, 2024 13 / 30


Superscript
ˆ
Similarly use {exp}, to produce superscript, like exp

Output
x3 is the third power of x

Superscripts may have their own superscripts:


ˆ {z}}$
$x{y ˆ should display something like
z
xy

If a symbol has both subscripts and superscripts, the order doesn’t


matter. E.g. $a n2̂$ and $a2̂ n$ both produces same output e.g.

Output
an2 and an2

Kaushik Roy (WBSU) LaTeX May 28, 2024 14 / 30


Font Size
\tiny{Tiny Text} Tiny Text

Kaushik Roy (WBSU) LaTeX May 28, 2024 15 / 30


Font Size
\tiny{Tiny Text} Tiny Text

\scriptsize{Scriptsize Text} Scriptsize Text

Kaushik Roy (WBSU) LaTeX May 28, 2024 15 / 30


Font Size
\tiny{Tiny Text} Tiny Text

\scriptsize{Scriptsize Text} Scriptsize Text

\footnotesize{Footnotesize Text} Footnotesize Text

Kaushik Roy (WBSU) LaTeX May 28, 2024 15 / 30


Font Size
\tiny{Tiny Text} Tiny Text

\scriptsize{Scriptsize Text} Scriptsize Text

\footnotesize{Footnotesize Text} Footnotesize Text

\small{Small Text} Small Text

Kaushik Roy (WBSU) LaTeX May 28, 2024 15 / 30


Font Size
\tiny{Tiny Text} Tiny Text

\scriptsize{Scriptsize Text} Scriptsize Text

\footnotesize{Footnotesize Text} Footnotesize Text

\small{Small Text} Small Text


\normalsize{Normal Text} Normal Text

Kaushik Roy (WBSU) LaTeX May 28, 2024 15 / 30


Font Size
\tiny{Tiny Text} Tiny Text

\scriptsize{Scriptsize Text} Scriptsize Text

\footnotesize{Footnotesize Text} Footnotesize Text

\small{Small Text} Small Text


\normalsize{Normal Text} Normal Text
\large{large Text} large Text

Kaushik Roy (WBSU) LaTeX May 28, 2024 15 / 30


Font Size
\tiny{Tiny Text} Tiny Text

\scriptsize{Scriptsize Text} Scriptsize Text

\footnotesize{Footnotesize Text} Footnotesize Text

\small{Small Text} Small Text


\normalsize{Normal Text} Normal Text
\large{large Text} large Text
\Large{Large Text} Large Text

Kaushik Roy (WBSU) LaTeX May 28, 2024 15 / 30


Font Size
\tiny{Tiny Text} Tiny Text

\scriptsize{Scriptsize Text} Scriptsize Text

\footnotesize{Footnotesize Text} Footnotesize Text

\small{Small Text} Small Text


\normalsize{Normal Text} Normal Text
\large{large Text} large Text
\Large{Large Text} Large Text
\LARGE{LARGE Text} Large Text

Kaushik Roy (WBSU) LaTeX May 28, 2024 15 / 30


Font Size
\tiny{Tiny Text} Tiny Text

\scriptsize{Scriptsize Text} Scriptsize Text

\footnotesize{Footnotesize Text} Footnotesize Text

\small{Small Text} Small Text


\normalsize{Normal Text} Normal Text
\large{large Text} large Text
\Large{Large Text} Large Text
\LARGE{LARGE Text} Large Text
\huge{huge Text} huge Text

Kaushik Roy (WBSU) LaTeX May 28, 2024 15 / 30


Font Size
\tiny{Tiny Text} Tiny Text

\scriptsize{Scriptsize Text} Scriptsize Text

\footnotesize{Footnotesize Text} Footnotesize Text

\small{Small Text} Small Text


\normalsize{Normal Text} Normal Text
\large{large Text} large Text
\Large{Large Text} Large Text
\LARGE{LARGE Text} Large Text
\huge{huge Text} huge Text
\Huge{Huge Text} Huge Text
Kaushik Roy (WBSU) LaTeX May 28, 2024 15 / 30
Font Family

\textrm{Roman Font} Roman Font

Kaushik Roy (WBSU) LaTeX May 28, 2024 16 / 30


Font Family

\textrm{Roman Font} Roman Font

\textsf{Sans Serif Font} Sans Serif Font

Kaushik Roy (WBSU) LaTeX May 28, 2024 16 / 30


Font Family

\textrm{Roman Font} Roman Font

\textsf{Sans Serif Font} Sans Serif Font

\texttt{Typewriter Font} Typewriter Font

Kaushik Roy (WBSU) LaTeX May 28, 2024 16 / 30


Font Styles

\MakeUppercase{Lowercase Text} LOWERCASE TEXT

Kaushik Roy (WBSU) LaTeX May 28, 2024 17 / 30


Font Styles

\MakeUppercase{Lowercase Text} LOWERCASE TEXT


\MakeLowercase{UPPERCASE Text} uppercase text

Kaushik Roy (WBSU) LaTeX May 28, 2024 17 / 30


Font Styles

\MakeUppercase{Lowercase Text} LOWERCASE TEXT


\MakeLowercase{UPPERCASE Text} uppercase text
\textbf{Bold Text} Bold Text

Kaushik Roy (WBSU) LaTeX May 28, 2024 17 / 30


Font Styles

\MakeUppercase{Lowercase Text} LOWERCASE TEXT


\MakeLowercase{UPPERCASE Text} uppercase text
\textbf{Bold Text} Bold Text
\textit{Italic Text} Italic Text

Kaushik Roy (WBSU) LaTeX May 28, 2024 17 / 30


Font Styles

\MakeUppercase{Lowercase Text} LOWERCASE TEXT


\MakeLowercase{UPPERCASE Text} uppercase text
\textbf{Bold Text} Bold Text
\textit{Italic Text} Italic Text

\textsc{Small Caps Text}

Kaushik Roy (WBSU) LaTeX May 28, 2024 17 / 30


Font Styles

\MakeUppercase{Lowercase Text} LOWERCASE TEXT


\MakeLowercase{UPPERCASE Text} uppercase text
\textbf{Bold Text} Bold Text
\textit{Italic Text} Italic Text

\textsc{Small Caps Text}


\textcolor{orange}{Orange Colored Text} Orange Colored Text

Kaushik Roy (WBSU) LaTeX May 28, 2024 17 / 30


Font Styles

\MakeUppercase{Lowercase Text} LOWERCASE TEXT


\MakeLowercase{UPPERCASE Text} uppercase text
\textbf{Bold Text} Bold Text
\textit{Italic Text} Italic Text

\textsc{Small Caps Text}


\textcolor{orange}{Orange Colored Text} Orange Colored Text
\alert{Alert Text} Alert Text

Kaushik Roy (WBSU) LaTeX May 28, 2024 17 / 30


Font Styles

\MakeUppercase{Lowercase Text} LOWERCASE TEXT


\MakeLowercase{UPPERCASE Text} uppercase text
\textbf{Bold Text} Bold Text
\textit{Italic Text} Italic Text

\textsc{Small Caps Text}


\textcolor{orange}{Orange Colored Text} Orange Colored Text
\alert{Alert Text} Alert Text
\structure{Structure Text} Structure Text

Kaushik Roy (WBSU) LaTeX May 28, 2024 17 / 30


Font Styles (contd.)

\uline{Underlined Text} Underlined Text

Kaushik Roy (WBSU) LaTeX May 28, 2024 18 / 30


Font Styles (contd.)

\uline{Underlined Text} Underlined Text

\uuline{Double-Underlined Text} Double-Underlined Text

Kaushik Roy (WBSU) LaTeX May 28, 2024 18 / 30


Font Styles (contd.)

\uline{Underlined Text} Underlined Text

\uuline{Double-Underlined Text} Double-Underlined Text

\uwave{Wavy-Underlined Text} Wavy-Underlined Text


:::::::::::::::::::::

Kaushik Roy (WBSU) LaTeX May 28, 2024 18 / 30


Font Styles (contd.)

\uline{Underlined Text} Underlined Text

\uuline{Double-Underlined Text} Double-Underlined Text

\uwave{Wavy-Underlined Text} Wavy-Underlined Text


:::::::::::::::::::::

\sout{Strikethrough Text} Strikethrough Text

Kaushik Roy (WBSU) LaTeX May 28, 2024 18 / 30


Font Styles (contd.)

\uline{Underlined Text} Underlined Text

\uuline{Double-Underlined Text} Double-Underlined Text

\uwave{Wavy-Underlined Text} Wavy-Underlined Text


:::::::::::::::::::::

\sout{Strikethrough Text} Strikethrough Text

\xout{Struck with Hatching Text} ////////


Struck//////
with////////////
Hatching//////
Text

Kaushik Roy (WBSU) LaTeX May 28, 2024 18 / 30


Font Styles (contd.)

\uline{Underlined Text} Underlined Text

\uuline{Double-Underlined Text} Double-Underlined Text

\uwave{Wavy-Underlined Text} Wavy-Underlined Text


:::::::::::::::::::::

\sout{Strikethrough Text} Strikethrough Text

\xout{Struck with Hatching Text} ////////


Struck//////
with////////////
Hatching//////
Text

\dashuline{Dashed Underline Text} Dashed Underline Text

Kaushik Roy (WBSU) LaTeX May 28, 2024 18 / 30


Font Styles (contd.)

\uline{Underlined Text} Underlined Text

\uuline{Double-Underlined Text} Double-Underlined Text

\uwave{Wavy-Underlined Text} Wavy-Underlined Text


:::::::::::::::::::::

\sout{Strikethrough Text} Strikethrough Text

\xout{Struck with Hatching Text} ////////


Struck//////
with////////////
Hatching//////
Text

\dashuline{Dashed Underline Text} Dashed Underline Text

\dotuline{Dotted Underline Text} .Dotted


. . . . . . . .Underline
. . . . . . . . . . . .Text
.....

Kaushik Roy (WBSU) LaTeX May 28, 2024 18 / 30


Unordered Lists

• The itemize environment creates an unordered list (like this one).


• Items are started using the \item command.
• You can have nested lists.

Code
\begin{itemize}
\item I am using itemize environment to create an unordered list here.
\item Items are started using the \item command.
\end{itemize}

Output
• I am using itemize environment to create an unordered list here.
• Items are started using the \item command.

Kaushik Roy (WBSU) LaTeX May 28, 2024 19 / 30


Ordered Lists
1 The enumerate environment creates an ordered (numbered) list
(like this one).
2 Items are started using the \item command.
3 You can have nested lists.
Code
\begin{enumerate}
\item I am using enumerate environment to create an ordered
(numbered) list.
\item Items are started using the \item command.
\end{enumerate}

Output
1 I am using enumerate environment to create an ordered
(numbered) list.
2 Items are started using the \item command.
Kaushik Roy (WBSU) LaTeX May 28, 2024 20 / 30
Nested list
• We can change the number or bullets as desired
• the enumitem package can be used

output
code code
\begin{enumerate} \item 3rd item 1 1st item
\item 1st item \begin{itemize} 1 1st sub item
2 2nd sub item
\begin{enumerate} \item 1st sub item
\item 1st sub item \item 2nd sub item 2 2nd item
\item 2nd sub item \end{itemize} (i) 1st sub item
(ii) 2nd sub item
\end{enumerate} \item 4th item
\item 2nd item \begin{itemize} 3 3rd item
• 1st sub item
\begin{enumerate}[(i)] \item[\ast] sub item
• 2nd sub item
\item 1st sub item \item[\ast] sub item
\item 2nd sub item \end{itemize} 4 4th item
\end{enumerate} \end{enumerate} ∗ sub item
∗ sub item
Kaushik Roy (WBSU) LaTeX May 28, 2024 21 / 30
Alignment

• For Alignment of text we need respective environment


• Left Align
• flushleft environment
• \begin{flushleft} [text.....] \end{flushleft}
• Right Align
• flashright environment
• \begin{flashright} [text.....] \end{flashright}
• Center Align
• center environment
• \begin{center} [text.....] \end{center}
• Justified
• justifying environment
• \begin{justify} [text.....] \end{justify}

Kaushik Roy (WBSU) LaTeX May 28, 2024 22 / 30


Outline

1 Introduction to LATEX

2 Text formatting
Font, List, Comments & Spacing, Special Characters

3 Figure & Tables

4 Mathematics & Algorithm

5 Reference & Cross Reference

6 Advanced features of LATEX

7 Presentation using LATEX

8 Drawing Figures

Kaushik Roy (WBSU) LaTeX May 28, 2024 23 / 30


Outline

1 Introduction to LATEX

2 Text formatting
Font, List, Comments & Spacing, Special Characters

3 Figure & Tables

4 Mathematics & Algorithm

5 Reference & Cross Reference

6 Advanced features of LATEX

7 Presentation using LATEX

8 Drawing Figures

Kaushik Roy (WBSU) LaTeX May 28, 2024 24 / 30


Outline

1 Introduction to LATEX

2 Text formatting
Font, List, Comments & Spacing, Special Characters

3 Figure & Tables

4 Mathematics & Algorithm

5 Reference & Cross Reference

6 Advanced features of LATEX

7 Presentation using LATEX

8 Drawing Figures

Kaushik Roy (WBSU) LaTeX May 28, 2024 25 / 30


Outline

1 Introduction to LATEX

2 Text formatting
Font, List, Comments & Spacing, Special Characters

3 Figure & Tables

4 Mathematics & Algorithm

5 Reference & Cross Reference

6 Advanced features of LATEX

7 Presentation using LATEX

8 Drawing Figures

Kaushik Roy (WBSU) LaTeX May 28, 2024 26 / 30


Outline

1 Introduction to LATEX

2 Text formatting
Font, List, Comments & Spacing, Special Characters

3 Figure & Tables

4 Mathematics & Algorithm

5 Reference & Cross Reference

6 Advanced features of LATEX

7 Presentation using LATEX

8 Drawing Figures

Kaushik Roy (WBSU) LaTeX May 28, 2024 27 / 30


Outline

1 Introduction to LATEX

2 Text formatting
Font, List, Comments & Spacing, Special Characters

3 Figure & Tables

4 Mathematics & Algorithm

5 Reference & Cross Reference

6 Advanced features of LATEX

7 Presentation using LATEX

8 Drawing Figures

Kaushik Roy (WBSU) LaTeX May 28, 2024 28 / 30


Exercise

1 Display various fonts and sizes of text

Kaushik Roy (WBSU) LaTeX May 28, 2024 29 / 30


Conclusion

Kaushik Roy (WBSU) LaTeX May 28, 2024 30 / 30

You might also like