# Latex Formatting

##### What is Latex?

LaTeX (pronounced lay-tech) is a method of creating documents using plain text, stylized using markup tags, similar to HTML/CSS or Markdown. LaTeX is most commonly used to create documents for academia, such as academic journals.

LaTeX (/ˈlɑːtɛx/ LAH-tekh or /ˈleɪtɛx/ LAY-tekh, often stylized as LaTeX) is a software system for document preparation. When writing, the writer uses plain text as opposed to the formatted text found in WYSIWYG word processors like Microsoft Word, LibreOffice Writer and Apple Pages.

LATEX (pronounced LAY-tek or LAH-tek) is a tool used to create professional-looking documents. It is based on the WYSIWYM (what you see is what you mean) idea, meaning you only have focus on the contents of your document and the computer will take care of the formatting. Instead of spacing out text on a page to control formatting, as with Microsoft Word or LibreOffice Writer, users can enter plain text and let LATEX take care of the rest.

##### Why Latex?

LATEX is used all over the world for scientific documents, books, as well as many other forms of publishing. Not only can it create beautifully typeset documents, but it allows users to very quickly tackle the more complicated parts of typesetting, such as inputting mathematics, creating tables of contents, referencing and creating bibliographies, and having a consistent layout across all sections. Due to the huge number of open source packages available (more on this later), the possibilities with LATEX are endless. These packages allow users to do even more with LATEX, such as add footnotes, draw schematics, create tables etc.

One of the most important reasons people use LATEX is that it separates the content of the document from the style. This means that once you have written the content of your document, we can change its appearance with ease. Similarly, you can create one style of document which can be used to standardise the appearance of many different documents. This allows scientific journals to create templates for submissions. These templates have a pre-made layout meaning that only the content needs to be added. In fact there are hundreds of templates available for everything from CVs to slideshows.

##### Tips

You can add comments to your source file that won’t appear in your typeset document by starting them with a %. Any line that starts with a % will be “commented out”, and won’t be interpreted. You can also add a % at the end of a line, with or without text, and it will make the end of the line disappear.

For example,

% This is a comment line. This is not a comment line.

This line has a comment at the end% % This line should be invisible. of the line. will typeset as

This is not a comment line.

This line has a comment at the endof the line.

Notice the lack of a space in “endof” on the last line of the typeset output. TEX expects a carriage-return character at the end of a line, and interprets that carriage return as an interword space. If you comment out the end of a line, you also comment out the carriage return on that line, and you’ll have words run into one another unless you have a space before the %.

TEX collapses multiple spaces into one, and ignores whitespace at the beginning of a line. Thus

No spaces.

Five spaces.

A tab.

typesets as

No spaces.

Five spaces.

A tab.

(The lines are indented because they are at the start of a paragraph. You can suppress paragraph indentation with \noindent.)

Paragraphs are delimited by two carriage returns (with or without whitespace between them).

•     Using Graphics with pdfTEX

pdfTEX supports PDF and JPEG as native graphic file formats. EPS is not directly supported—to use EPS figures with pdfTEX, you must first convert your EPS files to PDF.

If you’re using a graphics program such as Adobe Illustrator to prepare your figures, just save them as PDF instead of (or in addition to) EPS.

If you don’t have access to the tool you used to create your images, but you still need to convert them, you can use the program epstopdf.

The old version of epstopdf would write to standard output by default, so you had to redirect the output to a file, as in

unix% epstopdf foo.eps > foo.pdf

Current versions, however, will create a PDF file with the same basename as the original (but with the extension replaced). Thus,

unix% epstopdf foo.eps

does exactly the same thing as the previous example, and is easier to type, as well.

To convert a whole slew of files, you could use a command such as the following (with the csh):

unix% foreach f ( ‘find . -type f -name ’*.eps’‘)

foreach? epstopdf $f foreach? end For bash, you could do unix$ for f in ‘find . -type f -name ’*.eps’; do epstopdf \$f; done

These commands work by \find ing all files in or below the current directory (.) that have names that end in eps, and then operate on them.

