答案1
因为这是一张“重复”的图片,所以我们用循环来重复\foreach
。首先放置一些坐标,然后绘制线条、圆圈(顶点)和标签。
像这样:
\documentclass[tikz,border=2mm]{standalone}
\begin{document}
\begin{tikzpicture}[thick,scale=1.5]
% coordinates
\foreach\i in {0,...,12}
{
\coordinate (A\i) at ({0.5*sqrt(3)*\i},{1+0.5*mod(\i,2)}); % top
\coordinate (B\i) at ({0.5*sqrt(3)*\i}, {-0.5*mod(\i,2)}); % bottom
}
% left hexagons
\draw (A6) foreach\i in {6,...,0} {-- (A\i)} -- (B0) foreach\i in {1,...,6} {-- (B\i)};
\foreach\i in {2,4,6}
\draw (A\i) -- (B\i);
% right hexagon
\draw (A10) -- (A11) -- (A12) -- (B12) -- (B11) -- (B10) -- cycle;
% dashed lines
\foreach\i in {A,B}\foreach\j in {6,9}
\pgfmathtruncatemacro\k{\j+1}
\draw[gray,dotted] (\i\j) -- (\i\k);
\draw [gray,dotted] (A7) ++ (0.2,-1) --++ ({sqrt(3)-0.4},0);
% vertices and labels
\foreach\i in {0,...,7,9,10,11,12}
{
\pgfmathtruncatemacro\j{\i+1}
\draw[fill=white] (A\i) circle (0.4mm) \ifnum\i<3 node[above] {$\j$}\fi;
\pgfmathtruncatemacro\j{6-\i}
\draw[fill=white] (B\i) circle (0.4mm) \ifnum\i<3 node[below] {$\j$}\fi;
}
\node[yshift=5mm] at (A10) {$2n-3$};
\node[above] at (A11) {$2n-4$};
\node[above right] at (A12) {$2n+1$};
\node[below right] at (B12) {$2n$};
\node[below] at (B11) {$2n-1$};
\node[yshift=-5mm] at (B10) {$2n-2$};
\foreach\i in {1,2,3}
\pgfmathtruncatemacro\j{2*\i-1}
\node[yshift=-1cm] at (B\j) {\Large$H_\i$};
\node[yshift=-1cm] at (B7) {\Large$\cdots$};
\node[yshift=-1cm] at (B9) {\Large$\cdots$};
\node[yshift=-1cm] at (B11) {\Large$H_n$};
\end{tikzpicture}
\end{document}
答案2
带chemfig
包装
\documentclass[border=1.5cm]{standalone}
\usepackage{chemfig}
\def\atsep{4em}
\begin{document}
\chemfig[atom sep=\atsep]{
*6(--(*6(--(*6(--(*6(--[,,,,draw=none](*6(-[,,,,draw=none]-(*6(-----))---[,,,,draw=none]))-[,,,,draw=none]-[,,,,draw=none]-))---))---))----)
}
\chemmove{
\coordinate (R1) at (cyclecenter1);
\coordinate (R2) at (cyclecenter2);
\coordinate (R3) at (cyclecenter3);
\coordinate (R4) at (cyclecenter4);
\coordinate (R5) at (cyclecenter5);
\coordinate (R6) at (cyclecenter6);
\draw[-, dashed, shorten <=10pt, shorten >=10pt] (R4) -- (R5);
\foreach \x in {1,2,3,6}{\foreach \y in {30,90,...,330}{
\draw[fill=white] (R\x) ++(\y:\atsep) circle[radius=2pt];}}
\foreach \x in {4,5}{\foreach \y in {90,270}{
\draw[fill=white] (R\x) ++(\y:\atsep) circle[radius=2pt];}}
\path[every node/.style={circle, label distance=-0.5em}]
(R1) ++(150:\atsep) node[label={150:1}] {}
(R1) ++(90:\atsep) node[label={90:2}] {}
(R1) ++(30:\atsep) node[label={90:3}] {}
(R1) ++(-30:\atsep) node[label={270:4}] {}
(R1) ++(-90:\atsep) node[label={-90:5}] {}
(R1) ++(-150:\atsep) node[label={-150:6}] {}
(R1) ++(-90:3em+\atsep) node {$\mathrm{H}_1$}
(R2) ++(-90:3em+\atsep) node {$\mathrm{H}_2$}
(R6) ++(-90:3em+\atsep) node {$\mathrm{H}_n$};
\path[every node/.style={label distance=-0.5em}]
(R6) ++(30:\atsep) node[label={30:$2n+1$}] {}
(R6) ++(90:\atsep) node[label={90:$2n-4$}] {}
(R6) ++(150:\atsep) node[label={[label distance=0.3em]90:$2n-3$}] {}
(R6) ++(-150:\atsep) node[label={[label distance=0.3em]-90:$2n-2$}] {}
(R6) ++(-90:\atsep) node[label={-90:$2n-1$}] {}
(R6) ++(-30:\atsep) node[label={-30:$2n$}] {};
}
\end{document}
答案3
另一种解决方案是使用regular polygons
及其锚点作为参考。
\documentclass[tikz, border=2mm]{standalone}
\usetikzlibrary{shapes.geometric, positioning}
\begin{document}
\begin{tikzpicture}[
hexagon/.style={regular polygon, regular polygon sides=6, shape border rotate=30, draw, minimum size=3cm, outer sep=0pt}]
\node[hexagon, label={[label distance=5mm]below:$H_1$}] (h1) {};
\node[hexagon, label={[label distance=5mm]below:$H_2$}, right=-.25\pgflinewidth of h1.side 5] (h2) {};
\node[hexagon, label={[label distance=5mm]below:$H_3$}, right=-.25\pgflinewidth of h2.side 5] (h3) {};
\node[hexagon, right=-.25\pgflinewidth of h3.side 5, draw=none] (h4) {};
\node[hexagon, right=-.25\pgflinewidth of h4.side 5, draw=none] (h5) {};
\node[hexagon, label={[label distance=5mm]below:$H_n$}, right=-.25\pgflinewidth of h5.side 5] (h6) {};
\draw[dotted] (h4.corner 2)--(h4.corner 1);
\draw[dotted] (h4.corner 3)--(h4.corner 4);
\draw[dotted] (h5.corner 1)--(h5.corner 6);
\draw[dotted] (h5.corner 4)--(h5.corner 5);
\foreach \i in {1,2,...,6}
\foreach \j in {1,2,3,6}
\draw[fill=white] (h\j.corner \i) circle (2pt);
\foreach \i/\j in {4/1, 4/4, 5/1, 5/4}
\draw[fill=white] (h\i.corner \j) circle(2pt);
\foreach \i in {-5pt, 0pt, 5pt}
\draw[fill] ([xshift=\i]h4.side 5) circle(1pt);
\foreach \i/\j in {1/2,2/1,3/6}
\node[above=1mm] at (h1.corner \j) {\i};
\foreach \i/\j in {$2n-3$/2,$2n-4$/1,$2n+1$/6}
\node[above=1mm] at (h6.corner \j) {\i};
\foreach \i/\j in {4/5,5/4,6/3}
\node[below=1mm] at (h1.corner \j) {\i};
\foreach \i/\j in {$2n$/5,$2n-1$/4,$2n-2$/3}
\node[below=1mm] at (h6.corner \j) {\i};
\end{tikzpicture}
\end{document}