0

I am trying to code one of the most common formula in genetics in LaTeX. After compiling the script I get the correct formula on the PDF file, but it seems like LaTeX doesn't like it and returns this error: "Double Superscript"

I am inserting the formula as below:

lod = Z = \log_{10}\frac{(1-\theta)^N^R \times \theta^R}{(0.5)^(^N^R^+^R^)}

Any help is much appreciated!

naphaneal
  • 2,614
RJF
  • 135
  • you have a ^(^ and a ^R^ in that line. should it be like this? – naphaneal Mar 15 '17 at 22:39
  • Your mistake is trying to use ^ for each element of your various exponents. You need to encase the entire exponent in braces like this: ^{NR} – Au101 Mar 15 '17 at 22:39

2 Answers2

3

Your mistake is trying to use ^ for each element of your various exponents. You need to encase the entire exponent in braces like this: ^{NR}

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\[
  \mathrm{LOD} = Z = \log_{10} \frac{(1 - \theta)^{NR} \times
    \theta^{R}}{(0.5)^{(NR + R)}}
\]

\end{document}

enter image description here

As an additional hint it's easy to see how LaTeX formulas are coded in Wikipedia by either hitting the appropriate [edit] button and looking at the source, or right-clicking on the image (in Firefox at least) and selecting 'View Image Info' - I'm sure other browsers have similar features. The associated text will have the LaTeX code.

It would also be well-worth your time having a quick look at this Q&A:

What are good learning resources for a LaTeX beginner?

I highly recommend putting in a little bit of time at the beginning to nail the basics, before diving in feet first and having a bad experience or picking up bad habits. Once you've got the basics (and really only the basics), the best (and perhaps only) way to learn is to learn by doing. But it's worth getting a few things under your belt - or at least having the right resources to refer to if you do dive straight in and get stuck somewhere!

Au101
  • 10,278
1

Thank you guys for your helpful comment. I am posting here the correct f format for anyone who may need it:

\begin{equation}
lod = Z = \log_{10}\frac{(1-\theta)^{NR} \times \theta^{R}}{(0.5)^{(NR+R)}}
\end{equation}
RJF
  • 135