Writing a simple document in Latex

  • LATEX input files can be created with any text  editor . It contains the LATEX commands and the contents you want to add in your document. The input for LaTeX is a plain ASCII text file.  The commands used in it tells LaTeX how to typeset the text.
  • LaTeX files usually have a .tex extension.
  • Simple example:
\documentclass [12pt] {article} 
\begin{document}
This is  my first document prepared in Latex. 
\end{document}
  • Another example:
\documentclass[12pt]{article} 
\title{\LaTeX} \date{} 
\begin{document} 
\maketitle 
\LaTeX{} is a document preparation system for the \TeX{} typesetting program. It offers programmable desktop publishing features and extensive facilities for automating most aspects of typesetting and desktop publishing, including numbering and cross-referencing, tables and figures, page layout, bibliographies,and much more. 
\end{document}
  • Save this file with extension .tex
  • In order to create the pdf of your file, go to terminal and run the following command :

     pdflatex filename.tex

  • The document environment: After the document class declaration, the text of your document is enclosed between two commands which identify the beginning and end of the actual document:
  • \documentclass[11pt,a4paper,oneside]{report}\begin{document}\end{document}You would put your text where the dots are.
  • Top Matter: At the beginning of most documents there will be information about the document itself, such as the title and date, and also information about the authors, such as name, address, email etc. All of this type of information within LaTeX is collectively referred to as top matter. A simple example:
  • \documentclass[11pt,a4paper,oneside]{report}
    \begin{document}
    \title{How to Structure a LaTeX Document}
    \author{Parveen Kaur}
    \date{December 2004}
    \maketitle
    \end{document}
  • If there are two authors separate them with the \and command:

\author{Jane Doe \and John Doe}

  • Abstract: As most research papers have an abstract, there are predefined commands for telling LaTeX which part of the content makes up the abstract. This command is available for the document classes article and report, but not book.
  • \documentclass{article}\begin{document}\begin{abstract}Your abstract goes here…\end{abstract}

    \end{document}

This entry was posted in LaTex. Bookmark the permalink.

Leave a comment