You are here

This manual about how to write a paper in Latex has beed written by Professor Schirner to help the student writing paper using Latex. The students can focuse on the contents without being distracted by formatting styles. In this tip some Latex compilation tools under windows and how to use them are introduced. 

LaTeX for writing articles is intersting, it allows us to focus first on the content, without being distracted by the actual formatting. Later in the process, we can add the typesetting and tweak automatic setting from LaTeX. There are plenty other good reasons for using LaTeX, but as often it is a matter of taste.

For using LaTeX under Windows, the following software very helpful:

  • MiKTeX a TeX implementation for the Windows operating system.
  • Ghostscript an interpreter for the PostScript language and for PDF.
  • TeXnicCenter an IDE for developing LaTeX documents under Windows.
  • SumatraPDF a fast PDF viewer which does not lock viewed PDF files (as Adobe Acrobat does). The viewed PDF will automatically update when recompiled. It also allows syncing PDF to LaTeX source: ie. double click on a text passage in SumatraPDF and TeXnicCenter will open the corresponding LaTeX source line (follow TeXnicCenter SumatraPDF integration instructions). These two features really contribute to productivity.

 

Integrating Windows Generated Figures into LaTeX

Two main compilation methods exist for compiling LaTeX: dvips and pdflatex. I have recently switched to pdflatex (since a convenient viewer SumatraPDF exists now). pdflatex can include figures in PDF, which makes it easy to integrate any sort of windows generated figure into Latex.

 

PDF Figures in Windows

Simply print the desired figure into PDF. Ensure that only a single page is printed. Then, crop the white margin, e.g. in Adobe Acrobat or Briss, or use trim= option to \includefigure.

 

Generating EPS Files in Windows

I use the AdobePS printer to generate EPS files. Make sure to select EPS as output in the advanced options. For that open the printer preferences, open the Advanced tab, then click on Printing Defaults... and finally on Advanced. This opens a dialog for Advanced Options containing a tree of options. Unfold the PostScript Options and select for PostScript Output Option the value Encapsulated PostScript(EPS). Further, disable the option Send PostScript Error Handler. Note that my Windows XP, the printer drivers would be lost after I OK all changes. To make printer preferences under the subtree PostScript Options persistent, I had to change other options outside this subtree at the same time too (for example switch TrueType Font under Graphic, OK all changes and later switch it back).
With the freshly installed printer, EPS files can be created from any application. To integrate the EPS into another document, the size and location of the figure within the printed page is important. A setting inside the EPS file, the bounding box, defines the boundaries of the graphic. The created EPS file typically has for the whole page instead of the figure/drawing itself. Including a graphic with the default bounding box results in large empty spaces around the figure when integrated into a LaTeX/PDF document. However, a tight fitting bounding is very desired.
Ghost script does a very good job in automatically calculating the bounding box (use File -> "PS to EPS"). Note, that I was not very lucky in generating EPS directly from Power Point. Despite using a blank template, the automatically calculated bounding box is always too large. Instead, I now copy and paste the graph into another program and print it from there.
For increased convenience, I adapted a small shell script to call ghost script to perform the calculation. Also, I placed a wrapping batch file into the context menu for "eps" files (following these instructions).
There is still room for improvement. One possible addition for example is the automatic calculation of the bounding box directly after printing. What would also be nice is to have an application independent file dialog to select the output file name (Excel 2003 for example requires manually entering the complete string). One idea to achieve all this is to adjust CutePDF for this purpose as it seems to be nicely configurable.

 

WMF2EPS

Other people are successful using wmf2eps. As one part, it installs a generic post script printer driver. Then it allows to print out of any windows application into an EPS file (similar to the more manual approach above). It also should adjust the bounding box automatically. However, I did not have much success.

 

EPS to WMF

I did not have the best experience with this tool. The resulting WMF files differed too much from their original. The fonts did not match and curves did appear very coarsely approximated. As a result, I try to create a WMF directly in the first place. This was possible, because I generated measurement graphs using Octave, which allows for WMF output.
 

 

Too Small Head Margin using MikTeX

Sometimes the head margin (space between top of the page and first text line), seems to be awfully small. When comparing Linux compiled output and the Windows output using MikTeX, the Windows output did leave too little room on the head of the page. The culprit in my case was dvips. On linux it assumes a letter output, whereas it the Windows version assumes A4 as default. I found two possible solutions: adding an option to dvips or defining the papersize in the latex source code.

Alternative 1: adding paper size definition in LaTeX source code

Add within the LaTeX source code the following line:

%setup letter paper size for dvips
% (it requires absolute values)
\special{papersize=8.5in,11in}

Alternative 2: Add Option to "dvips"

The option "-t letter" forces dvips to output letter sized paper, which fixes the headmargin problem as well.
In the end, I decided for this solution and added the extra parameter to the output profile of MikTeX (Build -> "Define Output Profiles ...").
 

 

PDF Tools

Here a collection of some PDF tools that I find useful. Obviously there are more tools out there in the world.

Acrobat Reader

The standard reader.

Foxit Reader

PDF Reader, allows saving form data, and simple manipulations, e.g. overwrite simple objects (line, rectangle, text ...).
This reader has extended functionality, but is not as convenient to use as the Acrobat Reader.

CutePDF

Installs a pinter driver to generate PDF

PDFInfo

Modify the Meta Information In a PDF FILE

Pdftk

PDF Tool Kit. Command line for PDF manipulation (split, merge ...)

PDFTK Builder

Graphical Front end for Pdftk. However, it does not provide access to all functionality of Pdftk. (Web site also provides info for more PDF tools.)

 

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer