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.

Right now, I am using \lvert,\rvert, and \mid to display

enter image description here

\documentclass[border=3pt]{standalone}
\usepackage{amsmath}
\begin{document}
$\lvert x \rvert \mid y$
\end{document}

Is there a better way to do this?

share|improve this question
3  
Interesting issue. You could slight change the height of the divides with something like \newcommand{\Divides}{\mathbin{\big|}}, and then use $ \lvert x \rvert \Divides y $. –  Peter Grill Feb 11 '13 at 1:10
    
I think this notation is possibly very confusing. Why not define an new math operator: \DeclareMathOperator{\abs}{abs} so you would then write $\abs(x) \mid y$ –  A.Ellett Feb 11 '13 at 1:49
    
@A.Ellett You make a valid point. However, it would mean changing throughout the document just to satisfy one occurrence. –  beethree Feb 11 '13 at 2:21
2  
If the numbers are integer, x\mid y says exactly the same thing. –  egreg Feb 11 '13 at 9:31
    
@egreg yay math! Although I can see how, as a learning student, it could confuse someone (if it were a textbook we were talking about, for example). –  Sean Allred Feb 11 '13 at 9:36

4 Answers 4

up vote 7 down vote accepted

Option 1

By making the \mid bigger (based on the given comments),

enter image description here

\documentclass[border=3pt]{standalone}
\usepackage{amsmath}
\newcommand\abs[1]{\ensuremath{\lvert#1\rvert}}
\newcommand\divides{\ensuremath{\bigm|}}
\begin{document}
$\abs{x} \divides y$
\end{document}

Option 2

By making the font smaller locally, {\scriptstyle\lvert#1\rvert},

enter image description here

\documentclass[border=3pt]{standalone}
\usepackage{amsmath}
\newcommand\abs[1]{\ensuremath{{\scriptstyle\lvert#1\rvert}}}
\begin{document}
$\abs{x} \mid y$
\end{document}

Option 3

Rephrasing the mathematical statement,

enter image description here

\documentclass[border=3pt]{standalone}
\usepackage{amsmath}
\newcommand\abs[1]{\ensuremath{\lvert#1\rvert}}
\begin{document}
$ y \mod \abs{x} = 0$
\end{document}
share|improve this answer
1  
The fact that x is made smaller than y makes this look off, IMO –  Matthew Leingang Feb 11 '13 at 1:41
1  
Instead of renaming \mid (first case) I would create a new command \newcommand{\divides}{\bigm|}, where \bigm automatically provides the spacing you are looking for. –  Manuel Feb 11 '13 at 2:09
    
I will make the \mid bigger. –  beethree Feb 11 '13 at 2:21
    
If only you removed those useless \ensuremath commands… –  egreg Feb 11 '13 at 9:30
    
@egreg: It can be regarded as a best practice. :-) –  Who is crazy first Feb 11 '13 at 9:32

I think this notation is possibly very confusing. Why not define an new math operator:

\DeclareMathOperator{\abs}{abs}

so you would then write

$\abs(x) \mid y$

enter image description here

share|improve this answer

Yes, it looks too similar to \mid. The best solution I've been able to come up is to reorganize and avoid such constructions (whatever you do, it will look confusing), probably by spelling it out: ... \(\abs{x}\) divides \(y\)...

share|improve this answer
    
This is immensly better than all the alternatives. –  Mariano Suárez-Alvarez Feb 11 '13 at 3:58
    
Come to think about it, what makes \abs{x} dividing y any different from x dividing y? (OK, yes, I've had such constructions, but there the abs{} meant size/order of a group/...) –  vonbrand Feb 11 '13 at 4:05

I have recently been lecturing on the Sylow theorems and related topics, which means that I am continually needing to say that the size of some group divides or is divisible by something. The solution I have adopted is to denote the size of a finite set by \#(G), not |G|.

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.