Tikz Lecture

Embed Size (px)

Citation preview

  • 8/13/2019 Tikz Lecture

    1/30

    What is TikZ? Before We Get Started Example to Get Us Started TikZlibraries Background example More Advance Example,

    Lecture 9 - TikZand pgf

    LATEX for Math and ScienceChristian Blanco and Brandon Eltiste

    Spring 2011 Lecture 7

    LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 9 - TikZand pgf

    http://find/
  • 8/13/2019 Tikz Lecture

    2/30

    What is TikZ? Before We Get Started Example to Get Us Started TikZlibraries Background example More Advance Example,

    Outline

    1 What is TikZ?

    2 Before We Get Started

    3 Example to Get Us Started

    4 TikZlibraries

    5 Background example

    6 More Advance Example, Koch Snowflake

    7 Resources

    8 Homework

    LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 9 - TikZand pgf

    http://find/
  • 8/13/2019 Tikz Lecture

    3/30

    What is TikZ? Before We Get Started Example to Get Us Started TikZlibraries Background example More Advance Example,

    What is TikZ?

    A package for creating pictures (Show examples).

    Create anything from rectangles, circles to Koch

    snowflakes, 3D graphs and animations.

    LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 9 - TikZand pgf

    http://find/
  • 8/13/2019 Tikz Lecture

    4/30

    What is TikZ? Before We Get Started Example to Get Us Started TikZlibraries Background example More Advance Example,

    What is TikZ?

    A package for creating pictures (Show examples).

    Create anything from rectangles, circles to Koch

    snowflakes, 3D graphs and animations.

    LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 9 - TikZand pgf

    http://find/
  • 8/13/2019 Tikz Lecture

    5/30

    What is TikZ? Before We Get Started Example to Get Us Started TikZlibraries Background example More Advance Example,

    Before We Get Started

    You need to add \usepackage{tikz}into your

    preamble. Other commands to put in preamble will be

    discussed later.

    When creating a picture use the tikzpictureenvironment. E.g.:

    \begin{tikzpicture}

    ...

    \end{tikzpicture}

    LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 9 - TikZand pgf

    http://find/http://goback/
  • 8/13/2019 Tikz Lecture

    6/30

    Wh i ? B f W G S d E l G U S d lib i B k d l M Ad E l

  • 8/13/2019 Tikz Lecture

    7/30

    What is TikZ? Before We Get Started Example to Get Us Started TikZlibraries Background example More Advance Example,

    Getting Started with Basic Examples

    \begin{tikzpicture}

    \draw[line width=2pt,color=red](1,0) -- (0,0) -- (0,1);

    \end{tikzpicture}

    \begin{tikzpicture}

    \draw[line width=2pt,color=red]

    (1,0) -- (0,0) -- (0,1) -- cycle;

    \end{tikzpicture}

    Note:Dont forget the semicolons.

    LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 9 - TikZand pgf

    Wh t i TikZ? B f W G t St t d E l t G t U St t d TikZ lib i B k d l M Ad E l

    http://find/
  • 8/13/2019 Tikz Lecture

    8/30

    What is TikZ? Before We Get Started Example to Get Us Started TikZlibraries Background example More Advance Example,

    Getting Started with Basic Examples

    \begin{tikzpicture}

    \draw[line width=2pt,color=red](1,0) -- (0,0) -- (0,1);

    \end{tikzpicture}

    \begin{tikzpicture}

    \draw[line width=2pt,color=red]

    (1,0) -- (0,0) -- (0,1) -- cycle;

    \end{tikzpicture}

    Note:Dont forget the semicolons.

    LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 9 - TikZand pgf

    What is TikZ? Before We Get Started Example to Get Us Started TikZ libraries Background example More Advance Example

    http://find/
  • 8/13/2019 Tikz Lecture

    9/30

    What is TikZ? Before We Get Started Example to Get Us Started TikZlibraries Background example More Advance Example,

    Getting Started with Basic Examples

    \begin{tikzpicture}

    \draw[line width=2pt,color=red](1,0) -- (0,0) -- (0,1);

    \end{tikzpicture}

    \begin{tikzpicture}

    \draw[line width=2pt,color=red]

    (1,0) -- (0,0) -- (0,1) -- cycle;

    \end{tikzpicture}

    Note: Dont forget the semicolons.

    LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 9 - TikZand pgf

    What is TikZ? Before We Get Started Example to Get Us Started TikZ libraries Background example More Advance Example

    http://find/
  • 8/13/2019 Tikz Lecture

    10/30

    What is TikZ? Before We Get Started Example to Get Us Started TikZlibraries Background example More Advance Example,

    Getting Started with Basic Examples

    \begin{tikzpicture}

    \draw[line width=2pt,color=red](1,0) -- (0,0) -- (0,1);

    \end{tikzpicture}

    \begin{tikzpicture}

    \draw[line width=2pt,color=red]

    (1,0) -- (0,0) -- (0,1) -- cycle;

    \end{tikzpicture}

    Note: Dont forget the semicolons.

    LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 9 - TikZand pgf

    What is TikZ? Before We Get Started Example to Get Us Started TikZ libraries Background example More Advance Example

    http://find/http://goback/
  • 8/13/2019 Tikz Lecture

    11/30

    What is TikZ? Before We Get Started Example to Get Us Started TikZlibraries Background example More Advance Example,

    Getting Started with Basic Examples

    \begin{tikzpicture}

    \draw[line width=2pt,color=red](1,0) -- (0,0) -- (0,1);

    \end{tikzpicture}

    \begin{tikzpicture}

    \draw[line width=2pt,color=red]

    (1,0) -- (0,0) -- (0,1) -- cycle;

    \end{tikzpicture}

    Note: Dont forget the semicolons.

    LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 9 - TikZand pgf

    What is TikZ? Before We Get Started Example to Get Us Started TikZ libraries Background example More Advance Example

    http://find/
  • 8/13/2019 Tikz Lecture

    12/30

    What is TikZ? Before We Get Started Example to Get Us Started TikZlibraries Background example More Advance Example,

    Getting Started with Basic Examples

    \begin{tikzpicture}

    \fill[line width=1pt,color=blue]

    (0,0) {[rounded corners]

    -- (0,1)} -- (1,0);

    \end{tikzpicture}

    \begin{tikzpicture}

    \fill[line width=1pt,color=blue]

    (0,0) {[rounded corners]

    -- (0,1) -- (1,0)} -- cycle;

    \end{tikzpicture}

    LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 9 - TikZand pgf

    What is TikZ? Before We Get Started Example to Get Us Started TikZ libraries Background example More Advance Example,

    http://find/
  • 8/13/2019 Tikz Lecture

    13/30

    What is TikZ? Before We Get Started Example to Get Us Started TikZlibraries Background example More Advance Example,

    Getting Started with Basic Examples

    \begin{tikzpicture}

    \fill[line width=1pt,color=blue]

    (0,0) {[rounded corners]

    -- (0,1)} -- (1,0);

    \end{tikzpicture}

    \begin{tikzpicture}

    \fill[line width=1pt,color=blue]

    (0,0) {[rounded corners]

    -- (0,1) -- (1,0)} -- cycle;

    \end{tikzpicture}

    LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 9 - TikZand pgf

    What is TikZ? Before We Get Started Example to Get Us Started TikZlibraries Background example More Advance Example,

    http://find/http://goback/
  • 8/13/2019 Tikz Lecture

    14/30

    p g p p ,

    Getting Started with Basic Examples

    \begin{tikzpicture}

    \fill[line width=1pt,color=blue]

    (0,0) {[rounded corners]

    -- (0,1)} -- (1,0);

    \end{tikzpicture}

    \begin{tikzpicture}

    \fill[line width=1pt,color=blue]

    (0,0) {[rounded corners]

    -- (0,1) -- (1,0)} -- cycle;

    \end{tikzpicture}

    LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 9 - TikZand pgf

    http://find/
  • 8/13/2019 Tikz Lecture

    15/30

    What is TikZ? Before We Get Started Example to Get Us Started TikZlibraries Background example More Advance Example,

  • 8/13/2019 Tikz Lecture

    16/30

    More Getting Started with Basic Examples

    \begin{tikzpicture}

    \fill[line width=1pt,color=blue](0,0) rectangle (2,1);

    \end{tikzpicture}

    \begin{tikzpicture}

    \draw[line width=2pt,color=gray]

    (0,0) circle[radius=1];

    \end{tikzpicture}

    LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 9 - TikZand pgf

    What is TikZ? Before We Get Started Example to Get Us Started TikZlibraries Background example More Advance Example,

    http://find/
  • 8/13/2019 Tikz Lecture

    17/30

    More Getting Started with Basic Examples

    \begin{tikzpicture}

    \fill[line width=1pt,color=blue](0,0) rectangle (2,1);

    \end{tikzpicture}

    \begin{tikzpicture}

    \draw[line width=2pt,color=gray]

    (0,0) circle[radius=1];

    \end{tikzpicture}

    LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 9 - TikZand pgf

    What is TikZ? Before We Get Started Example to Get Us Started TikZlibraries Background example More Advance Example,

    http://goforward/http://find/http://goback/
  • 8/13/2019 Tikz Lecture

    18/30

    More Getting Started with Basic Examples

    \begin{tikzpicture}

    \fill[line width=1pt,color=blue](0,0) rectangle (2,1);

    \end{tikzpicture}

    \begin{tikzpicture}

    \draw[line width=2pt,color=gray]

    (0,0) circle[radius=1];

    \end{tikzpicture}

    LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 9 - TikZand pgf

    What is TikZ? Before We Get Started Example to Get Us Started TikZlibraries Background example More Advance Example,

    http://goforward/http://find/http://goback/
  • 8/13/2019 Tikz Lecture

    19/30

    More Getting Started with Basic Examples

    \begin{tikzpicture}

    \fill[line width=1pt,color=blue](0,0) rectangle (2,1);

    \end{tikzpicture}

    \begin{tikzpicture}

    \draw[line width=2pt,color=gray]

    (0,0) circle[radius=1];

    \end{tikzpicture}

    LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 9 - TikZand pgf

    What is TikZ? Before We Get Started Example to Get Us Started TikZlibraries Background example More Advance Example,

    http://goforward/http://find/http://goback/
  • 8/13/2019 Tikz Lecture

    20/30

    TikZLibraries

    To provide simpler methods to create complex structures

    libraries for TikZhas \usetikzlibary

    Different examples are: decorations.fractals,arrows, backgrounds, intersectionsand

    shapes.geometric.

    And now for some examples using these...

    LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 9 - TikZand pgf

    http://goforward/http://find/http://goback/
  • 8/13/2019 Tikz Lecture

    21/30

    What is TikZ? Before We Get Started Example to Get Us Started TikZlibraries Background example More Advance Example,

  • 8/13/2019 Tikz Lecture

    22/30

    First you must add \usetikzlibrary{backgrounds}

    to your preamble

    \begin{tikzpicture}

    [background rectangle/.style={fill=blue!20,

    draw=blue!50,line width=3pt},

    show background rectangle]

    \draw[line width=2pt,color=gray]

    (2,2) circle[radius=1];\end{tikzpicture}

    LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 9 - TikZand pgf

    What is TikZ? Before We Get Started Example to Get Us Started TikZlibraries Background example More Advance Example,

    http://find/
  • 8/13/2019 Tikz Lecture

    23/30

    First you must add \usetikzlibrary{backgrounds}

    to your preamble

    \begin{tikzpicture}

    [background rectangle/.style={fill=blue!20,

    draw=blue!50,line width=3pt},

    show background rectangle]

    \draw[line width=2pt,color=gray]

    (2,2) circle[radius=1];\end{tikzpicture}

    LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 9 - TikZand pgf

    What is TikZ? Before We Get Started Example to Get Us Started TikZlibraries Background example More Advance Example,

    http://find/
  • 8/13/2019 Tikz Lecture

    24/30

    Koch Snowflake

    First you must add

    \usetikzlibrary{decorations.fractals} to your

    preamble

    \begin{tikzpicture}[decoration=Koch

    snowflake,draw=blue,fill=blue!20,thick]

    \filldraw decorate{ decorate{ (0,0) --

    ++(60:1) -- ++(-60:1) -- cycle}};

    \end{tikzpicture}

    LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 9 - TikZand pgf

    What is TikZ? Before We Get Started Example to Get Us Started TikZlibraries Background example More Advance Example,

    http://find/
  • 8/13/2019 Tikz Lecture

    25/30

    Koch Snowflake

    First you must add

    \usetikzlibrary{decorations.fractals} to your

    preamble

    \begin{tikzpicture}[decoration=Koch

    snowflake,draw=blue,fill=blue!20,thick]

    \filldraw decorate{ decorate{ (0,0) --

    ++(60:1) -- ++(-60:1) -- cycle}};

    \end{tikzpicture}

    LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 9 - TikZand pgf

    http://find/
  • 8/13/2019 Tikz Lecture

    26/30

    What is TikZ? Before We Get Started Example to Get Us Started TikZlibraries Background example More Advance Example,

  • 8/13/2019 Tikz Lecture

    27/30

    LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 9 - TikZand pgf

    What is TikZ? Before We Get Started Example to Get Us Started TikZlibraries Background example More Advance Example,

    http://find/
  • 8/13/2019 Tikz Lecture

    28/30

    Dont forget

    At the end of each statement put a semi-colon.

    Dont forget to put the correct TikZlibrary in your preamble.

    LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 9 - TikZand pgf

    What is TikZ? Before We Get Started Example to Get Us Started TikZlibraries Background example More Advance Example,

    http://find/
  • 8/13/2019 Tikz Lecture

    29/30

    Resources

    PGF Manual

    TikZExamples

    Extra TikZslides

    LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 9 - TikZand pgf

    What is TikZ? Before We Get Started Example to Get Us Started TikZlibraries Background example More Advance Example,

    http://mirror.ctan.org/graphics/pgf/base/doc/generic/pgf/pgfmanual.pdfhttp://www.texample.net/tikz/examples/all/http://www.texample.net/tikz/examples/all/http://www.texample.net/tikz/examples/all/http://www.texample.net/tikz/examples/all/http://people.hsc.edu/faculty-staff/blins/latex/LatexSeminar2.pdfhttp://people.hsc.edu/faculty-staff/blins/latex/LatexSeminar2.pdfhttp://people.hsc.edu/faculty-staff/blins/latex/LatexSeminar2.pdfhttp://people.hsc.edu/faculty-staff/blins/latex/LatexSeminar2.pdfhttp://people.hsc.edu/faculty-staff/blins/latex/LatexSeminar2.pdfhttp://people.hsc.edu/faculty-staff/blins/latex/LatexSeminar2.pdfhttp://www.texample.net/tikz/examples/all/http://mirror.ctan.org/graphics/pgf/base/doc/generic/pgf/pgfmanual.pdfhttp://find/
  • 8/13/2019 Tikz Lecture

    30/30

    Homework

    Homework

    LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 9 - TikZand pgf

    http://latex.berkeley.edu/files/tikz_homework.pdfhttp://latex.berkeley.edu/files/tikz_homework.pdfhttp://find/