How to use tikzmark inside tikz-cd?

The name of the pictureThe name of the pictureThe name of the pictureClash 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.










share|improve this question























  • 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










  • Thanks for accepting my answer. However, the answer by LoopSpace is clearly better, Could you please accept it instead?
    – marmot
    4 mins ago














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.










share|improve this question























  • 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










  • Thanks for accepting my answer. However, the answer by LoopSpace is clearly better, Could you please accept it instead?
    – marmot
    4 mins ago












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.










share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 16 mins ago

























asked 1 hour ago









Gau-Syu

1477




1477











  • 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










  • 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










  • 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










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!






share|improve this answer




















  • 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


















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



enter image description here



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


enter image description here






share|improve this answer






















  • 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 tikzpictures 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 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




    @marmot See my answer. Yet again, you've tracked down a bug in tikzmark.
    – Loop Space
    7 mins ago










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',
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















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






























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!






share|improve this answer




















  • 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















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!






share|improve this answer




















  • 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













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!






share|improve this answer












(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!







share|improve this answer












share|improve this answer



share|improve this answer










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

















  • 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











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



enter image description here



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


enter image description here






share|improve this answer






















  • 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 tikzpictures 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 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




    @marmot See my answer. Yet again, you've tracked down a bug in tikzmark.
    – Loop Space
    7 mins ago














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



enter image description here



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


enter image description here






share|improve this answer






















  • 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 tikzpictures 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 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




    @marmot See my answer. Yet again, you've tracked down a bug in tikzmark.
    – Loop Space
    7 mins ago












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



enter image description here



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


enter image description here






share|improve this answer














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



enter image description here



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


enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








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 nesting tikzpictures 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 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




    @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










  • @Gau-Syu Yes, that's not surprising since you are essentially nesting tikzpictures 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 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




    @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 tikzpictures by doing this, which should be avoided.
– marmot
1 hour ago




@Gau-Syu Yes, that's not surprising since you are essentially nesting tikzpictures 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

















 

draft saved


draft discarded















































 


draft saved


draft discarded














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













































































Comments

Popular posts from this blog

What does second last employer means? [closed]

Installing NextGIS Connect into QGIS 3?

One-line joke