Beamer

Version 5 (Andrey Golovin, 03.10.2013 00:40)

1 1 Andrey Golovin
h1. Приёмы создания илюстраций в LATEX
2 1 Andrey Golovin
3 1 Andrey Golovin
4 1 Andrey Golovin
> > Файлы и листинги которые я размещаю не идеальны, это рабочие файлы, которые делались часто на скорость.
5 1 Andrey Golovin
6 1 Andrey Golovin
h2. Приамбула
7 1 Andrey Golovin
8 1 Andrey Golovin
В большинстве случаев я использую некий шаблон постоянного содержания откуда указывается путь к файлу с содержимым. Если надо задать некоторые функции я их  выношу в отдельный файл, как впрочем настройки стилей, так и пакеты для использования.
9 1 Andrey Golovin
10 2 Andrey Golovin
* Основной файл: attachment:prez.tex
11 2 Andrey Golovin
* Функции: attachment:functions.tex
12 2 Andrey Golovin
* Подключаемые пакеты: attachment:packages.tex
13 2 Andrey Golovin
* Настроки стилей: attachment:header.sty 
14 2 Andrey Golovin
* Пример файла с содержимым: attachment:cont.tex
15 4 Andrey Golovin
* Все растровые картинки располагаются в директории *./fig*
16 4 Andrey Golovin
* Файлы для графиков располагаются в директории *./plot*
17 3 Andrey Golovin
18 3 Andrey Golovin
Для сборки всего в один pdf файл используется:
19 1 Andrey Golovin
<code>
20 4 Andrey Golovin
lualatex --shell-escape prez.tex
21 1 Andrey Golovin
</code>
22 4 Andrey Golovin
23 4 Andrey Golovin
h2. Примеры
24 4 Andrey Golovin
25 5 Andrey Golovin
h3. Химические формулы (chemfig):
26 5 Andrey Golovin
27 5 Andrey Golovin
Номера атомов располагались с помощью невидимых  связей
28 5 Andrey Golovin
29 5 Andrey Golovin
|_.Код      |_. Результат   |
30 5 Andrey Golovin
|<pre><code>
31 5 Andrey Golovin
\begin{frame}{Основания}
32 5 Andrey Golovin
    \setatomsep{1.6em}%
33 5 Andrey Golovin
      \footnotesize \begin{tabular}{c c c c}
34 5 Andrey Golovin
          \chemfig{*6((-[5,0.5,,,draw=none]\color{blue}2)=N(-[6,0.5,,,draw=none]\color{blue}3)-(-[6,0.5,,,draw=none]\color{blue}4)*6(
35 5 Andrey Golovin
            -\chembelow{N}{H}(-[6,1.0,,,draw=none]\color{blue}9)-(-[7,0.5,,,draw=none]\color{blue}8)=N?(-[1,0.5,,,draw=none]\color{blue}7))
36 5 Andrey Golovin
        =?(-[2,0.5,,,draw=none]\color{blue}5)-(-[2,0.5,,,draw=none]\color{blue}6)=N(-[3,0.5,,,draw=none]\color{blue}1)-[,,1])} &
37 5 Andrey Golovin
38 5 Andrey Golovin
            \chemfig{*6((-[:-130]H_2N)=N-*6(-\chembelow{N}{H}-=N?)=?-(=[2]O)-HN-[,,2])}&
39 5 Andrey Golovin
            \chemfig{*6(=N-*6(-\chembelow{N}{H}-=N?)=?-(-[2]NH_2)=N-[,,1])}&~\\[1.0cm]-HN-[,,2])}&
40 5 Andrey Golovin
            \chemfig{*6(=N-*6(-\chembelow{N}{H}-=N?)=?-(-[2]NH_2)=N-[,,1])}&~\\[1.0cm]
41 5 Andrey Golovin
            Пурин&Гуанин&Аденин& \\[.2cm]
42 5 Andrey Golovin
             \hline\\[.2cm]
43 5 Andrey Golovin
             \chemfig{*6((-[5,0.5,,,draw=none]\color{blue}2)=N(-[6,0.5,,,draw=none]\color{blue}1)-(-[7,0.5,,,draw=none]\color{blue}6)
44 5 Andrey Golovin
             =(-[1,0.5,,,draw=none]\color{blue}5)-(-[2,0.5,,,draw=none]\color{blue}4)=N(-[3,0.6,,,draw=none]\color{blue}3)-)} &
45 5 Andrey Golovin
            \chemfig{*6((=[5]O)-\chembelow{N}{H}-=-(-[2]NH_2)=N-)} &
46 5 Andrey Golovin
            \chemfig{*6((=[5]O)-\chembelow{N}{H}-=-(=[2]O)-HN-[,,2])} &
