A LaTeX Course.
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

lecture-06-TiKZ.tex 30KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077
  1. \documentclass[handout]{latexkurs}
  2. \subtitle{Grafiken erstellen mit \LaTeX{}}
  3. \date{\dateSeventhLecture}
  4. \def\TikZ{Ti\emph{k}Z}
  5. \begin{document}
  6. \maketitle
  7. \begin{frame}
  8. \frametitle{Grafiken erstellen in \LaTeX}
  9. \onslide<+->
  10. \LaTeX\ stellt von sich aus Möglichkeiten bereit, Graphiken zu erzeugen:
  11. \begin{itemize}
  12. \item<2-> die \texttt{picture}-Umgebung
  13. \item<2-> \texttt{pict2e}, um die \texttt{picture}-Umgebung zu erweitern
  14. \item<2-> \texttt{epic}, \textit{enhanced picture}
  15. \item<2-> \texttt{eepic}, \textit{enhanced epic}
  16. \item<2-> \texttt{pmgraph}, \textit{poor man graphics}
  17. \item<3-> \alert<3-5>{pstricks}
  18. \begin{itemize}
  19. \item<4-> schnell (nutzt Postscript)
  20. \item<5-> funktioniert nicht mit \texttt{pdftex} und \texttt{luatex}
  21. \end{itemize}
  22. \item<6-> \alert<6->{\TikZ}
  23. \begin{itemize}
  24. \item<7-> portabel
  25. \item<8-> langsamer als \texttt{pstricks}
  26. \item<9-> subjektiv einfacher als \texttt{pstricks}
  27. \end{itemize}
  28. \end{itemize}
  29. \end{frame}
  30. \begin{luacode}
  31. function weierstrass(x0, x1, n, a, b, epsilon)
  32. local dx = (x1 - x0) / n
  33. local x = x0
  34. local out = assert(io.open("tmp.data", "w"))
  35. local y, k, dy
  36. while (x <= x1) do
  37. y = 0
  38. k = 0
  39. repeat
  40. dy = math.pow(a, k) * math.cos(math.pow(b, k) * math.pi * x)
  41. y = y + dy
  42. k = k + 1
  43. until (math.abs(dy) < epsilon)
  44. out:write(x, " ", y, "\string\n")
  45. x = x + dx
  46. end
  47. out:close()
  48. end
  49. \end{luacode}
  50. \directlua{weierstrass(-2,2,500,0.3,5,1.e-12)}
  51. \begin{frame}
  52. \frametitle{Weierstraß-Funktion mit \TikZ\ und Lua}
  53. \begin{equation*}
  54. x \mapsto \sum_{n=0} ^\infty a^n \cos(b^n \pi x)
  55. \end{equation*}
  56. \begin{center}
  57. \begin{tikzpicture}
  58. \begin{axis}[axis lines=middle, ymin=-1.5, ymax=1.75]
  59. \addplot[thin, blue] table {tmp.data};
  60. \end{axis}
  61. \end{tikzpicture}
  62. \end{center}
  63. \end{frame}
  64. \section{Grundlagen von \TikZ}
  65. \begin{frame}[fragile]
  66. \frametitle{Wie? }
  67. \onslide<+->
  68. Um \TikZ\ in \LaTeX\ zu nutzen:
  69. \begin{itemize}
  70. \item<+-> \lstinline!\usepackage{tikz}!
  71. \item<+-> Aller Code zwischen \lstinline!\begin{tikzpicture}! und
  72. \lstinline!\end{tikzpicture}! wird von \LaTeX\ an \TikZ\
  73. abgegeben.
  74. \end{itemize}
  75. \onslide<+->
  76. \begin{block}{\textcolor{red}{\textbf{ACHTUNG!}}}
  77. \TikZ\ ist eine eigene \enquote{Sprache}!
  78. \end{block}
  79. \end{frame}
  80. \begin{frame}[fragile,t]
  81. \frametitle{Die \texttt{tikzpicture} Umgebung.}
  82. \begin{lstlisting}
  83. \begin{tikzpicture}
  84. CODE
  85. \end{tikzpicture}
  86. \end{lstlisting}
  87. \pause
  88. Kann zum Beispiel in \texttt{figure} Umgebung eingebettet werden.
  89. \begin{lstlisting}
  90. \begin{figure}[h]
  91. \centering
  92. \begin{tikzpicture}
  93. CODE
  94. \end{tikzpicture}
  95. \caption{\label{fig:someref} some caption}
  96. \end{figure}
  97. \end{lstlisting}
  98. \end{frame}
  99. \begin{frame}[fragile]
  100. \frametitle{Ein paar Linien …}
  101. \centering
  102. \pause
  103. \begin{columns}
  104. \begin{column}{0.3\linewidth}
  105. \centering
  106. \tikzexternalenable
  107. \begin{tikzpicture}[step=0.3]
  108. \draw<2->[red] (0,0) -- (2,3);
  109. \draw<3->[thick,blue] (1,1) -- (1,3);
  110. \uncover<4->{\draw[step=0.3] (0,0) grid (3,3);}
  111. \end{tikzpicture}
  112. \tikzexternaldisable
  113. \end{column}
  114. \begin{column}{0.7\linewidth}
  115. \begin{lstlisting}[frame=none]
  116. \begin{tikzpicture}
  117. \draw[red] (0,0) -- (2,3); \pause
  118. \draw[thick,blue] (1,1) -- (1,3); \pause
  119. \draw[step=.3] (0,0) grid (3,3);
  120. \end{tikzpicture}
  121. \end{lstlisting}
  122. \end{column}
  123. \end{columns}
  124. \pause
  125. \medskip
  126. \begin{columns}
  127. \begin{column}{0.3\linewidth}
  128. \centering
  129. \tikzexternalenable
  130. \begin{tikzpicture}[step=0.3]
  131. \draw<5->[red,->] (0,0) -- (2,3);
  132. \draw<6->[blue,dashed] (1,1) -- (1,3);
  133. \uncover<7->{\draw[dotted] (0,0) grid (3,3);}
  134. \end{tikzpicture}
  135. \tikzexternaldisable
  136. \end{column}
  137. \begin{column}{0.7\linewidth}
  138. \begin{lstlisting}[frame=none]
  139. \begin{tikzpicture}[step=0.3]
  140. \draw[red,->] (0,0) -- (2,3); \pause
  141. \draw[blue,dashed] (1,1) -- (1,3); \pause
  142. \draw[dotted] (0,0) grid (3,3);
  143. \end{tikzpicture}
  144. \end{lstlisting}
  145. \end{column}
  146. \end{columns}
  147. \end{frame}
  148. \begin{frame}[fragile,t]
  149. \frametitle{Noch mehr Linien …}
  150. \pause
  151. \begin{columns}
  152. \begin{column}{0.3\linewidth}
  153. \centering
  154. \tikzexternalenable
  155. \begin{tikzpicture}[step=0.4,scale=0.8]
  156. \uncover<2->{\draw[red!50,thick,<<-] (0,0) -- (2,3);}
  157. \draw<3->[line width=4pt,blue] (1,1) -- (0,2);
  158. \uncover<4->{\draw[dotted] (0,0) grid (3,3);}
  159. \end{tikzpicture}
  160. \tikzexternaldisable
  161. \end{column}
  162. \begin{column}{0.7\linewidth}
  163. \begin{lstlisting}[frame=none]
  164. \begin{tikzpicture}[scale=0.8,step=0.4]
  165. \draw[red!50,thick,<<-] (0,0) -- (2,3); \pause
  166. \draw[line width=4pt,blue] (1,1) -- (0,2); \pause
  167. \draw[dotted] (0,0) grid (3,3);
  168. \end{tikzpicture}
  169. \end{lstlisting}
  170. \end{column}
  171. \end{columns}
  172. \pause
  173. \medskip
  174. \begin{columns}
  175. \begin{column}{0.3\linewidth}
  176. \centering
  177. \tikzexternalenable
  178. \begin{tikzpicture}[every node/.style={below}]
  179. \tikzset{step=0.3}
  180. \draw<5->[red] (0,0) -- (2,3) node[above] {a};
  181. \draw<6->[blue,dashed] (1,1) rectangle (2,2);
  182. \uncover<7->{\draw[dotted] (0,0) node {0} grid (3,3);}
  183. \draw<8->[fill,,opacity=0.3] (1,1) circle(.707);
  184. \end{tikzpicture}
  185. \tikzexternaldisable
  186. \end{column}
  187. \begin{column}{0.7\linewidth}
  188. \begin{lstlisting}[frame=none]
  189. \begin{tikzpicture}[step=0.3]
  190. \tikzset{every node/.style={below}}
  191. \draw[red] (0,0) -- (2,3) node[above] {a}; \pause
  192. \draw[blue,dashed] (1,1) rectangle (2,2); \pause
  193. \draw[dotted] (0,0) node {0} grid (3,3); \pause
  194. \draw[fill,opacity=0.3] (1,1) circle(1);
  195. \end{tikzpicture}
  196. \end{lstlisting}
  197. \end{column}
  198. \end{columns}
  199. \end{frame}
  200. \begin{frame}[fragile]
  201. \frametitle{Jetzt wird's kurvig!}
  202. \pause
  203. \begin{columns}
  204. \begin{column}{0.3\linewidth}
  205. \centering
  206. \tikzexternalenable
  207. \begin{tikzpicture}
  208. \coordinate (a) at (0,0);
  209. \coordinate (b) at (0,1);
  210. \coordinate (c) at (1,1);
  211. \coordinate (d) at (3,2);
  212. \draw[blue] (a) -- (d);
  213. \draw<2-> (a)..controls (b) and (c)..(d);
  214. \draw<3->[green,bend left=30] (a) to (d);
  215. \draw<4->[red,out=90, in=-90] (a) to (d);
  216. \draw<5-> ($(a)!0.5!(d)$) ellipse (1 and 0.5);
  217. \end{tikzpicture}
  218. \tikzexternaldisable
  219. \end{column}
  220. \begin{column}{0.7\linewidth}
  221. \begin{lstlisting}[mathescape=false,frame=none]
  222. \usetikzlibrary{calc}
  223. \begin{tikzpicture}
  224. \coordinate (a) at (0,0);
  225. \coordinate (b) at (0,1);
  226. \coordinate (c) at (1,1);
  227. \coordinate (d) at (3,2);
  228. \draw[blue] (a) -- (d);
  229. \draw (a)..controls (b) and (c)..(d); \pause
  230. \draw[green,bend left=30] (a) to (d); \pause
  231. \draw[red,out=90, in=-90] (a) to (d); \pause
  232. \draw ($(a)!0.5!(d)$) ellipse(1 and 0.5);
  233. \end{tikzpicture}
  234. \end{lstlisting}
  235. \end{column}
  236. \end{columns}
  237. \end{frame}
  238. \begin{frame}[fragile]
  239. \frametitle{Zickzack}
  240. \pause
  241. \begin{columns}
  242. \begin{column}{0.3\linewidth}
  243. \centering
  244. \begin{tikzpicture}
  245. \coordinate (a) at (0,0);
  246. \coordinate (b) at (1,1);
  247. \coordinate (c) at (3,2);
  248. \draw<2->[blue] (a) -- (c);
  249. \draw<3-> (a)--(b)--(c);
  250. \begin{scope}[yshift=1cm,dashed,thick]
  251. \coordinate (a) at (0,0);
  252. \coordinate (c) at (3,2);
  253. \uncover<6->{\draw[red] (a)--(b)--(c);}
  254. \node<7->[draw,circle through=(a)] at (b){};
  255. \end{scope}
  256. \end{tikzpicture}
  257. \end{column}
  258. \begin{column}{0.7\linewidth}
  259. \begin{lstlisting}[mathescape=false,frame=none]
  260. \usetikzlibrary{through}
  261. \begin{tikzpicture}
  262. \coordinate (a) at (0,0);
  263. \coordinate (b) at (1,1);
  264. \coordinate (c) at (3,2);
  265. \draw[blue] (a) -- (c);\pause
  266. \draw (a)--(b)--(c);\pause
  267. \begin{scope}[yshift=1cm,dashed,thick] \pause
  268. \coordinate (a) at (0,0);
  269. \coordinate (c) at (3,2);\pause
  270. \draw[red] (a)--(b)--(c);\pause
  271. \node[draw,circle through=(a)] at (b){};
  272. \end{scope}
  273. \end{tikzpicture}
  274. \end{lstlisting}
  275. \end{column}
  276. \end{columns}
  277. \end{frame}
  278. \begin{frame}[fragile]
  279. \frametitle{Eine andere Sicht.}
  280. \pause
  281. \begin{columns}
  282. \begin{column}{0.2\linewidth}
  283. \centering
  284. \begin{tikzpicture}
  285. \tikzset{tomsbox/.style={rectangle, draw, very thick,
  286. minimum size=7mm, rounded corners=2mm}}
  287. \node[tomsbox] (1) at (0,0) {$T_1$};
  288. \node[tomsbox] (2) [below=of 1] {$T_2$};
  289. \node[tomsbox] (3) [below=of 2] {$T_3$};
  290. \node[tomsbox] (4) [below=of 3] {$T_4$};
  291. \draw (1)--(2)--(3)--(4);
  292. \end{tikzpicture}
  293. \end{column}
  294. \begin{column}{0.8\linewidth}
  295. \begin{lstlisting}[mathescape=false,frame=none]
  296. \usetikzlibrary{positioning} % in der Präambel
  297. \begin{tikzpicture}
  298. \tikzset{tomsbox/.style={rectangle, draw,
  299. very thick,minimum size=7mm,
  300. rounded corners=2mm}}
  301. \node[tomsbox] (1) at (0,0) {$T_1$};
  302. \node[tomsbox] (2) [below=of 1] {$T_2$};
  303. \node[tomsbox] (3) [below=of 2] {$T_3$};
  304. \node[tomsbox] (4) [below=of 3] {$T_4$};
  305. \draw (1)--(2)--(3)--(4);
  306. \end{tikzpicture}
  307. \end{lstlisting}
  308. \end{column}
  309. \end{columns}
  310. \end{frame}
  311. \begin{frame}[fragile]
  312. \frametitle{Wiederholungen}
  313. \pause
  314. \begin{columns}
  315. \begin{column}{0.2\linewidth}
  316. \centering
  317. \begin{tikzpicture}
  318. \tikzset{tomsbox/.style={rectangle, draw, very thick,
  319. minimum size=7mm, rounded corners=2mm}}
  320. \node[tomsbox] (1) at (0,0) {$T_1$};
  321. \foreach \i [count=\j] in {2,3,4}{
  322. \node[tomsbox] (\i) [below=of \j] {$T_\i$};
  323. \draw (\j)--(\i);
  324. }
  325. \end{tikzpicture}
  326. \end{column}
  327. \begin{column}{0.82\linewidth}
  328. \begin{lstlisting}[mathescape=false,frame=none]
  329. \begin{tikzpicture}
  330. \tikzset{tomsbox/.style={rectangle, draw,
  331. very thick,minimum size=7mm,
  332. rounded corners=2mm}}
  333. \node[tomsbox] (1) at (0,0) {$T_1$};
  334. \foreach \i [count=\j] in {2,3,4}
  335. {
  336. \node[tomsbox] (\i) [below=of \j] {$T_\i$};
  337. \draw (\j)--(\i);
  338. }
  339. \end{tikzpicture}
  340. \end{lstlisting}
  341. \end{column}
  342. \end{columns}
  343. \end{frame}
  344. \begin{frame}[fragile]
  345. \frametitle{Bibliotheken}
  346. \onslide<+->
  347. Die Funktionalität von \TikZ\ kann durch externe \emph{Bibliotheken} erweitert werden.
  348. \onslide<+->
  349. \begin{Beispiel}
  350. \begin{lstlisting}
  351. \usetikzlibrary{automata}
  352. \end{lstlisting}
  353. \centering
  354. \begin{tikzpicture}[shorten >=1pt,node distance=1cm and 3cm,on grid,
  355. every state/.style={draw=blue!50,very thick,fill=blue!20}]
  356. \node[state,initial] (q_0) {$q_0$};
  357. \node[state] (q_1) [above right=of q_0] {$q_1$};
  358. \node[state] (q_2) [below right=of q_0] {$q_2$};
  359. \path[->] (q_0) edge node [above left] {0} (q_1)
  360. edge node [below left] {1} (q_2)
  361. (q_1) edge [loop above] node {0} ()
  362. (q_2) edge [loop below] node {1} ();
  363. \end{tikzpicture}
  364. \end{Beispiel}
  365. \end{frame}
  366. \begin{frame}
  367. \frametitle{Bibliotheken}
  368. \onslide<+->
  369. \texttt{3d},
  370. \texttt{angles},
  371. \texttt{arrows},
  372. \texttt{automata},
  373. \texttt{babel},
  374. \texttt{backgrounds},
  375. \texttt{bending},
  376. \texttt{calc},
  377. \texttt{calendar},
  378. \texttt{chains},
  379. \texttt{decorations},
  380. \texttt{decorations.footprints},
  381. \texttt{decorations.fractals},
  382. \texttt{decorations.markings},
  383. \texttt{decorations.pathmorphing},
  384. \texttt{decorations.pathreplacing},
  385. \texttt{decorations.shapes},
  386. \texttt{decorations.text},
  387. \texttt{er},
  388. \texttt{fadings},
  389. \texttt{fit},
  390. \texttt{fixedpointarithmetic},
  391. \texttt{folding},
  392. \texttt{fpu},
  393. \texttt{intersections},
  394. \texttt{lindenmayersystems},
  395. \texttt{math},
  396. \texttt{matrix},
  397. \texttt{mindmap},
  398. \texttt{patterns},
  399. \texttt{petri},
  400. \texttt{plothandlers},
  401. \texttt{plotmarks},
  402. \texttt{positioning},
  403. \texttt{quotes},
  404. \texttt{scopes},
  405. \texttt{shadings},
  406. \texttt{shadows},
  407. \texttt{shapes.arrows},
  408. \texttt{shapes.callouts},
  409. \texttt{shapes},
  410. \texttt{shapes.gates.logic.IEC},
  411. \texttt{shapes.gates.logic.US},
  412. \texttt{shapes.geometric},
  413. \texttt{shapes.misc},
  414. \texttt{shapes.multipart},
  415. \texttt{shapes.symbols},
  416. \texttt{snakes},
  417. \texttt{spy},
  418. \texttt{svg.path},
  419. \texttt{through},
  420. \texttt{topaths},
  421. \texttt{trees},
  422. \texttt{turtle}
  423. \end{frame}
  424. \section{Datenvisualisierung}
  425. \begin{frame}[fragile]
  426. \frametitle{Datenvisualisierung}
  427. \onslide<+->
  428. \begin{columns}
  429. \begin{column}{0.3\linewidth}
  430. \centering
  431. \begin{tikzpicture}
  432. \datavisualization [school book axes, visualize as smooth line]
  433. data {x, y
  434. -1.5, 2.25
  435. -1, 1
  436. -.5, .25
  437. 0, 0
  438. .5, .25
  439. 1, 1
  440. 1.5, 2.25
  441. };
  442. \end{tikzpicture}
  443. \end{column}
  444. \begin{column}{0.6\linewidth}
  445. \small
  446. \begin{lstlisting}[frame=none]
  447. \usetikzlibrary{datavisualization}
  448. \begin{tikzpicture}
  449. \datavisualization [school book axes,
  450. visualize as smooth line]
  451. data {x, y
  452. -1.5, 2.25
  453. -1, 1
  454. -.5, .25
  455. 0, 0
  456. .5, .25
  457. 1, 1
  458. 1.5, 2.25
  459. };
  460. \end{tikzpicture}
  461. \end{lstlisting}
  462. \end{column}
  463. \end{columns}
  464. \end{frame}
  465. \begin{frame}[fragile]
  466. \frametitle{Automatisch}
  467. \onslide<+->
  468. \begin{columns}
  469. \begin{column}{0.3\linewidth}
  470. \centering
  471. \begin{tikzpicture}[baseline]
  472. \datavisualization [school book axes,
  473. visualize as smooth line]
  474. data [format=function] {
  475. var x : interval [-1.5:1.5] samples 7;
  476. func y = \value x * \value x;
  477. };
  478. \end{tikzpicture}
  479. \end{column}
  480. \begin{column}{0.6\linewidth}
  481. \small
  482. \begin{lstlisting}[mathescape=false,frame=none]
  483. \usetikzlibrary{datavisualization,
  484. datavisualization.formats.functions}
  485. \begin{tikzpicture}
  486. \datavisualization
  487. [school book axes,
  488. visualize as smooth line]
  489. data [format=function] {
  490. var x : interval [-1.5:1.5]
  491. samples 7;
  492. func y = \value x * \value x;
  493. };
  494. \end{tikzpicture}
  495. \end{lstlisting}
  496. \end{column}
  497. \end{columns}
  498. \end{frame}
  499. \begin{frame}[fragile]
  500. \frametitle{Achsen}
  501. \onslide<+->
  502. \begin{columns}
  503. \begin{column}{0.3\linewidth}
  504. \centering
  505. \begin{tikzpicture}[baseline]
  506. \datavisualization [scientific axes=clean,
  507. x axis={length=.7\linewidth, ticks=few},
  508. visualize as smooth line]
  509. data [format=function] {
  510. var x : interval [-1.5:1.5] samples 7;
  511. func y = \value x * \value x;
  512. };
  513. \end{tikzpicture}
  514. \end{column}
  515. \begin{column}{0.6\linewidth}
  516. \small
  517. \begin{lstlisting}[mathescape=false,frame=none]
  518. \begin{tikzpicture}
  519. \datavisualization
  520. [scientific axes=clean,
  521. x axis={length=.7\linewidth,
  522. ticks=few},
  523. visualize as smooth line]
  524. data [format=function] {
  525. var x : interval [-1.5:1.5]
  526. samples 7;
  527. func y = \value x * \value x;
  528. };
  529. \end{tikzpicture}
  530. \end{lstlisting}
  531. \end{column}
  532. \end{columns}
  533. \end{frame}
  534. \begin{frame}[fragile]
  535. \frametitle{Darstellung}
  536. \onslide<+->
  537. \begin{columns}
  538. \begin{column}{0.3\linewidth}
  539. \centering
  540. \begin{tikzpicture}[baseline]
  541. \datavisualization [scientific axes=clean,
  542. x axis={length=.7\linewidth, ticks=few},
  543. visualize as scatter]
  544. data [format=function] {
  545. var x : interval [-1.5:1.5] samples 7;
  546. func y = \value x * \value x;
  547. };
  548. \end{tikzpicture}
  549. \end{column}
  550. \begin{column}{0.6\linewidth}
  551. \small
  552. \begin{lstlisting}[mathescape=false,frame=none]
  553. \begin{tikzpicture}
  554. \datavisualization
  555. [scientific axes=clean,
  556. x axis={length=.7\linewidth,
  557. ticks=few},
  558. visualize as scatter]
  559. data [format=function] {
  560. var x : interval [-1.5:1.5]
  561. samples 7;
  562. func y = \value x * \value x;
  563. };
  564. \end{tikzpicture}
  565. \end{lstlisting}
  566. \end{column}
  567. \end{columns}
  568. \end{frame}
  569. \begin{frame}[fragile]
  570. \frametitle{Legenden}
  571. \onslide<+->
  572. \begin{columns}
  573. \begin{column}{0.3\linewidth}
  574. \centering
  575. \begin{tikzpicture}[baseline]
  576. \datavisualization [scientific axes=clean,
  577. x axis={length=.7\linewidth, ticks=few},
  578. legend={below},
  579. visualize as smooth line/.list={square},
  580. square={label in legend={text=$x^2$}}]
  581. data [format=function,set=square] {
  582. var x : interval [-1.5:1.5] samples 7;
  583. func y = \value x * \value x;
  584. };
  585. \end{tikzpicture}
  586. \end{column}
  587. \begin{column}{0.6\linewidth}
  588. \small
  589. \begin{lstlisting}[mathescape=false,frame=none]
  590. \begin{tikzpicture}
  591. \datavisualization
  592. [scientific axes=clean,
  593. x axis={length=.7\linewidth,
  594. ticks=few},
  595. legend={below},
  596. visualize as smooth
  597. line/.list={sq},
  598. sq={label in legend={text=$x^2$}}]
  599. data [format=function,set=sq] {
  600. var x : interval [-1.5:1.5]
  601. samples 7;
  602. func y = \value x * \value x;
  603. };
  604. \end{tikzpicture}
  605. \end{lstlisting}
  606. \end{column}
  607. \end{columns}
  608. \end{frame}
  609. \mode<handout>
  610. \section{Ein Tutorial}
  611. \begin{frame}[t]
  612. \begin{block}{Ziel}
  613. \begin{center}
  614. \begin{tikzpicture}[
  615. thick,
  616. >=stealth',
  617. dot/.style = {
  618. draw,
  619. fill = white,
  620. circle,
  621. inner sep = 0pt,
  622. minimum size = 4pt
  623. }
  624. ]
  625. \coordinate (O) at (0,0);
  626. \draw[->] (-0.3,0) -- (8,0) coordinate[label = {below:$x$}] (xmax);
  627. \draw[->] (0,-0.3) -- (0,5) coordinate[label = {right:$f(x)$}] (ymax);
  628. \path[name path=x] (0.3,0.5) -- (6.7,4.7);
  629. \path[name path=y] plot[smooth] coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  630. \begin{scope}[name intersections = {of = x and y, name = i}]
  631. \fill[gray!20] (i-1) -- (i-2 |- i-1) -- (i-2) -- cycle;
  632. \draw (0.3,0.5) -- (6.7,4.7) node[pos=0.8, below right] {Sekante};
  633. \draw[red] plot[smooth] coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  634. \draw (i-1) node[dot, label = {above:$P$}] (i-1) {} -- node[left,yshift=-3pt]
  635. {$f(x_0)$} (i-1 |- O) node[dot, label = {below:$x_0$}] {};
  636. \path (i-2) node[dot, label = {above:$Q$}] (i-2) {} -- (i-2 |- i-1)
  637. node[dot] (i-12) {};
  638. \draw (i-12) -- (i-12 |- O) node[dot,
  639. label = {below:$x_0 + \varepsilon$}] {};
  640. \draw[blue, <->] (i-2) -- node[right] {$f(x_0 + \varepsilon) - f(x_0)$}
  641. (i-12);
  642. \draw[blue, <->] (i-1) -- node[below] {$\varepsilon$} (i-12);
  643. \path (i-1 |- O) -- node[below] {$\varepsilon$} (i-2 |- O);
  644. \draw[gray] (i-2) -- (i-2 -| xmax);
  645. \draw[gray, <->] ([xshift = -0.5cm]i-2 -| xmax) -- node[fill = white]
  646. {$f(x_0 + \varepsilon)$} ([xshift = -0.5cm]xmax);
  647. \end{scope}
  648. \end{tikzpicture}
  649. \end{center}
  650. \end{block}
  651. \end{frame}
  652. \begin{frame}[t,fragile]
  653. \onslide<+->
  654. \begin{center}
  655. \scalebox{0.5}{
  656. \begin{tikzpicture}
  657. \coordinate (O) at (0,0); \draw[->] (-0.3,0) -- (8,0) coordinate[label =
  658. {below:$x$}] (xmax); \draw[->] (0,-0.3) -- (0,5) coordinate[label =
  659. {right:$f(x)$}] (ymax);
  660. \end{tikzpicture}
  661. }
  662. \end{center}
  663. \small
  664. \begin{lstlisting}
  665. \coordinate (O) at (0,0);
  666. \draw[->] (-0.3,0) -- (8,0) coordinate[label = {below:$x$}] (xmax);
  667. \draw[->] (0,-0.3) -- (0,5) coordinate[label = {right:$f(x)$}] (ymax);
  668. \end{lstlisting}
  669. \end{frame}
  670. \begin{frame}[t,fragile]
  671. \begin{center}
  672. \scalebox{0.5}{
  673. \begin{tikzpicture}
  674. \coordinate (O) at (0,0);
  675. \draw[->] (-0.3,0) -- (8,0) coordinate[label = {below:$x$}] (xmax);
  676. \draw[->] (0,-0.3) -- (0,5) coordinate[label = {right:$f(x)$}] (ymax);
  677. \draw (0.3,0.5) -- (6.7,4.7) node[pos=0.8, below right] {Sekante};
  678. \draw[red] plot[smooth] coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  679. \end{tikzpicture}
  680. }
  681. \end{center}
  682. \small
  683. \begin{lstlisting}
  684. \draw (0.3,0.5) -- (6.7,4.7) node[pos=0.8, below right] {Sekante};
  685. \draw[red] plot[smooth] coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  686. \end{lstlisting}
  687. \end{frame}
  688. \begin{frame}[t,fragile]
  689. \onslide<+->
  690. \begin{center}
  691. \scalebox{0.5}{
  692. \begin{tikzpicture}
  693. \coordinate (O) at (0,0);
  694. \draw[->] (-0.3,0) -- (8,0) coordinate[label = {below:$x$}] (xmax);
  695. \draw[->] (0,-0.3) -- (0,5) coordinate[label = {right:$f(x)$}] (ymax);
  696. \path[name path=x] (0.3,0.5) -- (6.7,4.7);
  697. \path[name path=y] plot[smooth] coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  698. \begin{scope}[name intersections = {of = x and y, name = i}]
  699. \fill[gray!20] (i-1) -- (i-2 |- i-1) -- (i-2) -- cycle;
  700. \draw (0.3,0.5) -- (6.7,4.7) node[pos=0.8, below right] {Sekante};
  701. \draw[red] plot[smooth] coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  702. \end{scope}
  703. \end{tikzpicture}
  704. }
  705. \end{center}
  706. \small
  707. \begin{lstlisting}
  708. \usetikzlibrary{intersections} % in der Präambel
  709. \path[name path=x] (0.3,0.5) -- (6.7,4.7);
  710. \path[name path=y] plot[smooth]
  711. coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  712. \begin{scope}[name intersections = {of = x and y, name = i}]
  713. \fill[gray!20] (i-1) -- (i-2 |- i-1) -- (i-2) -- cycle;
  714. \draw (0.3,0.5) -- (6.7,4.7) node[pos=0.8, below right] {Sekante};
  715. \draw[red] plot[smooth]
  716. coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  717. \end{scope}
  718. \end{lstlisting}
  719. \end{frame}
  720. \begin{frame}[t,fragile]
  721. \begin{center}
  722. \scalebox{0.5}{
  723. \begin{tikzpicture}
  724. \coordinate (O) at (0,0);
  725. \draw[->] (-0.3,0) -- (8,0) coordinate[label = {below:$x$}] (xmax);
  726. \draw[->] (0,-0.3) -- (0,5) coordinate[label = {right:$f(x)$}] (ymax);
  727. \path[name path=x] (0.3,0.5) -- (6.7,4.7);
  728. \path[name path=y] plot[smooth] coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  729. \begin{scope}[name intersections = {of = x and y, name = i}]
  730. \fill[gray!20] (i-1) -- (i-2 |- i-1) -- (i-2) -- cycle;
  731. \draw (0.3,0.5) -- (6.7,4.7) node[pos=0.8, below right] {Sekante};
  732. \draw[red] plot[smooth] coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  733. \draw (i-1) node[label = {above:$P$}] {} -- node[left,yshift=-3pt]
  734. {$f(x_0)$} (i-1 |- O) node[label = {below:$x_0$}] {};
  735. \end{scope}
  736. \end{tikzpicture}
  737. }
  738. \end{center}
  739. \small
  740. \begin{lstlisting}
  741. \begin{scope}[name intersections = {$\dots$}]
  742. $\dots\quad (\textsl{Wie vorher})$
  743. \draw (i-1) node[label = {above:$\text{\$P\$}$}] {}
  744. -- node[left,yshift=-3pt] {$\text{\$f(x\_0)\$}$}
  745. (i-1 |- O) node[label = {below:$\text{\$x\_0\$}$}] {};
  746. \end{scope}
  747. \end{lstlisting}
  748. \end{frame}
  749. \begin{frame}[t,fragile]
  750. \onslide<+->
  751. \begin{center}
  752. \scalebox{0.5}{
  753. \begin{tikzpicture}
  754. \coordinate (O) at (0,0);
  755. \draw[->] (-0.3,0) -- (8,0) coordinate[label = {below:$x$}] (xmax);
  756. \draw[->] (0,-0.3) -- (0,5) coordinate[label = {right:$f(x)$}] (ymax);
  757. \path[name path=x] (0.3,0.5) -- (6.7,4.7);
  758. \path[name path=y] plot[smooth] coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  759. \begin{scope}[name intersections = {of = x and y, name = i}]
  760. \fill[gray!20] (i-1) -- (i-2 |- i-1) -- (i-2) -- cycle;
  761. \draw (0.3,0.5) -- (6.7,4.7) node[pos=0.8, below right] {Sekante};
  762. \draw[red] plot[smooth] coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  763. \draw (i-1) node[label = {above:$P$}] {} -- node[left,yshift=-3pt]
  764. {$f(x_0)$} (i-1 |- O) node[label = {below:$x_0$}] {};
  765. \path (i-2) node[label = {above:$Q$}] {} -- (i-2 |- i-1) node (i-12) {};
  766. \end{scope}
  767. \end{tikzpicture}
  768. }
  769. \end{center}
  770. \small
  771. \begin{lstlisting}
  772. \begin{scope}[$\dots$]
  773. $\dots\quad (\textsl{Wie vorher})$
  774. \path (i-2) node[label = {above:$\text{\$Q\$}$}] {}
  775. -- (i-2 |- i-1) node (i-12) {};
  776. \end{scope}
  777. \end{lstlisting}
  778. \end{frame}
  779. \begin{frame}[t,fragile]
  780. \begin{center}
  781. \scalebox{0.5}{
  782. \begin{tikzpicture}
  783. \coordinate (O) at (0,0);
  784. \draw[->] (-0.3,0) -- (8,0) coordinate[label = {below:$x$}] (xmax);
  785. \draw[->] (0,-0.3) -- (0,5) coordinate[label = {right:$f(x)$}] (ymax);
  786. \path[name path=x] (0.3,0.5) -- (6.7,4.7);
  787. \path[name path=y] plot[smooth] coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  788. \begin{scope}[name intersections = {of = x and y, name = i}]
  789. \fill[gray!20] (i-1) -- (i-2 |- i-1) -- (i-2) -- cycle;
  790. \draw (0.3,0.5) -- (6.7,4.7) node[pos=0.8, below right] {Sekante};
  791. \draw[red] plot[smooth] coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  792. \draw (i-1) node[label = {above:$P$}] {} -- node[left,yshift=-3pt]
  793. {$f(x_0)$} (i-1 |- O) node[label = {below:$x_0$}] {};
  794. \path (i-2) node[label = {above:$Q$}] {} -- (i-2 |- i-1) node (i-12) {};
  795. \draw (i-12) -- (i-12 |- O) node[label = {below:$x_0 + \varepsilon$}] {};
  796. \end{scope}
  797. \end{tikzpicture}
  798. }
  799. \end{center}
  800. \small
  801. \begin{lstlisting}
  802. \begin{scope}[$\dots$]
  803. $\dots\quad(\textsf{Wie vorher})$
  804. \draw (i-12) -- (i-12 |- O)
  805. node[label = {below:\$x_0 + \varepsilon\$}] {};
  806. \end{scope}
  807. \end{lstlisting}
  808. \end{frame}
  809. \begin{frame}[t,fragile]
  810. \begin{center}
  811. \scalebox{0.5}{
  812. \begin{tikzpicture}
  813. \coordinate (O) at (0,0);
  814. \draw[->] (-0.3,0) -- (8,0) coordinate[label = {below:$x$}] (xmax);
  815. \draw[->] (0,-0.3) -- (0,5) coordinate[label = {right:$f(x)$}] (ymax);
  816. \path[name path=x] (0.3,0.5) -- (6.7,4.7);
  817. \path[name path=y] plot[smooth] coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  818. \begin{scope}[name intersections = {of = x and y, name = i}]
  819. \fill[gray!20] (i-1) -- (i-2 |- i-1) -- (i-2) -- cycle;
  820. \draw (0.3,0.5) -- (6.7,4.7) node[pos=0.8, below right] {Sekante};
  821. \draw[red] plot[smooth] coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  822. \draw (i-1) node[label = {above:$P$}] {} -- node[left,yshift=-3pt]
  823. {$f(x_0)$} (i-1 |- O) node[label = {below:$x_0$}] {};
  824. \path (i-2) node[label = {above:$Q$}] {} -- (i-2 |- i-1) node (i-12) {};
  825. \draw (i-12) -- (i-12 |- O) node[label = {below:$x_0 + \varepsilon$}] {};
  826. \draw[blue, <->] (i-2) -- node[right] {$f(x_0 + \varepsilon) - f(x_0)$} (i-12);
  827. \draw[blue, <->] (i-1) -- node[below] {$\varepsilon$} (i-12);
  828. \end{scope}
  829. \end{tikzpicture}
  830. }
  831. \end{center}
  832. \small
  833. \begin{lstlisting}
  834. \begin{scope}[$\dots$]
  835. $\dots\quad(\textsl{Wie vorher})$
  836. \draw[blue, <->] (i-2) --
  837. node[right] {\$f(x_0 + \varepsilon) - f(x_0)\$} (i-12);
  838. \draw[blue, <->] (i-1) --
  839. node[below] {\$\varepsilon\$} (i-12);
  840. \end{scope}
  841. \end{lstlisting}
  842. \end{frame}
  843. \begin{frame}[t,fragile]
  844. \begin{center}
  845. \scalebox{0.5}{
  846. \begin{tikzpicture}
  847. \coordinate (O) at (0,0);
  848. \draw[->] (-0.3,0) -- (8,0) coordinate[label = {below:$x$}] (xmax);
  849. \draw[->] (0,-0.3) -- (0,5) coordinate[label = {right:$f(x)$}] (ymax);
  850. \path[name path=x] (0.3,0.5) -- (6.7,4.7);
  851. \path[name path=y] plot[smooth] coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  852. \begin{scope}[name intersections = {of = x and y, name = i}]
  853. \fill[gray!20] (i-1) -- (i-2 |- i-1) -- (i-2) -- cycle;
  854. \draw (0.3,0.5) -- (6.7,4.7) node[pos=0.8, below right] {Sekante};
  855. \draw[red] plot[smooth] coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  856. \draw (i-1) node[label = {above:$P$}] {} -- node[left,yshift=-3pt]
  857. {$f(x_0)$} (i-1 |- O) node[label = {below:$x_0$}] {};
  858. \path (i-2) node[label = {above:$Q$}] {} -- (i-2 |- i-1) node (i-12) {};
  859. \draw (i-12) -- (i-12 |- O) node[label = {below:$x_0 + \varepsilon$}] {};
  860. \draw[blue, <->] (i-2) -- node[right] {$f(x_0 + \varepsilon) - f(x_0)$} (i-12);
  861. \draw[blue, <->] (i-1) -- node[below] {$\varepsilon$} (i-12);
  862. \path (i-1 |- O) -- node[below] {$\varepsilon$} (i-2 |- O);
  863. \draw[gray] (i-2) -- (i-2 -| xmax);
  864. \draw[gray, <->] ([xshift = -0.5cm]i-2 -| xmax) -- node[fill = white]
  865. {$f(x_0 + \varepsilon)$} ([xshift = -0.5cm]xmax);
  866. \end{scope}
  867. \end{tikzpicture}
  868. }
  869. \end{center}
  870. \small
  871. \begin{lstlisting}
  872. \begin{scope}[$\dots$]
  873. $\dots\quad (\textsl{Wie vorher})$
  874. \path (i-1 |- O) --
  875. node[below] {\$\varepsilon\$} (i-2 |- O);
  876. \draw[gray] (i-2) -- (i-2 -| xmax);
  877. \draw[gray, <->] ([xshift = -0.5cm]i-2 -| xmax) --
  878. node[fill = white] {\$f(x_0 + \varepsilon)\$}
  879. ([xshift = -0.5cm]xmax);
  880. \end{scope}
  881. \end{lstlisting}
  882. \end{frame}
  883. \begin{frame}[t,fragile]
  884. \begin{center}
  885. \scalebox{0.5}{
  886. \begin{tikzpicture}[
  887. thick,
  888. >=stealth',
  889. dot/.style = {
  890. draw,
  891. fill = white,
  892. circle,
  893. inner sep = 0pt,
  894. minimum size = 4pt
  895. }
  896. ]
  897. \coordinate (O) at (0,0);
  898. \draw[->] (-0.3,0) -- (8,0) coordinate[label = {below:$x$}] (xmax);
  899. \draw[->] (0,-0.3) -- (0,5) coordinate[label = {right:$f(x)$}] (ymax);
  900. \path[name path=x] (0.3,0.5) -- (6.7,4.7);
  901. \path[name path=y] plot[smooth] coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  902. \begin{scope}[name intersections = {of = x and y, name = i}]
  903. \fill[gray!20] (i-1) -- (i-2 |- i-1) -- (i-2) -- cycle;
  904. \draw (0.3,0.5) -- (6.7,4.7) node[pos=0.8, below right] {Sekante};
  905. \draw[red] plot[smooth] coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  906. \draw (i-1) node[dot, label = {above:$P$}] (i-1) {} -- node[left,yshift=-3pt]
  907. {$f(x_0)$} (i-1 |- O) node[dot, label = {below:$x_0$}] {};
  908. \path (i-2) node[dot, label = {above:$Q$}] (i-2) {} -- (i-2 |- i-1)
  909. node[dot] (i-12) {};
  910. \draw (i-12) -- (i-12 |- O) node[dot,
  911. label = {below:$x_0 + \varepsilon$}] {};
  912. \draw[blue, <->] (i-2) -- node[right] {$f(x_0 + \varepsilon) - f(x_0)$}
  913. (i-12);
  914. \draw[blue, <->] (i-1) -- node[below] {$\varepsilon$} (i-12);
  915. \path (i-1 |- O) -- node[below] {$\varepsilon$} (i-2 |- O);
  916. \draw[gray] (i-2) -- (i-2 -| xmax);
  917. \draw[gray, <->] ([xshift = -0.5cm]i-2 -| xmax) -- node[fill = white]
  918. {$f(x_0 + \varepsilon)$} ([xshift = -0.5cm]xmax);
  919. \end{scope}
  920. \end{tikzpicture}
  921. }
  922. \end{center}
  923. \small
  924. \begin{lstlisting}
  925. \begin{tikzpicture}[thick, >=stealth',
  926. dot/.style = {
  927. draw,
  928. fill = white,
  929. circle,
  930. inner sep = 0pt,
  931. minimum size = 4pt
  932. }]
  933. $\dots$
  934. \end{lstlisting}
  935. \end{frame}
  936. \end{document}
  937. %%% Local Variables:
  938. %%% mode: latex
  939. %%% TeX-master: t
  940. %%% TeX-engine: luatex
  941. %%% End: