Guest User

Untitled

a guest
Aug 19th, 2018
134
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. \documentclass{article}
  2.  
  3. \usepackage{mathtools,xparse,etoolbox}
  4.  
  5. \DeclarePairedDelimiterX{\RoundBrackets}[1]{(}{)}{#1}
  6.  
  7. \NewDocumentCommand{\pr}{ O{p} r() }{%
  8.   \def\prArg{#2}% Capture argument in macro
  9.   \patchcmd{\prArg}{|}{\mid}{}{}% Replace | with \mid
  10.   #1\RoundBrackets{\prArg}% Set argument in round brackets
  11. }
  12.  
  13. \begin{document}
  14.  
  15. $\pr(a|b) \quad \pr[p_\theta](c)$
  16.  
  17. \end{document}
RAW Paste Data