• Tidak ada hasil yang ditemukan

PDF is in effect the result of processing a document through PostScript: it’s a binary file format, extremely compact, and well-supported on all platforms.

If your system is configured to generate PDF files direct instead of DVI files, just open the .pdf file using any PDF previewer or browser.

Most editors are configured to display a toolbar icon which will pop up Acrobat Reader or some other viewer with the current PDF output file.

Adobe’s Acrobat Reader cannot automatically update the view if you reprocess your document, in the way that xdvi and GSview can. You have to close the display withCtrl W and reload the file withAlt F  1.

Bitmap preview fonts in Acrobat Reader

Acrobat Reader is extremely poor at rendering Type 3 (bitmap) fonts. If you are using these (either in an old LATEX installation which has not been upgraded to Type 1, or with files using specialist fonts only available in Type 3 format), you will see a very fuzzy display at low magnifications. It will print perfectly, but Acrobat Reader’s display is disappointing. The solution is to use a better previewer or to upgrade to the Type 1 versions of the fonts if possible, or both. If you need to use Type 3 fonts in PDFs, you probably need to warn your readers to expect a fuzzy display from Acrobat Reader (but good printout), and to change to a better reader if they can.

4.4. PRINTER OUTPUT

If you are using DVI and you have a previewer which has a print function configured for your printer, you can use that. If not, create a PostScript file and use GSview instead.

If you are using PDF you can print directly from your PDF viewer.

Be careful about using the ‘Fit to page’ options, as they will change the size of your document so all your measurements will be different.

Non-PostScript printers You can create a PostScript file with dvips (see § 4.3.2) and use GSview to print it (GSview can print PostScript files to almost any make or model of non-PostScript printer).

If you have a real PostScript printer or you are using a system with built-in PostScript printing support (such as Linux or Mac), you can create and send PostScript output directly from your editor to the printer without the need to open it in a previewer first. In Emacs, for example, this is what happens when you use theTEXTEX Print e menu item.

Both the dvips program and all the previewers that print tend to have facilities for printing selected pages, printing in reverse, scaling the page size, and printing only odd or even pages for two-sided work. If you are using PostScript there are programs for manipulating the output (pstops), for example to perform page imposition to get 4, 8, or 16 pages to a sheet for making booklets (psnup).

EXERCISE11 Print it!

Show that you have understood the process of type-setting, previewing, and printing, by displaying your document and printing it.

Formatting information 

 77

If you need a non-PostScript/Ghostscript solution, install a sep-arate TEX print driver for your printer. Some may be supplied with your TEX installation, and there are dozens more on CTAN.

Their names all start with dvi and are followed by an abbreviation for the printer make or model like dvieps for Epson, dvihp for Hewlett-Packard, dvialw for Apple LaserWriters, etc.. Configure the driver to print directly to the print queue, or pipe it to the print queue manually. On Linux with an HP printer, for example, this would be



dvihp mydoc | lpr

Microsoft Windows has no easy way to bypass the print spool, but you can do it from an MS-DOS command window with (using a HP printer as an example):



dvihp mydoc -o mydoc.hp

copy /b mydoc.hp LPT1:

Read the documentation for the driver, as the options and defaults vary.

5

CTAN, packages, and online help

The Comprehensive TEX Archive Network (CTAN) is a reposi-tory of Web and FTP servers worldwide which contain copies of almost every piece of free software related to TEX and LATEX.

CTAN is based on three main servers, and there are several online indexes available. There are complete TEX and LATEX systems for all platforms, utilities for text and graphics processing, conversion programs into and out of LATEX, printer drivers, extra typefaces, and (possibly the most important) the LATEX packages.

The three main servers are:

f TEX Users Group: http://www.ctan.org/

f UK TEX Users Group: http://www.tex.ac.uk/

f Deutschsprachige Anwendervereinigung TEX e.V. (DANTE, the German-speaking TEX Users Group); http://dante.

ctan.org/

Formatting information 

 79

CTAN should always be your first port of call when looking for a software update or a feature you want to use. Please don’t ask the network help resources (§ 5.3) until you have checked CTAN and the FAQ (§ 5.3.1).

5.1 Packages

Add-on features for LATEX are known as packages. Dozens of these are pre-installed with LATEX and can be used in your documents immediately. They should all be stored in subdirectories of texmf/tex/latex named after each package. To find out what other packages are available and what they do, you should use the CTAN search page1 which includes a link to Graham Williams’

comprehensive package catalogue.

A package is a file or collection of files containing extra LATEX commands and programming which add new styling features or modify those already existing. Installed package files all end with .sty(there may be ancillary files as well).

When you try to typeset a document which requires a package which is not installed on your system, LATEX will warn you with an error message that it is missing (see § 4.2.3.6), and you can then download the package and install it using the instructions in § 5.2. You can also download updates to packages you already have (both the ones that were installed along with your version of LATEX as well as ones you added).

There is no limit to the number of packages you can have installed on your computer (apart from disk space!), but there is probably a physical limit to the number that can be used inside any one LATEX document at the same time, although it depends on how big each package is. In practice there is no problem in having even a couple of dozen packages active (the style file for this document uses over 30).

1http://www.ctan.org/search

5.1. PACKAGES

5.1.1 Using an existing package

To use a package already installed on your system, insert a

\usepackage command in your document preamble with the package name in curly braces, as we have already seen in earlier chapters. For example, to use the color package, which lets you typeset in colours (I warned you this was coming!), you would type:



\documentclass[11pt,a4paper,oneside]{report}

\usepackage{color}

\begin{document}

...

\end{document}

You can include several package names in one \usepackage command by separating the names with commas, and you can have more than one \usepackage command.

Some packages allow optional settings in square brackets. If you use these, you must give the package its own separate \usepackage command, like geometry shown below:



\documentclass[11pt,a4paper,oneside]{report}

\usepackage{pslatex,palatino,avant,graphicx,color}

\usepackage[margin=2cm]{geometry}

\begin{document}

\title{\color{red}Practical Typesetting}

\author{\color{blue}Peter Flynn\\Silmaril Consultants}

\date{\color{green}December 2005}

\maketitle

\end{document}

(Incidentally, this is a rather crude way to do colours in ti-tling on a once-off basis: if it’s for a repeatable style we’ll see

Formatting information 

 81

in Chapter 9 how it can be automated and kept out of the author’s way.)

Many packages can have additional formatting specifications in optional arguments in square brackets, in the same way as geometry does. Read the documentation for the package con-cerned to find out what can be done.

EXERCISE12 Add colour

Use the color package to add some colour to your document. Stick with primary colours for the moment.

Use the geometry package to change the margins.

Reprocess and print your document if you have a colour printer (monochrome printers should print it in shades of grey).

CMYK and RGB are not the only colour models. Uwe Kern’s xcolor package defines half a dozen, and includes facilities for converting colour values from one model to another.

5.1.2 Package documentation

To find out what commands a package provides (and thus how to use it), you need to read the documentation. In the texmf/doc subdirectory of your installation there should be directories full of .dvifiles, one for every package installed. These can be previewed or printed like any other DVI file (see § 4.3.1). If your installation procedure has not installed the documentation, the DVI files can all be downloaded from CTAN.

Before using a package, you should read the documentation carefully, especially the subsection usually called ‘User Interface’, which describes the commands the package makes available. You cannot just guess and hope it will work: you have to read it and find out.

See the next section for details of how to create the documenta-tion .dvi file for addidocumenta-tional packages you install yourself.