1

How can I draw the following diagram in LaTeX? enter image description here

this is code but it is different,

 \begin{center}
  \begin{tikzpicture}[scale=0.4,cap=round,>=latex]
\draw[thick,blue] (0,0) -- (2,1.5) (2,1.5) -- (4.5,1.5) (4.5,1.5) -- (6.5,0) (6.5,0) -- (8.5,1.5) (8.5,1.5) -- (11,1.5) (11,1.5) -- (13,0) (16,0) -- (18,1.5) (18,1.5) -- (20.5,1.5) ;
\draw[thick,red] (0,0) -- (2,-1.5) (2,-1.5) -- (4.5,-1.5) (4.5,-1.5) -- (6.5,-0) (6.5,0) -- (8.5,-1.5) (8.5,-1.5) -- (11,-1.5) (11,-1.5) -- (13,0) (16,0) -- (18,-1.5) (18,-1.5) -- (20.5,-1.5) ;
\filldraw[black](14,0) circle(4pt);\filldraw[black](14.5,0) circle(4pt);\filldraw[black](15,0) circle(4pt);
\filldraw[fill=black,draw=black](0,0) circle(7pt);
 \filldraw[fill=black,draw=black](2,1.5) circle(7pt);
 \filldraw[fill=black,draw=black](4.5,1.5) circle(7pt);
 \filldraw[fill=black,draw=black](6.5,0) circle(7pt);
 \filldraw[fill=black,draw=black](8.5,1.5) circle(7pt);
 \filldraw[fill=black,draw=black](11,1.5) circle(7pt);
 \filldraw[fill=black,draw=black](13,0) circle(7pt);
 \filldraw[fill=black,draw=black](16,0) circle(7pt);
 \filldraw[fill=black,draw=black](18,1.5) circle(7pt);
 \filldraw[fill=black,draw=black](20.5,1.5) circle(7pt);
 \filldraw[fill=black,draw=black](2,-1.5) circle(7pt);
 \filldraw[fill=black,draw=black](4.5,-1.5) circle(7pt);
 \filldraw[fill=black,draw=black](8.5,-1.5) circle(7pt);
 \filldraw[fill=black,draw=black](11,-1.5) circle(7pt);
 \filldraw[fill=black,draw=black](18,-1.5) circle(7pt);
 \filldraw[fill=black,draw=black](20.5,-1.5) circle(7pt);
\node[above] at(2,1.5) {\tiny$1$};
\node[above] at(4.5,1.5) {\tiny$2$};
\node[above] at(8.5,1.5) {\tiny$3$};
\node[above] at(11,1.5) {\tiny$4$};
\node[above] at (18,1.5) {\tiny$2n-1$};
\node[above] at(20.5,1.5) {\tiny$2n$};
\node[below] at(2,-1.6) {\tiny$\check{1}$};
\node[below] at(4.5,-1.6) {\tiny$\check{2}$};
\node[below] at(8.5,-1.6) {\tiny$\check{3}$};
\node[below] at(11,-1.6) {\tiny$\check{4}$};
\node[below] at (18,-1.6) {\tiny$\check{(2n-1)}$};
\node[below] at(20.5,-1.6) {\tiny$\check{(2n)}$};
\node[above] at(0,0) {\tiny$1^0$};
\node[above] at(6.5,0) {\tiny$2^0$};
\node[above] at(13,0) {\tiny$3^0$};
\node[above] at(16,0) {\tiny$n^0$};
 \draw [thick, blue] (0,0) to[out=-120,in=100] (0,0) to[out=-220,in=20] (20.5,1.5);
\draw [thick, red] (0,0) to[out=120,in=00] (0,0) to[out=220,in=-20] (20.5,-1.5);
  \end{tikzpicture}
\captionof{figure} { spiro para-hexagonal cylinder chain}\label{fg1}
  \end{center}
cfr
  • 198,882
Liu Li
  • 31
  • What have you tried? Right now, this is just a do-it-for-me which may well get closed. If you've got some code you've tried and can explain the particular problem you're having, you're more likely to get help. – cfr Nov 03 '23 at 04:33
  • I make it, but it is different, this is code – Liu Li Nov 03 '23 at 04:39
  • 1
    You got a great deal of help in response to your previous do-it-for-me (https://tex.stackexchange.com/q/685563/). That should enable you to make a start here. If you just don't want to learn TikZ or similar (and why should you?), there's no reason you should, but you need a better strategy than posting do-it-for-mes on this site. Essentially, you either hire somebody to do your diagrams on a professional basis or you use one of the many GUI tools, which typically have gentler learning curves than TikZ et al. If your goal is to learn, people here will help, but you have to do the hard work. – cfr Nov 03 '23 at 04:40
  • 2
    If you spend some time with the tutorials recommended to you last time, this is really not at all difficult: just some circles and lines. Use polar coordinates to help with the positioning. – cfr Nov 03 '23 at 04:42

3 Answers3

4

I would use polar coordinates (as suggested by cfr in the comments) and loops probably to reproduce the above. Also, I would use nodes for the small circles.

Something like this could serve as a starting point (but it probably needs further tweaking):

\documentclass[border=10pt]{standalone}
\usepackage{tikz}

\tikzset{ every node/.style={ circle, draw, inner sep=1.5pt }, invisible/.style={ draw=none } }

\begin{document} \begin{tikzpicture} \foreach \i in {0,...,3} { \pgfmathparse{(\i == 0 ? "" : "invisible")} \node[\pgfmathresult] at ({45\i}:2.125) (A-\i) {}; \node at ({15+45\i}:2.5) (B-\i) {}; \node at ({30+45\i}:2.5) (C-\i) {}; \node at ({10+45\i}:1.5) (b-\i) {}; \node at ({35+45\i}:1.5) (c-\i) {}; \node at ({45+45\i}:2.125) (D-\i) {}; \draw (A-\i) -- (B-\i) -- (C-\i) -- (D-\i); \draw (A-\i) -- (b-\i) -- (c-\i) -- (D-\i); } \end{tikzpicture} \end{document}

enter image description here

3

I can't really make out the labels and adding those might need to be done separately but here is a graphs-powered solution with its grid placement.

Code

\documentclass[tikz]{standalone}
\usetikzlibrary{graphs.standard, ext.misc}
\tikzgraphsset{
  between from/.initial=, between target/.initial=,
  between/.style args={#1 and #2}{between from={#1}, between target={#2}},
  grid width/.initial=2, grid height/.initial=2,
  grid size/.style args={#1x#2}{grid height={#1}, grid width={#2}},
  declare={subgraph grid between}{
   [/utils/exec=% a bit math and short macros
      \pgfmathsetlengthmacro\gDist{% distance between the nodes in the grid between
        distancebetween("\pgfkeysvalueof{/tikz/graphs/between from}",%
                        "\pgfkeysvalueof{/tikz/graphs/between target}")/%
                        (\pgfkeysvalueof{/tikz/graphs/grid width}+1)}%
      \pgfmathsetmacro\gAngle{%
        anglebetween("\pgfkeysvalueof{/tikz/graphs/between from}",%
                     "\pgfkeysvalueof{/tikz/graphs/between target}")},
    wrap after=\pgfkeysvalueof{/tikz/graphs/grid width},
    group shift=(\gAngle:\gDist),
    chain shift=(\gAngle+90:\gDist),
    /tikz/shift=(\pgfkeysvalueof{/tikz/graphs/between from}),
    /tikz/shift={([rotate=\gAngle]\gDist,%
                  {-\gDist/(\pgfkeysvalueof{/tikz/graphs/grid height})})},
    grid placement,
   ] subgraph I_n
  }
}
\begin{document}
\tikz
  \graph[
    nodes={shape=circle, inner sep=+0pt, minimum size=+1ex, draw}, empty nodes,
    radius=3cm,
  ]{
    subgraph I_n[name=main, V={0, ..., 5}, clockwise=10, phase=180],
    \foreach[count=\i from 0]\j in {1, ..., 5}{
      subgraph grid between[name=between \i_\j_,% don't want to deal with \space
                         between={main \i} and main \j,
                               V={1, ..., 4}],
      main \i -- {between \i_\j_ 1, between \i_\j_ 2}
              -- {between \i_\j_ 3, between \i_\j_ 4} -- main \j
    },
  };
\end{document}

Output

enter image description here

Qrrbrbirlbel
  • 119,821
  • We could also make the grid size dependent on the number of nodes (\tikzgraphVnum = 4) but here, you define the grid size yourself. – Qrrbrbirlbel Nov 03 '23 at 14:18
0

For chemists, Spiro rings are easy to make with ChemFig

\documentclass[border=2mm]{standalone}
\usepackage{chemfig}
\begin{document}
\setchemfig{bond join=true}
    \chemfig{*6([:-30]---(*6([0]---(*6([0]------))---))---)}
\end{document}

enter image description here

A 3D simulation is not difficult to obtain

\documentclass[border=2mm]{standalone}
\usepackage{chemfig}
\begin{document}
\setchemfig{bond join=true,atom sep =2em,cram width =3pt,cram dash width =0.2pt,cram dash sep =0.4pt}
    \chemfig{*6([:-30]---(<[:330]-[,,,,,line width=3pt,shorten <=-.5pt,shorten >=-.5pt]>[:30])(-[:30]--[:330])---)}
\end{document}

enter image description here

With a little more work it is possible to make more complex structures.

CrocoDuck
  • 3,875