Some old text books use single thick vertical lines for writing norms of vectors. I would like to define a pair of delimiters which behaves like \lvert and \rvert, but with thicker lines. The new delimiters should of course adapt to the size of the formula, just like \lvert and \rvert do. Can this be done?
Asked
Active
Viewed 3,648 times
6
Sebastiano
- 54,118
linusk
- 63
1 Answers
7
There is an extensible delimiter called \bracevert, but it needs some coaxing:
\documentclass{article}
\usepackage{mathtools,xparse}
\DeclarePairedDelimiter{\oldnormaux}{\bracevert}{\bracevert}
\NewDocumentCommand{\oldnorm}{som}{%
\IfBooleanTF{#1}
{\oldnormaux*{#3}}
{\IfNoValueTF{#2}
{\oldnormaux*{\vphantom{dq}#3}}
{\oldnormaux[#2]{#3}}%
}%
}
\begin{document}
$\oldnorm{v}\oldnorm[\big]{v}\oldnorm[\Big]{v}\oldnorm*{\dfrac{1}{2}v}$
\end{document}
See the documentation of mathtools for \DeclarePairedDelimiter, with respect to the syntax; our \oldnorm command works the same.
A more complex solution which also takes care of the spacing; the example also compares it with the standard \Vert symbols.
\documentclass{article}
\usepackage{amsmath,xparse}
\NewDocumentCommand{\oldnorm}{sO{}m}{%
{\IfBooleanTF{#1}
{\oldnormaux{\left|}{\right|}{#3}}
{\oldnormaux{#2|}{#2|}{#3}}}
}
\makeatletter
\newcommand{\oldnormaux}[3]{\mathpalette\oldnormaux@i{{#1}{#2}{#3}}}
\newcommand{\oldnormaux@i}[2]{\oldnormaux@ii#1#2}
\newcommand{\oldnormaux@ii}[4]{%
\sbox\z@{$\m@th#1#2#4#3$}%
\sbox\tw@{$\m@th\|$}%
\mathopen{\hbox to\wd\tw@{\hss\vrule height \ht\z@ depth \dp\z@ width .3\wd\tw@\hss}}%
#4
\mathclose{\hbox to\wd\tw@{\hss\vrule height \ht\z@ depth \dp\z@ width .3\wd\tw@\hss}}%
}
\makeatother
\begin{document}
$\oldnorm{v}\oldnorm[\big]{v}\oldnorm[\Big]{v}\oldnorm*{\dfrac{1}{2}v}^2$
$|\oldnorm{x}|$
$|\lVert x\rVert|$
$\oldnorm*{\dfrac{1}{2}v}^2 \left\lVert\dfrac{1}{2}v\right\rVert^2$
$x_{\oldnorm{v}}$ $x_{\lVert v\rVert}$
\end{document}
egreg
- 1,121,712
-
The thickness of the vertical bars is exactly what I want. However, the horizontal spacing does not look good. Also, the vertical length of the delimiters is different from the vertical lines produced by \lrvert and \lvert. – linusk Jan 26 '17 at 08:11
-
You can always insert a negative space between the delimiters and the expression inside:
{\oldnormaux*{\mkern-5mu\vphantom{dq}#3\mkern-5mu}}for example. As for the vertical line length you're probably out of luck with\bracevert. The delimiter is constructed from a not-so-tiny parts stacked together, so its length changes discretely. – Sergei Golovan Jan 26 '17 at 09:16 -
@linusk Added a more complicated version that should satisfy your needs. – egreg Jan 26 '17 at 11:59


\bracevertdelimiters thick enough? – Sergei Golovan Jan 25 '17 at 09:12