You're reading the public-facing archive of the Category Theory Zulip server.
To join the server you need an invite. Anybody can get an invite by contacting Matteo Capucci at name dot surname at gmail dot com.
For all things related to this archive refer to the same person.
Hi folks,
I'm trying to figure out how to typeset vertical and horizontal composition of cells in a double category well in LaTeX, and I imagine someone here has been through this before!
In particular, I'd like to be able to write vertical composition as in , and horizontal composition as in . I've done this here as '\frac{a}{b}' and 'a \mid b', and while this works well when I have only two arguments it sort of breaks down when I have more than two.
For example, in , which is '\frac{\frac{a}{b}}{\frac{c}{d}}', the fact that \frac resizes its arguments is causing a problem. I would want all three horizontal lines to be the same size! Using '\mid' for horizontal composition causes similar problems, since it's a symbol of fixed height, and its operands can be quite tall.
I'm aware that one solution to this problem is to write vertical composition as something like . Personally I find the notation a lot clearer, particularly when terms become large, so if it isn't too much of a fuss I'd like to use that.
Does anyone have a good way to do this?
Could you simply use an inline table?
You could also make a macro with \genfrac
that doesn't resize its arguments. And something like \left. a \middle| b \right.
(You can use "view original message" in the hamburger menu to see the macrology I used to do that.)
(There are advantages to the inline table idea too, especially for if you're using higher-arity composition in one or both directions.)
Thanks for the suggestions!
My (admittedly naive) attempt to do this using tables didn't really work out. Nesting a 'horizontal' tabular environment (e.g., {c | c}) inside of a 'vertical' one (e.g., {c}) makes the vertical lines touch the horizontal lines, as in:
composition-with-tables.png
The above table is the result of the following LaTeX code:
Code
The \genfrac approach fares better, but there is still some spacing weirdness, apparently caused by nested vertical composition:
Both approaches seem like they could be perfect with a few tweaks. I'll do some reading...
Thanks again!
Curiously, the "vertical lines extend too far, touching the horizontal lines" thing also happens when I use tables for vertical composition and the command \hc for horizontal composition.
The issue with using \genfrac for this is that it gives the top and bottom arguments an equal amount of space, which looks weird when, say, the top argument is much larger than the bottom argument.
To clarify, I didn't mean to suggest nesting tables. I meant that you could use a single table, because it is not important to distinguish between a horizontal composite of vertical composites, and a vertical composite of horizontal composites, since they are equal in a double category.
I think I still need to be able to make, for example, this shape:
I don't see how I would do it as single table, but it is entirely possible that I just don't understand how tables work.
Most LaTeX packages for tables have support for multi-row and multi-column cells, which achieves this. (I think the best one is tabularray
.)
I didn't know that. Thanks!