\documentclass[11pt]{article}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,positioning}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{decorations.pathmorphing}
\tikzstyle arrowstyle=[scale=1]
\tikzstyle directed=[postaction={decorate,decoration={markings,
mark=at position .5 with {\arrow[arrowstyle]{stealth}}}}]
\tikzstyle reverse directed=[postaction={decorate,decoration={markings,
mark=at position .5 with {\arrowreversed[arrowstyle]{stealth};}}}]
\tikzset{
gluon/.style={decorate, draw=black,very thick,
decoration={coil,amplitude=4pt, segment length=5pt}}
}
\makeatletter
% gluon decoration (based on the original coil decoration)
\pgfdeclaredecoration{gluon}{coil}
{
\state{coil}[switch if less than=%
0.5\pgfdecorationsegmentlength+%>
\pgfdecorationsegmentaspect\pgfdecorationsegmentamplitude+%
\pgfdecorationsegmentaspect\pgfdecorationsegmentamplitude to last,
width=+\pgfdecorationsegmentlength]
{
\pgfpathcurveto
{\pgfpoint@oncoil{0 }{ 0.555}{1}}
{\pgfpoint@oncoil{0.445}{ 1 }{2}}
{\pgfpoint@oncoil{1 }{ 1 }{3}}
\pgfpathcurveto
{\pgfpoint@oncoil{1.555}{ 1 }{4}}
{\pgfpoint@oncoil{2 }{ 0.555}{5}}
{\pgfpoint@oncoil{2 }{ 0 }{6}}
\pgfpathcurveto
{\pgfpoint@oncoil{2 }{-0.555}{7}}
{\pgfpoint@oncoil{1.555}{-1 }{8}}
{\pgfpoint@oncoil{1 }{-1 }{9}}
\pgfpathcurveto
{\pgfpoint@oncoil{0.445}{-1 }{10}}
{\pgfpoint@oncoil{0 }{-0.555}{11}}
{\pgfpoint@oncoil{0 }{ 0 }{12}}
}
\state{last}[next state=final]
{
\pgfpathcurveto
{\pgfpoint@oncoil{0 }{ 0.555}{1}}
{\pgfpoint@oncoil{0.445}{ 1 }{2}}
{\pgfpoint@oncoil{1 }{ 1 }{3}}
\pgfpathcurveto
{\pgfpoint@oncoil{1.555}{ 1 }{4}}
{\pgfpoint@oncoil{2 }{ 0.555}{5}}
{\pgfpoint@oncoil{2 }{ 0 }{6}}
}
\state{final}{}
}
\def\pgfpoint@oncoil#1#2#3{%
\pgf@x=#1\pgfdecorationsegmentamplitude%
\pgf@x=\pgfdecorationsegmentaspect\pgf@x%
\pgf@y=#2\pgfdecorationsegmentamplitude%
\pgf@xa=0.083333333333\pgfdecorationsegmentlength%
\advance\pgf@x by#3\pgf@xa%
}
\makeatother
\begin{document}
\begin{tikzpicture}[scale=1.5][line width=10pt]
%\draw[step=.25cm] (-2.5,-2.5) grid (2.5,2.5);
\coordinate (Origin) at (0,0);
%\fill[black] (Origin) circle (2pt);
\draw [directed] (-1.25,.5) coordinate (a_3) -- node[left] {q} (-1.25, -.5) coordinate (a_2);
\draw [reverse directed] (-1.25, -.5) coordinate (a_2) -- (-.75,0) coordinate (a_1);
\draw [reverse directed] (-.75,0) coordinate (a_1) -- (-1.25,.5) coordinate (a_3);
\draw [dashed] (-.75,0) coordinate (a_1) -- node[above] {$h_{2}(h_{1})$} (1,0) coordinate (a_5);
\draw [dashed] (1,0) coordinate (a_5) -- node[above] {$\phi_1$} (1.75,.75) coordinate (a_6);
\draw [dashed] (1,0) coordinate (a_5) -- node[below] {$\phi_1$}(1.75,-.75) coordinate (a_7);
\draw [directed] (1.75,.75) coordinate(a_6) -- (1.75,1.25) coordinate [label = above:{$\tau^-$}] (a_8);
\draw [reverse directed] (1.75,.75) coordinate (a_6) -- (2.25,.75) coordinate [label = right:{$\tau^+$}] (a_9);
\draw [reverse directed] (1.75,-.75) coordinate(a_10) -- (1.75,-1.25) coordinate [label = below:{$\tau^+$}] (a_11);
\draw [directed] (1.75,-.75) coordinate(a_10) -- (2.25,-.75) coordinate [label = right:{$\tau^-$}] (a_11);
\node (a_12) at (-1.15,.4) {};
\node (a_13) at (-2.2,1.4) {g};
\path (a_12) edge[decorate,decoration={gluon, amplitude=4pt, segment length=5.25pt}] (a_13);
\node (a_14) at (-1.15,-.4) {};
\node (a_15) at (-2.2,-1.4) {g};
\path (a_14) edge[decorate,decoration={gluon, amplitude=4pt, segment length=5.25pt}] (a_15);
\end{tikzpicture}
\end{document}
我有上述费曼图代码。我想让所有线条变粗。我尝试使用以下方法全局指定线宽:
\begin{tikzpicture}[scale=1.5][line width=10pt]
但由于某种原因,没有效果。有人能指出我做错了什么吗?提前谢谢。
答案1
你的错误正是使用两个选项块 [...][...]
;tikzpicture
这只tikzpicture
识别第一个选项[...]
而忽略第二个选项。
您必须用逗号分隔选项。[scale=1.5,line width=10pt]
而不是[scale=1.5][line width=10pt]
。(10pt
似乎也是,我用过2pt
)。
如果你想要所有图片的全局定义,你应该把在序言中(或在所有图片之前)类似
\tikzset{every picture/.style={line width=2pt}}