We will now look at how to add images to a LATEX document. On Overleaf, you will first have to upload the images.

Below is an example on how to include a picture.

\documentclass{article}

\usepackage{graphicx}

\graphicspath { {images/} }

\begin{document}

The universe is immense and it seems to be homogeneous,

In a large scale, everywhere we look at.

\include graphics{universe}

There’s a picture of a galaxy above

\end{document}

LATEX cannot manage images by itself, so you will need to use a package. Packages can be used to change the default look of your LATEX document, or to allow more functionalities. In this case, you need to include an image in our document, so you should use the graphicx package. This package gives new commands, \includegraphics{…} and \graphicspath{…}. To use the graphicx package, include the following line in you preamble: \usepackage{graphicx}

The command \graphicspath{ {images/} } tells LATEX that the images are kept in a folder named images under the current directory.

The \includegraphics{universe} command is the one that actually included the image in the document. Here universe is the name of the file containing the image without the extension, then universe.PNG becomes universe. The file name of the image should not contain white spaces nor multiple dots.

Note: The file extension is allowed to be included, but it’s a good idea to omit it. If the file extension is omitted it will prompt LaTeX to search for all the supported formats. It is also usually recommended to use lowercase letters for the file extension when uploading image files. For more details see the section about generating high resolution and low resolution images.

##### Latex formatting Tools

1. LyX -The power and flexibility of TeX/LaTeX with an intuitive graphical interface

•  LyX is an advanced open source document processor. It is called a “document processor”, because unlike standard word processors, LyX encourages an approach to writing based on the structure of documents, not their appearance.
•  Based on a document preparation system for TeX typesetting, LyX can handle documents ranging from books, notes, theses to articles in refereed journals. It also supports right-to-left languages such as Arabic, Farsi, and Hebrew.
•  LyX is very popular among technical authors and scientists for its advanced mathematical modes. However, it is also frequently used by social scientists, as it features polished bibliographic database integration and multiple file managing and organizing features.

2. Pybliographer-Tool for managing bibliographic databases

• Pybliographer is a high quality tool for working with bibliographic databases. It provides a general framework to manipulate this type of database, with a friendly graphical interface. It is also extensible with a scripting language to tailor the application to a user’s requirements.
• Pybliographer supports BibTeX, Medline, Ovid and Refer files. Use this software for viewing, editing, and searching bibliographic databases, as well as to convert them into different formats such as HTML.
• Yelp (part of GNOME) is required to view the Pybliographic manual from within the graphical user interface.
• It is a simple framework that provides easy to use python classes and functions. It can therefore be extended for many different functions (generating HTML pages according to bibliographic searches, etc).

3. Kile-KDE Integrated LaTeX Environment

• Kile is a user-friendly LaTeX source editor and TeX shell for KDE. LaTeX is a text-processing system derived from TeX, a program developed originally in 1977 by Donald Knuth to help him layout his work professionally, obtaining a work similar to a typesetter’s.
• Kile allows you to use all the functionality of LaTeX in a graphical interface, giving you easy, immediate, and customized access to all programs for LaTeX codecompletion, compiling, postprocessing, debugging, conversion and viewing tools; you also get very handy wizards, a LaTeX reference and a powerful project management.
• The source editor is a multi-document editor designed for .tex and .bib files. Menus, wizards and auto-completion are provided to assist with tag insertion and code generation. A structural view of the document assists with navigation within source files.
• The TeX shell integrates the various tools required for TeX processing. It assists with LaTeX compilation, DVI and postscript document viewing, generation of bibliographies and indices and other common tasks.

4. Biber   BibTeX replacement for users of BibLaTeX

• Biber is a sophisticated, open source, bibliography processing backend for the LaTeX biblatex package.
• It supports a unsurpassed feature set for automated conformance to complex bibliography style requirements such as labelling, sorting and name handling.
• It has comprehensive Unicode support.
• Biber is written in Perl with the aim of providing a customised and sophisticated data preparation backend for biblatex.