Intro to LaTeX WING meeting 12 Jan 2007 What’s LaTeX An alternative to using MS Word for writing reports and papers Our target today HYP Thesis by ytm52584

VIEWS: 230 PAGES: 19

Ph.D Thesis Template document sample

More Info
									Intro to LaTeX
 WING meeting 12 Jan 2007
             What’s LaTeX?

    > An alternative to using MS Word for writing
      reports and papers

    > Our target today:
         HYP Thesis
         ACM Conference Submissions
         PhD Thesis


    > Best Practice Tools



2
              Why LaTeX?

    > Plain Text with Markup
    > Forces you to concentrate on writing
    > Takes care of math, figure positioning,
      references, and tables of contents quite well.
    > Free!

    > Why not LaTeX?
         Steep learning curve
         Not WYSIWYG (even with 3rd party tools)
         Needs compilation
         Ugly tables and Figure inclusion is hard

3
    > Conclusion: use if you have time to learn
            Example of LaTeX
            document
    \documentclass{article}
    \title{Simple Example}
    \author{Andrei Gurtov}
    \date{March 2000}
    \begin{document}
    \maketitle
    Hello world!
    \end{document}




4
       Tabular
                            Two Columns
    > Columns
        \begin{tabular}{|…|…|}
        \end{tabular}
                                       l = automatically adjust
    > Rows                                 size, left justify
        & - Split text into columns    r = automatically adjust
        \\ - End a row                     size, right justify
        \hline - Draw line under row   p = set size
        e.g. 123123 & 34.00\\ \hline        e.g p{4.7cm}
                                       c = centre text




5
        Example of table

    \begin{tabular}{|l|r|c|} \hline
    Date & Price & Size \\ \hline
    Yesterday & 5 & big \\ \hline
    Today & 3 & small \\ \hline
    \end{tabular}


             Date          Price      Size
             Yesterday        5        Big

             Today            3       Small



6
                         Floating Objects

    > Floating objects can stop splitting of tables and
      images over pages.
       \begin{figure}[options]
       \end{figure}
       \begin{table}[options]
       \end{table}
    > They will now appear in the
          List of Figures (LOF) and
          List of Tables (LOT).



                                 Options (recommendations)
                                 h = place table here
                                 t = place at top of page
7                                b = place at bottom of page
              Example of floating
              figure

    >   \begin{figure}[ht]
    >   \centering\epsfig{file=uni.ps, width=5cm}
    >   \caption{University of Helsinki}
    >   \label{uni}
    >   \end{figure}      Width and height modifiers


             Figure~\ref{uni}
             shows...


8
                  Some Math

    \begin{center}
    {\large
    $$ y=\frac{a^3+2c_{x}}{1+\sqrt{b_{x}}}
        $$ \\
    \vspace{0.2in}
    $$
        Q=\sum_{i=1}^{j}\int_{\mu}^{\infty}
        f(x_{j})dx $$ \\
    \vspace{0.2in}
    $$ \Psi = \oint_{-
        \infty}^{\infty}f_{xy}({\frac{\partial
    Qx}{\partial Qy}})^{\Im_{\pi}^ \prime}
        $$ \\ }




9
               Local .sty and .cls files

     > These are the files that control the
       formatting of the final file (look&feel)
          LaTeX uses .sty (style files)
          LaTeX2E uses .cls (class files)


     > For HYP reports use Wei Tsang’s page
          Google “latex ooiwt” or “latex nus soc”

     > For Ph.D. thesis use Hang’s template
          www.cuihang.com/software/thesis_template.zip
          Or WING cvs sg/edu/nus/comp/hang/thesis_template

     > For papers, start with the ACM template
10        Google “acm latex template”, use alternate tighter style
               Trivial to do

     > Create a table of contents
     > Create a table of figures
     > Create the bibliography
          Only records that were referenced will be included
          This means you can keep all of the references you will
          ever use in one BibTex file.




11
               Bibliography using
               BibTex

     > Bibliography information is stored in a
       *.bib file, in BibTex format.
     > Include chicago package (at top)
          \usepackage{chicago}
     > Set referencing style (at end)
          \bibliographystyle{chicago}
     > Create reference section by
          \bibliography{bibfile with no extension}




12
                Bibliography using
                Bibtex

     @book{Come95,
     author=“D. E. Comer”,
     title={Internetworking with TCP/IP:
         Principles, Protocols and Architecture},
     publisher=“Prentice-Hall”,
     year=1995,
     volume=1,
     edition=“Third”}




13
                        Bibliography
                        contd.
     > Citing references in text
           \cite{cuc98} = (Cuce 1998)
           \citeN{cru98} = Crud (1998)
           \shortcite{tom98} = (Tom, et. al. 1998)
     > Creating Bibtex Files
           Use Emacs with extensions.
            or copy Bibtex entries from bibliography database.
           ACM Portal has option to get BibTex reference




14
              Problems

     > Often LaTeX will fail with an error.

     > If it has a question mark for you,
       type “x” and press enter.

     > This will quit LaTeX.

     > When LaTeX dies like this, it is
       almost always because you
       screwed up.


15
                How to solve problems

     > Look at the error LaTeX gave you.

     > It will have a line number which will help you
       find the error.

     > Common mistakes:
           Mismatched \begin{}/\end{} blocks
           Mismatched {/}
           Mismatched $, $$, or \(\) or \[\]
           Misspelled keywords

     > Sometimes lines are too long. This isn’t fatal
       but looks bad. LaTeX outputs a warning with
       a line number so you can fix it.
16
               Best Practice Tools

     > make to create your pdf file
     > Use another program to create eps or pdf
       figures for inclusion.
          PowerPoint, or xfig
          Use graphicx or epsfig package for eps figures
          You can import raster graphics (jpg) but this is trickier;
          make sure resolution is correct
     > Use GhostView to see revisions
          Can read PDF, not as slow or feature heavy as Acrobat
          Reader
          Handles re-opens well
     > Need to count words?
17        Use my texWordCount.pl script, from my software page.
               General Best Practices

     > Check in your revisions very often to get CVS
       to backup your stuff
          You may need to refer to your old files
          Do comment your revisions
          Use in file CVS $Id$ and $Log$ to see revision history
     > Use specific comments
          Comments start with % but don’t show
          Use % BUG: to tell me what to correct, I will do the same
          Use % GUB: to tell me what’s fixed; I will then delete the
          line if I agree
     > Use inline notes {\em BUG: xxx }
          If you need me to see a thing wrt to the actual file.
18
               Need help?

     > Use the web; learn by example
     > One in particular:
       Hypertext help for LaTeX
          http://www.comp.nus.edu.sg/~kanmy/latex (local)




19

								
To top