
$\sm{1 & 0 \\ 1 & 0}\quad\psm{1 & 0 \\ 1 & 0}\quad\bsm{1 & 0 \\ 1 & 0}$

\end{document}


Of course, if you save the file Commons.sty in a convenient place (your local tree, for example) where TeX can find it, you can load the package and directly use the commands, as in:

\documentclass{article}
\usepackage{Commons}

\begin{document}

$\pfrac{1}{2}\quad \bfrac{1}{2}\quad \psfrac{1}{2}\quad \bsfrac{1}{2}\quad \mat{1 & 0 & 1 \\ 0 & 0 & 1 \\ 1 & 1 & 0}\quad \pmat{1 & 0 & 1 \\ 0 & 0 & 1 \\ 1 & 1 & 0}\quad \bmat{1 & 0 & 1 \\ 0 & 0 & 1 \\ 1 & 1 & 0}\quad$

$\sm{1 & 0 \\ 1 & 0}\quad\psm{1 & 0 \\ 1 & 0}\quad\bsm{1 & 0 \\ 1 & 0}$

\end{document}


As a side note, I would have defined \pmat and \bmat using directly bmatrix and pmatrix as provided by amsmath.

• @hhh he saves a few keystrokes; instead of, for example, \begin{matrix} 1 & 0 \\ 0 & 1 \end{matrix}, he can write \mat{1 & 0 \\ 0 & 1}. Oct 3 '12 at 3:31
• How to read this "\newcommand{\mat}[1]{\begin{matrix}#1\end{matrix}}"? "[1]"? 3 blocks: \mat is the command, [1] is a divider and the last part is the new -command with place-holder?
– hhh
Oct 3 '12 at 3:32
• @hhh maybe I don't understand you. Are you familiar with the use of \newcommand or is that precisely what you are asking? Oct 3 '12 at 3:34
• Yes after thinking a bit, [n] is the amount of parameters where n is the amount. \[p][s][frac|mat], is this some Regex? | is XOR? [p] means at least one p or no p? This is confusing notation, 3 blocks with no specifiers. [...][...][...], what does this mean?
– hhh
Oct 3 '12 at 3:37
• @hhh \mat is the command that will be defined; [1] declares that it has one argument (mandatory in this case); the next part: {\begin{matrix}#1\end{matrix}} is the definition of the command; it indicates that the argument will be typeset inside a matrix environment. Oct 3 '12 at 3:37

I don't want that Gonzalo Medina's words disappear so I attach them here from the chat. He clarifies the odd notation below. I bolded the clarifying point, thank you.

The author chose [p][s][frac|mat] as a simplified (yet not entirely correct) way to refer to a whole family of commands he defined (the ones I explained in my answer). With [p][s][frac|mat] he wants to refer quicly to \frac, \pfrac, \psfrac, \mat, \pmat, and the \mat version with an "s" which according to his notation should be \psmat, but that he really named \psm. Anyways, don't pay too much attention to the [p][s][frac|mat] notation; it is not relevant to the commands he defined; it was merely a "notational trickery" (that has nothing to do with LaTeX) that he selected to quickly refer to the family of commands that serve as shortcuts for matrices and fractions with or without delimiters. What really matters are the commands themselves. He chose p as a mnemonic for "*p*arenthesized", so \pmat represents a matrix using *p*arentheses as delimiters, \pfrac is a fraction delimited by parentheses, etc. The "s" stands as a mnemonic for "small", so \psm (which should have been \psmat, but he decided to use only \psm as the intent is to save keystrokes) represents a parenthesized small (for in-line use) matrix, etc.