6/01/2015

How to write Thesis using LaTeX


What is LaTeX

LaTeX is a document preparation system for high-quality typesetting. It is most often used for medium-to-large technical or scientific documents but it can be used for almost any form of publishing.

LaTeX is not a word processor! Instead, LaTeX encourages authors not to worry too much about the appearance of their documents but to concentrate on getting the right content.

LaTeX Features

  1. Typesetting journal articles, technical reports, books, and slide presentations.
  2. Control over large documents containing sectioning, cross-references, tables and figures.
  3. Typesetting of complex mathematical formulas.
  4. Advanced typesetting of mathematics with AMS-LaTeX.
  5. Automatic generation of bibliographies and indexes.
  6. Multi-lingual typesetting.
  7. Inclusion of artwork, and process or spot colour.
  8. Using PostScript or Metafont fonts.

How to Download and Install LaTeX

There are different LaTeX distribution available on internet, different means what and how many LaTeX packages they have included in that distribution,

For example, Either you can Download Full LaTeX distribution (7-zip compressed, self-extracting executable, ~2GB) Or you can download just what you need, that's where MikTeX comes. (~163MB)

Software that will help you to work with LaTeX

What is Thesis?


A thesis statement declares what you believe and what you intend to prove.

A good tentative thesis will help you focus your search for information. But don't rush! You must do a lot of background reading before you know enough about a subject to identify key or essential questions. You may not know how you stand on an issue until you have examined the evidence. You will likely begin your research with a working, preliminary or tentative thesis which you will continue to refine until you are certain of where the evidence leads.

What makes a Good Thesis?

  1. It should be contestable, proposing an arguable point with which people could reasonably disagree.
  2. It tackles a subject that could be adequately covered in the format of the project assigned.
  3. It is specific and focused.
  4. It clearly asserts your own conclusion based on evidence. It is perfectly okay to change your thesis!
  5. It provides the reader with a map to guide him/her through your work.
  6. It anticipates and refutes the counter-arguments
  7. It avoids vague language (like "it seems").
  8. It avoids the first person. ("I believe," "In my opinion")
  9. It should pass the So what? or Who cares? test.

Reference1

General Document Structure for Thesis

/- Thesis Title Page
/- Declaration of Authorship
/- Favorite quote
/- Abstract
/- Acknowledgements
/- Table of Contents
/ List of Figures
/- List of Tables
/- Abbreviations
/- Physical Constants
/- Symbols
/- Dedication page
/-
/ Chapter 1 (Introduction)
    /- Section 1
    /- Section 2
/ Chapter 2 (Literature Survery / Background Theory)
/ Chapter 3 (Experimenal Setup)
/ Chapter 4 (Experiment 1)
/ Chapter 5 (Experiment 2)
/ Chapter 6 (Result and Discussion)
/ Chapter 7 (Conclusion)
/-
/- Appendix A
/- Appendix B
/- Appendix C
/- 
//- Bibliography (For Book)
//- References (For Article)

Getting Started LaTeX


Document Class

\documentclass[english]{article}
\documentclass[oneside,english]{book}
\documentclass[english]{letter}
\documentclass[english]{report}
\documentclass[a4paper, 11pt, oneside]{Thesis}   %Custom user defined document class

Page Margins Style

  1. One Column Document (Default)

     \documentclass[english]{article}
    
  2. Two Column Document

     \documentclass[twocolumn,english]{article}
    
  3. One side (Default)

  4. Two Side (Mirror Margin)
     \documentclass[twoside,english]{article}
    
  5. Two Side + Two Column
     \documentclass[twoside,twocolumn,english]{article}
    

Table Of Contents

\tableofcontents{}
% This is How you can add any page to table-of-contents list.
\addtotoc{Abstract}  % Add the "Abstract" page entry to the Contents
\addtocontents{toc}{\vspace{2em}} % Add a gap in the Contents, for aesthetics

List of Tables

% This is How you can dynamically generate list of tables.
\listoftables

List of Figures

% This is How you can dynamically generate list of figures.
\listoffigures

List of Algorithms

\listof{algorithm}{List of Algorithms}

New Page

\clearpage  %Start a new page
\newpage{}

Header and Footer

  • Header (Left)

      \lhead{}  % Clears the left side page header.
      \lhead{\emph{Contents}}  % Set the left side page header to "Contents".
      \lhead{\pagename}        % Set the left side page header to "Current Chaper Name"
      \lhead[\rm\thepage]{\fancyplain{}{\sl{\rightmark}}}
    
  • Header (Right)

      \rhead{\thepage}  % Sets the right side header to show the page number
    
      \fancyhead{}  % Clears all page headers and footers
      \pagestyle{fancy}  % use the "fancy" page style to implement the FancyHdr headers
    

Input External File This Command is useful to split your BIG document into small parts and later join them all. So, This is going to help you to write your thesis, chapterwise, (example, chapter1.tex, chapter2.tex, ... )

\input{filename}  %without Extension *.tex

Page Number

  • For Initial front matter (Use Roman style)

      \frontmatter      % Begin Roman style (i, ii, iii, iv...) page numbering
    
  • For Document Environment (Use Numerical numbers)

      \mainmatter      % Begin normal, numeric (1,2,3...) page numbering
    

Font Settings

  • Font family
      % => Roman (Default)
      \textsf{TEXT_CONTENT_HERE}  % => Sans Serif  
      \texttt{TEXT_CONTENT_HERE}  % => TypeWriter
    
  • Font Size
      {\tiny{}Simple Demo World Simple Demo World Simple Demo World }{\tiny \par}    % => Tiny
      {\scriptsize{}Simple Demo World Simple Demo World Simple Demo}    % => Smallest
      {\footnotesize{}Simple Demo World Simple Demo World Simple Demo}    % => Smaller
      {\small{}Simple Demo World Simple Demo World Simple Demo}    % => Small
      % => Normal (default)
      {\large{}Simple Demo World Simple Demo World Simple Demo}    % => Large
      {\Large{}Simple Demo World Simple Demo World Simple Demo}    % => Larger
      {\LARGE{}Simple Demo World Simple Demo World Simple Demo}    % => Largest
      {\huge{}Simple Demo World Simple Demo World Simple Demo}    % => Huge
      {\Huge{}Simple Demo World Simple Demo World Simple Demo}    % => Huger
    
  • Font Color

      \textcolor{red}{TEXT_CONTENT_HERE}
    
  • Shape

      % Upright (Default)
      \textit{TEXT_CONTENT_HERE}  % => Italic  
      \textsl{TEXT_CONTENT_HERE}  % => Slanted  
      \textsc{TEXT_CONTENT_HERE}   %=> Small Caps
    
  • Others

      %=> Bold
      \textbf{TEXT_CONTENT_HERE}
      %=> Emphasize
      \PassOptionsToPackage{normalem}{ulem}
      \usepackage{ulem}
      \emph{Simple Demo World Simple Demo World Simple Demo} 
    
      %=> Underbar
      \uline{Simple Demo World Simple Demo World Simple Demo}
      %=> Double Underbar
      \uuline{Simple Demo World Simple Demo World Simple Demo}
      %=> Wavy Underbar
      \uwave{Simple Demo World Simple Demo World Simple Demo}
    
      %=> Strike Out
      \PassOptionsToPackage{normalem}{ulem}
      \usepackage{ulem}
      \sout{Simple Demo World Simple Demo World Simple Demo}
      %=> Noun
      \newcommand{\noun}[1]{\textsc{#1}}
      \noun{Simple Demo World Simple Demo World Simple Demo}
      %=> Url / Web Links
      \url{http://www.google.com}
    

Line Spacing

  • To set custom line spacing you have to import setspace ( \usepackage{setspace} ) LaTeX package.

      %=> Single (Default)
      %=> OneHalf
      \onehalfspacing
    
      %=> Double
      \doublespacing
    
      %=> Custom Line Spacing
      \setstretch{1.2}
      \setstretch{1.3}  % It is better to have smaller font and larger line spacing than the other way round
    

Sectioning Environment Commands

\part{}  or  \part*{}  %=> Part  
\chapter{}  or  \chapter*{}  %=> Chapter  
\section{}  or  \section*{}  %=> Section  
\subsection{}  or  \subsection*{}  %=> SubSection  
\subsubsection{}  or  \subsubsection*{}  %=> SubSubSection  
\paragraph{}  or  \paragraph*{}  %=> Paragraph  
\subparagraph{}  or  \subparagraph*{}  %=> SubParagraph

Labels

Labels for any section, subsection, figure, table, paragraph are very important, because labels are usually used to make cross-references inside document. There are some rules (standards) related to, How you should use labels inside LaTeX Document. labels can be used with \ref , \eqref , \pageref Commads.

  • Using label for Figure Float

      \begin{figure}
    
          \protect\caption{demo}\label{fig:demo}
      \end{figure}
    

ref

This \ref command is used when you want to refer to some setion/figure/table/float etc. For example, You might have read in books that,

"Please, refer to figure 4.5" But in LaTeX, this figure number is automatically generated by \label command.

Please, refer to figure \ref{fig:my_first_figure}

\ref{sec:second-section}  %=>  0.2

eqref

Same as \ref Command, but output will be enclosed inside parenthesis.

\eqref{sec:second-section}  %=>  (0.2)

pageref

Its output will be page number where you label is. \pageref{sec:second-section} => 3

Here 3 is page number at which this label is embedded with that section.

Citations

To use citation, First you have to define bibitem (within thebibliography Environment) or include external bibliography file.

  • Single Citation ( \cite{key} )

          \cite{AbuOmar2013}
    
  • Multiple Citation ( \cite{key1}\cite{key2} )

          \cite{A.L.Greer1994}\cite{A.Peker1993a}
    
  • Grouped Citation ( \cite{keylist} )

          \cite{A.Peker1993a,Agarwal2006,Al-Ghamdi2011,Al-Heniti2009}
    

FootNote

Footnotes are great way to add references and definitions for any terms, page by page.

For example,

This is Demo String\footnote{This is my first text in LaTeX.}

Float

  • Algorithm Float

      \begin{algorithm}
    
      \protect\caption{First Algorithm}
      \end{algorithm}
    
  • Figure Float

      \begin{figure}
    
      \protect\caption{First Figure}
      \end{figure}
    
  • Table Float

      \begin{table}
    
      \protect\caption{First Table}
      \end{table}
    
  • Wrap Figure Float

      \begin{wrapfigure}{o}{0.5\columnwidth}%
    
      \protect\caption{First wrap figure float}
      \end{wrapfigure}%
    
  • Wrap Table Float

      \begin{wraptable}{o}{0.5\columnwidth}%
    
          \protect\caption{}
      \end{wraptable}%
    

Float Placement cases

You can combine these options in any order, if float is not at right position.

For example,

Here if Possible + Ignore LaTeX rules => [!h]

  • Top of Page (t) (Default)
  • Bottom of Page (b)
  • Page of floats (p)
  • Here if Possible (h)
  • Here definitely (H)
  • Ignore LaTeX rules (!)
  1. Span Columns

     \begin{figure*}
    
         \protect\caption{dmeo World}
     \end{figure*}
    
  2. Rotate Sideways (for Float)

    FIG:float_rotate_sideways_view.png

    Note:- You need to import rotfloat LaTeX package.

     \begin{sidewaysfigure}
         \begin{centering}
             \includegraphics[width=3in]{img/2}
             \par\end{centering}
         \begin{centering}
             \includegraphics[width=3in]{img/3}
             \par\end{centering}
         \protect\caption{First Figure}
     \end{sidewaysfigure}
    
  3. Alignment

    Left => Right => Center => Justified

    1. Using Alignment Environment For Text / table / Image or Graphics (If table/Graphics is without table/figure float)

       \begin{flushright}
           this is very first and simple paragraph
           \par
       \end{flushright}
      
       \begin{center}
           this is very first and simple paragraph
           \par
       \end{center}
      
       \begin{flushleft}
           this is very first and simple paragraph
           \par
       \end{flushleft}
      
       \begin{flushright}
           \includegraphics{img/2}
           \par
       \end{flushright}
      
       \begin{center}
           \begin{tabular}{|c|c|}
               \hline 
               1 & 2\tabularnewline
               \hline 
               \hline 
               3 & 4\tabularnewline
               \hline 
           \end{tabular}
           \par
       \end{center}
      
    2. For Graphics / Image / Table

       \begin{figure}
           \begin{raggedright}
               \includegraphics[width=3in]{img/2}
               \par\end{raggedright}
           \protect\caption{First figure}
       \end{figure}
      
       \begin{figure}
           \begin{centering}
               \includegraphics[width=3in]{img/2}
               \par\end{centering}
           \protect\caption{First figure}
       \end{figure}
      
       \begin{figure}
           \begin{raggedleft}
               \includegraphics[width=3in]{img/2}
               \par\end{raggedleft}
           \protect\caption{First figure}
       \end{figure}
      
    3. Using Alignment Commands

       \centering
       \center
       \flushright
       \flushleft
      

Figures

  • Using Figure Float

    \par Command is used to add a horizontal line space.

      \begin{figure}
      \begin{centering}
          \includegraphics[width=3in]{img/2}\includegraphics[width=3in]{img/3}
          \par
      \end{centering}
      \begin{centering}
          \includegraphics[width=3in]{img/4}\includegraphics[width=3in]{img/5}
          \par
      \end{centering}
      \protect\caption{First figure}
      \end{figure}
    
  • Subfigure (Using Figure Float)

    Insert figure float, and into figure float, insert other figure floats.

    Note:- You need to import subfig package.

    Warning:- This technique can distrub alignment of text in table of figures.

    -/ Figure_float

      -/ First Figure     -/ Second Figure
      -/ Third Figure     -/ Fourth Figure
    

    First Example,

      \begin{figure}
          \begin{centering}
              \subfloat[First Sub figure]{\protect\includegraphics[width=3in]{img/2}
    
              } \subfloat[Second Sub Figure]{\protect\includegraphics[width=3in]{img/3}
          }
          \par\end{centering}
      \begin{centering}
          \subfloat[Third Sub Figure]{\protect\includegraphics[width=3in]{img/4}
    
          } \subfloat[Fourth Sub Figure]{\protect\includegraphics[width=3in]{img/5}
      }
      \par\end{centering}
      \protect\caption{First figure}
      \end{figure}
    
  • Subfigure (Using Table)

    Insert table float, and Create a table (let 2 x 2) and put your graphics there into each column.

      \begin{table}
          \begin{centering}
              \begin{tabular}{|c|c|}
                  \hline 
                  \includegraphics[width=3in]{img/2} & \includegraphics[width=3in]{img/3}\\
                  \hline 
                  \hline 
                  \includegraphics[width=3in]{img/4} & \includegraphics[width=3in]{img/5}\\
                  \hline 
              \end{tabular}
              \par\end{centering}
          \protect\caption{Figures table}
      \end{table}
    

    Another Example, (Remove all table chrome)

      \begin{table}
          \begin{centering}
              \begin{tabular}{cc}
                  \includegraphics[width=3in]{img/2} & \includegraphics[width=3in]{img/3}\\
                  \includegraphics[width=3in]{img/4} & \includegraphics[width=3in]{img/5}\\
              \end{tabular}
              \par\end{centering}
          \protect\caption{Figures table}
      \end{table}
    

Tables

  1. Using tabbling Environment.

     %This is How You can use  tabbling  environment.
     % table of 3 x 4
     \begin{tabbing}
         \hspace{1in}\=\hspace{1.5in}\=\kill  %setup column spacing
         First \> 56 \>  78 \\  %just append a new line character after completion of column
         Second \> 45 \> 12 \\
         Third \> 15 \> 23  \\
         Fourth \> demo \> world
     \end{tabbing}
    

In This example, we have given some margin to rows (Add margin with horizontal line).

\begin{center}
\begin{tabular}{|c|c|c|}
    \hline \rule[-2ex]{0pt}{5.5ex}  First & Second & Third \\ 
    \hline \rule[-2ex]{0pt}{5.5ex} 45 & 12 & 3 \\ 
    \hline \rule[-2ex]{0pt}{5.5ex} 10 & 89 & 5 \\ 
    \hline \rule[-2ex]{0pt}{5.5ex} 56 & 2 & 58 \\ 
    \hline 
    \end{tabular}   

\end{center}
  1. Using tabular environment.

    First Example,

     % Now we are going to use   tabular   environment
     % here we want to center the content in each column using some margin
     % For that you have to use   tabularx  package.
     \begin{tabular}{|>{\centering\arraybackslash}p{1.5in}|>{\centering\arraybackslash}p{1in}|>{\centering\arraybackslash}p{1in}|>{\centering\arraybackslash}p{1in}|}
         \hline  First & Second & Third & Fourth \\ 
         \hline 1 & 2 & 3 & 4 \\ 
         \hline 5 & 6 & 7 & 8 \\ 
         \hline 9 & 10 & 11 & 12 \\ 
         \hline 13 & 14 & 15 & 16 \\ 
         \hline 
     \end{tabular}
    

    Second Example,

    multicolumn Command is used to combine multiple columns together, (there are three possible cases, Check those out using TeX Studio)

     % \multicolumn{int(How_many_columns_you_want_to_combine)}{|c|}{Column_Data}
     % \multicolumn{int(How_many_columns_you_want_to_combine)}{}{Column_Data}
     % \multicolumn{int(How_many_columns_you_want_to_combine)}{||c||}{Column_Data}
    
     \begin{tabular}{|c|c|c|}
     \hline First & Second & Third\tabularnewline
     \hline 
     \hline 1 & 2 & 3\tabularnewline
     \hline \multicolumn{2}{|c|}{Action} & 7\tabularnewline
     \hline 4 & 5 & 6\tabularnewline
     \hline 
     \end{tabular}
    

    Third Example, (How to combine multiple rows together)

     % \multirow{int(How_many_rows_to_merge)}{*}{Row_Data}
     % \cline{1-2}  => put data into 1 and 2 column only
    
     \begin{tabular}{|c|c|c|}
     \hline First & Second & Third\tabularnewline
     \hline 
     \hline 1 & 2 & \multirow{3}{*}{376}\tabularnewline
     \cline{1-2} \multicolumn{2}{|c|}{Action} & \tabularnewline
     \cline{1-2} 4 & 5 & \tabularnewline
     \hline 
     \end{tabular}
    

    Fourth Example,

     \begin{tabular}{|c|c|c|}
     \hline First & Second & Third\tabularnewline
     \hline 
     \hline 1 & 2 & \multirow{2}{*}{36}\tabularnewline
     \cline{1-2} 4 & 5 & \tabularnewline
     \hline 9 & 8 & 7\tabularnewline
     \hline 
     \end{tabular}
    

Maths

  • Inline math mode

      $ y = x^{12} + 45 $
    
  • Display Math Mode

      \[ y = x^{5} + 45*x^{3} - 12*x +23 \]
    
  • Using Numbered Equations

      \begin{equation}
           y = x^{5} + 45*x^{3} - 12*x +23 
      \end{equation}
    
  • Matrix

    First Examples,

      $\left\{ \begin{array}{cc}
      1 & 2\\
      4 & 3
      \end{array}\right\} $
    

    Second Example,

      $\begin{bmatrix}1 & 2\\
      4 & 3
      \end{bmatrix}$
    

Bibliography / References

  1. Seperate section for References
  2. Chapter wise References

Color for Citation & Color for URL & Color for Bookmarks

% Using Package  hyperref
% bookmarks=true
% bookmarksopenlevel=0
% bookmarksnumbered=true
% linkcolor={blue}
% citecolor={blue}
% urlcolor={red}
\usepackage[pdfpagemode={UseOutlines},bookmarks=true,bookmarksopen=true,bookmarksopenlevel=0,bookmarksnumbered=true,hypertexnames=false,colorlinks,linkcolor={blue},citecolor={blue},urlcolor={red},pdfstartview={FitV},unicode,breaklinks=true]{hyperref}

Document Background Color

\definecolor{page_backgroundcolor}{rgb}{0, 0.335938, 1}  %blue color
\pagecolor{page_backgroundcolor}

Using References / Bibliography

There are two methods so that you can use Bibliography into your document.

You can embed a list of your Refrences into your document.

First you need to define style (How you want to format citation) for Bibliography. After that you can initialze thebibliography Environment, and put your references there as bibitems.

\bibliographystyle{plain}    

\begin{thebibliography}{9}
    \bibitem{Law} J.~D."Lawrence, \emph{A Catalog of Special Plane Curves}, Dover Publications, New York, 1972.
    \bibitem{Law1} J.~D."Lawrence, \emph{Another Catalog of Special Plane Curves}, Dover Publications, New York, 1972.
    \bibitem{Law2} J.~D."Lawrence, \emph{Demo Special Plane Curves}, Dover Publications, New York, 1972.
\end{thebibliography}

Or, You can use a external Bibliography file, (bibLaTeX format)

You can use external Bibliography file (library.bib) and use its references inside your document, but to compile your document, there will be different steps.

pdfLaTeX COMMAND

bibtex COMMAND

pdfLaTeX COMMAND

pdfLaTeX COMMAND

\bibliographystyle{plain}    
\bibliography{library}  %This is our external bibliography file

C:\Users\ssp\Desktop\11>
=> LaTeX document.tex
This is pdfTeX, Version 3.1415926-2.5-1.40.14 (MiKTeX 2.9)
entering extended mode
(C:\Users\ssp\Desktop\11\document.tex
LaTeX2e <2011/06/27>
----- **** ----------
Output written on document.dvi (2 pages, 8572 bytes).
Transcript written on document.log.


C:\Users\ssp\Desktop\11>
=> bibtex document.aux
This is BibTeX, Version 0.99d (MiKTeX 2.9)
The top-level auxiliary file: document.aux
The style file: plain.bst
Database file #1: library.bib

C:\Users\ssp\Desktop\11>
=> LaTeX document.tex
This is pdfTeX, Version 3.1415926-2.5-1.40.14 (MiKTeX 2.9)
entering extended mode
(C:\Users\ssp\Desktop\11\document.tex
LaTeX2e <2011/06/27>
----- **** ----------
Output written on document.dvi (2 pages, 10020 bytes).
Transcript written on document.log.


C:\Users\ssp\Desktop\11>
=> LaTeX document.tex
This is pdfTeX, Version 3.1415926-2.5-1.40.14 (MiKTeX 2.9)
entering extended mode
(C:\Users\ssp\Desktop\11\document.tex
LaTeX2e <2011/06/27>
----- **** ----------
Output written on document.dvi (2 pages, 10020 bytes).
Transcript written on document.log.

General Document Structure for LaTeX Document


%-- First Section is for Document Declaration --------
\documentclass[12pt,a4paper,oneside]{book}

%-- Second Section is for Global Import-Module --------
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{cite}
\usepackage{fancyhdr}
\usepackage{amsmath,amsfonts,amssymb,amscd,amsthm,xspace}
\usepackage[centerlast,small,sc]{caption}
\usepackage[scriptsize]{subfigure}
\usepackage{booktabs}
\usepackage{rotating}
\usepackage{listings}
\usepackage{longtable}
\usepackage{color}


%-- Third Section is for Document Settings
\usepackage[pdfpagemode={UseOutlines},bookmarks=true,bookmarksopen=true,bookmarksopenlevel=0,bookmarksnumbered=true,hypertexnames=false,colorlinks,linkcolor={blue},citecolor={blue},urlcolor={red},pdfstartview={FitV},unicode,breaklinks=true]{hyperref}


%-- Fourth Section is for Document Environment Initilization

\begin{document}

\chapter{First Chapter}    

\section{First Section}
Not so long ago, data-rich web application was an oxymoron. Today, these applications
are everywhere, and you need to know how to build them.
Traditionally, web applications left the heavy lifting of data to servers that pushed HTML
to the browser in complete page loads. The use of client-side JavaScript was limited to
improving the user experience. Now this relationship has been inverted
client applications pull raw data from the server and render it into the browser when and where it
is needed.

\definecolor{page_backgroundcolor}{rgb}{0, 0.335938, 1}  %blue color
\pagecolor{page_backgroundcolor}


\section{Second Section}
 Initially, jQuery was the go-to library for this paradigm. Its
nature was to make Ajax requests, then update text on the page and so on. However,
this pattern with jQuery revealed that we have implicit model data on the client side \cite{AbuOmar2013}.

\section{Third Section}
The rise of arbitrary code on the client side that can talk to the server however it sees
fit has meant an increase\footnote{This is about increas 1 by one.} in client-side complexity . Good architecture on the client side
has gone from an afterthought to essential?you can?t just hack together some jQuery
code and expect it to scale as your application grows \cite{A.L.Greer1994}\cite{A.Peker1993a}. Most likely, you would end up
with a nightmarish tangle\footnote{This is demo footnote.} of UI callbacks entwined with business logic, destined to be discarded by the poor soul who inherits your code \cite{A.Peker1993a,Agarwal2006,Al-Ghamdi2011,Al-Heniti2009}. \\


\definecolor{page_backgroundcolor}{rgb}{1, 1, 1}  %white color
\pagecolor{page_backgroundcolor}


\bibliographystyle{plain}    
\bibliography{library}  %This is our external bibliography file

\end{document}

Using LaTeX from Command Line


  • LaTeX

    LaTeX.exe -src -interaction=nonstopmode "document".tex (Run this command, 2 times)

    Three files will be generated,

    document.aux

    document.dvi

    document.log

    Now you can compile .DVI to .PDF file,

      C:\Users\ssp\Desktop\11>
      => dvips document.dvi
      This is dvips(k) 5.993 Copyright 2013 Radical Eye Software (www.radicaleye.com)
      ' TeX output 2015.05.27:0940' -> document.ps
      <F:/Softwares/LYX/App/MiKTeX 2.9/dvips/base/tex.pro>
      <F:/Softwares/LYX/App/MiKTeX 2.9/dvips/base/texps.pro>.
      <F:/Softwares/LYX/App/MiKTeX 2.9/fonts/type1/public/amsfonts/cm/cmr12.pfb>
      <F:/Softwares/LYX/App/MiKTeX 2.9/fonts/type1/public/amsfonts/cm/cmbx12.pfb>
      [1]
    
      C:\Users\ssp\Desktop\11>
      => ps2pdf document.ps
    
  • pdfLaTeX (To generate PDF document)

    pdfLaTeX.exe -synctex=1 -interaction=nonstopmode "document".tex ( Run this command, 2 times)

    Five files will be generated.

    document.aux

    document.log

    document.out

    document.pdf

    document.synctex.gz

  • luaLaTeX

    luaLaTeX.exe -synctex=1 -interaction=nonstopmode "document".tex (Run this command, 2 times)

  • bibtex

    bibtex "LaTeX_document.aux"

      Process started: bibtex.exe "________Project_Thesis"
    
      This is BibTeX, Version 0.99d (MiKTeX 2.9)
      The top-level auxiliary file: ________Project_Thesis.aux
    
      Process exited normally
    
  • biber

    biber.exe "LaTeX_document.tex"

Conversion between different file formats

DVI -> PS (dvips)

PS -> PDF (ps2pdf)

DVI -> PDF (dvips -> ps2pdf)

Creating a Batch file to Automate our JOB

@rem -- Here we use (pdfLaTeX + bibtex)
@rem -- USAGE:  ..\..\__init__.bat document.tex 
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION

cd /d %~p1

@rem -- First run PDFLaTeX Command ( First argument will be TeX Document)
pdfLaTeX.exe -synctex=1 -interaction=nonstopmode %~n1.tex

@rem -- Now run bibtex Command
bibtex.exe %~n1.aux

pdfLaTeX.exe -synctex=1 -interaction=nonstopmode %~n1.tex 
pdfLaTeX.exe -synctex=1 -interaction=nonstopmode %~n1.tex 

@rem -- It's clean up time___
IF EXIST *.aux del %~n1.aux
IF EXIST *.bbl del %~n1.bbl
IF EXIST *.blg del %~n1.blg
IF EXIST *.lof del %~n1.lof
IF EXIST *.log del *.log
IF EXIST *.out del %~n1.out
IF EXIST *.toc del %~n1.toc
IF EXIST *.synctex.gz del %~n1.synctex.gz

LaTeX Error : Missing Package error


If you have import external package, for your LaTeX document, and when you are going to compile that document, if error returns, then you need to find that package and install that,

! LaTeX Error: File `demo.sty' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)

If after installing that package, still you are facing this error, then you have to update file list for your local LaTeX installation, and you can do that using this command.

@rem -- This is how you can update file list for LaTeX
initexmf -u 
initexmf --dump
@rem -- This is how you can look for an LaTeX packae file, that is missing.
findtexmf cite.sty
Post a Comment