TransWikia.com

Putting 2 dotted lines inside a rhombus

TeX - LaTeX Asked by Happy on June 13, 2021

I know how to draw 3 rhombi above each other as follows:

    documentclass{article}
    usepackage{amsmath}
    usepackage{tikz-cd}
    usetikzlibrary{shapes.geometric}
    begin{document}
    [begin{tikzcd}[sep = 2em,
        /tikz/rhombus/.style={shape=diamond,draw,minimum size=2em}]
     |[rhombus,draw,minimum size=3em]|{}arrow[r,shorten >=0.5em,shorten <=0.5em] & 
     |[rhombus,append after command={pgfextra{letmylntikzlastnode}
     (myln.north) node[anchor=south,rhombus] {}
     (myln.south) node[anchor=north,rhombus] {}}]|{}
    end{tikzcd}]
    end{document}

But what if inside the big rhombus I want to put 2 dotted lines to indicate the places where I will pinch it to get the 3 rhombi?

Any help in drawing this will be greatly appreciated!

One Answer

You can use execute at end picture to add additional TikZ code to the diagram. So if you give the big node alias with alias=foo added to the style of the node, you can draw lines between the anchors of the node.

enter image description here

documentclass{article}
usepackage{amsmath}
usepackage{tikz-cd}
usetikzlibrary{shapes.geometric}
begin{document}
[
  begin{tikzcd}[sep = 2em,
    /tikz/rhombus/.style={shape=diamond,draw,minimum size=2em},
    execute at end picture={
      draw [densely dotted] (foo.north west) -- (foo.north east);
      draw [densely dotted] (foo.south west) -- (foo.south east);
    }
    ]
 |[rhombus,draw,minimum size=3em, alias=foo]|{}arrow[r,shorten >=0.5em,shorten <=0.5em] & 
 |[rhombus,append after command={pgfextra{letmylntikzlastnode}
 (myln.north) node[anchor=south,rhombus] {}
 (myln.south) node[anchor=north,rhombus] {}}]|{}
end{tikzcd}
]
end{document}

Correct answer by Torbjørn T. on June 13, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP