在下面的 TikZ 图像中,我希望两个大头针不延伸边界框,但仍能完整显示(即使它们的一部分落在边界框之外)。
使用overlay
节点或引脚本身的选项(如 percusse 在评论中所建议的这个答案) 不幸地将引脚裁剪到边界框中。如果我们将节点封闭在pgfinterruptboundingbox
或scope
环境中(后者再次使用选项overlay
),情况也是如此。
\documentclass[tikz]{standalone}
\usetikzlibrary{patterns}
\tikzset{
cross/.style={path picture={\draw[black]
(path picture bounding box.south east) -- (path picture bounding box.north west)
(path picture bounding box.south west) -- (path picture bounding box.north east);}}
}
\begin{document}
\begin{tikzpicture}
% Loop
\def\radius{1.5}
\draw[very thick] (0,0) circle (\radius);
\draw[fill=white,cross] (0,\radius) circle (0.175*\radius) node[above=5pt] {$\partial_k R_{k,ij}(p_1,p_2)$};
\node at (-1.35*\radius,0.75*\radius) {$G_{ij}(p_1,p_2)$};
\node at (1.35*\radius,0.75*\radius) {$G_{jk}(p_2,p_3)$};
\node[below] at (0,-\radius) {$G_{ef}(p_3,p_4)$};
% External lines
\draw (-2*\radius,0) -- (-\radius,0) node[pos=0.4,below] {$\varphi_a$};
\draw[->,semithick,yshift=5pt,shorten >=5pt,shorten <=5pt] (-2*\radius,0) -- (-1.25*\radius,0) node[midway,above] {$q_1$};
\draw (\radius,0) -- (2*\radius,0) node[pos=0.6,below] {$\varphi_b$};
\draw[->,semithick,yshift=5pt,shorten >=5pt,shorten <=5pt] (1.25*\radius,0) -- (2*\radius,0) node[midway,above] {$q_2$};
% Vertices
\node[draw,circle,minimum size=16pt,fill=white,postaction={pattern=north east lines},pin={260:$\Gamma_{k,ail}^{(3)}(q_1,\!p_1,\!p_4\!)$}] at (-\radius,0) {};
\node[draw,circle,minimum size=16pt,fill=white,postaction={pattern=north east lines},pin={280:$\Gamma_{k,bde}^{(3)}(q_2,\!p_3,\!p_4\!)$}] at (\radius,0) {};
\end{tikzpicture}
\end{document}
答案1
如果pin
没有产生您想要的结果,请不要使用它并寻找替代方案。这是一个,两个独立的节点,Gamma ...
字体较小,两条线将它们连接到圆圈,如pin
。
注意:可能pin
产生类似的结果,但我现在不想查阅文档。
\documentclass[tikz]{standalone}
\usetikzlibrary{patterns}
\tikzset{
cross/.style={path picture={\draw[black]
(path picture bounding box.south east) -- (path picture bounding box.north west)
(path picture bounding box.south west) -- (path picture bounding box.north east);}}
}
\begin{document}
\begin{tikzpicture}
% Loop
\def\radius{1.5}
\draw[very thick] (0,0) circle (\radius);
\draw[fill=white,cross] (0,\radius) circle (0.175*\radius) node[above=5pt] {$\partial_k R_{k,ij}(p_1,p_2)$};
\node at (-1.35*\radius,0.75*\radius) {$G_{ij}(p_1,p_2)$};
\node at (1.35*\radius,0.75*\radius) {$G_{jk}(p_2,p_3)$};
\node[below] at (0,-\radius) (gef) {$G_{ef}(p_3,p_4)$};
% External lines
\draw (-2*\radius,0) coordinate (xl) -- (-\radius,0) node[pos=0.4,below] {$\varphi_a$};
\draw[->,semithick,yshift=5pt,shorten >=5pt,shorten <=5pt] (-2*\radius,0) -- (-1.25*\radius,0) node[midway,above] {$q_1$};
\draw (\radius,0) -- (2*\radius,0) coordinate (xr) node[pos=0.6,below] {$\varphi_b$};
\draw[->,semithick,yshift=5pt,shorten >=5pt,shorten <=5pt] (1.25*\radius,0) -- (2*\radius,0) node[midway,above] {$q_2$};
% Vertices
\node[draw,circle,minimum size=16pt,fill=white,postaction={pattern=north east lines}] at (-\radius,0) (cl) {};
\node[anchor=north east, inner sep=0pt, font=\small] at (-135:\radius) (Gkail) {$\Gamma_{k,ail}^{(3)}(q_1,\!p_1,\!p_4\!)$};
\draw[thin,gray] (Gkail)--(cl);
\node[draw,circle,minimum size=16pt,fill=white,postaction={pattern=north east lines}] at (\radius,0) (cr) {};
\node[anchor=north west, inner sep=0pt, font=\small] at (-45:\radius) (Gkbde) {$\Gamma_{k,bde}^{(3)}(q_2,\!p_3,\!p_4\!)$};
\draw[thin,gray] (Gkbde)--(cr);
\end{tikzpicture}
\end{document}
答案2
这显示了如何创建部分重叠的图像。 的问题在于\includestandalone
您无法直接传递\leftoverlap
和\rightoverlap
值。您可以将它们写出来并手动输入。您也可以将它们写入文件并再次读入。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{patterns}
\newlength{\leftoverlap}
\newlength{\rightoverlap}
\tikzset{
cross/.style={path picture={\draw[black]
(path picture bounding box.south east) -- (path picture bounding box.north west)
(path picture bounding box.south west) -- (path picture bounding box.north east);}}
}
\begin{document}
\sbox0{\begin{tikzpicture}
% Loop
\def\radius{1.5}
\draw[very thick] (0,0) circle (\radius);
\draw[fill=white,cross] (0,\radius) circle (0.175*\radius) node[above=5pt] {$\partial_k R_{k,ij}(p_1,p_2)$};
\node at (-1.35*\radius,0.75*\radius) {$G_{ij}(p_1,p_2)$};
\node at (1.35*\radius,0.75*\radius) {$G_{jk}(p_2,p_3)$};
\node[below] at (0,-\radius) {$G_{ef}(p_3,p_4)$};
% External lines
\draw (-2*\radius,0) -- (-\radius,0) node[pos=0.4,below] {$\varphi_a$};
\draw[->,semithick,yshift=5pt,shorten >=5pt,shorten <=5pt] (-2*\radius,0) -- (-1.25*\radius,0) node[midway,above] {$q_1$};
\draw (\radius,0) -- (2*\radius,0) node[pos=0.6,below] {$\varphi_b$};
\draw[->,semithick,yshift=5pt,shorten >=5pt,shorten <=5pt] (1.25*\radius,0) -- (2*\radius,0) node[midway,above] {$q_2$};
% Vertices
\node[draw,circle,minimum size=16pt,fill=white,postaction={pattern=north east lines},pin={260:$\Gamma_{k,ail}^{(3)}(q_1,\!p_1,\!p_4\!)$}] at (-\radius,0) {};
\node[draw,circle,minimum size=16pt,fill=white,postaction={pattern=north east lines},pin={280:$\Gamma_{k,bde}^{(3)}(q_2,\!p_3,\!p_4\!)$}] at (\radius,0) {};
% compute margins
\coordinate(A) at (-2*\radius,0);
\coordinate(B) at (2*\radius,0);
\pgfextractx{\leftoverlap}{\pgfpointdiff{\pgfpointanchor{current bounding box}{west}}{\pgfpointanchor{A}{center}}}
\pgfextractx{\rightoverlap}{\pgfpointdiff{\pgfpointanchor{B}{center}}{\pgfpointanchor{current bounding box}{east}}}
\global\leftoverlap=\leftoverlap
\global\rightoverlap=\rightoverlap
\end{tikzpicture}}%
\fboxsep=0pt
\fbox{% show minipage border
\begin{minipage}{\dimexpr \wd0-\leftoverlap-\rightoverlap}
\leftskip=-\leftoverlap
\rightskip=-\rightoverlap
\usebox0
\end{minipage}}
\end{document}