Problem of using Tikz in beamer presentation
Clash Royale CLAN TAG#URR8PPP
up vote
4
down vote
favorite
I used Tikz to draw some specific shapes on a matrix, this the MWE that I am using:
documentclassarticle
usepackagetikz
usetikzlibrarymatrix,decorations.pathreplacing
pgfkeystikz/mymatrixenv/.style=decoration=brace,every left delimiter/.style=xshift=4pt,every right delimiter/.style=xshift=-4pt
pgfkeystikz/mymatrix/.style=matrix of math nodes,left delimiter=[,right delimiter=],inner sep=1pt,row sep=0em,column sep=0em,nodes=inner sep=6pt
begindocument
begintikzpicture[baseline=0cm,mymatrixenv]
matrix [mymatrix,text width=0.6em,align=center] (m)
a & b & c \
d & e & f \
g & h & i \
;
pgfmathsetmacrooffset0.5mm
draw [thick,blue,rounded corners=1mm] (m-1-1.west) |- (m-3-3.south) -- cycle;
draw [thick,red,rounded corners=1mm] (m-1-1.north) -| (m-3-3.east) -- cycle;
draw [thick,green,rounded corners=1mm] ([yshift=offset]m-1-1.west) -- ([xshift=-offset]m-1-1.north) -- ([yshift=-offset]m-3-3.east) -- ([xshift=offset]m-3-3.south) -- cycle;
endtikzpicture
enddocument
Result:
but when I tried this code in a beamer presentation (theme: Warsaw) I get this:
What's wrong and how can I fix it?
tikz-pgf beamer matrices tikz-matrix
add a comment |Â
up vote
4
down vote
favorite
I used Tikz to draw some specific shapes on a matrix, this the MWE that I am using:
documentclassarticle
usepackagetikz
usetikzlibrarymatrix,decorations.pathreplacing
pgfkeystikz/mymatrixenv/.style=decoration=brace,every left delimiter/.style=xshift=4pt,every right delimiter/.style=xshift=-4pt
pgfkeystikz/mymatrix/.style=matrix of math nodes,left delimiter=[,right delimiter=],inner sep=1pt,row sep=0em,column sep=0em,nodes=inner sep=6pt
begindocument
begintikzpicture[baseline=0cm,mymatrixenv]
matrix [mymatrix,text width=0.6em,align=center] (m)
a & b & c \
d & e & f \
g & h & i \
;
pgfmathsetmacrooffset0.5mm
draw [thick,blue,rounded corners=1mm] (m-1-1.west) |- (m-3-3.south) -- cycle;
draw [thick,red,rounded corners=1mm] (m-1-1.north) -| (m-3-3.east) -- cycle;
draw [thick,green,rounded corners=1mm] ([yshift=offset]m-1-1.west) -- ([xshift=-offset]m-1-1.north) -- ([yshift=-offset]m-3-3.east) -- ([xshift=offset]m-3-3.south) -- cycle;
endtikzpicture
enddocument
Result:
but when I tried this code in a beamer presentation (theme: Warsaw) I get this:
What's wrong and how can I fix it?
tikz-pgf beamer matrices tikz-matrix
Please provide a full minimal example of the beamer use (that makes it much faster for others to test and suggest solutions)
– daleif
Aug 12 at 12:10
Tested withdocumentclassbeamer usethemeWarsaw
and works fine on share latex... may be you need a second run if didn't tried
– koleygr
Aug 12 at 12:40
I think it would be appropriate if you mentioned that you got that nice code from here.
– marmot
Aug 12 at 15:51
add a comment |Â
up vote
4
down vote
favorite
up vote
4
down vote
favorite
I used Tikz to draw some specific shapes on a matrix, this the MWE that I am using:
documentclassarticle
usepackagetikz
usetikzlibrarymatrix,decorations.pathreplacing
pgfkeystikz/mymatrixenv/.style=decoration=brace,every left delimiter/.style=xshift=4pt,every right delimiter/.style=xshift=-4pt
pgfkeystikz/mymatrix/.style=matrix of math nodes,left delimiter=[,right delimiter=],inner sep=1pt,row sep=0em,column sep=0em,nodes=inner sep=6pt
begindocument
begintikzpicture[baseline=0cm,mymatrixenv]
matrix [mymatrix,text width=0.6em,align=center] (m)
a & b & c \
d & e & f \
g & h & i \
;
pgfmathsetmacrooffset0.5mm
draw [thick,blue,rounded corners=1mm] (m-1-1.west) |- (m-3-3.south) -- cycle;
draw [thick,red,rounded corners=1mm] (m-1-1.north) -| (m-3-3.east) -- cycle;
draw [thick,green,rounded corners=1mm] ([yshift=offset]m-1-1.west) -- ([xshift=-offset]m-1-1.north) -- ([yshift=-offset]m-3-3.east) -- ([xshift=offset]m-3-3.south) -- cycle;
endtikzpicture
enddocument
Result:
but when I tried this code in a beamer presentation (theme: Warsaw) I get this:
What's wrong and how can I fix it?
tikz-pgf beamer matrices tikz-matrix
I used Tikz to draw some specific shapes on a matrix, this the MWE that I am using:
documentclassarticle
usepackagetikz
usetikzlibrarymatrix,decorations.pathreplacing
pgfkeystikz/mymatrixenv/.style=decoration=brace,every left delimiter/.style=xshift=4pt,every right delimiter/.style=xshift=-4pt
pgfkeystikz/mymatrix/.style=matrix of math nodes,left delimiter=[,right delimiter=],inner sep=1pt,row sep=0em,column sep=0em,nodes=inner sep=6pt
begindocument
begintikzpicture[baseline=0cm,mymatrixenv]
matrix [mymatrix,text width=0.6em,align=center] (m)
a & b & c \
d & e & f \
g & h & i \
;
pgfmathsetmacrooffset0.5mm
draw [thick,blue,rounded corners=1mm] (m-1-1.west) |- (m-3-3.south) -- cycle;
draw [thick,red,rounded corners=1mm] (m-1-1.north) -| (m-3-3.east) -- cycle;
draw [thick,green,rounded corners=1mm] ([yshift=offset]m-1-1.west) -- ([xshift=-offset]m-1-1.north) -- ([yshift=-offset]m-3-3.east) -- ([xshift=offset]m-3-3.south) -- cycle;
endtikzpicture
enddocument
Result:
but when I tried this code in a beamer presentation (theme: Warsaw) I get this:
What's wrong and how can I fix it?
tikz-pgf beamer matrices tikz-matrix
edited Aug 12 at 12:15


