Thursday, January 19, 2012

LaTeX Tutorial: How to write mathematical equations in LaTeX

Those who use LaTeX for their documentation related works, usually are from STEM (Science, Technology, Engineering, Mathematics) background. These people use equations more often than not. Therefore, I will introduce how to write equations in LaTeX today.

In this tutorial we will go over following features:

  • Latex amsmath package 
  • Latex equation environment 
  • Using Simple equations like x = y + z 
  • Using Summation in equations 
  •  Using Integration in equations 
  • Using Cases in equation (if condition based values of a variable) 
  • Using fractions to write multiple-row equations
Watch the following video to learn how to do these things:


The code used in this Video can be found below:

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
\title{Writing Equations with Latex by http://QuickLatex.blogspot.com}
\maketitle
\begin{equation}
%x = y + z
%f(x) = x ^ 2
%f(x) = x_1 + x_2 + x_3 + ......+ x_n
%f(x) = \sum_{i=1}^{n} {x_i}
%f(x) = \int_{i=1}^{n}{x_i}
%X=
%\begin{cases}
%5, \text{if X is divisible by 5}
%\\
%10, \text {if X is divisible by 10}
%\\
%-1, \text {otherwise}
%\end{cases}
X =
\frac{\substack{\sum_{i=1}^{n} {x_i}}}
{\substack{\sum_{i=20}^{50} {x_i}}}
\end{equation}
\end{document}

3 comments:

  1. why exactly do you use \usepackage{amssymb}? is it useful to load it always with \usepackage{amsmath}?
    and do you know, how to create chemical structures? that would be really great!

    ReplyDelete
    Replies
    1. Dear Julia,

      Package amsmath is used for additional mathematical symbols which are not there by default.

      I will try to do some chemical symbols soon.

      Regards,
      Dinesh agarwal

      Delete
  2. How do we use the latex templates and styles? For instance, I have downloaded siamltex.cls and copied it to C:\Program Files\MiKTeX 2.9\tex\latex\ltxmisc and ran texhash. Still I get the error "! LaTeX Error: File `siamltex.cls' not found." Any pointers?

    ReplyDelete

Comments on QuickLatex are strictly moderated. As much as I hate moderation, I must fight spam. Please rest assured that if your comment is relevant I will approve it and answer.