XY-pic封装图的定位方法

XY-pic封装图的定位方法

我有这个基本的 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}

输出结果如下:

tex 文件的输出

相关内容