1

I would like to create the following image in Latex. I have never used the graphical facilities before so I have no idea how I would go about doing this. The image is supposed to represent a crystal type structure with N layers and the dashes in the middle just mean there are arbitrary many layers in the middle. That's also why I have the three dots between L2 and LN on the right hand side.

So how can I create an image?

enter image description here

Edit As suggested in the comments, here what I attempted before I posted here:

\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}
sonicboom
  • 579
  • You could follow some of the suggestions in this question: http://tex.stackexchange.com/questions/205/what-graphics-packages-are-there-for-creating-graphics-in-latex-documents . You will get more help here if you ask a specific question once you have made a start... – Thruston May 12 '17 at 13:39
  • 1
    You could use a TikZ matrix of nodes (and add a MWE to your post). – CarLaTeX May 12 '17 at 13:46

1 Answers1

2

You can obtain something very similar without any graphic package:

\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}

enter image description here

Bernard
  • 271,350
  • ..hmmm it appears very small when I generate a PDF containing it. I see arraystretch stretches the heights of the columns but how can I scale the widths? – sonicboom May 12 '17 at 16:12
  • 1
    The simplest would be to base the new column type on p{somewidth}, adjust \arraystretch and change the scaling of ``bigcirc`. For now, the squares are more or less 8mm wide. Which dimension would you like for the squares? – Bernard May 12 '17 at 16:19
  • Ok I'd say that a scaling factor of 1.5 would be the ideal amount. – sonicboom May 12 '17 at 17:12
  • 1
    @sonicboom: I've updated the code with newparameters (actually I took 2 as a scaling factor, as 1.5 wasn't very different from the result of the first code. Please see if it's fine. – Bernard May 12 '17 at 17:41