
나는 다음 명령을 사용했습니다 :
\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
두 번째 열에 말합니다.
\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}