2

How can I draw these two schemes with LaTeX?

cfr
  • 198,882
Mary
  • 21
  • 3
    Welcome! What have you tried? If you post the code you've got then you are more likely to get effective help. Partly because people don't have to start from scratch and partly because then you can make clear exactly what your question is. What is the problem or obstacle you can't solve when trying to draw these? – cfr Dec 17 '15 at 22:27
  • 1
    Also, your question says LaTeX but the tags specify TikZ. What are you trying to use? You might be trying any number of approaches and solutions may not help you if we don't know which. – cfr Dec 17 '15 at 22:29
  • Related: http://tex.stackexchange.com/questions/184603/tape-environment-in-latex, http://tex.stackexchange.com/questions/23090/overlapping-tikz-nodes-to-look-as-a-tape-strip, http://tex.stackexchange.com/questions/153895/making-this-figure-in-latex etc. – cfr Dec 17 '15 at 22:42
  • Also, what schemes are these? What are they for? What do they represent? Your question lacks some context. Welcome to Tex.SE! – Alenanno Dec 17 '15 at 22:51

2 Answers2

2

As starting point for other images:

enter image description here

\documentclass[border=3mm,tikz]{standalone}
    \usetikzlibrary{arrows.meta,
                    bending,
                    calc,chains,
                    shapes.misc,
% added for compatibility with babel ...
                    babel
                    }
    \usepackage{mathtools}

\begin{document}
    \begin{tikzpicture}[
    node distance = 0pt,
shorten <>/.style = {shorten <=#1, shorten >=#1},
start chain = going right,
  box/.style = {shape=rectangle, draw, fill=#1,
                minimum width=6mm, minimum height=9mm, outer sep=0pt,
                node contents={},
                on chain},
box/.default = none,
arrow/.style = {draw=blue!60!black, thick, shorten <>=1mm, 
                out=90, in=90, looseness=3,
                -{Straight Barb[bend]}},
arbox/.style = {inner sep=0pt, minimum size=5pt},
crbox/.style = {inner sep=0pt,
                node contents={\scriptsize\color{red}$\boldsymbol{\times}$}
                },
    label distance = -3pt,
   sx/.style = {xshift=#1pt}
                        ]
\node (n0) [box,dashed];
\foreach \i in {1,2,...,13}
    \ifnum\i<6
        \node (n\i) [box]
    \else
        \node (n\i) [box=gray!25]
    \fi;
\node (n14) [box,dashed];
    \draw[very thick,shorten <>=-2mm]  (n5.north east)  --  (n5.south east);
    \draw[ultra thick,dotted,shorten <=1mm]  (n0)  -- + (-9mm,0mm);
    \draw[ultra thick,dotted,shorten <=1mm]  (n14) -- + (+9mm,0mm);
\fill[black!75]  (n1)  circle (1mm)  (n2)  circle (1mm)   (n6) circle (1mm)
                (n10) circle (1mm)  (n12) circle (1mm)
                ($(n13)+(0,1.3)$)  circle (1mm);
% arrows
\draw[arrow]    ([sx=-1] n1.north) to node[arbox,label=above:$\delta$] {} (n0.north);
\draw[arrow]    ([sx= 1] n1.north) to node[crbox,label=above:$\delta$] {} (n2.north);
%
\draw[arrow]    ([sx=-1] n6.north) to node[crbox] {} (n5.north);
\draw[arrow]    ([sx= 1] n6.north) to node[arbox] {} (n7.north);
%
\draw[arrow]    ([sx=-1] n10.north) to node[arbox,label=above:$\delta$] {} (n9.north);
\draw[arrow]    ([sx= 1] n10.north) to node[arbox] {} (n11.north);
%
\draw[->]    (n12.north) -- + (0,0.7) node[ left] {$\omega_{\mathrm{off}}$};
\draw[<-]    (n13.north) -- + (0,0.7) node[right] {$\omega_{\mathrm{on}}$};
% x axe
\draw[->]    ($(n1.south west)+(0,-1)$) coordinate (a) 
                        -- (a -| n13.east) node[right] {$x$};
\draw   ($(a -| n5)+(0,1mm)$) node[above] {$s-1$} -- + (0,-2mm) node[below] {$-\varepsilon$}
        ($(a -| n6)+(0,1mm)$) node[above] {$s$}   -- + (0,-2mm) node[below] {$0$}
        ($(a -| n7)+(0,1mm)$) node[above] {$s+1$} -- + (0,-2mm) node[below] {$\varepsilon$};
    \end{tikzpicture}
\end{document}
Zarko
  • 296,517
1

Here's a beginning for the first one. Start from this if you have nothing and then post a more specific question if you get stuck.

\documentclass[tikz,border=10pt,multi]{standalone}
\usetikzlibrary{matrix}
\tikzset{
  my tape/.style={
    matrix of nodes, nodes={minimum height=3ex, font=\sffamily, inner sep=0pt, anchor=center, minimum width=3ex, text centered, #1}, nodes in empty cells
  },
  my tape end/.style={
    draw=none, inner xsep=2.5pt
  }
}
\begin{document}
\begin{tikzpicture}
  \matrix (tape 1) [my tape={draw=gray, very thin}]
  {
    |[my tape end]|\dots&\textbullet&\textbullet&&&\textbullet&&\textbullet&|[my tape end]|\dots\\
  };
  \draw [thick] ([xshift=-2.5pt]tape 1-1-2.north west) -- ([xshift=2.5pt]tape 1-1-8.north east);
  \draw [thick] ([xshift=-2.5pt]tape 1-1-2.south west) -- ([xshift=2.5pt]tape 1-1-8.south east);
\end{tikzpicture}
\end{document}

ticker tape

Within the matrix, we can start a cell using |...| and the ... will be added to the command which creates the node. So, for example, adding |[fill=gray]| to a cell produces

filled cell

After the matix, we can refer to the cells within the matrix by their node names. These are given by

<name of matrix>-<row>-<column>

Hence since the matrix was named tape 1 in the example above,

  • tape 1-1-1 refers to the first cell (with the dots);
  • tape 1-1-2 refers to the second cell;

    ...

  • tape 1-1-9 refers to the last cell (with the other dots).

As usual, these nodes have anchor points and these are used in the code above to draw the thick lines above and beneath the ticker tape.

This can also be used to add the annotations and arrows required. For example,

  \draw [<-] ([yshift=2.5pt]tape 1-1-8.north)  -- ++(0,10pt) node [pos=.75, right, text=blue!25!gray] {$w_{on}$} node [yshift=2.5pt] {\textbullet} ;

annotated cell

The arrows and so on can be added in the same way, using the usual path specification options provided by TikZ.

cfr
  • 198,882