samcarter
74.1k784238
74.1k784238
asked Aug 12 at 12:04
user137684
374129
374129
Please provide a full minimal example of the beamer use (that makes it much faster for others to test and suggest solutions)
– daleif
Aug 12 at 12:10
Tested withdocumentclassbeamer usethemeWarsaw
and works fine on share latex... may be you need a second run if didn't tried
– koleygr
Aug 12 at 12:40
I think it would be appropriate if you mentioned that you got that nice code from here.
– marmot
Aug 12 at 15:51
add a comment |Â
Please provide a full minimal example of the beamer use (that makes it much faster for others to test and suggest solutions)
– daleif
Aug 12 at 12:10
Tested withdocumentclassbeamer usethemeWarsaw
and works fine on share latex... may be you need a second run if didn't tried
– koleygr
Aug 12 at 12:40
I think it would be appropriate if you mentioned that you got that nice code from here.
– marmot
Aug 12 at 15:51
Please provide a full minimal example of the beamer use (that makes it much faster for others to test and suggest solutions)
– daleif
Aug 12 at 12:10
Please provide a full minimal example of the beamer use (that makes it much faster for others to test and suggest solutions)
– daleif
Aug 12 at 12:10
Tested with
documentclassbeamer usethemeWarsaw
and works fine on share latex... may be you need a second run if didn't tried– koleygr
Aug 12 at 12:40
Tested with
documentclassbeamer usethemeWarsaw
and works fine on share latex... may be you need a second run if didn't tried– koleygr
Aug 12 at 12:40
I think it would be appropriate if you mentioned that you got that nice code from here.
– marmot
Aug 12 at 15:51
I think it would be appropriate if you mentioned that you got that nice code from here.
– marmot
Aug 12 at 15:51
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
10
down vote
accepted
You need to use a fragile
frame:
documentclassbeamer
usepackagetikz
usetikzlibrarymatrix,decorations.pathreplacing
pgfkeystikz/mymatrixenv/.style=decoration=brace,every left delimiter/.style=xshift=4pt,every right delimiter/.style=xshift=-4pt
pgfkeystikz/mymatrix/.style=matrix of math nodes,left delimiter=[,right delimiter=],inner sep=1pt,row sep=0em,column sep=0em,nodes=inner sep=6pt
begindocument
beginframe[fragile]
begintikzpicture[baseline=0cm,mymatrixenv]
matrix [mymatrix,text width=0.6em,align=center] (m)
a & b & c \
d & e & f \
g & h & i \
;
pgfmathsetmacrooffset0.5mm
draw [thick,blue,rounded corners=1mm] (m-1-1.west) |- (m-3-3.south) -- cycle;
draw [thick,red,rounded corners=1mm] (m-1-1.north) -| (m-3-3.east) -- cycle;
draw [thick,green,rounded corners=1mm] ([yshift=offset]m-1-1.west) -- ([xshift=-offset]m-1-1.north) -- ([yshift=-offset]m-3-3.east) -- ([xshift=offset]m-3-3.south) -- cycle;
endtikzpicture
endframe
enddocument
Do you have a slight idea what difference the option fragile makes (internally)?
– Dr. Manuel Kuehner
Aug 12 at 13:30
1
@Dr.ManuelKuehner Only a very rough idea. It more or less treats the content of the frame as verbatim material and limits the amount of processing which is normally done. For tikz the most noticeable effect is that tikz can still use one#
. Without the fragile option one would need###
.
– samcarter
Aug 12 at 14:15
Thanks! That helps. Wouldn't it be a a good idea then, to set fragile as the standard frame option? Apart from a maybe slower compilation process. Or is this rather a own question?
– Dr. Manuel Kuehner
Aug 12 at 17:22
1
@Dr.ManuelKuehner No. Having fragile as standard option causes quite some problems. It should only be used if necessary.
– samcarter
Aug 12 at 18:41
1
@Dr.ManuelKuehner To give a few examples: it interact badly with other options likeshrink
orallowframebreaks
.
– samcarter
Aug 13 at 13:57
 |Â
show 1 more comment
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
10
down vote
accepted
You need to use a fragile
frame:
documentclassbeamer
usepackagetikz
usetikzlibrarymatrix,decorations.pathreplacing
pgfkeystikz/mymatrixenv/.style=decoration=brace,every left delimiter/.style=xshift=4pt,every right delimiter/.style=xshift=-4pt
pgfkeystikz/mymatrix/.style=matrix of math nodes,left delimiter=[,right delimiter=],inner sep=1pt,row sep=0em,column sep=0em,nodes=inner sep=6pt
begindocument
beginframe[fragile]
begintikzpicture[baseline=0cm,mymatrixenv]
matrix [mymatrix,text width=0.6em,align=center] (m)
a & b & c \
d & e & f \
g & h & i \
;
pgfmathsetmacrooffset0.5mm
draw [thick,blue,rounded corners=1mm] (m-1-1.west) |- (m-3-3.south) -- cycle;
draw [thick,red,rounded corners=1mm] (m-1-1.north) -| (m-3-3.east) -- cycle;
draw [thick,green,rounded corners=1mm] ([yshift=offset]m-1-1.west) -- ([xshift=-offset]m-1-1.north) -- ([yshift=-offset]m-3-3.east) -- ([xshift=offset]m-3-3.south) -- cycle;
endtikzpicture
endframe
enddocument
Do you have a slight idea what difference the option fragile makes (internally)?
– Dr. Manuel Kuehner
Aug 12 at 13:30
1
@Dr.ManuelKuehner Only a very rough idea. It more or less treats the content of the frame as verbatim material and limits the amount of processing which is normally done. For tikz the most noticeable effect is that tikz can still use one#
. Without the fragile option one would need###
.
– samcarter
Aug 12 at 14:15
Thanks! That helps. Wouldn't it be a a good idea then, to set fragile as the standard frame option? Apart from a maybe slower compilation process. Or is this rather a own question?
– Dr. Manuel Kuehner
Aug 12 at 17:22
1
@Dr.ManuelKuehner No. Having fragile as standard option causes quite some problems. It should only be used if necessary.
– samcarter
Aug 12 at 18:41
1
@Dr.ManuelKuehner To give a few examples: it interact badly with other options likeshrink
orallowframebreaks
.
– samcarter
Aug 13 at 13:57
 |Â
show 1 more comment
up vote
10
down vote
accepted
You need to use a fragile
frame:
documentclassbeamer
usepackagetikz
usetikzlibrarymatrix,decorations.pathreplacing
pgfkeystikz/mymatrixenv/.style=decoration=brace,every left delimiter/.style=xshift=4pt,every right delimiter/.style=xshift=-4pt
pgfkeystikz/mymatrix/.style=matrix of math nodes,left delimiter=[,right delimiter=],inner sep=1pt,row sep=0em,column sep=0em,nodes=inner sep=6pt
begindocument
beginframe[fragile]
begintikzpicture[baseline=0cm,mymatrixenv]
matrix [mymatrix,text width=0.6em,align=center] (m)
a & b & c \
d & e & f \
g & h & i \
;
pgfmathsetmacrooffset0.5mm
draw [thick,blue,rounded corners=1mm] (m-1-1.west) |- (m-3-3.south) -- cycle;
draw [thick,red,rounded corners=1mm] (m-1-1.north) -| (m-3-3.east) -- cycle;
draw [thick,green,rounded corners=1mm] ([yshift=offset]m-1-1.west) -- ([xshift=-offset]m-1-1.north) -- ([yshift=-offset]m-3-3.east) -- ([xshift=offset]m-3-3.south) -- cycle;
endtikzpicture
endframe
enddocument
Do you have a slight idea what difference the option fragile makes (internally)?
– Dr. Manuel Kuehner
Aug 12 at 13:30
1
@Dr.ManuelKuehner Only a very rough idea. It more or less treats the content of the frame as verbatim material and limits the amount of processing which is normally done. For tikz the most noticeable effect is that tikz can still use one#
. Without the fragile option one would need###
.
– samcarter
Aug 12 at 14:15
Thanks! That helps. Wouldn't it be a a good idea then, to set fragile as the standard frame option? Apart from a maybe slower compilation process. Or is this rather a own question?
– Dr. Manuel Kuehner
Aug 12 at 17:22
1
@Dr.ManuelKuehner No. Having fragile as standard option causes quite some problems. It should only be used if necessary.
– samcarter
Aug 12 at 18:41
1
@Dr.ManuelKuehner To give a few examples: it interact badly with other options likeshrink
orallowframebreaks
.
– samcarter
Aug 13 at 13:57
 |Â
show 1 more comment
up vote
10
down vote
accepted
up vote
10
down vote
accepted
You need to use a fragile
frame:
documentclassbeamer
usepackagetikz
usetikzlibrarymatrix,decorations.pathreplacing
pgfkeystikz/mymatrixenv/.style=decoration=brace,every left delimiter/.style=xshift=4pt,every right delimiter/.style=xshift=-4pt
pgfkeystikz/mymatrix/.style=matrix of math nodes,left delimiter=[,right delimiter=],inner sep=1pt,row sep=0em,column sep=0em,nodes=inner sep=6pt
begindocument
beginframe[fragile]
begintikzpicture[baseline=0cm,mymatrixenv]
matrix [mymatrix,text width=0.6em,align=center] (m)
a & b & c \
d & e & f \
g & h & i \
;
pgfmathsetmacrooffset0.5mm
draw [thick,blue,rounded corners=1mm] (m-1-1.west) |- (m-3-3.south) -- cycle;
draw [thick,red,rounded corners=1mm] (m-1-1.north) -| (m-3-3.east) -- cycle;
draw [thick,green,rounded corners=1mm] ([yshift=offset]m-1-1.west) -- ([xshift=-offset]m-1-1.north) -- ([yshift=-offset]m-3-3.east) -- ([xshift=offset]m-3-3.south) -- cycle;
endtikzpicture
endframe
enddocument
You need to use a fragile
frame:
documentclassbeamer
usepackagetikz
usetikzlibrarymatrix,decorations.pathreplacing
pgfkeystikz/mymatrixenv/.style=decoration=brace,every left delimiter/.style=xshift=4pt,every right delimiter/.style=xshift=-4pt
pgfkeystikz/mymatrix/.style=matrix of math nodes,left delimiter=[,right delimiter=],inner sep=1pt,row sep=0em,column sep=0em,nodes=inner sep=6pt
begindocument
beginframe[fragile]
begintikzpicture[baseline=0cm,mymatrixenv]
matrix [mymatrix,text width=0.6em,align=center] (m)
a & b & c \
d & e & f \
g & h & i \
;
pgfmathsetmacrooffset0.5mm
draw [thick,blue,rounded corners=1mm] (m-1-1.west) |- (m-3-3.south) -- cycle;
draw [thick,red,rounded corners=1mm] (m-1-1.north) -| (m-3-3.east) -- cycle;
draw [thick,green,rounded corners=1mm] ([yshift=offset]m-1-1.west) -- ([xshift=-offset]m-1-1.north) -- ([yshift=-offset]m-3-3.east) -- ([xshift=offset]m-3-3.south) -- cycle;
endtikzpicture
endframe
enddocument
answered Aug 12 at 12:13


