3

An inline xymatrix is, by default, surrounded by a non-0 amount of space:

\documentclass{amsart}
\usepackage[all]{xy}
\begin{document}
[\(\xymatrix{A}\)] vs.\ [\(A\)]
\end{document}

produces

Illustration of spacing around xymatrix

How do I adjust (in fact remove) that spacing? Edited to add, after @Sebastiano's answer: if possible, I'd like to do this by some appropriate \setlength or by passing some appropriate argument to xymatrix, rather than by manually adding spacing commands before or after.

1 Answer 1

4

There are several (somewhat cryptic) commands in xy to adjust spacing. See section 3.3 of the manual for details. In your case I think you want to set the margin (@M) to 0pt.

There is also the "special code" @1 that is designed for "one-line" diagrams to improve the placement on the line:

enter image description here

\documentclass{amsart}
\usepackage[all]{xy}
\begin{document}
[\(\xymatrix@M=0pt{A}\)] vs.\ [\(A\)] vs.\ [\(\xymatrix@1{A}\)]
\end{document}
1
  • 1
    As always with the best answers, this answers the question I asked, as well as the one I probably should have asked. Thanks!
    – LSpice
    Jun 20, 2023 at 20:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .