5

I am trying do make this looking better:

output_latex

namely: curly brackets enclosing everything, tikzcd diagram vertically centered compared to the two other lines. Any suggestion?

\documentclass[letter, 11pt]{article}
\usepackage{multirow}
\usepackage{amsmath}
\usepackage{tikz-cd}
\tikzset{
    commutative diagrams/.cd,
    arrow style=tikz,
    diagrams={>={Computer Modern Rightarrow[length=5pt,width=5pt]}},
}

\begin{document}
    \begin{align*}
        M :=  
        \left\{\begin{array}{c|c} 
        f:A \to B & \multirow{2}{*}{
        \begin{tikzcd}[ampersand replacement=\&,column sep=1em]
            X \times Y \ar[r, "m"] \ar[d, "r"']\& Z \times W \ar[r, "n"] \& V\\
            X \times Y \ar[r, "m"] \& Z \times \ar[r, "n"]W \& V    \ar[u, "h"']        
        \end{tikzcd}    
        } \\
        g: A \times X \to Y  & \\
        \end{array}\right\}
    \end{align*}
\end{document}
  • how you imagine "better look" bigger distance between nodes? – Zarko May 15 '19 at 3:43
7

an alternative, simple solution:

\documentclass[letter, 11pt]{article}
\usepackage{amsmath}
\usepackage{tikz-cd}
\tikzset{
    commutative diagrams/.cd,
    arrow style=tikz,
    diagrams={>={Computer Modern Rightarrow[length=5pt,width=5pt]}},
}

\begin{document}
    \[
        M :=
        \left\{\begin{array}{c|c}
        \begin{gathered}
        f:A \to B            \\
        g: A \times X \to Y
        \end{gathered} &  \begin{tikzcd}[ampersand replacement=\&]
                                X \times Y \ar[r, "m"] \ar[d, "r"']\& Z \times W \ar[r, "n"] \& V\\
                                X \times Y \ar[r, "m"] \& Z \times \ar[r, "n"]W \& V    \ar[u, "h"']
                                            \end{tikzcd}
        \end{array}\right\}
    \]
    \end{document}

enter image description here

addendum: some off-topic remarks:

  • for determining arrows style you can instead of \tikzset use (shorter) \tikzcdset, for example:

    \tikzcdset{arrow style=tikz,
               diagrams={>=Straight Barb} % I liked such arrows :-)
               }
    
  • in your case you not need ampersand replacement=\&

  • arrows is better -- due to consistency of code -- to write after node content, i.e.: instead Z \times \ar[r, "n"]W is better Z\times W \ar[r, "n"], regardless that resulting diagram is the same

    \documentclass[margin=3mm, varwidth]{standalone}
    \usepackage{amsmath}
    \usepackage{tikz-cd}
    \tikzcdset{arrow style=tikz,
               diagrams={>=Straight Barb}
               }
    
    \begin{document}
        \[
    M := \left\{\begin{array}{c|c}
        \begin{gathered}
        f:A \to B            \\
        g: A \times X \to Y
        \end{gathered} & \begin{tikzcd}%[sep=large]  % i like bigger diagram :-)
                            X\times Y \ar[r, "m"] \ar[d, "r"'] & Z\times W \ar[r, "n"] & V\\
                            X\times Y \ar[r, "m"]              & Z\times W \ar[r, "n"] & V \ar[u, "h"']
                         \end{tikzcd}
        \end{array}\right\}
        \]
    \end{document}
    

gives:

enter image description here

| improve this answer | |
  • In the first code missing \end{document} :-). I not edit, never, the answer of the best users. – Sebastiano Jun 16 '19 at 20:26
3

I think you should not use \left and \right.

Also, letter is not defined yet. Use letterpaper.

\documentclass[letterpaper,11pt]{article}
\usepackage{mathtools}
\usepackage{tikz-cd}
\tikzset{
    commutative diagrams/.cd,
    arrow style=tikz,
    diagrams={>={Computer Modern Rightarrow[length=5pt,width=5pt]}},
}
\makeatletter
\newcommand{\vast}{\bBigg@{4}}
\makeatother
\begin{document}
\[
M\coloneqq\vast\{
\begin{array}{c}
    f:A\to B\\
    g:A\times X\to Y
\end{array}\vast|\begin{tikzcd}[ampersand replacement=\&,column sep=1em]
X \times Y \ar[r, "m"] \ar[d, "r"']\& Z \times W \ar[r, "n"] \& V\\
X \times Y \ar[r, "m"] \& Z \times \ar[r, "n"]W \& V    \ar[u, "h"']    
\end{tikzcd}
\vast\}
\]
\end{document}

enter image description here

The arrow tips are not consistent at all... However, as that is your intention, I keep it.

| improve this answer | |
2

Output

\documentclass[letter, 11pt]{article}
\usepackage{amsmath}
\usepackage{tikz-cd}
\tikzset{
    commutative diagrams/.cd,
    arrow style=tikz,
    diagrams={>={Computer Modern Rightarrow[length=5pt,width=5pt]}},
}

\begin{document}
    \begin{align*}
     M :=   \left\{
                \begin{array}{ll}
                    f:  & A \to B           \\ 
                    g:  & A \times X \to Y  \\
                \end{array}
                \middle|
                \begin{tikzcd}[ampersand replacement=\&,column sep=1em]
                    X \times Y \ar[r, "m"] \ar[d, "r"']\& Z \times W \ar[r, "n"] \& V\\
                    X \times Y \ar[r, "m"] \& Z \times \ar[r, "n"]W \& V    \ar[u, "h"']        
                \end{tikzcd}
            \right\}
    \end{align*}
\end{document}
| improve this answer | |
1

Here I add my proposal using mathtools + xy packages.

enter image description here

\documentclass[12pt]{article}
\usepackage[all]{xy}
\usepackage{mathtools,amssymb}

\begin{document}

\[M\coloneqq \begin{Bmatrix}
\begin{matrix}
f:&A \rightarrow B \\
g:& A \times X \rightarrow Y
\end{matrix}\mathrel{\Bigg|}\vcenter{\xymatrix@R=.9pc{
X \times Y  \ar[r]^{m}  \ar[d]_r &  Z \times W  \ar[r]^(.6){n} & V \\
X \times Y  \ar[r]^m &  Z \times W \ar[r]^(.6){n} & V \ar[u]_h
}}\end{Bmatrix}
\]

\end{document}
| improve this answer | |

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.