chapter 12

LATEX-DOCUMENT GENERATION TOOL

Success of a research deeply resides in the manner in which it is presented. The way in which it is presented is as important as content in getting your message to the audience. The paper or report that we publish needs to be in a very tidy and orderly manner and should also have a consistent format. The format inconsistency or lag in text orientation will make the reader unenthusiastic. In this chapter, we discuss about a tool, LaTeX, which helps in creating a well-formed and structured document.

LaTeX is a typesetting tool, producing professionally typeset pages or in short it is a document preparation system for producing professional looking documents. It was designed by Donald Knuth in the year 1978. LaTeX was originally written by Leslie Lamport in 1980. LaTeX is particularly suited to produce long, structured documents with equations and symbols.

12.1 DOCUMENT GENERATION TOOLS

There are various other document generation tools such as Microsoft word, EMC2 expression, Adobe InDesign and so on of which word remains the basic document generation tool that is being widely used. To replace such a widely accepted tool, LaTeX should have some upper hand over it.

Table 12.1 clearly shows the upper hand of LaTeX over Microsoft word. In LaTeX, we just code our document and compile it like any of our programming language and finally run it to generate our document as output. Figure 12.1 shows a complexity effort graph between Word and LaTeX.

 

Table 12.1 Comparisons between LaTeX and Word

img
img

Fig. 12.1 Complexity comparison graph

A LaTeX document is a plain text file with a .tex file extension. It can be typed in a simple text editor such as LaTeX editor or tex maker or tex works. When the document is finished typing, we compile it and convert it into another format. Several different output formats are available, but the mostly used output format is Portable Document Format (PDF). It is then printed and transferred between computers.

12.2 GETTING STARTED

We have already mentioned that LaTeX is available for free. So let us begin from, how to get a LaTeX editor and platform. The basic element to begin our document generation is to have a base element or a base platform. The commonly used platform is MikTex. This can be obtained for free from the weblink, http://www.miktex.org/. After installing the platform, we need to have an editor, one of the commonly used editor is texnic center, which is available for free in the weblink, http://www.teXnicCenter.org/. After installing texnic center and MikTex, you are ready to generate a document. In an advanced perspective, you can also have a postscript convertor and a previewer for advanced viewing of the output. Figure 12.2 shows the basic installation steps for the LaTeX.

img

Fig. 12.2 LaTeX installation steps

A texnic center editor will have the following layout (Fig. 12.3). It basically has four parts: a Menu ribbon, Navigator, Editor and a Log section. The menu ribbon has the options to open a new file, search for some text, options to insert mathematical equations. It also has the options to compile and run the document. The second part is the navigator. It shows where the particular file is stored. It also shows history of the recently opened documents, the places where images are stored, etc. The editor is the space where we do all typing. It can also be called the document coding area. All texts, images, tables, etc. are coded in this area. We also have a log section that shows all sorts of warning and errors while we compile. It displays results with line number and will suggest why the particular error has occurred. We can relate this to the way in which the errors are displayed while you compile a java or c++ source code.

img

Fig. 12.3 Texnic center editor

12.3 HOW LATEX WORKS

After making the required coding, you need to save the document. The extension of the file will be .tex. This specifies the LaTeX source file. For creating a bibliography, we have the .bib file. Also we can include various class files, which have the extension .cls. Other types of files will be created automatically when the file is compiled and run. Figure 12.4 shows the entire mechanism of texing.

img

Fig. 12.4 Texing mechanism

The traditional way is to run the LaTeX program, which creates a DVI (Device Independent) file. This file is in binary format and not viewed directly. Then run a previewing program for viewing on screen and/or the dvips program to create a PostScript file for viewing or for printing via GS View. Alternatively, you can run the relatively recent pdf LaTeX program to create a PDF file for viewing or printing. Figure 12.5 shows the different ways in which output is generated in LaTeX.

img

Fig. 12.5 Output generation

12.4 DOCUMENT CREATION

Document creation starts with the documentclass command. The general format of documentclass is given as follows:

documentclass[options]{class}

The text in the curly brackets specifies the document class. Document class can be either an article which is suitable for shorter documents such as journal articles and short reports, or a report for longer documents with chapters, conference proceedings and slides. We can also have a document class book, while preparing a textbook. The text in the square brackets specifies options such as font size, font name, paper size and so on. Figure 12.6 shows the fragments of basic document in LaTeX. A sample document class declaration is shown as follows.

documentclass[a4paper, 12pt]{article}

This says that, we are going to create an article in an a4 size paper with text font as 12 points. If we want to mention any font to be used in particular, we can provide that too in the square brackets. So to conclude we can say that, documentclass command appears at the start of every LaTeX document depending on what type of document that we are going to generate.

Entire text of our document lies between egin{document} and end{document} commands. Anything typed before egin{document} is known as the preamble and will affect the whole document. So, documentclass[]{} is the preamble. Anything typed after end{document} is ignored.

Consider the following code:

documentclass[a4paper,14pt]{report}

egin{document}

This is the first line

end{document}

This will generate a report in A4 paper with font size of 14 with the text “This is the first line.”

img

Fig. 12.6 Writing a document in LaTeX

12.4.1 Page Setup, Page Numbering and Headings

LaTeX automatically sets reasonable values for the page dimensions, orientation, etc. However, in some cases customization may be required. There are two ways to do this: the easy way, using several packages which do all the work for you, and the hard way, which involves doing all the work yourself. The easy way involves using certain packages to do the heavy lifting. For example, to set the margins using the geometry package, use

usepackage[margin = 2.5cm]{geometry}

The default paper setting of LaTeX is shown in Fig. 12.7.

img

Fig. 12.7 Default paper setting of LaTeX

We can also set the values manually, but it is a hard task. We may need to set topmargin, bottom margin, paragraph skip, etc. It can be done like the following:

setlength{ opmargin}{0in}

setlength{headheight}{0in}

setlength{headsep}{0in}

setlength{ extheight}{7.7in}

setlength{ extwidth}{6.5in}

setlength{oddsidemargin}{0in}

setlength{evensidemargin}{0in}

setlength{parindent}{0.25in}

setlength{parskip}{0.25in}

The command pagestyle controls page numbering and headings. It should always go between the documentclass{article} and the egin{document} commands. It can take the following forms:

  1. pagestyle{plain} is the default, which puts the page number at the centre of the bottom of the page and provides no headings.
  2. pagestyle{empty} provides neither page numbers nor headings.
  3. pagestyle{headings} will provide page numbers and headings from any section’s that you are using.
  4. pagestyle{myheadings} will provide page numbers and custom headings.

These commands can also be applied to a single page using hispagestyle instead of pagestyle.

12.4.2 Creating a Title Page

The title, author and date of your document are information that various LaTeX commands can make use of, if you provide it. It is a good habit to get into to provide this information in the preamble of your document. The commands are as follows:

  1. verb# itle{yourtitlehere}#
  2. verb#author{yournamehere}#
  3. verb#date{currentdate}#

To create the title, place a maketitle command immediately after the egin{document} command.

12.4.3 Sections

LaTeX is a language for creating structured documents. One of the most important ways of creating structure in a document is to split it into logical sections. If your document deals with more than one concept or theme, then each concept should go into its own section. There are two related commands for creating sections: section{sectiontitle} and section*{sectiontitle}. The first one numbers the sections, while the starred form does not. Both create separate sections with titles in a larger font size. Its general format is as follows:

section{In This First Section}

This is the first section.

subsection{We Have This First Subsection}

This is the first subsection.

subsubsection{And This Subsubsection}

A subsubsection.

Example:

section{The Main section}

this is the main section of this chapter

subsection{Subsection}

the first subsection begins here

subsubsection{Subsubsection}

this is a section linked to the subsection

Coding similar to this will produce an output as in Fig. 12.8.

img

Fig. 12.8 Section output

To create a new paragraph, we can use the keyword par {text}.

12.4.4 Font Size and Formatting

There are LaTeX commands for a variety of font effects:

extit{words in italics} – words in italics

extsl{words slanted} – words slanted

extsc{words in smallcaps} – words in smallcaps

extbf{words in bold} – words in bold

exttt{words in teletype} – words in teletype

extsf{sans serif words} – sans serif words

extrm{roman words} – roman words

underline{underlined words} – underlined words

Different font size can be represented as shown in Fig. 12.9.

img

Fig. 12.9 Font size

We have the flushrigh and flushleft commands to align the text to right and left. It can be used as follows.

egin{flushleft}

textbf{Left allignment}

end{flushleft}

egin{flushright}

extbf{Right alignment}

end{flushright}

In between our text, there will be situations to give quotes. We can give the quotes using the keyword,

