Math & ScienceNew to Latex Problem with Fraction

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
dynamite
Posts: 2
Joined: Mon Sep 14, 2009 6:39 pm

New to Latex Problem with Fraction

Post by dynamite »

Code: Select all

\documentclass[11pt]{article}
\usepackage{amsmath}
%\usepackage[pdftex]{graphicx}
\usepackage{amssymb}
\usepackage{amsthm} 
\usepackage{syntonly}
%\syntaxonly
\pdfpagewidth 8.5in
\pdfpageheight 11in 
% Begin the page layout design
\setlength\topmargin{0in}
\setlength\headheight{0in}
\setlength\headsep{0in}
\setlength\textheight{7.7in}
\setlength\textwidth{6.5in}
\setlength\oddsidemargin{0in}
\setlength\evensidemargin{0in}
\setlength\parindent{0.25in}

\begin{document}
\begin{center}

\end{center}

\paragraph{(1.5)}
We attempt to prove this by induction. \\
Base Case: $n$=1 \\
$1+\frac{1}{2}=2-\frac{1}{2} \Rightarrow \frac{3}{2}=\frac{3}{2}$ This checks! \\
Inductive Case: Assume true \forall{n}: $1+\frac{1}{2} +\ldots+\frac{1}{2^n}=2-\frac{1}{2^n}$
For some reason on my inductive case, the first fraction puts everything following it under the fraction even though i only want it to be 1/2. Why is this?

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

New to Latex Problem with Fraction

Post by Stefan Kottwitz »

Hi,

you should have noticed errors during compilation, the math mode was not uses correctly. I've corrected one line:

Code: Select all

Inductive Case: Assume true $\forall{n}: 1+\frac{1}{2} +\ldots+\frac{1}{2^n}=2-\frac{1}{2^n}$
Without setting \forall{n} in math mode etc. the problem described above could occur in the output because TeX would change into math mode by itself.

Stefan
LaTeX.org admin
dynamite
Posts: 2
Joined: Mon Sep 14, 2009 6:39 pm

Re: New to Latex Problem with Fraction

Post by dynamite »

Yes it is doing that.

What do you mean by math mode not used correctly and how can i fix that?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

New to Latex Problem with Fraction

Post by localghost »

It seems that you are lacking some basics. A good guide through LaTeX is given with the "Unofficial LaTeX Reference Manual".


Best regards and welcome to the board
Thorsten
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

New to Latex Problem with Fraction

Post by Stefan Kottwitz »

dynamite wrote: What do you mean by math mode not used correctly and how can i fix that?
The math mode embedded in text can be started and ended by $, as you already know. Most symbols require the math mode, like \forall, also greek letters and other symbols, not only mathematical. Enclose complete formulas in math mode, not just variables, for instance, instead of

Code: Select all

Base Case: $n$=1
write

Code: Select all

Base Case: $n=1$
You will notice, that the second code will give a spacing around the equal sign like in the other formulas. The first code will give an improper spacing, because LaTeX cannot handle the complete formula: =1 would be set in text mode.

Btw. I would not use \\ to end a line, I would use an empty line causing a paragraph break instead of \newline.

Stefan
LaTeX.org admin
Post Reply