Math & ScienceError When writing this equation

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
jack666sparrow
Posts: 6
Joined: Sun Jul 06, 2014 3:34 pm

Error When writing this equation

Post by jack666sparrow »

Hi

My code

Code: Select all

\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[a4paper,body={},top=1.5cm, left=2.5cm,right=1cm,bottom=2.5cm,nohead]{geometry}


%===============  Begin Document ==================

\begin{document}
\begin{enumerate}
   \item Question \#1\\  
   {\bf Answer.}
2-2.7+2.7^2-...+2(-7)^n=$\frac{1-(-7)^n+1}{4}
   
\end{enumerate}

\end{document}

It says the error in this line

Code: Select all

2-2.7+2.7^2-...+2(-7)^n=$\frac{1-(-7)^n+1}{4}
How can I fix it ?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Error When writing this equation

Post by Johannes_B »

You only have one single Dollar-sign, but you need two to enclose math (it's the same with braces, parenthesis and brackets).

Code: Select all

\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[a4paper,body={},top=1.5cm, left=2.5cm,right=1cm,bottom=2.5cm,nohead]{geometry}

\begin{document}
\begin{enumerate}
	\item Question \#1\\  
		{\bf Answer.}
$2-2.7+2.7^2-...+2(-7)^n=\frac{1-(-7)^n+1}{4}$
\end{enumerate}
\end{document}
Are you aware that there are multiple classes and packages providing Q/A-things? I even showed a simple hand made approach here once.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
jack666sparrow
Posts: 6
Joined: Sun Jul 06, 2014 3:34 pm

Re: Error When writing this equation

Post by jack666sparrow »

Thanks a lot bro
Post Reply