egin{quotation}

Text here

end{quotation}

An example of quotation may look like the following:

egin{quotation}

extit{A central task of developmental biology is to discover}

end{quotation}

The corresponding output is shown in Fig. 12.10.

img

Fig. 12.10 Quotation output

12.4.5 List – Enumerate

LaTeX distinguishes between three different enumeration/itemization environments. Each of them provide four levels, which means you can have nested lists of up to four levels. We use the following command for enumeration.

egin{enumerate}

item This is the first item

end{enumerate}

The enumerate-environment is used to create numbered lists. If you like to change the appearance of the enumerator, the simplest way to change is to use the enumerate-package, giving you the possibility to optionally choose an enumerator.

usepackage{enumerate}

egin{enumerate}[I]

item First line

end{enumerate}

This provides the Roman numbering scheme, I, II, III, ….

egin{enumerate}[(a)]

item First line

end{enumerate}

This provides the alphabetic numbering a, b, c, ….

An example of enumerate is shown below:

egin {enumerate}

itemIdentification of pre-miRNAs from a human genome

itemIdentification of mature microRNAs from pre-miRNAs

itemIdentification microRNA targets from a miRNA:mRNA pair.

end {enumerate}

This generates the output as shown in Fig. 12.11.

img

Fig. 12.11 Output

12.4.6 List Itemize

egin{itemize}

item

end{itemize}

Itemization is probably the mostly used list in LaTeX. It also provides four levels. The bullets can be changed for each level. It is same as the way we explained for enumeration.

An example of combining both enumeration and itemize is given below.

egin{itemize}

item First level, itemize, first item

egin{itemize}

item Second level, itemize, first item

item Second level, itemize, second item

egin{enumerate}

item Third level, enumerate, first item

item Third level, enumerate, second item

end{enumerate}

end{itemize}

item First level, itemize, second item

end{itemize}

This generates the output as shown in Fig. 12.12.

img

Fig. 12.12 Output

12.4.7 Comments

Comments are created using %. When LaTeX encounters a % character while processing a .tex file, it ignores the rest of the line. This can be used to write notes in the input file, which will not show up in the printed version.

The following code:

It is a truth universally acknowledged % Note comic irony in the very first sentence, that a single man in possession of a good fortune, must be in want of a wife.

Produces:

It is a truth universally acknowledged, that a single man in possession of a good fortune, must be in want of a wife

Multiple consecutive spaces in LaTeX are treated as a single space. Several empty lines are treated as one empty line. The main function of an empty line in LaTeX is to start a new paragraph. In general, LaTeX ignores blank lines and other empty space in the .tex file. Two backslashes (\) can be used to start a new line. We can use the command ewpage to print the text in a fresh page. Also linebreak is a command used to break printing in the current line.

12.4.8 Special Characters

The following symbols are reserved characters, which have a special meaning in LaTeX:

$ % ^ & _ { } ~

All of these apart from the backslash can be inserted as characters in your document by adding a prefix backslash:

$ \% ^{} & \_ { } ~{}

Note that you need to type a pair of curly brackets {} after the hat ^ and tilde ~, otherwise these will appear as accents over the following character.

For example, “^ e” produces “e

The above code will produce:

$ % ^ & _ { } ~

The backslash character cannot be entered by adding a prefix backslash, \, as this is used for line breaking. We can use the extbackslash command instead.

12.5 TABLES

The tabular command is used to typeset tables. By default, LaTeX tables are drawn without horizontal and vertical lines | you need to specify if you want lines drawn. LaTeX determines the width of the columns automatically.

The below code starts a table

egin{tabular}{…},

where the dots between the curly brackets are replaced by code defining the columns:

  • l for a column of left-aligned text (letter el, not number one).
  • r for a column of right-aligned text.
  • c for a column of centre-aligned text.
  • | for a vertical line.

For example, lll (i.e., left left left) will produce 3 columns of left-aligned text with no vertical lines, while –l–l–r– (i.e., |left|left|right|) will produce 3 columns where the first 2 are left-aligned, the third is right-aligned, and there are vertical lines around each column. The table data follows the egin command. & is placed between columns and \ is placed at the end of a row (to start a new one). We use hline to insert a horizontal line and cline{1-2} to insert a partial horizontal line between column 1 and column 2. The command end{tabular} finishes the table.

Example code,

