Graphics, Figures & Tables ⇒ tikz-feynman underbrace
tikz-feynman underbrace
Thanks!
-Dan
\usepackage {tikz-feynman}
\begin{tikzpicture}
\begin{feynman}
% Nodes
\vertex (a);
\vertex [right=0.5cm of a] (b);
\vertex [right=0.5cm of b] (c);
\vertex [below left=of a] (uin) {\(u\)};
\vertex [below left=of b] (d1in) {\(d\)};
\vertex [below left=of c] (d2in) {\(d\)};
\draw [decoration={brace},decorate] (uin.south west) -- (d2in.south east) node[pos=0.5,below] {\(n\)};
\vertex [above left=of a] (u1out) {\(u\)};
\vertex [above left=of b] (dout) {\(d\)};
\vertex [above left=of c] (u2out) {\(u\)};
\draw [decoration={brace},decorate] (u1out.north west) -- (u2out.north east) node[pos=0.5,above] {\(p\)};
\vertex at ($(c)+(1.5,0.5cm)$) (d);
\vertex at ($(d)+(1.5,-0.5cm)$) (eout) {\(e^{-}\)};
\vertex [above right=of d] (antineutrinoin) {\(\overline{\nu _e}\)};
% Diagram
\diagram* {
(uin) -- [fermion] (a) -- [fermion] (u1out),
(d1in) -- [fermion] (b) -- [fermion] (dout),
(d2in) -- [fermion] (c) [dot] -- [fermion] (u2out),
(c) -- [boson, edge label'=\(W^{-}\)] (d),
(d) -- [fermion] (eout),
(antineutrinoin) -- [fermion] (d),
};
\end{feynman}
\end{tikzpicture}
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
tikz-feynman underbrace
I don't know the package, but a short test revealed you just need to swap the 2 coordinates to get what you want:
Code: Select all
\draw [decoration={brace},decorate] (d2in.south east) -- (uin.south west) node[midway,below=2pt] {\(n\)};
In full:
Code: Select all
\documentclass{article}
\usepackage {tikz-feynman}
\begin{document}
\begin{tikzpicture}
\begin{feynman}
% Nodes
\vertex (a);
\vertex [right=0.5cm of a] (b);
\vertex [right=0.5cm of b] (c);
\vertex [below left=of a] (uin) {\(u\)};
\vertex [below left=of b] (d1in) {\(d\)};
\vertex [below left=of c] (d2in) {\(d\)};
\draw [decoration={brace},decorate] (d2in.south east) -- (uin.south west) node[midway,below=2pt] {\(n\)};
\vertex [above left=of a] (u1out) {\(u\)};
\vertex [above left=of b] (dout) {\(d\)};
\vertex [above left=of c] (u2out) {\(u\)};
\draw [decoration={brace},decorate] (u1out.north west) -- (u2out.north east) node[pos=0.5,above] {\(p\)};
\vertex at ($(c)+(1.5,0.5cm)$) (d);
\vertex at ($(d)+(1.5,-0.5cm)$) (eout) {\(e^{-}\)};
\vertex [above right=of d] (antineutrinoin) {\(\overline{\nu _e}\)};
% Diagram
\diagram* {
(uin) -- [fermion] (a) -- [fermion] (u1out),
(d1in) -- [fermion] (b) -- [fermion] (dout),
(d2in) -- [fermion] (c) [dot] -- [fermion] (u2out),
(c) -- [boson, edge label'=\(W^{-}\)] (d),
(d) -- [fermion] (eout),
(antineutrinoin) -- [fermion] (d),
};
\end{feynman}
\end{tikzpicture}
\end{document}
Rainer
tikz-feynman underbrace
Code: Select all
\documentclass{standalone}
\usepackage{tikz-feynman}
\begin{document}
\begin{tikzpicture}
\begin{feynman}
% Nodes
\vertex (a);
\vertex [right=0.5cm of a] (b);
\vertex [right=0.5cm of b] (c);
% changes the height of the text and straighten the brace
\vertex [below left=of a, text height=height("d")] (uin) {\(u\)};
\vertex [below left=of b] (d1in) {\(d\)};
\vertex [below left=of c] (d2in) {\(d\)};
\draw [decoration={brace,mirror},decorate]% adds the mirror option
% moves the node between the coordinates
(uin.south west) -- node[below] {\(n\)} (d2in.south east)
;
\vertex [above left=of a] (u1out) {\(u\)};
\vertex [above left=of b] (dout) {\(d\)};
\vertex [above left=of c] (u2out) {\(u\)};
\draw [decoration={brace},decorate]
(u1out.north west) -- node[above] {\(p\)} (u2out.north east)
;
% I removed the unit of measurement to achieve a uniform representation.
% It just shows another way of doing the same thing and is not intended
% as a correction to your source code.
\vertex at ($(c)+(1.5,0.5)$) (d);
\vertex at ($(d)+(1.5,-0.5)$) (eout) {\(e^{-}\)};
\vertex [above right=of d] (antineutrinoin) {\(\overline{\nu_e}\)};
% Diagram
\diagram* {
(uin) -- [fermion] (a) -- [fermion] (u1out),
(d1in) -- [fermion] (b) -- [fermion] (dout),
(d2in) -- [fermion] (c) [dot] -- [fermion] (u2out),
(c) -- [boson, edge label'=\(W^{-}\)] (d),
(d) -- [fermion] (eout),
(antineutrinoin) -- [fermion] (d),
};
\end{feynman}
\end{tikzpicture}
\end{document}
tikz-feynman underbrace
And the text height thing. I was thinking I was simply stuck with that but I was going to experiment later on. I never would have found that solution.
Is there a more comprehensive manual for tikz-feynman than https://mirror.mwt.me/ctan/graphics/pgf ... eynman.pdf?
Thanks to both of you!
-Dan
- Stefan Kottwitz
- Site Admin
- Posts: 10335
- Joined: Mon Mar 10, 2008 9:44 pm
tikz-feynman underbrace
that's the latest manual (texdoc:


Stefan