SlideShare ist ein Scribd-Unternehmen logo
1 von 82
Downloaden Sie, um offline zu lesen
A
                             Introduction to LTEX
                                  Session #2

                         Oriol Borrega       Pedro Tiago Martins

                                 Universitat de Barcelona


                                  January 21, 2013




Borrega & Martins (UB)                           A
                                 Introduction to L TEX Session #2   January 21, 2013   1 / 41
Outline


1   A preamble: preambles
      Styling with style

2   Listing the lists
       Itemizing stuff
       Enumerating stuff
       Defining stuff

3   Floating elements
      Imagine images
      Why must there always be a table?



    Borrega & Martins (UB)                   A
                             Introduction to L TEX Session #2   January 21, 2013   2 / 41
Before we begin. . .

Before we begin. . .



    . . . remember your commands!

documentclass[a4paper,12pt]{article}
section{Your section name here}
emph{some text here}


begin{document}
Lots of stuff in here
end{document}




   Borrega & Martins (UB)                       A
                                Introduction to L TEX Session #2   January 21, 2013   3 / 41
Before we begin. . .

Before we begin. . .



    . . . remember your commands!

documentclass[a4paper,12pt]{article}
section{Your section name here}
emph{some text here}


begin{document}
Lots of stuff in here
end{document}




   Borrega & Martins (UB)                       A
                                Introduction to L TEX Session #2   January 21, 2013   3 / 41
Before we begin. . .

Before we begin. . .



    . . . remember your commands!

documentclass[a4paper,12pt]{article}
section{Your section name here}
emph{some text here}


begin{document}
Lots of stuff in here
end{document}




   Borrega & Martins (UB)                       A
                                Introduction to L TEX Session #2   January 21, 2013   3 / 41
Before we begin. . .

(and a brief side comment)




Anything following a percent sign (%) will be ignored by the compiler.
That’s very useful to put comments in your documents or to turn on/off
commands and lines of text.




   Borrega & Martins (UB)                       A
                                Introduction to L TEX Session #2   January 21, 2013   4 / 41
A preamble: preambles

Outline


1   A preamble: preambles
      Styling with style

2   Listing the lists
       Itemizing stuff
       Enumerating stuff
       Defining stuff

3   Floating elements
      Imagine images
      Why must there always be a table?



    Borrega & Martins (UB)                          A
                                    Introduction to L TEX Session #2   January 21, 2013   5 / 41
A preamble: preambles

An example of a preamble


documentclass{article}

usepackage[english,catalan]{babel}
usepackage[ansinew]{inputenc}
usepackage{geometry} %Allows to change layout settings
usepackage{enumerate} %Enables lists

title{The Denisova Hominin}
author{Wikipedia}
date{January 21st, 2013}

parskip=5mm
geometry{top=2.5cm,left=3cm,right=3cm,bottom=2.5cm}


  Borrega & Martins (UB)                          A
                                  Introduction to L TEX Session #2   January 21, 2013   6 / 41
A preamble: preambles

What is going on here?

   We are declaring the kind of document we want
            documentclass[a4paper,12pt]{article}
                  A
   We are telling LTEX we will do some “special tricks”
              usepackage[english,catalan]{babel}
              usepackage[ansinew]{inputenc}
              usepackage{geometry}
              usepackage{enumerate}
   We are signing our document
            title {The Denisova hominin}
            author {N.E.Ander et al.}
            date {Just about today}
   We are changing the default layout of the document
            parskip=5mm
            geometry{top=2.5cm,left=3cm,right=3cm,bottom=2.5cm}


  Borrega & Martins (UB)                          A
                                  Introduction to L TEX Session #2   January 21, 2013   7 / 41
A preamble: preambles

What is going on here?

   We are declaring the kind of document we want
            documentclass[a4paper,12pt]{article}
                  A
   We are telling LTEX we will do some “special tricks”
              usepackage[english,catalan]{babel}
              usepackage[ansinew]{inputenc}
              usepackage{geometry}
              usepackage{enumerate}
   We are signing our document
            title {The Denisova hominin}
            author {N.E.Ander et al.}
            date {Just about today}
   We are changing the default layout of the document
            parskip=5mm
            geometry{top=2.5cm,left=3cm,right=3cm,bottom=2.5cm}


  Borrega & Martins (UB)                          A
                                  Introduction to L TEX Session #2   January 21, 2013   7 / 41
A preamble: preambles

What is going on here?

   We are declaring the kind of document we want
            documentclass[a4paper,12pt]{article}
                  A
   We are telling LTEX we will do some “special tricks”
              usepackage[english,catalan]{babel}
              usepackage[ansinew]{inputenc}
              usepackage{geometry}
              usepackage{enumerate}
   We are signing our document
            title {The Denisova hominin}
            author {N.E.Ander et al.}
            date {Just about today}
   We are changing the default layout of the document
            parskip=5mm
            geometry{top=2.5cm,left=3cm,right=3cm,bottom=2.5cm}


  Borrega & Martins (UB)                          A
                                  Introduction to L TEX Session #2   January 21, 2013   7 / 41
A preamble: preambles

What is going on here?

   We are declaring the kind of document we want
            documentclass[a4paper,12pt]{article}
                  A
   We are telling LTEX we will do some “special tricks”
              usepackage[english,catalan]{babel}
              usepackage[ansinew]{inputenc}
              usepackage{geometry}
              usepackage{enumerate}
   We are signing our document
            title {The Denisova hominin}
            author {N.E.Ander et al.}
            date {Just about today}
   We are changing the default layout of the document
            parskip=5mm
            geometry{top=2.5cm,left=3cm,right=3cm,bottom=2.5cm}


  Borrega & Martins (UB)                          A
                                  Introduction to L TEX Session #2   January 21, 2013   7 / 41
A preamble: preambles

What is going on here?

   We are declaring the kind of document we want
            documentclass[a4paper,12pt]{article}
                  A
   We are telling LTEX we will do some “special tricks”
              usepackage[english,catalan]{babel}
              usepackage[ansinew]{inputenc}
              usepackage{geometry}
              usepackage{enumerate}
   We are signing our document
            title {The Denisova hominin}
            author {N.E.Ander et al.}
            date {Just about today}
   We are changing the default layout of the document
            parskip=5mm
            geometry{top=2.5cm,left=3cm,right=3cm,bottom=2.5cm}


  Borrega & Martins (UB)                          A
                                  Introduction to L TEX Session #2   January 21, 2013   7 / 41
A preamble: preambles

What is going on here?

   We are declaring the kind of document we want
            documentclass[a4paper,12pt]{article}
                  A
   We are telling LTEX we will do some “special tricks”
              usepackage[english,catalan]{babel}
              usepackage[ansinew]{inputenc}
              usepackage{geometry}
              usepackage{enumerate}
   We are signing our document
            title {The Denisova hominin}
            author {N.E.Ander et al.}
            date {Just about today}
   We are changing the default layout of the document
            parskip=5mm
            geometry{top=2.5cm,left=3cm,right=3cm,bottom=2.5cm}


  Borrega & Martins (UB)                          A
                                  Introduction to L TEX Session #2   January 21, 2013   7 / 41
A preamble: preambles

What is going on here?

   We are declaring the kind of document we want
            documentclass[a4paper,12pt]{article}
                  A
   We are telling LTEX we will do some “special tricks”
              usepackage[english,catalan]{babel}
              usepackage[ansinew]{inputenc}
              usepackage{geometry}
              usepackage{enumerate}
   We are signing our document
            title {The Denisova hominin}
            author {N.E.Ander et al.}
            date {Just about today}
   We are changing the default layout of the document
            parskip=5mm
            geometry{top=2.5cm,left=3cm,right=3cm,bottom=2.5cm}


  Borrega & Martins (UB)                          A
                                  Introduction to L TEX Session #2   January 21, 2013   7 / 41
A preamble: preambles

What is going on here?

   We are declaring the kind of document we want
            documentclass[a4paper,12pt]{article}
                  A
   We are telling LTEX we will do some “special tricks”
              usepackage[english,catalan]{babel}
              usepackage[ansinew]{inputenc}
              usepackage{geometry}
              usepackage{enumerate}
   We are signing our document
            title {The Denisova hominin}
            author {N.E.Ander et al.}
            date {Just about today}
   We are changing the default layout of the document
            parskip=5mm
            geometry{top=2.5cm,left=3cm,right=3cm,bottom=2.5cm}


  Borrega & Martins (UB)                          A
                                  Introduction to L TEX Session #2   January 21, 2013   7 / 41
A preamble: preambles

What is going on here?

   We are declaring the kind of document we want
            documentclass[a4paper,12pt]{article}
                  A
   We are telling LTEX we will do some “special tricks”
              usepackage[english,catalan]{babel}
              usepackage[ansinew]{inputenc}
              usepackage{geometry}
              usepackage{enumerate}
   We are signing our document
            title {The Denisova hominin}
            author {N.E.Ander et al.}
            date {Just about today}
   We are changing the default layout of the document
            parskip=5mm
            geometry{top=2.5cm,left=3cm,right=3cm,bottom=2.5cm}


  Borrega & Martins (UB)                          A
                                  Introduction to L TEX Session #2   January 21, 2013   7 / 41
A preamble: preambles

What is going on here?

   We are declaring the kind of document we want
            documentclass[a4paper,12pt]{article}
                  A
   We are telling LTEX we will do some “special tricks”
              usepackage[english,catalan]{babel}
              usepackage[ansinew]{inputenc}
              usepackage{geometry}
              usepackage{enumerate}
   We are signing our document
            title {The Denisova hominin}
            author {N.E.Ander et al.}
            date {Just about today}
   We are changing the default layout of the document
            parskip=5mm
            geometry{top=2.5cm,left=3cm,right=3cm,bottom=2.5cm}


  Borrega & Martins (UB)                          A
                                  Introduction to L TEX Session #2   January 21, 2013   7 / 41
A preamble: preambles

What is going on here?

   We are declaring the kind of document we want
            documentclass[a4paper,12pt]{article}
                  A
   We are telling LTEX we will do some “special tricks”
              usepackage[english,catalan]{babel}
              usepackage[ansinew]{inputenc}
              usepackage{geometry}
              usepackage{enumerate}
   We are signing our document
            title {The Denisova hominin}
            author {N.E.Ander et al.}
            date {Just about today}
   We are changing the default layout of the document
            parskip=5mm
            geometry{top=2.5cm,left=3cm,right=3cm,bottom=2.5cm}


  Borrega & Martins (UB)                          A
                                  Introduction to L TEX Session #2   January 21, 2013   7 / 41
A preamble: preambles

Remember!




   Title, author and date do not appear by default
            maketitle
   Something similar happens with languages
            selectlanguage{catalan}




  Borrega & Martins (UB)                          A
                                  Introduction to L TEX Session #2   January 21, 2013   8 / 41
A preamble: preambles

Remember!




   Title, author and date do not appear by default
            maketitle
   Something similar happens with languages
            selectlanguage{catalan}




  Borrega & Martins (UB)                          A
                                  Introduction to L TEX Session #2   January 21, 2013   8 / 41
A preamble: preambles

Remember!




   Title, author and date do not appear by default
            maketitle
   Something similar happens with languages
            selectlanguage{catalan}




  Borrega & Martins (UB)                          A
                                  Introduction to L TEX Session #2   January 21, 2013   8 / 41
A preamble: preambles

Remember!




   Title, author and date do not appear by default
            maketitle
   Something similar happens with languages
            selectlanguage{catalan}




  Borrega & Martins (UB)                          A
                                  Introduction to L TEX Session #2   January 21, 2013   8 / 41
A preamble: preambles   Styling with style

Just a word on styling: Font Size

    this text is tiny

    this text is in scriptsize
    this text is in footnotesize
    this text is still small
    this is the normalsize
    this text is large
    this text is Large
    Man, this text is LARGE
    this is huge
    this is really Huge
   Borrega & Martins (UB)                               A
                                        Introduction to L TEX Session #2      January 21, 2013   9 / 41
A preamble: preambles   Styling with style

Just a word on styling: Text Alignment

        A
Text in LTEX can be aligned as you like,

              you just have to say how that is. You rather have it

                                                     centered, to the left or to the right?


begin{flushleft}
  Text in LaTeX can be aligned as you like,
end{flushleft}
begin{center}
  you just have to say how that is. You rather have it
end{center}
begin{flushright}
  centered, to the left or to the right?
end{flushright}
   Borrega & Martins (UB)                          A
                                   Introduction to L TEX Session #2      January 21, 2013   10 / 41
A preamble: preambles   Styling with style

Just a word on styling: Text Alignment

        A
Text in LTEX can be aligned as you like,

              you just have to say how that is. You rather have it

                                                     centered, to the left or to the right?


begin{flushleft}
  Text in LaTeX can be aligned as you like,
end{flushleft}
begin{center}
  you just have to say how that is. You rather have it
end{center}
begin{flushright}
  centered, to the left or to the right?
end{flushright}
   Borrega & Martins (UB)                          A
                                   Introduction to L TEX Session #2      January 21, 2013   10 / 41
Listing the lists

Outline


1   A preamble: preambles
      Styling with style

2   Listing the lists
       Itemizing stuff
       Enumerating stuff
       Defining stuff

3   Floating elements
      Imagine images
      Why must there always be a table?



    Borrega & Martins (UB)                   A
                             Introduction to L TEX Session #2   January 21, 2013   11 / 41
Listing the lists

Three examples of lists



       Itemizing only puts bullets. . .
       . . . it makes an unordered list.


  1    Enumeration numbers each item. . .
  2    . . . automatically, of course.


 Description is seldom used, though it’s nice.
           Items are put as in a dictionary.




      Borrega & Martins (UB)    Introduction to L TEX Session #2
                                                A                  January 21, 2013   12 / 41
Listing the lists

Three examples of lists



       Itemizing only puts bullets. . .
       . . . it makes an unordered list.


  1    Enumeration numbers each item. . .
  2    . . . automatically, of course.


 Description is seldom used, though it’s nice.
           Items are put as in a dictionary.




      Borrega & Martins (UB)                    A
                                Introduction to L TEX Session #2   January 21, 2013   12 / 41
Listing the lists

Three examples of lists



       Itemizing only puts bullets. . .
       . . . it makes an unordered list.


  1    Enumeration numbers each item. . .
  2    . . . automatically, of course.


 Description is seldom used, though it’s nice.
           Items are put as in a dictionary.




      Borrega & Martins (UB)                    A
                                Introduction to L TEX Session #2   January 21, 2013   12 / 41
Listing the lists

Three examples of lists



       Itemizing only puts bullets. . .
       . . . it makes an unordered list.


  1    Enumeration numbers each item. . .
  2    . . . automatically, of course.


 Description is seldom used, though it’s nice.
           Items are put as in a dictionary.




      Borrega & Martins (UB)                    A
                                Introduction to L TEX Session #2   January 21, 2013   12 / 41
Listing the lists   Itemizing stuff

Itemizing stuff




    The basic way:

begin{itemize}
  item First item
  item Second item
  item Third item
end{itemize}




   Borrega & Martins (UB)                   A
                            Introduction to L TEX Session #2     January 21, 2013   13 / 41
Listing the lists   Itemizing stuff

Itemizing stuff

    Itemization provides four levels, by nesting several itemize
    environments
begin{itemize}
  item First level
  begin{itemize}
    item Second level
    begin{itemize}
      item Third level
      begin{itemize}
        item Fourth level
      end{itemize}
    end{itemize}
  end{itemize}
end{itemize}

   Borrega & Martins (UB)                   A
                            Introduction to L TEX Session #2     January 21, 2013   14 / 41
Listing the lists   Itemizing stuff

Itemizing stuff

    Itemization provides four levels, by nesting several itemize
    environments
begin{itemize}
  item First level
  begin{itemize}
    item Second level
    begin{itemize}
      item Third level
      begin{itemize}
        item Fourth level
      end{itemize}
    end{itemize}
  end{itemize}
end{itemize}

   Borrega & Martins (UB)                   A
                            Introduction to L TEX Session #2     January 21, 2013   14 / 41
Listing the lists   Itemizing stuff

A quick challenge



    First level
            Second level
    First level
            Second level
                   Third level
            Second level
                   Third level
                   Third level
    First level




   Borrega & Martins (UB)                        A
                                 Introduction to L TEX Session #2     January 21, 2013   15 / 41
Listing the lists   Itemizing stuff

Was it hard?

begin{itemize}
  item First level
  begin{itemize}
    item Second level
  end{itemize}
  item First level
  begin{itemize}
    item Second level
    begin{itemize}
      item Third level
    end{itemize}
    item Second level
    begin{itemize}
      item Third level
      item Third level
    end{itemize}
  end{itemize}
  item First level
end{itemize}

   Borrega & Martins (UB)                   A
                            Introduction to L TEX Session #2     January 21, 2013   16 / 41
Listing the lists   Enumerating stuff

Enumerating stuff




   The basic way, almost like itemizing:

begin{enumerate}
  item First item
  item Second item
  item Third item
end{enumerate}




  Borrega & Martins (UB)                   A
                           Introduction to L TEX Session #2       January 21, 2013   17 / 41
Listing the lists   Enumerating stuff

Enumerating stuff

    Like with itemization, four levels are provided with different
    numeration symbols: Arabic numbers, bracketted latin letters, roman
    numbers and capital latin letters.
    Good news is: it is very easy to change those symbols:
       (i) roman numbers
      (ii) with brackets
       1) arabic numbers
       2) with a single bracket

      A.- capital latin letters
      B.- with a dot and a dash

∀(x) →1 meaningless logical formula
∀(x) →2 and an arabic number


   Borrega & Martins (UB)                     A
                              Introduction to L TEX Session #2      January 21, 2013   18 / 41
Listing the lists   Enumerating stuff

Enumerating stuff

    Like with itemization, four levels are provided with different
    numeration symbols: Arabic numbers, bracketted latin letters, roman
    numbers and capital latin letters.
    Good news is: it is very easy to change those symbols:
       (i) roman numbers
      (ii) with brackets
       1) arabic numbers
       2) with a single bracket

      A.- capital latin letters
      B.- with a dot and a dash

∀(x) →1 meaningless logical formula
∀(x) →2 and an arabic number


   Borrega & Martins (UB)                     A
                              Introduction to L TEX Session #2      January 21, 2013   18 / 41
Listing the lists   Enumerating stuff

Enumerating stuff

    Like with itemization, four levels are provided with different
    numeration symbols: Arabic numbers, bracketted latin letters, roman
    numbers and capital latin letters.
    Good news is: it is very easy to change those symbols:
       (i) roman numbers
      (ii) with brackets
       1) arabic numbers
       2) with a single bracket

      A.- capital latin letters
      B.- with a dot and a dash

∀(x) →1 meaningless logical formula
∀(x) →2 and an arabic number


   Borrega & Martins (UB)                     A
                              Introduction to L TEX Session #2      January 21, 2013   18 / 41
Listing the lists   Enumerating stuff

. . . enumeration not enumerating any more!



    You can even make enumeration look like an itemized list:
         - with dashes
         - and nothing else
       % with percent symbols
       % if you fancy

            with nothing at all
            (really, this is an enumeration too)

       :-) with anything
       :-) that you want ;-)




   Borrega & Martins (UB)                       A
                                Introduction to L TEX Session #2       January 21, 2013   19 / 41
Listing the lists   Enumerating stuff

. . . enumeration not enumerating any more!



    You can even make enumeration look like an itemized list:
         - with dashes
         - and nothing else
       % with percent symbols
       % if you fancy

            with nothing at all
            (really, this is an enumeration too)

       :-) with anything
       :-) that you want ;-)




   Borrega & Martins (UB)                       A
                                Introduction to L TEX Session #2       January 21, 2013   19 / 41
Listing the lists   Enumerating stuff

. . . enumeration not enumerating any more!



    You can even make enumeration look like an itemized list:
         - with dashes
         - and nothing else
       % with percent symbols
       % if you fancy

            with nothing at all
            (really, this is an enumeration too)

       :-) with anything
       :-) that you want ;-)




   Borrega & Martins (UB)                       A
                                Introduction to L TEX Session #2       January 21, 2013   19 / 41
Listing the lists   Enumerating stuff

. . . enumeration not enumerating any more!



    You can even make enumeration look like an itemized list:
         - with dashes
         - and nothing else
       % with percent symbols
       % if you fancy

            with nothing at all
            (really, this is an enumeration too)

       :-) with anything
       :-) that you want ;-)




   Borrega & Martins (UB)                       A
                                Introduction to L TEX Session #2       January 21, 2013   19 / 41
Listing the lists   Enumerating stuff

. . . enumeration not enumerating any more!



    You can even make enumeration look like an itemized list:
         - with dashes
         - and nothing else
       % with percent symbols
       % if you fancy

            with nothing at all
            (really, this is an enumeration too)

       :-) with anything
       :-) that you want ;-)




   Borrega & Martins (UB)                       A
                                Introduction to L TEX Session #2       January 21, 2013   19 / 41
Listing the lists   Enumerating stuff

Some examples


usepackage{enumerate}

begin{enumerate}[(i)]
  item roman numbers
  item with brackets
end{enumerate}

begin{enumerate}[]
  item with nothing at all
  item (really, this is an enumeration too)
end{enumerate}

begin{enumerate}[:-)]
  item with anything
  item that you want ;-)
end{enumerate}



   Borrega & Martins (UB)   Introduction to L TEX Session #2
                                            A                      January 21, 2013   20 / 41
Listing the lists   Defining stuff

Defining stuff



   The basic way. Notice the defined term is entered as an optional
   argument to item:

begin{description}
  item[One] First item
  item[Two] Second item
  item[Three] Third item
end{description}




  Borrega & Martins (UB)   Introduction to L TEX Session #2
                                           A                  January 21, 2013   21 / 41
Listing the lists   Defining stuff

Defining stuff




   It looks good, as in a dictionary:
            One First item
            Two Second item
          Three Third item




  Borrega & Martins (UB)                   A
                           Introduction to L TEX Session #2   January 21, 2013   22 / 41
Floating elements

Outline


1   A preamble: preambles
      Styling with style

2   Listing the lists
       Itemizing stuff
       Enumerating stuff
       Defining stuff

3   Floating elements
      Imagine images
      Why must there always be a table?



    Borrega & Martins (UB)                     A
                               Introduction to L TEX Session #2   January 21, 2013   23 / 41
Floating elements

Why “floating”?




   There are two basic types: figures and tables
                                                 A
   They do not have a fixed placing in the page: LTEX decides where is
   best to anchor them so they don’t interrupt the flow of the text
   They are containers to elements that cannot be split or broken
   between pages.
   Additionally, they have a caption defining them, and they are
   numbered (so they can be referred to easily in the text).




  Borrega & Martins (UB)                     A
                             Introduction to L TEX Session #2   January 21, 2013   24 / 41
Floating elements

Why “floating”?




   There are two basic types: figures and tables
                                                 A
   They do not have a fixed placing in the page: LTEX decides where is
   best to anchor them so they don’t interrupt the flow of the text
   They are containers to elements that cannot be split or broken
   between pages.
   Additionally, they have a caption defining them, and they are
   numbered (so they can be referred to easily in the text).




  Borrega & Martins (UB)                     A
                             Introduction to L TEX Session #2   January 21, 2013   24 / 41
Floating elements

Why “floating”?




   There are two basic types: figures and tables
                                                 A
   They do not have a fixed placing in the page: LTEX decides where is
   best to anchor them so they don’t interrupt the flow of the text
   They are containers to elements that cannot be split or broken
   between pages.
   Additionally, they have a caption defining them, and they are
   numbered (so they can be referred to easily in the text).




  Borrega & Martins (UB)                     A
                             Introduction to L TEX Session #2   January 21, 2013   24 / 41
Floating elements

Why “floating”?




   There are two basic types: figures and tables
                                                 A
   They do not have a fixed placing in the page: LTEX decides where is
   best to anchor them so they don’t interrupt the flow of the text
   They are containers to elements that cannot be split or broken
   between pages.
   Additionally, they have a caption defining them, and they are
   numbered (so they can be referred to easily in the text).




  Borrega & Martins (UB)                     A
                             Introduction to L TEX Session #2   January 21, 2013   24 / 41
Floating elements   Imagine images

Figures: an example




                           Figure: Not this kind of latex

  Borrega & Martins (UB)                       A
                               Introduction to L TEX Session #2   January 21, 2013   25 / 41
Floating elements   Imagine images

Hands on: lets include an image


   First of all, we must declare the graphicx package

usepackage{graphicx}

   Then, we prepare the figure environment

begin{figure}[h]

  ldots

end{figure}

   Notice the [h] there?



  Borrega & Martins (UB)     Introduction to L TEX Session #2
                                             A                  January 21, 2013   26 / 41
Floating elements   Imagine images

Hands on: lets include an image


   First of all, we must declare the graphicx package

usepackage{graphicx}

   Then, we prepare the figure environment

begin{figure}[h]

  ldots

end{figure}

   Notice the [h] there?



  Borrega & Martins (UB)     Introduction to L TEX Session #2
                                             A                  January 21, 2013   26 / 41
Floating elements   Imagine images

Hands on: lets include an image


   First of all, we must declare the graphicx package

usepackage{graphicx}

   Then, we prepare the figure environment

begin{figure}[h]

  ldots

end{figure}

   Notice the [h] there?



  Borrega & Martins (UB)     Introduction to L TEX Session #2
                                             A                  January 21, 2013   26 / 41
Floating elements   Imagine images

Hands off! Placing floats



All floats take an optional argument: the place specifier.
There are four possible values:
  h → here
  t → top
  b → bottom
  p → sepparate page just for floats
They can be forced by adding an exclamation mark ([h!])
                                                 A
However, in the end, they are just a suggestion: LTEX has the final word




   Borrega & Martins (UB)                     A
                              Introduction to L TEX Session #2   January 21, 2013   27 / 41
Floating elements   Imagine images

Hands off! Placing floats



All floats take an optional argument: the place specifier.
There are four possible values:
  h → here
  t → top
  b → bottom
  p → sepparate page just for floats
They can be forced by adding an exclamation mark ([h!])
                                                 A
However, in the end, they are just a suggestion: LTEX has the final word




   Borrega & Martins (UB)                     A
                              Introduction to L TEX Session #2   January 21, 2013   27 / 41
Floating elements   Imagine images

Hands off! Placing floats



All floats take an optional argument: the place specifier.
There are four possible values:
  h → here
  t → top
  b → bottom
  p → sepparate page just for floats
They can be forced by adding an exclamation mark ([h!])
                                                 A
However, in the end, they are just a suggestion: LTEX has the final word




   Borrega & Martins (UB)                     A
                              Introduction to L TEX Session #2   January 21, 2013   27 / 41
Floating elements   Imagine images

Hands on (again): lets include an image

                    A
    Next step: tell LTEX what image we want to include, and how big it
    must be
begin{figure}[h]

  includegraphics[width=5cm]{images/image.png}

end{figure}

    Regarding size, we can tinker with
            Image width → [width=Xcm]
            Image height → [height=Xcm]
            Scaling factor → [scale=1.5]
            Rotation angle (in degrees) → [angle=X]



   Borrega & Martins (UB)                     A
                              Introduction to L TEX Session #2   January 21, 2013   28 / 41
Floating elements   Imagine images

Hands on (again): lets include an image

                    A
    Next step: tell LTEX what image we want to include, and how big it
    must be
begin{figure}[h]

  includegraphics[width=5cm]{images/image.png}

end{figure}

    Regarding size, we can tinker with
            Image width → [width=Xcm]
            Image height → [height=Xcm]
            Scaling factor → [scale=1.5]
            Rotation angle (in degrees) → [angle=X]



   Borrega & Martins (UB)                     A
                              Introduction to L TEX Session #2   January 21, 2013   28 / 41
Floating elements   Imagine images

Hands on (again): lets include an image

                    A
    Next step: tell LTEX what image we want to include, and how big it
    must be
begin{figure}[h]

  includegraphics[width=5cm]{images/image.png}

end{figure}

    Regarding size, we can tinker with
            Image width → [width=Xcm]
            Image height → [height=Xcm]
            Scaling factor → [scale=1.5]
            Rotation angle (in degrees) → [angle=X]



   Borrega & Martins (UB)                     A
                              Introduction to L TEX Session #2   January 21, 2013   28 / 41
Floating elements   Imagine images

Hands on (again): lets include an image

                    A
    Next step: tell LTEX what image we want to include, and how big it
    must be
begin{figure}[h]

  includegraphics[width=5cm]{images/image.png}

end{figure}

    Regarding size, we can tinker with
            Image width → [width=Xcm]
            Image height → [height=Xcm]
            Scaling factor → [scale=1.5]
            Rotation angle (in degrees) → [angle=X]



   Borrega & Martins (UB)                     A
                              Introduction to L TEX Session #2   January 21, 2013   28 / 41
Floating elements   Imagine images

Hands on (again): lets include an image

                    A
    Next step: tell LTEX what image we want to include, and how big it
    must be
begin{figure}[h]

  includegraphics[width=5cm]{images/image.png}

end{figure}

    Regarding size, we can tinker with
            Image width → [width=Xcm]
            Image height → [height=Xcm]
            Scaling factor → [scale=1.5]
            Rotation angle (in degrees) → [angle=X]



   Borrega & Martins (UB)                     A
                              Introduction to L TEX Session #2   January 21, 2013   28 / 41
Floating elements   Imagine images

Hands on (again): lets include an image



    Finally, we can add a caption to the image (either before or after the
    image itself, within the environment)

begin{figure}[h]

  includegraphics[width=5cm]{images/image.png}

  caption{This image has served us as a tutorial.}

end{figure}




   Borrega & Martins (UB)     Introduction to L TEX Session #2
                                              A                  January 21, 2013   29 / 41
Floating elements   Imagine images

Imagine not only images



Although this is not as common, the contents of the figure environment
can be text. For instance:

Com evident experi`ncia mostra, la debilitat de la nostra mem`ria, sotsmetent f`cilment
                     e                                          o                  a
   a oblivi´ no solament los actes per longitud de temps envellits, mas encara los actes
           o
frescs de nostres dies, ´s estat doncs molt condecent, util e expedient deduir en escrit les
                        e                               ´
   gestes e hist`ries antigues dels homens forts e virtuosos, com sien espills molt clars,
                o
   exemples e virtuosa doctrina de nostra vida, segons recita aquell gran orador Tul·li.

                             Figura: A fragment of Tirant lo Blanc




    Borrega & Martins (UB)                           A
                                     Introduction to L TEX Session #2   January 21, 2013   30 / 41
Floating elements   Imagine images

Imagine not only images



Although this is not as common, the contents of the figure environment
can be text. For instance:

Com evident experi`ncia mostra, la debilitat de la nostra mem`ria, sotsmetent f`cilment
                     e                                          o                  a
   a oblivi´ no solament los actes per longitud de temps envellits, mas encara los actes
           o
frescs de nostres dies, ´s estat doncs molt condecent, util e expedient deduir en escrit les
                        e                               ´
   gestes e hist`ries antigues dels homens forts e virtuosos, com sien espills molt clars,
                o
   exemples e virtuosa doctrina de nostra vida, segons recita aquell gran orador Tul·li.

                             Figura: A fragment of Tirant lo Blanc




    Borrega & Martins (UB)                           A
                                     Introduction to L TEX Session #2   January 21, 2013   30 / 41
Floating elements   Why must there always be a table?

Ready? The tough part begins now...



                  ...so take a deep breath.




The fun part begins now!




     Borrega & Martins (UB)                     A
                                Introduction to L TEX Session #2                 January 21, 2013   31 / 41
Floating elements   Why must there always be a table?

How a table looks like in the final .pdf...



                             JOHN          MARY      JAMES
               Monday       ironing        cooking
                                                 vacuum cleaning
               Tuesday      cooking        dusting  sweeping
              Wednesday                        shopping
              Thursday      bathroom cleaning        cooking
                Friday                      rest
                            Table: This table is neat!




   Borrega & Martins (UB)                     A
                              Introduction to L TEX Session #2                 January 21, 2013   32 / 41
Floating elements   Why must there always be a table?

...and how it looks like in the .tex



begin{table}[h!]
begin{tabular}{|c|c|c|c|}
cline{2-4}
multicolumn{1}{c|}{} & JOHN & MARY & JAMES hline
Monday & ironing & cooking & vacuum cleaning hline
Tuesday & cooking & dusting & sweeping cline{1-1}cline{3-4}
Wednesday & & multicolumn{2}{c|}{shopping}hline
Thursday & multicolumn{2}{c|}{bathroom cleaning} & cooking hline
Friday & multicolumn{3}{c|}{rest}hline
end{tabular}
caption{This table is neat!}
end{table}




   Borrega & Martins (UB)                     A
                              Introduction to L TEX Session #2                 January 21, 2013   33 / 41
Floating elements   Why must there always be a table?

Lets walk through it step by step



    First, we prepare the table environment

begin{table}[ht!]

   ...

caption{This table is neat!}
end{table}

    caption is optional




   Borrega & Martins (UB)     Introduction to L TEX Session #2
                                              A                                January 21, 2013   34 / 41
Floating elements   Why must there always be a table?

Lets walk through it step by step



    First, we prepare the table environment

begin{table}[ht!]

   ...

caption{This table is neat!}
end{table}

    caption is optional




   Borrega & Martins (UB)     Introduction to L TEX Session #2
                                              A                                January 21, 2013   34 / 41
Floating elements   Why must there always be a table?

Lets walk through it step by step



    Next, we create the table with the tabular environment

begin{table}[ht!]
  begin{tabular}{alignment}
     ...
  end{tabular}
caption{This table is neat!}
end{table}

    Possible alignments are l (left), c (center) and r (right)




   Borrega & Martins (UB)                     A
                              Introduction to L TEX Session #2                 January 21, 2013   35 / 41
Floating elements   Why must there always be a table?

Lets walk through it step by step



    Next, we create the table with the tabular environment

begin{table}[ht!]
  begin{tabular}{alignment}
     ...
  end{tabular}
caption{This table is neat!}
end{table}

    Possible alignments are l (left), c (center) and r (right)




   Borrega & Martins (UB)                     A
                              Introduction to L TEX Session #2                 January 21, 2013   35 / 41
Floating elements   Why must there always be a table?

Lets walk through it step by step



    Next, we create the table with the tabular environment

begin{table}[ht!]
  begin{tabular}{rcl}
     ...
  end{tabular}
caption{This table is neat!}
end{table}

    Possible alignments are l (left), c (center) and r (right)




   Borrega & Martins (UB)                     A
                              Introduction to L TEX Session #2                 January 21, 2013   36 / 41
Floating elements   Why must there always be a table?

Lets walk through it step by step


    Finally, we add row after row of table

begin{table}[ht!]
  begin{tabular}{rcl}
     A    & B    & C 
     AA   & BB   & CC 
     AAA & BBB & CCC 
     AAAA & BBBB & CCCC 
  end{tabular}
caption{This table is neat!}
end{table}

    The ampersand (&) is the column divider, a linebreak () finishes
    each row.


   Borrega & Martins (UB)     Introduction to L TEX Session #2
                                              A                                January 21, 2013   37 / 41
Floating elements    Why must there always be a table?

Ok, run it!




    if we run the previous code, we get...
                                 A                B        C
                                AA               BB        CC
                               AAA              BBB        CCC
                              AAAA              BBBB       CCCC
                            Table: This table is neat!




   Borrega & Martins (UB)                     A
                              Introduction to L TEX Session #2                  January 21, 2013   38 / 41
Floating elements    Why must there always be a table?

Ok, run it!




    if we run the previous code, we get...
                                 A                B        C
                                AA               BB        CC
                               AAA              BBB        CCC
                              AAAA              BBBB       CCCC
                            Table: This table is neat!




   Borrega & Martins (UB)                     A
                              Introduction to L TEX Session #2                  January 21, 2013   38 / 41
Floating elements   Why must there always be a table?

Lets add lines



begin{table}[ht!]
  begin{tabular}{|r|c|l|}
     hline
     A    & B    & C  hline
     AA   & BB   & CC  cline{1-2}
     AAA & BBB & CCC  cline{2-3}
     AAAA & BBBB & CCCC  hline
  end{tabular}
caption{This table is neat!}
end{table}




   Borrega & Martins (UB)     Introduction to L TEX Session #2
                                              A                                January 21, 2013   39 / 41
Floating elements   Why must there always be a table?

Lets add lines




                               A          B            C
                              AA          BB           CC
                             AAA         BBB           CCC
                            AAAA         BBBB          CCCC
                            Table: This table is neat!




   Borrega & Martins (UB)                     A
                              Introduction to L TEX Session #2                 January 21, 2013   40 / 41
Floating elements   Why must there always be a table?

Another quick challenge




                           COLUMN A              COLUMN B               COLUMN C
            ROW 1          A1                       B1                        C1
            ROW 2          A2                       B2                        C2
            ROW 3          A3                       B3                        C3
                           Table: This table is a quick exercise




  Borrega & Martins (UB)                           A
                                   Introduction to L TEX Session #2                 January 21, 2013   41 / 41

Weitere ähnliche Inhalte

Empfohlen

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Empfohlen (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

LaTeX tutorial II

  • 1. A Introduction to LTEX Session #2 Oriol Borrega Pedro Tiago Martins Universitat de Barcelona January 21, 2013 Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 1 / 41
  • 2. Outline 1 A preamble: preambles Styling with style 2 Listing the lists Itemizing stuff Enumerating stuff Defining stuff 3 Floating elements Imagine images Why must there always be a table? Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 2 / 41
  • 3. Before we begin. . . Before we begin. . . . . . remember your commands! documentclass[a4paper,12pt]{article} section{Your section name here} emph{some text here} begin{document} Lots of stuff in here end{document} Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 3 / 41
  • 4. Before we begin. . . Before we begin. . . . . . remember your commands! documentclass[a4paper,12pt]{article} section{Your section name here} emph{some text here} begin{document} Lots of stuff in here end{document} Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 3 / 41
  • 5. Before we begin. . . Before we begin. . . . . . remember your commands! documentclass[a4paper,12pt]{article} section{Your section name here} emph{some text here} begin{document} Lots of stuff in here end{document} Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 3 / 41
  • 6. Before we begin. . . (and a brief side comment) Anything following a percent sign (%) will be ignored by the compiler. That’s very useful to put comments in your documents or to turn on/off commands and lines of text. Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 4 / 41
  • 7. A preamble: preambles Outline 1 A preamble: preambles Styling with style 2 Listing the lists Itemizing stuff Enumerating stuff Defining stuff 3 Floating elements Imagine images Why must there always be a table? Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 5 / 41
  • 8. A preamble: preambles An example of a preamble documentclass{article} usepackage[english,catalan]{babel} usepackage[ansinew]{inputenc} usepackage{geometry} %Allows to change layout settings usepackage{enumerate} %Enables lists title{The Denisova Hominin} author{Wikipedia} date{January 21st, 2013} parskip=5mm geometry{top=2.5cm,left=3cm,right=3cm,bottom=2.5cm} Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 6 / 41
  • 9. A preamble: preambles What is going on here? We are declaring the kind of document we want documentclass[a4paper,12pt]{article} A We are telling LTEX we will do some “special tricks” usepackage[english,catalan]{babel} usepackage[ansinew]{inputenc} usepackage{geometry} usepackage{enumerate} We are signing our document title {The Denisova hominin} author {N.E.Ander et al.} date {Just about today} We are changing the default layout of the document parskip=5mm geometry{top=2.5cm,left=3cm,right=3cm,bottom=2.5cm} Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 7 / 41
  • 10. A preamble: preambles What is going on here? We are declaring the kind of document we want documentclass[a4paper,12pt]{article} A We are telling LTEX we will do some “special tricks” usepackage[english,catalan]{babel} usepackage[ansinew]{inputenc} usepackage{geometry} usepackage{enumerate} We are signing our document title {The Denisova hominin} author {N.E.Ander et al.} date {Just about today} We are changing the default layout of the document parskip=5mm geometry{top=2.5cm,left=3cm,right=3cm,bottom=2.5cm} Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 7 / 41
  • 11. A preamble: preambles What is going on here? We are declaring the kind of document we want documentclass[a4paper,12pt]{article} A We are telling LTEX we will do some “special tricks” usepackage[english,catalan]{babel} usepackage[ansinew]{inputenc} usepackage{geometry} usepackage{enumerate} We are signing our document title {The Denisova hominin} author {N.E.Ander et al.} date {Just about today} We are changing the default layout of the document parskip=5mm geometry{top=2.5cm,left=3cm,right=3cm,bottom=2.5cm} Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 7 / 41
  • 12. A preamble: preambles What is going on here? We are declaring the kind of document we want documentclass[a4paper,12pt]{article} A We are telling LTEX we will do some “special tricks” usepackage[english,catalan]{babel} usepackage[ansinew]{inputenc} usepackage{geometry} usepackage{enumerate} We are signing our document title {The Denisova hominin} author {N.E.Ander et al.} date {Just about today} We are changing the default layout of the document parskip=5mm geometry{top=2.5cm,left=3cm,right=3cm,bottom=2.5cm} Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 7 / 41
  • 13. A preamble: preambles What is going on here? We are declaring the kind of document we want documentclass[a4paper,12pt]{article} A We are telling LTEX we will do some “special tricks” usepackage[english,catalan]{babel} usepackage[ansinew]{inputenc} usepackage{geometry} usepackage{enumerate} We are signing our document title {The Denisova hominin} author {N.E.Ander et al.} date {Just about today} We are changing the default layout of the document parskip=5mm geometry{top=2.5cm,left=3cm,right=3cm,bottom=2.5cm} Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 7 / 41
  • 14. A preamble: preambles What is going on here? We are declaring the kind of document we want documentclass[a4paper,12pt]{article} A We are telling LTEX we will do some “special tricks” usepackage[english,catalan]{babel} usepackage[ansinew]{inputenc} usepackage{geometry} usepackage{enumerate} We are signing our document title {The Denisova hominin} author {N.E.Ander et al.} date {Just about today} We are changing the default layout of the document parskip=5mm geometry{top=2.5cm,left=3cm,right=3cm,bottom=2.5cm} Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 7 / 41
  • 15. A preamble: preambles What is going on here? We are declaring the kind of document we want documentclass[a4paper,12pt]{article} A We are telling LTEX we will do some “special tricks” usepackage[english,catalan]{babel} usepackage[ansinew]{inputenc} usepackage{geometry} usepackage{enumerate} We are signing our document title {The Denisova hominin} author {N.E.Ander et al.} date {Just about today} We are changing the default layout of the document parskip=5mm geometry{top=2.5cm,left=3cm,right=3cm,bottom=2.5cm} Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 7 / 41
  • 16. A preamble: preambles What is going on here? We are declaring the kind of document we want documentclass[a4paper,12pt]{article} A We are telling LTEX we will do some “special tricks” usepackage[english,catalan]{babel} usepackage[ansinew]{inputenc} usepackage{geometry} usepackage{enumerate} We are signing our document title {The Denisova hominin} author {N.E.Ander et al.} date {Just about today} We are changing the default layout of the document parskip=5mm geometry{top=2.5cm,left=3cm,right=3cm,bottom=2.5cm} Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 7 / 41
  • 17. A preamble: preambles What is going on here? We are declaring the kind of document we want documentclass[a4paper,12pt]{article} A We are telling LTEX we will do some “special tricks” usepackage[english,catalan]{babel} usepackage[ansinew]{inputenc} usepackage{geometry} usepackage{enumerate} We are signing our document title {The Denisova hominin} author {N.E.Ander et al.} date {Just about today} We are changing the default layout of the document parskip=5mm geometry{top=2.5cm,left=3cm,right=3cm,bottom=2.5cm} Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 7 / 41
  • 18. A preamble: preambles What is going on here? We are declaring the kind of document we want documentclass[a4paper,12pt]{article} A We are telling LTEX we will do some “special tricks” usepackage[english,catalan]{babel} usepackage[ansinew]{inputenc} usepackage{geometry} usepackage{enumerate} We are signing our document title {The Denisova hominin} author {N.E.Ander et al.} date {Just about today} We are changing the default layout of the document parskip=5mm geometry{top=2.5cm,left=3cm,right=3cm,bottom=2.5cm} Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 7 / 41
  • 19. A preamble: preambles What is going on here? We are declaring the kind of document we want documentclass[a4paper,12pt]{article} A We are telling LTEX we will do some “special tricks” usepackage[english,catalan]{babel} usepackage[ansinew]{inputenc} usepackage{geometry} usepackage{enumerate} We are signing our document title {The Denisova hominin} author {N.E.Ander et al.} date {Just about today} We are changing the default layout of the document parskip=5mm geometry{top=2.5cm,left=3cm,right=3cm,bottom=2.5cm} Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 7 / 41
  • 20. A preamble: preambles Remember! Title, author and date do not appear by default maketitle Something similar happens with languages selectlanguage{catalan} Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 8 / 41
  • 21. A preamble: preambles Remember! Title, author and date do not appear by default maketitle Something similar happens with languages selectlanguage{catalan} Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 8 / 41
  • 22. A preamble: preambles Remember! Title, author and date do not appear by default maketitle Something similar happens with languages selectlanguage{catalan} Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 8 / 41
  • 23. A preamble: preambles Remember! Title, author and date do not appear by default maketitle Something similar happens with languages selectlanguage{catalan} Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 8 / 41
  • 24. A preamble: preambles Styling with style Just a word on styling: Font Size this text is tiny this text is in scriptsize this text is in footnotesize this text is still small this is the normalsize this text is large this text is Large Man, this text is LARGE this is huge this is really Huge Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 9 / 41
  • 25. A preamble: preambles Styling with style Just a word on styling: Text Alignment A Text in LTEX can be aligned as you like, you just have to say how that is. You rather have it centered, to the left or to the right? begin{flushleft} Text in LaTeX can be aligned as you like, end{flushleft} begin{center} you just have to say how that is. You rather have it end{center} begin{flushright} centered, to the left or to the right? end{flushright} Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 10 / 41
  • 26. A preamble: preambles Styling with style Just a word on styling: Text Alignment A Text in LTEX can be aligned as you like, you just have to say how that is. You rather have it centered, to the left or to the right? begin{flushleft} Text in LaTeX can be aligned as you like, end{flushleft} begin{center} you just have to say how that is. You rather have it end{center} begin{flushright} centered, to the left or to the right? end{flushright} Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 10 / 41
  • 27. Listing the lists Outline 1 A preamble: preambles Styling with style 2 Listing the lists Itemizing stuff Enumerating stuff Defining stuff 3 Floating elements Imagine images Why must there always be a table? Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 11 / 41
  • 28. Listing the lists Three examples of lists Itemizing only puts bullets. . . . . . it makes an unordered list. 1 Enumeration numbers each item. . . 2 . . . automatically, of course. Description is seldom used, though it’s nice. Items are put as in a dictionary. Borrega & Martins (UB) Introduction to L TEX Session #2 A January 21, 2013 12 / 41
  • 29. Listing the lists Three examples of lists Itemizing only puts bullets. . . . . . it makes an unordered list. 1 Enumeration numbers each item. . . 2 . . . automatically, of course. Description is seldom used, though it’s nice. Items are put as in a dictionary. Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 12 / 41
  • 30. Listing the lists Three examples of lists Itemizing only puts bullets. . . . . . it makes an unordered list. 1 Enumeration numbers each item. . . 2 . . . automatically, of course. Description is seldom used, though it’s nice. Items are put as in a dictionary. Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 12 / 41
  • 31. Listing the lists Three examples of lists Itemizing only puts bullets. . . . . . it makes an unordered list. 1 Enumeration numbers each item. . . 2 . . . automatically, of course. Description is seldom used, though it’s nice. Items are put as in a dictionary. Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 12 / 41
  • 32. Listing the lists Itemizing stuff Itemizing stuff The basic way: begin{itemize} item First item item Second item item Third item end{itemize} Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 13 / 41
  • 33. Listing the lists Itemizing stuff Itemizing stuff Itemization provides four levels, by nesting several itemize environments begin{itemize} item First level begin{itemize} item Second level begin{itemize} item Third level begin{itemize} item Fourth level end{itemize} end{itemize} end{itemize} end{itemize} Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 14 / 41
  • 34. Listing the lists Itemizing stuff Itemizing stuff Itemization provides four levels, by nesting several itemize environments begin{itemize} item First level begin{itemize} item Second level begin{itemize} item Third level begin{itemize} item Fourth level end{itemize} end{itemize} end{itemize} end{itemize} Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 14 / 41
  • 35. Listing the lists Itemizing stuff A quick challenge First level Second level First level Second level Third level Second level Third level Third level First level Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 15 / 41
  • 36. Listing the lists Itemizing stuff Was it hard? begin{itemize} item First level begin{itemize} item Second level end{itemize} item First level begin{itemize} item Second level begin{itemize} item Third level end{itemize} item Second level begin{itemize} item Third level item Third level end{itemize} end{itemize} item First level end{itemize} Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 16 / 41
  • 37. Listing the lists Enumerating stuff Enumerating stuff The basic way, almost like itemizing: begin{enumerate} item First item item Second item item Third item end{enumerate} Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 17 / 41
  • 38. Listing the lists Enumerating stuff Enumerating stuff Like with itemization, four levels are provided with different numeration symbols: Arabic numbers, bracketted latin letters, roman numbers and capital latin letters. Good news is: it is very easy to change those symbols: (i) roman numbers (ii) with brackets 1) arabic numbers 2) with a single bracket A.- capital latin letters B.- with a dot and a dash ∀(x) →1 meaningless logical formula ∀(x) →2 and an arabic number Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 18 / 41
  • 39. Listing the lists Enumerating stuff Enumerating stuff Like with itemization, four levels are provided with different numeration symbols: Arabic numbers, bracketted latin letters, roman numbers and capital latin letters. Good news is: it is very easy to change those symbols: (i) roman numbers (ii) with brackets 1) arabic numbers 2) with a single bracket A.- capital latin letters B.- with a dot and a dash ∀(x) →1 meaningless logical formula ∀(x) →2 and an arabic number Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 18 / 41
  • 40. Listing the lists Enumerating stuff Enumerating stuff Like with itemization, four levels are provided with different numeration symbols: Arabic numbers, bracketted latin letters, roman numbers and capital latin letters. Good news is: it is very easy to change those symbols: (i) roman numbers (ii) with brackets 1) arabic numbers 2) with a single bracket A.- capital latin letters B.- with a dot and a dash ∀(x) →1 meaningless logical formula ∀(x) →2 and an arabic number Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 18 / 41
  • 41. Listing the lists Enumerating stuff . . . enumeration not enumerating any more! You can even make enumeration look like an itemized list: - with dashes - and nothing else % with percent symbols % if you fancy with nothing at all (really, this is an enumeration too) :-) with anything :-) that you want ;-) Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 19 / 41
  • 42. Listing the lists Enumerating stuff . . . enumeration not enumerating any more! You can even make enumeration look like an itemized list: - with dashes - and nothing else % with percent symbols % if you fancy with nothing at all (really, this is an enumeration too) :-) with anything :-) that you want ;-) Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 19 / 41
  • 43. Listing the lists Enumerating stuff . . . enumeration not enumerating any more! You can even make enumeration look like an itemized list: - with dashes - and nothing else % with percent symbols % if you fancy with nothing at all (really, this is an enumeration too) :-) with anything :-) that you want ;-) Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 19 / 41
  • 44. Listing the lists Enumerating stuff . . . enumeration not enumerating any more! You can even make enumeration look like an itemized list: - with dashes - and nothing else % with percent symbols % if you fancy with nothing at all (really, this is an enumeration too) :-) with anything :-) that you want ;-) Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 19 / 41
  • 45. Listing the lists Enumerating stuff . . . enumeration not enumerating any more! You can even make enumeration look like an itemized list: - with dashes - and nothing else % with percent symbols % if you fancy with nothing at all (really, this is an enumeration too) :-) with anything :-) that you want ;-) Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 19 / 41
  • 46. Listing the lists Enumerating stuff Some examples usepackage{enumerate} begin{enumerate}[(i)] item roman numbers item with brackets end{enumerate} begin{enumerate}[] item with nothing at all item (really, this is an enumeration too) end{enumerate} begin{enumerate}[:-)] item with anything item that you want ;-) end{enumerate} Borrega & Martins (UB) Introduction to L TEX Session #2 A January 21, 2013 20 / 41
  • 47. Listing the lists Defining stuff Defining stuff The basic way. Notice the defined term is entered as an optional argument to item: begin{description} item[One] First item item[Two] Second item item[Three] Third item end{description} Borrega & Martins (UB) Introduction to L TEX Session #2 A January 21, 2013 21 / 41
  • 48. Listing the lists Defining stuff Defining stuff It looks good, as in a dictionary: One First item Two Second item Three Third item Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 22 / 41
  • 49. Floating elements Outline 1 A preamble: preambles Styling with style 2 Listing the lists Itemizing stuff Enumerating stuff Defining stuff 3 Floating elements Imagine images Why must there always be a table? Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 23 / 41
  • 50. Floating elements Why “floating”? There are two basic types: figures and tables A They do not have a fixed placing in the page: LTEX decides where is best to anchor them so they don’t interrupt the flow of the text They are containers to elements that cannot be split or broken between pages. Additionally, they have a caption defining them, and they are numbered (so they can be referred to easily in the text). Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 24 / 41
  • 51. Floating elements Why “floating”? There are two basic types: figures and tables A They do not have a fixed placing in the page: LTEX decides where is best to anchor them so they don’t interrupt the flow of the text They are containers to elements that cannot be split or broken between pages. Additionally, they have a caption defining them, and they are numbered (so they can be referred to easily in the text). Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 24 / 41
  • 52. Floating elements Why “floating”? There are two basic types: figures and tables A They do not have a fixed placing in the page: LTEX decides where is best to anchor them so they don’t interrupt the flow of the text They are containers to elements that cannot be split or broken between pages. Additionally, they have a caption defining them, and they are numbered (so they can be referred to easily in the text). Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 24 / 41
  • 53. Floating elements Why “floating”? There are two basic types: figures and tables A They do not have a fixed placing in the page: LTEX decides where is best to anchor them so they don’t interrupt the flow of the text They are containers to elements that cannot be split or broken between pages. Additionally, they have a caption defining them, and they are numbered (so they can be referred to easily in the text). Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 24 / 41
  • 54. Floating elements Imagine images Figures: an example Figure: Not this kind of latex Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 25 / 41
  • 55. Floating elements Imagine images Hands on: lets include an image First of all, we must declare the graphicx package usepackage{graphicx} Then, we prepare the figure environment begin{figure}[h] ldots end{figure} Notice the [h] there? Borrega & Martins (UB) Introduction to L TEX Session #2 A January 21, 2013 26 / 41
  • 56. Floating elements Imagine images Hands on: lets include an image First of all, we must declare the graphicx package usepackage{graphicx} Then, we prepare the figure environment begin{figure}[h] ldots end{figure} Notice the [h] there? Borrega & Martins (UB) Introduction to L TEX Session #2 A January 21, 2013 26 / 41
  • 57. Floating elements Imagine images Hands on: lets include an image First of all, we must declare the graphicx package usepackage{graphicx} Then, we prepare the figure environment begin{figure}[h] ldots end{figure} Notice the [h] there? Borrega & Martins (UB) Introduction to L TEX Session #2 A January 21, 2013 26 / 41
  • 58. Floating elements Imagine images Hands off! Placing floats All floats take an optional argument: the place specifier. There are four possible values: h → here t → top b → bottom p → sepparate page just for floats They can be forced by adding an exclamation mark ([h!]) A However, in the end, they are just a suggestion: LTEX has the final word Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 27 / 41
  • 59. Floating elements Imagine images Hands off! Placing floats All floats take an optional argument: the place specifier. There are four possible values: h → here t → top b → bottom p → sepparate page just for floats They can be forced by adding an exclamation mark ([h!]) A However, in the end, they are just a suggestion: LTEX has the final word Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 27 / 41
  • 60. Floating elements Imagine images Hands off! Placing floats All floats take an optional argument: the place specifier. There are four possible values: h → here t → top b → bottom p → sepparate page just for floats They can be forced by adding an exclamation mark ([h!]) A However, in the end, they are just a suggestion: LTEX has the final word Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 27 / 41
  • 61. Floating elements Imagine images Hands on (again): lets include an image A Next step: tell LTEX what image we want to include, and how big it must be begin{figure}[h] includegraphics[width=5cm]{images/image.png} end{figure} Regarding size, we can tinker with Image width → [width=Xcm] Image height → [height=Xcm] Scaling factor → [scale=1.5] Rotation angle (in degrees) → [angle=X] Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 28 / 41
  • 62. Floating elements Imagine images Hands on (again): lets include an image A Next step: tell LTEX what image we want to include, and how big it must be begin{figure}[h] includegraphics[width=5cm]{images/image.png} end{figure} Regarding size, we can tinker with Image width → [width=Xcm] Image height → [height=Xcm] Scaling factor → [scale=1.5] Rotation angle (in degrees) → [angle=X] Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 28 / 41
  • 63. Floating elements Imagine images Hands on (again): lets include an image A Next step: tell LTEX what image we want to include, and how big it must be begin{figure}[h] includegraphics[width=5cm]{images/image.png} end{figure} Regarding size, we can tinker with Image width → [width=Xcm] Image height → [height=Xcm] Scaling factor → [scale=1.5] Rotation angle (in degrees) → [angle=X] Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 28 / 41
  • 64. Floating elements Imagine images Hands on (again): lets include an image A Next step: tell LTEX what image we want to include, and how big it must be begin{figure}[h] includegraphics[width=5cm]{images/image.png} end{figure} Regarding size, we can tinker with Image width → [width=Xcm] Image height → [height=Xcm] Scaling factor → [scale=1.5] Rotation angle (in degrees) → [angle=X] Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 28 / 41
  • 65. Floating elements Imagine images Hands on (again): lets include an image A Next step: tell LTEX what image we want to include, and how big it must be begin{figure}[h] includegraphics[width=5cm]{images/image.png} end{figure} Regarding size, we can tinker with Image width → [width=Xcm] Image height → [height=Xcm] Scaling factor → [scale=1.5] Rotation angle (in degrees) → [angle=X] Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 28 / 41
  • 66. Floating elements Imagine images Hands on (again): lets include an image Finally, we can add a caption to the image (either before or after the image itself, within the environment) begin{figure}[h] includegraphics[width=5cm]{images/image.png} caption{This image has served us as a tutorial.} end{figure} Borrega & Martins (UB) Introduction to L TEX Session #2 A January 21, 2013 29 / 41
  • 67. Floating elements Imagine images Imagine not only images Although this is not as common, the contents of the figure environment can be text. For instance: Com evident experi`ncia mostra, la debilitat de la nostra mem`ria, sotsmetent f`cilment e o a a oblivi´ no solament los actes per longitud de temps envellits, mas encara los actes o frescs de nostres dies, ´s estat doncs molt condecent, util e expedient deduir en escrit les e ´ gestes e hist`ries antigues dels homens forts e virtuosos, com sien espills molt clars, o exemples e virtuosa doctrina de nostra vida, segons recita aquell gran orador Tul·li. Figura: A fragment of Tirant lo Blanc Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 30 / 41
  • 68. Floating elements Imagine images Imagine not only images Although this is not as common, the contents of the figure environment can be text. For instance: Com evident experi`ncia mostra, la debilitat de la nostra mem`ria, sotsmetent f`cilment e o a a oblivi´ no solament los actes per longitud de temps envellits, mas encara los actes o frescs de nostres dies, ´s estat doncs molt condecent, util e expedient deduir en escrit les e ´ gestes e hist`ries antigues dels homens forts e virtuosos, com sien espills molt clars, o exemples e virtuosa doctrina de nostra vida, segons recita aquell gran orador Tul·li. Figura: A fragment of Tirant lo Blanc Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 30 / 41
  • 69. Floating elements Why must there always be a table? Ready? The tough part begins now... ...so take a deep breath. The fun part begins now! Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 31 / 41
  • 70. Floating elements Why must there always be a table? How a table looks like in the final .pdf... JOHN MARY JAMES Monday ironing cooking vacuum cleaning Tuesday cooking dusting sweeping Wednesday shopping Thursday bathroom cleaning cooking Friday rest Table: This table is neat! Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 32 / 41
  • 71. Floating elements Why must there always be a table? ...and how it looks like in the .tex begin{table}[h!] begin{tabular}{|c|c|c|c|} cline{2-4} multicolumn{1}{c|}{} & JOHN & MARY & JAMES hline Monday & ironing & cooking & vacuum cleaning hline Tuesday & cooking & dusting & sweeping cline{1-1}cline{3-4} Wednesday & & multicolumn{2}{c|}{shopping}hline Thursday & multicolumn{2}{c|}{bathroom cleaning} & cooking hline Friday & multicolumn{3}{c|}{rest}hline end{tabular} caption{This table is neat!} end{table} Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 33 / 41
  • 72. Floating elements Why must there always be a table? Lets walk through it step by step First, we prepare the table environment begin{table}[ht!] ... caption{This table is neat!} end{table} caption is optional Borrega & Martins (UB) Introduction to L TEX Session #2 A January 21, 2013 34 / 41
  • 73. Floating elements Why must there always be a table? Lets walk through it step by step First, we prepare the table environment begin{table}[ht!] ... caption{This table is neat!} end{table} caption is optional Borrega & Martins (UB) Introduction to L TEX Session #2 A January 21, 2013 34 / 41
  • 74. Floating elements Why must there always be a table? Lets walk through it step by step Next, we create the table with the tabular environment begin{table}[ht!] begin{tabular}{alignment} ... end{tabular} caption{This table is neat!} end{table} Possible alignments are l (left), c (center) and r (right) Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 35 / 41
  • 75. Floating elements Why must there always be a table? Lets walk through it step by step Next, we create the table with the tabular environment begin{table}[ht!] begin{tabular}{alignment} ... end{tabular} caption{This table is neat!} end{table} Possible alignments are l (left), c (center) and r (right) Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 35 / 41
  • 76. Floating elements Why must there always be a table? Lets walk through it step by step Next, we create the table with the tabular environment begin{table}[ht!] begin{tabular}{rcl} ... end{tabular} caption{This table is neat!} end{table} Possible alignments are l (left), c (center) and r (right) Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 36 / 41
  • 77. Floating elements Why must there always be a table? Lets walk through it step by step Finally, we add row after row of table begin{table}[ht!] begin{tabular}{rcl} A & B & C AA & BB & CC AAA & BBB & CCC AAAA & BBBB & CCCC end{tabular} caption{This table is neat!} end{table} The ampersand (&) is the column divider, a linebreak () finishes each row. Borrega & Martins (UB) Introduction to L TEX Session #2 A January 21, 2013 37 / 41
  • 78. Floating elements Why must there always be a table? Ok, run it! if we run the previous code, we get... A B C AA BB CC AAA BBB CCC AAAA BBBB CCCC Table: This table is neat! Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 38 / 41
  • 79. Floating elements Why must there always be a table? Ok, run it! if we run the previous code, we get... A B C AA BB CC AAA BBB CCC AAAA BBBB CCCC Table: This table is neat! Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 38 / 41
  • 80. Floating elements Why must there always be a table? Lets add lines begin{table}[ht!] begin{tabular}{|r|c|l|} hline A & B & C hline AA & BB & CC cline{1-2} AAA & BBB & CCC cline{2-3} AAAA & BBBB & CCCC hline end{tabular} caption{This table is neat!} end{table} Borrega & Martins (UB) Introduction to L TEX Session #2 A January 21, 2013 39 / 41
  • 81. Floating elements Why must there always be a table? Lets add lines A B C AA BB CC AAA BBB CCC AAAA BBBB CCCC Table: This table is neat! Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 40 / 41
  • 82. Floating elements Why must there always be a table? Another quick challenge COLUMN A COLUMN B COLUMN C ROW 1 A1 B1 C1 ROW 2 A2 B2 C2 ROW 3 A3 B3 C3 Table: This table is a quick exercise Borrega & Martins (UB) A Introduction to L TEX Session #2 January 21, 2013 41 / 41