How do I draw the dashed lines as shown in this figureHow can I put a coloured outline around fraction...
Ellipses aligned on the same boundary point
How should I handle players who ignore the session zero agreement?
Why are the books in the Game of Thrones citadel library shelved spine inwards?
Why is working on the same position for more than 15 years not a red flag?
Salsa20 Implementation: Sum of 2 Words with Carries Suppressed
Avoid page break between paragraphs
Is there a lava-breathing lizard creature (that could be worshipped by a cult) in 5e?
Play Zip, Zap, Zop
How do you funnel food off a cutting board?
False written accusations not made public - is there law to cover this?
How to use Mathematica to do a complex integrate with poles in real axis?
Why do neural networks need so many training examples to perform?
How do you catch Smeargle in Pokemon Go?
How can I play a serial killer in a party of good PCs?
Differences between prior distribution and prior predictive distribution?
Cat is tipping over bed-side lamps during the night
Does Skippy chunky peanut butter contain trans fat?
Why is it that Bernie Sanders is always called a "socialist"?
What sets the resolution of an analog resistive sensor?
Why exactly do action photographers need high fps burst cameras?
Can I announce prefix 161.117.25.0/24 even though I don't have all of /24 IPs?
Why is Agricola named as such?
Why would space fleets be aligned?
Move fast ...... Or you will lose
How do I draw the dashed lines as shown in this figure
How can I put a coloured outline around fraction lines?Rotate a node but not its content: the case of the ellipse decorationHow to define the default vertical distance between nodes?Numerical conditional within tikz keys?TikZ/ERD: node (=Entity) label on the insideWhy do I get an extra white page before my TikZ picture?TikZ: Drawing an arc from an intersection to an intersectionDrawing rectilinear curves in Tikz, aka an Etch-a-Sketch drawingLine up nested tikz enviroments or how to get rid of themHow to draw a square and its diagonals with arrows?
I want to draw the dashed lines as shown in the below figure:
I have achieved the following so far:
MWE:
documentclass{article}
usepackage{tikz}
usepackage{xcolor}
usetikzlibrary{decorations.pathmorphing}
tikzset{zigzag/.style={decorate,decoration=zigzag}}
begin{document}
begin{tikzpicture}
coordinate (c) at (0,-2);
coordinate (d) at (4,-2);
coordinate (e) at (2,-4);
draw[thick,red,zigzag] (-2,0) coordinate(a) -- (2,0) coordinate(b);
draw[thick,fill=blue!20] (c) -- (b) -- (d) -- (e) -- (c);
draw[thick] (a) -- (c);
draw[thick,red,dashed] (0.8,0.08) -- (0,-0.8);
end{tikzpicture}
end{document}
tikz-pgf
add a comment |
I want to draw the dashed lines as shown in the below figure:
I have achieved the following so far:
MWE:
documentclass{article}
usepackage{tikz}
usepackage{xcolor}
usetikzlibrary{decorations.pathmorphing}
tikzset{zigzag/.style={decorate,decoration=zigzag}}
begin{document}
begin{tikzpicture}
coordinate (c) at (0,-2);
coordinate (d) at (4,-2);
coordinate (e) at (2,-4);
draw[thick,red,zigzag] (-2,0) coordinate(a) -- (2,0) coordinate(b);
draw[thick,fill=blue!20] (c) -- (b) -- (d) -- (e) -- (c);
draw[thick] (a) -- (c);
draw[thick,red,dashed] (0.8,0.08) -- (0,-0.8);
end{tikzpicture}
end{document}
tikz-pgf
add a comment |
I want to draw the dashed lines as shown in the below figure:
I have achieved the following so far:
MWE:
documentclass{article}
usepackage{tikz}
usepackage{xcolor}
usetikzlibrary{decorations.pathmorphing}
tikzset{zigzag/.style={decorate,decoration=zigzag}}
begin{document}
begin{tikzpicture}
coordinate (c) at (0,-2);
coordinate (d) at (4,-2);
coordinate (e) at (2,-4);
draw[thick,red,zigzag] (-2,0) coordinate(a) -- (2,0) coordinate(b);
draw[thick,fill=blue!20] (c) -- (b) -- (d) -- (e) -- (c);
draw[thick] (a) -- (c);
draw[thick,red,dashed] (0.8,0.08) -- (0,-0.8);
end{tikzpicture}
end{document}
tikz-pgf
I want to draw the dashed lines as shown in the below figure:
I have achieved the following so far:
MWE:
documentclass{article}
usepackage{tikz}
usepackage{xcolor}
usetikzlibrary{decorations.pathmorphing}
tikzset{zigzag/.style={decorate,decoration=zigzag}}
begin{document}
begin{tikzpicture}
coordinate (c) at (0,-2);
coordinate (d) at (4,-2);
coordinate (e) at (2,-4);
draw[thick,red,zigzag] (-2,0) coordinate(a) -- (2,0) coordinate(b);
draw[thick,fill=blue!20] (c) -- (b) -- (d) -- (e) -- (c);
draw[thick] (a) -- (c);
draw[thick,red,dashed] (0.8,0.08) -- (0,-0.8);
end{tikzpicture}
end{document}
tikz-pgf
tikz-pgf
edited 3 hours ago
JouleV
4,2801938
4,2801938
asked 5 hours ago
subham sonisubham soni
3,98882981
3,98882981
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
The task is not so difficult with decorations.markings
:
documentclass[tikz,margin=3mm]{standalone}
usetikzlibrary{decorations.pathmorphing,decorations.markings}
tikzset{zigzag/.style={decorate,decoration=zigzag}}
begin{document}
begin{tikzpicture}
coordinate (c) at (0,-2);
coordinate (d) at (4,-2);
coordinate (e) at (2,-4);
draw[thick,red,zigzag,postaction={
decoration={
markings,
mark=at position 0.7 with coordinate (x);
},
decorate
}] (-2,0) coordinate(a) -- (2,0) coordinate(b);
draw[thick,fill=blue!20] (c) -- (b) -- (d) -- (e) -- cycle;
draw[thick,postaction={
decoration={
markings,
mark=at position 0.7 with coordinate (y);
},
decorate
}] (a) -- (c);
draw[dashed,red,thick] (x)--(y);
end{tikzpicture}
end{document}
Bonus
Your entire figure:
documentclass[tikz,margin=3mm]{standalone}
usepackage{mathrsfs}
usetikzlibrary{decorations.pathmorphing,decorations.markings,calc,positioning}
tikzset{zigzag/.style={decorate,decoration=zigzag}}
begin{document}
begin{tikzpicture}
coordinate (c) at (0,-2);
coordinate (d) at (4,-2);
coordinate (e) at (2,-4);
draw[thick,red,zigzag,postaction={
decoration={
markings,
mark=at position 0.7 with coordinate (x);,
mark=at position 0.5 with coordinate (singularity);
},
decorate
}] (-2,0) coordinate(a) -- (2,0) coordinate(b);
draw[thick,fill=blue!20] (c) -- (b) -- (d) -- (e) -- cycle;
draw[thick,postaction={
decoration={
markings,
mark=at position 0.7 with coordinate (y);
},
decorate
}] (a) -- (c);
draw[dashed,red,thick] (x)--(y);
node[below left=1em and 1em of y,align=right,red] (es) {excision\surface};
draw[red,->] (es)--($(y)+(-.1,-.1)$);
node[above=10ex of singularity,red] (sn) {singularity};
draw[red,->] (sn)--($(singularity)+(0,1)$);
node[below left=.5ex and 2ex of b] {$mathcal{H}^+$};
path (b) -- (d) node[midway,above right] {$mathcal{I}^+$};
path (d) -- (e) node[midway,below right] {$mathcal{I}^-$};
path (e) -- (c) node[midway,below left] {$mathcal{H}^-$};
node[right=0pt of d] {$i^0$};
draw[postaction={
decoration={
markings,
mark=at position 0.15 with coordinate (enblue);
},
decorate
},thick,blue] (d) to[out=-150,in=-30] (c);
draw[<-,thick,blue] (enblue)--($(enblue)+(-60:1)$)--($(enblue)+(-60:1)+(.2,0)$) node[right,align=left] {$t$ = constant\in Schwarzschild\coordinates};
path[postaction={
decoration={
markings,
mark=at position 0.35 with coordinate (engren);
},
decorate
}] (c)--(b);
draw[thick,green!50!black,postaction={
decoration={
markings,
mark=at position 0.6 with coordinate (enargr);
},
decorate
}] (d) to[out=180,in=-30] (engren);
draw[thick,dashed,green!50!black] (engren)--($(engren)+(150:0.7)$);
draw[<-,thick,green!50!black] (enargr)--($(enargr)+(60:0.75)$)--($(enargr)+(60:0.75)+(2,0)$) node[right,align=left] {$tau$ = constant\in Kerr-Schild\coordinates};
end{tikzpicture}
end{document}
Can you please tell me how did you calculatemark=at position 0.7 with coordinate (x);
. Is there an easy way to determine this value
– subham soni
3 hours ago
Also, can you please explaindraw[thick,red,zigzag,postaction={ decoration={ markings, mark=at position 0.7 with coordinate (x); }
the meaning of the code
– subham soni
3 hours ago
@subhamsoni You can see why I used 0.7 if you use 0.5 or 0.8 or 0.75. Looking at the revisions you can see that I originally used 0.8, but then I changed to 0.7 to fit your figure better.
– JouleV
3 hours ago
Sure. can you please explain draw[thick,red,zigzag,postaction={ decoration={ markings, mark=at position 0.7 with coordinate (x); } the meaning of the code
– subham soni
3 hours ago
@subhamsoni It is explained very well in section 50.5 of the TikZ - PGF manual.
– JouleV
3 hours ago
|
show 4 more comments
It is possible to use the intersections
library which allows to calculate the intersection point of 2 paths. Here the zigzag
path and the dashed
path.
To draw a dashed parallel, I used the calc
library.
The principle.
I kept your path draw[thick,red,dashed] (0.8,0.08) -- (0,-0.8);
I shifted the starting point to the right by trial and error to find the right intersection.
I calculated the intersection named i
of this path and the zigzag
. Then I build a parallel path called dash
through this point.
I calculate the intersection of this path with the other side (the ac
side) and draw the parallel segment (i)--(l)
.
documentclass[tikz,border=5mm]{standalone}
%usepackage{xcolor}
usetikzlibrary{decorations.pathmorphing}
usetikzlibrary{intersections}
usetikzlibrary{calc}
tikzset{zigzag/.style={decorate,decoration=zigzag}}
begin{document}
begin{tikzpicture}
coordinate (c) at (0,-2);
coordinate (d) at (4,-2);
coordinate (e) at (2,-4);
draw[name path=zz,thick,red,zigzag] (-2,0) coordinate(a) -- (2,0) coordinate(b);
draw[thick,fill=blue!20] (c) -- (b) -- (d) -- (e) -- (c);
draw[thick,name path=ac] (a) -- (c);
path[name path=trans] (.9,0.08) -- (0,-0.8);
coordinate [name intersections={of= zz and trans,by={i}}];
coordinate (j) at ($(i)+(c)-(b)$);
coordinate(k) at ($(i)+(b)-(c)$);
path[name path=dash](j)--(k);
path[name intersections={of= ac and dash,by={l}}];
draw [thick,red,dashed] (i) -- (l);
end{tikzpicture}
end{document}
the line isn't at the exact location like in the picture
– subham soni
5 hours ago
I just corrected that, is that okay with you?
– AndréC
5 hours ago
can you please tell how did you calculate path[name path=dash] (.9,0.08) -- (0,-0.8);
– subham soni
3 hours ago
I renamed the paths so that the construction would be easier to understand. I'm looking for the intersection point between thezz
andtrans
path. This point is calledi
, then I draw the parallel[ik]
.
– AndréC
3 hours ago
add a comment |
You can easily calculate where a point in the middle between two other points lies:
documentclass{article}
usepackage{tikz}
usepackage{xcolor}
usetikzlibrary{decorations.pathmorphing,calc}
tikzset{
zigzag/.style={
decorate,
decoration={
zigzag,
amplitude=2.5pt,
segment length=2.5mm
}
}
}
begin{document}
defposition{0.6}
begin{tikzpicture}[thick]
coordinate (c) at (0,-2);
coordinate (d) at (4,-2);
coordinate (e) at (2,-4);
draw[red, zigzag] (-2,0) coordinate(a) -- (2,0) coordinate(b);
draw[fill=blue!20] (c) -- (b) -- (d) -- (e) -- (c);
draw (a) -- (c);
draw[red, densely dashed, shorten >=0.5pt] ($(a)!position!(c)$) -- ($(a)!position!(b)$);
end{tikzpicture}
end{document}
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f476907%2fhow-do-i-draw-the-dashed-lines-as-shown-in-this-figure%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
The task is not so difficult with decorations.markings
:
documentclass[tikz,margin=3mm]{standalone}
usetikzlibrary{decorations.pathmorphing,decorations.markings}
tikzset{zigzag/.style={decorate,decoration=zigzag}}
begin{document}
begin{tikzpicture}
coordinate (c) at (0,-2);
coordinate (d) at (4,-2);
coordinate (e) at (2,-4);
draw[thick,red,zigzag,postaction={
decoration={
markings,
mark=at position 0.7 with coordinate (x);
},
decorate
}] (-2,0) coordinate(a) -- (2,0) coordinate(b);
draw[thick,fill=blue!20] (c) -- (b) -- (d) -- (e) -- cycle;
draw[thick,postaction={
decoration={
markings,
mark=at position 0.7 with coordinate (y);
},
decorate
}] (a) -- (c);
draw[dashed,red,thick] (x)--(y);
end{tikzpicture}
end{document}
Bonus
Your entire figure:
documentclass[tikz,margin=3mm]{standalone}
usepackage{mathrsfs}
usetikzlibrary{decorations.pathmorphing,decorations.markings,calc,positioning}
tikzset{zigzag/.style={decorate,decoration=zigzag}}
begin{document}
begin{tikzpicture}
coordinate (c) at (0,-2);
coordinate (d) at (4,-2);
coordinate (e) at (2,-4);
draw[thick,red,zigzag,postaction={
decoration={
markings,
mark=at position 0.7 with coordinate (x);,
mark=at position 0.5 with coordinate (singularity);
},
decorate
}] (-2,0) coordinate(a) -- (2,0) coordinate(b);
draw[thick,fill=blue!20] (c) -- (b) -- (d) -- (e) -- cycle;
draw[thick,postaction={
decoration={
markings,
mark=at position 0.7 with coordinate (y);
},
decorate
}] (a) -- (c);
draw[dashed,red,thick] (x)--(y);
node[below left=1em and 1em of y,align=right,red] (es) {excision\surface};
draw[red,->] (es)--($(y)+(-.1,-.1)$);
node[above=10ex of singularity,red] (sn) {singularity};
draw[red,->] (sn)--($(singularity)+(0,1)$);
node[below left=.5ex and 2ex of b] {$mathcal{H}^+$};
path (b) -- (d) node[midway,above right] {$mathcal{I}^+$};
path (d) -- (e) node[midway,below right] {$mathcal{I}^-$};
path (e) -- (c) node[midway,below left] {$mathcal{H}^-$};
node[right=0pt of d] {$i^0$};
draw[postaction={
decoration={
markings,
mark=at position 0.15 with coordinate (enblue);
},
decorate
},thick,blue] (d) to[out=-150,in=-30] (c);
draw[<-,thick,blue] (enblue)--($(enblue)+(-60:1)$)--($(enblue)+(-60:1)+(.2,0)$) node[right,align=left] {$t$ = constant\in Schwarzschild\coordinates};
path[postaction={
decoration={
markings,
mark=at position 0.35 with coordinate (engren);
},
decorate
}] (c)--(b);
draw[thick,green!50!black,postaction={
decoration={
markings,
mark=at position 0.6 with coordinate (enargr);
},
decorate
}] (d) to[out=180,in=-30] (engren);
draw[thick,dashed,green!50!black] (engren)--($(engren)+(150:0.7)$);
draw[<-,thick,green!50!black] (enargr)--($(enargr)+(60:0.75)$)--($(enargr)+(60:0.75)+(2,0)$) node[right,align=left] {$tau$ = constant\in Kerr-Schild\coordinates};
end{tikzpicture}
end{document}
Can you please tell me how did you calculatemark=at position 0.7 with coordinate (x);
. Is there an easy way to determine this value
– subham soni
3 hours ago
Also, can you please explaindraw[thick,red,zigzag,postaction={ decoration={ markings, mark=at position 0.7 with coordinate (x); }
the meaning of the code
– subham soni
3 hours ago
@subhamsoni You can see why I used 0.7 if you use 0.5 or 0.8 or 0.75. Looking at the revisions you can see that I originally used 0.8, but then I changed to 0.7 to fit your figure better.
– JouleV
3 hours ago
Sure. can you please explain draw[thick,red,zigzag,postaction={ decoration={ markings, mark=at position 0.7 with coordinate (x); } the meaning of the code
– subham soni
3 hours ago
@subhamsoni It is explained very well in section 50.5 of the TikZ - PGF manual.
– JouleV
3 hours ago
|
show 4 more comments
The task is not so difficult with decorations.markings
:
documentclass[tikz,margin=3mm]{standalone}
usetikzlibrary{decorations.pathmorphing,decorations.markings}
tikzset{zigzag/.style={decorate,decoration=zigzag}}
begin{document}
begin{tikzpicture}
coordinate (c) at (0,-2);
coordinate (d) at (4,-2);
coordinate (e) at (2,-4);
draw[thick,red,zigzag,postaction={
decoration={
markings,
mark=at position 0.7 with coordinate (x);
},
decorate
}] (-2,0) coordinate(a) -- (2,0) coordinate(b);
draw[thick,fill=blue!20] (c) -- (b) -- (d) -- (e) -- cycle;
draw[thick,postaction={
decoration={
markings,
mark=at position 0.7 with coordinate (y);
},
decorate
}] (a) -- (c);
draw[dashed,red,thick] (x)--(y);
end{tikzpicture}
end{document}
Bonus
Your entire figure:
documentclass[tikz,margin=3mm]{standalone}
usepackage{mathrsfs}
usetikzlibrary{decorations.pathmorphing,decorations.markings,calc,positioning}
tikzset{zigzag/.style={decorate,decoration=zigzag}}
begin{document}
begin{tikzpicture}
coordinate (c) at (0,-2);
coordinate (d) at (4,-2);
coordinate (e) at (2,-4);
draw[thick,red,zigzag,postaction={
decoration={
markings,
mark=at position 0.7 with coordinate (x);,
mark=at position 0.5 with coordinate (singularity);
},
decorate
}] (-2,0) coordinate(a) -- (2,0) coordinate(b);
draw[thick,fill=blue!20] (c) -- (b) -- (d) -- (e) -- cycle;
draw[thick,postaction={
decoration={
markings,
mark=at position 0.7 with coordinate (y);
},
decorate
}] (a) -- (c);
draw[dashed,red,thick] (x)--(y);
node[below left=1em and 1em of y,align=right,red] (es) {excision\surface};
draw[red,->] (es)--($(y)+(-.1,-.1)$);
node[above=10ex of singularity,red] (sn) {singularity};
draw[red,->] (sn)--($(singularity)+(0,1)$);
node[below left=.5ex and 2ex of b] {$mathcal{H}^+$};
path (b) -- (d) node[midway,above right] {$mathcal{I}^+$};
path (d) -- (e) node[midway,below right] {$mathcal{I}^-$};
path (e) -- (c) node[midway,below left] {$mathcal{H}^-$};
node[right=0pt of d] {$i^0$};
draw[postaction={
decoration={
markings,
mark=at position 0.15 with coordinate (enblue);
},
decorate
},thick,blue] (d) to[out=-150,in=-30] (c);
draw[<-,thick,blue] (enblue)--($(enblue)+(-60:1)$)--($(enblue)+(-60:1)+(.2,0)$) node[right,align=left] {$t$ = constant\in Schwarzschild\coordinates};
path[postaction={
decoration={
markings,
mark=at position 0.35 with coordinate (engren);
},
decorate
}] (c)--(b);
draw[thick,green!50!black,postaction={
decoration={
markings,
mark=at position 0.6 with coordinate (enargr);
},
decorate
}] (d) to[out=180,in=-30] (engren);
draw[thick,dashed,green!50!black] (engren)--($(engren)+(150:0.7)$);
draw[<-,thick,green!50!black] (enargr)--($(enargr)+(60:0.75)$)--($(enargr)+(60:0.75)+(2,0)$) node[right,align=left] {$tau$ = constant\in Kerr-Schild\coordinates};
end{tikzpicture}
end{document}
Can you please tell me how did you calculatemark=at position 0.7 with coordinate (x);
. Is there an easy way to determine this value
– subham soni
3 hours ago
Also, can you please explaindraw[thick,red,zigzag,postaction={ decoration={ markings, mark=at position 0.7 with coordinate (x); }
the meaning of the code
– subham soni
3 hours ago
@subhamsoni You can see why I used 0.7 if you use 0.5 or 0.8 or 0.75. Looking at the revisions you can see that I originally used 0.8, but then I changed to 0.7 to fit your figure better.
– JouleV
3 hours ago
Sure. can you please explain draw[thick,red,zigzag,postaction={ decoration={ markings, mark=at position 0.7 with coordinate (x); } the meaning of the code
– subham soni
3 hours ago
@subhamsoni It is explained very well in section 50.5 of the TikZ - PGF manual.
– JouleV
3 hours ago
|
show 4 more comments
The task is not so difficult with decorations.markings
:
documentclass[tikz,margin=3mm]{standalone}
usetikzlibrary{decorations.pathmorphing,decorations.markings}
tikzset{zigzag/.style={decorate,decoration=zigzag}}
begin{document}
begin{tikzpicture}
coordinate (c) at (0,-2);
coordinate (d) at (4,-2);
coordinate (e) at (2,-4);
draw[thick,red,zigzag,postaction={
decoration={
markings,
mark=at position 0.7 with coordinate (x);
},
decorate
}] (-2,0) coordinate(a) -- (2,0) coordinate(b);
draw[thick,fill=blue!20] (c) -- (b) -- (d) -- (e) -- cycle;
draw[thick,postaction={
decoration={
markings,
mark=at position 0.7 with coordinate (y);
},
decorate
}] (a) -- (c);
draw[dashed,red,thick] (x)--(y);
end{tikzpicture}
end{document}
Bonus
Your entire figure:
documentclass[tikz,margin=3mm]{standalone}
usepackage{mathrsfs}
usetikzlibrary{decorations.pathmorphing,decorations.markings,calc,positioning}
tikzset{zigzag/.style={decorate,decoration=zigzag}}
begin{document}
begin{tikzpicture}
coordinate (c) at (0,-2);
coordinate (d) at (4,-2);
coordinate (e) at (2,-4);
draw[thick,red,zigzag,postaction={
decoration={
markings,
mark=at position 0.7 with coordinate (x);,
mark=at position 0.5 with coordinate (singularity);
},
decorate
}] (-2,0) coordinate(a) -- (2,0) coordinate(b);
draw[thick,fill=blue!20] (c) -- (b) -- (d) -- (e) -- cycle;
draw[thick,postaction={
decoration={
markings,
mark=at position 0.7 with coordinate (y);
},
decorate
}] (a) -- (c);
draw[dashed,red,thick] (x)--(y);
node[below left=1em and 1em of y,align=right,red] (es) {excision\surface};
draw[red,->] (es)--($(y)+(-.1,-.1)$);
node[above=10ex of singularity,red] (sn) {singularity};
draw[red,->] (sn)--($(singularity)+(0,1)$);
node[below left=.5ex and 2ex of b] {$mathcal{H}^+$};
path (b) -- (d) node[midway,above right] {$mathcal{I}^+$};
path (d) -- (e) node[midway,below right] {$mathcal{I}^-$};
path (e) -- (c) node[midway,below left] {$mathcal{H}^-$};
node[right=0pt of d] {$i^0$};
draw[postaction={
decoration={
markings,
mark=at position 0.15 with coordinate (enblue);
},
decorate
},thick,blue] (d) to[out=-150,in=-30] (c);
draw[<-,thick,blue] (enblue)--($(enblue)+(-60:1)$)--($(enblue)+(-60:1)+(.2,0)$) node[right,align=left] {$t$ = constant\in Schwarzschild\coordinates};
path[postaction={
decoration={
markings,
mark=at position 0.35 with coordinate (engren);
},
decorate
}] (c)--(b);
draw[thick,green!50!black,postaction={
decoration={
markings,
mark=at position 0.6 with coordinate (enargr);
},
decorate
}] (d) to[out=180,in=-30] (engren);
draw[thick,dashed,green!50!black] (engren)--($(engren)+(150:0.7)$);
draw[<-,thick,green!50!black] (enargr)--($(enargr)+(60:0.75)$)--($(enargr)+(60:0.75)+(2,0)$) node[right,align=left] {$tau$ = constant\in Kerr-Schild\coordinates};
end{tikzpicture}
end{document}
The task is not so difficult with decorations.markings
:
documentclass[tikz,margin=3mm]{standalone}
usetikzlibrary{decorations.pathmorphing,decorations.markings}
tikzset{zigzag/.style={decorate,decoration=zigzag}}
begin{document}
begin{tikzpicture}
coordinate (c) at (0,-2);
coordinate (d) at (4,-2);
coordinate (e) at (2,-4);
draw[thick,red,zigzag,postaction={
decoration={
markings,
mark=at position 0.7 with coordinate (x);
},
decorate
}] (-2,0) coordinate(a) -- (2,0) coordinate(b);
draw[thick,fill=blue!20] (c) -- (b) -- (d) -- (e) -- cycle;
draw[thick,postaction={
decoration={
markings,
mark=at position 0.7 with coordinate (y);
},
decorate
}] (a) -- (c);
draw[dashed,red,thick] (x)--(y);
end{tikzpicture}
end{document}
Bonus
Your entire figure:
documentclass[tikz,margin=3mm]{standalone}
usepackage{mathrsfs}
usetikzlibrary{decorations.pathmorphing,decorations.markings,calc,positioning}
tikzset{zigzag/.style={decorate,decoration=zigzag}}
begin{document}
begin{tikzpicture}
coordinate (c) at (0,-2);
coordinate (d) at (4,-2);
coordinate (e) at (2,-4);
draw[thick,red,zigzag,postaction={
decoration={
markings,
mark=at position 0.7 with coordinate (x);,
mark=at position 0.5 with coordinate (singularity);
},
decorate
}] (-2,0) coordinate(a) -- (2,0) coordinate(b);
draw[thick,fill=blue!20] (c) -- (b) -- (d) -- (e) -- cycle;
draw[thick,postaction={
decoration={
markings,
mark=at position 0.7 with coordinate (y);
},
decorate
}] (a) -- (c);
draw[dashed,red,thick] (x)--(y);
node[below left=1em and 1em of y,align=right,red] (es) {excision\surface};
draw[red,->] (es)--($(y)+(-.1,-.1)$);
node[above=10ex of singularity,red] (sn) {singularity};
draw[red,->] (sn)--($(singularity)+(0,1)$);
node[below left=.5ex and 2ex of b] {$mathcal{H}^+$};
path (b) -- (d) node[midway,above right] {$mathcal{I}^+$};
path (d) -- (e) node[midway,below right] {$mathcal{I}^-$};
path (e) -- (c) node[midway,below left] {$mathcal{H}^-$};
node[right=0pt of d] {$i^0$};
draw[postaction={
decoration={
markings,
mark=at position 0.15 with coordinate (enblue);
},
decorate
},thick,blue] (d) to[out=-150,in=-30] (c);
draw[<-,thick,blue] (enblue)--($(enblue)+(-60:1)$)--($(enblue)+(-60:1)+(.2,0)$) node[right,align=left] {$t$ = constant\in Schwarzschild\coordinates};
path[postaction={
decoration={
markings,
mark=at position 0.35 with coordinate (engren);
},
decorate
}] (c)--(b);
draw[thick,green!50!black,postaction={
decoration={
markings,
mark=at position 0.6 with coordinate (enargr);
},
decorate
}] (d) to[out=180,in=-30] (engren);
draw[thick,dashed,green!50!black] (engren)--($(engren)+(150:0.7)$);
draw[<-,thick,green!50!black] (enargr)--($(enargr)+(60:0.75)$)--($(enargr)+(60:0.75)+(2,0)$) node[right,align=left] {$tau$ = constant\in Kerr-Schild\coordinates};
end{tikzpicture}
end{document}
edited 4 hours ago
answered 5 hours ago
JouleVJouleV
4,2801938
4,2801938
Can you please tell me how did you calculatemark=at position 0.7 with coordinate (x);
. Is there an easy way to determine this value
– subham soni
3 hours ago
Also, can you please explaindraw[thick,red,zigzag,postaction={ decoration={ markings, mark=at position 0.7 with coordinate (x); }
the meaning of the code
– subham soni
3 hours ago
@subhamsoni You can see why I used 0.7 if you use 0.5 or 0.8 or 0.75. Looking at the revisions you can see that I originally used 0.8, but then I changed to 0.7 to fit your figure better.
– JouleV
3 hours ago
Sure. can you please explain draw[thick,red,zigzag,postaction={ decoration={ markings, mark=at position 0.7 with coordinate (x); } the meaning of the code
– subham soni
3 hours ago
@subhamsoni It is explained very well in section 50.5 of the TikZ - PGF manual.
– JouleV
3 hours ago
|
show 4 more comments
Can you please tell me how did you calculatemark=at position 0.7 with coordinate (x);
. Is there an easy way to determine this value
– subham soni
3 hours ago
Also, can you please explaindraw[thick,red,zigzag,postaction={ decoration={ markings, mark=at position 0.7 with coordinate (x); }
the meaning of the code
– subham soni
3 hours ago
@subhamsoni You can see why I used 0.7 if you use 0.5 or 0.8 or 0.75. Looking at the revisions you can see that I originally used 0.8, but then I changed to 0.7 to fit your figure better.
– JouleV
3 hours ago
Sure. can you please explain draw[thick,red,zigzag,postaction={ decoration={ markings, mark=at position 0.7 with coordinate (x); } the meaning of the code
– subham soni
3 hours ago
@subhamsoni It is explained very well in section 50.5 of the TikZ - PGF manual.
– JouleV
3 hours ago
Can you please tell me how did you calculate
mark=at position 0.7 with coordinate (x);
. Is there an easy way to determine this value– subham soni
3 hours ago
Can you please tell me how did you calculate
mark=at position 0.7 with coordinate (x);
. Is there an easy way to determine this value– subham soni
3 hours ago
Also, can you please explain
draw[thick,red,zigzag,postaction={ decoration={ markings, mark=at position 0.7 with coordinate (x); }
the meaning of the code– subham soni
3 hours ago
Also, can you please explain
draw[thick,red,zigzag,postaction={ decoration={ markings, mark=at position 0.7 with coordinate (x); }
the meaning of the code– subham soni
3 hours ago
@subhamsoni You can see why I used 0.7 if you use 0.5 or 0.8 or 0.75. Looking at the revisions you can see that I originally used 0.8, but then I changed to 0.7 to fit your figure better.
– JouleV
3 hours ago
@subhamsoni You can see why I used 0.7 if you use 0.5 or 0.8 or 0.75. Looking at the revisions you can see that I originally used 0.8, but then I changed to 0.7 to fit your figure better.
– JouleV
3 hours ago
Sure. can you please explain draw[thick,red,zigzag,postaction={ decoration={ markings, mark=at position 0.7 with coordinate (x); } the meaning of the code
– subham soni
3 hours ago
Sure. can you please explain draw[thick,red,zigzag,postaction={ decoration={ markings, mark=at position 0.7 with coordinate (x); } the meaning of the code
– subham soni
3 hours ago
@subhamsoni It is explained very well in section 50.5 of the TikZ - PGF manual.
– JouleV
3 hours ago
@subhamsoni It is explained very well in section 50.5 of the TikZ - PGF manual.
– JouleV
3 hours ago
|
show 4 more comments
It is possible to use the intersections
library which allows to calculate the intersection point of 2 paths. Here the zigzag
path and the dashed
path.
To draw a dashed parallel, I used the calc
library.
The principle.
I kept your path draw[thick,red,dashed] (0.8,0.08) -- (0,-0.8);
I shifted the starting point to the right by trial and error to find the right intersection.
I calculated the intersection named i
of this path and the zigzag
. Then I build a parallel path called dash
through this point.
I calculate the intersection of this path with the other side (the ac
side) and draw the parallel segment (i)--(l)
.
documentclass[tikz,border=5mm]{standalone}
%usepackage{xcolor}
usetikzlibrary{decorations.pathmorphing}
usetikzlibrary{intersections}
usetikzlibrary{calc}
tikzset{zigzag/.style={decorate,decoration=zigzag}}
begin{document}
begin{tikzpicture}
coordinate (c) at (0,-2);
coordinate (d) at (4,-2);
coordinate (e) at (2,-4);
draw[name path=zz,thick,red,zigzag] (-2,0) coordinate(a) -- (2,0) coordinate(b);
draw[thick,fill=blue!20] (c) -- (b) -- (d) -- (e) -- (c);
draw[thick,name path=ac] (a) -- (c);
path[name path=trans] (.9,0.08) -- (0,-0.8);
coordinate [name intersections={of= zz and trans,by={i}}];
coordinate (j) at ($(i)+(c)-(b)$);
coordinate(k) at ($(i)+(b)-(c)$);
path[name path=dash](j)--(k);
path[name intersections={of= ac and dash,by={l}}];
draw [thick,red,dashed] (i) -- (l);
end{tikzpicture}
end{document}
the line isn't at the exact location like in the picture
– subham soni
5 hours ago
I just corrected that, is that okay with you?
– AndréC
5 hours ago
can you please tell how did you calculate path[name path=dash] (.9,0.08) -- (0,-0.8);
– subham soni
3 hours ago
I renamed the paths so that the construction would be easier to understand. I'm looking for the intersection point between thezz
andtrans
path. This point is calledi
, then I draw the parallel[ik]
.
– AndréC
3 hours ago
add a comment |
It is possible to use the intersections
library which allows to calculate the intersection point of 2 paths. Here the zigzag
path and the dashed
path.
To draw a dashed parallel, I used the calc
library.
The principle.
I kept your path draw[thick,red,dashed] (0.8,0.08) -- (0,-0.8);
I shifted the starting point to the right by trial and error to find the right intersection.
I calculated the intersection named i
of this path and the zigzag
. Then I build a parallel path called dash
through this point.
I calculate the intersection of this path with the other side (the ac
side) and draw the parallel segment (i)--(l)
.
documentclass[tikz,border=5mm]{standalone}
%usepackage{xcolor}
usetikzlibrary{decorations.pathmorphing}
usetikzlibrary{intersections}
usetikzlibrary{calc}
tikzset{zigzag/.style={decorate,decoration=zigzag}}
begin{document}
begin{tikzpicture}
coordinate (c) at (0,-2);
coordinate (d) at (4,-2);
coordinate (e) at (2,-4);
draw[name path=zz,thick,red,zigzag] (-2,0) coordinate(a) -- (2,0) coordinate(b);
draw[thick,fill=blue!20] (c) -- (b) -- (d) -- (e) -- (c);
draw[thick,name path=ac] (a) -- (c);
path[name path=trans] (.9,0.08) -- (0,-0.8);
coordinate [name intersections={of= zz and trans,by={i}}];
coordinate (j) at ($(i)+(c)-(b)$);
coordinate(k) at ($(i)+(b)-(c)$);
path[name path=dash](j)--(k);
path[name intersections={of= ac and dash,by={l}}];
draw [thick,red,dashed] (i) -- (l);
end{tikzpicture}
end{document}
the line isn't at the exact location like in the picture
– subham soni
5 hours ago
I just corrected that, is that okay with you?
– AndréC
5 hours ago
can you please tell how did you calculate path[name path=dash] (.9,0.08) -- (0,-0.8);
– subham soni
3 hours ago
I renamed the paths so that the construction would be easier to understand. I'm looking for the intersection point between thezz
andtrans
path. This point is calledi
, then I draw the parallel[ik]
.
– AndréC
3 hours ago
add a comment |
It is possible to use the intersections
library which allows to calculate the intersection point of 2 paths. Here the zigzag
path and the dashed
path.
To draw a dashed parallel, I used the calc
library.
The principle.
I kept your path draw[thick,red,dashed] (0.8,0.08) -- (0,-0.8);
I shifted the starting point to the right by trial and error to find the right intersection.
I calculated the intersection named i
of this path and the zigzag
. Then I build a parallel path called dash
through this point.
I calculate the intersection of this path with the other side (the ac
side) and draw the parallel segment (i)--(l)
.
documentclass[tikz,border=5mm]{standalone}
%usepackage{xcolor}
usetikzlibrary{decorations.pathmorphing}
usetikzlibrary{intersections}
usetikzlibrary{calc}
tikzset{zigzag/.style={decorate,decoration=zigzag}}
begin{document}
begin{tikzpicture}
coordinate (c) at (0,-2);
coordinate (d) at (4,-2);
coordinate (e) at (2,-4);
draw[name path=zz,thick,red,zigzag] (-2,0) coordinate(a) -- (2,0) coordinate(b);
draw[thick,fill=blue!20] (c) -- (b) -- (d) -- (e) -- (c);
draw[thick,name path=ac] (a) -- (c);
path[name path=trans] (.9,0.08) -- (0,-0.8);
coordinate [name intersections={of= zz and trans,by={i}}];
coordinate (j) at ($(i)+(c)-(b)$);
coordinate(k) at ($(i)+(b)-(c)$);
path[name path=dash](j)--(k);
path[name intersections={of= ac and dash,by={l}}];
draw [thick,red,dashed] (i) -- (l);
end{tikzpicture}
end{document}
It is possible to use the intersections
library which allows to calculate the intersection point of 2 paths. Here the zigzag
path and the dashed
path.
To draw a dashed parallel, I used the calc
library.
The principle.
I kept your path draw[thick,red,dashed] (0.8,0.08) -- (0,-0.8);
I shifted the starting point to the right by trial and error to find the right intersection.
I calculated the intersection named i
of this path and the zigzag
. Then I build a parallel path called dash
through this point.
I calculate the intersection of this path with the other side (the ac
side) and draw the parallel segment (i)--(l)
.
documentclass[tikz,border=5mm]{standalone}
%usepackage{xcolor}
usetikzlibrary{decorations.pathmorphing}
usetikzlibrary{intersections}
usetikzlibrary{calc}
tikzset{zigzag/.style={decorate,decoration=zigzag}}
begin{document}
begin{tikzpicture}
coordinate (c) at (0,-2);
coordinate (d) at (4,-2);
coordinate (e) at (2,-4);
draw[name path=zz,thick,red,zigzag] (-2,0) coordinate(a) -- (2,0) coordinate(b);
draw[thick,fill=blue!20] (c) -- (b) -- (d) -- (e) -- (c);
draw[thick,name path=ac] (a) -- (c);
path[name path=trans] (.9,0.08) -- (0,-0.8);
coordinate [name intersections={of= zz and trans,by={i}}];
coordinate (j) at ($(i)+(c)-(b)$);
coordinate(k) at ($(i)+(b)-(c)$);
path[name path=dash](j)--(k);
path[name intersections={of= ac and dash,by={l}}];
draw [thick,red,dashed] (i) -- (l);
end{tikzpicture}
end{document}
edited 2 hours ago
answered 5 hours ago
AndréCAndréC
9,43111447
9,43111447
the line isn't at the exact location like in the picture
– subham soni
5 hours ago
I just corrected that, is that okay with you?
– AndréC
5 hours ago
can you please tell how did you calculate path[name path=dash] (.9,0.08) -- (0,-0.8);
– subham soni
3 hours ago
I renamed the paths so that the construction would be easier to understand. I'm looking for the intersection point between thezz
andtrans
path. This point is calledi
, then I draw the parallel[ik]
.
– AndréC
3 hours ago
add a comment |
the line isn't at the exact location like in the picture
– subham soni
5 hours ago
I just corrected that, is that okay with you?
– AndréC
5 hours ago
can you please tell how did you calculate path[name path=dash] (.9,0.08) -- (0,-0.8);
– subham soni
3 hours ago
I renamed the paths so that the construction would be easier to understand. I'm looking for the intersection point between thezz
andtrans
path. This point is calledi
, then I draw the parallel[ik]
.
– AndréC
3 hours ago
the line isn't at the exact location like in the picture
– subham soni
5 hours ago
the line isn't at the exact location like in the picture
– subham soni
5 hours ago
I just corrected that, is that okay with you?
– AndréC
5 hours ago
I just corrected that, is that okay with you?
– AndréC
5 hours ago
can you please tell how did you calculate path[name path=dash] (.9,0.08) -- (0,-0.8);
– subham soni
3 hours ago
can you please tell how did you calculate path[name path=dash] (.9,0.08) -- (0,-0.8);
– subham soni
3 hours ago
I renamed the paths so that the construction would be easier to understand. I'm looking for the intersection point between the
zz
and trans
path. This point is called i
, then I draw the parallel [ik]
.– AndréC
3 hours ago
I renamed the paths so that the construction would be easier to understand. I'm looking for the intersection point between the
zz
and trans
path. This point is called i
, then I draw the parallel [ik]
.– AndréC
3 hours ago
add a comment |
You can easily calculate where a point in the middle between two other points lies:
documentclass{article}
usepackage{tikz}
usepackage{xcolor}
usetikzlibrary{decorations.pathmorphing,calc}
tikzset{
zigzag/.style={
decorate,
decoration={
zigzag,
amplitude=2.5pt,
segment length=2.5mm
}
}
}
begin{document}
defposition{0.6}
begin{tikzpicture}[thick]
coordinate (c) at (0,-2);
coordinate (d) at (4,-2);
coordinate (e) at (2,-4);
draw[red, zigzag] (-2,0) coordinate(a) -- (2,0) coordinate(b);
draw[fill=blue!20] (c) -- (b) -- (d) -- (e) -- (c);
draw (a) -- (c);
draw[red, densely dashed, shorten >=0.5pt] ($(a)!position!(c)$) -- ($(a)!position!(b)$);
end{tikzpicture}
end{document}
add a comment |
You can easily calculate where a point in the middle between two other points lies:
documentclass{article}
usepackage{tikz}
usepackage{xcolor}
usetikzlibrary{decorations.pathmorphing,calc}
tikzset{
zigzag/.style={
decorate,
decoration={
zigzag,
amplitude=2.5pt,
segment length=2.5mm
}
}
}
begin{document}
defposition{0.6}
begin{tikzpicture}[thick]
coordinate (c) at (0,-2);
coordinate (d) at (4,-2);
coordinate (e) at (2,-4);
draw[red, zigzag] (-2,0) coordinate(a) -- (2,0) coordinate(b);
draw[fill=blue!20] (c) -- (b) -- (d) -- (e) -- (c);
draw (a) -- (c);
draw[red, densely dashed, shorten >=0.5pt] ($(a)!position!(c)$) -- ($(a)!position!(b)$);
end{tikzpicture}
end{document}
add a comment |
You can easily calculate where a point in the middle between two other points lies:
documentclass{article}
usepackage{tikz}
usepackage{xcolor}
usetikzlibrary{decorations.pathmorphing,calc}
tikzset{
zigzag/.style={
decorate,
decoration={
zigzag,
amplitude=2.5pt,
segment length=2.5mm
}
}
}
begin{document}
defposition{0.6}
begin{tikzpicture}[thick]
coordinate (c) at (0,-2);
coordinate (d) at (4,-2);
coordinate (e) at (2,-4);
draw[red, zigzag] (-2,0) coordinate(a) -- (2,0) coordinate(b);
draw[fill=blue!20] (c) -- (b) -- (d) -- (e) -- (c);
draw (a) -- (c);
draw[red, densely dashed, shorten >=0.5pt] ($(a)!position!(c)$) -- ($(a)!position!(b)$);
end{tikzpicture}
end{document}
You can easily calculate where a point in the middle between two other points lies:
documentclass{article}
usepackage{tikz}
usepackage{xcolor}
usetikzlibrary{decorations.pathmorphing,calc}
tikzset{
zigzag/.style={
decorate,
decoration={
zigzag,
amplitude=2.5pt,
segment length=2.5mm
}
}
}
begin{document}
defposition{0.6}
begin{tikzpicture}[thick]
coordinate (c) at (0,-2);
coordinate (d) at (4,-2);
coordinate (e) at (2,-4);
draw[red, zigzag] (-2,0) coordinate(a) -- (2,0) coordinate(b);
draw[fill=blue!20] (c) -- (b) -- (d) -- (e) -- (c);
draw (a) -- (c);
draw[red, densely dashed, shorten >=0.5pt] ($(a)!position!(c)$) -- ($(a)!position!(b)$);
end{tikzpicture}
end{document}
answered 5 hours ago
BubayaBubaya
635310
635310
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f476907%2fhow-do-i-draw-the-dashed-lines-as-shown-in-this-figure%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown