Tikzcd in beamer not workingDrawbacks of using fragile frames in beamerCross over of arrows in a complex...
Infestation of Locust borers on Black locust tree. Too late for it?
Maze generator & animator in Python
What happens when a file that is 100% paged in to the page cache gets modified by another process
Why can't we generate electricity from Earth's electric field?
UK citizen travelling to France at the end of November
Why should I always enable compiler warnings?
How strong is aircraft-grade spruce?
Short story: Interstellar inspector senses "off" nature of planet hiding aggressive culture
What is this sticking out of my wall?
Is it unavoidable taking shortcuts in software development sometimes?
How is lower/no gravity simulated on a planet with gravity, without leaving the surface?
Is there a star over my head?
Gap in tcolorbox after title
Determining System Regular Expression Library
How do Scrum teams manage their dependencies on other teams?
Why was "leaping into the river" a valid trial outcome to prove one's innocence?
Train between Vienna airport and city center
How can faith be maintained in a world of living gods?
More than three domains hosted on the same IP address
Why is it that I have to play this note on the piano as A sharp?
Bit floating sequence
Chandrayaan 2: Why is Vikram Lander's life limited to 14 Days?
The speed of a boat is 5Km/h in still water. It crosses a river of width 1km along the shortest path in 15 minutes.
How should we understand "unobscured by flying friends" in this context?
Tikzcd in beamer not working
Drawbacks of using fragile frames in beamerCross over of arrows in a complex diagramNumerical conditional within tikz keys?The onslide command in beamer with tikzcdtikzcd error with [ ]tikzcd, arrows not nicely alignedLaTeX beamer: pagenumbering appendixDouble arrows in tikzcdtikz cd not working in beamer
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
Currently I am trying to create a presentation with tikzcd
using the TeXWorks Editor. Apparently, my computer does not recognize the command arrow
in the way I would need it to work with tikzcd
(only a theory). Frankly speaking, it looks like my computer has problems with the tikzcd
package at all.
This is working (well, if you want to call this working...)
documentclass{beamer}
usetheme[width=2.18cm]{PaloAlto}
usefonttheme{serif}
usepackage{tikz, tikz-cd}
usetikzlibrary{arrows,shapes,cd}
begin{document}
begin{frame}{Not important}
framesubtitle{Neither important}
$begin{tikzcd}
end{tikzcd}$
end{frame}
end{document}
But as soon as I insert something marginal useful (e.g. A&B
, while a single A
is working...), I get an undefined control sequence referring to end{frame}
. I want to include something like this
I feel like I missing an important point, even though I copied the code given above straight from here. What could be wrong and more importantly: how do I fix this?
Thanks in advance!
beamer tikz-cd texworks
New contributor
add a comment |
Currently I am trying to create a presentation with tikzcd
using the TeXWorks Editor. Apparently, my computer does not recognize the command arrow
in the way I would need it to work with tikzcd
(only a theory). Frankly speaking, it looks like my computer has problems with the tikzcd
package at all.
This is working (well, if you want to call this working...)
documentclass{beamer}
usetheme[width=2.18cm]{PaloAlto}
usefonttheme{serif}
usepackage{tikz, tikz-cd}
usetikzlibrary{arrows,shapes,cd}
begin{document}
begin{frame}{Not important}
framesubtitle{Neither important}
$begin{tikzcd}
end{tikzcd}$
end{frame}
end{document}
But as soon as I insert something marginal useful (e.g. A&B
, while a single A
is working...), I get an undefined control sequence referring to end{frame}
. I want to include something like this
I feel like I missing an important point, even though I copied the code given above straight from here. What could be wrong and more importantly: how do I fix this?
Thanks in advance!
beamer tikz-cd texworks
New contributor
add a comment |
Currently I am trying to create a presentation with tikzcd
using the TeXWorks Editor. Apparently, my computer does not recognize the command arrow
in the way I would need it to work with tikzcd
(only a theory). Frankly speaking, it looks like my computer has problems with the tikzcd
package at all.
This is working (well, if you want to call this working...)
documentclass{beamer}
usetheme[width=2.18cm]{PaloAlto}
usefonttheme{serif}
usepackage{tikz, tikz-cd}
usetikzlibrary{arrows,shapes,cd}
begin{document}
begin{frame}{Not important}
framesubtitle{Neither important}
$begin{tikzcd}
end{tikzcd}$
end{frame}
end{document}
But as soon as I insert something marginal useful (e.g. A&B
, while a single A
is working...), I get an undefined control sequence referring to end{frame}
. I want to include something like this
I feel like I missing an important point, even though I copied the code given above straight from here. What could be wrong and more importantly: how do I fix this?
Thanks in advance!
beamer tikz-cd texworks
New contributor
Currently I am trying to create a presentation with tikzcd
using the TeXWorks Editor. Apparently, my computer does not recognize the command arrow
in the way I would need it to work with tikzcd
(only a theory). Frankly speaking, it looks like my computer has problems with the tikzcd
package at all.
This is working (well, if you want to call this working...)
documentclass{beamer}
usetheme[width=2.18cm]{PaloAlto}
usefonttheme{serif}
usepackage{tikz, tikz-cd}
usetikzlibrary{arrows,shapes,cd}
begin{document}
begin{frame}{Not important}
framesubtitle{Neither important}
$begin{tikzcd}
end{tikzcd}$
end{frame}
end{document}
But as soon as I insert something marginal useful (e.g. A&B
, while a single A
is working...), I get an undefined control sequence referring to end{frame}
. I want to include something like this
I feel like I missing an important point, even though I copied the code given above straight from here. What could be wrong and more importantly: how do I fix this?
Thanks in advance!
beamer tikz-cd texworks
beamer tikz-cd texworks
New contributor
New contributor
edited 6 hours ago
BambOo
3,4681 gold badge6 silver badges31 bronze badges
3,4681 gold badge6 silver badges31 bronze badges
New contributor
asked 8 hours ago
mrtaurhomrtaurho
1164 bronze badges
1164 bronze badges
New contributor
New contributor
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
This is a known problem: when a tikzcd
is inside the argument to another command, &
cannot be used; there's a handy workaround, though.
documentclass{beamer}
usetheme[width=2.18cm]{PaloAlto}
usefonttheme{serif}
usepackage{tikz, tikz-cd}
usetikzlibrary{arrows,shapes,cd}
begin{document}
begin{frame}{Not important}
framesubtitle{Neither important}
begin{tikzcd}[ampersand replacement=&,column sep=4em]
mathcal{C} arrow[r, bend left=30, "F"{name=U}]
arrow[r, bend right=30, "G"'{name=D}]
& mathcal{D}
arrow[Rightarrow, from=U, to=D,shorten=4pt,"omega"]
end{tikzcd}
end{frame}
end{document}
Hi, but usingxy
package (xymatrix
), is there the same problem?
– Sebastiano
3 hours ago
1
@Sebastiano No, as far as I know.
– egreg
2 hours ago
add a comment |
Questions of this type have been asked here before, but I could not find any answer with an explanation (which is most likely my fault). Anyway, here we go. In section 8 Creating Frames of the beamer
manual version 3.56 it is stated that (I highlighted the important part)
The environment contents can be normal LATEX text, but may not contain
verb commands or verbatim environments or any environment that
changes the character codes, unless the fragile option is given.
It also says on p. 61
If a frame contains fragile text, different internal mechanisms are
used to typeset the frame to ensure that inside the frame the
character codes can be reset. The price of switching to another
internal mechanism is that either you cannot use overlays or an
external file needs to be written and read back (which is not always
desirable).
In any case, since tikz-cd
does change some character codes, we need to add fragile
. (As a rule of thumb, whenever something does not work in beamer
which works fine elsewhere, it is worthwhile adding the fragile
key and check whether or not this solves the problem. Some of the drawbacks of using fragile
are discussed in this thread.)
I also used the opportunity to typeset the diagram, in which the execute at end picture
key is used to connect the two edge labels, which attained names with the alias
key.
documentclass{beamer}
usetheme[width=2.18cm]{PaloAlto}
usefonttheme{serif}
usepackage{tikz-cd}
begin{document}
begin{frame}[fragile]
frametitle{Not important}
framesubtitle{Neither important}
$begin{tikzcd}[execute at end picture={
path (F) edge[double equal sign distance, -Implies,"$omega$",
shorten >=2pt,shorten <=2pt] (G);}]
mathcal{C} arrow[r,bend left,"F" {alias=F}]
arrow[r,bend right,"G" {swap,alias=G}]& mathcal{D}
\
end{tikzcd}$
end{frame}
end{document}
ADDENDUM: It has been suggested that the ampersand is the problem. I disagree with that statement. E.g.
begin{frame}
frametitle{The ampersand per se is not the problem}
begin{tabular}{ccc}
a & b & c\
end{tabular}
end{frame}
does work. It is the line catcode
&=13that can be found in
tikz.code.tex. It is true, though, that ampersand replacement is another way to solve the problem. I also want to add that I was using
execute at end picturefor a reason. Even though there are seemingly simpler ways, they do not allow you to control the order in which the arrows are placed because
tikz-cd` collects them internally and draws them in an order that we cannot control. Here it does not matter, but you can find here an example where it does.
Again, thank you! I'll wait before accepting your answer to see if someone else has some improvements to offer or even an alternative :)
– mrtaurho
6 hours ago
@mrtaurho What kind of improvement are you after? To me the diagram looks fine (also because you do not overload it), what I would probably do is to make it larger, e.g.[begin{tikzcd}[column sep=6em,execute at end picture={ path (F) edge[double equal sign distance, -Implies,"$omega$", shorten >=2pt,shorten <=2pt] (G);}] mathcal{C} arrow[r,bend left,"F" {alias=F}] arrow[r,bend right,"G" {swap,alias=G}]& mathcal{D} \ end{tikzcd}]
, which also uses an equation environment. (I usefragile
all the time and there is IMHO no real downside to it.)
– Schrödinger's cat
6 hours ago
It has been suggested that the ampersand is the problem. I disagree with that statement. E.g.begin{frame} frametitle{The ampersand per se is not the problem} begin{tabular}{ccc} a & b & c\ end{tabular} end{frame}
does work. It is the linecatcode`&=13
that can be found intikz.code.tex
. It is true, though, thatampersand replacement
is another way to solve the problem.
– Schrödinger's cat
2 hours ago
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/4.0/"u003ecc by-sa 4.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
});
}
});
mrtaurho is a new contributor. Be nice, and check out our Code of Conduct.
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%2f507508%2ftikzcd-in-beamer-not-working%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
This is a known problem: when a tikzcd
is inside the argument to another command, &
cannot be used; there's a handy workaround, though.
documentclass{beamer}
usetheme[width=2.18cm]{PaloAlto}
usefonttheme{serif}
usepackage{tikz, tikz-cd}
usetikzlibrary{arrows,shapes,cd}
begin{document}
begin{frame}{Not important}
framesubtitle{Neither important}
begin{tikzcd}[ampersand replacement=&,column sep=4em]
mathcal{C} arrow[r, bend left=30, "F"{name=U}]
arrow[r, bend right=30, "G"'{name=D}]
& mathcal{D}
arrow[Rightarrow, from=U, to=D,shorten=4pt,"omega"]
end{tikzcd}
end{frame}
end{document}
Hi, but usingxy
package (xymatrix
), is there the same problem?
– Sebastiano
3 hours ago
1
@Sebastiano No, as far as I know.
– egreg
2 hours ago
add a comment |
This is a known problem: when a tikzcd
is inside the argument to another command, &
cannot be used; there's a handy workaround, though.
documentclass{beamer}
usetheme[width=2.18cm]{PaloAlto}
usefonttheme{serif}
usepackage{tikz, tikz-cd}
usetikzlibrary{arrows,shapes,cd}
begin{document}
begin{frame}{Not important}
framesubtitle{Neither important}
begin{tikzcd}[ampersand replacement=&,column sep=4em]
mathcal{C} arrow[r, bend left=30, "F"{name=U}]
arrow[r, bend right=30, "G"'{name=D}]
& mathcal{D}
arrow[Rightarrow, from=U, to=D,shorten=4pt,"omega"]
end{tikzcd}
end{frame}
end{document}
Hi, but usingxy
package (xymatrix
), is there the same problem?
– Sebastiano
3 hours ago
1
@Sebastiano No, as far as I know.
– egreg
2 hours ago
add a comment |
This is a known problem: when a tikzcd
is inside the argument to another command, &
cannot be used; there's a handy workaround, though.
documentclass{beamer}
usetheme[width=2.18cm]{PaloAlto}
usefonttheme{serif}
usepackage{tikz, tikz-cd}
usetikzlibrary{arrows,shapes,cd}
begin{document}
begin{frame}{Not important}
framesubtitle{Neither important}
begin{tikzcd}[ampersand replacement=&,column sep=4em]
mathcal{C} arrow[r, bend left=30, "F"{name=U}]
arrow[r, bend right=30, "G"'{name=D}]
& mathcal{D}
arrow[Rightarrow, from=U, to=D,shorten=4pt,"omega"]
end{tikzcd}
end{frame}
end{document}
This is a known problem: when a tikzcd
is inside the argument to another command, &
cannot be used; there's a handy workaround, though.
documentclass{beamer}
usetheme[width=2.18cm]{PaloAlto}
usefonttheme{serif}
usepackage{tikz, tikz-cd}
usetikzlibrary{arrows,shapes,cd}
begin{document}
begin{frame}{Not important}
framesubtitle{Neither important}
begin{tikzcd}[ampersand replacement=&,column sep=4em]
mathcal{C} arrow[r, bend left=30, "F"{name=U}]
arrow[r, bend right=30, "G"'{name=D}]
& mathcal{D}
arrow[Rightarrow, from=U, to=D,shorten=4pt,"omega"]
end{tikzcd}
end{frame}
end{document}
answered 5 hours ago
egregegreg
767k91 gold badges2002 silver badges3358 bronze badges
767k91 gold badges2002 silver badges3358 bronze badges
Hi, but usingxy
package (xymatrix
), is there the same problem?
– Sebastiano
3 hours ago
1
@Sebastiano No, as far as I know.
– egreg
2 hours ago
add a comment |
Hi, but usingxy
package (xymatrix
), is there the same problem?
– Sebastiano
3 hours ago
1
@Sebastiano No, as far as I know.
– egreg
2 hours ago
Hi, but using
xy
package (xymatrix
), is there the same problem?– Sebastiano
3 hours ago
Hi, but using
xy
package (xymatrix
), is there the same problem?– Sebastiano
3 hours ago
1
1
@Sebastiano No, as far as I know.
– egreg
2 hours ago
@Sebastiano No, as far as I know.
– egreg
2 hours ago
add a comment |
Questions of this type have been asked here before, but I could not find any answer with an explanation (which is most likely my fault). Anyway, here we go. In section 8 Creating Frames of the beamer
manual version 3.56 it is stated that (I highlighted the important part)
The environment contents can be normal LATEX text, but may not contain
verb commands or verbatim environments or any environment that
changes the character codes, unless the fragile option is given.
It also says on p. 61
If a frame contains fragile text, different internal mechanisms are
used to typeset the frame to ensure that inside the frame the
character codes can be reset. The price of switching to another
internal mechanism is that either you cannot use overlays or an
external file needs to be written and read back (which is not always
desirable).
In any case, since tikz-cd
does change some character codes, we need to add fragile
. (As a rule of thumb, whenever something does not work in beamer
which works fine elsewhere, it is worthwhile adding the fragile
key and check whether or not this solves the problem. Some of the drawbacks of using fragile
are discussed in this thread.)
I also used the opportunity to typeset the diagram, in which the execute at end picture
key is used to connect the two edge labels, which attained names with the alias
key.
documentclass{beamer}
usetheme[width=2.18cm]{PaloAlto}
usefonttheme{serif}
usepackage{tikz-cd}
begin{document}
begin{frame}[fragile]
frametitle{Not important}
framesubtitle{Neither important}
$begin{tikzcd}[execute at end picture={
path (F) edge[double equal sign distance, -Implies,"$omega$",
shorten >=2pt,shorten <=2pt] (G);}]
mathcal{C} arrow[r,bend left,"F" {alias=F}]
arrow[r,bend right,"G" {swap,alias=G}]& mathcal{D}
\
end{tikzcd}$
end{frame}
end{document}
ADDENDUM: It has been suggested that the ampersand is the problem. I disagree with that statement. E.g.
begin{frame}
frametitle{The ampersand per se is not the problem}
begin{tabular}{ccc}
a & b & c\
end{tabular}
end{frame}
does work. It is the line catcode
&=13that can be found in
tikz.code.tex. It is true, though, that ampersand replacement is another way to solve the problem. I also want to add that I was using
execute at end picturefor a reason. Even though there are seemingly simpler ways, they do not allow you to control the order in which the arrows are placed because
tikz-cd` collects them internally and draws them in an order that we cannot control. Here it does not matter, but you can find here an example where it does.
Again, thank you! I'll wait before accepting your answer to see if someone else has some improvements to offer or even an alternative :)
– mrtaurho
6 hours ago
@mrtaurho What kind of improvement are you after? To me the diagram looks fine (also because you do not overload it), what I would probably do is to make it larger, e.g.[begin{tikzcd}[column sep=6em,execute at end picture={ path (F) edge[double equal sign distance, -Implies,"$omega$", shorten >=2pt,shorten <=2pt] (G);}] mathcal{C} arrow[r,bend left,"F" {alias=F}] arrow[r,bend right,"G" {swap,alias=G}]& mathcal{D} \ end{tikzcd}]
, which also uses an equation environment. (I usefragile
all the time and there is IMHO no real downside to it.)
– Schrödinger's cat
6 hours ago
It has been suggested that the ampersand is the problem. I disagree with that statement. E.g.begin{frame} frametitle{The ampersand per se is not the problem} begin{tabular}{ccc} a & b & c\ end{tabular} end{frame}
does work. It is the linecatcode`&=13
that can be found intikz.code.tex
. It is true, though, thatampersand replacement
is another way to solve the problem.
– Schrödinger's cat
2 hours ago
add a comment |
Questions of this type have been asked here before, but I could not find any answer with an explanation (which is most likely my fault). Anyway, here we go. In section 8 Creating Frames of the beamer
manual version 3.56 it is stated that (I highlighted the important part)
The environment contents can be normal LATEX text, but may not contain
verb commands or verbatim environments or any environment that
changes the character codes, unless the fragile option is given.
It also says on p. 61
If a frame contains fragile text, different internal mechanisms are
used to typeset the frame to ensure that inside the frame the
character codes can be reset. The price of switching to another
internal mechanism is that either you cannot use overlays or an
external file needs to be written and read back (which is not always
desirable).
In any case, since tikz-cd
does change some character codes, we need to add fragile
. (As a rule of thumb, whenever something does not work in beamer
which works fine elsewhere, it is worthwhile adding the fragile
key and check whether or not this solves the problem. Some of the drawbacks of using fragile
are discussed in this thread.)
I also used the opportunity to typeset the diagram, in which the execute at end picture
key is used to connect the two edge labels, which attained names with the alias
key.
documentclass{beamer}
usetheme[width=2.18cm]{PaloAlto}
usefonttheme{serif}
usepackage{tikz-cd}
begin{document}
begin{frame}[fragile]
frametitle{Not important}
framesubtitle{Neither important}
$begin{tikzcd}[execute at end picture={
path (F) edge[double equal sign distance, -Implies,"$omega$",
shorten >=2pt,shorten <=2pt] (G);}]
mathcal{C} arrow[r,bend left,"F" {alias=F}]
arrow[r,bend right,"G" {swap,alias=G}]& mathcal{D}
\
end{tikzcd}$
end{frame}
end{document}
ADDENDUM: It has been suggested that the ampersand is the problem. I disagree with that statement. E.g.
begin{frame}
frametitle{The ampersand per se is not the problem}
begin{tabular}{ccc}
a & b & c\
end{tabular}
end{frame}
does work. It is the line catcode
&=13that can be found in
tikz.code.tex. It is true, though, that ampersand replacement is another way to solve the problem. I also want to add that I was using
execute at end picturefor a reason. Even though there are seemingly simpler ways, they do not allow you to control the order in which the arrows are placed because
tikz-cd` collects them internally and draws them in an order that we cannot control. Here it does not matter, but you can find here an example where it does.
Again, thank you! I'll wait before accepting your answer to see if someone else has some improvements to offer or even an alternative :)
– mrtaurho
6 hours ago
@mrtaurho What kind of improvement are you after? To me the diagram looks fine (also because you do not overload it), what I would probably do is to make it larger, e.g.[begin{tikzcd}[column sep=6em,execute at end picture={ path (F) edge[double equal sign distance, -Implies,"$omega$", shorten >=2pt,shorten <=2pt] (G);}] mathcal{C} arrow[r,bend left,"F" {alias=F}] arrow[r,bend right,"G" {swap,alias=G}]& mathcal{D} \ end{tikzcd}]
, which also uses an equation environment. (I usefragile
all the time and there is IMHO no real downside to it.)
– Schrödinger's cat
6 hours ago
It has been suggested that the ampersand is the problem. I disagree with that statement. E.g.begin{frame} frametitle{The ampersand per se is not the problem} begin{tabular}{ccc} a & b & c\ end{tabular} end{frame}
does work. It is the linecatcode`&=13
that can be found intikz.code.tex
. It is true, though, thatampersand replacement
is another way to solve the problem.
– Schrödinger's cat
2 hours ago
add a comment |
Questions of this type have been asked here before, but I could not find any answer with an explanation (which is most likely my fault). Anyway, here we go. In section 8 Creating Frames of the beamer
manual version 3.56 it is stated that (I highlighted the important part)
The environment contents can be normal LATEX text, but may not contain
verb commands or verbatim environments or any environment that
changes the character codes, unless the fragile option is given.
It also says on p. 61
If a frame contains fragile text, different internal mechanisms are
used to typeset the frame to ensure that inside the frame the
character codes can be reset. The price of switching to another
internal mechanism is that either you cannot use overlays or an
external file needs to be written and read back (which is not always
desirable).
In any case, since tikz-cd
does change some character codes, we need to add fragile
. (As a rule of thumb, whenever something does not work in beamer
which works fine elsewhere, it is worthwhile adding the fragile
key and check whether or not this solves the problem. Some of the drawbacks of using fragile
are discussed in this thread.)
I also used the opportunity to typeset the diagram, in which the execute at end picture
key is used to connect the two edge labels, which attained names with the alias
key.
documentclass{beamer}
usetheme[width=2.18cm]{PaloAlto}
usefonttheme{serif}
usepackage{tikz-cd}
begin{document}
begin{frame}[fragile]
frametitle{Not important}
framesubtitle{Neither important}
$begin{tikzcd}[execute at end picture={
path (F) edge[double equal sign distance, -Implies,"$omega$",
shorten >=2pt,shorten <=2pt] (G);}]
mathcal{C} arrow[r,bend left,"F" {alias=F}]
arrow[r,bend right,"G" {swap,alias=G}]& mathcal{D}
\
end{tikzcd}$
end{frame}
end{document}
ADDENDUM: It has been suggested that the ampersand is the problem. I disagree with that statement. E.g.
begin{frame}
frametitle{The ampersand per se is not the problem}
begin{tabular}{ccc}
a & b & c\
end{tabular}
end{frame}
does work. It is the line catcode
&=13that can be found in
tikz.code.tex. It is true, though, that ampersand replacement is another way to solve the problem. I also want to add that I was using
execute at end picturefor a reason. Even though there are seemingly simpler ways, they do not allow you to control the order in which the arrows are placed because
tikz-cd` collects them internally and draws them in an order that we cannot control. Here it does not matter, but you can find here an example where it does.
Questions of this type have been asked here before, but I could not find any answer with an explanation (which is most likely my fault). Anyway, here we go. In section 8 Creating Frames of the beamer
manual version 3.56 it is stated that (I highlighted the important part)
The environment contents can be normal LATEX text, but may not contain
verb commands or verbatim environments or any environment that
changes the character codes, unless the fragile option is given.
It also says on p. 61
If a frame contains fragile text, different internal mechanisms are
used to typeset the frame to ensure that inside the frame the
character codes can be reset. The price of switching to another
internal mechanism is that either you cannot use overlays or an
external file needs to be written and read back (which is not always
desirable).
In any case, since tikz-cd
does change some character codes, we need to add fragile
. (As a rule of thumb, whenever something does not work in beamer
which works fine elsewhere, it is worthwhile adding the fragile
key and check whether or not this solves the problem. Some of the drawbacks of using fragile
are discussed in this thread.)
I also used the opportunity to typeset the diagram, in which the execute at end picture
key is used to connect the two edge labels, which attained names with the alias
key.
documentclass{beamer}
usetheme[width=2.18cm]{PaloAlto}
usefonttheme{serif}
usepackage{tikz-cd}
begin{document}
begin{frame}[fragile]
frametitle{Not important}
framesubtitle{Neither important}
$begin{tikzcd}[execute at end picture={
path (F) edge[double equal sign distance, -Implies,"$omega$",
shorten >=2pt,shorten <=2pt] (G);}]
mathcal{C} arrow[r,bend left,"F" {alias=F}]
arrow[r,bend right,"G" {swap,alias=G}]& mathcal{D}
\
end{tikzcd}$
end{frame}
end{document}
ADDENDUM: It has been suggested that the ampersand is the problem. I disagree with that statement. E.g.
begin{frame}
frametitle{The ampersand per se is not the problem}
begin{tabular}{ccc}
a & b & c\
end{tabular}
end{frame}
does work. It is the line catcode
&=13that can be found in
tikz.code.tex. It is true, though, that ampersand replacement is another way to solve the problem. I also want to add that I was using
execute at end picturefor a reason. Even though there are seemingly simpler ways, they do not allow you to control the order in which the arrows are placed because
tikz-cd` collects them internally and draws them in an order that we cannot control. Here it does not matter, but you can find here an example where it does.
edited 2 hours ago
answered 6 hours ago
Schrödinger's catSchrödinger's cat
5,5307 silver badges17 bronze badges
5,5307 silver badges17 bronze badges
Again, thank you! I'll wait before accepting your answer to see if someone else has some improvements to offer or even an alternative :)
– mrtaurho
6 hours ago
@mrtaurho What kind of improvement are you after? To me the diagram looks fine (also because you do not overload it), what I would probably do is to make it larger, e.g.[begin{tikzcd}[column sep=6em,execute at end picture={ path (F) edge[double equal sign distance, -Implies,"$omega$", shorten >=2pt,shorten <=2pt] (G);}] mathcal{C} arrow[r,bend left,"F" {alias=F}] arrow[r,bend right,"G" {swap,alias=G}]& mathcal{D} \ end{tikzcd}]
, which also uses an equation environment. (I usefragile
all the time and there is IMHO no real downside to it.)
– Schrödinger's cat
6 hours ago
It has been suggested that the ampersand is the problem. I disagree with that statement. E.g.begin{frame} frametitle{The ampersand per se is not the problem} begin{tabular}{ccc} a & b & c\ end{tabular} end{frame}
does work. It is the linecatcode`&=13
that can be found intikz.code.tex
. It is true, though, thatampersand replacement
is another way to solve the problem.
– Schrödinger's cat
2 hours ago
add a comment |
Again, thank you! I'll wait before accepting your answer to see if someone else has some improvements to offer or even an alternative :)
– mrtaurho
6 hours ago
@mrtaurho What kind of improvement are you after? To me the diagram looks fine (also because you do not overload it), what I would probably do is to make it larger, e.g.[begin{tikzcd}[column sep=6em,execute at end picture={ path (F) edge[double equal sign distance, -Implies,"$omega$", shorten >=2pt,shorten <=2pt] (G);}] mathcal{C} arrow[r,bend left,"F" {alias=F}] arrow[r,bend right,"G" {swap,alias=G}]& mathcal{D} \ end{tikzcd}]
, which also uses an equation environment. (I usefragile
all the time and there is IMHO no real downside to it.)
– Schrödinger's cat
6 hours ago
It has been suggested that the ampersand is the problem. I disagree with that statement. E.g.begin{frame} frametitle{The ampersand per se is not the problem} begin{tabular}{ccc} a & b & c\ end{tabular} end{frame}
does work. It is the linecatcode`&=13
that can be found intikz.code.tex
. It is true, though, thatampersand replacement
is another way to solve the problem.
– Schrödinger's cat
2 hours ago
Again, thank you! I'll wait before accepting your answer to see if someone else has some improvements to offer or even an alternative :)
– mrtaurho
6 hours ago
Again, thank you! I'll wait before accepting your answer to see if someone else has some improvements to offer or even an alternative :)
– mrtaurho
6 hours ago
@mrtaurho What kind of improvement are you after? To me the diagram looks fine (also because you do not overload it), what I would probably do is to make it larger, e.g.
[begin{tikzcd}[column sep=6em,execute at end picture={ path (F) edge[double equal sign distance, -Implies,"$omega$", shorten >=2pt,shorten <=2pt] (G);}] mathcal{C} arrow[r,bend left,"F" {alias=F}] arrow[r,bend right,"G" {swap,alias=G}]& mathcal{D} \ end{tikzcd}]
, which also uses an equation environment. (I use fragile
all the time and there is IMHO no real downside to it.)– Schrödinger's cat
6 hours ago
@mrtaurho What kind of improvement are you after? To me the diagram looks fine (also because you do not overload it), what I would probably do is to make it larger, e.g.
[begin{tikzcd}[column sep=6em,execute at end picture={ path (F) edge[double equal sign distance, -Implies,"$omega$", shorten >=2pt,shorten <=2pt] (G);}] mathcal{C} arrow[r,bend left,"F" {alias=F}] arrow[r,bend right,"G" {swap,alias=G}]& mathcal{D} \ end{tikzcd}]
, which also uses an equation environment. (I use fragile
all the time and there is IMHO no real downside to it.)– Schrödinger's cat
6 hours ago
It has been suggested that the ampersand is the problem. I disagree with that statement. E.g.
begin{frame} frametitle{The ampersand per se is not the problem} begin{tabular}{ccc} a & b & c\ end{tabular} end{frame}
does work. It is the line catcode`&=13
that can be found in tikz.code.tex
. It is true, though, that ampersand replacement
is another way to solve the problem.– Schrödinger's cat
2 hours ago
It has been suggested that the ampersand is the problem. I disagree with that statement. E.g.
begin{frame} frametitle{The ampersand per se is not the problem} begin{tabular}{ccc} a & b & c\ end{tabular} end{frame}
does work. It is the line catcode`&=13
that can be found in tikz.code.tex
. It is true, though, that ampersand replacement
is another way to solve the problem.– Schrödinger's cat
2 hours ago
add a comment |
mrtaurho is a new contributor. Be nice, and check out our Code of Conduct.
mrtaurho is a new contributor. Be nice, and check out our Code of Conduct.
mrtaurho is a new contributor. Be nice, and check out our Code of Conduct.
mrtaurho is a new contributor. Be nice, and check out our Code of Conduct.
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%2f507508%2ftikzcd-in-beamer-not-working%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