# How to typeset absolute values and norms in ConTeXt

How to properly absolute values and norms in ConTeXt? I currently use:

\m{|x|\leq|y|}


But the height does not adapt to the content (same thing for \mid).

• I don't know Context, but take a look at the mathtools package and its \DeclarePairedDelimiter command (§ 3.6, Paired Delimiters, pp. 25-30 of the documentation). – Bernard Feb 20 at 21:42
• @Bernard I don't think you can use latex packages in context – daleif Feb 20 at 21:44
• @daleif: I thought some were compatible. Am I entirely wrong? – Bernard Feb 20 at 21:46
• Actually, it depends on the command used by the dev. If only plain tex is used there is no compatibility issue (this is almost the case for tikz) but AFAIK mathtools is not compatible. – Blincer Feb 20 at 21:50
• @Bernard not sure, never used context, there are some low level packages that also support context (like tikz). Not sure about amsmath – daleif Feb 20 at 21:51

You could use the \fenced command. For example:

\starttext

\startformula
\fenced[doublebar]{\int \psi(r) dr} = 1
\stopformula

\stoptext


You can find a list of defined fences in math-fen.mkiv.

If you don't want to use the \fenced macro, you can also use the fences directly with \L and \R prefix. These will also scale automatically and have to matched, just like \left and \right.

\starttext

\startformula
\Ldoublebar \int \psi(r) dr \Rdoublebar = 1
\stopformula

\stoptext


The output is the same.

\definemathfence[abs][left="007C,right="007C,command=yes]
\definemathfence[norm][left="2016,right="2016,command=yes]


Complete example below:

\definemathfence[abs][left="007C,right="007C,command=yes]
\definemathfence[norm][left="2016,right="2016,command=yes]
\starttext
\startTEXpage[offset=4mm]
Now we can type
\startformula
\stopformula
And if you think the sizes get wrong, you can adjust them like this:
\startformula
\stopformula
\stopTEXpage
\stoptext


• You don’t have to set the left and right values when you inherit the symbols from bar and doublebar with \definemathfence [abs] [bar] [command=yes] and \definemathfence [norm] [doublebar] [command=yes]. – Wolfgang Schuster Feb 21 at 16:47
• Thanks for commenting on this @WolfgangSchuster, I did not know! (At the point where I needed them for myself I just copied them from the source). I can add as a comment that I have asked for support for the possibility to write \abs[size=Big]{\frac{y}{z}} (syntax choice inspired from mathtools) to have \Bigl| and \Bigr. I hope it will be added after the TeXLive freeze. – mickep Feb 21 at 20:43

\left| and \right| scale automatically:

\m{\left| x \right| \leq \left| y^2 \right|}


• Keep in mind that unlike in LaTeX, \| is only a single vertical bar. To get the double vertical bar use \Vert. – Henri Menke Feb 20 at 22:45