I have this basic XY-pic package draw

    \xymatrix{A & B \\
              C & D }

And when i enter the code in Latex, it draws it in the center of the page. How can i position this draw exactly the way i want it?

P.S. Also, how do you throw any drawing into a box in latex?



 \hfill{}This matrix \fbox{\xymatrix{A & B \\ C & D }} is off to the right.
 This matrix \fbox{\xymatrix{A & B \\ C & D }} is centered.
 \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 }}

This results in output like:

output of the tex file

  • Hey Ben, what are you doing here? What are trying to accomplish with that first piece of code? I'm asking if i can place this xy-pic in whatever position i want. – Josh Jul 4 '17 at 13:55
  • When you say "whatever position", do you mean left, right, center, or do you mean at whatever coordinate location on the page? How do you want to specify the position? – Benjamin McKay Jul 4 '17 at 14:17
  • I mean literally whatever position and i'm the one asking if i'm able to do that in teh first place. Or atleast how do i specify it to be in the left for example. – Josh Jul 4 '17 at 18:23
  • I show above how to get a box around the matrix, and how to get the matrix to the left side of the text area. I will have to look up how to get a precise (x,y) coordinate location on the page. – Benjamin McKay Jul 4 '17 at 18:34
  • I appreciate your help. – Josh Jul 4 '17 at 18:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.