egin{tabular}{|r|c|l|}

hline

Right & Center & Left\

hline

alpha&beta&gamma\

delta&epsilon&zeta\

eta&theta&iota\

hline

end{tabular}

This generates the output as shown in Fig. 12.13.

img

Fig. 12.13 Table output

Examples of various tabular codes and its resulting outputs:

egin{tabular}{|l|l|}

Apples & Green \

Strawberries & Red \

Oranges & Orange \

end{tabular}

This generates the output as shown in Fig. 12.14.

img

Fig. 12.14 Table output

egin{tabular}{rc}

Apples & Green \

hline

Strawberries & Red \

cline{1-1}

Oranges & Orange \

end{tabular}

This generates the output as shown in Fig. 12.15.

img

Fig. 12.15 Table output

egin{tabular}{|r|l|}

hline

8 & here’s \

cline{2-2}

86 & stuff \

hline hline

2008 & now \

hline

end{tabular}

This generates the output similar to Fig. 12.16.

img

Fig. 12.16 Output

12.6 FIGURES

LaTeX also allows embedding of images to the text. To insert an image, we require the graphicx package. Images should be PDF, PNG, JPEG or GIF files. The following code will insert an image called myimage:

egin{figure}

centering

includegraphics[width = 1 extwidth]{myimage}

caption{Here is my image}

label{image-myimage}

end{figure}

The caption and labelling are same for tables too. centering centres the image on the page, if not used images are left-aligned by default. It is a good idea to use this as the figure captions are centred. Includegraphics… is the command that actually puts the image in your document. The image file should be saved in the same folder as the .tex file. [width = 1 extwidth] is an optional command that specifies the width of the picture – in this case, the same width as the text. The width could also be given in centimetres (cm). You could also use [scale = 0.5] which scales the image by the desired factor – in this case reducing by half. You can also specify the scale with respect to the width of a line in the local environment(linewidth), the width of the text on a page ( extwidth) or the height of the text on a page ( extheight) using the following codes.

includegraphics[width = linewidth]{ myimage }

includegraphics[width = extwidth]{ myimage }

includegraphics[height = extheight]{ myimage }

To rotate the image, we can use the keyword angle and can specify the angle to which it needs to be rotated.

includegraphics[scale = 0.5, angle = 180]{myimage}

To crop the image, we have the keyword trim. Its option parameter is in the order: left, bottom, right and top. The sample code will look like,

includegraphics[trim = 10mm 80mm 20mm 5mm, width = 3cm]{myimage}

It is also possible to have LaTeX create a border around your image by using fbox. fbox can be used in similar way to have border around text also.

setlengthfboxsep{0pt}

setlengthfboxrule{0.5pt}

fbox{includegraphics{myimage}}

For both figure and table, we can have some auxiliary options. The details of the option are given in Table 12.2.

 

Table 12.2 Options used in figures and tables

img

This is how the options are used,

egin{table}[ht] %table is placed on top of the current page

caption{Nonlinear model results} % title of Table

centering % used for centreing table

egin{tabular}{c c c c} %{ centred columns 4) columns)

hlinehline %inserts double horizontal lines

Case & Method#1 & Method#2 & Method#3 \ [0.5ex] % inserts table

%heading

hline % inserts single horizontal line

1 & 50 & 837 & 970 \ % inserting body of the table

2 & 47 & 877 & 230 \

3 & 31 & 25 & 415 \

4 & 35 & 144 & 2356 \

5 & 45 & 300 & 556 \ [1ex] % [1ex] adds vertical space

hline %inserts single line

end{tabular}

label{table:nonlin} % is used to refer this table in the text

end{table}

The corresponding output produced is shown in Fig. 12.17.

img

Fig. 12.17 Table output

While creating a report, we need to have an index of tables and figures. In normal word processing software, this content generation is a tedious task. But LaTeX does all in a fly with a single command listoffigures and listoftables. This command automatically builds the index page of tables and figures. To generate the entire contents, we have a similar command called ableofcontents.

12.7 MATH MODE

The LaTeX editor has a lot of inbuilt mathematics functions. The basic layout of the math’s environment is shown in Fig. 12.18.

img

Fig. 12.18 Mathematics environment in LaTeX editor

One of the main reasons for writing documents in LaTeX is, it is really good at typesetting equations. Equations are written in “math mode”. You can enter math mode with an opening and closing dollar sign $. This can be used to write mathematical symbols within a sentence, for example, typing $1 + 2 = 3$ produces 1 + 2 = 3.

