我想在 Latex 中创建以下图像。我以前从未使用过图形工具,所以我不知道该怎么做。该图像应该表示具有 N 层的晶体类型结构,中间的虚线仅表示中间有任意多个层。这也是为什么我在右侧的 L2 和 LN 之间有三个点。
那么我怎样才能创建图像?
编辑 正如评论中所建议的,以下是我在发布之前尝试过的内容:
\documentclass[11pt]{article}
\usepackage{tikz}
\usetikzlibrary{3d,calc}
\newcommand{\DrawNode}[2][]{%
\draw [#1]
([shift={(-\pgflinewidth,-0.5\pgflinewidth)}]#2.north east) --
([shift={(0.5\pgflinewidth,-0.5\pgflinewidth)}]#2.north west) --
([shift={(0.5\pgflinewidth,+0.5\pgflinewidth)}]#2.south west) --
([shift={(-\pgflinewidth,+0.5\pgflinewidth)}]#2.south east)
;
}%
\begin{document}
\begin{tikzpicture}[thick]
\node [draw=none, inner sep=0pt, minimum size=2cm] (1) at (0, 0) { };
\DrawNode[dotted]{1}
\node [draw=none, inner sep=0pt, minimum size=2cm] (1) at (4, 0) { };
\DrawNode[dotted]{1}
\node [style={draw, draw opacity=0.5, inner sep=0pt, minimum size=2cm}] (2) at (2,0) { };
\end{tikzpicture}
\end{document}
答案1
你可以得到非常类似的东西没有任何图形包:
\documentclass[11pt, svgnames]{article}
\usepackage[utf8]{inputenc}
\usepackage{array, multirow,booktabs}
\usepackage[table]{xcolor}
\usepackage{amssymb, mathtools, graphicx}
\usepackage{arydshln}
\setlength\dashlinedash{2pt}
\setlength\dashlinegap{1.2pt}
\newcommand\Bigcirc{\raisebox{0.3ex}{\scalebox{2}{$\bigcirc$}}}
\newcolumntype{C}{>{\columncolor{Gainsboro!80!Lavender}[\arraycolsep][10pt]}c}
\begin{document}
\[ \renewcommand\arraystretch{2.4}%
\ADLnullwidehline
\nodashgapcolor
\begin{array}{C:*{5}{>{\columncolor{Gainsboro!80!Lavender}[\arraycolsep][10pt]}c:}>{\columncolor{Gainsboro!80!Lavender}}cc}%
\cline{1-7}
\rowcolor{white} \phantom{\bigcirc} & \Bigcirc & \Bigcirc & \Bigcirc & \Bigcirc & \Bigcirc & \phantom{\bigcirc} & L₁\\
\cdashline{1-7}
\rowcolor{white} & \Bigcirc & \Bigcirc & \Bigcirc & \Bigcirc & \Bigcirc & & L₂\\
\dashgapcolor{Gainsboro!80!Lavender} \cdashline{1-7}%
& & & & & & & \multirow{2}{*}{\cellcolor{white}{$ ⋮ $}} \\
& & & & & & \\
\cdashline{1-7}
\rowcolor{white} & \Bigcirc & \Bigcirc & \Bigcirc & \Bigcirc & \Bigcirc & & L_N\\
\cline{1-7}
\end{array} \]%
\end{document}