47 5 Andrey Golovin
            \chemfig{*6((=[5]O)-\chembelow{N}{H}-=(-[1])-(=[2]O)-HN-[,,2])} 
48 5 Andrey Golovin
              \\[1.0cm]
49 5 Andrey Golovin
            Пиримидин&Цитозин&Урацил&Тимин\\[.2cm]
50 5 Andrey Golovin
             \hline
51 5 Andrey Golovin
52 5 Andrey Golovin
        \end{tabular}
53 5 Andrey Golovin
        \end{center}
54 5 Andrey Golovin
\end{frame}</code></pre>| !nucl-5.png! |
55 5 Andrey Golovin
56 5 Andrey Golovin
Стерео связи и подписи:
57 5 Andrey Golovin
58 5 Andrey Golovin
|_.Код      |_. Результат   |
59 5 Andrey Golovin
|<pre><code>
60 5 Andrey Golovin
\begin{frame}{Основания и остов}
61 5 Andrey Golovin
        \begin{center}
62 5 Andrey Golovin
    \begin{tikzpicture}[help lines/.style={thin,draw=black!50}]
63 5 Andrey Golovin
        \node (2) at (6,5) {N-гликозидная связь};
64 5 Andrey Golovin
        \node (1) at (2,2) {%
65 5 Andrey Golovin
    \schemestart[][west]
66 5 Andrey Golovin
    \setatomsep{1.7em}\setcrambond{0.2em}{}{}%
67 5 Andrey Golovin
     \small\chemfig{-[0]O-[0]-[6]?<[7](-[,,,,line
68 5 Andrey Golovin
        width=0.2em]>[1](-[2]OH)-[:160,1.3]O?)-[6]O
69 5 Andrey Golovin
        -[6]P(=[:-90]O)(-[4]\chemabove{O}{\hspace{1em}-})
70 5 Andrey Golovin
        -[0]O-[0]-[6]?[c2]<[7](-[,,,,line
71 5 Andrey Golovin
        width=0.2em]>[1](-[2]OH)-[:160,1.3]O?[c2])-[6]O-[6]
72 5 Andrey Golovin
    }
73 5 Andrey Golovin
    \arrow{-U>[ 2B ]}[0] 
74 5 Andrey Golovin
    \setatomsep{1.7em}\setcrambond{0.2em}{}{}%
75 5 Andrey Golovin
      \small\chemfig{-[0]O-[0]-[6]?<[7](-[,,,,line
76 5 Andrey Golovin
        width=0.2em]>[1](-[2]B)-[:160,1.3]O?)-[6]O
77 5 Andrey Golovin
        -[6]P(=[:-90]O)(-[4]\chemabove{O}{\hspace{1em}-})
78 5 Andrey Golovin
        -[0]O-[0]-[6]?[c2]<[7](-[,,,,line
79 5 Andrey Golovin
        width=0.2em]>[1](-[2]B)-[:160,1.3]O?[c2])-[6]O-[6]
80 5 Andrey Golovin
    }
81 5 Andrey Golovin
\schemestop};
82 5 Andrey Golovin
\draw [orange,thick](2.south east) -- (2.south);
83 5 Andrey Golovin
\draw [->,orange,thick] (2.south east) -- (6,3.8);
84 5 Andrey Golovin
\end{tikzpicture}
85 5 Andrey Golovin
        \end{center}
86 5 Andrey Golovin
\end{frame}
87 5 Andrey Golovin
</code></pre>| !nucl-6.png! |
88 5 Andrey Golovin
89 5 Andrey Golovin
90 5 Andrey Golovin
h3. Формулы и объеткы tikz:
91 5 Andrey Golovin
92 5 Andrey Golovin
|_.Код      |_. Результат   |
93 5 Andrey Golovin
|<pre><code>
94 5 Andrey Golovin
{Молекулярная динамика}
95 5 Andrey Golovin
\begin{center}
96 5 Andrey Golovin
    \tiny
97 5 Andrey Golovin
$$ U=\sum_{bonds}{ \frac{k_i}{2} ( l_i - l_0)^2} + \sum_{angles}{ \frac{k_i}{2} ( \phi_i - \phi_0)^2} + \sum_{torsions} { \frac{V_n}{2} (1 + cos(n\omega - \gamma))} + $$
98 5 Andrey Golovin
$$ + \sum_{i=1}^N \sum_{j=i+1}^N  \left (   4 \epsilon_{ij} \left [ \left ( \frac{\sigma_{ij}}{r_{ij}} \right )^{12} - \left ( \frac{\sigma_{ij}}{r_{ij}} \right )^6  \right ] + 
99 5 Andrey Golovin
\frac{q_i q_j}{ 4\pi \epsilon_0 r_{ij}} \right ) $$  
100 5 Andrey Golovin
\rule[0.5cm]{\linewidth}{1pt}
101 5 Andrey Golovin
\begin{tikzpicture}[node distance=1cm, auto]  
102 5 Andrey Golovin
\tikzset{%
103 5 Andrey Golovin
    mynode/.style={rectangle,draw=brown, top color=blue!10,bottom color=blue!10 },
104 5 Andrey Golovin
    myarrow/.style={->, >=latex', shorten >=1pt, thick},
105 5 Andrey Golovin
    mylabel/.style={text width=7em, text centered} 
106 5 Andrey Golovin
}  
107 5 Andrey Golovin
\node (nGray)   [mynode]   at      (0, 2.5) 
108 5 Andrey Golovin
{%
109 5 Andrey Golovin
    \begin{minipage}{0.4\textwidth}
110 5 Andrey Golovin
        \footnotesize Расчёт силы, действующей на атом  
111 5 Andrey Golovin
        \begin{center}
112 5 Andrey Golovin
        \normalsize
113 5 Andrey Golovin
$ F_i= \sum_j F_{ij} $
114 5 Andrey Golovin
       \end{center}
115 5 Andrey Golovin
    \end{minipage}
116 5 Andrey Golovin
};
117 5 Andrey Golovin
\node (nRed)    [mynode]    at      (3, 0)
118 5 Andrey Golovin
{%
119 5 Andrey Golovin
    \begin{minipage}{0.4\textwidth}
120 5 Andrey Golovin
       \footnotesize Расчёт новых координат  
121 5 Andrey Golovin
        \normalsize
122 5 Andrey Golovin
        \begin{center}
123 5 Andrey Golovin
            $ \frac{\partial^2r_i}{\partial t^2}=\frac{F_i}{m_i} $ \\
124 5 Andrey Golovin
            $ \frac{\partial r_i}{\partial t} =v_i , \frac{\partial
125 5 Andrey Golovin
            v_i}{\partial t} = \frac{F_i}{m_i} $
126 5 Andrey Golovin
       \end{center}
127 5 Andrey Golovin
    \end{minipage}
128 5 Andrey Golovin
};
129 5 Andrey Golovin
\node[mylabel, below of=nGray] (label1) at (-1,2) {%
130 5 Andrey Golovin
    \begin{minipage}{0.1\textwidth}
131 5 Andrey Golovin
           \[ \Delta t \]
132 5 Andrey Golovin
    \end{minipage}
133 5 Andrey Golovin
   };  
134 5 Andrey Golovin
\draw [ color   = red,   ultra thick,  -> ](nGray) |- (nRed);
135 5 Andrey Golovin
\draw [ color   = brown, ultra thick,  -> ](nRed) |- (nGray);
136 5 Andrey Golovin
\end{tikzpicture} 
137 5 Andrey Golovin
\end{center}
138 5 Andrey Golovin
\end{frame}%
139 5 Andrey Golovin
</code></pre>| !nucl-11.png! |
140 5 Andrey Golovin
141 5 Andrey Golovin
142 5 Andrey Golovin
143 5 Andrey Golovin
h3. Изображение и объеткы tikz:
144 5 Andrey Golovin
145 5 Andrey Golovin
|_.Код      |_. Результат   |
146 5 Andrey Golovin
|<pre><code>
147 5 Andrey Golovin
\begin{frame}%
148 5 Andrey Golovin
{Система для моделирования}
149 5 Andrey Golovin
\begin{tikzpicture}[xscale=1.0,yscale=1.0]
150 5 Andrey Golovin
    \node (ri) at (3,2 ) {\includegraphics[width=0.45\textwidth]{ribo.png}};
151 5 Andrey Golovin
    \node (cu) at (9,2) {\includegraphics[width=0.45\textwidth]{ribocube.png}};
152 5 Andrey Golovin
    \draw[thick,opacity=0.7] (2,1) rectangle (4,3);
153 5 Andrey Golovin
    \draw[thick] (cu.south west) rectangle (cu.north east);
154 5 Andrey Golovin
    \draw[dashed] (4,3) -- (cu.north west);
155 5 Andrey Golovin
    \draw[dashed] (4,1) -- (cu.south west);
156 5 Andrey Golovin
      \begin{scope}[fill opacity=.5,transparency group]
157 5 Andrey Golovin
    \node[thick,draw=black, fill=orange,opacity=0.5,circle,minimum size=1cm, radius=1.5] 
158 5 Andrey Golovin
    at (cu.center) {~} ;
159 5 Andrey Golovin
    \end{scope} 
160 5 Andrey Golovin
     \node at (cu.center){Lig};
161 5 Andrey Golovin
  \end{tikzpicture}
162 5 Andrey Golovin
\end{frame}%
163 5 Andrey Golovin
</code></pre>| !nucl-12.png! |
164 5 Andrey Golovin
165 5 Andrey Golovin
166 4 Andrey Golovin
h3. График функции и не только:
167 5 Andrey Golovin
168 4 Andrey Golovin
|_.Код      |_. Результат   |
169 5 Andrey Golovin
|<pre><code>
170 4 Andrey Golovin
\begin{frame}%
171 4 Andrey Golovin
{Конформационное равновесие}
172 4 Andrey Golovin
  \begin{center}
173 4 Andrey Golovin
    \schemestart 
174 4 Andrey Golovin
    \setnodestyle{draw,rectangle,fill=red,minimum size=20pt}
175 4 Andrey Golovin
    \chemfig{P_2} 
176 4 Andrey Golovin
    \arrow{<->>}
177 4 Andrey Golovin
    \setnodestyle{draw,circle,fill=yellow,minimum size=20pt}
178 4 Andrey Golovin
    \chemfig{P_1}
179 4 Andrey Golovin
    \schemestop
180 4 Andrey Golovin
    \hspace{3cm}~\par
181 4 Andrey Golovin
    \vspace{.75cm}
182 4 Andrey Golovin
\begin{tikzpicture}[xscale=1.0,yscale=1.0]
183 4 Andrey Golovin
    %% Pot energy plot
184 4 Andrey Golovin
  \begin{axis}[height=7cm,width=15cm,
185 4 Andrey Golovin
    xmin=-300,xmax=400,ymin=-.2, hide x axis, hide y axis,
186 4 Andrey Golovin
    xlabel=$$, ylabel=$$]
187 4 Andrey Golovin
   \addplot+[raw gnuplot, draw=blue, mark=none, smooth,thick] gnuplot[id=m]{%
188 4 Andrey Golovin
         set xrange [-180:180]; plot 1-0.25*(1+cos(3*pi*x/180))- 0.25*(1+cos(2*pi*x/180)) };
189 4 Andrey Golovin
  \draw[dashed,thick,red,->] (axis cs:-150,.7) parabola bend (axis cs:-70,0.95)(axis cs:0,.7);
190 4 Andrey Golovin
  \addplot[->,thick] coordinates {(-180,0.33) (-150,0.33)};
191 4 Andrey Golovin
  \addplot[->,thick] coordinates {(-180,0.90) (-80,.90)};
192 4 Andrey Golovin
  \addplot[thick] coordinates {(-180,0.90) (-180,.70)};
193 4 Andrey Golovin
  \addplot[thick] coordinates {(-180,0.33) (-180,.52)};
194 4 Andrey Golovin
  \addplot[->,thick] coordinates {(90,0.33) (-120,0.33)};
195 4 Andrey Golovin
  \addplot[->,thick] coordinates {(90,0.00) (5,.00)};
196 4 Andrey Golovin
  \addplot[thick] coordinates {(90,0.33) (90,0.22)};
197 4 Andrey Golovin
  \addplot[thick] coordinates {(90,0) (90,.05)};
198 4 Andrey Golovin
  \node at (axis cs:-180,0.6) {$\Delta E_a$};
199 4 Andrey Golovin
  \node at (axis cs:90,0.16) {$\Delta G$};
200 4 Andrey Golovin
  \node at (axis cs:-140,0.25) {$P_2$};
201 4 Andrey Golovin
  \node at (axis cs:0,-0.1) {$P_1$};
202 4 Andrey Golovin
  \node at (axis cs:200,0.1){%
203 4 Andrey Golovin
  \Large{$\frac{[P_1]}{[P_2]}\sim e^{-\frac{\Delta G}{RT}}
204 4 Andrey Golovin
      $}
205 4 Andrey Golovin
   } ;
206 4 Andrey Golovin
  \node at (axis cs:200,-0.1){%
207 4 Andrey Golovin
  $\frac{1}{100}\sim $ \textit{5 кКал}} ;
208 4 Andrey Golovin
  \node at  (axis cs:-180,0){%
209 4 Andrey Golovin
  \Large{$ k_v \sim e^{-\frac{\Delta E_a}{RT}}$}
210 4 Andrey Golovin
  };
211 1 Andrey Golovin
\end{axis}
212 4 Andrey Golovin
\end{tikzpicture}
213 4 Andrey Golovin
  \end{center}
214 4 Andrey Golovin
\end{frame}%
215 5 Andrey Golovin
</code></pre>| !prez-2.png! |