Posted in LaTeX

Writing Article Using LaTeX

Hi readers. If you are beginner LaTeX users, you can try using LaTeX by these following examples. Here I give you some examples of simple LaTeX code to write an article. Open your LaTeX editor (I use TexStudio), then type the given LaTeX code and “run” it. If there is no error, so you have successfully built your LaTeX code. Good luck!

TexStudio
TexStudio

1. Creating a very simple document with a sentence

Code:

\documentclass[a4paper,12pt]{article}
\begin{document}
This is a very simple document.
\end{document}

Result:

12. Creating title of the article

Code:

\documentclass[a4paper,12pt]{article}
\author{Adi~Marindra \thanks{Blog owner}}
\date{\today}
\title{This is the Title}

\begin{document}
\maketitle
Here is my text.
\end{document}

Result:

13.  Sectioning

Code:

\documentclass[final,a4paper,12pt]{article}
\author{Terry~Sturtevant \thanks{Physics Lab Supervisor}}
\date{\today}
\title{PC132 Lab Project}

\begin{document}
\maketitle
\section {Very Important Stuff}
Here is my text, including the \LaTeX\ symbol.
\subsection {Important Stuff}
More text here.
\subsubsection{Less Important Stuff}
\paragraph {Main paragraph}
\textbf{Note} that the text starts in line as paragraph heading
\subparagraph{Sub paragraph, just for testing}
\end{document}

Result:

14. Formatting

Code:

\documentclass{article}
\begin{document}
This is an example of “smart” quotes. This quote can be `single’ or “double”.
They can be also \emph{“emphasized”} etc., like any other text.
\end {document}

Result:

15. Mathematical expressions

Code:

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath}
\begin{document}
This is a \emph{very} simple document.
This is something written in $math \ mode$. It’s used for in-line equations
such as $E=m c^2$. The displayed formula mode is for things like
\[I =0 e^{\frac{e V} {k T}}\]
$$I= I_0 e^{\frac{e V}{k T}} $$
and so on.
If we want numbers for our equations, we can use
\begin{align}
F = ma \\
Pct = nRT^2
\end{align}

\begin{equation}
F=m a
\end{equation}
\begin{equation}
Ft=\sum ma
\end{equation}
\end{document}

Result:

1

6. Tables

Code:

\documentclass{article}
\usepackage{multirow}
\usepackage{graphicx}
\begin{document}
\section{Table}
\subsection{Basic Example}
\begin{tabular}{| l | c | r | c | c |}
\hline
1 & 2 & 3 & a & b\\ \hline
4 & 5 & 6 & & \\ \hline
7 & 8 & 9 & & \\ \hline
\end{tabular}

\subsection{Fixed Column Width}
List of AUN/SEED-Net students 2011\\
\begin{tabular}{|c|p{5cm}|l|l|}
\hline
No & Name & Nationality & Degree\\ \hline
1. & Adi Marindra & Indonesia & Master\\ \hline
2. & Sisongkham Phimmasean & Laos & Master\\ \hline
\end{tabular}

\subsection{Handling Many Columns}
\begin{tabular}{l*{6}{c} r}
Team                            & P & W & D & L & F & A & Pts\\ \hline
Inter milan                & 3    & 3    & 0 & 0 & 6 & 0 & 9\\
AC milan                    & 3 & 2 & 1 & 0 & 3 & 1 & 7\\
\end{tabular}

\subsection{Separating Decimal and Floating Point}
\begin{tabular}{r@{.}l}
3  & 1755\\
56 & 657\\
12 & 680897\\
\end{tabular}

\subsection{Multicolumn}
\begin{tabular}{|l|l|} \hline
\multicolumn{2}{|c|}{Team sheet} \\
\hline
TA & Taufik Alan\\
PT & Paijo Tukiyem\\
\hline
\end{tabular}

\subsection{Multirow and Multicolumn}
\begin{tabular}{|l|l|l|}
\hline
\multicolumn{3}{|c|}{Team sheet}\\
\hline
Goalkeeper & GK & Paul Robinson \\ \hline
\multirow{4}{*}{Defenders} & LB & Lucus Radebe \\
& DC & Michael Duberry \\
& DC & Dominic Matteo \\
& RB & Didier Domi \\ \hline
\multirow {3}{*}{Midfielders} & MC & David Batty \\
&MC & Eirik Bakke\\
&MC & Joddy Morris\\ \hline
\multirow {2}{*}{Forward} & FW & Adi \\
&FW & Pun\\ \hline
\end{tabular}

\subsection{Spanning in Both Directions Simultaneously}

\begin{tabular}{cc|c|c|c|c|l|}
\cline{3-7}
& & \multicolumn{5}{|c|}{Primes} \\ \cline{3-7}
& & 2 & 3 & 4 & 5 & 7 \\ \cline{1-7}
\multicolumn{1}{|c|}{\multirow{2}{*}{Powers}} &
\multicolumn{1}{|c|}{504} & 3 & 2 & 0 & 1 &4 \\ \cline{2-7}
\multicolumn{1}{|c|}{}                                                &
\multicolumn{1}{|c|}{540} & 3 & 2 & 0 & 1 & 3\\ \cline{1-7}
\multicolumn{1}{|c|}{\multirow{2}{*}{Powers}} &
\multicolumn{1}{|c|}{gcd} & 3 & 2 & 0 & 1 & 5\\ \cline{2-7}
\multicolumn{1}{|c|}{}                                                &
\multicolumn{1}{|c|}{1cm} & 3 & 2 & 0 & 1 & 3 \\ \cline{1-7}
\end{tabular}

\subsection{Scalebox}
\scalebox{0.7}{
\begin{tabular}{| l | c | r | c | c |}
\hline
1 & 2 & 3 & a & b\\ \hline
4 & 5 & 6 & & \\ \hline
7 & 8 & 9 & & \\ \hline
\end{tabular}}
\end{document}

Result:

11

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s