Math & ScienceError Missing $ inserted for my formula

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
jubairarifctg
Posts: 13
Joined: Wed Sep 09, 2009 6:55 am

Error Missing $ inserted for my formula

Post by jubairarifctg »

Hi there

I know it is a common problem and I found this question been answered before http://www.latex-community.org/forum/vi ... =46&t=4854 But that doesn't help me much.

What I want to do is to write the following formula for lognormal distribution

\[
p(t|a, b) = \frac{1}{{b^a}\Gamma
(a)}{t^{a-1}}{\exp^{\frac{-t}{b}}}
\]

But it kept giving me that annoying error of Missing $. The same error I get for simple $\rho(t|d)$.

Most importantly, I am writing those equation for my PhD thesis and the error only occurs with my PhD thesis compilation. The same equation compiles and I have used them in my published paper.

Looking forward to your help.

cheers
Arif.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
josephwright
Site Moderator
Posts: 814
Joined: Tue Jul 01, 2008 2:19 pm

Error Missing $ inserted for my formula

Post by josephwright »

Pleas post a full example. The following is fine

Code: Select all

\documentclass{article}
\begin{document}
\[
  p(t|a, b) = \frac{1}{{b^a}\Gamma
  (a)}{t^{a-1}}{\exp^{\frac{-t}{b}}}
  \]
\end{document}
Joseph Wright
jubairarifctg
Posts: 13
Joined: Wed Sep 09, 2009 6:55 am

Re: Error Missing $ inserted for my formula

Post by jubairarifctg »

Hi there

I think it is same as mine. Yes I tried inside DOCUMENT. By the way, with article as documentclass it works for me. But my document class looks like

\documentclass[11pt,a4paper,titlepage,twoside,openright]{book}

Any help?
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Error Missing $ inserted for my formula

Post by frabjous »

This code:

Code: Select all

\documentclass[11pt,a4paper,titlepage,twoside,openright]{book}
\begin{document}
\[
  p(t|a, b) = \frac{1}{{b^a}\Gamma
  (a)}{t^{a-1}}{\exp^{\frac{-t}{b}}}
  \]
\end{document}
does not produce any errors either. It would help if you tried to construct a minimal example in which the error is actually produced. Otherwise, it's very hard to tell what's going on.
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

Error Missing $ inserted for my formula

Post by localghost »

jubairarifctg wrote:[…] Most importantly, I am writing those equation for my PhD thesis and the error only occurs with my PhD thesis compilation. […]
You have to reduce the code of your dissertation to a complete and compilable minimal working example (MWE). Depending on how many code you've already written, this can imply very much trouble. But it is the only possible way to get closer to a solution. Everything else would only dwindle into a quiz.


Best regards and welcome to the board
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
jubairarifctg
Posts: 13
Joined: Wed Sep 09, 2009 6:55 am

Re: Error Missing $ inserted for my formula

Post by jubairarifctg »

Hi Guys

Thank you

I don't think I have written too much of the code as I am in my first chapter. Rather I think my problem is something like these links:
http://randomtech.blogspot.com/2004/11/ ... erted.html
http://www.karakas-online.de/mySGML/mis ... erted.html

Now, how do I stop latex to take intelligent decision from adding $ sign to my stuff. As I mentioned before, it works for my article but it does not work for my thesis. Thus, I believe it is something to do with my style file that I am using. How can I share my style file with you? I don't see any option to attach any files here. Can I use any email?
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Error Missing $ inserted for my formula

Post by gmedina »

Hi,
jubairarifctg wrote:...I don't see any option to attach any files here. Can I use any email?
Board Rule 2.1: ...There will be no support via PM, IM or e-Mail!

When you reply to a post (or open a new thread) you will see, right after the message window and to the left, a link labeled "Upload attachment". Following that link you can upload files.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
jubairarifctg
Posts: 13
Joined: Wed Sep 09, 2009 6:55 am

Re: Error Missing $ inserted for my formula

Post by jubairarifctg »

Thanks and sorry, I wasn't aware of that rule.

I am attaching my style file.

Plus I got another clue:

\[
p(t|a, b) = \frac{1}{{b^a}\Gamma
(a)}{t^{a-1}}{\exp^{\frac{-t}{b}}}
\]

I get error on things like \frac{}, \Gamma{} etc.

But there is no error for things like:
\begin{eqnarray}
m& = &ab\\
v& = &ab^2
\end{eqnarray}

As the later one does not have any functions such as \Gamma{}.

Looking forward to your help.
Attachments
uomthesis.sty
(12.82 KiB) Downloaded 388 times
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Error Missing $ inserted for my formula

Post by frabjous »

After downloading your style file, a file such as:

Code: Select all

\documentclass[11pt,a4paper,titlepage,twoside,openright]{book}
\usepackage{uomthesis}
\begin{document}
\[
  p(t|a, b) = \frac{1}{{b^a}\Gamma
  (a)}{t^{a-1}}{\exp^{\frac{-t}{b}}}
  \]
\end{document}
Still does not produce any errors for me.

Try to follow Thorsten's advice, refer to the link he gave about producing a minimal working example, and attach it here, and maybe someone can help -- you just aren't giving enough information to diagnose the problem. If we can't even reproduce your error, there's nothing for us to go on.
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Error Missing $ inserted for my formula

Post by gmedina »

Hi,

I did a simple test with your sty file and the code that you proposed as culprit, but it compiled OK in my system.

Let's try to detect the problem. Please do the following:

1) Copy the following test code (the one that I used) and save it as, for example, test.tex:
2) Save a copy of the file uomthesis.sty in the same folder that contains test.tex.
3) Compile the following document:

Code: Select all

\listfiles
\documentclass{book}
\usepackage{uomthesis}

\begin{document}

\[
  p(t|a, b) = \frac{1}{{b^a}\Gamma(a)}{t^{a-1}}{\exp^{\frac{-t}{b}}}
\]

\end{document}
You will get some warnings; we'll handle those later. If you get any errors, please search the file test.log and attach it to your next post. If no error messages occur, then the problem is somewhere else and we'll ask you for more information.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Post Reply