2

I'm writing up some category theory notes and I prefer (generally) to have 20mm spaces between the entries of my diagrams, so every time I initiate a new matrix I end up typing

\xymatrixrowsep{20mm}\xymatrixcolsep{20mm}

before I construct the matrix. Is there something I can add to my preamble which will set the default spacing to 20mm to avoid this step?

  • Did you try setting that in the preamble? – egreg Jan 22 at 18:03
  • @egreg No but this is exactly what I'm looking for, where in the preamble would it go? The only reference to xypic I have at all is \usepackage[all,cmtip]{xy}. – Alec Rhea Jan 22 at 18:05
  • @egreg Ha, I just typed it arbitrarily in the preamble and it worked, thanks for the advice. If only the solution was always this easy :-). If you wana post it as an answer I'll accept. – Alec Rhea Jan 22 at 18:09
2

Just do the setting in the preamble.

There's a simpler method for overriding it, in case of need, as shown below.

\documentclass{article}
\usepackage[all,cmtip]{xy}

\xymatrixrowsep{20mm}\xymatrixcolsep{20mm}

\begin{document}

\[
\xymatrix{ A \ar[r] \ar[d] & B \ar[d] \\ C \ar[r] & D }
\]

\[
\xymatrixrowsep{20mm}\xymatrixcolsep{20mm}
\xymatrix{ A \ar[r] \ar[d] & B \ar[d] \\ C \ar[r] & D }
\]

\[
\xymatrixrowsep{30mm}\xymatrixcolsep{30mm}
\xymatrix{ A \ar[r] \ar[d] & B \ar[d] \\ C \ar[r] & D }
\]

\[
\xymatrix@R=30mm@C=30mm{ A \ar[r] \ar[d] & B \ar[d] \\ C \ar[r] & D }
\]

\end{document}

enter image description here

The second example is identical to the first one, just for showing that the setting in the preamble is honored.

For overriding the values in a particular \xymatrix you can add @C=<dimen> and @R=<dimen>, instead of setting \xymatrixrowsep and \xymatrixcolsep. Handy if you have two diagrams in the same display.

  • Much appreciated! – Alec Rhea Jan 22 at 18:10

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.