If you want a displayed equation on its own line use then $$…$$. For example, $$1+2 = 3$$ produces 1 + 2 = 3.

For a numbered displayed equation, use egin{equation}…end{equation}.

For example,

egin{equation}1+2 = 3end{equation}

produces:

img

Although some basic mathematical symbols (+ – = /( )) can be accessed directly from the keyboard, most of them must be inserted using a command.

Powers are inserted using the hat ^ symbol. For example, $n^2$ produces n2.

Indices are inserted using an underscore _. For example, $2_a$ produces 2a. If the power or index includes more than one character, group them using curly brackets {…}, e.g., $b_{a-2}$ produces ba–2.

Fractions are inserted using frac{numerator}{denominator}.

$$frac{a}{3}$$

produces:

img

We can also produce nested fractions like,

$$frac{y}{frac{3}{x}+b}$$

produces the output as,

img

Square root symbols are inserted using sqrt{…} where … is replaced by the square root content.

%$$sqrt{y^2}$$

produces:

img

The command sum inserts a sum symbol; int inserts an integral. For both functions, the upper limit is specified by a hat ^ and the lower by an underscore _.

$$sum_{x = 1}^5 y$$

produces:

img

$$int_a^b f(x)$$

produces:

img

Greek letters can be typed in math mode using the name of the letter preceded by a backslash.

For example,

$alpha$ = α $eta$ = β

Some examples of mathematical mode are shown in Figs. 12.19 and 12.20.

img

Fig. 12.19 Maths mode 1

img

Fig. 12.20 Maths mode 2

If you want to have a series of equations or inequalities aligned together, you can surround the equations by egin{eqnarray*} and end{eqnarray*}

egin{eqnarray*}

1+2+ldots+n & = & frac{1}{2}((1+2+ldots+n)+(n+ldots+2+1))\

& = & frac{1}{2}underbrace{(n+1)+(n+1)+ldots+(n+1)}_{mbox{$n$ copies}}\

& = & frac{n(n+1)}{2}\

end{eqnarray*}

Produces similarly (Fig. 12.21),

img

Fig. 12.21 Output

