[OS X TeX] Redefining a math symbol
Michael Sharpe
msharpe at ucsd.edu
Thu Apr 18 23:27:11 CEST 2013
On Apr 18, 2013, at 1:33 PM, J. McKenzie Alexander <jalex at lse.ac.uk> wrote:
> I'm afraid that's not quite what I was looking for. If I wanted to type a macro, I would have done
>
> \def\given{\mathbin{|}}
>
> and written $\Pr(A \given B)$.
>
> But I was interested in learning whether there was a LaTeX command like \DeclareMathOperator, except for binary relations (and which wasn't restricted to only being used in the preamble). Or maybe a pointer to some source about how LaTeX is told to interpret symbols in math mode… I guess I need to return to the TeXbook.
>
> Thanks anyway,
>
> Jason
>
> On 18 Apr 2013, at 12:46, Peter Vamos <P.Vamos at exeter.ac.uk> wrote:
>
>> presumably there's a way to change the definition of the '|' symbol in math mode so that TeX treats it as a binary operator by default
>
> There is: \mid
>
> Peter
>
Doing something like this may be easiest in plain mode:
{\mathcode`|="326A $P\{A|B\}$} % math relation, family 2 (symbols), slot "6A
{\mathcode`|="226A $P\{A|B\}$} % binary operation
$P\{A|B\}$ % back to default
You may of course simplify these using your own \defs but you will need to know the family and the slot number for each character you change temporarily.
Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/macostex-archives/attachments/20130418/5026c203/attachment.html>
More information about the macostex-archives
mailing list