33
L A T E X 2017

Latex

Embed Size (px)

Citation preview

LATEX

2017

OBJECTIVES INTRODUCTION LATEX BASICS MATH IMAGES BIBLIOGRAPHY CONCLUSION

OBJECTIVES

I Introduction to LATEXI Hands-on

I Basics of LATEXI Math environments & commandsI Including graphicsI Creating Bibliography

I Helpful hints & resources

OBJECTIVES INTRODUCTION LATEX BASICS MATH IMAGES BIBLIOGRAPHY CONCLUSION

LATEX IS LIKE MS WORD, ONLY BETTER !

What is LATEX?I Pronounced as ’lay-tech’ or ’lah-tech’I Document preparation system for high-quality typesettingI Uses markup commands and a type setting program TEXI Used for publishing reports, books, scientific documents,

etc

OBJECTIVES INTRODUCTION LATEX BASICS MATH IMAGES BIBLIOGRAPHY CONCLUSION

LATEX SAVES FORMATTING TIME AND EFFORT

Concentrate on writing (content), NOT on formatting(appearance)

why use LATEX?

I Consistent layout, fonts, tables etc. throughout thepresentation

I Mathematical formulae can be easily typesetI Indices, references, footnotes can be easily generated

OBJECTIVES INTRODUCTION LATEX BASICS MATH IMAGES BIBLIOGRAPHY CONCLUSION

HOW DOES LATEX WORK?

I Source text marked up with logical structure (like HTML)I Document class tells LATEX how to format the content

OBJECTIVES INTRODUCTION LATEX BASICS MATH IMAGES BIBLIOGRAPHY CONCLUSION

LATEX OUTPUT FORMATS

Output formats availableI DVI - Device Independent file formatI PS - PostScript file formatI PDF - Portable Document Format

OBJECTIVES INTRODUCTION LATEX BASICS MATH IMAGES BIBLIOGRAPHY CONCLUSION

SETTING UP LATEX

I LinuxMost distributions have a TEXsystem including LATEX.Check software source for a TEXpackage, otherwise installTexLive directly

I Mac OS XMacTex - A full TEX system including LATEX

I WindowsI proTeXt - Easy to install complete LATEX systemI Download MikTeX and TeXnicCenter separately

OBJECTIVES INTRODUCTION LATEX BASICS MATH IMAGES BIBLIOGRAPHY CONCLUSION

OBJECTIVES INTRODUCTION LATEX BASICS MATH IMAGES BIBLIOGRAPHY CONCLUSION

UNDERSTANDING THE CODE & STRUCTUREI Preamble of a documentI Basic formatting: abstract, paragraphs & newlineI Environments - Paragraph style and formatting

OBJECTIVES INTRODUCTION LATEX BASICS MATH IMAGES BIBLIOGRAPHY CONCLUSION

SECTIONING COMMANDS

LATEX can organize, number and index chapters and sections ofa document. There are upto 7 levels of depth for definingsections depending on the document class.

OBJECTIVES INTRODUCTION LATEX BASICS MATH IMAGES BIBLIOGRAPHY CONCLUSION

OBJECTIVES INTRODUCTION LATEX BASICS MATH IMAGES BIBLIOGRAPHY CONCLUSION

BULLETS & NUMBERING

Unordered Lists

\begin{itemize}\item Item 1\item Item 2....\end{itemize}

The default labeling scheme:Level 1 - \bullet (•)Level 2 - (-)Level 3 - \ast (∗)Level 4 - \cdot (·)

Ordered Lists

\begin{enumerate}\item Item 1\item Item 2....\end{enumerate}

The default numbering scheme:Level 1 - 1,2,3...Level 2 - a,b,c...Level 3 - i,ii,iii...Level 4 - A,B,C...

OBJECTIVES INTRODUCTION LATEX BASICS MATH IMAGES BIBLIOGRAPHY CONCLUSION

OBJECTIVES INTRODUCTION LATEX BASICS MATH IMAGES BIBLIOGRAPHY CONCLUSION

MATHEMATICAL MODES

I Inline mode - Write formulas as a part of the text.Math Environment - \begin{math}...\end{math}LATEX shorthand− \(...\)TEX shorthand− $...$

I The formula (a + b)2 = a2 + b2 + 2ab is in inline mode.

I Display mode - Write formulas that are not a part of thetext/paragraph, thus put on separate lines.

Math Environment - \begin{equation}...\end{equation}LATEX shorthand− \[...\]TEX shorthand− $$...$$

I The same formula

(a + b)2 = a2 + b2 + 2ab

is in display mode.

OBJECTIVES INTRODUCTION LATEX BASICS MATH IMAGES BIBLIOGRAPHY CONCLUSION

MATHEMATICAL COMMANDS

Fractions\frac{x + y}{y− z} = x+y

y−z

\frac{frac{1}{x}+ frac{1}{y}}{z} =1x+

1y

z

Subscript and SuperscriptSuperscript: x ˆ n = xn; x{2n} = x2n

Subscript: x n = xn; x {2n} = x2n

Roots\sqrt[5]{\frac{x + y}{y− z}} = 5

√x+yy−z

Brackets(\frac{x + y}{z})2\times(\frac{x2}{y3}) = (

x+yz )2 × (x2

y3 )

OBJECTIVES INTRODUCTION LATEX BASICS MATH IMAGES BIBLIOGRAPHY CONCLUSION

ADDITIONAL OPERATORS

OBJECTIVES INTRODUCTION LATEX BASICS MATH IMAGES BIBLIOGRAPHY CONCLUSION

MATH EXERCISE

I Buzz LightYear: To∞ and beyond!I nCr =

n!r!(n−r)!

I 50 apples ×100 apples = lots of apples

I∑n

i=1 = n(n+1)2

OBJECTIVES INTRODUCTION LATEX BASICS MATH IMAGES BIBLIOGRAPHY CONCLUSION

SOLUTIONS

I Buzz LightYear: To $\infty$ and beyond!I { ˆ n}C r = \frac{n!}{r!(n− r)!}I $50$ apples $\times\textbf{100}$ apples = lots of applesI $\sum {i = 1}n = \frac{n(n + 1)}{2}$

OBJECTIVES INTRODUCTION LATEX BASICS MATH IMAGES BIBLIOGRAPHY CONCLUSION

INCLUDING IMAGES - USING PACKAGES IN LATEX

I Supports .eps, .jpeg, .pngI Include \usepackage{graphicx} in the preambleI Syntax: \includegraphics[attr1 = val1, attr2 = val2, ...]{image}I figure environment will take care of the placement of the

picture with respect to the flow of the documentI The images have to be kept in the same folder

OBJECTIVES INTRODUCTION LATEX BASICS MATH IMAGES BIBLIOGRAPHY CONCLUSION

IMAGE EXERCISE

I \includegraphics{image}I \includegraphics[width = 1.2cm]{image}I \includegraphics[scale = 0.5]{image}I \includegraphics[scale = 0.5, angle = 45]{image}I \includegraphics[trim =3mm 8mm 3mm 1mm, clip]{image}

OBJECTIVES INTRODUCTION LATEX BASICS MATH IMAGES BIBLIOGRAPHY CONCLUSION

SOLUTIONS

Figure: Original

OBJECTIVES INTRODUCTION LATEX BASICS MATH IMAGES BIBLIOGRAPHY CONCLUSION

SOLUTIONS

Figure: Width = 1.2cm

Figure: Scale = 0.5

OBJECTIVES INTRODUCTION LATEX BASICS MATH IMAGES BIBLIOGRAPHY CONCLUSION

SOLUTIONS

Figure: Scale = 0.4, Angle = 45

Figure: trim = 3mm 8mm 3mm 1mm

OBJECTIVES INTRODUCTION LATEX BASICS MATH IMAGES BIBLIOGRAPHY CONCLUSION

INCLUDING BIBLIOGRAPHY

Two ways to include bibliographyI Bibitem - Add each reference within the documentI BibTex - Store bibliography in an external file and link it to

the .tex document

OBJECTIVES INTRODUCTION LATEX BASICS MATH IMAGES BIBLIOGRAPHY CONCLUSION

BIBITEM - REQUIRES MANUAL FORMATTING

I Adds references at the end of the documentI Cross-references and automatically numberedI Requires manual formatting

Syntax - Creating bibliography\begin{thebibliography}{widest entry}

\bibitem[label 1]{cite key 1} bibliographic information\bibitem[label 2]{cite key 2} bibliographic information...\end{thebibliography}

Syntax - Citing references\cite{cite key} - Single reference\cite{cite key 1, cite key 2, ...} - Multiple references

OBJECTIVES INTRODUCTION LATEX BASICS MATH IMAGES BIBLIOGRAPHY CONCLUSION

OBJECTIVES INTRODUCTION LATEX BASICS MATH IMAGES BIBLIOGRAPHY CONCLUSION

BIBTEX - SIMPLER & EASIER

I Uses structured bibliography .bib file to be included in .texdocument

I Generates bibliography according to specified style

Write Once, Use many approach

OBJECTIVES INTRODUCTION LATEX BASICS MATH IMAGES BIBLIOGRAPHY CONCLUSION

BIBTEX ENTRY FORMAT

@entry type{cite key},field name 1 = “fieldtext”field name 2 = “fieldtext”

... }

I entry type - article, book, online, phdthesis, etc.I field name - author, title, volume, year, publisher, etc.I cite key - user defined key to cite the reference

For example, if reference is a book@book{HK,

author = “H.Kopka and P.W.Daly”,title = “A guide to Latex”,publisher = “Addison-Wesley”,year = 1999.

}

OBJECTIVES INTRODUCTION LATEX BASICS MATH IMAGES BIBLIOGRAPHY CONCLUSION

USING BIBTEX DATABASE

I Import biblatex packageI \usepackage{biblatex}

I Tell the compiler which .bib file to useI \bibliography{bibfile name}

I Select bibliographic styleI \bibliographystyle{style}I Standard styles - plain, alpha, abbrv, unsortI Publishers often supply their own style files (.bst)

I Citing ReferenceI \cite{cite key 1, cite key 2, ...}

OBJECTIVES INTRODUCTION LATEX BASICS MATH IMAGES BIBLIOGRAPHY CONCLUSION

OBJECTIVES INTRODUCTION LATEX BASICS MATH IMAGES BIBLIOGRAPHY CONCLUSION

ONLINE TUTORIALS & RESOURCES

I CEAS Library LATEX resourceshttp://guides.libraries.uc.edu/latex

I Online LATEX links & tutorialsI Basic Tutorial by Andrew RobertsI The LATEX wiki bookI LATEX Project http://www.latex-project.org/

OBJECTIVES INTRODUCTION LATEX BASICS MATH IMAGES BIBLIOGRAPHY CONCLUSION

Questions??

OBJECTIVES INTRODUCTION LATEX BASICS MATH IMAGES BIBLIOGRAPHY CONCLUSION

Thank you for attending the workshop!!