[dev-context] lvert rvert etc in math

Aditya Mahajan adityam at umich.edu
Sun Feb 25 00:16:38 CET 2007


Hi Hans and Taco,

amsmath.sty defines \lvert and \rvert which provide correct spacing 
when \vert is used as a left or a right delimiter (code at the end of 
email). I do not completely understand what amsmath is trying to do. 
Wouldn't

\definemathsymbol [lvert] [open]  [sy] ["6A] [ex] ["0C]
\definemathsymbol [rvert] [close] [sy] ["6A] [ex] ["0C]

this achieve the same goal?

AMS code:

% \subsection{Vertical bar symbols}
%    Add left/right specific versions of \cn{vert}, \cn{Vert}. Don't
%    assume the delimiter codes are the CM defaults.
%    \begin{macrocode}
\def\@tempa#1#2\@nil{%
   \ifx\delimiter#1\@tempcnta#2\relax\else\@tempcnta\z@\fi
}
\@xp\@tempa\vert\@empty\@nil
\ifnum\@tempcnta>\z@
   \advance\@tempcnta "4000000
   \xdef\lvert{\delimiter\number\@tempcnta\space }
   \advance\@tempcnta "1000000
   \xdef\rvert{\delimiter\number\@tempcnta\space }
\else
   \ifx\@@undefined\lvert
     % Fall back to cmex encoding since we don't know what else to do.
     \DeclareMathDelimiter{\lvert}
       {\mathopen}{symbols}{"6A}{largesymbols}{"0C}
     \DeclareMathDelimiter{\rvert}
       {\mathclose}{symbols}{"6A}{largesymbols}{"0C}
   \fi
\fi
\@xp\@tempa\Vert\@empty\@nil
\ifnum\@tempcnta>\z@
   \advance\@tempcnta "4000000
   \xdef\lVert{\delimiter\number\@tempcnta\space }
   \advance\@tempcnta "1000000
   \xdef\rVert{\delimiter\number\@tempcnta\space }
\else
   \ifx\@@undefined\lVert
     \DeclareMathDelimiter{\lVert}
       {\mathopen}{symbols}{"6B}{largesymbols}{"0D}
     \DeclareMathDelimiter{\rVert}
       {\mathclose}{symbols}{"6B}{largesymbols}{"0D}
   \fi
\fi

Aditya


More information about the dev-context mailing list