Eu usei o seguinte comando:
\documentclass{article}
\usepackage{xypic}
\usepackage[final]{showexpl}
\begin{document}
\begin{LTXexample}[pos=r,rframe=single,numbers=none,basicstyle=\ttfamily\small,]
\xymatrix{A \ar[r]^f & B}
\xymatrix{A \ar@{^{(}->}[r]^f & B}
\end{LTXexample}
\end{document}
Isso me dá
mas prefiro criar a seguinte tabela:
Responder1
Você pode usar um tabular
ambiente simples:
\documentclass[]{article}
\usepackage[T1]{fontenc}
\usepackage{array}
\usepackage{xypic}
\begin{document}
\begin{center}
\renewcommand\arraystretch{1.25}
\begin{tabular}{|p{.6\linewidth}|>{\centering\arraybackslash}p{.3\linewidth}|}
\hline
\centering Objetive {\footnotesize and} Input \par\footnotesize Commands to produce the diagrams displayed on the right are as follows, respectively: &
Output\par\footnotesize\itshape (what you get)
\tabularnewline\hline
{\small The default case arrow:}\par
\verb+\xymatrix{A \ar[r]^f & B}+ & $\xymatrix{A \ar[r]^f & B}$
\tabularnewline\hline
{\small Inclusion arrow:}\par
\verb+\xymatrix{A \ar@{^{(}->}[r]^f & B}+ & $\xymatrix{A \ar@{^{(}->}[r]^f & B}$
\tabularnewline\hline
\end{tabular}
\end{center}
\end{document}
Responder2
Isto evita a duplicação de código; você especifica o código na coluna da esquerda e diz \usecode
na segunda coluna.
\documentclass[]{article}
\usepackage[T1]{fontenc}
\usepackage{array,booktabs,xparse}
\usepackage{xypic}
\NewDocumentCommand{\code}{v}{%
\gdef\usecode{$\scantokens{#1}$}%
\texttt{#1}}
\begin{document}
\begin{table}
\caption{Table of the main \Xy{} constructs}
\centering
\bigskip
\begin{tabular}{
m{.6\columnwidth}
>{\centering\arraybackslash} m{.3\columnwidth}
}
\toprule
\multicolumn{1}{p{.6\columnwidth}}{\centering
Objective {\footnotesize and} Input \par
\footnotesize Commands to produce the diagrams displayed
on the right are as follows, respectively:} &
\multicolumn{1}{p{.3\columnwidth}}{\centering
Output\par\footnotesize\itshape (what you get)} \\
\midrule
The default case arrow:\newline
\code{\xymatrix{A \ar[r]^f & B}} & \usecode \\
\midrule
Inclusion arrow:\newline
\code{\xymatrix{A \ar@{^{(}->}[r]^f & B}} & \usecode \\
\bottomrule
\end{tabular}
\end{table}
\end{document}