我有這個基本的 XY-pic 套件繪製
\begin{displaymath}
\xymatrix{A & B \\
C & D }
\end{displaymath}
當我在 Latex 中輸入程式碼時,它會將其繪製在頁面的中心。我如何才能按照我想要的方式準確定位此繪圖?
PS 另外,如何將任何繪圖放入乳膠盒中?
答案1
嘗試
\documentclass{amsart}
\usepackage{tikz}
\usepackage{graphicx}
\usetikzlibrary{calc}
\usepackage[all]{xy}
\begin{document}
\hfill{}This matrix \fbox{\xymatrix{A & B \\ C & D }} is off to the right.
\begin{center}
This matrix \fbox{\xymatrix{A & B \\ C & D }} is centered.
\end{center}
\par\noindent{}This one \fbox{\xymatrix{A & B \\ C & D }} is on the left.
\begin{tikzpicture}[remember picture,overlay]
\node[anchor=south west,inner sep=0pt] at ($(current page.south west)+(0cm,0cm)$) {
\fbox{\xymatrix{A & B \\ C & D }}
};
\node[anchor=south east,inner sep=0pt] at ($(current page.south east)+(0cm,0cm)$) {
\fbox{\xymatrix{A & B \\ C & D }}
};
\node[anchor=north west,inner sep=0pt] at ($(current page.north west)+(0cm,0cm)$) {
\fbox{\xymatrix{A & B \\ C & D }}
};
\node[anchor=north east,inner sep=0pt] at ($(current page.north east)+(0cm,0cm)$) {
\fbox{\xymatrix{A & B \\ C & D }}
};
\end{tikzpicture}
\end{document}
這會導致輸出如下: