

\newcommand{\bra}[1]{$\langle{#1}|$}
\newcommand{\comm}[2]{$\left[{#1},{#2}\right]={#1}{#2}-{#2}{#1}$}


\comm{\bra{X},\bra{Y}} should return :

$\langle X|\langle Y| - \langle Y|\langle X|$


Seems simple enough - except I can not figure out the correct syntax or to find a similar question to work off of.

Thanks for your input.

Brian


There are better ways for this, however.

\documentclass{article}

\usepackage{mathtools}

\DeclarePairedDelimiter{\bra}{\langle}{|}
\DeclarePairedDelimiterX{\comm}[2]{[}{]}{#1,#2}
\newcommand{\commx}[2]{#1#2-#2#1}

\begin{document}

$\bra{X}$

$\comm{X}{Y}=\commx{X}{Y}$

$\comm[\big]{\bra{X}}{\bra{Y}}=\commx{\bra{X}}{\bra{Y}}$

\end{document}


Note that \comm and \bra accept an optional argument for changing the delimiters' size; also you can use \comm* and \bra* for automatic sizing (use with care).