return of the pdf
return of the pdf
IGNORED AS IF THEY ARENT PRESENT. LATEX COMMENTS ARE MULTILINE AS WE CAN SEE.
\documentclass[12pt, a4paper]{article}
%YOU INPUT OPTIONAL FUNCTIONS/ARGUMENTS BELOW THE DOCUMENTCLASS LINE .
\pagestyle{empty}
\usepackage{amsmath, amssymb, amsfonts}
\usepackage{float}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage[margin=2cm]{geometry}
\parindent 0px
\def\MACRO{This was written using a macro}
%In the above line, the square brackets after the command(this is a command and not
a function because it is a script not a language) give the optional parameters
while the curly brackets contain the main class or parameter to be assigned. The
most common document classes are: article (For articles in scientific journals,
presentations, short reports, program documentation, invitations, ...),
IEEEtran(For articles with the IEEE Transactions format), proc(A class for
proceedings based on the article class), minimal(It is as small as it can get. It
only sets a page size and a base font. It is mainly used for debugging purposes),
report(For longer reports containing several chapters, small books, thesis, ...)
book(For books), slides(For slides. The class uses big sans serif letters.), memoir
(For sensibly changing the output of the document. It is based on the book
class, but you can create any kind of document with it), letter(For writing
letters), beamer(For writing presentations).
\begin{document}
\maketitle
\tableofcontents
\pagebreak
\section{Basic Introduction}
Hello this is my first \LaTeX\ document.
%this a blank line which is used for a hard return. A soft return starts a new line
as we can see while a hard return starts a new paragraph and leaves a two finger
space.
I am a Mechanical engineering student.\\(we can also write like this as in C but it
gets cluttered [see line 11 of code] ).
% a double backslash "\\" is used for a soft return as is used in the above line
(note the difference between a hard return and a soft return).
I study Mechanical Engineering in the University of Engineering and Technology,
Mardan.\\
%A soft return followed by a hard return will leave a space between the two
paragraphs.
I am now learning \LaTeX\ and I will hone this skill for making my assignments and
Lab reports.\\
%to use mathematical expressions, we use math mode. To start math mode we use a
dollar sign and to end it we use another dollar sign. Everything in between the
dollar sgns will be in math mode. Let us see an example.
we can have a chapter, section, paragraph or a subparagraph etc by using the
command "$\backslash$XXXXXXX" where the XXXXXXX represent the required type of
division or organization e.g paragraph etc.\\
To make a page title , we use the commands,\\[5pt]
\large
$\backslash$title\{this is the title\}\\
$\backslash$author\{the name of the author\}\\
$\backslash$date\{type in the date here(if the mos recent compilation date is
required,
we use the command $\backslash$today)\}\\[5pt]
\normalsize
To display the title we use the command "$\backslash$maketitle" at the point where
the title is to be inserted as is the case in the beginning of this document.\\
To make a table of contents we use the command "$\backslash$tableofcontents" where
we want to insert the table of contents.\\
%There are two math modes inline and displayed math mode.in displayed math mode
everything will be in it own line(this is usually used in academic texts).To use
displayed math mode, we use a double dollar sign to start and end it. Inline math
mode is initiated and terminated using a single dollar sign and the quations will
apper inline with the text. An example of displayed math mode is as follows,
This is displayed math mode $$F(x)=x^2+4x+12$$ the equation is more a prominent
part of the paragraph and displayed as would be in a textbook.\\
\subparagraph{Greek Letters}:
To print Greek letters, we just use their names as commands which must be enclosed
in math mode operators to make sure they are printed and do not give errors as can
be seen in the following examples.\\
$$\pi$$
$$\Pi$$
$$\theta$$
$$\Theta$$
$$\alpha$$
$$A=\pi r^2$$
\subparagraph{Trignometric functions}:
$$y=\sin x$$
$$x=\cos y$$
$$y=\csc \theta$$
$$y=\sin^{-1} x$$
$$y=\arcsin x$$
\subparagraph{Logarithmic functions}:
$$y=\log x$$
$$y=\log_7 x$$
$$y=\ln x$$
\subparagraph{square root functions}:
$$y=\sqrt{2}$$
$$y=\sqrt[6]{99}$$
$$y=\sqrt[3]{23x \sqrt{3z}}$$
\subparagraph{fractions}:
%As the numerator and denomoinator both are essential i.e non optional, thus both
are in curly brackets.Square brackets only have optonal arguments which are used
for modiication as is the case with the "sqrt[]{}" comand.
$$\frac{2}{3}$$
About$\frac{9x}{3}$ of the glass is full.\\
We can also put fractions in display mode by using the command "dfrac" instead of
"frac" (an additional package is required for this to work so I just use displayed
math mode).$$y=\frac{nigga}{balls}$$
To just change the size of the mathematical notation to display size, use the
command "displaystyle" before the mathematical notation in math mode.
For example,\\[5pt]
%To include vertical spacing in the text without adding a full line gap, use square
brackets with the optional argument for text size as is used above.
$y=\displaystyle \frac{nigga}{balls}$.\\$y=\frac{nigga}{balls}$.\\[10pt]
$$y=\frac{1+\sqrt{3}}{x^{2z} \sqrt[5]{37z^3}}$$\\
\subparagraph{curly brackets}:
To show round or square or the other types of brackets, you just type them in, but
to show curly brackets, you have to put a backslash before them(just like we used
to show the backslash i.e escape sequence command in C bu putting another backslash
before it).$$y=\{x^2[2x(\log_y x)]\}$$
The same method is used to print all reserved symbols except a backslash which is
printed in math mode using the command $\backslash$backslash e.g\\[10pt]
The trip to China costs a minimum of \$300.\\
I have printed a backslash $\backslash$.
To correct the size of brackets to fit the mathematical notation, we precede the
brackets with the commands $\backslash$left and$\backslash$right for the left and
right brackets respectively.To print angular brackets, we also add the commands $\
backslash$langle and $\backslash$rangle after the above two commands which are used
for the bracket height adjustment.$$y=\left\{^2[2x(\log_y x)]\right\}$$ $$y=\
left \langle \frac{1+\sqrt{3}}{x^{2z} \sqrt[5]{37z^3}}\right \rangle$$ $$y=\left
| \frac{1+\sqrt{3}}{x^{2z} \sqrt[5]{37z^3}}\right |$$
To not print a command or an expression, put a period in front of it as follows $$\
left. \frac{dy}{dx} \right |_{x=1}$$
$$Y=20\pi\left.\left(\frac{suspense}{\left(x^2+\frac{nigga}{balls}\right)}\right)\
right|_{x\rightarrow\infty}$$
\subparagraph{symbols of sets}:
this is the symbol for real numbers\begin{large} "$\mathbb{R}$" \end{large}. To
show it , we use the command "$\backslash$mathbb\{R\}", the R can be replaced by Z,
Q etc for integers and rational numbers respectively. TO USE THIS, WE NEED THE
PACKAGE "amsfonts".
\subparagraph{Tables}:
In order to make tables we use the command $\backslash$begin\{tabular\}\{\}. \\
The second set of brackets indicates the number of columns in our table and they
are specified as left aligned by writing "l", right aligned by writing "r" or
center aligned by writing "c", we can also use a combination of these.The number of
columns is specified by the number of letters in the bracket, if we want five
columns, we write five letters e.g \{lllll\}, \{rrrrr\} or \{ccccc\} .In order to
add a line separating the columns, we add the pipe symbol between the letters e.g \
{|c|c|c|c|c|\}. If a cell is going to contain a paragraph, then we write p\{length
of paragraph in cm\} e.g \{|c|p\{2cm\}|c|c|c|\}. The pipe symbols at the beginning
and end are for the boundary.The table is ended with the command $\backslash$end\
{tabular\}.For the horizontal line , we use the command $\backslash$hline .\\
\begin{tabular}{|c|c|c|c|c|}
\hline
$x$ & 1 & 2 & 3 & 4\\ \hline
$f(x)$ & 6 & 8 & 10 & 12\\ \hline
\end{tabular}
%To give space between things, use the command \vspace{this has the length}
\vspace{1cm}
In order to get more control over the table entries i.e make a proper table, we
will use the commands $\backslash$begin\{table\} and $\backslash$end\{table\} at
the beginning and end of the prior commands.
The compiler will choose the best location for the table unless we use a modifier
"[H]" after the begin table command as follows, $\backslash$begin\{table\}[H] but
this needs the "float" package in order to work.
This will enable us to use certain modifier commands in order to modify the tables.
To get more vertical spacing in the rows we, we use the command $\backslash$def$\
backslash$arraystrech\{X\} , the "X" is replaced by a multiplier which will change
the height of the rows accordingly.\\
To center the tables, we use the command $\backslash$centering . \\ [10pt]
we can give captions in the table command before or after the table by using the
command $
\backslash$caption\{write your caption here\} .\\ [10pt]
\begin{table}[H]
\caption{THERE IS SOMETHING WRONG I THINK I DON'T HAVE AN OPTIONAL PACKAGE}
\centering
\def\arraystrech{1.3}
\begin{tabular}{|c|c|c|c|c|}
\hline
$x$&1&2&3&4\\
\hline
$f(x)$ & $\frac{6}{x}$ & 8 & $\frac{10}{x^2}$ & 12\\ \hline
\end{tabular}
\end{table}
\vspace{0.5cm}
Now with a paragraph\\
\centering
\begin{tabular}{|c|p{3cm}|c|c|c|}
\hline
$x$ & this is a paragraph & 2 & 3 & 4\\ \hline
$f(x)$ & this is my first \LaTeX presentation & 8 & $\frac{10}{x^2}$ & 12\\ \hline
\end{tabular} \\
\raggedright
\subparagraph{Arrays}:
To make arrays, we use the $\backslash$begin\{align\} and $\backslash$end\{align\}
commands at the beginning and end of the arrays respectively. In an array all
equations are numbered and the numbering is stored in the memory, it continues from
where it left off in the next array.In order to skip the numbering, we put an
asterisk at the end of the commands in the brackets as follows, $\backslash$begin\
{align*\} and $\backslash$end\{align*\} . \\
\begin{align}
5x^2=23\\
5x^2+y=231
\end{align} \\[10pt]
\begin{align*}
5x^2&=23\\
5x^2+y&=231\\
\end{align*}
The equal to signs are aligned by preceding them with an ampersand as above.\\
\subparagraph{Lists}:
In order to make proper lists, we use the commands $\backslash$begin\
{enumerate\}and $\backslash$end\{enumerate\} for making enumerated lists i.e
nubered lists and we use the commands $\backslash$begin\{itemize\}and $\
backslash$end\{itemize\} for making bulleted lists.
\begin{enumerate}
\item study
\item study
\item study
\item work on skills
\item work on development
\item give exams
\end{enumerate}
In order to add items to the lists, we use the command $\backslash$item and write
the item name after a space.
\begin{itemize}
\item 2*Thermo assignments and a quiz.
\item MOM assignment and quiz.
\item dynamics quiz and presentation.
\item differentials quiz and assignment.
\item TRW\&CS presentation and assignment.
\end{itemize}
We can also have nested lists by using the commands withing each other as follows,
\begin{enumerate}
\item study
\item study
\item study
\begin{enumerate}
\item more studying
\item even more studying
\item return of the studying
\item DON'T FORGET THE IMPLEMENTATION
%the tab i.e indentation is just for aesthetic reasons
\begin{enumerate}
\item This is the most important step
\end{enumerate}
\end{enumerate}
\item work on skills
\item work on development
\item give exams
\end{enumerate}
We can also change the enumeration i.e listing to letters etc by using the
preferred listing method in the modifier i.e square brackets of the command e.g, $\
backslash$begin\{enumerate\}[.A] and $\backslash$end\{enumerate\} for using capital
letters followed by a period for listing.\\
To start from numbers other than 1 or letters other than a we use the following
command immediately after the list initiator command without any space etc, the
command is $\backslash$setcounter\{enumi\}\{x\}. Here, the x is the number etc to
which the start counter is set which is set to zero by default, thus the list
starts from 1 by default.For this we have to use the package "enumerate". We can
also use custom enumerators for each item by typing them in the modifier i.e square
brackets immediately after the item command for each item i.e "$\
backslash$item[X]", here X represents the required enumerator.\\
\paragraph{Document Formatting}:
To have italicized text, we use the command "$\backslash$text"suffix"\{write the
text here\}", the text within the curly brackets will be italicized.\\
we use different suffixes in the above command for different text types.\\
it for \textit{italicized}\\
bf for \textbf{bold face}\\
sc for \textsc{small caps}\\
tt for \texttt{typewriter}\\
To insert a hyperlink, we use the "hyperref" package and then for writing urls
directly, we use the command "$\backslash$url\{type the url here\}" and for
attaching urls to certain words, we use the command "$\backslash$href\{type the url
here\}\{type the words to which the url is to be attached here\} e.g, \\
\url{https://www.youtube.com/watch?v=ydOTMQC7np0}\\
\href{https://www.youtube.com/watch?v=ydOTMQC7np0}{This Latex Course}\\
the first one is the url and the second one is the hyper reference to this
course.\\
To change the alignment of a sentence etc, we use the begin and end commands with
the arguments flushleft, flush right and center for the corresponding alignment and
if we want the alignment to change permanently from the point of the command
insertion, we use the $\backslash$centering, $\backslash$raggedright and $\
backslash$raggedleft commands.\\
\begin{center}
begin and end command with the center argument
\end{center}
\begin{flushright}
begin and end command with the flushright argument
\end{flushright}
\begin{flushleft}
begin and end command with the flushleft argument
\end{flushleft}
We are going to make some sections and subsections using the commands $\
backslash$section\{section name\} and $\backslash$subsection\{subsection name\}. As
always in order to hide the numbering , we add an asterisk to the end of the
command name e.g $\backslash$section*\{section name\} , we have done this with the
final subsection.
\section{i think this is the second section}
\subsection{sub sec 1}
this is subsec 1
\subsection{sub sec 2}
this is subsec 2
\subsection{the subsection continues}
After this is the graphics section
\paragraph{A note on packages}:
some packages and their functions are given below.\\
"fullpage": For having a 1 inch page margin on all sides.
"geometry": For having a customizable page. To use this package, follow the
following example, \\
$\backslash$usepackage[top=1in, bottom=1in, left=1in, right=1in, paperwidth=7in,
paperheight=7in]\{geometry\} \\
This will give us a margin of 1 inch on all sides and a paper of the specified
dimensions. If we don't want customized margins and instead we want to have the
same sized margin on all sides, we type "margin=1cm" etc in the modifier
brackets \\
\paragraph{Macros}:
just as we define macros in "C" by using \#define, to define macros in latex, we
use the "$\backslash$def" command as follows,\\
$\backslash$def$\backslash$"macro name"\{macro command or macro\} \\
The macro will be defined in the preamble section.\\
\MACRO \\
To make new commands in your latex document(these are like macros but instead of
macros they are recognized as commands), use $\backslash$newcommand\{command
name\}\{command\} e.g, \\[10pt]
\begin{large} $\backslash$newcommand\{set\}[1]\{$\backslash$setlength$\
backslash$itemsep\{\#1em\}\} \end{large} \\[10pt]
In the above command which increases the vertical space between items in the list,
the square brackets are for the optional arguments i.e modifiers..\\
\pagebreak
\section{Graphics}
To add graphics, the files must be located in the same folder as the latex document
in order for the compiler to find the file, otherwise it will just return an
error.\\
TO INSERT IMAGES WE NEED THE PACKAGE "graphicx". \\
We use the command \begin{large} $\backslash$includegraphics[scale=X]\{name of the
image file\} \end{large}, e.g\\
\begin{center} \begin{huge} NEVER GIVE UP ON YOUR DREAMS\\[10pt] BE RESILIENT LIKE
ME\\[10pt] AND\\[10pt] YOU WILL SUCCEED \end{huge} \end{center}
\begin{center}
\includegraphics[scale=1.2]{singing}
\end{center}
\vspace{0.5cm}
A scale of 1 means that the image will be inserted in its original size.
We can also specify the with and height manually in the optional arguments bracket
i.e square brackets. To specify the image size in percents, we write "[width=0.5$\
backslash$textwidth]" \\
To insert figures, we use $\backslash$begin\{figure\} and $\backslash$end\{figure\}
.
by enclosing the figure in this command set, we can define the location of the
figure by using the optional arguments h, b, etc for best height fit, bottom of the
page etc. We can also use captions when this command is used and the figure will be
numbered, if we don't want it to be numbered we will use an asterisk as we did with
previous commands.\\
\pagebreak
\section{Tips and Tricks}
We can use the side menu in Texmaker to insert symbols and commands, which makes it
really easy to use. from the side menu, we can insert
\begin{itemize}
\item Symbols
\item Special symbols
\item Commands
\item Special commands
\end{itemize}
\vspace{1.5cm}
\begin{center}
\begin{Huge}
\textbf{THE END}
\end{Huge}
\end{center}
\end{document}