[OS X TeX] Redefining a math symbol

Ross Moore ross.moore at mq.edu.au
Thu Apr 18 22:05:47 CEST 2013

Hello Jason,

On 18/04/2013, at 21:46, "J. McKenzie Alexander" <jalex at lse.ac.uk> wrote:

> Hello,
> As I don't understand the inner workings of math fonts, I'm hoping someone could help me out here... When writing a conditional probability, I find myself often using the following construction:
>    $\Pr( A \mathbin{|} B )$
> since that puts some additional space around the vertical bar.

Since you type a macro name  \Pr at the beginning anyway, 
why not define and use another name, as follows:

which you use as     \Cond(A|B)   as you clearly want to do.
Note the need to use the TeX primitive  \def  with its flexible pattern-matching syntax.
Or use  \mid  (middle delimiter)  instead of the  \mathbin  construction here, because you don't really have a binary relation, conceptually.

If you use the construction in headings or captions, then having a robust command is better,
so make 2 definitions.

  \def\ConditionalPr(#1|#2){\Pr(#1\mid #2)}

Use this the same way as above, so that you never really need to type the long name in the body of your LaTeX source.

> 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... but how?  And, ideally, it would be nice to have a pair of on/off macros so that, if I ever needed the default setting for '|' it could be reinstalled.
> Any help would be most appreciated!

Hope this helps you achieve the desired (indeed, correct!) visual appearance, whilst keeping your LaTeX body source easy to type, and simple to interpret when you revisit it 10 years later.



> Cheers,
> Jason
> --
> Dr J. McKenzie Alexander

More information about the macostex-archives mailing list