tikz (rev. 1.10)

EDRSPIHCRSSRSS

tikz

공주대학교 문서작성 워크숍 2017에서 집중적으로 다루었으며, 좋은 가이드북과 예제들이 많다.

  • Example: 스마일
    tikz-smile.png
    [PNG image (79.4 KB)]
    • tikz codes:
      \documentclass{standalone}
      \usepackage{tikz}
      \begin{document}
      \begin{tikzpicture}[line width=1.6pt]
      %\draw [help lines] (0,0) grid (2,2);
      \draw [fill=yellow]      (1,1) circle (1cm);
      \draw ([shift=(193:.75cm)]1,1) arc    (193:347:.75cm);
      \draw plot [domain=.15:.35]   (\x,{2/3*(\x+1)});
      \draw plot [domain=1.65:1.85] (\x,{-2/3*\x+2)});
      \filldraw (.6,1.3)  ellipse (.15cm and .25cm);
      \filldraw (1.4,1.3) ellipse (.15cm and .25cm);
      \path [fill=white] (.55,1.4)  circle (1.5pt);
      \path [fill=white] (1.35,1.4) circle (1.5pt);
      \end{tikzpicture}
      \end{document}
      
    • pstricks codes: 여기에서 가져옴.
      \documentclass[dvips]{oblivoir}
      \usepackage{pstricks-add}
      \begin{document}
      \begin{pspicture}[showgrid=false](-1,-1)(3,2)
        %\psaxes[ticks=none]{->}(-.5,-.5)(-1,-1)(2.5,3)
        \psset{linewidth=1.5pt,fillstyle=solid}
        \pscircle[fillcolor=yellow](1,1){1cm}
        \psarc[fillcolor=yellow](1,1){0.75}{193}{347}
        \psplot[algebraic]{1.65}{1.85}{-2/3*x+2}
        \psplot[algebraic]{0.15}{0.35}{2/3*(x+1)}
        \psellipse[fillcolor=black](.6,1.3)(.15,.25)
        \psellipse[fillcolor=black](1.4,1.3)(.15,.25)
        \pscircle[fillcolor=white](.55,1.4){.8mm}
        \pscircle[fillcolor=white](1.35,1.4){.8mm}
      \end{pspicture}
      \end{document}
      


  • Example: 태극기
    tageug.png
    [PNG image (42.4 KB)]
    • tikz codes:
      \documentclass{standalone}
      
      \usepackage{tikz}
      %\usepackage{xcolor}
      \definecolor{tgred}{RGB}{197,31,50}
      \definecolor{tgblue}{RGB}{33,59,116}
      
      \begin{document}
      
      \begin{tikzpicture}[scale=3]
      %% 보조선
      %\draw [help lines,step=.5] (-1.5,-1) grid (1.5,1);
      \draw [densely dashed] (-1.5,1) -- (1.5,-1);
      \draw [densely dashed] (-1.5,-1) -- (1.5,1);
      \draw [densely dashed] (0,0) circle (.75);
      
      %% 테두리
      \draw [semithick] (-1.5,-1) rectangle (1.5,1); % 3:2
      
      %% 태극
      \fill [tgred]  (0,0) circle (.5);
      \fill [tgblue] (0,0) arc (-atan(2/3):-atan(2/3)-180:1/4)
                           arc (-atan(2/3)-180:-atan(2/3):1/2) % blue
                           arc (-atan(2/3):-atan(2/3)+180:1/4) 
                           -- cycle ;
      %% 태극 (alternative)
      %\fill [tgblue] (0,0) circle (.5);
      %\fill [tgred]  (0,0) arc (-atan(2/3):-atan(2/3)-180:1/4)
      %                     arc (-atan(2/3)+180:-atan(2/3):1/2) % red
      %                     arc (-atan(2/3):-atan(2/3)+180:1/4) 
      %                     -- cycle ;
      
      %% 괘
      \begin{scope}[rotate={90-atan(2/3)}]
      \fill (-12/48,36/48) rectangle % 36/48=1/2+1/4, 12/48=.5*1/2
            (12/48,{(36+4)/48});
      \fill (-12/48,42/48) rectangle 
            (12/48,{(42+4)/48});
      \fill (-12/48,48/48) rectangle 
            (12/48,{(48+4)/48});
      \end{scope}
      
      \begin{scope}[rotate={90+atan(2/3)}]
      \fill (-12/48,36/48) rectangle 
            (12/48,{(36+4)/48});
      \fill (-12/48,42/48) rectangle 
            (-1/48,{(42+4)/48}) (1/48,42/48) rectangle %
            (12/48,{(42+4)/48});
      \fill (-12/48,48/48) rectangle 
            (12/48,{(48+4)/48});
      \end{scope}
      
      \begin{scope}[rotate={-90+atan(2/3)}]
      \fill (-12/48,36/48) rectangle 
            (-1/48,{(36+4)/48}) (1/48,36/48) rectangle %
            (12/48,{(36+4)/48});
      \fill (-12/48,42/48) rectangle 
            (12/48,{(42+4)/48});
      \fill (-12/48,48/48) rectangle 
            (-1/48,{(48+4)/48}) (1/48,48/48) rectangle %
            (12/48,{(48+4)/48});
      \end{scope}
      
      \begin{scope}[rotate={-90-atan(2/3)}]
      \fill (-12/48,36/48) rectangle 
            (-1/48,{(36+4)/48}) (1/48,36/48) rectangle %
            (12/48,{(36+4)/48});
      \fill (-12/48,42/48) rectangle 
            (-1/48,{(42+4)/48}) (1/48,42/48) rectangle %
            (12/48,{(42+4)/48});
      \fill (-12/48,48/48) rectangle 
            (-1/48,{(48+4)/48}) (1/48,48/48) rectangle %
            (12/48,{(48+4)/48});
      \end{scope}
      \end{tikzpicture}
      
      \end{document}