I am using xymatrix for a markov chain diagram. It looks awesome, but the bounding box is not correctly computed, and therefore, it overlaps with other text.
This is special bad as I am also using it on a standalone
script, and the resulting image is too cropped.
Follows the MWE:
\documentclass{article}
\usepackage{lipsum}
\usepackage[all]{xy}
\begin{document}
\lipsum[1]
\begin{figure}[h]
\[\xymatrix{
& a \ar@(ul,ur) \ar@/^/[rr] \ar@/^/[dd] \ar@/^/[ddrr] \ar@/^4pc/[rrrd]
&
& b \ar@(ul,ur) \ar@/^/[ll] \ar@/^/[dd] \ar@/^/[ddll] \ar[dr]
\\
begin \ar[ur] \ar[dr] \ar@/^4pc/[urrr]\ar@/_4pc/[drrr]
&
&
&
& end
\\
& c \ar@(dr,dl) \ar@/^/[rr] \ar@/^/[uu] \ar@/^/[uurr] \ar@/_4pc/[rrru]
&
& d \ar@(dr,dl) \ar@/^/[ll] \ar@/^/[uu] \ar@/^/[uull] \ar[ur]
}\]
\caption{Exemplo de uma cadeia de Markov\label{mkv1}}
\end{figure}
\lipsum[1]
\end{document}
And this is the image when I use standalone
Any hint on what to wrap the xymatrix into, in order to force it to display completely?
Thanks
EDIT: somewhat related to Add padding to the box of object grouping in xymatrix, but I didn't want to have to specify paddings for each different image...
amsmath
and wrap\xymatrix{}
with\boxed{...}
you can see the bounding box. I don't see any automatic way out of this. It seems certain constructions in xy does not contribute to the bounding box (note that we can have issues like that in tikz as well, but setting a specific bounding box in tikz is easy).