190 likes | 439 Views
Introduction to. Jeroen Buijs. Contents. Today What is LaTeX ? What do we need? Our first example : The Nature LaTeX template Writing articles in Latex Basic commands References Figures Tables Math, Chemistry and Life Sciences Next Presentations in LaTeX Posters in LaTeX
E N D
Introductionto Jeroen Buijs
Contents • Today • What is LaTeX? What do we need? • Our first example: The Nature LaTeX template • Writingarticles in Latex • Basic commands • References • Figures • Tables • Math, Chemistry and Life Sciences • Next • Presentations in LaTeX • Posters in LaTeX • Installation of stand-aloneversion
What is (La)TeX? • TeX is essentially a Markup Language (like HTML, XML and RTF) • TeX written in 70´s • TEX is a typesetting language written by Donald Knuth. • Plain TEX easy for simple documents (without equations, chapters etc). • Otherwise very tricky. • LaTeX is an extension of TeX • Macro packages to make TeX easier to use
Latex vs. Word Processors • WYSIWYG - WYMIWYG • High typeset quality • Easy to include formulas& references • Source file format is not bounded to a particular OS or platform • Implementations exist for all platforms (DOS, Windows, Unix,..) • Free • Steeplearning curve • Requirescompilation
How to make a document • Writer only makes source • Software creates document source compiler document
How to make a document source compiler document • SeveralgoodLaTeX editors exist, e.g. • TeXniccenter, www.texniccenter.org (Windows only) • TeXstudio, http://texstudio.sourceforge.net/ (“all major OS”) • TeXmaker, http://www.xm1math.net/texmaker/ (Linux, MacOSx, Windows)
How to make a document source compiler document • The set of programs that makes it possible to compile TeX and LaTeXdocuments is called a TEX distribution. • There are many (La)TeX distributions available for different operating systems. The most commonly used ones are • Windows • proTeXt, http://www.tug.org/protext/ • (includesMikTeX & TeXstudio)) • MixTeX, http://www.miktex.org • Mac: MacTeX, https://tug.org/mactex/ • Unix/GNU/Linux: TeX Live, http://www.tug.org/texlive/
How to make a document source compiler document TeXdistributionscomewithdifferent programs toobtain different output formats. We willusepdflatextocreate pdf documents
How to make a document source compiler document • Stand-aloneversion • Online editors & compilers: • WriteLaTeX, ShareLaTeX: https://www.sharelatex.com • Graphical interface combining WISYWIG with WYSIWYM: http://www.lyx.org • Exercise1: • Createan account on ShareLaTeX • Create a new articleintendedforNature • In the Menu, make sureto select pdflatexand a spell checker • Compileandreflect on the relation source – finaldocument • Where do youspell check your document?
The main file: XXX.tex • The main file contains a preambleand a document environment • The preamble • defines the class (and overall style) of your document bydefining the document class • tells the compiler which packages includingall kinds of extra (style) definitionsyouwilluse • containsyourowndefinitionsandcommands • The document environment • Starts with\begin{document}, endswith\end{document} • Contains the contents of your document • There are other files involved as well. In this case: • A file defining the bibliographystyle (XXX.bst) • A file containing the content of the references (XXX.bib)
The main file: XXX.tex • Exercise 2: • Change the title. • Change totwoauthorsandaddnames. • Compileand download the PDF. Tolearn more on packages andcommands, let’sbuildourownarticlefrom scratch using the standard article class Excellent referenceforall “basic stuff”: The notso short introductiontoLaTeX2e Andifyou’restuck? Google! Exercise 3: Using the standard article class, use (Share)LaTeXtocreate a pdf containingpage 1 of the article “Recent insights into Candida albicansbiofilm resistance mechanisms” by Mathé and Van Dijck.
References • Choose a bibliographystyle. For thisjournal, we use the chicagobibstyle.Addthis file toyour project: http://mirrors.ctan.org/biblio/bibtex/contrib/chicago/chicago.bst • Create a bib file thatwillcontainyourreferencesandadd the first reference in BibTeX format, e.g. byusingTeXMeD • Tell TeXtoinclude the references at the end of the document in the right style • Include the natbib package • Insert a \bibliograhystyleand\bibliographycommand • Add the citation in the tekst using the \citecommand
Figures • The package graphicxcanbeusedtoincludevariousgraphic formats • (like pdf, jpg, png) • Figures are typicallyadded as floatsby the • \begin{figure} … \end{figure} environment • In a multicol environment, floats are notallowedtofloat. We canuse the float package and the option [H] to do so…: • Preamble: • \usepackage{graphicx,float} • In the document: • \begin{figure}[H] • \centering • \includegraphics[width=0.9\linewidth]{qBasePlus_example} • \caption{qBasePlus} • \label{fig:qbp} • \end{figure}
Figures Always use vector basedgraphic formats ifpossible. Easiest way is toconvertthemallto pdf Exercise 4a: Add the figure qBasePlus_Example.pdf toyourarticle. First use the blindtext package toaddsome extra textbeforeandafter the picture. Add a cross referenceto the figure in yourtext.
Figures Or even better: let’screateourowngraphfrom the raw data. We use the packages pgfplotsandtikztodo this. We don’t want tooverloadourmain file, sowe’ll put the figure in a seperatetex-file using the standalone document class, andincludeitafterwards. Exercise 4b: Create a new file qbpfig.texanduseybar (pgfplots package) torecreate the figure. Use the \includestandalonecommand of the standalone package toinclude the figure in yourarticle.
Figures Possibleresult: • Advantages: • The font andstyle are the same as those of yourtext. • Youcanchoose the most appropriate way torepresentyour data • Take a look hereto get anidea of the strength of this package: • http://www.texample.net/tikz/examples/all/
Tables Toincludetables, we canusetablefloatsand the tabularenvironment. For complex tables, youcanuse spreadsheet-to-latex converters, e.g. Excel2LaTeX, http://www.ctan.org/pkg/excel2latex Exercise 4c: Add a tabletoyourarticle. Ifyou want, installanduse a spreadsheet converter. Alternatively, youcanusean online LaTeXtable generator.
Math, Chemistry & Bio stuff • LaTeX is verygood in typesetting mathematicalandchemicalformulas. • For ‘complexer’ mathematics, use the amsmath package. • For chemicalformulas, use the chemfig package • Therealsoexistsome bio-related packages, like: • texshade, fordisplaying the key changes in DNA • textopo, to draw transmembraneproteinsfrom a SwissProt file Exercise 5: (choosewhatyoulike) Add a Michaelis-Menten (or someother) equationtoyourarticle. Add the 2D formulaforethenoltoyourarticle. Check out one of the life science packages
Presentations in LaTeX Note: There is a lot of discussion, even within the LaTeX community, About the use of LaTeXfor making presentations – althoughverygood Resultscanbeobtainedforscientificpresentations, somearguethat It’s tocumbersometoproducegoodresults without visual software… The best way tocreatepresentations in LaTeX, is byusing the beamer class Example!