samcarter
74.1k784238
74.1k784238
Do you have a slight idea what difference the option fragile makes (internally)?
– Dr. Manuel Kuehner
Aug 12 at 13:30
1
@Dr.ManuelKuehner Only a very rough idea. It more or less treats the content of the frame as verbatim material and limits the amount of processing which is normally done. For tikz the most noticeable effect is that tikz can still use one#
. Without the fragile option one would need###
.
– samcarter
Aug 12 at 14:15
Thanks! That helps. Wouldn't it be a a good idea then, to set fragile as the standard frame option? Apart from a maybe slower compilation process. Or is this rather a own question?
– Dr. Manuel Kuehner
Aug 12 at 17:22
1
@Dr.ManuelKuehner No. Having fragile as standard option causes quite some problems. It should only be used if necessary.
– samcarter
Aug 12 at 18:41
1
@Dr.ManuelKuehner To give a few examples: it interact badly with other options likeshrink
orallowframebreaks
.
– samcarter
Aug 13 at 13:57
 |Â
show 1 more comment
Do you have a slight idea what difference the option fragile makes (internally)?
– Dr. Manuel Kuehner
Aug 12 at 13:30
1
@Dr.ManuelKuehner Only a very rough idea. It more or less treats the content of the frame as verbatim material and limits the amount of processing which is normally done. For tikz the most noticeable effect is that tikz can still use one#
. Without the fragile option one would need###
.
– samcarter
Aug 12 at 14:15
Thanks! That helps. Wouldn't it be a a good idea then, to set fragile as the standard frame option? Apart from a maybe slower compilation process. Or is this rather a own question?
– Dr. Manuel Kuehner
Aug 12 at 17:22
1
@Dr.ManuelKuehner No. Having fragile as standard option causes quite some problems. It should only be used if necessary.
– samcarter
Aug 12 at 18:41
1
@Dr.ManuelKuehner To give a few examples: it interact badly with other options likeshrink
orallowframebreaks
.
– samcarter
Aug 13 at 13:57
Do you have a slight idea what difference the option fragile makes (internally)?
– Dr. Manuel Kuehner
Aug 12 at 13:30
Do you have a slight idea what difference the option fragile makes (internally)?
– Dr. Manuel Kuehner
Aug 12 at 13:30
1
1
@Dr.ManuelKuehner Only a very rough idea. It more or less treats the content of the frame as verbatim material and limits the amount of processing which is normally done. For tikz the most noticeable effect is that tikz can still use one
#
. Without the fragile option one would need ###
.– samcarter
Aug 12 at 14:15
@Dr.ManuelKuehner Only a very rough idea. It more or less treats the content of the frame as verbatim material and limits the amount of processing which is normally done. For tikz the most noticeable effect is that tikz can still use one
#
. Without the fragile option one would need ###
.– samcarter
Aug 12 at 14:15
Thanks! That helps. Wouldn't it be a a good idea then, to set fragile as the standard frame option? Apart from a maybe slower compilation process. Or is this rather a own question?
– Dr. Manuel Kuehner
Aug 12 at 17:22
Thanks! That helps. Wouldn't it be a a good idea then, to set fragile as the standard frame option? Apart from a maybe slower compilation process. Or is this rather a own question?
– Dr. Manuel Kuehner
Aug 12 at 17:22
1
1
@Dr.ManuelKuehner No. Having fragile as standard option causes quite some problems. It should only be used if necessary.
– samcarter
Aug 12 at 18:41
@Dr.ManuelKuehner No. Having fragile as standard option causes quite some problems. It should only be used if necessary.
– samcarter
Aug 12 at 18:41
1
1
@Dr.ManuelKuehner To give a few examples: it interact badly with other options like
shrink
or allowframebreaks
.– samcarter
Aug 13 at 13:57
@Dr.ManuelKuehner To give a few examples: it interact badly with other options like
shrink
or allowframebreaks
.– samcarter
Aug 13 at 13:57
 |Â
show 1 more 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%2f445750%2fproblem-of-using-tikz-in-beamer-presentation%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
Please provide a full minimal example of the beamer use (that makes it much faster for others to test and suggest solutions)
– daleif
Aug 12 at 12:10
Tested with
documentclassbeamer usethemeWarsaw
and works fine on share latex... may be you need a second run if didn't tried– koleygr
Aug 12 at 12:40
I think it would be appropriate if you mentioned that you got that nice code from here.
– marmot
Aug 12 at 15:51