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.

Currently I'm having to write something like:

enter image description here

I'm writing "q" in the denominator as |\vec{q}| using the "pipe"; is it the proper way to do it?

share|improve this question
    
What about accepting one of the answers? –  Svend Tveskæg Feb 13 at 3:23
add comment

2 Answers

One way to do it is the following.

Code

\documentclass{article}

\usepackage{mathtools}
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}

\begin{document}
\[
\frac{\vec{q} \cdot \vec{r}_j}{\abs{\vec{q}\,} \times \abs{\vec{r}_j}}
\]
\end{document}

Output

enter image description here

share|improve this answer
4  
A \vec without subscripts immediately followed by a bar clashes with it, so probably \abs{\vec{q}\,} is better. –  egreg Mar 13 '13 at 11:27
    
Good point; I'll edit my answer. –  Svend Tveskæg Mar 13 '13 at 11:28
add comment

As far as I'm into LaTeX this is correct. I would put your formular as

$=\frac{\vec{q}\cdot\vec{r}_j}{|\vec{q}|\times|\vec{r}_j|}$

So for getting the absolute value typing the pipe | is fine. But do not use the pipe for some expression like

{a \in A | a \notin B}

instead use \mid there.

share|improve this answer
    
You'll get wrong spacing by using |s instead of \lvert and \rvert. –  Svend Tveskæg Dec 16 '13 at 4:57
add comment

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.