2 Day Workshop on Research Methodology & Technical Writing

FOR BEGINNERS

Chandra Prakash Assistant Professor IGDTUW, Delhi Index

• – Introduction • Why you should learn LaTeX ? • Nuts and Bolts of LaTeX – Structure – Format – Equations – Table and Figure – Reference • Examples

2 Common Scenario in Research

• As a Researcher you need to write a scientific Paper/Thesis and publish your research work • Each publishing firm (IEEE, Springer etc.) has its own layout. • If not selected in one firm, send it to other. – One way :- Rewrite it again as per new format – Other way :- If you write it in Latex you only need to change the style file to set it into their format. • There is no need for a complete rewrite Introduction

• LaTeX is a typesetting systems (scripting language) suitable for producing high quality scientific and mathematical documents – Enables authors to typeset and print their work at the highest typographical quality. – Pronounced as “Lay-tech”. – Uses TeX formatter as its typesetting engine.

• TeX is a program written by Donald Kunth in 70’s for typesetting text and mathematical formulas

TeX

LaTeX Identify Which One is Good in Look ??

5 Latex vs. Word Processors

• Standard processors (M.S. Word, Open office) are of the WYSIWYG type, that is, what you see is what you get. Instead, LATEX is considered as WYSIWYM, what you see is what you mean. • High typeset quality Word

 J[x(),u()]   F(x(t),u(t),t)dt LaTeX t0 • Easy to include math formulas • Source file format is not bounded to a particular OS or platform  • Portability (Windows, Unix, Mac) • Latex implementations exists for all platforms (DOS, Windows, Unix, Mac ..) • Free Vs Paid Again  Which One is Latex Draft ??? 

7 Why to use it • Considered as De facto standard for scientific publishing • Reuse already written up material • Almost all good journals/conferences have their LaTeX styles (just download and use them). • Meaning based structuring (rather than appearance) • Few bugs as compared to other drafting tools • Easy to draft large documents

• Final reason: Most likely, you will be forced to use it, since it is the fist choice of every good Researcher Disadvantages of using LaTeX

• It can be a bit overwhelming at first

• Fairly steep learning curve – Learning how to use it takes time

• Customizing is tedious. – Layout changes are difficult (i.e., will require time for you to hunt down solution and implement it) Installation: What do I need to use LATEX

Two different components to be installed : • A LATEX editor and • MiKTeX. • Download and install MikTeX LaTeX package http://www.miktex.org/

• Install Foxit Reader/Acrobat Reader

• Install Editor — Tex Studio — Online Editor: — WinEdt http://www.winedt.com/ https://www.sharelatex.com/ — TexnicCenter https://www.overleaf.com/ http://www.texniccenter.org/ — TeXworks — Emacs, vi, etc. TexStudio

11 To run and compile Tex file Texmaker

12 Basic steps to Use LaTeX to Create Documents

• Start with a skeleton document • Create it by yourself, • Get it from you colleagues, • Download it from journals’website

• Fill stuff into your skeleton document • Text, formula, figure, table …

• Run LaTeX to generate output and make modifications

• Learn as you go – via online — Comprehensive tutorial http://www.latex-tutorial.com/tutorials/ — Beginning LaTeX http://www.cs.cornell.edu/Info/Misc/LaTeX-Tutorial/LaTeX-Home.html Output Formats

.dvi Device Independent .ps Post Script .pdf PDF .rtf Rich Text Format .html HTML .xml XML

1 Process to Create Document Using LaTeX

TeX input file Your source LaTeX file. document

Run LaTeX program

DVI file Device independent output file.dvi

Run Device Driver Unix Commands

Out input file > latex file.tex runs latex file.ps or file.pdf > xdiv file.dvi previewer > dvips file.dvi creates .ps > pdflatex file.tex creates .pdf directly Latex File Structure • Document Class Predefined Formats (article, report, book,..). \documentclass[options]{class} options = a4paper, 11pt, 12pt, 10pt, twocolumn, landscape,... class = article, report, book,... • Packages used Added Functionality (graphics, reference style,...). \usepackage{package name} Eg: epsfig = insert PS pictures into the document fancyhdr = easy definition of footer and header • Main Body Text and Bibliography References. Basic Structure of LaTeX Document

\documentclass[options]{class} Define the types of the document \documentclass [12pt]{article} (article, book, thesis, letter …)

\usepackage {color} Preamble. Incorporate packages or \usepackage {graphicx} define macros here

\begin{document} \part{...} \section{Section Title} \subsection{ Title} Main body, stuff to be printed, title, \subsubsection{Title} authors, abstract, sections, \paragraph{...} references, …. \subparagraph{...} \end{document} Body of Text

• Start with \begin{document} • End with \end{document} • Typesetting Text – \\ or \newline and \newpage – Comment or Quotations % – Bold \textbf{……………} or \bf – Italics \emph{…………} or \textit{………} or \it – Underline \underline{…………} or \ul Format

• Sections – \section{…} 1. Latex is Great – \subsection{…} 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{footnote-text} Format Contd.

• \maketitle - Display Title and Author • \tableofcontents - Generates TOC • \listoftables - Generates List of Tables • \listoffigures -Generates List of Figures • 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. Body of Text cont…

• Including Multiple Files – \input{filename.tex}

• Modify main.tex to include chapters \documentclass{report} \title{Assignment 1 for ICT} \author{Prakash} \begin{document} \maketitle \tableofcontents \include{chapter_1} \include{chapter_2} \include{chapter_3} \end{document} Lists

• Source \begin{itemize} \item Apple \item Orange \end{itemize} – Apple – Orange • Enumerate instead of itemize gives a numbered list • Lists can be recursive Environment

• Something between – \begin{environment-name} – \end{environment-name} • Many command, for example \bf affect the text until the end of environment • Environments can be recursive • Examples: – Enumerate, itemize, description – Abstract- It is normally placed just after the \maketitle command. • \begin{abstract} • ... • \end{abstract} Standard Environments

\begin{env_name} stuff Environment name (env_name) can be \end{env_name} document, itemize, enumerate, tabular, etc.

\begin{itemize} \item The first item \item The second item \end{itemize}

\begin{enumerate} \item The first item \item The second item \end{enumerate} 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 Alignment

• Environments center, flushleft, flushright • Example – \begin{flushright} – Right aligned – \end{flushright} • Result Right aligned Font size

\tiny \scriptsize \footnotesize \small \normalsize \large \Large \LARGE \huge \Huge Formulas: How to insert Math

• In order to insert formulas in the main text, we need the operator ($).

• Use \( … \) for in-line and \[ … \] for displaying math formulas • Spaces inside \( … \) and \[ … \] are ignored. If needed, use “\ ” to add space • Use \mbox{…} for words inside math formulas Mathematics

Greek Symbols \alpha, \beta, \gamma

Superscript, Subscript x^y x_y x_y^z

Calculus \int_0^\infty \int{\int}

\frac{\partial u}{\partial x}

x = \frac{-b \pm \sqrt{b^2-4ac} } {2a} Some more 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} $$ \\ } Floating Objects • Floating objects can stop splitting of tables and images over pages. • Figures & Tables cannot be broken between pages • They are “floated” Options (recommendations) h (here) - place at same location \begin{table}[options] t (top) - place at top of page \end{table} b (bottom) - place at bottom of page p (page) - place at on an extra page \begin{figure}[options] ! (override) - will force the specified \end{figure} location H - Places the float at precisely the • They will now appear in the location in the LATEX code. – \listoffigures Requires the float package. This is somewhat equivalent to h!. • List of Figures (LOF) – List of Tables (LOT). Table environment

• The syntax for creating a table object is the following \begin{table}[position ] \label{tab1} \caption{table-caption } \begin{tabular} ... \end{tabular} \end{table}

32 Tabular

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

\begin{tabular}{l|c|c} \hline \multicolumn{3}{c}{Gender separation} \\ \hline & Female & Male \\ \hline Faculty & 0 & 12 \\ Research fellows & 1 & 1 \\ Ph.D & 1 & 9 \\ \hline \end{tabular} \

Example of Figure/Image You can insert figures in pdf, jpg, eps, and other formats into your document. \begin{figure}[position ] \centering \includegraphics[options ]{filename } \caption{caption-text } ... \end{figure} width, height, angle and scale \includegraphics[width=10cm,height=10cm] Multiple figures can be inserted{figure1.jpg} using \subfigure begin{figure}[hbtp] \centering \includegraphics[scale=.8]{ic3.jpg} \caption{IC3 Certificate} \end{figure} 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, save as GIF and convert to EPS. Cross Referencing

LaTeX generates numbers for Theorem, Equation, Section, Figure and other environments automatically. You can access them with \label and \ref

\section{Introduction} \label{sec:intro}

….

In Section \ref{sec:intro}, we ….

\label{marker} \ref{marker} \pageref{marker}

\section{Introduction} \label{intro} …

As mentioned in section \ref{intro} in page \pageref{intro} Reference and Citation

Easier in M.S Word , if need to change one reference we have to change all numbering again . Whereas in Latex no need

The \thebibliography environment produces a bibliography or reference list. In the article style, this reference list is labeled "References"; in the report style, it is labeled "Bibliography".

\begin{thebibliography} {widest-label}

\bibitem[label]{cite_key} . . . \end{thebibliography} Bibliography by hand

\begin{thebibliography}{1} \bibitem{IEEEhowto:1} A Nandy, S Bhowmick, P Chakraborty, GC Nandi. Gait Biometrics: An Approach to Speed Invariant Human Gait Analysis for Person Identification, Advances in Intelligent Systems and Computing Volume 236, pp 729-737, 2014. \bibitem{IEEEhowto:2} M.W. Whittle, Gait Analysis: An Introduction, 4th Edition, Elsevier, 2007. \bibitem{IEEEhowto:3} D.A. Winter, Biomechanics and Motor Control of Human Movement, 3rd Edition, John Wiley and Son Inc., New York, 2009. \end{thebibliography} Problem with this method

• User is burdened with deciding how to format article titles, journal names, proceeding references • Difficult to reuse references in other documents Solution : BibTex

• Complements LaTeX documents by managing bibliography and references • Minimizes the drudgery of formatting, numbering, and referencing • Disadvantage: – Steep Learning Curve The BibTex Process

1. Create a BibTex file with Rerefence entries 2. Get a *.bst file (bibliographic style file) 3. “Compile” or “Build” your LaTeX document to create an *.aux file 4. Run BibTeX on your LaTeX file 5. Run LaTeX twice on your updated file 6. View the dvi or pdf file Bibliography using Bibtex

• Bibliography information is stored in a *.bib file, in Bibtex format. • Include chicago package ( a kind of Bibliography style ) – \usepackage{chicago} • Set referencing style – \bibliographystyle{chicago} • Create reference section by – \bibliography{bibfile with no extension} Types of Documents BibTex can handle

• ARTICLE • MISC • BOOK • PHDTHESIS • BOOKLET • PROCEEDINGS • INBOOK • TECHREPORT • INCOLLECTION • UNPUBLISHED • INPROCEEDINGS • MANUAL Each Document type can have the following entries

• address • month • author • note • booktitle • number • chapter • organization • crossref • pages • edition • publisher • editor • school • howpublished • series • institution • title • journal • type=“Ph.D. dissertation” • key • volume • language • year Sample BibTex

Book Entry (mybib.bib) @BOOK{Press, author="W.H. Press", title="Numerical Recipes in C: The Art of Scientific Computing", publisher="Cambridge University Press", year=1992, } Sample BibTex Technical Report Entry

@TECHREPORT{Berk, author="Lex A. Berk and L.S. Bernstein and D.C. Robertson", title="MODTRAN: a moderate resolution model for LOWTRAN 7", number="GL-TR-89-0122", institution="Spectral Science", address = "Burlington, MA", year = 1989 } Sample BibTex

Ph.D. Dissertation Entry @PHDTHESIS{Kuo, author="Jan-Tai Kuo", title="The Influence of Hydrodynamic Transport on Phytoplankton Dynamics in Homogeneous Lakes", school="Cornell University", address="Ithaca, NY", year=1981, } Sample BibTex Article Entry

@ARTICLE{Vodacek, author="Anthony Vodacek and F.E. Hoge and R.N. Swift and J.K. Yungel and E.T. Peltzer and N.V. Blough", title="The use of in situ and airborne fluorescence measurements to determine UV absorption coefficients and DOC concentrations in surface waters", journal="Limnology and Oceanography", volume=40, number=2, year=1995, pages="411--415", } Article in Proceedings

@INPROCEEDINGS{Ulrich, author="B.L. Ulrich and P. Lacovara and S.E. Moran and M.J. DeWeert", title="Recent results in imaging lidar", crossref="Narayanan", pages="95--108", } 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. Bibtex bibliography styles

And more52 … Sample LaTeX document listing Bibliography in AMS Style (bib.tex) \documentclass{report} \begin{document} \bibliographystyle{amsplain} \bibliography{mybib} \nocite{*} \end{document} To include only cited articles we remove the \nocite{*} command

\documentclass{report} \begin{document} We want to get the documents \cite{RSI} and \cite{Kuo} for our collection \bibliographystyle{amsplain} \bibliography{mybib}

\end{document} Comments in LaTeX

% Ignores the rest of the line

To protect special characters such as (%, & , $ etc.) – Use the \ character • e.g. My\_Cat.raw

• To typeset a section as typed \begin{verbatim} \end{verbatim} Example Document From IEEE

Suppose you want to write a paper for IEEE journals

•Download LaTeX template from IEEE website http://www.ieee.org/web/publications/aut hors/transjnl/index.html

•Open example LaTeX file (bare_jrnl.tex) and modify it

•No need to worry about things like margin, font, …

bare_jrnl.tex Final Words:

• You have already taken your first step by attending this session. • Enjoy writing with LaTeX • Spread the joy of using LaTeX. • You will spend about an hour learning LaTeX. – Think of this as an investment for not wasting hours with Word later on for formatting in your career.

• Any problem feel free to ask me or drop a mail at [email protected] References

• http://www.miktex.org/ • http://www.toolscenter.org/ • http://www.ocf.berkeley.edu/~jjlin/latex/ • http://en.wikibooks.org/wiki/LaTeX • http://web.ift.uib.no/Fysisk/Teori/KURS/WRK/Te X/symALL.html

58