1

I'm trying to draw a figure consisting of two boxes, using the framed environment, aligned side by side, each containing a small header and an align* environment. I'd like some symmetry. I.E. that the top and bottom lines of the boxes line up and the boxes are of equal width and symmetrical about the center of the page.

This is what I've got so far (Making use of some shorthands in the align environments, but I'd like a solution that does not depend on the contents of the aligns):

\begin{figure}
\centering
\begin{minipage}{0.45\textwidth}
    \begin{framed}
    \centering
    \textbf{Unit}

    \scalebox{.9}{\parbox{\linewidth}{%
    \begin{align*}
        \unit{A}:&\quad A \rightarrow \allEn\pstar A\\
        \unit{A}(\env)=&\quad\finpr{\Id{A(\env,e)}}{\e\in E}
    \end{align*}
    }}
\end{framed}
\end{minipage}
\quad
\begin{minipage}{0.45\textwidth}
\begin{framed}
    \centering
    \textbf{Co-Unit}

    \scalebox{.9}{\parbox{\linewidth}{%
    \begin{align*}
        \counit{B} : &\quad \pstar\allEn B \rightarrow B\\
        \counit{B}(\env, \e') =&\quad \pi_{\e'} : \Pi_{e\in E}B(\env, \e)\rightarrow B(\env, \e')
    \end{align*}
    }}
\end{framed}
\end{minipage}

\caption{The unit and co-unit of the adjunction}
    \label{UnitCoUnitDefinition}
\end{figure}

Currently

If you look carefully, these boxes aren't quite aligned vertically.

Unaligned

Is there a way to fix the size of the boxes to be equal regardless of the contents of the boxes?

  • 1
    (1) always post full minimal examples, not sniplets. (2) why would they be aligned when they do not have the same height? – daleif Apr 1 at 20:38
  • Your issue seems related to \finpr, because this definition provides no difference between the two box heights. – Werner Apr 1 at 20:55
  • @Werner how bizarre - my definition is very similar but using {\left\langle#1\right\rangle_{#2}} instead. This appears to have fixed the issue as you've said. I'm currently deciding whether re-jig the question so it's useful for others (i.e. using an example with obviously different height aligns) – Xandros Apr 1 at 21:15
  • @Xandros: If you don't need \left...\right, don't just assume things will be the same without it. – Werner Apr 1 at 21:16
0

I use TikZ to handle this.

\documentclass{article}
\usepackage{tikz}
\usepackage{amsmath}
\tikzset{
    every node/.style={
        draw,text centered,
        text width=.45\textwidth,
        minimum height=2.5cm,
        inner sep=0pt
    }
}
\begin{document}
\begin{figure}
    \centering
    \tikz\node {%
    \textbf{Unit}
    \begin{align*}
        A&=B+C+D\\
        B\times C&=1+4
    \end{align*}};%
    \quad%
    \tikz \node {%
    \textbf{Co-unit}
    \begin{align*}
        A&=B+C+D\\
        B\times C&=1+4
    \end{align*}};%
    \caption{The unit and co-unit of the adjunction}
    \label{UnitCoUnitDefinition}
\end{figure}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.