TikZ \draw(a)至(b)延伸图片

TikZ \draw(a)至(b)延伸图片

所以我想把我的tikzpicture放在一个盒子里,但每当我使用\draw (a) to[out=0, in=180] (b)它时,图片都会从最初的 14x8 图片扩展到更宽的图片,并且居中看起来很奇怪。我尝试了除 之外的其他方法\draw (a) to[out=0, in=180] (b),但看起来不太好。
这是我的代码:

\begin{figure}[H]
\centering
\begin{tikzpicture}
    
    \def\LB{(L1) -- ++(-7:6)}
    \def\Lb{(L2) -- ++( 7:6)}
    
    \coordinate (CStart) at (7,3);
    \path (CStart) -- ++(0,-0.5) coordinate (L1);
    \path (L1) -- ++(0, -1) coordinate (L2);
    \path[name path=LB1] \LB;
    \path[name path=LB2] \Lb;
    \path[name intersections={of=LB1 and LB2, by=P}];
    \path (P) -- ++(0,-1) coordinate (F);
    \path (CStart) -- ++(-4,0) coordinate (CDashed);
    \path (CDashed) -- ++(0,-1) coordinate (CBott);
    \path (CStart) -- ++(0,-1) coordinate (CTop);
    
    \draw[line width = 1.5, green] \LB;
    \draw[line width = 1.5, green] \Lb;
    \draw[line width = 1.5, green] (L1) -- ++(-4,0);
    \draw[line width = 1.5, green] (L2) -- ++(-4,0);
    \draw[line width = 1.5, green] (5.65,6.35) to[out=0,in=180,looseness=3] (3,1.5);
    \draw[line width = 1.5, green] (5.85,6.65) to[out=0,in=180,looseness=3] (3,2.5);
    
    \fill[right color=gray!50!black,left color=gray!10,middle color=gray,shading=axis,opacity=0.25] (CBott) circle (0.5 and 1);
    \fill[top color=gray!50!black,bottom color=gray!50!black,middle color=gray!50,shading=axis,opacity=0.25] (3,1) -- ++(4,0) arc (270:90:0.5 and 1) -- (CDashed) arc (90:-90:0.5 and 1);
    \fill[left color=gray!90!,right color=gray!2,middle color=gray!30,shading=axis,opacity=0.25] (CTop) circle (0.5 and 1);
    
    \draw (0,0) rectangle (14,8);
    \draw[decorate with=dart] (F) -- ++(0,2);
    \draw (CStart) -- ++(-4,0) arc (90:270:0.5 and 1) -- ++(4,0) ++ (0,1) circle (0.5 and 1);
    \draw[densely dashed] (CDashed) arc (90:-90:0.5 and 1);
    
    \draw[line width = 1.5, green] (3,6.5) -- ++(2,0);
    \draw[line width = 1.5, green] (5,6.5) -- (5.65,6.35);
    \draw[line width = 1.5, green] (5,6.5) -- (5.85,6.65);
    
    \filldraw[fill=black!40,draw=black!80] 
        (1,7) rectangle ++(2,-1);
    
    \fill[top color=gray!60,opacity=0.15] (4,6) -- ++(1.5,0) -- ++(0,0.5) -- (4,6);
    \fill[color=gray!30!black,opacity=0.15] (5.5,6) -- ++(0.5,0.5) -- ++(0,0.5) -- ++(-0.5,-0.5) -- (5.5,6);
    \fill[color=gray!80,opacity=0.15] (4,6) -- ++(1.5,0.5) -- ++(0.5,0.5) -- ++(-1.5,-0.5) -- ++(-0.5,-0.5);
        
    \draw (4,6) -- ++(1.5,0) -- ++(0,0.5) -- (4,6) -- ++(0.5,0.5) -- ++(1.5,0.5) -- ++(0,-0.5) -- ++(-0.5,-0.5) -- ++(0,0.5) -- ++(0.5,0.5);
    
    \node[below] at (4.75,6) {Bragg cell};
    \node[below] at (5,1) {\ac{LDA}-probe};
    \node[below] at (2,6) {Laser};
    
\end{tikzpicture}
\caption{Caption}
\label{fig:Theo/Actual probe}
\end{figure}<br/>

弯曲的绿线看起来就像我想要的那样,但它们似乎将图片延伸到了我绘制的框之外,现在它不再居中了。第一张图显示了我希望用曲线呈现的图片外观,第二张图显示了我希望居中的外观。
图片应位于此处的中心。

就像这里的情况一样

答案1

好吧没关系,我找到了解决方案:
只需将边框插入为\useasboundingbox (0,0) rectangle (14,8);,它就会删除边框外的所有内容,这意味着居中将再次按预期工作。
我在 Caramdir 对 Freddie 的问题的回答

相关内容