Text Formatting, Equations and Figures using LaTeX

Posted on February 26, 2013 in Tutorials, Writing

LaTeX is easy and straight forward ! a simple document using Latex is shown below:

\documentclass[a4paper,11pt,twocolumn]{article}
\usepackage{amsmath,times}
\usepackage{graphicx}
\usepackage{tabularx}
\begin{document}
\title{The title of your article here....}
\author{I. Bouchrika and A. Another \\ 
       University of ABC \\
      address here of your university \\ 
      Country, post code}
\date{}
\maketitle
\begin{abstract}
This is the text for my abstract .....
\end{abstract}
\section{introduction}
text for the introduction \textit{here} text for \textbf{the }introduction \underline{here} text for the introduction here 

\end{document}

latex5For simple and frequent commands for text formatting:

\textit{text} ITALIC TEXT

\textbf{text} BOLD TEXT

\underline{text} Underlined text

For inserting Equation within a text, we use $ equation here $as shown in the example :

\section{introduction}
the introduction here as shown for $x=f(t)$ text for the introduction here text for the introduction here

latex2

If you want to insert equation on its own, we use the \begin{equation} and \end{equation}:

\section{introduction}
the introduction here as  (\ref{eq:myeqa}) text for the introduction here text for the introduction here
\begin{equation}
x=\sum{f(t))}
\label{eq:myeqa}
\end{equation}

The output of the above is shown below:
latex3

Note that the equation block has the command \label{eq:anythinghere}. This is a label or an address that we can within the text to refer to the equation using the command \ref{eq:anythinghere}

To insert an image or a figure, we need first to import the package graphicx using the command : \usepackage{graphicx}. We use the command \begin{figure} and \end{figure} as shown below:

\section{introduction}
the introduction here as  (\ref{fg:myfig}) text for the in....
\begin{figure}[h]
\centering
\includegraphics[width=3cm]{nameofyourimage.jpg}
\label{fg:myfig}
\caption{Title of your image here}
\end{figure}

The output of the above is :

latex4

The option [h] inside \begin{figure}[h], means place the picture HERE.

Tthe command \centering is to align the image into the middle (center ).

The main command is \includegraphics[options]{pathofyourimage.jpg] Options can be : width, height, angle

The \caption command is for the title of the text.