0

I'm needing some help to fix this minor error, can't seem to find where's the missing $ character.

I've tried to add $$ for both \mathbb{P} and \mathbb{Q}. Latex compiled and showed it in plaintext instead.

Appreciate your kind help. Thanks.

\begin{align}
\begin{tabular}{cc}
\text{P} =\begin{cases}
\mathbb{P} & ,\mathbb{P}_{length} > \mathbb{Q}_{length} \\
\mathbb{Q} & ,\mathbb{Q}_{length} > \mathbb{P}_{length}
\end{cases}   \hspace{2em}  &  \hspace{2em}
\text{Q} =\begin{cases}
\mathbb{Q} & ,\mathbb{P}_{length} > \mathbb{Q}_{length} \\
\mathbb{P} & ,\mathbb{Q}_{length} > \mathbb{P}_{length}
\end{cases}
\end{tabular}
\end{align}
2

tabular is normally for text, not math. If you want math, then you could try the array environment. But the point of align is that you don't need the array environment. Could you just leave that out? And since you're not using any lines within array (the only \\ you have is in cases), you could change align to equation (and drop the & that isn't in cases). You should also use \mathrm with the "length"s (and probably nothing for P and Q, although that would depend on what they're doing). That would leave you with:

\documentclass{amsart}
\begin{document}
\begin{equation}
P =\begin{cases}
\mathbb{P} & ,\mathbb{P}_{\mathrm{length}} > \mathbb{Q}_{\mathrm{length}} \\
\mathbb{Q} & ,\mathbb{Q}_{\mathrm{length}} > \mathbb{P}_{\mathrm{length}}
\end{cases}   \hspace{4em}
Q =\begin{cases}
\mathbb{Q} & ,\mathbb{P}_{\mathrm{length}} > \mathbb{Q}_{\mathrm{length}} \\
\mathbb{P} & ,\mathbb{Q}_{\mathrm{length}} > \mathbb{P}_{\mathrm{length}}
\end{cases}
\end{document}

There was some discussion about difference between \mathrm and \text. You could look at something like \emph{A distance like $P_{\mathrm{length}}$ is always positive.} With \text, the subscript would be italic, unlike other occurrences of the variable.

And depending on the relation of \mathbb{P} and \mathbb{P}_{\mathrm{length}}, you might be able to simply say P=\max(\mathbb{P}_{\mathrm{length}},\mathbb{Q}_{\mathrm{length}}) and \min for Q.

  • Hi Teepeemm, thanks for the advice... i removed the tabular and it compiled fine now.. i wanted to use tabular to place the equations side by side.. but i didnt know i could do it using align by itself.. – Clarence Cheong Jan 31 at 3:26
  • Note that \text is not the right command: it should most likely be \mathrm – egreg Jan 31 at 9:59
  • @ClarenceCheong For side by side, you don't really need anything. The point of align, tabular, array, cases, etc., is to have separate lines line up the same way. That's way things line up correctly in the cases environment. But since cases takes care of its thing, you don't need it for the rest of your expression. – Teepeemm Jan 31 at 13:12
  • @Teepeemm \text uses the font that was current when the formula started, \mathrm will use upshape in every case. – egreg Jan 31 at 13:43
  • thanks for the advice @egreg, i've updated the \text to \mathrm but i dont see any difference. @Teepeemm, noted regarding the align and cases ... will try to remove the align and make it work only with cases – Clarence Cheong Feb 1 at 9:31

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.