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.

This code

\begin{equation}
  \label{eq:test}
  | \mathbf{v} |
\end{equation}

gives me the error:

ERROR: LaTeX Error: \mathbf allowed only in math mode.

--- TeX said ---

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.430   | \mathbf
                 {v} |

My question is simply why? Is not equation math mode??

share|improve this question
3  
Please provide a Complete working example that shows the problem. Most likely you have loaded a package that redefines | to do something, but we can't help just given that fragment. –  David Carlisle Apr 23 '12 at 15:55
2  
Welcome to TeX.SE! Please post a complete MWE (minimum working example) that produces the error you're encountering. (The above code, preceded by \documentclass{article}\begin{document} and succeeded by \end{document}, does not generate an error.) It may be that the error is caused by a missing math delimiter somewhere prior to the equation you're showing. –  Mico Apr 23 '12 at 15:55
    
It works for me. Did you try your code in a MWE file without additional packages or definitions? –  Christian Apr 23 '12 at 15:56
1  
Hi abbec, Welcome to TeX.SE! I edited your question to indent the log message too. Your snippet works fine for me- could you post a few more details about your distribution? Welcome to the group :) –  cmhughes Apr 23 '12 at 15:56
    
I actually found the problem... It was the package program that redefined the | to something as you said @David Carlisle. Thanks guys! –  abbec Apr 23 '12 at 16:00

1 Answer 1

You already know that many packages redefine |. Thus I usually recommend using amsmath and its commands \lvert and \rvert for left and right pipe delimiters. Besides protection against redefinition of |, this also makes better spacing when | is indeed a delimiter.

share|improve this answer

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.