Slide 1

Slide 1 text

TikZ ೖ໳ L UTMC October 23, 2020

Slide 2

Slide 2 text

TikZ ͱ͸ ▶ TikZ ͸ TikZ ist kein Zeichenprogramm (υΠπޠͰʮTikZ ͸ඳըϓϩάϥ ϜͰ͸͋Γ·ͤΜʯ) ͷུ 1(࠶ؼత಄ࣈޠ) ▶ Till Tantau ࢯʹΑΔ L A TEX ͷඳըػೳ ▶ picture ؀ڥͷΑ͏ʹը૾ϑΝΠϧΛ഑ஔ͢ΔͷͰ͸ͳ͘ɼ௚઀ඳը͢Δ 1ެࣜϚχϡΞϧΑΓɽ ʮϓϩάϥϜͱ͍͏ΑΓ͸ݴޠʯͱ͍͏͜ͱΒ͍͠ɽެࣜϚχϡΞϧ ͸ίϯιʔϧ্Ͱ”texdoc tikz” ͱଧͯ͹දࣔ͞ΕΔɽ 2/22

Slide 3

Slide 3 text

࢖͍ํ % p d f ग़ ྗ ͢ Δ ͱ ͖ ͸ Φ ϓ γ ϣ ϯ Λ Ճ ͑ Δ \documentclass [dvipdfmx ]{ jsarticle} % t i k z ύ ο έ ʔ δ Λ ಡ Έ ࠐ Ή \usepackage {tikz} % ඞ ཁ ʹ Ԡ ͡ ͯ ֦ ு ϥ Π ϒ ϥ Ϧ Λ ಡ Έ ࠐ Ή \usetikzlibrary { intersections , calc , arrows} \begin{document} % 1 ߦ ͷ ඳ ը ॲ ཧ \tikz\draw (0 ,0) - -(1 ,1); % ෳ ਺ ߦ ͷ ඳ ը ॲ ཧ ( f i g u r e ؀ ڥ Ͱ ͞ Β ʹ ғ Μ Ͱ ΋ ͍ ͍ ) \begin{ tikzpicture } \draw (0 ,0) - -(1 ,1); \draw (0 ,1) - -(1 ,0); \end{ tikzpicture } \end{document} ͲΜͳॲཧͰ΋࠷ޙʹηϛίϩϯΛ͚ͭΔɽ ࠲ඪͷࢦఆ͸ (x,y) (্͕+y, ӈ͕+x) ·ͨ͸ۃ࠲ඪܗࣜ (֯౓:௕͞) 3/22

Slide 4

Slide 4 text

୯७ͳઢ \tikz\draw (0 ,0) - -(1 ,1) - -(2 ,0); ઢ෼ͷ୺఺ͷ࠲ඪΛ--Ͱͭͳ͍Ͱॻ͍͍ͯ͘ɽ \tikz\draw (0,0)--(1,1)--(2,0)-- cycle; cycle ͰऴΘΔͱऴ఺ͱ࢝఺Λͭͳ͍Ͱดͯ͘͡ΕΔɽ \tikz\draw[line width =2, rounded corners =5](0 ,0) - -(1 ,1) - -(2 ,0); ઢͷଠ͞ɼ֯ͷؙΈͳͲΛௐ੔Մೳɽ࠶ͼઑΒͤΔʹ͸ sharp cornersɽ 4/22

Slide 5

Slide 5 text

ઢͷଠ͞ɾೋॏઢ \begin{ tikzpicture } \draw[line width =1pt](0 ,0) - -(2 ,0); \draw[line width =1mm](0 , -0.5) - -(2 , -0.5); \draw[ultra thin ](0,-1)--(2,-1); \draw[very thin ](0 , -1.5) - -(2 , -1.5); \draw[thin ](0,-2)--(2,-2); \draw[semithick ](0 , -2.5) - -(2 , -2.5); \draw[thick ](0,-3)--(2,-3); \draw[very thick ](0 , -3.5) - -(2 , -3.5); \draw[ultra thick ](0,-4)--(2,-4); \draw[double ](0 , -4.5) - -(2 , -4.5); \draw[double=red ](0,-5)--(2,-5); \draw[double distance =2pt](0 , -5.5) - -(2 , -5.5); \draw[line width =1mm , opacity =.6](0 , -6) - -(2 , -6); \end{ tikzpicture } 5/22

Slide 6

Slide 6 text

ഁઢ \begin{ tikzpicture }[ line width =1] % ڞ ௨ ͢ Δ Φ ϓ γ ϣ ϯ ͸ ͜ ͜ ʹ ॻ ͚ Δ \draw[dotted ](0 ,3) - -(2 ,3); \draw[dashed ](0 ,2.5) - -(2 ,2.5); \draw[dash dot ](0 ,2) - -(2 ,2); \draw[dash dot dot ](0 ,1.5) - -(2 ,1.5); \draw[densely dotted ](0 ,1) - -(2 ,1); \draw[loosely dotted ](0 ,0.5) - -(2 ,0.5); \draw[dash pattern=on 3pt off 2pt on 5pt off 2pt ](0 ,0) - -(2 ,0); \end{ tikzpicture } 6/22

Slide 7

Slide 7 text

໼ҹͷܗঢ় \begin{ tikzpicture }[ line width =1] \draw [ - >](0 ,3.5) - -(1 ,3.5); \draw [ < -](0 ,3) - -(1 ,3); \draw [ < - >](0 ,2.5) - -(1 ,2.5); \draw [->>](0,2)--(1,2); \draw[->,>=to ](0 ,1.5) - -(1 ,1.5); \draw[->,>=latex ](0 ,1) - -(1 ,1); \draw[<-,>= stealth ](0 ,0.5) - -(1 ,0.5); \draw[stealth -latex ](0 ,0) - -(1 ,0); \end{ tikzpicture } tikzpicture ؀ڥͷΦϓγϣϯʹ [>=stealth] ͳͲͱઃఆ͢Δ͜ͱ΋Ͱ͖Δɽ 7/22

Slide 8

Slide 8 text

఺ʹ஫ऍ \begin{ tikzpicture }[ line width =1] \draw (0 , -0.5) node[left ]{ ࢝ } - -(0.5 , -0.5) node[below ]{$\pi$} --(1,-0.5) node[right ]{ \hbox{\tate ऴ ఺}}; \end{ tikzpicture } ࢝ π ऴ ఺ ࠲ඪͷ௚ޙʹ node[Ґஔ]{จࣈྻ} ͱॻ͘ͱͦͷҐஔʹจࣈྻΛදࣔͰ͖Δɽ Ґஔ͸ above,left,below,right,above left ͳͲɽ จࣈྻ͸਺ࣜ΍ L A TEX ຊจͰ࢖͑Δ΋ͷͳΒେମࢦఆͰ͖Δɽ 8/22

Slide 9

Slide 9 text

௕ํܗɾਨઢ \begin{ tikzpicture } \draw (0 ,1.5) rectangle (2 ,2); \draw[rounded corners =5](0 ,0) rectangle (2 ,1); \end{ tikzpicture } ର֯ઢͷ࠲ඪΛࢦఆ͢Δɽ\draw ͷΦϓγϣϯ͸͍ΖΜͳ΋ͷʹྲྀ༻Մೳɽ \begin{ tikzpicture } \draw (0 ,0.5)| -(1 ,1); \draw (0 ,0) -|(1 ,0.5); \draw (2,1)--($(0 ,0)!(2 ,1)!(1 ,0)$); \end{ tikzpicture } $(a,b)!(x,y)!(c,d)$ Ͱ (x,y) ͔Β (a,b),(c,d) Λ݁Ϳ௚ઢʹԼΖͨ͠ਨઢͷ଍ ͕ٻ·Δɽ 9/22

Slide 10

Slide 10 text

֨ࢠɾԁɾପԁ \begin{ tikzpicture } \draw[step=1,gray ]( -0.2 , -0.2) grid (2.2 ,2.2); \draw (0.5 ,0.5) circle (0.5) node{$\pi r^2$}; \draw (1 ,1.5) ellipse (1 and 0.5); \draw (1.5 ,0.5) circle[x radius =0.6 , y radius =0.3 , rotate =45]; \end{ tikzpicture } πr2 \draw[step=֨ࢠִؒ](ࠨԼ)grid(ӈ্) Ͱ֨ࢠɽ (த৺࠲ඪ)circle(൒ܘ) Ͱԁɽ (த৺࠲ඪ)ellipse(x ൒ܘ and y ൒ܘ) Ͱପԁɽ (த৺࠲ඪ)circle[x radius=,y radius=,rotate=] Ͱ΋ପԁɽ 10/22

Slide 11

Slide 11 text

৭ ৭͸ xcolor.sty Ͱఆٛ͞Ε͍ͯΔ͕ɼTikZ ΛಡΈࠐΊ͹ xcolor ΋ಡΈࠐ·ΕΔɽ ▶ RGB ܥ : red, green, blue, brown, lime, orange, pink, purple, teal, violet ▶ CMYK ܥ : cyan, magenta, yellow, olive ▶ gray ܥ : black, darkgray, gray, lightgray, white ▶ black!20 Ͱࠇ 20%ɼred!30!yellow Ͱ੺ 30%ԫ 70% ͳͲɽ ▶ definecolor ίϚϯυͰ৭Λࣗ࡞͢Δ͜ͱ΋Ͱ͖Δɽ 11/22

Slide 12

Slide 12 text

ృΓͭͿ͠ \begin{ tikzpicture } \fill[teal ](0 ,0) - -(1.5 ,0) - -(1 ,1); \fill[olive ](0 , -0.25) rectangle (1.5 , -0.75); \filldraw[fill=violet ,very thick ](1.75 ,0) circle (0.5); \filldraw[fill=pink ,very thick] (0 ,-1.5)--(0.5,-1)--(1,-2) - -(1.5 , -1.5); \end{ tikzpicture } Լʹॻ͍ͨ΋ͷ΄Ͳલ໘ʹදࣔ͞ΕΔɽ ด͍ͯ͡ͳͯ͘΋࢝఺ͱऴ఺Λͭͳ͍ͩྖҬͰృͬͯ͘ΕΔɽ 12/22

Slide 13

Slide 13 text

Ҡಈɾ֦ॖɾճస \begin{ tikzpicture }[ ultra thick] \draw[->,>=stealth ,semithick] ( -0.5 ,0) - -(2.5 ,0) node[above ]{$x$}; \draw[->,>=stealth ,semithick] (0 , -0.5) - -(0 ,3.5) node[right ]{$y$}; \draw[red ](0 ,0.5) - -(0.5 ,0) - -(1 ,0.5); \draw[shift ={(1 ,2)} , blue ](0 ,0.5) - -(0.5 ,0) - -(1 ,0.5); \draw[scale =2,blue ](0 ,0.5) - -(0.5 ,0) - -(1 ,0.5); \draw[rotate =-70, blue ](0 ,0.5) - -(0.5 ,0) - -(1 ,0.5); \end{ tikzpicture } x y σϑΥϧτͰ͸ݪ఺Λத৺ʹ֦ॖɼճస͕ߦΘΕΔɽ [scale around={2:(1,1)}] ͱ͢Δͱ (1,1) Λத৺ʹ 2 ഒʹ֦େ͞Εɼ [rotate around={20,(1,1)}] ͱ͢Δͱ (1,1) Λத৺ʹ൓࣌ܭճΓʹ 20˃ճస ͢Δɽ 13/22

Slide 14

Slide 14 text

఺ΛจࣈͰஔ͘ \begin{ tikzpicture }[ ultra thick] \coordinate (A) at (1 ,1); \coordinate [label = -90:B] (B) at (2 ,1); \coordinate [label=right:C] (C) at (3 ,1); \draw (A)--(B)--(C); \end{ tikzpicture } B C [label=ภ֯:ද໊ࣔ],[label=Ґஔ:ද໊ࣔ] ͱ͢Δͱද໊ࣔ΋ಉ࣌ʹઃఆͰ ͖Δɽ 14/22

Slide 15

Slide 15 text

ަ఺ͷࣗಈܭࢉ \begin{ tikzpicture }[ scale =0.5] \draw[name path=C1] (0 ,0) circle (1); \draw[name path=C2] (2 ,1) circle (2); \path[name intersections ={of= C1 and C2 , by={A,B }}]; \fill[red] (A) circle (0.06) node[above left ]{A}; \fill[red] (B) circle (0.06) node[below ]{B}; \end{ tikzpicture } A B 15/22

Slide 16

Slide 16 text

࠲ඪܭࢉ \begin{ tikzpicture }[ scale =0.4] \coordinate (A) at (1 ,1); \coordinate (B) at (5 ,1); \fill (A)circle (0.1) node[below ]{A}; \fill (B)circle (0.1) node[below ]{B}; \fill ($(A)!0.7!(B)$)circle (0.1) node[below ]{C}; \fill ($(A)! -0.3!(B)$)circle (0.1)[ left]node{D}; \fill ($(A)!1 cm!(B)$)circle (0.1)[ above]node{E}; \fill ($(A)!0.7!30:(B)$)circle (0.1)[ above]node{F}; \end{ tikzpicture } A B C D E F $(A)!t!(B)$͸ AɼB ͔Βͷڑ཭ͷൺ͕ |t|: |1 − t| ͷ AB ্ͷ఺ɽ $(A)!t!:a(B)$͸ͦΕΛ a ౓൓࣌ܭճΓʹ A Λத৺ʹճసͤͨ͞఺ɽ $(A)!t cm:a(B)$͸ A ͔Β B ޲͖ʹ t cm ʹ͋Δ఺ɽ $(A)+(B)$,$k*(A)$ͱ͍͏࿨ɼੵ΋ܭࢉՄೳɽ 16/22

Slide 17

Slide 17 text

܁Γฦ͠ \begin{ tikzpicture }[ scale =0.1] \draw (0 ,0) - -(100 ,0); \foreach \x in {0 ,... ,100} \draw (\x ,0)--(\x ,3); \foreach \x in {0 ,5 ,... ,100} \draw (\x ,0)--(\x ,5); \foreach \x in {0 ,10 ,... ,100} \draw (\x ,0)--(\x ,7); \end{ tikzpicture } ΠςϨʔλͷ૿͑ํ΋ࣗಈͰྨਪͯ͘͠ΕΔɽ \x in {A,B,...,Z}ͱ͢Δͱ x ʹ A ͔Β Z ·ͰͷΞϧϑΝϕοτ͕ೖΔɽ 17/22

Slide 18

Slide 18 text

άϥϑ (ؔ਺) \begin{ tikzpicture }[ scale =0.5] \draw[samples =300 , % ϓ ϩ ο τ ਺ domain =-3*pi /4:3* pi/4, % ൣ ғ variable=\t] % ม ਺ ໊ plot(\t ,{ sin (2* \t r)}) node[below ]{ \tiny $y=\sin x$ \normalsize }; \end{ tikzpicture } y = sin x ࠲ඪͷܭࢉࣜʹ () Λ࢖͏ͳΒ{}ͰғΉɽ ࡾ֯വ਺͸ r Λࢦఆ͢ΔͱϥδΞϯͰ֯౓͕ࢦఆͰ͖Δɽ cos,exp,sqrt ͳͲ΋࢖͑Δɽ 18/22

Slide 19

Slide 19 text

άϥϑ (άϥϑཧ࿦) \begin{ tikzpicture }[ line width =1.6pt ,node distance =2 cm] \node(a) [draw ,circle ]{$a$}; \node[above right of=a](b) [draw ,circle ]{$b$}; \node[below right of=a](c) [draw ,circle ]{$c$}; \node[right of=a,node distance =2.82 cm](d) [draw , circle ]{$d$}; \draw(a) to[bend left] node[midway ,left] {$e_1$}(b ); \draw(a) -- node[midway ,right ]{$e_2$}(b); \draw(a) -- node[midway ,right ]{$e_3$}(c); \draw(a) to[bend right] node[midway ,left] {$e_4$}( c); \draw(a) -- node[pos =.7, above ]{$e_5$}(d); \draw(b) -- node[midway ,above ]{$e_6$}(d); \draw(c) -- node[midway ,below ]{$e_7$}(d); \end{ tikzpicture } a b c d e1 e2 e3 e4 e5 e6 e7 bend left/right ͸ઢͷਐߦํ޲ʹରͯ͠ӈ͔ࠨ͔ɽ 19/22

Slide 20

Slide 20 text

ͦͷଞ ▶ tikzpicture ؀ڥͷ࠷ॳʹ\clip(x,y)rectangle(z,w); ͱॻ͘ͱͦͷ௕ ํܗͷத͚ͩʹඳը͞ΕΔɽ ▶ \draw(a,b)arc(s:t:r); ͱ͢Δͱத৺ (a,b) ൒ܘ r ͷԁͷภ֯ s˃͔Β t˃ ͷހΛඳ͚Δɽ etc. 20/22

Slide 21

Slide 21 text

࡞ͬͯΈΑ͏ m ੩ࢭ୆ ࣭ྔ M 21/22

Slide 22

Slide 22 text

ࢀߟจݙ ▶ TikZ ֮ॻ ˡ ೔ຊޠͰମܥతʹ·ͱ·͍ͬͯͯ෼͔Γ΍͍͢ɽ http://perikanfan.web.fc2.com/Manual.pdf ▶ TikZ ͷ࢖͍ํ (ݍ࿦ฤ) http://alg-d.com/math/kan_extension/TikZ_for_cat.pdf ▶ TEXWiki TikZ https://texwiki.texjp.org/?TikZ ▶ TikZ Λ࢖ͬͯΈΑ͏ʂ: جຊతͳ࢖͍ํ https://guides.lib.kyushu-u.ac.jp/c.php?g=774891&p=5559091 ▶ LaTeX ͰਤΛ௚઀ඳ͚Δ TikZ ͷ࢖͍ํ https://math-note.xyz/latex/tikz/tikz-line/ ▶ TikZ ͰϊʔυΛ૬ରҐஔͰ഑ஔ͢Δ࿩ https://zrbabbler.hatenablog.com/entry/20150201/1422745097 ▶ Ԟଜ੖඙ɾࠇ໦༞հʰL A TEX2ε ඒจॻ࡞੒ೖ໳ʱ(ٕज़ධ࿦ࣾɼ1997) 22/22