• Home   /  
  • Archive by category "1"

Latexila Bibliography

The styles, contents and layout in a LaTeX document are defined by means of tags or commands in a plain .tex file, this file can be used to generate several types of "human-readable" versions of the document. The easiest way to generate this final output is to use ShareLaTeX, ShareLaTeX has a ready-to-use LaTeX distribution and final documents can be generated by simply clicking the "Recompile" button; if this is your case you can skip this article. Otherwise, if you need to learn how to compile documents in your computer, this article describes how to generate PS, DVI and PDF output from a LaTeX file.

[edit] Introduction

LaTeX documents are plain documents with a .tex extension (see the Creating a document in LaTeX article for examples), this plain text file has some markup commands that are meant to format the document but, how do you actually generate the final output?. It depends on the type of document you want to generate.

Suppose you saved your document and named the file "mydocument.tex". To create a .PDF file just run this command in the system terminal.

And a file named "mydocument.pdf" will appear.

[edit] TeX distributions

The set of programs that make possible to compile TeX and LaTeX documents is called a TeX typesetting or a TeX distribution. There are many TeX distributions available for different operating systems:

  • MiKTeX for Windows
  • TeX Live for Linux and other UNIX-like systems
  • MacTeX redistribution of TeX Live for Mac OS X
  • teTeX for Linux and other UNIX-like systems, now is no longer actively maintained
  • proTeXt is based on MiKTeX

Of course, if you don't want to go through the process of installing a TeX distribution, you can use an on-line ready to use option like ShareLaTeX.

[edit] LaTeX editors

There are many advanced text editors specifically dedicated to LaTeX for the most popular operating systems, some of them can be downloaded for free while others are proprietary software:

  • Open source: AUCTEX, GNU TeXmacs, Gummi, Kile, LaTeXila, MeWa, TeXShop, TeXnicCenter, Texmaker, TeXstudio, TeXworks
  • Freeware: LEd, WinShell
  • Proprietary/Shareware: Inlage, Scientific WorkPlace, WinEdt

There are also general-purpose editors that add LaTeX-friendly options by means of plugins. For example the well known editors emacs and vim have both a LaTeX extension.

It's worth to mention that the editor in ShareLaTeX can be customized to emulate the emacs or vim behaviour. It is also themeable, so you can choose the same syntax highlighting of some of the aforementioned editors.

[edit] Output formats

There are three output formats available in all TeX distributions. To generate a specific output the document has to be compiled by running a command in a terminal (linux and osx) or the command prompt (windows).

For example, if you want to compile a file named "mydocument.tex" you can use one of the next commands:

This will create "mydocument.dvi", a DVI document
This will generate "mydocument.pdf", a PDF document

There are some additional commands that allow conversion between formats, PS images are also supported. See the reference guide for a schematic description of commands and output formats.

A description of each output format is provided below:

  • (DVI) Device independent file format consists of binary data describing the visual layout of a document in a manner not reliant on any specific image format, display hardware or printer.
  • (PS) PostScript file format describes text and graphics on page and it is based on vector graphics. PostScript is, until now, a standard in desktop publishing areas.
  • (PDF) Portable Document Format is a file format, based on PostScript, used to represent documents in a manner independent of application software, hardware, and operating systems. It is now widely used as a file format for printing and for distribution on the Web.

Note: Most of the editors nowadays include quick-access icons to compile to different output formats so you don't have to actually run the commands in a system prompt.

[edit] Compiling documents with cross-references

In some cases, when your document includes cross-references, you must compile the source twice. It is necessary to include the correct numbers in the table of contents, list of images, reference numbers to theorems and so on.

During the first compilation the LaTeX compiler writes the .aux file for informations about different numbering and during the second one the compiler reads these informations in order to properly generate a table of contents, bibliography, etc.

This process can be automatized by the command . For example, to create a pdf out of the "mydocument.tex" file, run

only once, even if the document has referenced images and bibliography. You can change -pdf to -dvi to set a different file type.

[edit] Reference guide

LaTeX compilation file flow

[edit] Further reading

In order to successfully use , you need to execute the following sequence of commands:

  1. run on the file
  2. run
  3. run again
  4. run again

The first pass of detects a citation command in your file, as well as the and commands. Then, running formats the citation based on the command. Running the second time makes the appropriate links, and, finally, running the third time puts everything in place.

(In TeXShop, you run by either clicking on in the window or by the shortcut ; is run by changing the dropdown menu next to the button to and then clicking or by using the shortcut .)

A couple things you may want to note:

First, if the file is in the same directory as the file, you do not need to specify the entire file path.

Second, you probably want to avoid having spaces in the name of your file. If the name, for example, is , you probably want to change it to , and you can include it simply with , leaving off the file extension.

Third, if these instructions are confusing, there is an engine called , which is, I think, a Perl script that was written to execute and the correct number of times on a file. This is available as an engine with any recent version of TeXShop. By default, it is inactive. If you type:

into the command line (i.e., Terminal) it will move this script into the active folder for you, and then you can access this from the dropdown menu in TeXShop right next to the button, after quitting and reopening TeXShop. (You can also do this by using 'drag & drop' techniques and Finder, though you will probably need to reveal your Library folder, if you're running a recent OS X.)

Finally, a suggestion: you need not make separate files for each document that you write in . You can make one 'master' file, and put it in the directory (which is a place that will always be found when you run , , and/or ). Only citations that you have cited with a command will actually show up in the References section of the document. I find that this is a good way to manage citations, rather than having separate files for everything, particularly if there are works that you you end up citing multiple times.

Update (as per some recent comments):

First, make sure that your TeX distribution is up to date.

Then, if you have not already set up the requisite directory structure for adding your own files, files, etc., you can follow the instructions here to do so.

After following those instructions, you can move your file to the directory. This should take care of any problems that \ might have in locating the file. (Again, doing this might require you to reveal your Library folder.)

Moreover, MWEs for both the file and file will look as follows:

file, which is named and located in :

and the file:

One thought on “Latexila Bibliography

Leave a comment

L'indirizzo email non verrà pubblicato. I campi obbligatori sono contrassegnati *