How to use tikzmark inside tikz-cd?
Clash Royale CLAN TAG#URR8PPP
up vote
3
down vote
favorite
I want to use tikzmark in tikzcd.
However, even the following sample returns errors
documentclassarticle
usepackageamsmath
usepackagetikz-cd
usetikzlibrarytikzmark
begindocument
begintikzcd
tikzmarku1A & B\
C & tikzmarku2D
endtikzcd
begintikzpicture[remember picture,overlay]
draw[->] (u1) edge (u2);
endtikzpicture
enddocument
The error report is
Package tikz Error: Cannot parse this coordinate. tikzmarku1A
Package tikz Error: Cannot parse this coordinate. C & tikzmarku2D
Package pgf Error: No shape named u1 is known. draw[->] (u1)
Package pgf Error: No shape named u1 is known. draw[->] (u1) edge
(u2)
Package pgf Error: No shape named u2 is known. draw[->] (u1) edge
(u2)
Package pgf Error: No shape named u2 is known. draw[->] (u1) edge
(u2)
Package pgf Error: No shape named u1 is known. draw[->] (u1) edge
(u2)
Label(s) may have changed. Rerun to get cross-references right.
How to fix this kind of errors?
Update:
I have tried this
documentclassarticle
usepackageamsmath
usepackagetikz-cd
usetikzlibrarytikzmark
begindocument
begintikzcd[remember picture]
aaaaaasubnodeu1A & B\
C & subnodeu2Dddddddd
endtikzcd
begintikzpicture[remember picture,overlay]
draw[->] (u1) edge (u2);
endtikzpicture
enddocument
and this
documentclassarticle
usepackageamsmath
usepackagetikz-cd
usetikzlibrarytikzmark
begindocument
begintikzcd[remember picture]
aaaaaatikzmarknodeu1A & B\
C & tikzmarknodeu2Dddddddd
endtikzcd
begintikzpicture[remember picture,overlay]
draw[->] (u1) edge (u2);
endtikzpicture
enddocument
But none of them put the arrow in correct location.
Update:
The tikzmarknode command does work correctly if I use LuaLaTex instead of XeLaTeX.
tikz-cd tikzmark
add a comment |Â
up vote
3
down vote
favorite
I want to use tikzmark in tikzcd.
However, even the following sample returns errors
documentclassarticle
usepackageamsmath
usepackagetikz-cd
usetikzlibrarytikzmark
begindocument
begintikzcd
tikzmarku1A & B\
C & tikzmarku2D
endtikzcd
begintikzpicture[remember picture,overlay]
draw[->] (u1) edge (u2);
endtikzpicture
enddocument
The error report is
Package tikz Error: Cannot parse this coordinate. tikzmarku1A
Package tikz Error: Cannot parse this coordinate. C & tikzmarku2D
Package pgf Error: No shape named u1 is known. draw[->] (u1)
Package pgf Error: No shape named u1 is known. draw[->] (u1) edge
(u2)
Package pgf Error: No shape named u2 is known. draw[->] (u1) edge
(u2)
Package pgf Error: No shape named u2 is known. draw[->] (u1) edge
(u2)
Package pgf Error: No shape named u1 is known. draw[->] (u1) edge
(u2)
Label(s) may have changed. Rerun to get cross-references right.
How to fix this kind of errors?
Update:
I have tried this
documentclassarticle
usepackageamsmath
usepackagetikz-cd
usetikzlibrarytikzmark
begindocument
begintikzcd[remember picture]
aaaaaasubnodeu1A & B\
C & subnodeu2Dddddddd
endtikzcd
begintikzpicture[remember picture,overlay]
draw[->] (u1) edge (u2);
endtikzpicture
enddocument
and this
documentclassarticle
usepackageamsmath
usepackagetikz-cd
usetikzlibrarytikzmark
begindocument
begintikzcd[remember picture]
aaaaaatikzmarknodeu1A & B\
C & tikzmarknodeu2Dddddddd
endtikzcd
begintikzpicture[remember picture,overlay]
draw[->] (u1) edge (u2);
endtikzpicture
enddocument
But none of them put the arrow in correct location.
Update:
The tikzmarknode command does work correctly if I use LuaLaTex instead of XeLaTeX.
tikz-cd tikzmark
You don't. Just addremember picture
to thetikzcd
and refer to the nodes with(tikzcdmatrixname-1-1)
and so on.
â marmot
1 hour ago
Note that xelatex has known issues with positioning, and so with tikzmark.
â Loop Space
8 mins ago
Thanks for accepting my answer. However, the answer by LoopSpace is clearly better, Could you please accept it instead?
â marmot
4 mins ago
add a comment |Â
up vote
3
down vote
favorite
up vote
3
down vote
favorite
I want to use tikzmark in tikzcd.
However, even the following sample returns errors
documentclassarticle
usepackageamsmath
usepackagetikz-cd
usetikzlibrarytikzmark
begindocument
begintikzcd
tikzmarku1A & B\
C & tikzmarku2D
endtikzcd
begintikzpicture[remember picture,overlay]
draw[->] (u1) edge (u2);
endtikzpicture
enddocument
The error report is
Package tikz Error: Cannot parse this coordinate. tikzmarku1A
Package tikz Error: Cannot parse this coordinate. C & tikzmarku2D
Package pgf Error: No shape named u1 is known. draw[->] (u1)
Package pgf Error: No shape named u1 is known. draw[->] (u1) edge
(u2)
Package pgf Error: No shape named u2 is known. draw[->] (u1) edge
(u2)
Package pgf Error: No shape named u2 is known. draw[->] (u1) edge
(u2)
Package pgf Error: No shape named u1 is known. draw[->] (u1) edge
(u2)
Label(s) may have changed. Rerun to get cross-references right.
How to fix this kind of errors?
Update:
I have tried this
documentclassarticle
usepackageamsmath
usepackagetikz-cd
usetikzlibrarytikzmark
begindocument
begintikzcd[remember picture]
aaaaaasubnodeu1A & B\
C & subnodeu2Dddddddd
endtikzcd
begintikzpicture[remember picture,overlay]
draw[->] (u1) edge (u2);
endtikzpicture
enddocument
and this
documentclassarticle
usepackageamsmath
usepackagetikz-cd
usetikzlibrarytikzmark
begindocument
begintikzcd[remember picture]
aaaaaatikzmarknodeu1A & B\
C & tikzmarknodeu2Dddddddd
endtikzcd
begintikzpicture[remember picture,overlay]
draw[->] (u1) edge (u2);
endtikzpicture
enddocument
But none of them put the arrow in correct location.
Update:
The tikzmarknode command does work correctly if I use LuaLaTex instead of XeLaTeX.
tikz-cd tikzmark
I want to use tikzmark in tikzcd.
However, even the following sample returns errors
documentclassarticle
usepackageamsmath
usepackagetikz-cd
usetikzlibrarytikzmark
begindocument
begintikzcd
tikzmarku1A & B\
C & tikzmarku2D
endtikzcd
begintikzpicture[remember picture,overlay]
draw[->] (u1) edge (u2);
endtikzpicture
enddocument
The error report is
Package tikz Error: Cannot parse this coordinate. tikzmarku1A
Package tikz Error: Cannot parse this coordinate. C & tikzmarku2D
Package pgf Error: No shape named u1 is known. draw[->] (u1)
Package pgf Error: No shape named u1 is known. draw[->] (u1) edge
(u2)
Package pgf Error: No shape named u2 is known. draw[->] (u1) edge
(u2)
Package pgf Error: No shape named u2 is known. draw[->] (u1) edge
(u2)
Package pgf Error: No shape named u1 is known. draw[->] (u1) edge
(u2)
Label(s) may have changed. Rerun to get cross-references right.
How to fix this kind of errors?
Update:
I have tried this
documentclassarticle
usepackageamsmath
usepackagetikz-cd
usetikzlibrarytikzmark
begindocument
begintikzcd[remember picture]
aaaaaasubnodeu1A & B\
C & subnodeu2Dddddddd
endtikzcd
begintikzpicture[remember picture,overlay]
draw[->] (u1) edge (u2);
endtikzpicture
enddocument
and this
documentclassarticle
usepackageamsmath
usepackagetikz-cd
usetikzlibrarytikzmark
begindocument
begintikzcd[remember picture]
aaaaaatikzmarknodeu1A & B\
C & tikzmarknodeu2Dddddddd
endtikzcd
begintikzpicture[remember picture,overlay]
draw[->] (u1) edge (u2);
endtikzpicture
enddocument
But none of them put the arrow in correct location.
Update:
The tikzmarknode command does work correctly if I use LuaLaTex instead of XeLaTeX.
tikz-cd tikzmark
tikz-cd tikzmark
edited 16 mins ago
asked 1 hour ago
Gau-Syu
1477
1477
You don't. Just addremember picture
to thetikzcd
and refer to the nodes with(tikzcdmatrixname-1-1)
and so on.
â marmot
1 hour ago
Note that xelatex has known issues with positioning, and so with tikzmark.
â Loop Space
8 mins ago
Thanks for accepting my answer. However, the answer by LoopSpace is clearly better, Could you please accept it instead?
â marmot
4 mins ago
add a comment |Â
You don't. Just addremember picture
to thetikzcd
and refer to the nodes with(tikzcdmatrixname-1-1)
and so on.
â marmot
1 hour ago
Note that xelatex has known issues with positioning, and so with tikzmark.
â Loop Space
8 mins ago
Thanks for accepting my answer. However, the answer by LoopSpace is clearly better, Could you please accept it instead?
â marmot
4 mins ago
You don't. Just add
remember picture
to the tikzcd
and refer to the nodes with (tikzcdmatrixname-1-1)
and so on.â marmot
1 hour ago
You don't. Just add
remember picture
to the tikzcd
and refer to the nodes with (tikzcdmatrixname-1-1)
and so on.â marmot
1 hour ago
Note that xelatex has known issues with positioning, and so with tikzmark.
â Loop Space
8 mins ago
Note that xelatex has known issues with positioning, and so with tikzmark.
â Loop Space
8 mins ago
Thanks for accepting my answer. However, the answer by LoopSpace is clearly better, Could you please accept it instead?
â marmot
4 mins ago
Thanks for accepting my answer. However, the answer by LoopSpace is clearly better, Could you please accept it instead?
â marmot
4 mins ago
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
3
down vote
accepted
(Note: I agree with marmot that for this particular case I wouldn't use tikzmark, but I get that it is a simple example and it reveals a bug in tikzmark.)
It would appear that when I modified tikzmark to make it possible to use inside tikzpictures, then I inadvertently broke the ability to use it inside a node (though I'm not sure if that was ever a recommended use!). A node is inside a tikzpicture but should be treated as if it weren't. My current test for whether the tikzmark is inside a tikzpicture doesn't pick up on this. Here's the corrected test:
documentclassarticle
%urlhttps://tex.stackexchange.com/q/458387/86
usepackageamsmath
usepackagetikz-cd
usetikzlibrarytikzmark
makeatletter
deftikzmark%
ifxpgfpictureid@undefined
lettikzmark@next=tikzmark@outside
else
relax
ifxscopetikz@origscoperelax
lettikzmark@next=tikzmark@outside
else
lettikzmark@next=tikzmark@inside
fi
fi
tikzmark@next%
makeatother
begindocument
begintikzcd
tikzmarku1A & B\
C & tikzmarku2D
endtikzcd
begintikzpicture[remember picture,overlay]
draw[->] (pic cs:u1) -- (pic cs:u2);
endtikzpicture
enddocument
I've uploaded this to github and will send it off to CTAN once the amazing testing team of marmot has answered a few questions to check that I haven't broken something else!
Great! That's what I was hoping for! The marmot testing team used this great package in several answers and everything worked absolutely smoothly!
â marmot
5 mins ago
add a comment |Â
up vote
2
down vote
REVISED ANSWER: I could get tikzmark
to collaborate with tikz-cd
by switching to tikzmarknode
. More precisely, if I rewrite cfr's nice answer to become
documentclassarticle
usepackagetikz-cd,amssymb
usetikzlibrarytikzmark,quotes
begindocument
begintikzcd
x in tikzmarknodeu1U subseteq M arrowrf & f(x) in V subseteq
tikzmarknodenN arrowdpsi \
phi(x) in tikzmarknodeu2phi(U) subseteq mathbbR^m arrowrpsi f phi^-1 & psi(f(x)) in psi(V) subseteq mathbbR^n
endtikzcd
begintikzpicture[overlay, remember picture]
draw [->] (u1) edge ["$phi$", right] (u2.north -| u1);
endtikzpicture
enddocument
I get
which might be what you are after.
Let me also mention that for your above example you may not use tikzmark
since you have the objects already in TikZ nodes.
documentclassarticle
usepackageamsmath
usepackagetikz-cd
begindocument
begintikzcd[remember picture]
A & B\
C & D
endtikzcd
begintikzpicture[remember picture,overlay]
draw[->] (tikzcdmatrixname-1-1) edge (tikzcdmatrixname-2-2);
endtikzpicture
enddocument
What I mean is I cannot use tikzmark commands inside a tikzcd environment: as in my sample shows the command tikzmark just cause "Cannot parse this coordinate" error.
â Gau-Syu
1 hour ago
@Gau-Syu Yes, that's not surprising since you are essentially nestingtikzpicture
s by doing this, which should be avoided.
â marmot
1 hour ago
What makes me confuse is that there are some answers in Tex.SE using tikzmark inside tikzcd, for example tex.stackexchange.com/a/287727/54169 and tex.stackexchange.com/a/176572/54169
â Gau-Syu
1 hour ago
@Gau-Syu Yes, but it is clearly stated that you need to usesubnode
then. I believe that the thing above is simpler. (As I said, I really love tikzmark, but would not use it here.)
â marmot
1 hour ago
1
@marmot See my answer. Yet again, you've tracked down a bug in tikzmark.
â Loop Space
7 mins ago
 |Â
show 6 more comments
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
(Note: I agree with marmot that for this particular case I wouldn't use tikzmark, but I get that it is a simple example and it reveals a bug in tikzmark.)
It would appear that when I modified tikzmark to make it possible to use inside tikzpictures, then I inadvertently broke the ability to use it inside a node (though I'm not sure if that was ever a recommended use!). A node is inside a tikzpicture but should be treated as if it weren't. My current test for whether the tikzmark is inside a tikzpicture doesn't pick up on this. Here's the corrected test:
documentclassarticle
%urlhttps://tex.stackexchange.com/q/458387/86
usepackageamsmath
usepackagetikz-cd
usetikzlibrarytikzmark
makeatletter
deftikzmark%
ifxpgfpictureid@undefined
lettikzmark@next=tikzmark@outside
else
relax
ifxscopetikz@origscoperelax
lettikzmark@next=tikzmark@outside
else
lettikzmark@next=tikzmark@inside
fi
fi
tikzmark@next%
makeatother
begindocument
begintikzcd
tikzmarku1A & B\
C & tikzmarku2D
endtikzcd
begintikzpicture[remember picture,overlay]
draw[->] (pic cs:u1) -- (pic cs:u2);
endtikzpicture
enddocument
I've uploaded this to github and will send it off to CTAN once the amazing testing team of marmot has answered a few questions to check that I haven't broken something else!
Great! That's what I was hoping for! The marmot testing team used this great package in several answers and everything worked absolutely smoothly!
â marmot
5 mins ago
add a comment |Â
up vote
3
down vote
accepted
(Note: I agree with marmot that for this particular case I wouldn't use tikzmark, but I get that it is a simple example and it reveals a bug in tikzmark.)
It would appear that when I modified tikzmark to make it possible to use inside tikzpictures, then I inadvertently broke the ability to use it inside a node (though I'm not sure if that was ever a recommended use!). A node is inside a tikzpicture but should be treated as if it weren't. My current test for whether the tikzmark is inside a tikzpicture doesn't pick up on this. Here's the corrected test:
documentclassarticle
%urlhttps://tex.stackexchange.com/q/458387/86
usepackageamsmath
usepackagetikz-cd
usetikzlibrarytikzmark
makeatletter
deftikzmark%
ifxpgfpictureid@undefined
lettikzmark@next=tikzmark@outside
else
relax
ifxscopetikz@origscoperelax
lettikzmark@next=tikzmark@outside
else
lettikzmark@next=tikzmark@inside
fi
fi
tikzmark@next%
makeatother
begindocument
begintikzcd
tikzmarku1A & B\
C & tikzmarku2D
endtikzcd
begintikzpicture[remember picture,overlay]
draw[->] (pic cs:u1) -- (pic cs:u2);
endtikzpicture
enddocument
I've uploaded this to github and will send it off to CTAN once the amazing testing team of marmot has answered a few questions to check that I haven't broken something else!
Great! That's what I was hoping for! The marmot testing team used this great package in several answers and everything worked absolutely smoothly!
â marmot
5 mins ago
add a comment |Â
up vote
3
down vote
accepted
up vote
3
down vote
accepted
(Note: I agree with marmot that for this particular case I wouldn't use tikzmark, but I get that it is a simple example and it reveals a bug in tikzmark.)
It would appear that when I modified tikzmark to make it possible to use inside tikzpictures, then I inadvertently broke the ability to use it inside a node (though I'm not sure if that was ever a recommended use!). A node is inside a tikzpicture but should be treated as if it weren't. My current test for whether the tikzmark is inside a tikzpicture doesn't pick up on this. Here's the corrected test:
documentclassarticle
%urlhttps://tex.stackexchange.com/q/458387/86
usepackageamsmath
usepackagetikz-cd
usetikzlibrarytikzmark
makeatletter
deftikzmark%
ifxpgfpictureid@undefined
lettikzmark@next=tikzmark@outside
else
relax
ifxscopetikz@origscoperelax
lettikzmark@next=tikzmark@outside
else
lettikzmark@next=tikzmark@inside
fi
fi
tikzmark@next%
makeatother
begindocument
begintikzcd
tikzmarku1A & B\
C & tikzmarku2D
endtikzcd
begintikzpicture[remember picture,overlay]
draw[->] (pic cs:u1) -- (pic cs:u2);
endtikzpicture
enddocument
I've uploaded this to github and will send it off to CTAN once the amazing testing team of marmot has answered a few questions to check that I haven't broken something else!
(Note: I agree with marmot that for this particular case I wouldn't use tikzmark, but I get that it is a simple example and it reveals a bug in tikzmark.)
It would appear that when I modified tikzmark to make it possible to use inside tikzpictures, then I inadvertently broke the ability to use it inside a node (though I'm not sure if that was ever a recommended use!). A node is inside a tikzpicture but should be treated as if it weren't. My current test for whether the tikzmark is inside a tikzpicture doesn't pick up on this. Here's the corrected test:
documentclassarticle
%urlhttps://tex.stackexchange.com/q/458387/86
usepackageamsmath
usepackagetikz-cd
usetikzlibrarytikzmark
makeatletter
deftikzmark%
ifxpgfpictureid@undefined
lettikzmark@next=tikzmark@outside
else
relax
ifxscopetikz@origscoperelax
lettikzmark@next=tikzmark@outside
else
lettikzmark@next=tikzmark@inside
fi
fi
tikzmark@next%
makeatother
begindocument
begintikzcd
tikzmarku1A & B\
C & tikzmarku2D
endtikzcd
begintikzpicture[remember picture,overlay]
draw[->] (pic cs:u1) -- (pic cs:u2);
endtikzpicture
enddocument
I've uploaded this to github and will send it off to CTAN once the amazing testing team of marmot has answered a few questions to check that I haven't broken something else!
answered 10 mins ago
Loop Space
110k28293599
110k28293599
Great! That's what I was hoping for! The marmot testing team used this great package in several answers and everything worked absolutely smoothly!
â marmot
5 mins ago
add a comment |Â
Great! That's what I was hoping for! The marmot testing team used this great package in several answers and everything worked absolutely smoothly!
â marmot
5 mins ago
Great! That's what I was hoping for! The marmot testing team used this great package in several answers and everything worked absolutely smoothly!
â marmot
5 mins ago
Great! That's what I was hoping for! The marmot testing team used this great package in several answers and everything worked absolutely smoothly!
â marmot
5 mins ago
add a comment |Â
up vote
2
down vote
REVISED ANSWER: I could get tikzmark
to collaborate with tikz-cd
by switching to tikzmarknode
. More precisely, if I rewrite cfr's nice answer to become
documentclassarticle
usepackagetikz-cd,amssymb
usetikzlibrarytikzmark,quotes
begindocument
begintikzcd
x in tikzmarknodeu1U subseteq M arrowrf & f(x) in V subseteq
tikzmarknodenN arrowdpsi \
phi(x) in tikzmarknodeu2phi(U) subseteq mathbbR^m arrowrpsi f phi^-1 & psi(f(x)) in psi(V) subseteq mathbbR^n
endtikzcd
begintikzpicture[overlay, remember picture]
draw [->] (u1) edge ["$phi$", right] (u2.north -| u1);
endtikzpicture
enddocument
I get
which might be what you are after.
Let me also mention that for your above example you may not use tikzmark
since you have the objects already in TikZ nodes.
documentclassarticle
usepackageamsmath
usepackagetikz-cd
begindocument
begintikzcd[remember picture]
A & B\
C & D
endtikzcd
begintikzpicture[remember picture,overlay]
draw[->] (tikzcdmatrixname-1-1) edge (tikzcdmatrixname-2-2);
endtikzpicture
enddocument
What I mean is I cannot use tikzmark commands inside a tikzcd environment: as in my sample shows the command tikzmark just cause "Cannot parse this coordinate" error.
â Gau-Syu
1 hour ago
@Gau-Syu Yes, that's not surprising since you are essentially nestingtikzpicture
s by doing this, which should be avoided.
â marmot
1 hour ago
What makes me confuse is that there are some answers in Tex.SE using tikzmark inside tikzcd, for example tex.stackexchange.com/a/287727/54169 and tex.stackexchange.com/a/176572/54169
â Gau-Syu
1 hour ago
@Gau-Syu Yes, but it is clearly stated that you need to usesubnode
then. I believe that the thing above is simpler. (As I said, I really love tikzmark, but would not use it here.)
â marmot
1 hour ago
1
@marmot See my answer. Yet again, you've tracked down a bug in tikzmark.
â Loop Space
7 mins ago
 |Â
show 6 more comments
up vote
2
down vote
REVISED ANSWER: I could get tikzmark
to collaborate with tikz-cd
by switching to tikzmarknode
. More precisely, if I rewrite cfr's nice answer to become
documentclassarticle
usepackagetikz-cd,amssymb
usetikzlibrarytikzmark,quotes
begindocument
begintikzcd
x in tikzmarknodeu1U subseteq M arrowrf & f(x) in V subseteq
tikzmarknodenN arrowdpsi \
phi(x) in tikzmarknodeu2phi(U) subseteq mathbbR^m arrowrpsi f phi^-1 & psi(f(x)) in psi(V) subseteq mathbbR^n
endtikzcd
begintikzpicture[overlay, remember picture]
draw [->] (u1) edge ["$phi$", right] (u2.north -| u1);
endtikzpicture
enddocument
I get
which might be what you are after.
Let me also mention that for your above example you may not use tikzmark
since you have the objects already in TikZ nodes.
documentclassarticle
usepackageamsmath
usepackagetikz-cd
begindocument
begintikzcd[remember picture]
A & B\
C & D
endtikzcd
begintikzpicture[remember picture,overlay]
draw[->] (tikzcdmatrixname-1-1) edge (tikzcdmatrixname-2-2);
endtikzpicture
enddocument
What I mean is I cannot use tikzmark commands inside a tikzcd environment: as in my sample shows the command tikzmark just cause "Cannot parse this coordinate" error.
â Gau-Syu
1 hour ago
@Gau-Syu Yes, that's not surprising since you are essentially nestingtikzpicture
s by doing this, which should be avoided.
â marmot
1 hour ago
What makes me confuse is that there are some answers in Tex.SE using tikzmark inside tikzcd, for example tex.stackexchange.com/a/287727/54169 and tex.stackexchange.com/a/176572/54169
â Gau-Syu
1 hour ago
@Gau-Syu Yes, but it is clearly stated that you need to usesubnode
then. I believe that the thing above is simpler. (As I said, I really love tikzmark, but would not use it here.)
â marmot
1 hour ago
1
@marmot See my answer. Yet again, you've tracked down a bug in tikzmark.
â Loop Space
7 mins ago
 |Â
show 6 more comments
up vote
2
down vote
up vote
2
down vote
REVISED ANSWER: I could get tikzmark
to collaborate with tikz-cd
by switching to tikzmarknode
. More precisely, if I rewrite cfr's nice answer to become
documentclassarticle
usepackagetikz-cd,amssymb
usetikzlibrarytikzmark,quotes
begindocument
begintikzcd
x in tikzmarknodeu1U subseteq M arrowrf & f(x) in V subseteq
tikzmarknodenN arrowdpsi \
phi(x) in tikzmarknodeu2phi(U) subseteq mathbbR^m arrowrpsi f phi^-1 & psi(f(x)) in psi(V) subseteq mathbbR^n
endtikzcd
begintikzpicture[overlay, remember picture]
draw [->] (u1) edge ["$phi$", right] (u2.north -| u1);
endtikzpicture
enddocument
I get
which might be what you are after.
Let me also mention that for your above example you may not use tikzmark
since you have the objects already in TikZ nodes.
documentclassarticle
usepackageamsmath
usepackagetikz-cd
begindocument
begintikzcd[remember picture]
A & B\
C & D
endtikzcd
begintikzpicture[remember picture,overlay]
draw[->] (tikzcdmatrixname-1-1) edge (tikzcdmatrixname-2-2);
endtikzpicture
enddocument
REVISED ANSWER: I could get tikzmark
to collaborate with tikz-cd
by switching to tikzmarknode
. More precisely, if I rewrite cfr's nice answer to become
documentclassarticle
usepackagetikz-cd,amssymb
usetikzlibrarytikzmark,quotes
begindocument
begintikzcd
x in tikzmarknodeu1U subseteq M arrowrf & f(x) in V subseteq
tikzmarknodenN arrowdpsi \
phi(x) in tikzmarknodeu2phi(U) subseteq mathbbR^m arrowrpsi f phi^-1 & psi(f(x)) in psi(V) subseteq mathbbR^n
endtikzcd
begintikzpicture[overlay, remember picture]
draw [->] (u1) edge ["$phi$", right] (u2.north -| u1);
endtikzpicture
enddocument
I get
which might be what you are after.
Let me also mention that for your above example you may not use tikzmark
since you have the objects already in TikZ nodes.
documentclassarticle
usepackageamsmath
usepackagetikz-cd
begindocument
begintikzcd[remember picture]
A & B\
C & D
endtikzcd
begintikzpicture[remember picture,overlay]
draw[->] (tikzcdmatrixname-1-1) edge (tikzcdmatrixname-2-2);
endtikzpicture
enddocument
edited 27 mins ago
answered 1 hour ago
marmot
71.5k476152
71.5k476152
What I mean is I cannot use tikzmark commands inside a tikzcd environment: as in my sample shows the command tikzmark just cause "Cannot parse this coordinate" error.
â Gau-Syu
1 hour ago
@Gau-Syu Yes, that's not surprising since you are essentially nestingtikzpicture
s by doing this, which should be avoided.
â marmot
1 hour ago
What makes me confuse is that there are some answers in Tex.SE using tikzmark inside tikzcd, for example tex.stackexchange.com/a/287727/54169 and tex.stackexchange.com/a/176572/54169
â Gau-Syu
1 hour ago
@Gau-Syu Yes, but it is clearly stated that you need to usesubnode
then. I believe that the thing above is simpler. (As I said, I really love tikzmark, but would not use it here.)
â marmot
1 hour ago
1
@marmot See my answer. Yet again, you've tracked down a bug in tikzmark.
â Loop Space
7 mins ago
 |Â
show 6 more comments
What I mean is I cannot use tikzmark commands inside a tikzcd environment: as in my sample shows the command tikzmark just cause "Cannot parse this coordinate" error.
â Gau-Syu
1 hour ago
@Gau-Syu Yes, that's not surprising since you are essentially nestingtikzpicture
s by doing this, which should be avoided.
â marmot
1 hour ago
What makes me confuse is that there are some answers in Tex.SE using tikzmark inside tikzcd, for example tex.stackexchange.com/a/287727/54169 and tex.stackexchange.com/a/176572/54169
â Gau-Syu
1 hour ago
@Gau-Syu Yes, but it is clearly stated that you need to usesubnode
then. I believe that the thing above is simpler. (As I said, I really love tikzmark, but would not use it here.)
â marmot
1 hour ago
1
@marmot See my answer. Yet again, you've tracked down a bug in tikzmark.
â Loop Space
7 mins ago
What I mean is I cannot use tikzmark commands inside a tikzcd environment: as in my sample shows the command tikzmark just cause "Cannot parse this coordinate" error.
â Gau-Syu
1 hour ago
What I mean is I cannot use tikzmark commands inside a tikzcd environment: as in my sample shows the command tikzmark just cause "Cannot parse this coordinate" error.
â Gau-Syu
1 hour ago
@Gau-Syu Yes, that's not surprising since you are essentially nesting
tikzpicture
s by doing this, which should be avoided.â marmot
1 hour ago
@Gau-Syu Yes, that's not surprising since you are essentially nesting
tikzpicture
s by doing this, which should be avoided.â marmot
1 hour ago
What makes me confuse is that there are some answers in Tex.SE using tikzmark inside tikzcd, for example tex.stackexchange.com/a/287727/54169 and tex.stackexchange.com/a/176572/54169
â Gau-Syu
1 hour ago
What makes me confuse is that there are some answers in Tex.SE using tikzmark inside tikzcd, for example tex.stackexchange.com/a/287727/54169 and tex.stackexchange.com/a/176572/54169
â Gau-Syu
1 hour ago
@Gau-Syu Yes, but it is clearly stated that you need to use
subnode
then. I believe that the thing above is simpler. (As I said, I really love tikzmark, but would not use it here.)â marmot
1 hour ago
@Gau-Syu Yes, but it is clearly stated that you need to use
subnode
then. I believe that the thing above is simpler. (As I said, I really love tikzmark, but would not use it here.)â marmot
1 hour ago
1
1
@marmot See my answer. Yet again, you've tracked down a bug in tikzmark.
â Loop Space
7 mins ago
@marmot See my answer. Yet again, you've tracked down a bug in tikzmark.
â Loop Space
7 mins ago
 |Â
show 6 more comments
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%2f458387%2fhow-to-use-tikzmark-inside-tikz-cd%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
You don't. Just add
remember picture
to thetikzcd
and refer to the nodes with(tikzcdmatrixname-1-1)
and so on.â marmot
1 hour ago
Note that xelatex has known issues with positioning, and so with tikzmark.
â Loop Space
8 mins ago
Thanks for accepting my answer. However, the answer by LoopSpace is clearly better, Could you please accept it instead?
â marmot
4 mins ago