# New Notation for Comma Categories

I would like to ask about a nifty macro for the following operator from category theory, to be used to denote comma categories:

It takes two arguments, such as (category, object), (object, functor), (functor, functor) etc.. An example of the symbol in use is as follows: For $B$ a topological space,

denotes the comma category of topological bundles with base space $B$, whose objects are pairs $(E,p)$ where $E$ is a topological space and $p:E\to B$ is a continuous map, and whose arrows$\phi:(E,p)\to (F,q)$ are continuous $\phi:E\to F$ such that $q\circ \phi=p$.

As for properties, it should be scalable, vertically and horizontally (independently), and it should have a reflection like so (for convenience):

I have no experience in creating macros of this complexity, so I would appreciate a full example, but just suggestions are welcome as well. Thank you for your time.

Edit: Using egreg's answer and this tex.SE entry I came up with my own version, in case someone else wants to use this notation as well, but can not be bothered adjusting the height of the stair. I got rid of the third adjustment argument of egreg's version and employed the package cellspace instead:

\documentclass{article}
\usepackage{amsmath,hhline}

\usepackage{amssymb,faktor}

\usepackage{cellspace}
\setlength\cellspacetoplimit{1pt}
\setlength\cellspacebottomlimit{1pt}

\newcommand{\cat}[1]{\mathbf{#1}} % or whatever YOU like

\newcommand{\rcom}[2]{%
\begingroup
\renewcommand{\arraystretch}{1}%
\setlength{\arraycolsep}{2pt}%
\begin{array}{Sr|Sl}
\hhline{~|-}
${#1}$  &  ${#2}$\\
\hhline{-|~}
\end{array}%
\endgroup
}

\newcommand{\lcom}[2]{%
\begingroup
\renewcommand{\arraystretch}{1}%
\setlength{\arraycolsep}{2pt}%
\begin{array}{r|l}
\hhline{-|~}
#1&#2\\
\hhline{~|-}
\end{array}%
\endgroup
}

\begin{document}

$\lcom{\overline{\underline{R}}}{\cat{Rng}}$\\

$\rcom{\cat{Ab}}{\faktor{G}{H}}$\\

$\rcom{\underline{\cat{Top}}}{\widetilde{G}}$\\

$\rcom{\cat{Ab}}{\dfrac{G}{H}}$

\end{document}


You can use an array with the help of the hhline package. An optional argument is provided for increasing the allotted space in case big objects need to be accommodated.

\documentclass{article}
\usepackage{amsmath,hhline}

\newcommand{\cat}[1]{\mathbf{#1}} % or whatever you like

\newcommand{\commacat}[3][1]{%
\begingroup
\renewcommand{\arraystretch}{#1}%
\setlength{\arraycolsep}{2pt}%
\begin{array}{r|l}
\hhline{~|-}
#2&#3\\
\hhline{-|~}
\end{array}%
\endgroup
}
\newcommand{\cocommacat}[3][1]{%
\begingroup
\renewcommand{\arraystretch}{#1}%
\setlength{\arraycolsep}{2pt}%
\begin{array}{r|l}
\hhline{-|~}
#2&#3\\
\hhline{~|-}
\end{array}%
\endgroup
}

\begin{document}

$\commacat{\cat{Top}}{B} \qquad \cocommacat{X}{\cat{Set}}$

$\commacat[1.8]{\cat{Top}}{\dfrac{A}{B}} \qquad \cocommacat[1.8]{\dfrac{A}{B}}{\cat{Top}}$

\end{document}


• Thank you egreg, it seems your solution is almost working, except that it doesn't scale well vertically (e.g. if you put \dfrac or \faktor or \widetilde on the right handside etc.) . Also is there a way to make the line continuous (there is a very apparent line break on the lower corner for both comma and cocomma)? – Alp Uzman Apr 30 '18 at 21:55
• @AlpUzman Now it should fit your needs. – egreg Apr 30 '18 at 22:35