
次のコマンドを使用しました:
\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}
これは私に
しかし、私は次の表を作成したいと思います。
答え1
シンプルな環境を使用できますtabular
:
\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}
答え2
これにより、コードの重複が回避されます。左の列にコードを指定し、\usecode
2 番目の列に記述します。
\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}