I wanted to do something like this: How to have overlapping under-braces and over-braces
The example given is really great, so I tried it on my own: what I was hoping to achieve is to represent a contribution from four fields to Wick theorem by clipping pair of fields, so I tried this:
\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{mathtools}
\begin{document}
\begin{equation}
\begin{aligned}
\overbracket{\phi (x_1) \quad \phi (x_2)} \quad \overbracket{\phi (x_3) \quad \phi (x_4)} \\
\rlap{$\overbracket{\phantom{\phi (x_1) \quad \phi(x_2) \quad \phi (x_3)}}$} \phi(x_1) \quad
\underbracket{\phi (x_2) \quad \phi (x_3) \quad \phi (x_4)} \\
\overbracket{\phi (x_1) \quad \underbracket{\phi (x_2) \quad \phi (x_3)} \quad \phi (x_5)}
\end{aligned}
\end{equation}
\end{document}
Almost, but not quite! The under/overbrackets are starting and ending on the wrong position, I would rather stress the point (x_1
, …), where the bracket starts or ends. So I tried modifying it like this:
\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{mathtools}
\begin{document}
\begin{equation}
\begin{aligned}
\phi (x\!\!\overbracket{\,_{1}) \quad \phi (x\!}{\,}_{\!2}) \quad \phi (x\!\overbracket{_3) \quad \phi (x\!}{\,}_{\!4}) \\
\rlap{$\phi (x\!\!\overbracket{\phantom{\,_1) \quad \phi(x_2) \quad \phi (x}}_3)$} \phi(x_1) \quad
\phi (x\!\!\underbracket{\,_2) \quad \phi (x_3) \quad \phi (x\!}{\,}_{\!4}) \\
\phi (x\!\!\overbracket{\,_1) \quad \phi (x\!\!\underbracket{\,_2) \quad \phi (x\!}{\,}_{\!3}) \quad \phi (x\!}{\,}_{\!4})
\end{aligned}
\end{equation}
\end{document}
This is, in fact, very ugly code, but it works for the first and last case – because there are no interlapping clips. What is worse than ugly code, is that this is not working for the middle case (interlapping clip x1 - x3
and x2 - x4
), when number 3 is positioned below the first overbracket (right under x_2
, where the second clip starts), the right parenthesis is duplicated and also, if you watch carefully, the \phi (x
is somewhat bold, so it's duplicated and slightly displaced too. How can I achieve the interlapping clips effect with exact positioning over x's without these issues?
Thank you.
P.S.: I'm using pdflatex in TeXworks
Best Answer
It's simpler to do it with
pst-node
: consider variables you want to link as\rnodes
, and connect them with the\ncbar
command: