Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have an equation consisting of two parts and would like to use subequation for that. Here's the code:

\usepackage{amsmath}

\begin{subequations}
\begin{equation}
\operatorname{min}_{a,b,c} 
\frac{1}{2}\mathbf{w}^{T}\mathbf{w} + C \sum_{i=1}^{l}\xi_{i} 

\end{equation}
\begin{equation}
y_{i}\left(\mathbf{w}^{T}\phi(x_{i})+b\right)
\end{equation}

\end{subequations}

I'm getting an error:

final.tex:118:Missing $ inserted.
final.tex:118:Display math should end with $$.

Can anybody help with that?

share|improve this question

1 Answer 1

up vote 10 down vote accepted

Paragraph breaks (which are produced by empty lines, too) don't quite work in math mode. Once you remove the empty line, the code compiles fine:

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{subequations}
\begin{equation}
  \operatorname{min}_{a,b,c} 
  \frac{1}{2}\mathbf{w}^{T}\mathbf{w} + C \sum_{i=1}^{l}\xi_{i} 
\end{equation}    
\begin{equation}
  y_{i}\left(\mathbf{w}^{T}\phi(x_{i})+b\right)
\end{equation}
\end{subequations}

\end{document}
share|improve this answer
    
Thank you for a swift answer. I have spent two hours on looking for this error and found it by myself minute I posted my question here. –  matcheek Mar 22 '11 at 8:09
1  
BTW: use \min instead of \operatorname{min}, and it might be an idea to use the bm package and its \bm command for bold letters, then one gets bold italic not bold upright –  daleif Mar 22 '11 at 10:05
2  
another suggestion: instead of separate equations within subequations, it's generally better to use one of the amsmath multi-line display structures; in this instance i'd suggest gather. separate equations may not be spaced well vertically, and can break across pages. –  barbara beeton Mar 22 '11 at 12:39
    
There is a good example of how to do this in the `Short Math Guide to LaTeX'. –  erik Nov 17 '13 at 20:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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