JP-Ellis / tikz-feynman

Feynman Diagrams with TikZ
http://www.jpellis.me/projects/tikz-feynman
Other
148 stars 20 forks source link

Vertical centering of diagram #59

Closed Txordi00 closed 4 years ago

Txordi00 commented 6 years ago

Hi. Is there any other way of vertical placement other than the baseline? Consider a diagram such as:

\newcommand{\scalartwoloopselfenergy}[1][1]
{
    \begin{tikzpicture}[scale=#1,transform shape, baseline=(b.base)]
    \begin{feynman}[inline=(b.base)]
    \vertex (i1);
    \vertex[right=of i1] (b);
    \vertex[above right=of b] (c);
    \vertex[below right=of b] (d);
    \vertex[below right=of c] (e);
    \vertex[right=of e] (o1);
    \diagram*
    {
        (i1) -- (b) -- [quarter left] (c) -- [quarter left] (e) -- [quarter left] (d) -- [quarter left] (b),
        (c) -- (d),
        (e) -- (o1)
    };
    \end{feynman}
    \end{tikzpicture}
}

And I want to insert it into a phrase, e.g.: Do something with the $\scalartwoloopselfenergy[0.2]$ diagram. Which gives: imatge How can I properly align the diagram? Let's say, for example, align the vertical centre of the diagram with the vertical centre of the line I'm working at. Is it even possible? Thank you!

Txordi00 commented 6 years ago

Solved just by: $\vcenter{\hbox{\scalartwoloopselfenergy[0.2]}}$

JP-Ellis commented 4 years ago

Alternatively, it would also be possible to specify an actual quantity to baseline=..., such as baseline=0.5ex or baseline=-0.5ex.

It's also possible to have baseline={(current bounding box.south)} which will use the bottom of the diagram as the baseline.