0

Please edit for suitable tags, if you know some related tag.

See the 3rd page of this paper by Bhargava. There is a cube drawn there, which you can see in the image below (everything is black and white there, of course):

enter image description here

enter image description here

Notice that in this cube, a letter is written on each of the vertices.

I want to draw a cube where the invisible edges are marked with dotted lines (=dashed dots), and at the point of intersection with the visible edges, these edges are completely invisible from a small distance before and after (and not as a dotted line), like the 2nd and 4th images. And I need to emphasize that I cannot draw any of the pictures in this question:

enter image description here

enter image description here

enter image description here

And besides the dotted lines, is it possible to put a sphere in the vertices? Like the picture below:

enter image description here

enter image description here

I've seen suggestions in this question (What is the easiest way to draw a 3D cube with TikZ?), and also this question (How may I put labels on the corners/vertices of a cube?), and also this question (How can I draw a graph that looks like this hand drawn picture?), but they are not what I am looking for.



Using the codes presented in the answer by Qrrbrbirlbel, I tried to create the 2nd and the 5th cube, but it seems that I don't know how to use the crossing over command. Also, I don't know how to remove the circles.

Code

\documentclass[tikz]{standalone}
\usetikzlibrary{cd}
\tikzcdset{3d cd/.style={/tikz/every odd row/.append style={xshift={#1}}}}
\begin{document}
\begin{tikzcd}[
  3d cd=2em, arrows=dash, row sep=.6em, column sep=1.5em,
  dedo/.style={dash pattern=on \pgflinewidth off 2\pgflinewidth},% custom dashes
  cells={nodes={
      circle, draw, inner sep=+.2em, % make all nodes the same size:
      align=center, text width=width("$f$"), text depth=+0pt, text height=+.7em,
      t/.style={text={####1}}}}]
   |[t=yellow]| c_1 \ar[r]        \ar[d]
 & |[t=green]|  d_1 \ar[dd]       \ar[d]                          \\
   |[t=green]|  a_1 \ar[dd]       \ar[r, crossing over]
 & |[t=purple]| b_1 \ar[dd, crossing over]                                       \\
   |[t=red]|    c_2 \ar[d, dedo] \ar[r, dedo] \ar[uu, dedo]
 & |[t=yellow]| d_2 \ar[d]                                              \\
   |[t=yellow]| a_2 \ar[r]
 & |[t=green]|  b_2
\end{tikzcd}
\end{document}

Output

enter image description here

1

1 Answer 1

3

Code

\documentclass[tikz]{standalone}
\usetikzlibrary{cd}
\tikzcdset{3d cd/.style={/tikz/every odd row/.append style={xshift={#1}}}}
\begin{document}
\begin{tikzcd}[
  3d cd=2em, arrows=dash, row sep=.6em, column sep=1.5em,
  dedo/.style={dash pattern=on \pgflinewidth off 2\pgflinewidth},% custom dashes
  cells={nodes={
      circle, draw, inner sep=+.2em, % make all nodes the same size:
      align=center, text width=width("$f$"), text depth=+0pt, text height=+.7em,
      t/.style={text={####1}}}}]
   |[t=yellow]| e \ar[r]        \ar[d]
 & |[t=green]|  b \ar[dd]       \ar[d, dedo]                          \\
   |[t=green]|  e \ar[dd]       \ar[r, dedo]
 & |[t=purple]| f \ar[dd, dedo]                                       \\
   |[t=red]|    c \ar[d] \ar[r, crossing over] \ar[uu, crossing over]
 & |[t=yellow]| d \ar[d]                                              \\
   |[t=yellow]| g \ar[r]
 & |[t=green]|  h
\end{tikzcd}
\end{document}

Output

enter image description here

5
  • Thank you for your answer. When I copy your code into an empty file, I can get the output (although it's probably too big, and I need to resize it). Unfortunately, I don't know too much about LaTeX, and I can't get output from this code when I use the \input command.
    – Davood
    Jul 27 at 14:46
  • Using your codes, I tried to create the 2nd cube, but it seems that I don't know how to use the crossing over command (I added the image of the output and this comment at the end of the original question). Also, I don't know how to remove the circles.
    – Davood
    Jul 27 at 15:56
  • 1
    @Davood In your preamble, you must load the tikz package and the cd library or just \usepackage{tikz-cd}. The whole tikzcd environment can reside in a different file and can be \inputed. Jul 27 at 16:26
  • 1
    @Davood The circles can be removed by removing circle, draw (and possibly more) from the cells={nodes={…}} entry. The crossing over key works by first drawing a fat white line and then the actual arrow, therefore it must come after the line that should be painted over. In your case, you should use \ar[dd, crossing over] from the b_2 cell, for example. Jul 27 at 16:27
  • Thanks for your generous and kind answers. Now I am able to create all of the six cubes described in the question. As you've guided I've loaded \usepackage{tikz-cd} and \usetikzlibrary{cd}, and after ignoring \documentclass[tikz]{standalone}, \begin{document} and \end{document} everything was fine, and by using \input everything was done. Thanks for all.
    – Davood
    Jul 27 at 19:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .