4

I want to put a triangular-shaped diagram in a line between the text, like:

Consider the diagram $\xymatrix{ & \bullet \ar[dr] & \\ \bullet \ar[rr] \ar[ur] & & \bullet }$ blah blah blah

The problem is that the base of the triangle is placed below the baseline. Is there a way to adjust it to the base line?

2
  • 1
    Welcome to TeX - LaTeX! Please code that compiles, preferably in the form of a complete small document. Your \xymatrix gives many errors because of non-existent targets in rows above and below, e.g. \ar[dr] points down to the right, but there is no next row. Please replace with a use-case example. Jun 9, 2019 at 8:36
  • @AndrewSwann Sorry for the errors. I think it should be fine now. Jun 9, 2019 at 8:52

2 Answers 2

4

Here is one possible way

Sample output

\documentclass{article}

\usepackage[all]{xy}

\begin{document}

Consider the diagram $\xy (0,12)+{\xymatrix { & \bullet \ar[dr] & \\ \bullet
\ar[rr] \ar[ur] & & \bullet }} \endxy$ with appropriate baseline.

\end{document}

The \xymatrix produces an object that can be shifted in standard xy style , here by (0,12) in the natural coordinate system, meaning 0 to the right and 12 up.

1
  • My sincere congratulation. I want used minipage or float but I still hadn't been able to position the text well with the graph.
    – Sebastiano
    Jun 9, 2019 at 12:34
2

You can raise the diagram by its depth (the vertical extent below the baseline), but also taking into account that the \xymatrix is surrounded by \fboxsep space around all sides.

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

\begin{document}

Consider the diagram
\raisebox{\dimexpr\depth-\fboxsep}{%
  $\xymatrix{ & \bullet \ar[dr] & \\ \bullet \ar[rr] \ar[ur] & & \bullet }$%
}
blah blah blah

\end{document}

enter image description here

I'd also make it smaller, if you really want it to be inline.

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

\begin{document}

Consider the diagram
\raisebox{\dimexpr\depth-\fboxsep}{%
  $\xymatrix@R-1pc@C-1pc{ & \bullet \ar[dr] & \\ \bullet \ar[rr] \ar[ur] & & \bullet }$%
} 
blah blah blah

\end{document}

enter image description here

You must log in to answer this question.

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