# Bussproofs problem

I use bussproofs all the time, but here's a scenario that I have yet to solve. I want to typeset the following in such a way that the "in [CATEGORY]" additions to the right, aslign with the baselines of the bussproofs tree. (Of course I don't want to just put the texts into the 'tree', that would defeat the purpose.) Ideally, the texts would additionally be right-aligned.

This example just has two bussproof trees aligned side by side, but the double line vs no line difference makes them have different heights. (And, other typographical things could worsen the situation.)

Does anybody have some cool trick to offer?

\documentclass{article}
\usepackage{amsmath}
\usepackage{bussproofs}

\begin{document}

\begin{align*}
\AxiomC{$\mathsf{Forget}(A) \xrightarrow{f} Y$}
\doubleLine
\UnaryInfC{$A \xrightarrow{g} \nabla Y$}
\DisplayProof
\AxiomC{$\textrm{in \textbf{Set}}$}
\noLine
\UnaryInfC{$\textrm{in$D$-\textbf{Set}}$}
\DisplayProof
\end{align*}

\end{document}

• please provide a small complete document that produces the image shown, so people can test answers Jun 12 '18 at 19:36
• Ah, I already found 1 solution what works reasonably: adding the texts with \rlap{\quad\textrm{...}} Jun 12 '18 at 19:45
• 1) The align doesn't really matter here, of course. 2) The next column doesn't fix, because the problem is that bussproof trees, with resp. without (double)lines, are of different heights. 3) Now the code should be a complete working document. Jun 12 '18 at 20:28
• yes, sorry I deleted that comment I was thrown by the mis use of align, which should just be  if it is a single row with no & as here, Jun 12 '18 at 20:38 ## 2 Answers This takes two runs to measure the positions \documentclass{article} \usepackage{amsmath} \usepackage{bussproofs} \makeatletter \def\zz#1{\pdfsavepos\write\@auxout{\gdef\expandafter\string\csname ZZ#1\endcsname{\the\pdflastxpos sp}}} \def\zzadjust#1#2{% \expandafter\ifx\csname ZZ#1\endcsname\relax \else \kern\dimexpr\csname ZZ#2\endcsname-\csname ZZ#1\endcsname\relax \fi} \makeatother \begin{document} \begin{center} \AxiomC{\mathsf{Forget}(A) \xrightarrow{f} Y\rlap{\zz{a}\zzadjust{a}{z}in \textbf{Set}}} \doubleLine \UnaryInfC{A \xrightarrow{g} \nabla Y\rlap{\zz{b}\zzadjust{b}{z}in D-\textbf{Set}}} \DisplayProof\zz{z} \end{center} \end{document}  • Oh, I do have one remaining question. I want to use this repeatedly, and at first thought I could just use new 'names' instead of a, b, and z, but filling anything else in for z seems to break the code. Apparently it isn't a name? (I'm not that much of a LaTeX wizard..) Is there any way I could use this multiple times in the same document? Jun 14 '18 at 10:07 • you can use names but z here is the right hand edge of the main tree so used at the end but also in the "adjust" command in the other cases, so you need to rename all of them together. @KelleyvanEvert Jun 14 '18 at 12:38 • @KelleyvanEvert apart from my habit of calling all commands on this site zz you might want to call \zz \savethispoint and \zzadjust something like \moveto you save points a , b and z but then move a and b horizontally to align with z. Jun 14 '18 at 12:40 • I always get the error Missing number, treated as zero. <to be read again> \ZZhello, if I substitute hello for z (or most everything else, it seems. w and q and k work, x and p gives the error, as well as double letters, etc. I don't really understand the logic, but I think I will run out of letters, or at least have a bit of a hassle :D). Jun 14 '18 at 12:56 • @KelleyvanEvert you can use long names \kk{myproof1} Jun 14 '18 at 13:36 This works, with some low level tricks. \documentclass{article} \usepackage{amsmath} \usepackage{bussproofs} \begin{document} \[ \AxiomC{\mathsf{Forget}(A) \xrightarrow{f} Y} \doubleLine \UnaryInfC{A \xrightarrow{g} \nabla Y} \sbox{0}{\DisplayProof} \usebox{0} \vcenter to \dimexpr\ht0+\dp0{ \hbox{\textrm{in \textbf{Set}}\vphantom{\xrightarrow{f}}} \vfill \hbox{\textrm{in D-\textbf{Set}}} }

\end{document}


• Interesting. But, it does still depend on typographic details. In fact, I have small macro's that surround bussproofs' commands, in order to slightly strut everything to reasonable heights, and this kind of thing breaks these kinds of solutions. But thanks for an interesting solution nonetheless :D Jun 12 '18 at 20:26
• @KelleyvanEvert Of course it won't do for three line proofs, for instance. I'm not sure there exists a general solution (maybe by storing the vertical position of the various lines). Jun 12 '18 at 20:28