How to draw arrows from floating text into a picture in Beamer?
up vote
2
down vote
favorite
I currently have the following figure and code
documentclass{beamer}
usepackage{tikz}
begin{document}
begin{frame}
begin{tikzpicture}[remember picture, overlay]
node (image) at (current page.center) {includegraphics[scale=0.5]{tj}};
node[align=center, yshift = 1.5cm, xshift = 4cm] at (current page.center) {Tom};
node[align=center, yshift = -1.5cm, xshift = 4cm] at (current page.center) {Jerry};
end{tikzpicture}
end{frame}
end{document}
I want to draw two arrows from Tom and Jerry to the location of their respective faces. I know there is a way to accomplish this using Tikz node. But I am not sure how to do this without compilation errors.
]2
Can someone help me achieve this effect?
beamer tikz-arrows text
add a comment |
up vote
2
down vote
favorite
I currently have the following figure and code
documentclass{beamer}
usepackage{tikz}
begin{document}
begin{frame}
begin{tikzpicture}[remember picture, overlay]
node (image) at (current page.center) {includegraphics[scale=0.5]{tj}};
node[align=center, yshift = 1.5cm, xshift = 4cm] at (current page.center) {Tom};
node[align=center, yshift = -1.5cm, xshift = 4cm] at (current page.center) {Jerry};
end{tikzpicture}
end{frame}
end{document}
I want to draw two arrows from Tom and Jerry to the location of their respective faces. I know there is a way to accomplish this using Tikz node. But I am not sure how to do this without compilation errors.
]2
Can someone help me achieve this effect?
beamer tikz-arrows text
1
see tex.stackexchange.com/questions/457969/… or tex.stackexchange.com/questions/186389/…
– samcarter
2 days ago
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I currently have the following figure and code
documentclass{beamer}
usepackage{tikz}
begin{document}
begin{frame}
begin{tikzpicture}[remember picture, overlay]
node (image) at (current page.center) {includegraphics[scale=0.5]{tj}};
node[align=center, yshift = 1.5cm, xshift = 4cm] at (current page.center) {Tom};
node[align=center, yshift = -1.5cm, xshift = 4cm] at (current page.center) {Jerry};
end{tikzpicture}
end{frame}
end{document}
I want to draw two arrows from Tom and Jerry to the location of their respective faces. I know there is a way to accomplish this using Tikz node. But I am not sure how to do this without compilation errors.
]2
Can someone help me achieve this effect?
beamer tikz-arrows text
I currently have the following figure and code
documentclass{beamer}
usepackage{tikz}
begin{document}
begin{frame}
begin{tikzpicture}[remember picture, overlay]
node (image) at (current page.center) {includegraphics[scale=0.5]{tj}};
node[align=center, yshift = 1.5cm, xshift = 4cm] at (current page.center) {Tom};
node[align=center, yshift = -1.5cm, xshift = 4cm] at (current page.center) {Jerry};
end{tikzpicture}
end{frame}
end{document}
I want to draw two arrows from Tom and Jerry to the location of their respective faces. I know there is a way to accomplish this using Tikz node. But I am not sure how to do this without compilation errors.
]2
Can someone help me achieve this effect?
beamer tikz-arrows text
beamer tikz-arrows text
asked 2 days ago
Shamisen Expert
1595
1595
1
see tex.stackexchange.com/questions/457969/… or tex.stackexchange.com/questions/186389/…
– samcarter
2 days ago
add a comment |
1
see tex.stackexchange.com/questions/457969/… or tex.stackexchange.com/questions/186389/…
– samcarter
2 days ago
1
1
see tex.stackexchange.com/questions/457969/… or tex.stackexchange.com/questions/186389/…
– samcarter
2 days ago
see tex.stackexchange.com/questions/457969/… or tex.stackexchange.com/questions/186389/…
– samcarter
2 days ago
add a comment |
1 Answer
1
active
oldest
votes
up vote
3
down vote
accepted
As discussed in this great answer, it is convenient to introduce a local coordinate system on top of the image.
documentclass{beamer}
usepackage{tikz}
begin{document}
% based on https://tex.stackexchange.com/a/9562/121799
begin{frame}
frametitle{only<1>{Draw a coordinate system on top of the image}%
only<2>{Draw the text nodes (with some generous inner sep)}%
only<3>{Connec the text nodes to the points}%
only<4>{Remove the grid}%
}
begin{tikzpicture}
node (image) at (current page.center) {includegraphics[scale=0.5]{tj}};
begin{scope}[shift={(image.south west)},x={(image.south east)},y={(image.north west)}]
only<1-3>{
draw[help lines,xstep=.1,ystep=.1] (0,0) grid (1,1);
foreach x in {0,1,...,9} { node [anchor=north] at (x/10,0) {0.x}; }
foreach y in {0,1,...,9} { node [anchor=east] at (0,y/10) {0.y}; }
}
only<2->{
node[fill=white,font=large,inner sep=4pt] (Tom) at (0.9,0.74) {Tom};
node[fill=white,font=large,inner sep=4pt] (Jerry) at (0.9,0.23) {Jerry};
}
only<3->{
draw[ultra thick,red] (Tom) -- (0.49,0.42);
draw[ultra thick,red] (Jerry) -- (0.66,0.23);
}
end{scope}
end{tikzpicture}
end{frame}
end{document}
Of course, in the end you may want to erase the grid.
documentclass{beamer}
usepackage{tikz}
begin{document}
% based on https://tex.stackexchange.com/a/9562/121799
begin{frame}
begin{tikzpicture}
node (image) at (current page.center) {includegraphics[scale=0.5]{tj}};
begin{scope}[shift={(image.south west)},x={(image.south east)},y={(image.north west)}]
node[fill=white,font=large,inner sep=4pt,align=center]
(Tom) at (0.9,0.74) {Bad\ Tom};
node[fill=white,font=large,inner sep=4pt,align=center] (Jerry) at (0.9,0.23)
{Tasty\ Jerry};
draw[ultra thick,red,-stealth] (Tom) -- (0.49,0.42);
draw[ultra thick,red,-stealth] (Jerry) -- (0.66,0.23);
end{scope}
end{tikzpicture}
end{frame}
end{document}
Note that you were using remember picture,overlay
without actually using it. As long as you do not really make use of it I recommend dropping it. I also added the arrow heads and multiline nodes, as asked in the comments.
Thanks you saved my life
– Shamisen Expert
2 days ago
Do you know if there is a way to easily put an arrow at the end <-
– Shamisen Expert
2 days ago
@ShamisenExpert Sure, just replacedraw[ultra thick,red] (Tom) -- (0.49,0.42); draw[ultra thick,red] (Jerry) -- (0.66,0.23);
bydraw[ultra thick,red,-stealth] (Tom) -- (0.49,0.42); draw[ultra thick,red,-stealth] (Jerry) -- (0.66,0.23);
. (Will decouple now for a while.)
– marmot
2 days ago
Ok. I wonder if there is a way to write {Bad \ Tom} i.e., Tom beneath Bad. I tried to do this but received errors.
– Shamisen Expert
2 days ago
@ShamisenExpert You can definitely have mutliline text in nodes, you only need to specify the alignment. I added examples withalign=center
to the answer.
– marmot
2 days ago
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
As discussed in this great answer, it is convenient to introduce a local coordinate system on top of the image.
documentclass{beamer}
usepackage{tikz}
begin{document}
% based on https://tex.stackexchange.com/a/9562/121799
begin{frame}
frametitle{only<1>{Draw a coordinate system on top of the image}%
only<2>{Draw the text nodes (with some generous inner sep)}%
only<3>{Connec the text nodes to the points}%
only<4>{Remove the grid}%
}
begin{tikzpicture}
node (image) at (current page.center) {includegraphics[scale=0.5]{tj}};
begin{scope}[shift={(image.south west)},x={(image.south east)},y={(image.north west)}]
only<1-3>{
draw[help lines,xstep=.1,ystep=.1] (0,0) grid (1,1);
foreach x in {0,1,...,9} { node [anchor=north] at (x/10,0) {0.x}; }
foreach y in {0,1,...,9} { node [anchor=east] at (0,y/10) {0.y}; }
}
only<2->{
node[fill=white,font=large,inner sep=4pt] (Tom) at (0.9,0.74) {Tom};
node[fill=white,font=large,inner sep=4pt] (Jerry) at (0.9,0.23) {Jerry};
}
only<3->{
draw[ultra thick,red] (Tom) -- (0.49,0.42);
draw[ultra thick,red] (Jerry) -- (0.66,0.23);
}
end{scope}
end{tikzpicture}
end{frame}
end{document}
Of course, in the end you may want to erase the grid.
documentclass{beamer}
usepackage{tikz}
begin{document}
% based on https://tex.stackexchange.com/a/9562/121799
begin{frame}
begin{tikzpicture}
node (image) at (current page.center) {includegraphics[scale=0.5]{tj}};
begin{scope}[shift={(image.south west)},x={(image.south east)},y={(image.north west)}]
node[fill=white,font=large,inner sep=4pt,align=center]
(Tom) at (0.9,0.74) {Bad\ Tom};
node[fill=white,font=large,inner sep=4pt,align=center] (Jerry) at (0.9,0.23)
{Tasty\ Jerry};
draw[ultra thick,red,-stealth] (Tom) -- (0.49,0.42);
draw[ultra thick,red,-stealth] (Jerry) -- (0.66,0.23);
end{scope}
end{tikzpicture}
end{frame}
end{document}
Note that you were using remember picture,overlay
without actually using it. As long as you do not really make use of it I recommend dropping it. I also added the arrow heads and multiline nodes, as asked in the comments.
Thanks you saved my life
– Shamisen Expert
2 days ago
Do you know if there is a way to easily put an arrow at the end <-
– Shamisen Expert
2 days ago
@ShamisenExpert Sure, just replacedraw[ultra thick,red] (Tom) -- (0.49,0.42); draw[ultra thick,red] (Jerry) -- (0.66,0.23);
bydraw[ultra thick,red,-stealth] (Tom) -- (0.49,0.42); draw[ultra thick,red,-stealth] (Jerry) -- (0.66,0.23);
. (Will decouple now for a while.)
– marmot
2 days ago
Ok. I wonder if there is a way to write {Bad \ Tom} i.e., Tom beneath Bad. I tried to do this but received errors.
– Shamisen Expert
2 days ago
@ShamisenExpert You can definitely have mutliline text in nodes, you only need to specify the alignment. I added examples withalign=center
to the answer.
– marmot
2 days ago
add a comment |
up vote
3
down vote
accepted
As discussed in this great answer, it is convenient to introduce a local coordinate system on top of the image.
documentclass{beamer}
usepackage{tikz}
begin{document}
% based on https://tex.stackexchange.com/a/9562/121799
begin{frame}
frametitle{only<1>{Draw a coordinate system on top of the image}%
only<2>{Draw the text nodes (with some generous inner sep)}%
only<3>{Connec the text nodes to the points}%
only<4>{Remove the grid}%
}
begin{tikzpicture}
node (image) at (current page.center) {includegraphics[scale=0.5]{tj}};
begin{scope}[shift={(image.south west)},x={(image.south east)},y={(image.north west)}]
only<1-3>{
draw[help lines,xstep=.1,ystep=.1] (0,0) grid (1,1);
foreach x in {0,1,...,9} { node [anchor=north] at (x/10,0) {0.x}; }
foreach y in {0,1,...,9} { node [anchor=east] at (0,y/10) {0.y}; }
}
only<2->{
node[fill=white,font=large,inner sep=4pt] (Tom) at (0.9,0.74) {Tom};
node[fill=white,font=large,inner sep=4pt] (Jerry) at (0.9,0.23) {Jerry};
}
only<3->{
draw[ultra thick,red] (Tom) -- (0.49,0.42);
draw[ultra thick,red] (Jerry) -- (0.66,0.23);
}
end{scope}
end{tikzpicture}
end{frame}
end{document}
Of course, in the end you may want to erase the grid.
documentclass{beamer}
usepackage{tikz}
begin{document}
% based on https://tex.stackexchange.com/a/9562/121799
begin{frame}
begin{tikzpicture}
node (image) at (current page.center) {includegraphics[scale=0.5]{tj}};
begin{scope}[shift={(image.south west)},x={(image.south east)},y={(image.north west)}]
node[fill=white,font=large,inner sep=4pt,align=center]
(Tom) at (0.9,0.74) {Bad\ Tom};
node[fill=white,font=large,inner sep=4pt,align=center] (Jerry) at (0.9,0.23)
{Tasty\ Jerry};
draw[ultra thick,red,-stealth] (Tom) -- (0.49,0.42);
draw[ultra thick,red,-stealth] (Jerry) -- (0.66,0.23);
end{scope}
end{tikzpicture}
end{frame}
end{document}
Note that you were using remember picture,overlay
without actually using it. As long as you do not really make use of it I recommend dropping it. I also added the arrow heads and multiline nodes, as asked in the comments.
Thanks you saved my life
– Shamisen Expert
2 days ago
Do you know if there is a way to easily put an arrow at the end <-
– Shamisen Expert
2 days ago
@ShamisenExpert Sure, just replacedraw[ultra thick,red] (Tom) -- (0.49,0.42); draw[ultra thick,red] (Jerry) -- (0.66,0.23);
bydraw[ultra thick,red,-stealth] (Tom) -- (0.49,0.42); draw[ultra thick,red,-stealth] (Jerry) -- (0.66,0.23);
. (Will decouple now for a while.)
– marmot
2 days ago
Ok. I wonder if there is a way to write {Bad \ Tom} i.e., Tom beneath Bad. I tried to do this but received errors.
– Shamisen Expert
2 days ago
@ShamisenExpert You can definitely have mutliline text in nodes, you only need to specify the alignment. I added examples withalign=center
to the answer.
– marmot
2 days ago
add a comment |
up vote
3
down vote
accepted
up vote
3
down vote
accepted
As discussed in this great answer, it is convenient to introduce a local coordinate system on top of the image.
documentclass{beamer}
usepackage{tikz}
begin{document}
% based on https://tex.stackexchange.com/a/9562/121799
begin{frame}
frametitle{only<1>{Draw a coordinate system on top of the image}%
only<2>{Draw the text nodes (with some generous inner sep)}%
only<3>{Connec the text nodes to the points}%
only<4>{Remove the grid}%
}
begin{tikzpicture}
node (image) at (current page.center) {includegraphics[scale=0.5]{tj}};
begin{scope}[shift={(image.south west)},x={(image.south east)},y={(image.north west)}]
only<1-3>{
draw[help lines,xstep=.1,ystep=.1] (0,0) grid (1,1);
foreach x in {0,1,...,9} { node [anchor=north] at (x/10,0) {0.x}; }
foreach y in {0,1,...,9} { node [anchor=east] at (0,y/10) {0.y}; }
}
only<2->{
node[fill=white,font=large,inner sep=4pt] (Tom) at (0.9,0.74) {Tom};
node[fill=white,font=large,inner sep=4pt] (Jerry) at (0.9,0.23) {Jerry};
}
only<3->{
draw[ultra thick,red] (Tom) -- (0.49,0.42);
draw[ultra thick,red] (Jerry) -- (0.66,0.23);
}
end{scope}
end{tikzpicture}
end{frame}
end{document}
Of course, in the end you may want to erase the grid.
documentclass{beamer}
usepackage{tikz}
begin{document}
% based on https://tex.stackexchange.com/a/9562/121799
begin{frame}
begin{tikzpicture}
node (image) at (current page.center) {includegraphics[scale=0.5]{tj}};
begin{scope}[shift={(image.south west)},x={(image.south east)},y={(image.north west)}]
node[fill=white,font=large,inner sep=4pt,align=center]
(Tom) at (0.9,0.74) {Bad\ Tom};
node[fill=white,font=large,inner sep=4pt,align=center] (Jerry) at (0.9,0.23)
{Tasty\ Jerry};
draw[ultra thick,red,-stealth] (Tom) -- (0.49,0.42);
draw[ultra thick,red,-stealth] (Jerry) -- (0.66,0.23);
end{scope}
end{tikzpicture}
end{frame}
end{document}
Note that you were using remember picture,overlay
without actually using it. As long as you do not really make use of it I recommend dropping it. I also added the arrow heads and multiline nodes, as asked in the comments.
As discussed in this great answer, it is convenient to introduce a local coordinate system on top of the image.
documentclass{beamer}
usepackage{tikz}
begin{document}
% based on https://tex.stackexchange.com/a/9562/121799
begin{frame}
frametitle{only<1>{Draw a coordinate system on top of the image}%
only<2>{Draw the text nodes (with some generous inner sep)}%
only<3>{Connec the text nodes to the points}%
only<4>{Remove the grid}%
}
begin{tikzpicture}
node (image) at (current page.center) {includegraphics[scale=0.5]{tj}};
begin{scope}[shift={(image.south west)},x={(image.south east)},y={(image.north west)}]
only<1-3>{
draw[help lines,xstep=.1,ystep=.1] (0,0) grid (1,1);
foreach x in {0,1,...,9} { node [anchor=north] at (x/10,0) {0.x}; }
foreach y in {0,1,...,9} { node [anchor=east] at (0,y/10) {0.y}; }
}
only<2->{
node[fill=white,font=large,inner sep=4pt] (Tom) at (0.9,0.74) {Tom};
node[fill=white,font=large,inner sep=4pt] (Jerry) at (0.9,0.23) {Jerry};
}
only<3->{
draw[ultra thick,red] (Tom) -- (0.49,0.42);
draw[ultra thick,red] (Jerry) -- (0.66,0.23);
}
end{scope}
end{tikzpicture}
end{frame}
end{document}
Of course, in the end you may want to erase the grid.
documentclass{beamer}
usepackage{tikz}
begin{document}
% based on https://tex.stackexchange.com/a/9562/121799
begin{frame}
begin{tikzpicture}
node (image) at (current page.center) {includegraphics[scale=0.5]{tj}};
begin{scope}[shift={(image.south west)},x={(image.south east)},y={(image.north west)}]
node[fill=white,font=large,inner sep=4pt,align=center]
(Tom) at (0.9,0.74) {Bad\ Tom};
node[fill=white,font=large,inner sep=4pt,align=center] (Jerry) at (0.9,0.23)
{Tasty\ Jerry};
draw[ultra thick,red,-stealth] (Tom) -- (0.49,0.42);
draw[ultra thick,red,-stealth] (Jerry) -- (0.66,0.23);
end{scope}
end{tikzpicture}
end{frame}
end{document}
Note that you were using remember picture,overlay
without actually using it. As long as you do not really make use of it I recommend dropping it. I also added the arrow heads and multiline nodes, as asked in the comments.
edited 2 days ago
answered 2 days ago
marmot
75k483159
75k483159
Thanks you saved my life
– Shamisen Expert
2 days ago
Do you know if there is a way to easily put an arrow at the end <-
– Shamisen Expert
2 days ago
@ShamisenExpert Sure, just replacedraw[ultra thick,red] (Tom) -- (0.49,0.42); draw[ultra thick,red] (Jerry) -- (0.66,0.23);
bydraw[ultra thick,red,-stealth] (Tom) -- (0.49,0.42); draw[ultra thick,red,-stealth] (Jerry) -- (0.66,0.23);
. (Will decouple now for a while.)
– marmot
2 days ago
Ok. I wonder if there is a way to write {Bad \ Tom} i.e., Tom beneath Bad. I tried to do this but received errors.
– Shamisen Expert
2 days ago
@ShamisenExpert You can definitely have mutliline text in nodes, you only need to specify the alignment. I added examples withalign=center
to the answer.
– marmot
2 days ago
add a comment |
Thanks you saved my life
– Shamisen Expert
2 days ago
Do you know if there is a way to easily put an arrow at the end <-
– Shamisen Expert
2 days ago
@ShamisenExpert Sure, just replacedraw[ultra thick,red] (Tom) -- (0.49,0.42); draw[ultra thick,red] (Jerry) -- (0.66,0.23);
bydraw[ultra thick,red,-stealth] (Tom) -- (0.49,0.42); draw[ultra thick,red,-stealth] (Jerry) -- (0.66,0.23);
. (Will decouple now for a while.)
– marmot
2 days ago
Ok. I wonder if there is a way to write {Bad \ Tom} i.e., Tom beneath Bad. I tried to do this but received errors.
– Shamisen Expert
2 days ago
@ShamisenExpert You can definitely have mutliline text in nodes, you only need to specify the alignment. I added examples withalign=center
to the answer.
– marmot
2 days ago
Thanks you saved my life
– Shamisen Expert
2 days ago
Thanks you saved my life
– Shamisen Expert
2 days ago
Do you know if there is a way to easily put an arrow at the end <-
– Shamisen Expert
2 days ago
Do you know if there is a way to easily put an arrow at the end <-
– Shamisen Expert
2 days ago
@ShamisenExpert Sure, just replace
draw[ultra thick,red] (Tom) -- (0.49,0.42); draw[ultra thick,red] (Jerry) -- (0.66,0.23);
by draw[ultra thick,red,-stealth] (Tom) -- (0.49,0.42); draw[ultra thick,red,-stealth] (Jerry) -- (0.66,0.23);
. (Will decouple now for a while.)– marmot
2 days ago
@ShamisenExpert Sure, just replace
draw[ultra thick,red] (Tom) -- (0.49,0.42); draw[ultra thick,red] (Jerry) -- (0.66,0.23);
by draw[ultra thick,red,-stealth] (Tom) -- (0.49,0.42); draw[ultra thick,red,-stealth] (Jerry) -- (0.66,0.23);
. (Will decouple now for a while.)– marmot
2 days ago
Ok. I wonder if there is a way to write {Bad \ Tom} i.e., Tom beneath Bad. I tried to do this but received errors.
– Shamisen Expert
2 days ago
Ok. I wonder if there is a way to write {Bad \ Tom} i.e., Tom beneath Bad. I tried to do this but received errors.
– Shamisen Expert
2 days ago
@ShamisenExpert You can definitely have mutliline text in nodes, you only need to specify the alignment. I added examples with
align=center
to the answer.– marmot
2 days ago
@ShamisenExpert You can definitely have mutliline text in nodes, you only need to specify the alignment. I added examples with
align=center
to the answer.– marmot
2 days ago
add a comment |
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
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f459663%2fhow-to-draw-arrows-from-floating-text-into-a-picture-in-beamer%23new-answer', 'question_page');
}
);
Post as a guest
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
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
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
1
see tex.stackexchange.com/questions/457969/… or tex.stackexchange.com/questions/186389/…
– samcarter
2 days ago