TransWikia.com

Error compiling equation

TeX - LaTeX Asked by Rens on May 30, 2021

My document (subfile in documentclass book) compiles perfectly, untill I add the following equation:

begin{equation} 
label{beliefupdate}
begin{split}
b_{t+1}(s') & = Pr(s'|o',a,b) 
            & = frac{Pr(o'|s',a,b)Pr(s'|a,b)}{Pr(o'|a,b} 
            & = frac{Pr(o'|s',a) sum_{sinS}Pr(s'|a,b,s)Pr(s|a,b)}{Pr(o'|a,b)} 
            & = frac{O(o',a,s') sum_{sinS}T(s,a,s')b_t(s)}{Pr(o'|a,b)}
end{split}
end{equation}

I have loaded the packages:

usepackage{amsmath}  
usepackage{amsfonts}
usepackage{amssymb} 
usepackage{physics}

renewcommand{S}{mathcal{S}}

usepackage{graphicx}
usepackage{wrapfig}

Now, Latex starts giving me warnings in two locations of the document. The first few are in this piece of code, way before the location where I enter the equation

begin{wrapfigure}{r}
    centering
    includegraphics[scale = 0.25]{images/MDP.jpg}
end{wrapfigure}

I get the error: ‘missing number, treated as zero’ and also ‘Illegal unit of measure (pt inserted)’ both about the line centering

The second batch of errors is about the line end{split} in the equation.

errors:

FIRST ERROR:

Argument of opbraces has an extra }.

par
l.151 end{split}


SECOND ERROR:

Runaway argument?

(o’|a,b
! Paragraph ended before opbraces was complete.

par
l.151 end{split}


THIRD ERROR:
Missing $ inserted.


I honestly don’t see where I go wrong

One Answer

Well, you're missing ) at the end of the second line in split:

        & = frac{Pr(o'|s',a,b)Pr(s'|a,b)}{Pr(o'|a,b} 

should be

        & = frac{Pr(o'|s',a,b)Pr(s'|a,b)}{Pr(o'|a,b)} 

The missing parenthesis goes unnoticed when physics is not loaded, but it becomes essential when it is, because the package (re)defines Pr to look for an argument enclosed in (...) (which is a bad thing to do, in my opinion).

Check your input more closely. And don't do renewcommandS{mathcal{S}}.

Personal opinion. I cannot recommend using the physics package, because it has a very convoluted syntax and makes disputable typesetting decisions.

Answered by egreg on May 30, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP