Presentation of Scientific Results Marek Seliger Lecture and Seminar 2 nd lecture: Gnuplot and LaTeX how to prepare figures and equations physik.uni-graz.at/~sel/teaching/presentation Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 1/40
How to prepare figures program, method result plot with output Fortran C MATLAB Mathematica paper & pencil data set file.dat x y z...... analytical expression f(x)= Gnuplot Excel Origin Mathematica MATLAB screen figure PostScript (.ps) encapsulated ps (.eps) gif, tif, jpg, pdf (most common) Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 2/40
Gnuplot: An Introduction Gnuplot is a plotting device for analytical functions and for data Free for Linux and Windows www.gnuplot.info For Windows download binary: gp420win32.zip There you also find lots of examples screenshots tutorials Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 3/40
Features Easy to use Youcan work with it and also produce figures for presentations 2D plots 3D plots Contour plots Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 4/40
Basic Commands: An Example gnuplot set term post eps color solid set output 'figure.eps' set title 'Short Laser Puls' set xlabel 'Time [fs]' set ylabel 'Amplitude [arb. units]' set sample 1000 set size 0.6,0.6 set xrange [-pi:pi] plot 'data.txt' with xyerror title 'Experiment \,cos(x*10)*exp(-x*x) title 'Amplitude'\,exp(-x*x) title 'Envelope' quit data.txt: -3 0 0.3 0.1-2 0.05 0.3 0.1-1 -0.42 0.3 0.1 0 0.8 0.3 0.1 1-0.4 0.3 0.1 2 0 0.3 0.1 3 0 0.3 0.1 Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 5/40
The Fine Art of Figures: 3D Contour Plots set pm3d unset surface set palette model RGB rgbformulae -21,-35,-23 set palette model HSV rgbformulae 3,2,2 plot sin( sqrt(x*x+y*y) ) / sqrt(x*x+y*y) Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 6/40
LaTeX: An Introduction (based on slides by Troy D. Milner and Simon Cuce) TeX is essentially a Markup Language (like HTML, XML and RTF) TeX written by Donald Knuth in 70 s A revolution in typesetting Latex is an extension of TeX Macro packages to make TeX easier to use Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 7/40
Latex vs. Word Processors High typeset quality Easy to include math formulas Source file format is platform independent Latex implementations exists for all platforms Latex is free De facto standard for scientific publishing Very few bugs Good for large documents Can run even on 386 PC Not very easy to learn Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 8/40
How to install LaTeX 1. Package MikTeX: www.miktex.org 2. Ghostscript and GSview: www.cs.wisc.edu/~ghost 3. Acrobat Reader: www.adobe.com/products/acrobat/readstep2.html 4. Windows Editor TEXnicCenter: www.toolscenter.org WinEdit: www.winedt.com LyX: www.lyx.org Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 9/40
Example of Latex document \documentclass{article} \begin{document} Hello world! \end{document} Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 10/40
Example of Latex document \documentclass{article} \title{simple Example} \author{max Mustermann} \date{march 2007} \begin{document} \maketitle Hello world! \end{document} Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 11/40
Creating Latex Files Your Latex File (a text file) Latex compile x3 Your Bibtex File Bibtex compile x2 Latex compile x3 Device independent output.dvi dvips compile x1 Your Postscript File Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 12/40
Latex File Structure Document Class Predefined Formats (article, report, book,..). Packages used Added Functionality (graphics, reference style,...). Main Body Text and Bibliography References. Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 13/40
The Basics Document Class \documentclass[options]{class} options = a4paper, 11pt, 12pt, 10pt, twocolumn, landscape,... class = article, report, book,... Packages \usepackage{package name} epsfig = insert PS pictures into the document fancyhdr = easy definition of footer and header Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 14/40
Body of Text Start with \begin{document} End with \end{document} Typesetting Text \\or \newline and \newpage Quotations Bold \textbf{ } or \bf Italics \emph{ } or \textit{ } or \it Underline \underline{ } or \ul Including Multiple Files \input{filename.tex} Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 15/40
Format Sections \section{ } \subsection{ } = 1. Latex is Great = 1.1 Why Latex is Great \subsubsection{ } = 1.1.1 Reason One \appendix - changes numbering scheme \chapter{ } - To be used with book and report document classes Titles, Authors and others \title{ } \author{ } \footnote{ } Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 16/40
Format Contd. \maketitle - Display Title and Author \tableofcontents - generates TOC \listoftables - generates LOT \listoffigures - generates LOF Labels \label{marker} - Marker in document. \pageref{marker} - Displays page no. of marker. \ref{marker} - Displays section location of marker. Itemize Use either enumerate, itemize or description. Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 17/40
Lists Source \begin{itemize} \item Apple \item Orange \end{itemize} Result Apple Orange Enumerate instead of itemize gives a numbered list Lists can be nested Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 18/40
Environment Something between \begin{name} \end{name} Many command, for example \bf affect the text until the end of environment Environments can be nested Examples: itemize, center, abstract Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 19/40
Group Group is some text between { and } Many commands work until the end of the group Code put {one word \bf in bold} here Result put one word in bold here Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 20/40
Alignment Environments: center, flushleft, flushright Example \begin{flushright} Right aligned \end{flushright} Result Right aligned Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 21/40
Font size \tiny \scriptsize \footnotesize \small \normalsize \large \Large \LARGE \huge \Huge Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 22/40
Tabular Columns \begin{tabular}{ } \end{tabular} Two Columns Rows & - [ampersand] Split text into columns \\ - End a row \hline - Draw line under row e.g. 123123 & 34.00\\ \hline l = automatically adjust size, left justify r = automatically adjust size, right justify p = set size e.g p{4.7cm} c = centre text Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 23/40
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 Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 24/40
Images Use epsfig package \usepackage{epsfig} Including images in main body \epsfig{file=filename.eps, width=10cm, height=9cm, angle=90} Creating EPS - Use xv and/or xfig MS Power Point, print as PostScript (PS) Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 25/40
Floating Objects Floating objects can stop splitting of tables and images over pages. \begin{figure}[options] \end{figure} \begin{table}[options] \end{table} use \clearpage to flush all floating objects 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 b = place at bottom of page Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 26/40
Example of floating figure \begin{figure}[ht] \epsfig{file=uni.eps, height=5cm} \caption{university of Graz} \label{uni} \end{figure} Figure \ref{uni}shows... Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 27/40
Typesetting Math Mathematical text is placed between $ which is normally displayed inline like $f(x)=y$ To display formulas as an extra equation use $$ F=m a $$ For numbered equations use \begin{equation} F=m a \end{equation} Math mode uses italics and no spaces between words Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 28/40
Useful Math Commands Greek letters $\pi$ for lowercase, $\Pi$ for uppercase Fractions $\frac{numerator}{denominator}$ Inline: My equation is $\alpha = \frac{n}{2} \times \xi$. Square roots $\sqrt{x}$ Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 29/40
Useful Math Commands Superscripts and Subscripts $x^2$ $x_2$ Use curly braces to group items together $x_{i_2}$ or $x_{min}$ Can have a superscript and a subscript on the same character $x_i^3$ Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 30/40
Useful Math Commands Limits and Integrals $$ \int \lim_{x \to \infty} 3x $$ $$ \int_0^2 x\, dx $$ The \, gives a space between x and dx $$ \sum_{i=1}^n i = \frac{n(n+1)}{2} $$ Displaying special characters $\ mathbb{r} $ Trignometric functions $\sin$ or $\cos$ Math inequalities $\le$ or $\ge$ Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 31/40
Using Parenthesis The size of the parenthesis should match the size of the mathematical expression. $O(\frac{1}{n})$ $O\left(\frac{1}{n}\right)$ 1 O( ) n O 1 n $\left\{\frac{1}{n}\right\}$ { is a special symbol: Use \{ 1 n Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 32/40
An Example \begin{equation} x = \left\{ \begin{array}{lr} y & \mbox{if $y > 0$} \\ z+y & \mbox{otherwise} \end{array} \right. \end{equation} Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 33/40
Some Examples $$ y=\frac{a^3+2c_{x}} {1+\sqrt{b_{x}}} $$ $$ Q=\sum_{i=1}^{j} \int_{\mu}^{\infty} f(x_{j}) dx $$ $$ \Psi = \oint_{- \infty}^{\infty} f_{xy} ({\frac{\partial Qx}{\partial Qy}}) ^{\Im_{\pi}^ \prime} $$ Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 34/40
Other Important Characters Comments Use % at the beginning of any lines you want to comment out Creating a space between two characters \, Creating a new line \newline Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 35/40
Bibliography by hand \begin{thebibliography}{} \bibitem[mus07]{mm07} M. Muster, and M. M\ uller, {\sl My first paper}, Phys. Rev. A {\bf 55}, 2145 (2007). \end{thebibliography} [12] M. Muster, and M. Müller, My first paper, Phys. Rev. A 55, 2145 (2007). Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 36/40
Bibliography using Bibtex Bibliography information is stored in a *.bib file, in Bibtex format. Include chicago package \usepackage{chicago} Set referencing style \bibliographystyle{chicago} Create reference section by \bibliography{bibfile with no extension} Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 37/40
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 } Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 38/40
Bibliography contd. Citing references in text \cite{cuc98} = [12] or (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. Use JabRef as your personal data base Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 39/40
Thank You for Your Attention! Now you know: how to make simple figures how to install LaTeX how to produce a LaTeX document Next time (April 3 rd ): How to prepare a scientific talk the central point of this lecture: don t miss that one Marek Seliger Presentation of Scientific Results, Gnuplot and LaTeX page 40/40