In the question Absolute Value Symbols I read about the best ways to write absolute values. I found the accepted answer pretty good and it works in almost all cases. Sadly, only in almost. For example on the letter "k" the pipes are drawn far under the lower end of the letter "k" in the PDF output. Why is this and what to do about it?
The bad thing is: I can not just skip the macro on all "k" vectors and use the regular pipes |\vec{k}| or the starred version of the abs* operator because as you will see from the last two lines in the minimal example, the regular pipes on the "k" are drawn to short at the top (not around the vector arrow). The "x" is drawn like expected by a reader, however.
The following is a minimal example that shows the problem (letter "x" works fine, letter "k" has to big/small pipes). In my real world document I also have T1 fontenc, and font packages loaded (libertine, fouriernc and inconsolata), so this behavior seems to be independent of all the font/math-related packages.
\documentclass{article}
\usepackage{mathtools}
%define abs
\DeclarePairedDelimiter\abs{\lvert}{\rvert}%
%switch starred and non-starred (auto-size)
\makeatletter
\let\oldabs\abs
\def\abs{\@ifstar{\oldabs}{\oldabs*}}
\makeatother
\begin{document}
\[ \abs{\vec{x}} \]
\[ \abs{\vec{k}} \]
\[ |\vec{x}| \]
\[ |\vec{k}| \]
\end{document}
The output:

I know about the nath package, but it always gives me a lot of errors and seems to be unmaintained. Also, to me it always feels a bit "strange" if things are auto-done to my document that can't be "looked inside" (without investing tons of non-available time to work through the nath package code). So, I'd rather like to not use it.





\leftand\rightautomatically, to begin with. It's wrong. The absolute value bar shouldn't change depending on the single symbol it encloses: what about|\vec{x}|+|\vec{k}|? I'd never want different bars. – egreg Jan 04 '13 at 16:18\left| \vec{x} \right|and|\vec{x}|give the same result, while the same for k is not true? I mean, x and k are just some letters and no special symbols. – Foo Bar Jan 04 '13 at 17:13\leftand\righthave a "tolerance" on the amount of vertical space not covered. – egreg Jan 04 '13 at 17:17\leftand\right, on small stuff I don't use it. But how do I tell for a single letter if I should use them or not? – Foo Bar Jan 04 '13 at 17:22