[f(x) = left{egin{array}{rll}

-1 & mbox{if} & x < 0; \

0 & mbox{if} & x = 0; \

1 & mbox{if} & x > 0; \

end{array} ight.

]

Produces (Fig. 12.22)

img

Fig. 12.22 Output

The continuation dots … are known as an ellipsis. They occur frequently enough in mathematics for LaTeX to have four commands to typeset them with the right spacing. They are as follows.

  • dots for 3 continuous dots.
  • cdots for centre height dots.
  • ddots for diagonal dots, which occur in matrices.
  • ldots for lower height dots.
  • vdots for vertical dots.

We have provided almost all special characters used and Greek letters used in LaTeX at the end of this chapter.

12.8 ALGORITHM MODE

Algorithm mode is also very important and is a major concern for computer science students. In many research papers and technical reports, you may have to include algorithms. Now let us see how the algorithm environment works. To have the algorithm environment, we should include the following packages:

usepackage{algorithm}

usepackage {algorithmic}

The algorithms like all other constructs start with a egin and ends with a end. Consider the following set of code:

egin{algorithm}

caption{Calculate $y = x^n$}

label{alg1}

egin{algorithmic}

REQUIRE $n geq 0 vee x eq 0$

ENSURE $y = x^n$

STATE $y Leftarrow 1$

IF{$n < 0$}

STATE $X Leftarrow 1 / x$

STATE $N Leftarrow -n$

ELSE

STATE $X Leftarrow x$

STATE $N Leftarrow n$

ENDIF

WHILE{$N eq 0$}

IF{$N$ is even}

STATE $X Leftarrow X imes X$

STATE $N Leftarrow N / 2$

ELSE[$N$ is odd]

STATE $y Leftarrow y imes X$

STATE $N Leftarrow N - 1$

ENDIF

ENDWHILEend{algorithmic}

end{algorithm}

This will produce the output as shown in Fig. 12.23.

img

Fig. 12.23 Algorithm output 1

Similarly for the students interested in inserting procedures in the text, we can work in the similar manner. An example of a slowsort procedure is mentioned below.

usepackage{algorithmic}

{f procedure} $SlowSort(A,i,j)$

egin{algorithmic}[1]

IF{$igeq j$}

STATE Return

ENDIF

STATE $mgets lfloor (i+j)/2 floor$

STATE $SlowSort(A,i,m)$

STATE $SlowSort(A,m+1,j)$

IF{$A[m]>A[j]$}

STATE exchange $A[j],A[m]$

ENDIF

STATE $SlowSort(A,i,j-1)$

end{algorithmic}

This generates the output as shown in Fig. 12.24.

img

Fig. 12.24 Algorithm output 2

12.9 BIBLIOGRAPHIC REFERENCES

The easiest way to cite references in your document is with the author’s name and year of publication in parenthesis (Lamport, 1994). This is actually the preferred method in many technical publications. You can make a numbered list of references with the enumerate commands. If you choose this method, you should use the Harvard system for formatting your list of references:

  1. Last1, First1 Middle1, and First2 Middle2 Last2 (year). Book Title. ed. Publisher, City.
  2. Last1, First1 Middle1, and First2 Middle2 Last2 (year). Article Title. Journal Name, vol. X, no. Y, pagepage.

It is convenient to put all your references together in a separate file. Here eight references are placed in the file called tref.tex. The bibliography file begins with the line:

egin{thebibliography}{77}

where the 77 has the same width as the longest number of your reference. Each item in the bibliography begins with a ibitem{ label }where the label is used to cite to the reference in your text. The text following the ibitem line is the text of your reference. A suggested reference style is shown in this section. The line: end{thebibliography} ends the bibliography. To actually include the references in your document, put the command: input{tref} where you want your references to appear (usually at the end of the report). References are automatically numbered.

We can also create a separate bibliography using a BibTeX file to store all our references. It is actually more easy when compared to the manual bibliography creation (Fig. 12.25).

img

Fig. 12.25 BibTeX file inclusion

12.9.1 BibTeX File

BibTeX file contains all the references you want to cite in your document. It has the file extension .bib. It should be given the same name as and kept in the same folder as yours .tex file. The .bib file is plain text – it can be edited using Notepad or your LaTeX editor (e.g., Texworks, Texmaker, Texnic center). You should enter each of your references in the BibTeX file in the following format:

@article{

AISSCE,

Author = {Vinodchandra, S. S. and Anand, H. S.},

Title = {Vertical and Horizontal Rule Mining Algorithm},

Journal = {Elsevier Book Series},

Volume = {1},

Pages = {123-128},

Year = {2014} }

The reference type declaration is followed by a curly bracket, then the citation key. Each reference’s citation key must be unique. Each reference starts with the reference type (@). Likewise we can add any number of references. Then we can add the below two lines of code to the place where we want our bibliography to appear.

ibliographystyle{plain}

ibliography{Doc1}

where Doc1 is the name of the bib file that we created.

Type cite{citationkey} at the place where you want to cite your reference in your .tex document. If you do not want an in-text citation, but still want the reference to appear in the bibliography, use ocite{citationkey}. To include a page number in your in-text citation, put it in square brackets before the citation key: cite[p. 215]{citationkey}. To cite multiple references, include all the citation keys within the curly brackets separated by commas: cite{citation01, citation02, citation03}. In our example, the citation key is AISSCE.

In the above example, we have used the code ibliographystyle{plain}. This plain is the style in which numeric in text citation comes. We have many other styles also.

  • Plain:

    The citation is a number in square brackets (e.g., [1]). The bibliography is ordered alphabetically by first author surname. All of the authors’ names are written in full.

  • Abbrv:

    The same as plain except the authors’ first names are abbreviated to an initial.

  • Unsrt:

    The same as plain except the references in the bibliography appear in the order that the citations appear in the document.

  • Alpha:

    The same as plain except the citation is an alphanumeric abbreviation based on the author(s) surname(s) and year of publication, surrounded by square brackets (e.g., [chandra14]).

If you still want to use a different style like the one provided by the journal, you are submitting an article to, then you should save the style file (.bst file) in the same folder as yours .tex and .bib files. Include the name of the .bst file in the ibliographystyle{…} command.

12.10 PREPARATION OF PRESENTATION

LaTeX is not just used for making reports and articles. It can be used for creating slides for presentation. We have a documentclass by name slides. Using this we can create a presentation. The usage of the particular documentclass is as shown below.

documentclass{slides}

Each slide starts with a egin{slide} and ends with end{slide}. Anything written in between comes as first slide. To have the next slide again start with egin{slide}… end{slide}. All these keywords will be declared inside the egin{document} and end{document}.

Beamer is another LaTeX document class for creating slides for presentations. It supports both pdfLaTeX and LaTeX + dvips. The name is taken from the German word Beamer, a pseudo-anglicism for video projector. Source code for beamer presentations, is the same as of LaTeX files. We can have various types of templates which are inbuild in beamer. It also serves the same purpose as that of the document class slides.

For various purposes, there are various templates available. For example, if you are planning for a very formal presentation, one of the beamer templates called Amsterdam is available. These template themes can be readily downloaded from the internet. A wide variety of themes, both formal and casual themes are available, which make beamer a better choice for people to prepare slides.

A sample code,

egin{document}

egin{slide}

egin{center}

{ Large Title of Presentation }\

Name of Presenter\

Affiliation\

Date\

end{center}

egin{center}

Outline of presentation

end{center}

egin{center}

1. Section One \

2. Section Two\

3. Section Three\

end{center}

end{slide}

end{document}

This will produce an output as shown in Fig. 12.26.

img

Fig. 12.26 Slides in LaTeX

12.11 TEMPLATES

We can either start a document creation from scratch or from an already specified template. In LaTeX, we have already mentioned that there are various document classes like article, report, book, etc. Every class will have a completely different page setup and layout. Even you can have templates specific for bibliographic creation. In some cases, templates offer numbering of items, in others it offers the alphabetic arrangement and in some case it provides the list without any numbering but with a very legal formatting.

Here we can describe in detail the various document class templates used during the preparation of documents.

12.11.1 Articles

An article is a piece of writing designed to clearly and concisely convey information to a reader. Articles are generally non-fiction and are used to propagate information such as news and scientific research. The layout of articles is generally multi-column to maximize the information per page and make text easier to read.

The articles templates will be normally provided by the particular publisher of the article. If you intend to publish an article in a journal with high impact factor, you need to check out for the latest available LaTeX template for the same and start working accordingly. Templates change from journals to journals. Almost all the journals provide you with a sample .cls file, using that you can create a .tex file corresponding to it. This .tex file will be in accordance with the template specified by the journal.

A sample article is shown here.

img

12.11.2 Thesis and Conference Proceedings

One of the major documents which need prime importance for formatting is nothing but a thesis. We need to set our text height, width, page margins, etc. We make use of the document class report for both thesis and conference proceedings. For fixing the width and height, we need to include a special package called, set space. For including figures, we use the package “graphicx”.

The preamble for a thesis or conference proceeding will be similar to this:

documentclass[a4paper,12pt]{report}

usepackage{cite}

usepackage{graphicx}

usepackage{subfigure}

usepackage{float}

usepackage{setspace}

setlength{ extheight}{8.5in}

setlength{ extwidth}{5.5in}

addtolength{ opmargin}{-1cm}

For the thesis, we need to have a title page, which mentions about the author, his affiliation, etc. To make that we have the keywords egin{titlepage} … end{titlepage}. We provide all credentials between this code section, and gives the command maketitle to generate the title page.

egin{titlepage}

egin{document}

title{Your title of the Project}

author{Name of Author}

maketitle

end{titlepage}

Abstract of the study is also very important; we know that abstract stands alone in a page with special formatting. In LaTeX, we have the keyword abstract to have an easy formatting of the same. The section in a thesis will be as follows:

egin{abstract}

This section provides the breif study of the work done.

This is the abstract.

end{abstract}

12.11.3 Books

A book is a long document used for many purposes, such as for novels, non-fiction works or textbooks. This variety of applications makes books one of the most complicated document types to write and typeset. Books need to include the capability for including all document constituents and often contain many cross-references.

In such a situation other document creation tools finds difficult to have a easy formatting method. On the other hand, LaTeX is the premiere tool for simplifying the inherent complexity of a book to allow the author to focus on writing rather than formatting.

documentclass[12pt,oneside]{book}

{

usepackage[width = 4.375in, height = 7.0in, top = 1.0in, = {5.5in, 8.5in}]

usepackage[pdftex]{graphicx}

usepackage{amsmath}

usepackage{amssymb}

}

egin{document}

chapter*{Huge center Name of Book }

section*{huge center Author 1}

ewpage

subsection*{center ormalsize Copyright copyright 2014 by Authors}

subsection*{center ormalsize All rights reserved.}

subsection*{center ormalsize ISBN dots}

subsection*{center ormalsize dots Publications}

chapter*{center ormalsize To my Parents}

ableofcontents

chapter{Introduction}

In mathematical logic, predicate logic is the generic term for symbolic formal systems like first-order logic, second-order logic, many-sorted, or infinitary logic. This formal system is distinguished from other systems that its formulae contain variables which can be quantified. Two common are the existential and universal quantifiers. The variables could be elements in the universe under discussion, or perhaps or functions over that universe.

chapter{First Order Logic}

First-order logic is a formal system used in mathematics, philosophy, and computer science. It is also known as first-order predicate calculus, lower predicate calculus, quantification theory, and predicate logic.

Figure ef{15} forms the basis of the entire

egin{figure}[ht]

centering

includegraphics[width

= 0.4 extwidth,natwidth = 0.1,natheight = 0.1]{15.jpg}\

caption{Slides in LaTeX}

label{15}

end{figure}

chapter{Second Order Logic}

In logic and mathematics second-order logic is an extension of first-order which itself is an extension of propositional logic. Second-order logic is in turn extended by higher-order logic and type theory.

Sample Table is shown below.

egin{tabular}{|r|l|}

hline

7C0 & hexadecimal \

3700 & octal \ cline{2-2}

11111000000 & binary \

hline hline

1984 & decimal \

hline

end{tabular}

egin{thebibliography}{99}

ibitem{maths_books}

Books of Mathematics (Author Name): \

http://shop.mathsbooks.org/

ibitem{logicbooks}

Author names., emph{Book Title}, Name of Publications (Year) \

ISBN: Number

end{thebibliography}

end{document}

This sample code generates the book pages as follows:

img

img
12.12 NUTS AND BOLTS

To end with, let us look some auxiliary options available in LaTeX, one of which is the footnote. It facilities to typeset inserted text. Footnotes are generated with the command footnote{footnote text} which comes immediately after the word requiring an explanation in a footnote. The text of the footnote appears as a footnote in a smaller typeface at the bottom of the page. A sample footnote code will look like below.

egin{minipage}{.5linewidth}

enewcommand{ hefootnote}{ hempfootnote}

egin{tabular}{ll}

multicolumn{2}{c}{fseries PostScript type 1 fonts} \

Courierfootnote{Donated by IBM.} & cour,courb,courbi,couri \

Charterfootnote{Donated by Bitstream.} & bchb,bchbi,bchr,bchri\

Nimbusfootnote{Donated by URW GmbH.} & unmr, unmrs \

URW Antiquafootnotemark[value{mpfootnote}] & uaqrrc\

URW Groteskfootnotemark[value{mpfootnote}] & ugqp\

Utopiafootnote{Donated by Adobe.} & putb, putbi, putr, putri

end{tabular}

end{minipage}

This generates the output as shown in Fig. 12.27.

img

Fig. 12.27 Output footnote

In the same way, we can add text on the margins and it is termed as marginal notes. The way in which it is used is similar to that of footnotes. The marginpar command generates the marginal note.

Another text appending method is endnotes; they appear at the end of each chapter or at the end of the document. Endnotes are not supported in standard LaTeX, but by using the package endnotes we can adhere endnotes in a way similar to footnotes. The command used is,

enewcommand{footnote}{endnote}

EXERCISES
  1. What is TeX?
  2. What is “writing in TeX”?
  3. How should I pronounce “TeX”?
  4. What is Metafont?
  5. What is MetaPost?
  6. Things with “TeX” in the name
  7. What is CTAN? Discuss the (CTAN) catalogue.
  8. How can I be sure it is really TeX?
  9. What is e-TeX?
  10. What is PDFTeX?
  11. What is LaTeX? What is LaTeX2e?
  12. How should I pronounce “LaTeX(2e)”?
  13. Should I use Plain TeX or LaTeX?
  14. How does LaTeX relate to Plain TeX?
  15. What is ConTeXt?
  16. What are the AMS packages (AMSTeX, etc.)?
  17. What is Eplain?
  18. What is Texinfo?
  19. If TeX is so good, how come it is free?
  20. What is the future of TeX?
  21. How will you read a (La)TeX file ?
  22. Why is TeX not a WYSIWYG system?
  23. What is a DVI?
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.214.155