TeX - LaTeX Asked by Jan Heimsoth on March 5, 2021
So I wanted to have my tikzpicture
inside a box, but whenever I used draw (a) to[out=0, in=180] (b)
it would extend the picture from initially a 14×8 picture to something wider, and the centering would look weird. I have tried other things than the draw (a) to[out=0, in=180] (b)
, but it is just not looking good.
Here is my code:
begin{figure}[H]
centering
begin{tikzpicture}
defLB{(L1) -- ++(-7:6)}
defLb{(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/>
The curved green lines look how I want them to look, but they seem to extend the picture beyond the box I have drawn and now it is not centered anymore. The first image shows how I intend the picture to look with the curved lines, and the second image shows how I want the centering to look.
Okay nevermind, I found the solution:
Just insert the bordering rectangle as useasboundingbox (0,0) rectangle (14,8);
, it gets rid of everything outside of it, meaning centering will work as thought again.
I found it in Caramdir's answer to Freddie's Question.
Correct answer by Jan Heimsoth on March 5, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP