Math & Scienceleftrightarrows in math equations

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
abu aasiyah
Posts: 26
Joined: Wed Sep 30, 2009 7:04 pm

leftrightarrows in math equations

Post by abu aasiyah »

Hello,

I am writing all types of equations in my reports. To be mathematically correct i am adding a leftrightarrow at the end of each equation-line. But when I compile the file, the leftrightarrows are placed too far to the right whereas the equations (which are placed vertically one beneath the other) are placed to the left of the paper, so that the distance between the equations and leftrightarrows is far to big. How do I decrease this distance ?

Thanks.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Re: leftrightarrows in math equations

Post by Stefan Kottwitz »

Hi,

that depends on the code you are using. You described the problem but you didn't mention which math environments you're using: equation, align, alignat, flalignat, ...
Just show us example code of such problematic formulas, then we could suggest a correction.

Stefan
LaTeX.org admin
abu aasiyah
Posts: 26
Joined: Wed Sep 30, 2009 7:04 pm

leftrightarrows in math equations

Post by abu aasiyah »

Hello,

Here is the code I am using:

Code: Select all

\documentclass[12pt,a4paper,danish]{report} 
\usepackage[latin1]{inputenc} 
\usepackage[danish]{babel} % danske overskrifter
\usepackage[T1]{fontenc} 
\usepackage{lmodern} 
\usepackage{graphicx} 
\usepackage{mathtools}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{ulem}
\usepackage{latexsym}

\begin{document}

\begin{align*}
\sum_{n=0}^{\infty} (e^{x})^{n} &= (e^{x})^{0} + \sum_{n=1}^{\infty} (e^{x})^{n} \\ 
\sum_{n=1}^{\infty} (e^{x})^{n} &=  \sum_{n=0}^{\infty} (e^{x})^{n} - 1 \\ 
\sum_{n=1}^{\infty} (e^{x})^{n} &= \frac{1}{1-e^{x}} - 1
\end{align*}

\end{document}
One more question: Which package should I use if I want to insert a small black scare at the end of an example ( you know those small black squares which are flushed right to indicate that the example is finished).

Thanks in advande.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

leftrightarrows in math equations

Post by Stefan Kottwitz »

abu aasiyah wrote:i am adding a leftrightarrow at the end of each equation-line. But when I compile the file, the leftrightarrows are placed too far to the right
your code doesn't contain the arrows, so how you've got that behavior? Writing just

Code: Select all

\begin{align*}
\sum_{n=0}^{\infty} (e^{x})^{n} &= (e^{x})^{0} + \sum_{n=1}^{\infty} (e^{x})^{n} \quad\Leftrightarrow\\
\sum_{n=1}^{\infty} (e^{x})^{n} &= \sum_{n=0}^{\infty} (e^{x})^{n} - 1  \quad\Leftrightarrow\\
\sum_{n=1}^{\infty} (e^{x})^{n} &= \frac{1}{1-e^{x}} - 1
\end{align*}
puts the arrow to the right , and not too far.

Or do you want to align the arrows as well? In that case try alignat*:

Code: Select all

\begin{alignat*}{2}
\sum_{n=0}^{\infty} (e^{x})^{n} &= (e^{x})^{0} + \sum_{n=1}^{\infty} (e^{x})^{n} &\quad&\Leftrightarrow\\
\sum_{n=1}^{\infty} (e^{x})^{n} &= \sum_{n=0}^{\infty} (e^{x})^{n} - 1  &&\Leftrightarrow\\
\sum_{n=1}^{\infty} (e^{x})^{n} &= \frac{1}{1-e^{x}} - 1
\end{alignat*}
Stefan
LaTeX.org admin
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

leftrightarrows in math equations

Post by localghost »

abu aasiyah wrote:[...] One more question: Which package should I use if I want to insert a small black scare at the end of an example ( you know those small black squares which are flushed right to indicate that the example is finished).

Thanks in advande.
The amssymb package provides a black square. If you want to format your examples with such a symbol flushed to the right you could try the ntheorem package. Otherwise it is possible to define a new command for signing a paragraph in such a way.


Best regards
Thorsten
Post Reply