4

I have the following diagram:

enter image description here

\documentclass{article} \usepackage{xypic,amsmath} \DeclareMathOperator{\coker}{coker} \DeclareMathOperator{\im}{im} \newcommand{\subU}[1]{\left.#1\right|_U} \begin{document} \[ \xymatrix@C=7pt { \subU{\ker\Theta_M^j} \ar@{^(->}[rr] && \subU{\widetilde M} \ar[rr]^-{\subU{\Theta_M^j}} \ar@{->>}[rd] && \subU{\widetilde M(jp^{r-1})} \ar@{->>}[rr] && \subU{\coker\Theta_M^j(jp^{r-1})} \\ &&& \subU{\im\Theta_M^j(jp^{r-1})} \ar@{^(->}[ru] } \] \end{document} 

which is spaced very awkwardly on the page. The image term in the bottom row should be in the center but the cokernel term at the end of the first row is big and the image term makes the column it's in bigger than it needs to be. So it ends up looking a little ugly.

I think this would look a lot better if I could move the two \widetilde M terms closer together. The large space between them is there because the image term makes that column big. Is there any way to tell xypic to not worry about the overlap?

Or if you have any other suggestions I'd love to hear them.

3
  • Welcome to TeX.sx! Commented Mar 11, 2013 at 22:23
  • Welcome to TeX.SE! I've taken the liberty of transforming your code snippet into a full MWE (minimum working example), to simplify and expedite the diagnosis of the problem and (hopefully) the finding of a solution. I had to apply some educated guesses as to what \coker and \im should look like; if I got it wrong, please apply the necessary corrections. Commented Mar 12, 2013 at 1:10
  • That's perfect, thanx. Commented Mar 12, 2013 at 3:12

1 Answer 1

5

For your second question about bringing closer the two central terms by making the image term to use less space, a suggestion is to introduce that term in a \hbox{} of fixed width (say for example 2em).

To prevent an overfull box and to center the term inside that narrow box (so that it protrudes the same amount in both sides) the box can contain two \hss at its ends.

This solution is syntactically awkward, because it requires to enter again in math mode inside the \hbox but produces the desired result.

\documentclass{article} \usepackage{xypic,amsmath} \DeclareMathOperator{\coker}{coker} \DeclareMathOperator{\im}{im} \newcommand{\subU}[1]{\left.#1\right|_U} \begin{document} \[ \xymatrix@C=7pt { \subU{\ker\Theta_M^j} \ar@{^(->}[rr] && \subU{\widetilde M} \ar[rr]^-{\subU{\Theta_M^j}} \ar@{->>}[rd] && \subU{\widetilde M(jp^{r-1})} \ar@{->>}[rr] && \subU{\coker\Theta_M^j(jp^{r-1})} \\ &&& \hbox to 3em{\hss$\displaystyle\subU{\im\Theta_M^j(jp^{r-1})}$\hss} \ar@{^(->}[ru] } \] \end{document} 

Result

About your first question (to center the imag term in the page) the solution would be more difficult. I would switch to tikz for total freedom.

Update

Here is an idea to get the im term horizontally centered, using tikz. The idea is to define the bounding box of the tikzpicture centered around that node, and passing through the coker term. The following figure, which draws a red rectangle around the intended bounding box would make this clear (I also added a border around each node to better see its placement, and a horizontal line below which shows the text width, to appreciate the centering). I did not complete the figure with arrows:

Centered

This figure was generated with the following code (note how the right border of the bounding box was computed simply as the symmetrical of the left border, using the negative of its x, since I placed the im node at (0,0)):

\documentclass{article} \usepackage{tikz} \usepackage{amsmath} \usetikzlibrary{calc,positioning} \DeclareMathOperator{\coker}{coker} \DeclareMathOperator{\im}{im} \newcommand{\subU}[1]{$\left.#1\right|_U$} \begin{document} \begin{center} \begin{tikzpicture}[node distance=8mm, every node/.style={draw}] \node (im) at (0,0) {\subU{\im\Theta_M^j(jp^{r-1})}}; \node[above left=of im.center] (M) {\subU{\widetilde M}}; \node[above right=of im.center] (Mj) {\subU{\widetilde M(jp^{r-1})}}; \node[left=of M] (ker) {\subU{\ker\Theta_M^j}}; \draw[red, use as bounding box] let \p1 = (ker.north west) in (ker.west|-im.south) rectangle (-\x1,\y1); \node[right=of Mj] (coker) {\subU{\coker\Theta_M^j(jp^{r-1})}}; \end{tikzpicture} \end{center} \noindent\hrulefill\par \end{document} 
1
  • Thanx, I was previously unaware of the \hss command. Commented Mar 12, 2013 at 3:19

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.