172
The L A T E X Graphics Companion Second Edition Michel Goossens Frank Mittelbach Sebastian Rahtz Denis Roegel Herbert Voß Upper Saddle River, NJ Boston Indianapolis San Francisco New York Toronto Montreal London Munich Paris Madrid Capetown Sydney Tokyo Singapore Mexico City

The LATEX Graphics Companion - Pearsoncmg

  • Upload
    others

  • View
    13

  • Download
    0

Embed Size (px)

Citation preview

Page 1: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:36 — page iii — #3

The LATEX GraphicsCompanion

Second Edition

Michel GoossensFrank MittelbachSebastian Rahtz

Denis RoegelHerbert Voß

Upper Saddle River, NJ • Boston • Indianapolis • San FranciscoNew York • Toronto • Montreal • London • Munich • Paris • Madrid

Capetown • Sydney • Tokyo • Singapore • Mexico City

Page 2: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:36 — page iv — #4

Many of the designations used by manufacturers and sellers to distinguish their products are claimedas trademarks. Where those designations appear in this book, and Addison-Wesley was aware of atrademark claim, the designations have been printed with initial capital letters or in all capitals.

The authors and publisher have taken care in the preparation of this book, but make no expressed orimplied warranty of any kind and assume no responsibility for errors or omissions. No liability isassumed for incidental or consequential damages in connection with or arising out of the use of theinformation or programs contained herein.

The publisher offers discounts on this book when ordered in quantity for bulk purchases and specialsales. For more information, please contact:

U.S. Corporate and Government Sales(800) [email protected]

For sales outside of the United States, please contact:

International [email protected]

Visit Addison-Wesley on the Web: www.awprofessional.com

Library of Congress Cataloging-in-Publication Data

The LaTeX Graphics companion / Michel Goossens ... [et al.]. -- 2nd ed.p. cm.

Includes bibliographical references and index.ISBN 978-0-321-50892-8 (pbk. : alk. paper)1. LaTeX (Computer file) 2. Computerized typesetting. 3. PostScript

(Computer program language) 4. Scientific illustration--Computer programs.5. Mathematics printing--Computer programs. 6. Technicalpublishing--Computer programs. I. Goossens, Michel.

Z253.4.L38G663 2008686.2’2544536–dc22 2007010278

Copyright © 2008 by Pearson Education, Inc.

All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, ortransmitted, in any form, or by any means, electronic, mechanical, photocopying, recording, orotherwise, without the prior consent of the publisher.

The foregoing notwithstanding, the examples contained in this book and obtainable online onCTAN are made available under the LATEX Project Public License (for information on the LPPL,see www.latex-project.org/lppl).

For information on obtaining permission for use of material from this work, please submit a writtenrequest to:

Pearson Education, Inc.Rights and Contracts Department75 Arlington Street, Suite 300Boston, MA 02116Fax: (617) 848-7047

ISBN 10: 0-321-50892-0ISBN 13: 978-0-321-50892-8

Text printed in the United States on recycled paper at Courier in Westford, Massachusetts.

First printing, July 2007

Page 3: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:36 — page v — #5

We dedicate this book to the hundreds of LATEX developerswhose contributions are showcased in it,and we salute their enthusiasm and hard work.

We would also like to remember with affection and thanksDaniel Taupin, whose MusiXTEX system is described inChapter 9, and who passed away in 2003, a great loss to our community.

Page 4: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:36 — page xxv — #25

Preface

More than a decade has passed since the publication of the first edition of The LATEX GraphicsCompanion, and there have been many changes and new developments since 1996.

The second edition has seen a major change in the authorship: Frank, Michel and Se-bastian have been joined by Denis and Herbert as authors, enriching the book with theirknowledge and experience in individual subject areas.

As in the first edition, this book describes techniques and tricks of extended LATEX type-setting in the area of graphics and fonts. We examine how to draw pictures with LATEX andhow to incorporate graphics files into a LATEX document. We explain how to program pic-tures using ������� and ��������, as well as how to achieve special effects withsmall fragments of embedded PostScript. We look in detail at a whole range of tools for build-ing graphics in TEX itself.

TEX is the world’s première markup-based typesetting system, and PostScript (onwhich PDF is based) is the leading language for describing the printed page. We describehow they can produce even more beautiful results when they work together. TEX’s mathemat-ical capability, its paragraph building, its hyphenation, and its programmable extensibilitycan cooperate with the graphical flexibility and font-handling capabilities of PostScript andPDF to provide a rich partnership for both author and typesetter.

To be able to do justice to the graphics packages that have been further developed sincethe first edition, we decided to omit a description of PostScript and PDF tools, and of fonttechnologies, from the printed version of this book. This material, which was covered inChapters 10 and 11 of the first edition, has been substantially expanded and is now freelyavailable (see http://xml.cern.ch/lgc2). It covers DVI-to-PostScript drivers, the freeprogram ghostscript to view PostScript and PDF files, tools for manipulating PostScript andPDF files, and suggestions on how to combine the latest font technologies (PostScript Type 1and OpenType) with LATEX.

Page 5: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:36 — page xxvi — #26

xxvi PREFACE

This volume is not a complete consumer guide to packages. In trying to teach by ex-ample, we present hundreds of self-contained code samples of the most useful types of solu-tions, based on proven and well-known implementations. But, given the space available, wecannot provide a full manual for every package. Our aim is simply to show how easy it is touse a given package and to indicate whether it seems to do what is required—not to dwellon the precise details of syntax or options. Nevertheless, we have described in more detail afew selected tools that we consider especially important.

We assume you know some LATEX; you cannot read this book by itself if you have neverused TEX before. We recommend that you start with LATEX: A Document Preparation Sys-tem, Second Edition [78], or the Guide to LATEX, Fourth Edition [76], and continue with TheLATEX Companion, Second Edition [83], to explore some of the many (non-graphical) pack-ages available.

Why LATEX, and why PostScript?This book is about LATEX, graphics, PostScript, and its child PDF. We believe that the struc-tured approach of a system like LATEX is the best way to use TEX, and LATEX is by far themost widely used TEX format. This means that it attracts contributors who develop new pack-ages, and thus some of what we describe works only in LATEX. We apologize in advance forour LATEX bias to those who appreciate the elegance of the original plain TEX format and itsderivatives, and we promise them that most of the packages will work well with any TEX di-alect: the delights of systems such as ��������, PSTricks, XY-pic, and MusiXTEX are opento all.

We also want to explain why we talk about PostScript so much. This language has beenwell established for almost two decades as an extremely flexible page-description language,and it remains the tool of choice for professional typesetters. Among the features that makeit so attractive are these:

• The quantity, quality, and flexibility of Type 1 fonts

• The device-independence and portability of files

• The quality of graphics and the quantity of drawing packages that generate it

• The facilities for manipulating text

• The mature color-printing technology

• The encapsulation conventions that make it easy to embed PostScript graphics

• The availability of screen-based implementations (e.g., ghostscript/ghostview)

PostScript has spawned an enterprising child, the PDF (Portable Document Format)language, used by Adobe Acrobat and now well established as an exchange format for doc-uments on the Web. Designed for screen display with hypertext features, PDF offers a newdegree of portability and efficiency. Although not the main subject of this book, we neverthe-less mention that LATEX can also produce “rich” PDF documents, and versions of TEX (e.g.,pdflatex) that produce PDF directly are available.

ch-preface.tex,v: 1.38 2007/06/05

Page 6: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:36 — page xxvii — #27

PREFACE xxvii

Again, we apologize to those of you who are disappointed not to read about LATEX’sassociation with Mac’s QuickDraw, or the Windows GDI, HPGL, PCL, etc., but with so manypackages available, we had to make a choice.

Please note that the absence of a given package or tool in this book in no way impliesthat we consider it less useful or of inferior quality. We do think, though, that we have in-cluded a representative set of tools and packages, and we sincerely hope that you will findhere one or more subjects to entertain you.

How this book is arrangedThis book is subdivided in two basic ways: by application area and by technique. We suggest

Basic information inChapters 1 and 2

that all readers look at Chapter 1 before going any further, because it introduces how wethink about graphics and summarizes some techniques developed in later chapters. We alsosuggest that you read Chapter 2, which covers the LATEX standard graphics package, since thetools for including graphics files will be needed often. Chapter 2 also covers pict2e, a packagethat reimplements LATEX’s picture environment using PostScript, and a further extensioncurve2e. Together these packages not only do away with most of the limitations inherentin the standard version of LATEX’s picture, but also offer new and powerful commands todraw arcs and curves with mininal effort.

We have tried to make it possible to read each of the other chapters separately; you mayprefer to go straight to the chapters that cover your subject area or look at those that describea particular tool. Two chapters each are dedicated to the generic systems �������� andPSTricks.

3�� ���� and�� ����: TEX’s Mates shows how to exploit the power of TEX’s���� languages (Knuth’s ������� and its PostScript-based extension ����-����). After introducing the basic functions, the basic �������� libraries are de-scribed, as well as available TEX interfaces and miscellaneous tools and utilities.

4�� ���� Applications introduces the �������� toolkit, and explains how touse��������’s unparalleled expressive power for describing many types of graphs,diagrams, and geometric constructs. Applications in the areas of science and engineer-ing, 3-D representations, posters, etc. conclude the overview.

5 Harnessing PostScript Inside LATEX: PSTricks walks the reader through the various com-ponents of the PSTricks language, looking at such things as defining the coordinate sys-tem, lines and polygons, circles, ellipses and curves, arrows, labels, fill areas, and muchmore.

6 The Main PSTricks Packages takes you even deeper into the world of PSTricks. Armedwith the knowledge gained in Chapter 5, the reader will find here detailed descriptionsof the most common PSTricks packages—in particular, pst-plot for plotting functionsand data; pst-node for mastering nodes and their connections; pst-tree for creating treediagrams; pst-fill for filling and tiling areas; pst-3d for creating 3-D effects, such as shad-ows and tilting; and pst-3dplot for handling 3-D functions and data sets. The chapterends with a summary of PSTricks commands and keywords.

ch-preface.tex,v: 1.38 2007/06/05

Page 7: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:36 — page xxviii — #28

xxviii PREFACE

The next four chapters discuss problems in special application areas and survey morepackages:

7 The XY-pic Package introduces a package that goes to great lengths to define a notationfor many kinds of mathematics diagrams and implements it in a generic and portableway.

8 Applications in Science, Technology, and Medicine looks at chemical formulae andbonds, applications in bioinformatics, Feynman diagrams, timing diagrams, and elec-tronic and optics circuits.

9 Preparing Music Scores first describes the principles of the powerful MusiXTEX package.Then several preprocessors providing a more convenient interface are introduced: abcfor folk tunes, PMX for entering polyphonic music, and M-Tx (an offspring of PMX) fordealing with multi-voice lyrics in scores. We also take a short look at LilyPond, a modernmusic typesetter written in C++, and say a few words about TEXmuse.

10 Playing Games is for those who use LATEX for play as well as for work. It shows you howto describe chess games and typeset chess boards (the usual and oriental variants). Thischapter also describes how to handle Go, backgammon, and card games. We concludewith crosswords in various forms and Sudokus, including how to typeset, solve, andgenerate them.

Our last chapter addresses an area of general interest: color, and some of its commonuses in LATEX.

11 The World of Color starts with a short general introduction to color. Next comes anoverview of the xcolor package and the colortbl package, that is based on xcolor. Thefinal part discusses the beamer class for producing color slides with LATEX.

Appendix A describes ways to generate PDF from LATEX. Appendix B introduces CTANand explains how to download the LATEX packages described in this book.

As mentioned earlier, material about PostScript and PDF tools, as well as informationabout how to use PostScript and OpenType fonts with LATEX, is available as supplementarymaterial (see http://xml.cern.ch/lgc2), which covers the following subjects:

PostScript Fonts and Beyond describes the ins and outs of using PostScript fonts withLATEX. It also looks at the latest developments on how to integrate OpenType fonts bycreating TEX-specific auxiliary files (TEX metrics, virtual fonts, etc.) or by reading thefont’s characteristics directly in the OpenType source.

PostScript and PDF Tools starts with a short introduction to the PostScript, PDF, andSVG languages. It then describes some freely available programs, in particular dvipsand pdflatex to generate PostScript and PDF, ghostscript and ghostview to manipulateand view PostScript and PDF, plus a set of other tools that facilitate handling PostScriptand PDF files and conversions.

ch-preface.tex,v: 1.38 2007/06/05

Page 8: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:36 — page xxix — #29

PREFACE xxix

Typographic conventionsIt is essential that the presentation of the material conveys immediately its function in theframework of the text. Therefore, we present below the typographic conventions used in thisbook.

Throughout the text, LATEX command and environment names are set in mono-spaced Commands,environments,packages, . . .

type (e.g., \includegraphics , sidewaystable, \begin{tabular}), while names ofpackage and class files are in sans serif type (e.g., graphicx). Commands to be typed bythe user on a computer terminal are shown in monospaced type and are underlined (e.g.,This is user input).

The syntax of the more complex LATEX commands is presented inside a rectangular box. Syntax descriptions

Command arguments are shown in italic type:

\includegraphics*[llx,lly][urx,ury]{file}

In LATEX, optional arguments are denoted with square brackets and the star indicates a vari-ant form (i.e., is also optional), so the above box means that the \includegraphics com-mand can come in six different incarnations:

\includegraphics{file}\includegraphics[llx,lly]{file}\includegraphics[llx,lly][urx,ury]{file}\includegraphics*{file}\includegraphics*[llx,lly]{file}\includegraphics*[llx,lly][urx,ury]{file}

In case of PSTricks the syntax is not as straight forward and optional arguments mayhave other delimiters than brackets. For this reason they are shown with a gray backgroundas in the following example:

\pstriangle* [settings] (xM ,yM) (dx,dy)

Lines containing examples with LATEX commands are indented and are typeset in a Code examples . . .

monospaced type at a size somewhat smaller than that of the main text:\fmfdotn{v}{4}\fmfv{decor.shape=circle,decor.filled=full,

decor.size=2thick}{v1,v2,v3,v4}

However, in the majority of cases we provide complete examples together with the output . . . with output . . .

they produce side by side:

� �� � ��

\usepackage{feyn}

$\feyn{fglf}$ \qquad $\Feyn{fglf}$

Example

0-0-1

Note that the preamble commands are always shown in blue in the example source.

ch-preface.tex,v: 1.38 2007/06/05

Page 9: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:36 — page xxx — #30

xxx PREFACE

In case several pages need to be shown to prove a particular point, these are usually. . . with several pages. . . framed to indicate that we are showing material from several pages (this setup is repeat-

edly used in Section 11.4, where the beamer class for producing color slides with LATEX, isdescribed), as shown here.

The Declaration of Independence of the ThirteenColonies.

by Thomas Jefferson et al.

July 4, 1776

Self-evident truths.

We hold these truths to be self-evident,� that all men are created equal,� that they are endowed by their Creator with certain

inalienable rights,� that among these are Life, Liberty and the Pursuit of

Happiness.� That, to secure these rights, Governments are instituted

among Men, deriving their just powers from the consent ofthe governed.

� That, when any form of government becomes destructive ofthese ends, it is the Right of the People to alter or abolish it.

\documentclass{beamer}

\title{The Declaration of Independence ofthe Thirteen Colonies.}

\author{by Thomas Jefferson et al.}\date{July 4, 1776}\frame{\maketitle}

\section{The unanimous Declaration}\begin{frame}\frametitle{Self-evident truths.}We hold these truths to be self-evident,\begin{itemize}\item \textbf{that} all men are created equal,\item \textbf{that} they are endowed by their

Creator with certain inalienable rights,\item \textbf{that} among these are Life,

Liberty and the Pursuit of Happiness.\item \textbf{That}, to secure these rights,Governments are instituted among Men, derivingtheir just powers from the consent of the governed.\item \textbf{That}, when any form of governmentbecomes destructive of these ends, it is the Right... further code omitted ...

Example

0-0-2

For large examples, where the input and output cannot be shown conveniently along-. . . with large output . . .

side each other, the following layout is used:

\usepackage{feyn}

\begin{eqnarray}\feyn{fcf} &=& \feyn{faf} + \feyn{fpf} + \cdots \\

&=& \sum_{n=0}^\infty \feyn{fsafs ( pfsafs)}^n\end{eqnarray}

� �� = � �� + � �� + · · · (1)

=∞∑

n=0

� �� (���� )n

(2)

Example

0-0-3

Depending on the example content, some additional explanation might appear betweeninput and output.

ch-preface.tex,v: 1.38 2007/06/05

Page 10: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/28 — 8:28 — page xxxi — #31

PREFACE xxxi

All of these examples are “complete” if, for the LATEX examples, you mentally add a\documentclass line (with the article class1 as an argument) and surround the body ofthe example with a document environment. In fact, this is how all the examples in thisbook were produced. When processing the book, special LATEX commands take the sourcelines for an example and write them to an external file, thereby automatically adding the\documentclass or the relevant lines needed to run the example. This turns each exam-ple into a small but complete source document, which can then be externally processed (us-ing a mechanism that runs each example as often as necessary; see also the next section onhow to use the examples). The result is converted into small EPS graphics, which are thenloaded in the appropriate place the next time LATEX is run on the whole book. The imple-mentation is based on the fancyvrb package, and is described in more details in The LATEXCompanion [83] (Section 3.4.3, in particular pages 162–163).

In some cases input for the examples may get very lengthy without providing additionalOmitting example codeinsight to the reader. In that case some of it is replaced by the line “... further code

omitted ...” to save space, as shown in Example 0-0-2. Technically this is achieved byplacing the command \empty on a line by itself into the example code (where you will findit in the online version of the examples). When the example is processed to produce theoutput graphic this command is ignored, but when the code is read verbatim to show theinput in the book, it serves as marker to end the code display.

Throughout the book, blue notes are sprinkled in the margin to help you easily findcertain information that would otherwise be hard to locate. In a few cases these notes exhibit � Watch out

for thesea warning sign, indicating that you should probably read this information even if you areotherwise only skimming through the particular section.

Using the examplesOur aim when producing this book was to make it as useful as possible for our readers. Forthis reason the book contains nearly 1200 complete, self-contained examples illustrating themain aspects of the packages and programs covered in the book.

We have put the source of the examples on CTAN (Comprehensive TEX ArchiveOnline example sourcesNetwork—see Appendix B) in the directory info/examples/lgc2. The examples are

numbered per section, and each number is shown in a small box in the inner margin (e.g.,2-1-1 for the Example 2-1-1 on page 26). These numbers are also used for the external filenames by appending a filetype that corresponds to the source. Most files are in LATEX sourceformat (with an extension of .ltx for a single page, or .ltxb for generating several pageswhen giving examples of the use of the beamer class). There are also plain TEX files (exten-sion .ptx), �������� source files (extension .mp), MusiXTEX preprocessor source files(extensions .abc, .abcplus, .pmx, .mtx, and .ly), pic files (extension .pic), and m4sources (extension .m4). For each of these types of sources there is a corresponding Unixscript (runabc, runabcpl, runltx, runltxb, runly, runm4, runmp, runmtx, runpic,runpmx, runptx), which can be used as an example of how to run the given source file on asystem where all the needed packages and software, as described in this book, are available.

1Except for examples in Chapter 11 that require the beamer class.

ch-preface.tex,v: 1.39 2007/06/28

Page 11: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:36 — page xxxii — #32

xxxii PREFACE

To reuse any of the examples it is usually sufficient to copy the preamble code (typesetin blue) into the preamble of your document and, if necessary, adjust the document text asshown. In some cases it might be more convenient to place the preamble code into your ownpackage (or class file), thus allowing you to load this package in multiple documents using\usepackage . If you want to do the latter, there are two points to observe:

• Any use of the \usepackage command in the preamble code should be replaced by\RequirePackage , which is the equivalent command for use in package and classfiles (see e.g., Section A.4.5 of The LATEX Companion [83]).

• Any occurrence of \makeatletter and \makeatother must be removed from thepreamble code. This is very important because the \makeatotherwould stop correctreading of such a file.

So let us assume you wish to reuse the code from the following (rather complex) example:

\usepackage{pstricks,pst-xkey}

\makeatletter % ‘@’ now normal "letter"

\newif\ifHRInner\def\psset@HRInner#1{\@nameuse{HRInner#1}}\psset@HRInner{false}\def\psHexagon{\pst@object{psHexagon}}\def\psHexagon@i{\@ifnextchar({\psHexagon@ii}%

{\psHexagon@ii(0,0)}}\def\psHexagon@ii(#1)#2{%

\begin@ClosedObj% closed object\pst@@getcoor{#1}% get center\pssetlength\pst@dimc{#2}% set radius to pt\addto@pscode{% PostScript

\pst@coor T % xM yM new origin\psk@dimen CLW mul % set line width/Radius \pst@number\pst@dimc\space % save radius\ifHRInner\space 3 sqrt 2 div div \fi def % inner?

/angle \ifHRInner 30 \else 0 \fi def % starting angleRadius angle PtoC moveto % go to first point6 { % 6 iterations/angle angle 60 add def % alpha = alpha+60Radius angle PtoC L % line to next point

} repeatclosepath % closed object

}%\def\pst@linetype{3}% set linetype\showpointsfalse% do not show base points

\end@ClosedObj% end\ignorespaces}% swallow spaces

\makeatother % ‘@’ is restored as "non-letter"

ch-preface.tex,v: 1.38 2007/06/05

Page 12: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:36 — page xxxiii — #33

PREFACE xxxiii

\psset{unit=7mm}\begin{pspicture}(-3,-3)(3,3)\psHexagon[linewidth=3pt,linecolor=red]{2.5}\pscircle[linestyle=dashed,linecolor=red]{2.5}

%\psHexagon[linewidth=3pt,linecolor=blue,HRInner=true]{2.5}\pscircle[linestyle=dashed,linecolor=blue]{2.17}

\end{pspicture}

Example

0-0-4

You have two alternatives: You can copy the preamble code (i.e., code colored blue) into yourown document preamble or you can place that code—but without the\makeatletterand\makeatother and with \usepackage replaced by \RequirePackage—in a packagefile (e.g., myhexagon.sty) and afterwards load this “package” in the preamble of your owndocuments with \usepackage{myhexagon}.

Finding all those packages and programsAll of the packages and programs described in this book are freely available in public soft-ware archives; a few are in the public domain, but most are protected by copyright andavailable to you under an open-source license. Some programs are available only in sourceform or work only on certain computer platforms, and you should be prepared for a certainamount of “getting your hands dirty” in some cases. We also cannot guarantee that later ver-sions of packages or programs will give results identical to those in our book. Many of thesepackages and programs remain under active development, and new or changed versions ap-pear several times a year; we completed this book in spring 2007, and tested the exampleswith the versions current at that time.

In Appendix B we give full details on how to access CTAN sites and how to downloadfiles using the Internet. You can also purchase the TEX Collection DVD from one of the TEXUsers Groups. This DVD contains implementations of TEX for various systems, many pack-ages and fonts, in particular it provides you with all the LATEX packages described in thisbook and The LATEX Companion, Second Edition. Some programs (such as the ones describedin the music chapter) are not available on CTAN (or the DVD) and must be downloadedfrom the location indicated in the text.

ch-preface.tex,v: 1.38 2007/06/05

Page 13: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:36 — page xxxiv — #34

xxxiv PREFACE

AcknowledgmentsWe gratefully recognize all of our many colleagues in the TEX world who develop LATEXpackages—not only those described here, but also the hundreds of others that help userstypeset their documents faster and better. Without the continuous effort of all these enthusi-asts, TEX would not be the magnificent and flexible tool it is today.

We have many people to thank. Our primary debt, of course, is to the authors of theprograms and packages we describe. Every author whom we contacted to discuss problemsprovided us with practical help in the spirit of the TEX community, and often gave us permis-sion to reuse examples from their documentation.

We are greatly indebted to Eric Beitz, Ulrich Dirr, Ulrike Fischer, Federico Garcia, UweKern, Claudia Krysztofiak, Aaron Lauda, Susan Leech O’Neale, Ross Moore, Janice Navarria,Han-Wen Nienhuys, Ralf Vogel, and Damien Wyart, for their careful reading of sections ofthe manuscript. Their numerous comments, suggestions, corrections, and hints have sub-stantially improved the quality of the text. Special thanks go to Hubert Gäßlein, who greatlyhelped us at all stages of preparation, verification, and typesetting.

As he did with The LATEX Companion, Second Edition, Richard Evans of Infodex Index-ing Services in Raleigh, North Carolina, undertook the groundwork for the comprehensiveindexes in the back of the book—thank you, Dick.

On the publishing side, we wish to thank Peter Gordon, our editor at Addison-Wesley,who gave us much-needed support and encouragement over the three years duration of thisproject. When it came to production, Elizabeth Ryan was unfailingly patient with our id-iosyncrasies and steered us safely to completion. Jill Hobbs edited our dubious prose intoreal English; we greatly appreciate their work.

∗ ∗ ∗Our families and friends have lived through the preparation of this book over several

years, and we thank them for their patience and moral support.

FeedbackWe would like to ask you, dear reader, for your collaboration. We kindly invite you to sendyour comments, suggestions, or remarks to any of the authors. We shall be glad to correct

To Err is Human any mistakes or oversights in a future edition, and are open to suggestions for improve-ments or the inclusion of important developments we may have overlooked. Any mistakeor oversight found in this book and reported represents a gain for all readers. The latestversion of the errata file (with contact details) can be found on the LATEX project site athttp://www.latex-project.org/guides/lgc2.errwhere you will also find an on-line version of the index and other extracts from the book.

Michel GoossensFrank Mittelbach

Sebastian RahtzDenis RoegelHerbert Voß

June 2007

ch-front.tex,v: 1.22 2007/06/15

Page 14: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:36 — page 1 — #1

C H A P T E R 1

Graphics with LATEX

1.1 Graphics systems and typesetting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.2 Drawing types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.3 TEX’s interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61.4 Graphics languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101.5 Choosing a package. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

The phrase “A picture paints a thousand words” seems to have entered the English lan-guage thanks to Frederick R. Barnard in Printer’s Ink, 8 December 1921, retelling a Chineseproverb.1 However, while LATEX is quite good at typesetting words in a beautiful manner,LATEX manuals usually tell you little or nothing about how to handle graphics. This book at-tempts to fill that gap by describing tools and TEXniques that let you generate, manipulate,and integrate graphics with your text.

In these days of the multimedia PC, graphics appear in various places. With many prod-ucts we get ready-to-use collections of clipart graphics; in shops we can buy CD-ROMs with

“the best photos” of important places; and so forth. As we shall see, all such graphics can beincluded in a LATEX document as long as they are available in a suitable format. Fortunately,many popular graphic formats either are directly supported or can be converted via a pro-gram that allows transformation into a supported representation.

If you want to become your own graphic artist, you can use stand-alone dedicateddrawing tools, such as the freely available dia (www.gnome.org/projects/dia) andxfig (www.xfig.org/userman) on Linux, or the commercial products Adobe Illustrator(www.adobe.com/illustrator) or Corel Draw (www.corel.com/coreldraw) on aMac or PC. Spreadsheet programs, or one of the modern calculation tools like Mathematica

1Paul Martin Lester (commfaculty.fullerton.edu/lester/writings/letters.html) states thatthe literal translation of the “phony” Chinese proverb should rather be “A picture’s meaning can express ten thou-sand words”. He, rightly, emphasizes that pictures cannot and should not replace words, but both are comple-mentary and contribute equally to the understanding of the meaning of a work.

Page 15: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:36 — page 2 — #2

2 GRAPHICS WITH LATEX

(www.wolfram.com/mathematica), Maple (www.maplesoft.com/maple), and MAT-LAB (www.mathworks.com/matlab), or their freely available GNU variant Octave (www.octave.org) and its plotting complements Octaviz (octaviz.sourceforge.net) andOctplot (octplot.sourceforge.net), can also produce graphics by using one of theirmany graphical output representations. With the help of a scanner or a digital camera youcan produce digital photos, images of hand-drawn pictures, or other graphics that can bemanipulated with their accompanying software. In all these cases it is easy to generate filesthat can be directly referenced in the LATEX source through the commands of the graphicspackage described in Chapter 2.

If needed, LATEX can also offer a closer integration with the typesetting system than thatpossible by such programs. Such integration is necessary if you want to use the same fontsin text and graphics, or more generally if the “style” of the graphics should depend on theoverall style of the document. Close integration of graphics with the surrounding text clearlyrequires generation of the graphic by the typesetting system itself, because otherwise anychange in the document layout style requires extensive manual labor and the whole processbecomes very error-prone.

∗ ∗ ∗

This chapter considers graphic objects from different angles. First. we look at the require-ments that various applications impose on graphic objects. Next, we analyze the types ofdrawings that appear in documents and the strategies typically employed to generate, in-tegrate, and manipulate such graphics. Then, we discuss the interfaces offered by TEX fordealing with graphic objects. Armed with this knowledge, we end the chapter with a shortsurvey of graphics languages built within and around TEX. This overview will help you se-lect the right tool for the job at hand. In fact, the current chapter also gives some examplesof languages and approaches not covered in detail elsewhere in the book. Thus this surveyshould provide you with enough information to decide whether or not to follow the pointersand obtain such a package for a particular application.

1.1 Graphics systems and typesettingWhen speaking about “graphic objects”, we should first define the term. One extreme posi-tion is to view everything put on paper as a graphic object, including the characters of thefonts used. This quite revolutionary view was, in fact, adopted in the design of the page de-scription language PostScript, in which characters can be composed and manipulated byexactly the same functions as other graphic objects (we will see some examples of this inChapters 5 and 6, which describe PSTricks and its support packages).

Most typesetting systems, including TEX, do not try to deploy such a general model butinstead restrict their functional domain to a subset of general graphic objects—for exam-ple, by providing very sophisticated functions to place characters, resolve ligatures, etc., butomitting operators to produce arbitrary lines, construct and fill regions, and so forth. As aresult the term “graphics” for most LATEX users is a synonym for “artwork”, thereby ignoringthe fact that LATEX already has a graphics language—the picturemode.

ch-graphics.tex,v: 1.47 2007/06/01

Page 16: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:36 — page 3 — #3

1.2 Drawing types 3

When discussing the graphical capabilities of an ideal typesetting system, we must re-member that different applications have different, sometimes conflicting requirements:

• One extreme is the need for complete portability between platforms; another is to takeinto account even differences in the way printers put ink onto paper.

• A graphic might need to be correctly scaled to a certain size depending on factors of thevisual environment created by the typesetting system, e.g., the measure of the text.

• It is also possible that parts of the graphic should not scale linearly. For example, itmight be important for readability to ensure that textual parts of a graphic do not be-come smaller or larger than some limit. It might also be required that, when a graphicis scaled by, say, 10% to fit the line, any included text must stay the same, so as to avoidmaking it larger than the characters in the main document body.

• It might be required that the graphical object be closely integrated with the surroundingtext, such as by using the same fonts as in other parts of the document or more gener-ally by containing objects that should change their appearance if the overall style of thedocument is changed. (The latter is especially important if the document is describedby its logical content rather than by its visual appearance, with the intention of reusingit in various contexts and forms.)

As LATEX is a general-purpose typesetting system used for all types of applications, the pre-ceding requirements and more might arise in various situations. As we will see throughoutthis book, a large number of them can be handled with grace, if not to perfection. In somecases an appropriate solution was anything but obvious and developing the mature macropackages and programs we now have took a decade or more of work.

1.2 Drawing typesThe typology of graphics at the beginning of this chapter focused on the question of theintegration with the LATEX system, and divided the graphics into externally and internallygenerated ones. A different perspective would be to start from the types of graphics we mightencounter in documents and discuss possible ways to generate and incorporate them.

A first class of graphics to be included are treated by LATEX as a single object, a “blackbox”, without an accessible inner structure. LATEX, via its graphics package (described inChapter 2), is interested only in the rectangular dimensions of the graphic image, its “bound-ing box”. The graphics will be included in the output “as is”, possibly after some simple ma-nipulation, such as scaling or rotation. On top of that LATEX can also produce a caption andlegend to allow proper referencing from within the document. The main categories are asfollows:

1. Free-hand pictures drawn without a computer, such as the drawing of a glass bead inFigure 1.1. For use in LATEX, such a graphic must to be transformed into a digital image,using, for example, a scanner.

ch-graphics.tex,v: 1.47 2007/06/01

Page 17: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:36 — page 4 — #4

4 GRAPHICS WITH LATEX

Figure 1.1: Pen and ink drawing of a beadFigure 1.2: Bitmap drawing outputcreated with GIMP

2. “Art” graphics drawn with bitmap tools on a computer, such as the example in Figure 1.2,which are to some extent the computer equivalents of pen and ink drawings. This draw-ing was created with GIMP, the GNU Image Manipulation Program (www.gimp.org),using a deliberately crude technique. The distinctive characteristic of this type of draw-ing is that the resolution chosen in the generation process cannot easily be changedwithout loss of quality (or alternatively without a lot of manual labor). In other respectssuch a picture is like a free-hand drawing: there is generally no desire to integrate thedrawing with the text or to worry about conformity of typefaces.

3. Photographs either created directly using a digital camera or scanned like hand-drawnpictures. In the latter case the continuous tones of the photograph are converted intoa distinct range of colors or gray levels (black-and-white photographs treated in thisway are known as half-tones). Full-color reproduction requires sophisticated printingtechniques, but this issue arises at the printing stage and does not normally affect thetypesetting. Figure 1.3 shows how LATEX can distort the image.

A second class of graphics is the “object-oriented” type, where the information is storedin the form of abstract objects that incorporate no device-dependent information (unlikebitmap graphics, where the storage format just contains information about whether a cer-tain spot is black or white, making them resolution-dependent). This device independencemakes it easy to reuse the graphic with different output devices and allows us to manipulateindividual aspects of the graphic during the design process.

There are essentially three types of such graphics systems: one in which LATEX mainlyremains passive (it just takes into account the bounding box of the picture), and two othersthat relate to graphics that contain more complex text, in particular formulae. For the lattertypes it is important to use LATEX to typeset text within the graphic because the symbols informulae and their typeset form carry a precise semantic meaning. Therefore one must takegreat care to ensure that their visual representation is identical in both text and associatedgraphics.

1. Self-contained object-oriented graphics. The ducks of Figure 1.4, which was producedwith Adobe Illustrator, were created by drawing one object in terms of curves and then

ch-graphics.tex,v: 1.47 2007/06/01

Page 18: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:36 — page 5 — #5

1.2 Drawing types 5

Figure 1.3: Digitally transformed image(vertically stretched)

HUMANIST rulesOK

Figure 1.4: Object-oriented drawing

copying and rotating it many times. This type of drawing often also contains textualannotations comparable to typeset text. Although it is usually possible to add text tothe graphic with external tools such Illustrator, it is not in general possible to use LATEXto typeset this text (although psfrag provides a solution in some circumstances).

2. Algorithmic display graphics (e.g., histograms, graphs). These drawings are created with-out human interaction but often contain text that should match the document text. Thescale and distance between elements is an essential characteristic of the drawing.Extensive plotting and diagram facilities are provided by many LATEX packages buildingon the picturemode, by generic TEX packages such as PICTEX [139], DraTex [39], andtikz [115]; and by PSTricks (see Chapters 5 and 6). All these solutions let us deploy thefull power of LATEX’s typesetting functions within textual parts of the graphic and thusintegrate it perfectly with surrounding document elements.

3. Algorithmic structural graphics, which can be derived from a textual representation. Un-like with the previous category, often merely the spatial relationship between elementsis important with these graphics, not the elements’ exact position or size. Examples arecategory diagrams, chemical formulae, trees, and flowcharts. Such graphics are natu-ral candidates for generation by graphics languages internal to LATEX that provide high-level interfaces which focus on objects and relationships and decide final placement andlayout automatically.Of the general-purpose languages, the �������� system (Chapters 3 and 4) is per-haps the most flexible one for this type of graphics, although PICTEX, XY-pic (Chapter 7),PSTricks (Chapters 5 and 6), and DraTex are also suitable. They are based on differentparadigms, and differ greatly in approach, focus, and user interface, but they all havefound their place in the LATEX world. We describe small specialized languages tailoredfor specific application domains such as physics, chemistry or electronics diagrams(Chapter 8), music (Chapter 9), and games (Chapter 10). For special applications suchas tree drawing, many other LATEX languages are available as well (see [13], for instance).

ch-graphics.tex,v: 1.47 2007/06/01

Page 19: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:36 — page 6 — #6

6 GRAPHICS WITH LATEX

As we see, many types of graphics exist, each with its own requirements. The first threetypes essentially present themselves as black boxes to LATEX and thus their use within a LATEXdocument involves no more than their inclusion and in some cases their manipulation as awhole. The necessary functionality is discussed in detail in Chapter 2.

In scientific texts, the other types of graphics are by far the more common. Examples in-clude maps [119], chemical structures, or commutative diagrams. They are for the most partbased on an object-oriented approach, specifying objects and their relations in an abstractway using a suitable language. Close integration with the surrounding text can be achieved,if needed, by choosing one of the graphics languages described in this book.

In some cases interactive drawing programs can be instructed to output their results inone of the graphics languages built directly on top of LATEX’spicturemode. Widely used ex-amples under Linux are dia and xfig, whose pictures, although externally produced, can beinfluenced by layout decisions within the document. Note, however, that such mechanicallyproduced LATEX code is normally not suitable for further manual editing and manipulationis practically limited to layout facilities implemented by the chosen graphics language. Nev-ertheless, in certain situations this approach can offer the best of two worlds.

1.3 TEX’s interfacesTo understand the merits of the different approaches to graphics as implemented by vari-ous packages, it is helpful to consider yet another point of view: the interfaces provided byTEX for dealing with them. Describing the methods by which graphics can be generated, in-cluded, or manipulated will give you some feeling for such important issues as portability,quality, and resource requirements of individual solutions. We assume that the reader has areasonable understanding of how TEX works—that is, the progression from source file to aDVI file that is processed by a driver to produce printed pages. Of course, the DVI stage canbe skipped when using pdflatex, but the various ways of including the graphics material arestill identical.

In the following we first look at ways of including externally generated graphics (i.e.,those that appear as black boxes to TEX) and methods to manipulate them. Then we considerinterfaces provided to build graphics languages within TEX.

1.3.1 Methods of integrationTEX offers two major facilities for integrating graphics as a whole: one involving the\special command, and the other using the font interface.

Using \special commands

The TEXbook [70] does not describe ways to directly include externally generated graphics.The only command available is the \special command, which by itself does nothing, butdoes enable us to access capabilities that might be present in the post-processor (DVI driveror pdflatex). To quote Knuth [70, page 229]:

The\special command enables you to make use of special equipment that mightbe available to you, e.g., for printing books in glorious TEXnicolor.

ch-graphics.tex,v: 1.47 2007/06/01

Page 20: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:36 — page 23 — #1

C H A P T E R 2

Standard LATEX Interfaces

2.1 Inclusion of graphics files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232.2 Manipulating graphical objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362.3 Line graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

Since the introduction of LATEX 2ε in 1994, LATEX has offered a uniform syntax for includingevery kind of graphics file that can be handled by the different drivers. In addition, all kindsof graphic operations (such as resizing and rotating) as well as color support are available.

These features are not part of the LATEX 2ε kernel, but rather are loaded by the standard,fully supported color, graphics, and graphicx extension packages. Because the TEX programdoes not have any direct methods for graphic manipulation, the packages must rely on fea-tures supplied by the “driver” used to print the dvi file. Unfortunately, not all drivers sup-port the same features, and even the internal method of accessing these extensions variesamong drivers. Consequently, all of these packages take options, such as dvips, to specifywhich external driver is being used. Through this method, unavoidable device-dependentinformation is localized in a single place, the preamble of the document.

In this chapter we start by looking at graphics file inclusion. LATEX offers both a simple in-terface (graphics), which can be combined with the separate rotation and scaling commands,and a more complex interface (graphicx), which features a powerful set of manipulation op-tions. The chapter concludes with a discussion of the pict2e package, which implements thedriver encapsulation concept for line graphics and with a brief description of the curve2epackage, which is not part of the “standard LATEX interface” but nevertheless represents aninteresting extension to pict2e. Color support is covered in Chapter 11.

2.1 Inclusion of graphics filesThe packages graphics and graphicx can both be used to scale, rotate, and reflect LATEX ma-terial or to include graphics files prepared with other programs. The difference between

Page 21: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:36 — page 24 — #2

24 STANDARD LATEX INTERFACES

Table 2.1: Overview of color and graphics capabilities of device drivers

Option Author of Driver Features

dvips T. Rokicki All functions (reference driver; option also used by xdvi)dvipdf S. Lesenko All functionsdvipdfm S. Lesenko All functionsdvipsone Y&Y All functionsdviwin H. Sendoukas File inclusionemtex E. Mattes File inclusion only, but no scalingpdftex Hàn Thê Thành All functions for pdftex programpctexps PCTeX File inclusion, color, rotationpctexwin PCTeX File inclusion, color, rotationpctex32 PCTeX All functionspctexhp PCTeX File inclusion onlytruetex Kinch Graphics inclusion and some colortcidvi Kinch TrueTeX with extra support for Scientific Wordtextures Blue Sky All functions for Textures programvtex Micropress All functions for VTeX program

the two is that graphics uses a combination of macros with a “standard” or TEX-like syn-tax, while the “extended” or “enhanced” graphicx package presents a key/value interface forspecifying optional parameters to the \includegraphicsand \rotatebox commands.

2.1.1 Options for graphics and graphicxWhen using LATEX’s graphics packages, the necessary space for the typeset material after per-forming a file inclusion or applying some geometric transformation is reserved on the out-put page. It is, however, the task of the device driver (e.g., dvips, xdvi, dvipsone) to performthe actual inclusion or transformation in question and to show the correct result. Given thatdifferent drivers may require different code to carry out an action, such as rotation, onehas to specify the target driver as an option to the graphics packages—for example, optiondvips if you use one of the graphics packages with Tom Rokicki’s dvips program, or optiontextures if you use one of the graphics packages and work on a Macintosh using Blue Sky’sTextures program.

Some drivers, such as previewers, are incapable of performing certain functions. Hencethey may display the typeset material so that it overlaps with the surrounding text. Table 2.1gives an overview of the more important drivers currently supported and their possible lim-itations. Support for older driver programs exists usually as well—you can search for it onCTAN.

The driver-specific code is stored in files with the extension .def—for example,dvips.def for the PostScript driver dvips. As most of these files are maintained by thirdparties, the standard LATEX distribution contains only a subset of the available files and notnecessarily the latest versions. While there is usually no problem if LATEX is installed as partof a full TEX installation, you should watch out for incompatibilities if you update the LATEXgraphics packages manually.

ch-stdgraph.tex,v: 1.46 2007/06/15

Page 22: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:36 — page 25 — #3

2.1 Inclusion of graphics files 25

It is also possible to specify a default driver using the \ExecuteOptions declarationSetting a default driverin the configuration filegraphics.cfg. For example,\ExecuteOptions{dvips}makes

the dvips drivers become the default. In this case the graphics packages pick up the drivercode for the dvips TEX system on a PC if the package is called without a driver option. Mostcurrent TEX installations are distributed with a ready-to-use graphics.cfgfile.

In addition to the driver options, the packages support some options controlling whichfeatures are enabled (or disabled):

draft Suppress all “special” features, such as including external graphics files in the finaloutput. The layout of the page will not be affected, because LATEX still reads the size in-formation concerning the bounding box of the external material. This option is of par-ticular interest when a document is under development and you do not want to down-load the (often huge) graphics files each time you print the typeset result. When draftmode is activated, the picture is replaced by a box of the correct size containing thename of the external file.

final The opposite of draft. This option can be useful when, for instance, “draft” modewas specified as a global option with the \documentclass command (e.g., for show-ing overfull boxes), but you do not want to suppress the graphics as well.

hiresbb In PostScript files, look for bounding box comments that are of the form%%HiResBoundingBox (which typically have real values) instead of the standard%%BoundingBox (which should have integer values).

hiderotate Do not show the rotated material (for instance, when the previewer cannotrotate material and produces error messages).

hidescale Do not show the scaled material (for instance, when the previewer does notsupport scaling).

With the graphicx package, the options draft, final, and hiresbb are also available lo-cally for individual \includegraphics commands, that is, they can be selected for indi-vidual graphics.

2.1.2 The \includegraphics syntax in the graphics packageWith the graphics package, you can include an image file by using the following command:

\includegraphics*[llx,lly][urx,ury]{file}

If the [urx,ury] argument is present, it specifies the coordinates of the upper-right cornerof the image as a pair of TEX dimensions. The default units are big (PostScript) points; thus[1in,1in] and[72,72] are equivalent. If only one optional argument is given, the lower-left corner of the image is assumed to be located at [0,0]. Otherwise, [llx,lly] specifiesthe coordinates of that point. Without optional arguments, the size of the graphic is deter-mined by reading the external file (containing the graphics itself or a description thereof, asdiscussed later).

ch-stdgraph.tex,v: 1.46 2007/06/15

Page 23: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:36 — page 26 — #4

26 STANDARD LATEX INTERFACES

%!PS-Adobe-2.0%%BoundingBox:100 100 150 150100 100 translate % put origin at 100 1000 0 moveto % define current point50 50 rlineto % trace diagonal line50 neg 0 rlineto % trace horizontal line50 50 neg rlineto % trace other diagonal linestroke % draw (stroke) the lines0 0 moveto % redefine current point

/Times-Roman findfont % get Times-Roman font50 scalefont % scale it to 50 big points

setfont % make it the current font(W) show % draw an uppercase W

Figure 2.1: The contents of the file w.eps

The starred form of the \includegraphics command “clips” the graphics imageto the size of the specified bounding box. In the normal form (without the *), any part ofthe graphics image that falls outside the specified bounding box overprints the surroundingtext.

The examples in the current and next sections use a small PostScript program (in afile w.eps) that paints a large uppercase letter “W” and a few lines. Its source is shown inFigure 2.1. Note the BoundingBoxdeclaration, which stipulates that the image starts at thepoint 100, 100 (in big points), and goes up to 150, 150; that is, its natural size is 50 bigpoints by 50 big points.

In the examples we always embed the \includegraphics command in an \fbox(with a blue frame and zero \fboxsep) to show the space that LATEX reserves for the in-cluded image. In addition, the baseline is indicated by the horizontal rules produced by the\HR command, defined as an abbreviation for \rule{1em}{0.4pt}.

The first example shows the inclusion of the w.eps graphic at its natural size. Here thepicture and its bounding box coincide nicely.

left W right

\usepackage{graphics,color}\newcommand\HR{\rule{1em}{0.4pt}}\newcommand\bluefbox[1]{\textcolor{blue}{%

\setlength\fboxsep{0pt}\fbox{\textcolor{black}{#1}}}}

left\HR \bluefbox{\includegraphics{w.eps}}\HR rightExample

2-1-1

Next, we specify a box that corresponds to a part of the picture (and an area outsideit) so that some parts fall outside its boundaries, overlaying the material surrounding thepicture. If the starred form of the command is used, then the picture is clipped to the box(specified as optional arguments), as shown on the right.

ch-stdgraph.tex,v: 1.46 2007/06/15

Page 24: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:36 — page 27 — #5

2.1 Inclusion of graphics files 27

Example

2-1-2

leftW middleW right

\usepackage{graphics,color}% \bluefbox and \HR as before

left\HR\bluefbox{\includegraphics

[120,120][150,180]{w.eps}}%\HR middle\HR\bluefbox{\includegraphics*

[120,120][150,180]{w.eps}}%\HR right

In the remaining examples we combine the \includegraphics command withother commands of the graphics package to show various methods of manipulating an in-cluded image. (Their exact syntax is discussed in detail in Section 2.2.) We start with the\scalebox and \resizebox commands. In both cases we can either specify a change inone dimension and have the other scale proportionally, or specify both dimensions to distortthe image.

Example

2-1-3 left W middle W right

\usepackage{graphics,color}% \bluefbox and \HR as before

left\HR\bluefbox{\scalebox{.5}{%\includegraphics{w.eps}}}%

\HR middle\HR\bluefbox{\scalebox{.5}[1.5]{%\includegraphics{w.eps}}}%

\HR right

Example

2-1-4 left W middle W right

\usepackage{graphics,color}% \bluefbox and \HR as before

left\HR\bluefbox{\resizebox{10mm}{!}{%\includegraphics{w.eps}}}%

\HR middle\HR\bluefbox{\resizebox{20mm}{10mm}{%\includegraphics{w.eps}}}%

\HR right

Adding rotations makes things even more interesting. Note that in comparison to Ex-ample 2-1-1 on the facing page the space reserved by LATEX is far bigger. LATEX “thinks” inrectangular boxes, so it selects the smallest size that can hold the rotated image.

Example

2-1-5 left W right

\usepackage{graphics,color}% \bluefbox and \HR as before

left\HR\bluefbox{\rotatebox{25}{%\includegraphics{w.eps}}}%

\HR right

ch-stdgraph.tex,v: 1.46 2007/06/15

Page 25: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:36 — page 28 — #6

28 STANDARD LATEX INTERFACES

2.1.3 The \includegraphics syntax in the graphicx packageThe extended graphics package graphicx also implements \includegraphics but offersa syntax for including external graphics files that is somewhat more transparent and user-friendly. With today’s TEX implementations, the resultant processing overhead is negligible,so we suggest using this interface.

\includegraphics*[key/val-list]{file}

The starred form of this command exists only for compatibility with the standard version of\includegraphics , as described in Section 2.1.2. It is equivalent to specifying the clipkey.

The key/val-list is a comma-separated list of key=value pairs for keys that take a value.For Boolean keys, specifying just the key is equivalent to key=true; not specifying the keyis equivalent to key=false. Possible keys are listed below:

bb The bounding box of the graphics image. Its value field must contain four dimen-sions, separated by spaces. This specification will overwrite the bounding box in-formation that might be present in the external file.1

hiresbb Makes LATEX search for %%HiResBoundingBox comments, which specify thebounding box information with decimal precision, as used by some applications.In contrast, the normal %%BoundingBox comment can take only integer values.It is a Boolean value, either “true” or “false”.

viewport Defines the area of the graphic for which LATEX reserves space. Material outsidethis will still be print unless trim is used. The key takes four dimension argu-ments (like bb), but the origin is with respect to the bounding box specified inthe file or with the bb keyword. For example, to describe a 20 bp square 10 bp tothe right and 15 bp above the lower-left corner of the picture you would specifyviewport=10 15 30 35.

trim Same functionality as the viewport key, but this time the four dimensions cor-respond to the amount of space to be trimmed (cut off) at the left-hand side, bot-tom, right-hand side, and top of the included graphics.

natheight,natwidth The natural height and width of the figure, respectively.2

angle The rotation angle (in degrees, counterclockwise).

origin The origin for the rotation, similar to the originparameter of the \rotateboxcommand described on page 40.

width The required width (the width of the image is scaled to that value).

1There also exists an obsolete form kept for backward compatibility only: [bbllx=a, bblly=b,bburx=c, bbury=d] is equivalent to [bb = a b c d], so the latter form should be used.

2These arguments can be used for setting the lower-left coordinate to (0 0) and the upper-right coordinateto (natwidth natheight) and are thus equivalent to bb=0 0 w h, where w and h are the values specified forthese two parameters.

ch-stdgraph.tex,v: 1.46 2007/06/15

Page 26: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:36 — page 51 — #1

C H A P T E R 3

�������� and�������: TEX’s Mates

3.1 The���� language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523.2 Differences between�������� and������� . . . . . . . . . . . . . . . . . 603.3 Running the���� programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 683.4 Some basic�������� libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 743.5 The������ package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 803.6 TEX interfaces: getting the best of both worlds . . . . . . . . . . . . . . . . . . . . 1203.7 From �������� and to�������� . . . . . . . . . . . . . . . . . . . . . . . . 1373.8 The future of�������� . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138

In designing the TEX typesetting system, Donald Knuth soon realized that he would alsohave to write his own font design program. He devised�������, a language for describ-ing shapes, and a program to interpret that language and turn the shapes into a pattern ofdots for a printing or viewing device. The result of Knuth’s work was TEX,�������, andthe extensive Computer Modern font family written in�������.������� has alsobeen used to create special-purpose symbol fonts and some other font families.

The development of ������� as a font description language paralleled to someextent that of the PostScript language, which also describes character shapes very elegantly.PostScript’s strategy, however, is to leave the rendering of the shape until the final printingstage, whereas������� seeks to precompute the bitmap output and print it on a fairlydumb printing device.

Font design is a decidedly specialist art, and one that most of us are ill equipped totackle. �������, however, defines a very powerful language that can cope with mostgraphical tasks. A sibling program, ��������, was developed that uses essentially thesame language but generates PostScript instead of bitmaps. Together, the two provide an

Page 27: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:36 — page 52 — #2

52 �������� AND�������: TEX’S MATES

excellent companion facility with which (LA)TEX users can illustrate their documents, partic-ularly when they want pictures that graphically express some mathematical construct; this isnot surprising, given that Knuth’s aim was to describe font shapes mathematically. Applica-tions vary from drawing Hilbert or Sierpinski curves (described in Section 4.4.3) to plottingdata in graphs and expressing relationships in graphical form.

In this chapter we consider how to use both ������� and �������� (hence-forth we use ���� to mean “both ������� and ��������”) to draw pictures andshapes other than characters in fonts.

Our coverage of���� is divided into six parts. We start with a brief look at the����language basics; our aim is to give readers new to ���� some ideas of its facilities and thelevel at which pictures can be designed. We try to explain commands as they are used, butsome examples may contain���� code that is not explicitly described.

We next consider in some detail the extra facilities of the �������� language, inparticular the inclusion of text and color in figures.

The third section examines how the���� programs are run and how resulting figurescan be included in a LATEX document. The following section describes the general-purpose�������� libraries, covering in particular boxing macros and the������ package.

We then look at programs that write ���� commands for you, concentrating on themfpic (LA)TEX package. We conclude with an overview of miscellaneous tools and utilitiesrelated to��������.

For some applications, such as drawing of graphs, diagrams, geometrical figures, and3-D objects, higher-level macro packages have been developed, which define their own lan-guages for the user. These packages are described in Chapter 4.

3.1 The���� languageThe full intricacies of ������� are described in loving detail in [72]; the manual for�������� [47] not only describes the differences between the two systems, but is itselfa good introduction to ����. Alan Hoenig’s book TEX Unbound [49] provides a wealth ofmaterial on ������� techniques. Articles over many years in the journal TUGboat arealso vital reading for those who want to delve deeply into������� and��������.

The job of the ���� language is to describe shapes; these shapes can then be filled,scaled, rotated, reflected, skewed, and shifted, among other complex transformations. In-deed, ���� programs can be regarded as specialized equation-solving systems that havethe side effect of producing pictures.

���� offers all the facilities of a conventional programming language. Program flowcontrol, for example, is provided by a for . . .endfor construct, with the usual condition-als. You can write parameterized macros or subroutines, and there are facilities for localvariables and grouping to limit the scope of value changes. Some of these features are de-scribed with more detail in the �������� section, although they are also available in�������.

Because a lot of the work in writing ���� programs deals with describing geomet-rical shapes, the numeric support is extensive. For instance, Pythagorean addition (++)and subtraction (+-+) are directly supported. Useful numeric functions include length x

tlgc2.sty,v: 1.43 2007/06/02

Page 28: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:36 — page 53 — #3

3.1 The�� language 53

(absolute value of x), sqrt x (square root of x), sind x (sine of x degrees), cosd x(cosine of x degrees), angle (x, y) (arctangent of y/x), floor x (largest integer ≤x), uniformdeviate x (uniformly distributed random number between 0 and x), andnormaldeviate (normally distributed random number with mean 0 and standard devia-tion 1).

A variety of complex data types are defined, including boolean, numeric, pair,path, pen, picture, string, and transform. Here we can look at some of these in moredetail:

pair “Points” in two-dimensional space are represented in����with the typepair. Con-stants of type pair have the form (x, y), where x and y are both numeric constants.A variable p of type pair is equal to the pair expression (xpart p, ypart p).

path A path is a continuous curve, which is composed of a chain of segments. Each seg-ment has a shape determined by four control points. Two of the control points, the keypoints, are the segment’s end points; very often we let ���� determine the other twocontrol points.

pen Pens, a distinctive feature of ����, are filled convex shapes that are moved alongpaths and affect the way lines are drawn in the result. Two pens are initially presentin ����: nullpen and pencircle. nullpen is the single point (0, 0); it containsno pixels and can be used to fill a region without changing its boundary. By contrast,pencircle is circular, with the points (±0.5, 0) and (0, ±0.5) on its circumference.Other pens are constructed as convex polygons viamakepenc, where c is a closedpath;the key points of c become the vertices of the pen. Pens themselves can be transformed.

picture A picture is a data type that can be used to store a sequence of ���� drawingcommands; the result of a complete ���� program is often built up from the interac-tion of a set of pictures. The meaning of v+w in�������, for example, is a picturein which each pixel is the sum of the two pixels occupying the same position in picturesv and w, respectively.

transform Affine transforms are the natural transformations of Euclidean geometry—that is, the linear transformations augmented by translation.���� can construct anyaffine transform and provides seven primitive ones [72, p. 141]: shifted, scaled, xscaled,yscaled, slanted, rotated, and zscaled. The effect of most of the operations is self-evident;the last one, zscaled, uses a pair of numbers, interpreted as a complex number in Carte-sian coordinates (i.e., complex multiplication).

Finally, ���� is famous for its ability to solve linear equations, including equationsthat involve points. In particular, you can define a point in terms of other points. For exam-ple, z3=1/2[z1,z2]defines z3 as the point in the middle of the line from z1 to z2.

3.1.1 First examples of���� programsLet us first look at some examples of���� code, all drawn using��������. You shouldhave little difficulty making these examples run under ������� as well, except that

tlgc2.sty,v: 1.43 2007/06/02

Page 29: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:36 — page 54 — #4

54 �������� AND�������: TEX’S MATES

you may encounter problems with high-resolution output devices, as������� can runout of memory when composing large pictures—remember that ������� generates abitmap output. This book was typeset at 2400 dpi, and some ������� examples wereimpossible to run at this resolution. Your only recourse is to work at a lower resolution (e.g.,300 dpi) or to break your picture into separate “characters” in a font and join them togetherin LATEX. It is almost certainly easier to use��������, as it generates PostScript that canbe rendered directly by many printers or turned into PDF.

We do not show the “wrapper” code that is always necessary to turn these examples intoa self-contained document. See the notes in Section 3.3.1 on page 68 for information on how������� creates a character and Section 3.3.2 on page 71 for more on how��������creates a figure.

The simplest statement in ���� is draw, which takes a sequence of points separatedby .. and connects them with curves:

draw (0,0)..(50,20)..(40,30)..(30,20);Example

3-1-1

The default unit here is a PostScript point (1/72 inch, TEX’s “big point”). To close a objectsmoothly between its last and first points, the sequence can be terminated by cycle:

draw (0, 50)..(0,0)..(60,40)..(60,10)..cycle;

Example

3-1-2

Straight lines are drawn by putting -- instead of .. between the points (the lines areactually implemented as specially constrained curves):

draw (0,0)--(50,20)--(40,60)--(30,20);Example

3-1-3

There are several ways of controlling curves: one can vary the angles at the start andend of the curve with dir, the points that are to be the extremes (the upmost, the leftmost,and so forth), and the inflection of the curve (with tension and curl). Thus the following

tlgc2.sty,v: 1.43 2007/06/02

Page 30: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:36 — page 55 — #5

3.1 The�� language 55

code draws a crude coil by judicious use of dir. Instead of the default units, we express alldimensions in terms of a unit of 2.5 cm, defined at the start:

Example

3-1-4

u=2.5cm;path p;p= (0,0) {dir 130}..

{dir -130}(0.25u,0){dir 130}..{dir -130}(0.5u,0){dir 130}..{dir -130}(0.75u,0){dir 130}..{dir -130}(u,0);

draw p rotated -90;

The next example shows the effect of curl. Here a straight line is drawn between threepoints and then a curve is drawn between the same points, with curl values:

Example

3-1-5

path p,q;u=.5cm;q=(0u,0u)--(6u,0u)--(4u,3u);draw q;p=(0u,0u){curl 4000}..(6u,0u)

..{curl 4000}(4u,3u);draw p;

To demonstrate����’s unusual “pens”, we approximate a spiral drawn with a strange“nib”. A colored version of this drawing appears in Color Plate I(a).

Example

3-1-6

pickup pencircle scaled 3ptyscaled .2pt rotated 60;

n:=5;for i := (n*20) step -(n) until (n):draw ((i,0)..(0,i)..(-i,0)

..(0,-(i-n))..(i-n,0)) scaled 0.7;endfor

A very characteristic technique with ���� is creating a path and then using it severaltimes with different transformations. The following code is an extract from a drawing of a

tlgc2.sty,v: 1.43 2007/06/02

Page 31: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:36 — page 56 — #6

56 �������� AND�������: TEX’S MATES

kite’s tail. Note that shapes can be made solid by using fill instead of draw:

u=1cm;path p[];p1:=(.5u,.5u)--(1.5u,.5u)--(.5u,1.5u)--(1.5u,1.5u)--(.5u,.5u)--cycle;fill (p1 shifted (0,2.5u))rotatedaround ((u,3.5u),90);draw p1 shifted (u,4u);fill p1 shifted (3.5u,3u);p2 =(2u,2u)..(u,3.5u)..(2u,5u)..(4.5u,4u)..(7u,5u);pickup pencircle scaled 4pt;draw p2;

Example

3-1-7

A more complicated picture, courtesy of Alan Hoenig from his book TEX Unbound [49],demonstrates looping commands. Boxes of gradually decreasing size are drawn alternatelywhite and black, with each one being rotated slightly with respect to the previous box.

boolean timetofillbox; timetofillbox := true;partway := 0.9; l := .45in; u := 1.05in;n := 4; theta := 360/n; z1 = (0,u);for i := 2 upto n:z[i] = z1 rotated ((i-1)*theta);

endforforever:path p; p := z1for j := 2 upto n: --z[j] endfor --cycle;if timetofillbox:

fill p; timetofillbox := false;else:

unfill p; timetofillbox := true;fipair Z[];for j := 1 upto n:

Z[j] := partway[z[j-1],z[j]];endforZ1 := partway[z[n],z1];for j := 1 upto n:

x[j] := xpart Z[j]; y[j] := ypart Z[j];endforif not timetofillbox: l := abs(z1); fiexitif l < .05u;

endforExample

3-1-8

tlgc2.sty,v: 1.43 2007/06/02

Page 32: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:37 — page 141 — #2

C H A P T E R 4

�������� Applications

4.1 A drawing toolkit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1414.2 Representing data with graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1574.3 Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1764.4 Geometry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1894.5 Science and engineering applications. . . . . . . . . . . . . . . . . . . . . . . . . . 1964.6 3-D extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207

Chapter 3 gave a general overview of�������� and�������, as well as an extensivedescription of two multipurpose structuring packages, boxes and������. However, asis the case for LATEX, solutions to many problems can often be found by using existing high-level packages. Sometimes several different ������� packages are aimed at the sametasks, and these packages come with both advantages and drawbacks.

Unfortunately, the perfect package is seldom at hand. It is therefore useful to have ageneral idea of what can be achieved in �������, and to have some kind of toolboxfor problem solving. Understanding a number of basic tricks will enable the beginner tosupplement existing packages and achieve the desired results.

In this chapter, we start with a review of a number of basic problems and show howthese problems can be solved. Then we describe some standard applications of ����-���, ranging from geometry to physics.

4.1 A drawing toolkitThis section is devoted to a number of advanced features, which are located somewhere be-tween low-level ������� code and full application packages. We like to consider allthese features as a kind of toolkit, which can be used with benefit in wider applications.

Page 33: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:37 — page 149 — #10

4.1 A drawing toolkit 149

Bogusław Jackowski’s hatching package provides a more elaborate way to achieve hatch-ing patterns, by redefining the withcolor primitive in such a way that it represents hatch-ing parameters when the blue component of the color is negative. The following examplesillustrate this principle.

Example

4-1-10

input hatching;

path p;p:=unitsquare xscaled 30mm yscaled 15mm;hatchfill p withcolor red

withcolor (45,2mm,-.5bp)withcolor (-45,2mm,-.5bp);

The next three examples use a special closed path shaped as a star, defined by the starmacro:

Example

4-1-11

input hatching;vardef star(expr n) =for i_:=0 upto 2n-1:if odd i_: 1/2 fi (right rotated (180*(i_/n))) --endfor cycleenddef;

interim hatch_match:=0;path p;p:=star(10) xscaled 30mm

yscaled 20mmrotated 20;

hatchfill p withcolor (0,1,.5);draw image(hatchfill p

withcolor (45,3bp,-.5bp)withcolor (-45,3bp,-.5bp);

) withcolor red dashed evenly;

Example

4-1-12

input hatching;% star macro defined as above

path p;p:=star(10) xscaled 30mm

yscaled 20mmrotated 20;

interim hatch_match:=0;hatchoptions(withcolor blue

dashed evenly scaled 2);hatchfill p withcolor .75white

withcolor (20,6bp,-.5bp);hatchoptions(withcolor (blue+green)

dashed evenlyshifted (3/2bp,0));

hatchfill p withcolor (110,6bp,-.5bp);

tlgc2.sty,v: 1.43 2007/06/02

Page 34: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:37 — page 174 — #35

174 �������� APPLICATIONS

A more elaborate example appears below. The 8% corresponds to 10 being 8% of 50 +30 + 10 + 20 + 20.

Lions

Tigers

Hyaena

Monkeys

1020

38 %

23 %

a segment with 8 %

a green label

input piechartmp

SetupColors((.7,.7),this,this);SetupPercent(this, " %");Segment(50,"Lions"); Segment(30,"Tigers");Segment(10,"Hyaena"); Segment(20,"Monkeys");Segment(20,"Warthogs");SegmentState(4,this,0.3);SegmentState(5,invisible,this);PieChart(2cm,0.15,60,0,0);Label.auto(0)(name)(outwards,0);Label(3,4,5)(value)(inwards,0) withcolor white;Label(1,2)(percent)(inwards,0) withcolor (1,1,0);Label.lrt(3)("a segment with ",percent)

((0.9,0.8),(0,-2cm)) withcolor .8red;pickup pencircle scaled 2pt;Label.auto(2)("a green label")

((0.9,0.1),(-1cm,7mm)) withcolor .8green;Example

4-2-26

This example has labels with spaces and needs a font with spaces—hence thedefaultfontdeclaration. This is not a problem when we are using TEX labels.

SetupNumbers(precision,delimiter)

In addition to the SetupPercent commands, several other setup commands are available.Setup commands The first, SetupNumbers, sets the accuracy and delimiter used. SetupNumbers(2,",")

will, for instance, round at two places and use a comma delimiter.

SetupColors(auto-SV ,shading-SV ,grayscale)

This command specifies the colors used for segments. The three arguments are as follows:

auto-SV is a pair (S, V ), where S is the saturation and V is the value in the HSV model.The hue H is taken from the position of the segment.

shading-SV is a pair giving the maximum values of (S, V ) for shaded areas in segments.The default is (0.4,0.3).

grayscale is a Boolean that, when set to true, switches the colors to grayscale.

SetupText(Mode,TeXFormat,TeXSettings)

This command sets up how text is handled, using three arguments:

Mode is an integer specifying the way labels are typeset: 0 is for string-based typesetting(default); 1 is for external TEX-based typesetting using TeXFormat and TeXSettings; 2 is

tlgc2.sty,v: 1.43 2007/06/02

Page 35: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:37 — page 202 — #63

202 �������� APPLICATIONS

ctext.rt(R.C.l+(1cm,0),R.C.r+(1cm,0),"$E_2$",witharrow);

B

E

C

RC

VCC

RB

VBB

Ca

IE

IC

IB

E1

E2

Example

4-5-7

v

D1

D2D3

D4

ZL

input makecirc;initlatex("\usepackage{amsmath,amssymb}");

source.a(origin,AC,90,"v","");junction.a(S.a.p+(3cm,1cm),"")(top);diode.a(J.a,normal,-45,pinA,"D_1","");diode.b(D.a.K,normal,-135,pinK,"D_2","");diode.c(D.b.A,normal,135,pinK,"D_3","");diode.d(D.c.A,normal,45,pinA,"D_4","");junction.b(D.b.A,"")(bot);centerto.A(S.a.n,S.a.p)(5cm,imp);impedance.a(A,90,"Z_L","");wireU(S.a.p,D.a.A,1.5cm,udsq);wireU(S.a.n,D.b.A,-1.5cm,udsq);wire(D.a.K,Z.a.r,rlsq);wire(Z.a.l,Z.a.l+(0,-4mm),nsq);wireU(Z.a.l+(0,-4mm),D.d.A,-4cm,rlsq);

Example

4-5-8

input makecirc;initlatex("\usepackage{amsmath,amssymb}");

transformer.a(origin,mid,0);diode.a(tf.a.ss+(5mm,1cm),normal,0,pinA,"D_1","");diode.b(tf.a.si+(5mm,-1cm),normal,0,pinA,"D_2","");impedance.a(D.a.K+(2cm,-4mm),-90,"Z_L","300\ohm");wire(tf.a.ss,D.a.A,udsq);wire(tf.a.si,D.b.A,udsq);wire(D.a.K,Z.a.l,rlsq);wire(Z.a.r,tf.a.m,udsq);wire(D.b.K,D.a.K+(5mm,0),rlsq);junction.a(D.a.K+(5mm,0),"")(top);centerto.A(tf.a.pi,tf.a.ps)(-15mm,sac);source.a(A,AC,90,"220 V","v");wire(S.a.p,tf.a.ps,udsq);wire(S.a.n,tf.a.pi,udsq);centreof.A((xpart S.a.p,ypart tf.a.ps),tf.a.ps,cur);current.a(c.A,phi.A,"i(t)","5 A");imesh(tf.a.ss+(1cm,0),15mm,1cm,cw,0,"I_{cc}");

tlgc2.sty,v: 1.43 2007/06/02

Page 36: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:37 — page 210 — #71

210 �������� APPLICATIONS

hexagonal meshes Given a function z = f(x, y), a hexagonal mesh can be obtained withthe hexagonaltrimeshmacro.

input featpost3Dplus2D

def zsurface( expr xc, yc ) =cosd(xc*57)*cosd(yc*57)+4*mexp(-(xc**2+yc**2)*6.4)

enddef;

f := 7*(4,1,5);Spread := 35;LightSource := 10*(4,-3,4);SubColor := 0.4background;

numeric np, ssize;path chair;np = 20;ssize = 5;

hexagonaltrimesh( true,np,ssize,zsurface);Example

4-6-2

cubes The kindofcubemacro produces a cube in an orientation depending on its param-eters. In this example, each cube erases what has been drawn under it, so that it givesthe illusion of the removal of hidden parts.

input featpost3Dplus2D

Spread := 30;f := 5.4*(1.5,0.5,1);numeric gridstep, sidenumber,

i, j, coord, aa, ab, ac;color pa;gridstep = 0.7;sidenumber = 4;coord = 0.5*sidenumber*gridstep;for i=0 upto sidenumber:for j=0 upto sidenumber:

pa := (-coord+j*gridstep,-coord+i*gridstep,0);aa := uniformdeviate(360);ab := uniformdeviate(180);ac := uniformdeviate(90);kindofcube(false, false,

pa, aa, ab, ac, 0.4, 0.4, 0.9 );endfor;

endfor;Example

4-6-3

tlgc2.sty,v: 1.43 2007/06/02

Page 37: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:37 — page 211 — #72

4.6 3-D extensions 211

labels in space The next example shows how labels can be drawn in space using thelabelinspacemacro.

Example

4-6-4

Label

input featpost3Dplus2Dverbatimtex%&latex\documentclass{article}\begin{document}etex

f := 1.1*(2,1,0.5);ParallelProj := true;kindofcube(false,true,(0,-0.5,0),

90,0,0,1.2,0.1,0.4);kindofcube(false,true,(0,0,0),

0,0,0,0.5,0.1,0.8);labelinspace(false,(0.45,0.1,0.65),

(-0.4,0,0),(0,0,0.1),btex \framebox{\textsc{Label}} etex);

projected segments The last example shows how points can be defined in space, andpathofstraightlineused to draw a segment joining the projections of these points.

Example

4-6-5

input featpost3Dplus2D

SphericalDistortion := true;Spread := 50;f := 0.4*(1.5,0.5,1);numeric gridstep, sidenumber, i, coord;color pa, pb, pc, pd;gridstep = 0.1;sidenumber = 5;coord = 0.5*sidenumber*gridstep;for i=0 upto sidenumber:pa := (-coord,-coord+i*gridstep,0);pb := (coord,-coord+i*gridstep,0);pc := (-coord+i*gridstep,-coord,0);pd := (-coord+i*gridstep,coord,0);draw pathofstraightline( pa, pb );draw pathofstraightline( pc, pd );

endfor;

3DLDF

Laurence D. Finston’s ambitious extension to �������, 3DLDF (http://www.gnu.org/software/3dldf/LDF.html) is written in C++ using CWEB. 3DLDF (the author’sinitials) takes an input similar to ������� and outputs pure ������� code. Thepackage currently computes the intersections of various projected curves, and the authorplans to implement the removal of hidden parts.

tlgc2.sty,v: 1.43 2007/06/02

Page 38: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:37 — page 213 — #1

C H A P T E R 5

Harnessing PostScriptInside LATEX: PSTricks

5.1 The components of PSTricks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2145.2 Setting keywords, lengths, and coordinates . . . . . . . . . . . . . . . . . . . . . . 2175.3 The pspicture environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2205.4 The coordinate system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2235.5 Grids . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2245.6 Lines and polygons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2315.7 Circles, ellipses, and curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2405.8 Dots and symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2495.9 Filling areas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2535.10 Arrows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2595.11 Labels. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2655.12 Boxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2695.13 User styles and objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2795.14 Coordinates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2965.15 The PSTricks core . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302

As we saw in Chapter 1, one way of drawing graphics with LATEX is to embed low-level picturedrawing primitives for the target device into LATEX macros, so that full typesetting informa-tion is available and we can work in a familiar macro programming environment. Whenthe target device is something as rich as the full PostScript language, this can result in avery powerful system. While many macro packages have implemented access to some partsof PostScript for this purpose, the most complete is undoubtedly PSTricks. In the next twochapters, we survey its capabilities and demonstrate some of the power that results fromcombining LATEX and PostScript.

Page 39: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:37 — page 214 — #2

214 HARNESSING POSTSCRIPT INSIDE LATEX: PSTRICKS

We do not attempt to describe absolutely every PSTricks-related macro, nor do we giveexamples of all the possible combinations and tricks, as this would require a large book of itsown, e.g., [135]. We have, however, tried to describe and give examples of all the importantfeatures of the basic packages. You’ll find a lot of useful information on the official PSTricksWeb site at http://PSTricks.tug.org/.

Because there are a great many commands and especially keywords in PSTricks, we pro-vide a summary description at the end of the next chapter (Section 6.8 on page 459). PSTricksand its related packages are extremely powerful, and their facilities may take some time tounderstand. It is also documented in the individual packages and [127, 135], and its imple-mentation is described in [126].

5.1 The components of PSTricksThe PSTricks project was started by Timothy Van Zandt a long time ago and is one of theoldest TEX packages still in use.

I started in 1991. Initially I was just trying to develop tools for my own use. Then I thoughtit would be nice to package them so that others could use them. It soon became temptingto add lots of features, not just the ones I needed. When this became so interesting that itinterfered with my “day job”, I gave up the project “cold turkey”, in 1994.

[Timothy Van Zandt]

After Timothy Van Zandt stopped working on the project, Denis Girou took over thetask to care for PSTricks, mainly fixing bugs and writing some more new packages; nowa-days this job is done by Herbert Voß. Several developers are working on existing and newpackages, which is the reason why the number of these additional packages, which dependon the basic PSTricks, is still increasing. A selection of them is discussed in Chapter 6, andthe full list is available at the official Web site at http://PSTricks.tug.org.

5.1.1 The kernelThe basic PSTricks package file is pstricks.tex, which provides the basic unit handling,and basic graphic macros like dots, lines, frames, and so on. For some historical reasonthe packages pstricks, pst-plot, pst-node, and pst-tree build the core of PSTricks and areall available on CTAN in the directory CTAN:/graphics/pstricks/base/generic/.Each PSTricks package has a corresponding LATEX style file, and the basic ones are stored inCTAN:/graphics/pstricks/base/latex/. In general, the style files do nothing otherthan load the TEX file via the \inputmacro.

The basic PSTricks packages consist of a core of picture-drawing primitives imple-mented by \special commands that pass PostScript code to a driver, mainly dvips. Thepackages also contain a set of higher-level macros for particular applications, like pst-plotor pst-node. With it you can

• Draw lines, polygons, circles, and curves.

• Place and manipulate TEX text.

ch-pstricks.tex,v: 1.73 2007/06/01

Page 40: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:37 — page 225 — #13

5.5 Grids 225

\psgrid[settings] (x0,y0) (x1,y1) (x2,y2)

The \psgridmacro is a very powerful tool for drawing coordinate grids. The syntax is easyto use, but is valid only for Cartesian coordinate systems.

When no coordinates have been specified, \psgrid takes the ones defined by the en-closing pspicture environment or, if not inside such an environment, a 10 × 10 rectanglein the current units is assumed. If only one coordinate pair is given, it is taken to denote onecorner and (0,0) is established as the opposite corner. When using two coordinate pairs,any two opposite corners of the grid should be specified. With three coordinate pairs given,the first pair determines the intersection point of the lines to be labeled and the other twopairs are interpreted as in the previous case.

In short: (x0,y0) defaults to (x1,y1); the default for the latter is (0,0), and (outsideof a pspicture environment) the default for (x2,y2) is (10,10).

The labels are positioned along the two lines that intersect at (x0,y0), on the side of theline pointing away from (x2,y2), and shifted slightly horizontally or vertically towards thelatter coordinate so they won’t interfere with other lines. In the next example, \psgrid hasno arguments, so it takes all coordinates from the surrounding pspicture environment.The keywords used in this and the following examples are discussed in detail in Section 5.5.1on the following page.

Example

5-5-1 -1 0 1 2-1

0

1

2

\usepackage{pstricks}

\psset{griddots=0,gridlabels=7pt,subgriddiv=2}\begin{pspicture}(-1,-1)(2,2)\psgrid

\end{pspicture}

With only one pair of coordinates, \psgrid assumes that (0,0) is the opposite corner.Exchanging the order of the coordinate pairs, as in the second figure, changes the positionof the labels from the left and bottom sides to the right and top sides of the rectangle, respec-tively. (See also the last example below with three pairs of coordinates.)

Example

5-5-2 0 10

1

2 102

1

0

\usepackage{pstricks}

\begin{pspicture}(-1,-1)(2,2)\psgrid[griddots=0,gridlabels=7pt,subgriddiv=2](1,2)

\end{pspicture}\begin{pspicture}(-1,-1)(2,2)\psgrid[griddots=0,gridlabels=7pt,

subgriddiv=2](1,2)(0,0)\end{pspicture}

ch-pstricks2.tex,v: 1.48 2007/04/21

Page 41: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:37 — page 288 — #76

288 HARNESSING POSTSCRIPT INSIDE LATEX: PSTRICKS

This is also demonstrated in the next example.

0 1 2 30

1

2

3

4

\usepackage{pstricks,pst-plot}

\begin{pspicture}[showgrid=true](3,4)\pscustom[linewidth=1.5pt]{%\translate(0,1)\psplot{0}{3}{x 180.0 mul 1.5 div sin}\translate(2,0)\swapaxes\psplot[liftpen=2]{0}{3}{x 180.0 mul 1.5 div sin}}

\end{pspicture}Example

5-13-18

\msave \mrestore

With this pair of macros, the currently valid coordinate system may be saved and restored,respectively. In contrast to what happens with \gsave and \grestore pairs, all other val-ues such as line type, thickness, etc., will remain unaffected. The \msave and \mrestorecommands must be used in pairs! They can be nested arbitrarily both with themselves andwith \gsave and \grestore. Care must be taken to ensure that this nesting is pairwisebalanced.

The next example plots the first sine function with the origin of ordinates set by\translate(0,1.5). Thereafter, the state of the coordinate system is saved, a new ori-gin is set with \translate(1,2)1, and another sine function is plotted. Following that,the old state is restored with \mrestore and the origin of ordinates is back at (0,1.5)again. The later cosine function is plotted with this origin.

0 1 2 30

1

2

3

4 \usepackage{pstricks,pst-plot}

\begin{pspicture}[showgrid=true](3,4)\pscustom[linewidth=1.5pt]{%\translate(0,1.5)\psplot{0}{3}{x 180.0 mul 1.5 div sin}\msave

\translate(1,2)\scale{1 0.5}\psplot[liftpen=2]{-1}{2}{x 180.0 mul 1.5 div sin}

\mrestore\psplot[liftpen=2]{0}{3}{x 180.0 mul 0.5 div cos}}

\end{pspicture}Example

5-13-19

1Referring to the current origin (0,1.5) a \translate(1,2) corresponds to the absolute coordinates(1,3.5).

ch-pstricks10.tex,v: 1.59 2007/06/06

Page 42: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:37 — page 289 — #77

5.13 User styles and objects 289

\openshadow[settings]

The \openshadow command creates a copy of the current path, using the specified shadowkey values (see page 239). Whether the shadow path thus obtained is stroked or filled de-pends on the parameter settings supplied with \openshadow itself and/or \pscustom, ascan be seen in the example.

Example

5-13-20 0 1 2 30

1

2

3

4

\usepackage{pstricks,pst-plot}

\begin{pspicture}[showgrid=true](3,4)\pscustom[linewidth=2pt]{%\translate(0,3)\psplot{0}{3}{x 180.0 mul 1.5 div sin}\openshadow[shadowsize=10pt,shadowangle=-30,

shadowcolor=blue]}\pscustom[linewidth=2pt,fillcolor=red,

fillstyle=solid]{%\translate(0,1.5)\psplot{0}{3}{x 180.0 mul 1.5 div sin}\openshadow[shadowsize=10pt,shadowangle=-30,

shadowcolor=blue]}\end{pspicture}

\closedshadow[settings]

The \closedshadowcommand always creates a filled shadow of the region enclosed by thecurrent path, as if it were a non-transparent environment.

Example

5-13-21 0 1 2 30

1

2

3

4

\usepackage{pstricks,pst-plot}

\begin{pspicture}[showgrid=true](3,4)\pscustom[linewidth=2pt]{%\translate(0,3)\psplot{0}{3}{x 180.0 mul 1.5 div sin}\closedshadow[shadowsize=10pt,shadowangle=-30,

shadowcolor=blue]}\pscustom[linewidth=2pt,fillcolor=red,

fillstyle=none]{% <-- no effect!\translate(0,1.5)\psplot{0}{3}{x 180.0 mul 1.5 div sin}\closedshadow[shadowsize=10pt,shadowangle=-30,

shadowcolor=blue]}\end{pspicture}

The method used for producing the shadow should be noted. PSTricks simply cre-ates a copy of the closed path, translates it according to the demands of shadowsizeand shadowangle, fills it with shadowcolor, and then refills the original path withfillcolor, which is white by default. The \openshadowmacro doesn’t fill the original

ch-pstricks10.tex,v: 1.59 2007/06/06

Page 43: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:37 — page 290 — #78

290 HARNESSING POSTSCRIPT INSIDE LATEX: PSTRICKS

path with the current fillcolor, so that the underlying shadow copy is visible (and inthis example, not filled). The \closedshadowfills the original path, so that the underlyingcopy looks like a real shadow.

\usepackage{pstricks}

\begin{pspicture}(0,-0.25)(5,2)\pscustom[fillstyle=none,shadowcolor=lightgray,fillcolor=blue]{%

\psbezier(0,0)(1,1)(1,-1)(2,0) \psbezier(2,0)(3,1)(1,1)(2,2)\closepath\openshadow[shadowsize=10pt,fillcolor=white,shadowangle=30]}

\rput(2.5,0){%\pscustom[fillstyle=none,shadowcolor=lightgray,fillcolor=blue]{%

\psbezier(0,0)(1,1)(1,-1)(2,0) \psbezier(2,0)(3,1)(1,1)(2,2)\closepath\closedshadow[shadowsize=10pt,fillcolor=white,shadowangle=30]}}

\end{pspicture}

Example

5-13-22

This strategy is to be kept in mind when specifying, with the keyword \pscustom , afillcolor that differs from white: in such cases the macro \closedshadow has to begiven the correct fill color.

\movepath(dx,dy)

The \movepath command shifts the current path by (dx, dy). If the original path is neededlater on, the \movepath operation has to be encapsulated within a \gsave/\grestorepair.

0 1 2 3 40

1

2

3

\usepackage{pstricks,pst-plot}

\begin{pspicture}[showgrid=true](4,3)\pscustom[fillcolor=lightgray,fillstyle=solid]{%

\translate(0,1.5)\psplot{0}{3}{x 180.0 mul 1.5 div sin}\movepath(1,0.5)}

\psline[linestyle=dashed]{*->}(0,1.5)(1,2)\end{pspicture}

Example

5-13-23

ch-pstricks10.tex,v: 1.59 2007/06/06

Page 44: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:37 — page 313 — #1

C H A P T E R 6

The Main PSTricks Packages

6.1 pst-plot—Plotting functions and data . . . . . . . . . . . . . . . . . . . . . . . . . 3136.2 pst-node—Nodes and connections . . . . . . . . . . . . . . . . . . . . . . . . . . . 3346.3 pst-tree—Typesetting trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3666.4 pst-fill—Filling and tiling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3836.5 pst-3d—Shadows, tilting, and three-dimensional representations . . . . . . . . 3886.6 pst-3dplot—3-D parallel projections of functions and data . . . . . . . . . . . . 4006.7 Short overview of other PSTricks packages. . . . . . . . . . . . . . . . . . . . . . . 4176.8 Summary of PSTricks commands and keywords. . . . . . . . . . . . . . . . . . . . 459

The “main” packages of PSTricks nowadays have this name only for historical reasons.PSTricks is used for those packages listed in the pst-all package. We do not follow this listhere. Instead, we describe the most common ones (e.g., pst-plot, pst-node) in some detail.Section 6.7 then gives an overview of other packages, showing at least one characteristicexample to help you understand the purpose of each package and approach that it takes.

6.1 pst-plot—Plotting functions and dataThe base package pstricks provides some macros to plot function values and coordinates,as listed in Table 6.1. All of these macros accept an arbitrary number of coordinate pairs asarguments.

The pst-plot package provides improved commands for plotting external data andfunctions as well as coordinate axes [59, 60, 131]. It supports only two-dimensional datapairs. For plotting (x, y, z) data triplets or three-dimensional functions, you can use thepst-3dplot package discussed in Section 6.6, which supports a parallel projection of 3-D ob-jects [132, 134].

Page 45: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:37 — page 326 — #14

326 THE MAIN PSTRICKS PACKAGES

In contrast to the preceding plot commands, the argument of \listplot is first ex-\listplot panded if it contains TEX macros; otherwise, it is passed to PostScript without change. In

the process, TEX macros are replaced with their corresponding replacement text. It is pos-sible to include entire PostScript programs in the argument to \listplot , as shown inExample 6-1-33.

The first example illustrates the Hénon attractor.

1−1−2

1 �

��

� ��

� ��

� �

��

\usepackage{pstricks,pst-plot}% definition of \henon with data points like this:% \newcommand\henon{ 1.00000000 1.00000000% 0.56000000 0.31000000% ... many more ...}

\psset{xunit=1.5cm, yunit=2.5cm}\begin{pspicture}(-2,-0.5)(1.5,1.25)\psaxes{->}(0,0)(-2,-0.5)(1.5,1.25)\listplot[showpoints=true,plotstyle=curve,

linecolor=blue]{\henon}\end{pspicture}

Example

6-1-32

The second example includes the watermark “DRAFT”, which was added to the originaldata with additional PostScript code.

1−1−2

1

DRAFT�

��

� ��

� ��

� �

��

\usepackage{pstricks,pst-plot}% \henon as in previous example\newcommand{\dataA}{\henongsave/Helvetica findfont 40 scalefont setfont45 rotate0.9 setgray-60 10 moveto (DRAFT) showgrestore }

\psset{xunit=1.5cm, yunit=2.5cm}\begin{pspicture}(-2,-0.5)(1.5,1.25)\psaxes{->}(0,0)(-2,-0.5)(1.5,1.25)\listplot[showpoints=true,linecolor=blue,

plotstyle=curve]{\dataA}\end{pspicture}

Example

6-1-33

Instead of modifying the data set passed to \listplot, you can redefine the\ScalePointsmacro in pst-plot. For example, if you wanted to exchange the x and y val-

ch-pst-packages1.tex,v: 1.59 2007/06/05

Page 46: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:37 — page 357 — #45

6.2 pst-node—Nodes and connections 357

It works only in conjunction with the \nput command (see page 359).

Example

6-2-54

AAAAA

AAAAAAAAAAAAAAAAAAAAAA A A A AAAA

AAAAAAAA

AAAAAAAAAAAAAAAAAAA A A A A A A AAA

AAAAAA

A

AAAAAAAAAAAAA

\usepackage{pstricks,pst-node,multido}

\begin{pspicture}(4.5,4.5)\cnode*(2,2){4pt}{A}\multido{\nA=0+10,\rB=0+0.5}{90}{%

\nput[rot=\nA,%labelsep=\rB pt]{\nA}{A}{A}}

\end{pspicture}

6.2.5 Putting labels on node connectionsIn Section 5.11 on page 265, we already discussed several commands that allow arbitraryplacement of marks with respect to labels. In the context of connections, there are somespecial commands to consider. After a connection has been drawn, the coordinates of twopoints are stored temporarily until a new connection is drawn. This data may prove veryuseful for positioning the labels to be attached to such a connection. Of course, it also impliesthat label commands should come immediately after connection commands.

In Section 6.2.4 on page 348, which discussed the allowed keywords, you will find manyexamples of the placement of labels. In this section we will review the various commandsonce again.

\ncput* [settings] {object} \naput* [settings] {object} \nbput* [settings] {object}

The n label commands are always based on the visible length of a connection, without atten-n labelstion to the actual node centers. By default, the label is placed in the middle of this visible

connection, which can be changed with the appropriate keyword. The letter c indicates con-nected (on the line), and a and b indicate above and below the line, respectively. The starredversions produce opaque material, which means you can overwrite lines with a label to gainincreased visibility.

Example

6-2-55 0 1 2 30

1

2

3

4

on

above

below

on

above

below

\usepackage{pstricks,pst-node}

\begin{pspicture}[showgrid=true](3,4)\cnode(0.1,0.1){0.1cm}{A} \cnode(2.9,2.9){0.1cm}{B}\ncline{<->}{A}{B} \ncput*{on}\naput[npos=0.75]{above} \nbput[npos=0.25]{below}\nccurve[angleA=110,angleB=100,linecolor=blue]{<->}{A}{B}

\ncput{\textcolor{blue}{on}}\naput[npos=0.75]{\textcolor{blue}{above}}\nbput[npos=0.25]{\textcolor{blue}{below}}

\end{pspicture}

ch-pst-packages2.tex,v: 1.70 2007/06/05

Page 47: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:37 — page 414 — #102

414 THE MAIN PSTRICKS PACKAGES

The keyword pOrigin is the positioning key, which is passed to the command \rput.The pOrigin key

Its effects concern only \pstThreeDPut, and the default value is based on the defaults for\rput (see Section 5.11.1 on page 266).

x y

z

xy

xz

yz \usepackage{pstricks,pst-3dplot}

\begin{pspicture}(-2,-1)(1,2.5)\pstThreeDCoor[xMin=-1,xMax=2,yMin=-1,

yMax=2,zMin=-1,zMax=2]\pstPlanePut[pOrigin=c](0,0,-1){\fbox{\Huge\red xy}}\pstPlanePut[plane=xz,pOrigin=rb](0,0,0)

{\fbox{\Huge\blue xz}}\pstPlanePut[plane=yz,pOrigin=lb](0,0,1.5)

{\fbox{\Huge\green yz}}\end{pspicture}

Example

6-6-28

The keyword hiddenLine enables a very simple “hidden-line algorithm”: the linesThe hiddenLine key are plotted with the command \pscustom and then filled with the predefined fill style

hiddenStyle.

\newpsstyle{hiddenStyle}{fillstyle=solid,fillcolor=white}

You can overwrite this style as required. Just keep in mind that the curves must be builtfrom the end to the beginning; otherwise, the hidden lines will be visible. For examples, seeSection 6.6.2 on page 406.

The keyword drawStyledefines the manner in which the function is plotted. PossibleThe drawStyle key key values are xLines, yLines, xyLines, and yxLines. The values refer to the plotting

sequence; that is, xLines has the lines drawn in the x direction, whereas yxLines meansthat they are first drawn in the y direction and then in the x direction.

x y

z

\usepackage{pstricks,pst-3dplot}% \func as defined in Example 6-6-13

\begin{pspicture}(-6,-3)(6,4)\psset{Beta=15,unit=0.75}\psplotThreeD[plotstyle=line,

drawStyle=xLines,yPlotpoints=50,xPlotpoints=50,linewidth=0.2pt](-4,4)(-4,4)

{\func}\pstThreeDCoor[xMax=5,yMax=5,

zMax=3.5]\end{pspicture}

Example

6-6-29

ch-pst-packages6.tex,v: 1.49 2007/06/06

Page 48: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:37 — page 415 — #103

6.6 pst-3dplot—3-D parallel projections of functions and data 415

Example

6-6-30

x y

z

\usepackage{pstricks,pst-3dplot}% \func as defined in Example 6-6-13

\begin{pspicture}(-6,-3)(6,4)\psset{Beta=15,unit=0.75}\psplotThreeD[plotstyle=curve,%

drawStyle=yLines,%hiddenLine=true,%yPlotpoints=50,xPlotpoints=50,%linewidth=0.2pt](-4,4)(-4,4){\func}

\pstThreeDCoor[xMax=5,yMax=5,zMax=3.5]\end{pspicture}

Example

6-6-31

x y

z

\usepackage{pstricks,pst-3dplot}% \func as defined in Example 6-6-13

\begin{pspicture}(-6,-3)(6,4)\psset{Beta=15,unit=0.75}\psplotThreeD[%plotstyle=curve,drawStyle=xyLines,%hiddenLine=true,%yPlotpoints=50,xPlotpoints=50,%linewidth=0.2pt](-4,4)(-4,4){\func}

\pstThreeDCoor[xMax=5,yMax=5,zMax=3.5]\end{pspicture}

The keywords visibleLineStyle and invisibleLineStyle refer to the The visibleLineStyleand invisibleLineStylekeys

drawing of bodies: the macro tries to identify hidden lines and draws them withthe line style invisibleLineStyle, while drawing the visible ones with the stylevisibleLineStyle.

Example

6-6-32

x

y

z

� \usepackage{pstricks,pst-3dplot}

\begin{pspicture}(-1,-1)(3,3.25)\psset{Alpha=30}\pstThreeDCoor[xMin=-3,xMax=1,yMax=2,zMax=4]\pstThreeDBox(-1,1,2)(0,0,2)(2,0,0)(0,1,0)\pstThreeDDot[drawCoor=true,linecolor=blue](-1,1,2)

\end{pspicture}

ch-pst-packages6.tex,v: 1.49 2007/06/06

Page 49: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:37 — page 446 — #134

446 THE MAIN PSTRICKS PACKAGES

\CylindreThreeD(0,0,0){10}{15} \CylindreThreeD(0,0,15){20}{5}\DemiSphereThreeD[RotX=180](0,0,35){20}\SphereCreuseThreeD[RotX=180](0,0,35){20}{ \psset{RotY=90,RotX=0,RotZ=30} \CylindreThreeD(15,15,5){5}{20} }\multido{\iCY=-45+90}{2}{\CylindreThreeD(45,\iCY,0){5}{50}

\DemiSphereThreeD(45,\iCY,50){5}}\end{pspicture}

Example

6-7-39

The pst-ob3d package

This package allows you to draw basic three-dimensional objects such as cubes (which canbe deformed to rectangular parallelepipeds) and dies. The package author is Denis Girou.

\usepackage{pst-ob3d}

\ThreeDput{\psframe[fillstyle=solid,fillcolor=black!15](6,6)\psgrid[subgriddiv=0,gridlabels=0,griddots=5](6,6)}

\psset{fillstyle=solid,dotscale=2,RandomFaces=true,Corners=true}\randomi=123456 \PstDie[fillcolor=black!10](1,3,0)\randomi=271354 \PstDie[fillcolor=black!20,viewpoint=1 0.3 1,

CornersColor=black!80](0.3,1.5,0)\psset{linecolor=white}\randomi=93850516 \PstDie[fillcolor=black!60,viewpoint=1 -0.5 1,

CornersColor=black!20](3,3,0)\randomi=8873165 \PstDie[fillcolor=black!40,viewpoint=1 -0.2 1,

CornersColor=black!10](2,5,0)

�� � �����

���

� � ���

�� �� �

��

�� ������

���

���

� ��� � � ��

��

� ��� �� � �������

� � ���� �

� �

���

����� � ��

� � �

Example

6-7-40

ch-pst-packages99.tex,v: 1.93 2007/06/15

Page 50: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:38 — page 467 — #1

C H A P T E R 7

The XY-pic Package

7.1 Introducing XY-pic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4677.2 Basic constructs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4697.3 Extensions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4747.4 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4787.5 Further examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509

XY-pic is a general-purpose drawing package based on TEX. It works smoothly with mostformats, including LATEX, AMS-LATEX, AMS-TEX, and plain TEX. It has been used to type-set complicated diagrams from numerous application areas, including category theory, au-tomata, algebra, geometry, neural networks, and knot theory. XY-pic’s generic syntax letsyou use a consistent mnemonic notation system that is based on the logical construction ofdiagrams by the combination of various elementary visual components. You can also writemacros by combining these basic elements consistently to form higher-level structures spe-cific to the intended application.

XY-pic was originally written by Kristoffer Høgsbro Rose [105]. Later Ross Moorejoined the development effort and the ensuing collaboration resulted in extensive revisionsand extensions [104, 106].

7.1 Introducing XY-picThe XY-pic system is built around an object-oriented drawing language called the kernel:this is a notation for composing “objects” with “methods” that correspond to the meaningfuldrawing operations on the object.

The kernel supports the following basic graphic notions (see Section 7.2):

• Positions can be specified in various formats. In particular, user-defined coordinatescan be absolute or relative to previous positions, objects, object edges, or points onconnections.

Page 51: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:38 — page 468 — #2

468 THE XY-pic PACKAGE

• Objects can have several forms—e.g., circular, elliptic, and rectangular—and can beadjusted in several ways, even depending on the direction of other objects. In particular,an object can be used to connect two other objects.

Enhancements to the kernel, called “options”, have two main varieties: extensions (seeSection 7.3) add more objects and methods to the repertoire (such as “curving” and “fram-ing”), while features (see Section 7.4) provide notations for particular application areas (e.g.,

“arrows”, “matrices”, “polygons”, “lattices”, “knots”). In general, extensions provide visualcomponents, whereas features add domain-specific notations for their logical composition.

This chapter gives examples of XY-pic’s use in various application areas. Through this“teach by example” approach, it serves as a complement to the XY-pic User’s Guide [106],which introduces the most used features, and the XY-pic Reference Manual [104], which de-scribes the syntax of all XY-pic commands and their arguments. A study of our examplesshould put you in an excellent position to start drawing your own diagrams; we hope it willalso convince you of the beauty, power, and flexibility of the XY-pic package.

XY-pic consists of various modules. If you are not sure which ones to load, it is probablyA first example ofXY-pic code best to load “a large set”, as follows:1

\usepackage[all]{xy}

Once you know enough about XY-pic to identify which functions you want to use, then youcan specify only the extensions or features that are actually needed. For instance,

\usepackage[curve,arrow,cmactex]{xy}

loads the curve extension and arrow feature, which are tuned to produce \special com-mands understood by Thomas Kiffe’s CMacTeX Macintosh port of TEX programs.

To get an idea of the philosophy on which XY-pic is based, let us first look at how we“construct” an XY-picture. To make things relatively easy, we consider a matrix-like diagram.As explained in more detail in Section 7.4.2, the principal way to create a diagram is with thecommand \xymatrix{spec}, where spec is the specification of the matrix entries, which, ingeneral, are aligned in rows and columns. Just as in a tabular environment, entries insidea row are separated by ampersands and successive rows are separated by \\.

A∑m

i=n i2

• D

�����������

\usepackage[all]{xy}

\[\xymatrix{A & *+[F]{\sum_{i=n}^m {i^2}} \\

& {\bullet} & D \ar[ul]}\]

Example

7-1-1

1For formats other than LATEX, use the command\input xy followed by \xyoption{all}. The all optionloads the curve, frame, tips, line, rotate, and color extensions as well as the matrix, arrow, and graphfeatures. Any other features or extensions needed must be loaded separately.

ch-xypic.tex,v: 1.47 2007/06/03

Page 52: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:38 — page 469 — #3

7.2 Basic constructs 469

This example has two rows of three columns and shows a good deal about how XY-picinterprets commands.

• By default, entries inside XY-pic environments are typeset in mathematics mode, using“text style”, and are centered.

• In many cases you may not start entries with a bare macro name—such names must beenclosed in braces or be otherwise “protected”.

• As in a tabular environment, empty entries at the end of rows can be omitted if notreferred to.

• Elements can be addressed by their relative (“logical”) position in the diagram; thus\ar[ul] draws an arrow from the “current” position to the matrix cell “one up andone to the left”.

• The format and shape of an element can be customized by specifying an “entry modi-fier” (e.g., “[F]” tells XY-pic to frame the entry).

If you have questions or need some help, you can address the XY-pic mailing [email protected], to which you can subscribe by visiting the Web sitehttp://tug.org/mailman/listinfo/xy-pic.

7.2 Basic constructsA thorough knowledge of how XY-pic interprets the various commands will let you exploitits many functions fully. It will also help you understand the subtleties of the various exten-sions and features introduced in later sections.

A kernel XY-picture is enclosed in an xy environment:1

\begin{xy}. . .\end{xy}

The location at which an XY-pic object is being “dropped” is called its “position”. In fact, inmost cases only the coordinates or shape of the “current position” is set.

7.2.1 Initial positionsThe simplest form of XY-pic position is called absolute, written <X,Y>. The coordinates Xand Y are the offsets right and above the origin of the picture, which thus lies at <0cm,0cm>.Simple arithmetic operators can be used to position the current point. A comma is used toseparate one position from another:

Example

7-2-1 DL DR

UL UR

5, 5

\usepackage{xy}

\[\begin{xy}0*{DL} ,+/r1cm/*{DR}

,<0cm,1cm>*{UL} ,<1cm,1cm>*{UR},(5,5)*{5,5}\end{xy}\]

1When using XY-pic with formats other than LATEX, use \xy. . .\endxy.

ch-xypic.tex,v: 1.47 2007/06/03

Page 53: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:38 — page 484 — #18

484 THE XY-pic PACKAGE

Squares and triangles can be easily combined to create more complex diagrams. A spe-cial kind of diagram is the “pullback”, which is created as follows.

Y Zg

X ×Z Y

Y

g

��

X ×Z Y Xp X

Z

f

��

T

X

x

�������

������

������

���T

X ×Z Y

(x,y)

��

T

Y

y

��

\usepackage{diagxy}

\[\bfig\pullback|brra|

[X\times_ZY‘X‘Y‘Z;p‘g‘f‘g]%/>‘{.>}‘>/[T;x‘(x,y)‘y]

\efig\]Example

7-4-9

In homology one often encounters 3 × 3 and 3 × 2 diagrams. They are typeset withthe \iiixiii and \iiixii commands, respectively, whose default behavior is displayedin the following examples. The usual order for the arrow parameters is first all horizontalarrows and then all vertical ones, left to right, and then top to bottom.

\usepackage{diagxy}

$\bfig \iiixiii[A‘B‘C‘D‘E‘F‘G‘H‘I; 1‘2‘3‘4‘5‘6‘7‘8‘9‘10‘11‘12] \efig$\quad$\bfig \iiixii[A‘B‘C‘D‘E‘F; 1‘2‘3‘4‘5‘6‘7] \efig$

G H5

H I6

E F4 D E3

A B1 B C

2 C

F

9

��

B

E

8

��

A

D

7

��D

G

10

��

E

H

11

��

F

I

12

��

D E3

E F4

A B1 A

D

5

��

B C2 B

E

6

��

C

F

7

��

Example

7-4-10

A more interesting example of a 3 × 2 diagram is the following, where we add annota-tions (text and matrices) to the arrows. The placement of the arrow labels is specified withthe first argument. Recall the order in which the arrow characteristics should be specified(see Example 7-4-10). We also load the amsmath package since we use the pmatrix envi-ronment.

\usepackage{diagxy,amsmath}

\[\bfig\iiixii|aaaalmr|<1000,800>

[X‘Y‘Z‘X\oplus X_0‘Y\oplus X_0\oplus Z_0‘Z\oplus Z_0;f_1‘f_2‘\begin{pmatrix}f_1&0\\0&1\\0&0\end{pmatrix}‘

\begin{pmatrix}f_2&0&0\\0&0&1\end{pmatrix}‘

ch-xypic.tex,v: 1.47 2007/06/03

Page 54: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:38 — page 485 — #19

7.4 Features 485

\begin{pmatrix}1\\0\end{pmatrix}‘\begin{pmatrix}1\\0\\0\end{pmatrix}‘\begin{pmatrix}1\\0\end{pmatrix}]

\efig\]

Example

7-4-11 X ⊕ X0 Y ⊕ X0 ⊕ Z0

⎛⎜⎜⎝

f1 00 10 0

⎞⎟⎟⎠

Y ⊕ X0 ⊕ Z0 Z ⊕ Z0

⎛⎝f2 0 0

0 0 1

⎞⎠

X Yf1 X

X ⊕ X0

⎛⎝1

0

⎞⎠

��

Y Zf2 Y

Y ⊕ X0 ⊕ Z0

⎛⎜⎜⎝

100

⎞⎟⎟⎠

��

Z

Z ⊕ Z0

⎛⎝1

0

⎞⎠

��

Finite-state and stack diagrams

Finite-state diagrams can also be typeset in a straightforward way:

Example

7-4-12

in ���������1

b

�� a���������2

a

b���������3����

a

��

b���������BCDEFGHI4

����

a

���

����

b

��

\usepackage[matrix,curve,arrow,tips,frame]{xy}

\[\UseTips\entrymodifiers={++[o][F]}\xymatrix @-1mm {*+\txt{in} \ar[r]& 1 \ar@(dr,dl)[]^b \ar[r]_a& 2 \ar@(d,dl)[]^a \ar[r]_b& 3 \ar ‘u[l] ‘^d[l]_a [l] \ar[r]_b& *++[o][F=]{4}\ar ‘dl_l[ll]+/d6mm/‘l_ul[ll]^a [ll]\ar ‘u^l[lll]+/u1cm/‘l^d[lll]_b [lll]

}\]

In this kind of diagram,1 all states (elements) are enclosed in circles; here we use the\entrymodifiers command to specify the default modifier to realize this goal. To getnice arrowheads on the end of curves, we use Computer Modern tips. To keep the diagram alittle more compact, we reduce the interelement spacing by 1 mm (@-1mm before the openingbrace of the \xymatrix command). Starting an entry with an asterisk (i.e., using the form*〈object〉) overrides the default settings from\entrymodifiers; this feature is used in theleftmost cell to eliminate the frame and in the rightmost cell to typeset a double circle. Notethat in the latter case the complete modifier specification had to be given. The only othertricky bit is the use of displacements towards the exterior, which add 6 mm (for a) and 1 cm(for b) in establishing the locations of the turns.

1We based our example on the deterministic finite automaton diagram in [7, p. 136]; another representationof the same diagram can be found in [106, Section 3.4], and we also used it for Example 3-4-10 on p. 79.

ch-xypic.tex,v: 1.47 2007/06/03

Page 55: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:38 — page 506 — #40

506 THE XY-pic PACKAGE

Note the use of the ^ character in the first position of the label “5”, which places the label“above” the arrow while the (default) _ character places it “below”.

\usepackage[curve,knot,graph,dvips]{xy}

\[\xygraph{!{0;/r10mm/:}!{\vover}

[u] !{\hcap[-2]}[d] !{\vover-}

[ruu] !{\hcap[2]}}\]\[\begin{xy} 0;/r10mm/:

,\hcap[-2]\vunder\vunder-,+(1,2),\hcap[2]

\end{xy}\]Example

7-4-39

Since all knot crossings are, by default, bounded by a rectangle of one coordinate unit,and since loop and cap commands do not change the current point, it is convenient to use thegraph feature to put together the various pieces of knot crossings and joins. This is shownin the top part of Example 7-4-39, where the \vover and \hcap commands position theelements by using “turtle” movements (up, down, left, right). The bottom part presents avariant diagram in which an explicit coordinate move was used to place the final \hcap.Note the use of the scaling factors, [2] or [-2].

Commands are also available to combine pieces in which the strings are basically atangles of 45 degrees, as in this next example.

a

b

c

d

e

f g

h

i

j

k

l

\usepackage[curve,knot,arrow,dvips]{xy}

\[\renewcommand{\labelstyle}{\scriptstyle}\begin{xy} 0;/r8mm/:,{\xcapv-|{a}}, +(0,1) ,{\xcaph|{b}\xunderh|{c}%

\xcaph|{d}\xcapv|{e}},-(3,0),{\xoverh|{f}},+(1,0),{\xoverh|{g}},-(3,1),{\xcapv-|{h}\xcaph-|{i}},+(0,1),{\xunderh-|{j}},+(0,-1),{\xcaph-|{k}},+(0,1),{\xcapv|{l}}\end{xy}\]

Example

7-4-40

The placement of the various pieces in this construction is easy to follow by looking at thelabels.

ch-xypic.tex,v: 1.47 2007/06/03

Page 56: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:38 — page 511 — #1

C H A P T E R 8

Applications in Science,Technology, and Medicine

8.1 Typographical rules for scientific texts . . . . . . . . . . . . . . . . . . . . . . . . . 5128.2 Typesetting chemical formulae . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5188.3 Alignment and topology plots in bioinformatics . . . . . . . . . . . . . . . . . . . 5478.4 Drawing Feynman diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5558.5 Typesetting timing diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5728.6 Electronics and optics circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 576

Because of its unsurpassed mathematical typesetting, TEX is widely used in the area of sci-ence, technology, and medicine (STM). It is not surprising, therefore, that the STM commu-nity has developed a number of packages to typeset the diagrams and schematics neededin their various disciplines. Chapter 8 of The LATEX Companion, Second Edition [83], de-scribes in detail the AMS-LATEX package, which makes marking up (higher) mathematicsrather more convenient than with TEX’s basic commands. Chapter 10 of that book mentionsa few simple packages, such as epic, eepic, and pspicture (or the recently released pict2e),which complement LATEX’s picture environment for drawing “simple” generic graphics. Ofcourse, the general packages, such as �������� (Chapters 3 and 4) and PSTricks (Chap-ters 5 and 6), or even the slightly more directed XY-pic package (Chapter 7) may provide allthe functionality you need to typeset even the most complex graphics. Nevertheless, the spe-cific needs of a given user community are often better served by a more targeted approach;the packages covered in this chapter address such problem areas.

In scientific texts, precision and consistency are of the utmost importance. Thereforewe start with a brief discussion of typographic conventions in scientific texts. The next twosections describe packages for typesetting chemical structures and complex biological pro-tein topologies. Section 8.4 explores various ways of constructing Feynman diagrams, an

Page 57: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:38 — page 512 — #2

512 APPLICATIONS IN SCIENCE, TECHNOLOGY, AND MEDICINE

important tool used by physicists. The last two sections turn to electronics and describe ded-icated packages for drawing timing and circuit diagrams.

8.1 Typographical rules for scientific textsIn scientific texts the typographic representation of a symbol carries a semantic meaning.Authors working in these areas should, therefore, be aware of and adhere to these typograph-ical conventions. A brief summary of the most important rules for composing scientific textsfollows (see also [52, 53, 56, 69]).

The most important rule in all circumstances is consistency: a given symbol should al-ways be presented in the same way, whether it appears in the text body, a title, a figure, atable, or a formula; on the main line or as a superscript or subscript. An important corollaryfor LATEX users is this: always typeset a symbol in either math or text mode—never mix thetwo, even if the results appear to be the same. Indeed, with LATEX, the final visual appearancemay change substantially when using a different class file or after adding a new package. Forexample, when using PostScript fonts, digits in text are taken from the PostScript text faceand can look quite different from those in formulae. Therefore, it is good practice to alwaystypeset numbers that refer to a result or part of a formula in math mode—i.e., surroundedby $.

In scientific texts, many symbols are traditionally typeset as Roman (upright) charac-ters1 and may not be understood properly otherwise. The most important such symbols aredescribed here:2

• Units—for example, g, cm, s, keV. Note that physical constants are usually set in ital-ics, so that units involving constants are mixed Roman–italics, e.g., keV/c (where c isthe speed of light, a constant). Unit symbols are never followed by a period (see Sec-tion 8.1.1).

• Chemical elements—for example Ne, O, Cu—and elementary particle names—for ex-ample, p, K, q, H. To help the typist produce typographically correct texts, packagesthat contain commands representing the various names have been developed. In par-ticular, chemists can use chemsym (see Section 8.1.2), while the PEN (Particle EntityNotation) scheme has been proposed for high-energy physics [34].3

• Standard mathematical functions (sin, det, cos, tan, �, �, etc.), for which the built-inLATEX functions should be used.

• Numbers.

1With LATEX, Roman type in mathematics mode can be achieved by the \mathrm command.2See http://physics.nist.gov/Document/typefaces.pdf for a convenient two-page overview.3Andy Buckley’s heppennames package is an implementation of the PEN notation. He also wrote

hepnicenames, which complements heppennames by providing more “user-friendly” names for often-occurringparticles. These packages do, however, allow you too much freedom by offering the possibility to define the outputstyle for the particle names. For instance, you can typeset their symbols in italic, a style still often (wrongly) usedin American physics journals, rather than in Roman, as mandated by the IUPAP rules [56] described here. SeeSection 8.4.2 for an example of how these packages are used in practice.

ch-science.tex,v: 1.59 2007/06/15

Page 58: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:38 — page 513 — #3

8.1 Typographical rules for scientific texts 513

Table 8.1: The importance of typographic rules in scientific texts

Roman Type Italic TypeA ampere (electric unit) A atomic number (variable)e electron (particle name) e electron charge (constant)g gluon (particle name) g gravitational constantl liter (volume unit) l length (variable)m meter (length unit) m mass (variable)p proton (particle name) p momentum (variable)q quark (particle name) q electric charge (variable)s second (time unit) s c.m. energy squared (variable)t tonne (weight unit) t time (variable)V volt (electric unit) V volume (variable)Z Z boson (particle name) Z atomic charge (variable)

• Names of waves or states (p-wave) and covariant couplings (A for axial, V for vector);names of monopoles (E for electric, M for magnetic).

• Abbreviations that are pieces of words (exp for experimental; min for minimum).

• The “d” in integrands (e.g., dp).

Obeying these typesetting conventions helps the reader understand at first glance themeaning of a symbol. Table 8.1 shows a few examples in which the meaning of a symboldepends on its typographic representation.

8.1.1 Getting the units rightThe importance of correctly typesetting units was recognized early, and several authors havedeveloped packages to help users in this respect. Axel Reichert made a first step with his unitsand nicefrac packages. More recent and complete approaches are Patrick Happel’s unitsdefpackage and Danie Els’s SIstyle package. Both contain useful rules for expressing values ofquantities.1 SIstyle can be used together with Marcel Heldoorn’s SIunits package. This pack-age, which we shall describe next, is by far the more complete and provides full support forall units defined by the International System of Units (abbreviated SI2 ), the modern form ofthe metric system. It is the world’s most widely used system of units, both in everyday com-

1The requirements for formatting and typesetting of SI units and numbers are described in the NIST (NationalInstitute of Standards and Technology) document http://physics.nist.gov/Document/sp811.pdf. Avery handy checklist for reviewing compuscripts is available from http://physics.nist.gov/cuu/Units/rules.html.

2From the French name Système International d’Unités. The SI was adopted by the “General Conference onWeights and Measures”, which is also known under its French acronym CGPM (Conférence Générale des Poidset Mesures; see http://www.bipm.fr/en/convention/cgpm/). The CGPM meets in Paris once every fouryears, and the last CGPM was held in October 2003. The SI is a coherent system based on seven base units asdefined in the CGPM 1960 and subsequent conferences. An overview of the SI system is available in the brochurehttp://www1.bipm.org/utils/common/pdf/si_brochure_8_en.pdf (eighth edition, 2006).

ch-science.tex,v: 1.59 2007/06/15

Page 59: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:38 — page 540 — #30

540 APPLICATIONS IN SCIENCE, TECHNOLOGY, AND MEDICINE

Configurations, conformations, and reaction schemes

Numerous configurations of tetrahedral molecules with wedged bonds can be drawn us-ing variants of the command \tetrahedral. For instance, the following Fischer dia-gram, which shows the absolute configuration of the sugar D-glucose, uses four nested\tetrahedral commands.

C

CHO

H OH

CHO H

CH OH

CH OH

CH2OH

\usepackage{xymtexps}

\changeunitlength{0.09pt}\tetrahedral{0==C;1A==CHO;%

2B==H;4B==OH;3A==%\tetrahedral{0==C;1==(yl);%

2B==HO;4B==H;3A==%\tetrahedral{0==C;1==(yl);%

2B==H;4B==OH;3A==%\tetrahedral{0==C;1==(yl);%

2B==H;4B==OH;3A==CH$\sb{2}$OH}}}}Example

8-2-39

Finally, reaction schemes containing tetrahedral molecules with wedged bonds can alsobe handled. For instance, consider the Walden inversion reaction, which is drawn with thehelp of the chemeqn environment and the \reactrarrow command, both of which aredefined in the chemist package (part of the XΥMTEX distribution).

\usepackage{xymtexps,chmst-ps}

\begin{chemeqn}HO\sp{-}~+~\raisebox{-28pt}{\ltetrahedralS{0==C;1==Cl;%

2==C$\sb{3}$H$\sb{7}$;%3A==CH$\sb{3}$;4B==C$\sb{2}$H$\sb{5}$}}

\reactrarrow{0pt}{1cm}{}{}\qquad\raisebox{-28pt}{\dtrigpyramid[{0{~~$\delta+$}}]%

{0==C;4A==HO$\sp{\delta-}$;%5A==Cl$\sp{\delta-}$;%1==C$\sb{3}$H$\sb{7}$;%2A==CH$\sb{3}$;%3B==C$\sb{2}$H$\sb{5}$}}

\quad\reactrarrow{0pt}{1cm}{}{}\quad\raisebox{-28pt}{\rtetrahedralS{0==C;1==HO;%

2==C$\sb{3}$H$\sb{7}$;%3A==CH$\sb{3}$;4B==C$\sb{2}$H$\sb{5}$}}

~+~Cl\sp{-} \label{myeqn}\end{chemeqn}

��− + C Cl

C3H7

CH3C2H5

δ+CHOδ− Clδ−

C3H7

CH3C2H5

CHO

C3H7

CH3C2H5

+��−

(1)Example

8-2-40

ch-science.tex,v: 1.59 2007/06/15

Page 60: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:38 — page 551 — #41

8.3 Alignment and topology plots in bioinformatics 551

8.3.2 Membrane protein topology plotsEric Beitz also wrote the textopo package, which provides a LATEX interface to generateshaded membrane protein topology plots. This package provides two new environments,textopo and helicalwheel.

The textopo environment displays schematic topology plots of membrane proteins. Itallows you to import sequence and topology data or alignment files in various formats. Youcan also manually enter the sequence and the positions of the membrane spanning domainswithin the environment. The package implementation will generate a basic layout from thesedata, which can be further adjusted by adding labels, special styles for the presentation ofresidues, automatic or manual shading, and annotations.

\begin{textopo}[parameterfile]textopo commands

\end{textopo}

The parameter file parameterfile, which is optional, can contain any command defined by thetextopo package to specify user parameter settings. The textopo environment itself mustcontain at least one command to load the sequence and topology data for the protein thatmust be plotted (i.e., \getsequenceor \sequenceand\MRs, which specify the positionsof the membrane regions).

The following example, which uses the file AQP1.PHD, comes with the distribution.

Example

8-3-6

extra

intra

H2N–•◦M•◦A•◦S•◦E•◦I•◦K•◦K•◦K•◦L•◦F•◦W•◦R•◦A•◦V•◦V•◦A•◦E•◦F•◦L•◦A•◦M•◦T•◦L•◦F•◦V•◦F•◦I•◦S•◦I•◦G•◦S•◦A•◦L

•◦G•◦F•◦N•◦Y•◦P•◦L•◦E•◦R•◦N•◦Q•◦T•◦L•◦V•◦Q•◦D•◦N•◦V•◦K•◦V•◦S •◦L•◦A•◦F •◦G•◦L•◦S •◦I•◦A•◦T •◦L•◦A•◦Q •◦S•◦V•◦G•◦H•◦I•◦S•◦G•◦A•◦H•◦S•◦N•◦P•◦A

•◦V•◦T•◦L•◦G•◦L•◦L•◦

L•◦S•◦C•◦Q•◦I•◦S•◦I•◦L•◦R•◦A•◦V•◦M•◦Y•◦I•◦I•◦A•◦Q•◦C•◦V•◦G•◦A•◦I•◦V•◦A•◦S•◦A•◦I•◦L•◦S•◦G•◦I•◦T•◦S•◦S•◦L•◦L•◦

E•◦N•◦S•◦L•◦G•◦R•◦N•◦D•◦L•◦A•◦R•◦G•◦V•◦N•◦S•◦G•◦Q•◦G•◦L •◦G•◦I•◦E •◦I•◦I•◦G •◦T•◦L•◦Q •◦L•◦V•◦L •◦C•◦V•◦L•◦A•◦T•◦T•◦D•◦R•◦R•◦R•◦R•◦D•◦L•◦G•◦G•◦S•◦A•◦P•◦L•◦A•◦I•◦G•◦L•◦S•◦V•◦A•◦L•◦G•◦H•◦L•◦L•◦A•◦I•◦D•◦Y•◦T

•◦G•◦C•◦G•◦I•◦N•◦P•◦A•◦R•◦S•◦F•◦G•◦S•◦A•◦V•◦L•◦T•◦R•◦N•◦F•◦S•◦N•◦H•◦W•◦I•◦F•◦W•◦V•◦G •◦P•◦F•◦I •◦G•◦S•◦A •◦L•◦A•◦V •◦L•◦I•◦Y •◦D•◦F•◦I•◦L•◦A•◦P•◦R•◦S•◦S•◦D•◦F•◦T•◦D•◦R•◦M•◦K•◦V•◦W•◦T•◦S•◦G•◦Q•◦V•◦E•◦E•◦Y•◦D•◦L•◦D•◦A•◦D•◦D•◦I•◦N•◦S•◦

R•◦V•◦M•◦K•◦P•◦

K –COOH

\usepackage[]{textopo}

\begin{textopo}\getsequence{PHD}{AQP1.phd}% no transmembrane labels\hideTMlabels% small font size (range 1-10)\scaletopo{2}\end{textopo}

The second environment, helicalwheel, is in its functionality quite similar totextopo, but produces output that shows helical transmembrane spans as helical wheels

ch-science.tex,v: 1.59 2007/06/15

Page 61: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:38 — page 584 — #74

584 APPLICATIONS IN SCIENCE, TECHNOLOGY, AND MEDICINE

command sequence for this precedure on a Unix machine would be similar to the following(depending on where the m4 files are stored):

m4 /usr/local/lib/m4/libcct.m4 cirexa.m4 > cirexa.picgpic -t cirexa.pic > cirexa.tex

This leaves us with a TEX file cirexa.tex, which contains only the tpic code for the exam-ple. To process it further, we could include it into a LATEX source using \input. This storesthe picture in a box register named \graph, so we have to add a \usebox{\graph} state-ment into the document at the spot where we want it to appear.

Customizing the diagram

To show the flexibility of the circuit_macros approach, let us modify our exampleslightly to see how it behaves with an alternating current.

Vac

R

L

iLω

C1

iCω

.PScct_initlinethick=1.6define(‘dimen_’,0.6)loopwid = 0.9; loopht = 0.7

source(left_ loopwid,AC); llabel(,V_{ac},)resistor(up_ loopht,5); llabel(,R,)inductor(right_ loopwid,W); rlabel(,L,); llabel(,iL\omega,)capacitor(down_ loopht,); llabel(,C,)

rlabel(,\displaystyle\frac{1}{iC\omega},).PE\usebox{\graph}

Example

8-6-11

After specifying thick lines, we draw an alternating current (AC) source. The resistoris made a little bigger, and we specify a complex value for the impedance of the self and thecapacitor. Note how we place text at either side of the element with the llabel and rlabelcommands. As the label text is set in mathematics mode, you can freely use math symbolsand other specific commands for math mode (e.g., \displaystyle to choose a larger typesize for the capacitor’s numerator and denominator).

Some authors prefer to draw their circuit elements using a grid. We can write an m4macro grid, which has two arguments $1 and $2 that define the x and y coordinates atwhich the element is to be drawn.

−+V

R

L

C

.PScct_initgridsize = 0.1define(‘grid’,‘(gridsize*‘$1’,gridsize*‘$2’)’)

source(left_ from grid(7,0) to grid(0,0),V); llabel(,V,)resistor(up_ from grid(0,0) to grid(0,5),4); llabel(,R,)inductor(right_ from grid(0,5) to grid(7,5),W); llabel(,L,)capacitor(down_ from grid(7,5) to grid(7,0)); llabel(,C,)

.PE\usebox{\graph}

Example

8-6-12

ch-science.tex,v: 1.59 2007/06/15

Page 62: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:38 — page 587 — #1

C H A P T E R 9

Preparing Music Scores

9.1 Using TEX for scores—An overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . 5899.2 Using MusiXTEX. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5909.3 abc2mtex—Easy writing of tunes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6009.4 Preprocessors for MusiXTEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6159.5 The PMX preprocessor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6189.6 M-Tx—Music from TeXt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6519.7 The music engraver LilyPond . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6619.8 TEXmuse—TEX and�������� working together . . . . . . . . . . . . . . . . . 666

Preparing music scores of high quality is a complex task, since music notation can representa huge amount of information about the structure and performance of a musical piece.1

While reading a score for performing a music piece, musicians must gather all the informa-tion they need, including the pitch and the length of the notes, the rhythm, and the articula-tion. Depending on the instrument, the musical notation may span more than a single stave(e.g., three or more for the organ), so the amount of data to be processed concurrently canbe quite large. This makes great demands on the musician’s ability, especially when sight-reading a piece. The quality of the typeset score plays an important role in this process sinceit must clearly show the structure of the piece.

High-quality music typesetting requires a good eye and much experience. Until recently,this type of work has been done by highly trained music engravers who manage, accord-ing to Helene Wanske [136], no more than one or two pages per day. As in typesettingof text, a criterion of high quality is the overall look of the page, especially the distribu-tion of black and white. Several texts about music notation practice have been published,but they cannot replace a practitioner when it comes to ensuring the aesthetic form of thescore as a whole. The Production Committee of the Music Publisher’s Association has pub-

1The Web site http://www.music-notation.info/ provides a set of pointers to music notation lan-guages, programs, fonts, etc.

Page 63: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:38 — page 588 — #2

588 PREPARING MUSIC SCORES

lished a text that outlines a series of standards for music notation (http://www.mpa.org/notation/notation.pdf). The Big Site of Music Notation and Engraving (http://www.coloradocollege.edu/dept/MU/Musicpress/) intends to provide a helpful sourcefor musicians, typesetters, students, publishers, and anyone else who is interested in musicnotation and engraving. See also Jean-Pierre Coulon’s Essay on the true art of music engrav-ing (http://icking-music-archive.org/lists/sottisier/sottieng.pdf).

In recent years several computer systems for writing scores have been devel-oped. Encore (www.encoremusic.com), Finale (www.finalemusic.com), and Sibelius(www.sibelius.com) are examples of commercial products, while Rosegarden (http://www.rosegardenmusic.com/) and noteedit (http://developer.berlios.de/projects/noteedit) are freely available developments. All of these programs are of theWYSIWYG (What You See Is What You Get) type, and most of them have reached a gen-uine state of perfection. However, they cannot yet replace an experienced music engraver.All they can do to ensure high-quality typesetting is to create a “nice” draft: they contributeto a high-quality score only if they leave the aesthetic decisions to the experienced user.

This role is even more evident when one considers nonstandard situations, which areencountered in modern music, for which notational requirements are hard to standardize atall. Indeed, music, as a live art form, evolves continuously, and its current practice is oftenquite distinct from that of the 18th and 19th centuries, when the “standard” music notationwas consolidated. Whereas standard notational practices are quite sufficient for popular andcommercial music (and thus the favored target for commercial software), “modern” musicgoes well beyond this traditional form, in particular in its graphic representation. Moreover,musicology has notational needs (e.g., symbols for highlighting certain notes, unusual ties,superposition of staves) for the analysis of all kinds of music—classical and contemporary,western and oriental, ethnic from various peoples of the world—that go well beyond the pos-sibilities of current professional typesetting applications. What is needed is a programmablesystem, and here TEX can be an important player.

In this chapter, after a short historical introduction (Section 9.1), we first considerMusiXTEX, a set of TEX macros that build a very powerful and flexible tool for typesettingscores. As MusiXTEX makes no aesthetic decisions—these choices must all be made by thetypesetter—it is quite complex to use. Therefore several preprocessors have been developedto provide an easier interface. In Section 9.3, we introduce the abc language, which is inwidespread use for folk tunes. In Section 9.5, we describe the PMX language, which makesentering polyphonic music more convenient. In Section 9.6, we have a look at the M-Tx lan-guage, an offspring of PMX, which adds, among other features, support for dealing withmulti-voice lyrics in scores. In Section 9.7, we introduce LilyPond, a music typesetter writ-ten in C++, while Section 9.8 says a few words about TEXmuse.

The Werner Icking Music Archive (http://icking-music-archive.org)containsa lot of material related to music software. In particular, it is the definitive archive of soft-ware related to MusiXTEX, including pointers to the latest developments of abc, PMX, M-Tx,and their brethren. It also contains hundreds of freely available music scores typeset withMusiXTEX, often with accompanying input files, so that it is an ideal source of examples.

This chapter is somewhat unusual as it contains little LATEX: MusiXTEX is essentially low-level TEX, albeit with a LATEX interface; some of the programs discussed to translate musicallanguages, such as abc, even bypass TEX altogether. We nevertheless believe that it is appro-

ch-music.tex,v: 1.55 2007/06/15

Page 64: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:38 — page 601 — #15

9.3 abc2mtex—Easy writing of tunes 601

a little practice, most users can play a tune directly from the abc notation (without gen-erating sheet music output). Moreover, the simplicity and clarity of the notation make ita straightforward matter to notate tunes that are stored in a computer file. In addition,these files can be easily exchanged by e-mail, thus enabling dissemination and discussionof the music. In fact, the abc language has become the de facto standard among folk musi-cians, and thousands of tunes in abc notation are now available on the Internet (see, e.g.,http://abcnotation.org.uk/tunes.html).

9.3.1 Writing an abc sourceTo see how an abc source is built up, consider the following example:

Example

9-3-1

1. Sur le pont d’Avignon

G2 24 ˇ ˇ ˇ ˇ ˇ ˇ ˇ ˇÐÐ

ˇ ˇ ˇÐÐˇ

G2 ˇ ˇ ˇ ˇ ˇ ˇ ˇ ˇÐÐˇ ˇ ææ (ˇ (ˇ

G2 ˇ ˇ ˇ ˇ ˇ ˇ ˇ ˇ ˇ ˇ ˇ ˇ ˇ

X:1T: Sur le pont d’AvignonM:2/4L:1/8K:F

FF F2 | GG G2 | ABcF | EFGC |FF F2 | GG G2 | ABcF | GE F || F |FF FF | G2 FF | FFFF | G2 F2 |]

An abc source consists of two parts: a header and a body. The header (shown in blue inthe examples) contains information fields, each starting with an uppercase letter to denotethe kind of information, followed by a colon. The body consists of the music piece itself.Within the body, additional information fields can be inserted that are used for changes tothe header information (e.g., the key, meter, or tempo).

Table 9.3 shows all possible information fields, most of which are optional. A few wordsabout the more important ones follow.

• Musical information:

– K: the key, consisting of a capital letter possibly followed by a # or b forsharp or flat, respectively. You can use major keys (e.g., K:Emaj) or minor keys(K:gmin), or specify other modes, such as Mixolydian (K:AMix) and Dorianmodes (K:EDor).

– L: the default note length (i.e., L:1/4 for a quarter note, L:1/8 for an eighth note,etc.). The default note length is also set automatically by the meter field M:.

– M: the meter, such as M:3/4, M:C (common time), or M:C| (cut time).

ch-music.tex,v: 1.55 2007/06/15

Page 65: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:38 — page 645 — #59

9.5 The PMX preprocessor 645

Example

9-5-36

Cb

Vc

Va

Vl II

Vl I

Tp

Tb (do)

Cr (do)

Fg

Ob

Fl

I

IKG

G

IG

G

IG

G

S

S

S

S

S

S

S

S

S

S

S

f

f

f

ˇf

f

ˇf

ˇˇf

ˇˇf

a2ˇf

a2ˇ

Allegro vivace

f

ˇ

?

?

?

?

?

>

>

>

?

?

?

3ˇ ŐŐŐŐ

3ˇ ŐŐŐŐ

3

ˇ ŐŐŐŐ3

ˇ ˇ ˇ3

ˇ ˇ ˇ

3ˇ ŐŐŐŐ

3

ˇ ŐŐŐŐ

3ˇŐŐŐŐˇ

ˇ

ˇ

ˇˇ

ˇ

ˇ

ˇ ˇ

ˇ ˇ

ˇ

ˇ

ˇ

?

?

?

?

?

>

>

>

?

?

?

3ˇ ŐŐŐŐ

3ˇ ŐŐŐŐ

3

ˇ ŐŐŐŐ3

ˇ ˇ ˇ3

ˇ ˇ ˇ

3ˇ ŐŐŐŐ

3

ˇ ŐŐŐŐ

3ˇŐŐŐŐˇ

ˇ > <

ˇ > <

ˇ > <ˇ > <ˇ > >

ˇ > <

ˇˇ > <

ˇˇ > <

ˇ > <

ˇ > <

ˇ> <

? ‰-ˇ

˘¯˘

ˇ` -ˇ

˘

˘

ˇ` -ˇ

=

=

=

=

=

=

=

˘

˘˘

˘

ˇ>

ˇ >

ˇ >

ˇ >

=

=

=

=

=

=

=

ch-music.tex,v: 1.55 2007/06/15

Page 66: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:38 — page 651 — #65

9.6 M-Tx—Music from TeXt 651

9.6 M-Tx—Music from TeXtAfter describing the PMX language we now turn to Dirk Laurie’s M-Tx language,1 whichadds a layer of convenience to PMX, making entering information—in particular, in thepreamble—more intuitive. By its very conception, it offers also a straightforward way foradding words (lyrics) to the music.

Let us first have another look at Section 9.4 on page 615, especially the example com-paring the coding of the first bars of the Mozart piece. One large difference between PMXand M-Tx coding is that, with M-Tx voice (instrument) lines are input as they are printed (i.e.,from top to bottom), whereas with PMX they are entered last line first (i.e., from bottom totop).

Example

9-6-1

IJPiano IG

44

44

Riff in CW. A. Mozart (1756–1791)

ˇ ˇ ˇ ˇ ˇ ˇ ˇ ˇ˘ ˇ ˇ

ˇ ˇ ˇˇ`

ˇˇĞĞĞĞˇ

ˇ ˇ ˇ ˇ˘

Title: Riff in CComposer: W. A. Mozart (1756--1791)Style: pianoName: PianoMeter: 4/4Size: 16Indent: 0.18

%% w70m

c2+ e4 g | b4d- c1 d c2 |c8 g+ e g c- g+ e g | d g f g c- g+ e g |

Example 9-6-1 was compiled by the M-Tx processor prepmx, which transforms the M-Txinput file into a PMX file to be run through the pmxab processor.

> prepmx 9-6-1==> This is M-Tx 0.60 (Music from TeXt) <16 March 2005>==>> Input from file 9-6-1.mtxWriting to 9-6-1.pmxinstrumentNames = TRUEPrePMX done. Now run PMX.

> pmxab 9-6-1This is PMX, Version 2.506, 14 Nov 04Opening 9-6-1.pmxStarting first PMX passBar 1 Bar 2Done with first passStarting second PMX passBar 1 Bar 2Writing ./9-6-1.texDone with second PMX pass.

The prepmx processor has several options, all of which are described in the M-Tx manual.

1The M-Tx entry on the home pagehttp://icking-music-archive.org/software/indexmt6.htmlof the Icking Music Archive provides pointers to the latest version of the distribution, manual, examples, andrelated utilities.

ch-music.tex,v: 1.55 2007/06/15

Page 67: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:38 — page 661 — #75

9.7 The music engraver LilyPond 661

9.7 The music engraver LilyPondIn 1996, in the previous edition of this book, we described Jan Nieuwenhuizen’s MPPMusiXTEX preprocessor [89]. Since then, Jan and his colleague Han-Wen Nienhuys have aban-doned that system and developed LilyPond,1 an “automated engraving system that formatsmusic beautifully and automatically and has a friendly syntax for its input files”. They nolonger use TEX as the basic typesetting engine but have developed a large C++ program(more than 6000 lines of code); they also use Python and Scheme code, as well as a speciallydesigned font family (feta), which is available in various formats (PostScript Type 1, Open-Type, and SVG).

9.7.1 The LilyPond source languageTo typeset one note, four kinds of information can be specified: notename, octave, duration,and features. Only the notename is mandatory. All this information is coded in the givenorder with no intervening spaces; a blank separates two notes.

Notes are denoted by lowercase letters. A comma (,) following the letter transposesthe note one octave deeper, while a right quote (’) makes it an octave higher. To generatedifferent clefs, use the command \clef followed by either treble, alto, tenor, or bass.The following example shows some pitches and ways to generate different kinds of bar lines.

{c d \bar "|" e f \bar "|:" g c’ \bar "||"d’ e’ \bar ":|" f’ g’ \bar ".|" c’ d’ \bar ".||." \breake’’ f’’ g’’ c’’’ \bar ":|:"d’’’ e’’’ f’’’ g’’’ \bar "|." c’ c c, c,, \bar ":" }

Example

9-7-1

�� ��� �� � ���� � ��� ��

����������

� ���

�4

� �� ��

1The LilyPond home page is at www.lilypond.org, where you can download the latest version of the system.There is also a tutorial, the reference guide, and much more. Of particular interest is the essay “What is behindLilyPond?”, which explains the authors’ views on problems in music notation (software) and their approach tosolving them.

ch-music.tex,v: 1.55 2007/06/15

Page 68: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/27 — 17:59 — page 667 — #1

C H A P T E R 10

Playing Games

10.1 Chess . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 668

10.2 Xiangqi—Chinese chess . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 687

10.3 Go . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 690

10.4 Backgammon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 696

10.5 Card games . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 698

10.6 Crosswords in various forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 702

10.7 Sudokus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 709

Board and card games have a long history, and thousands of books in many languages havebeen dedicated to chess, Go, cards, and the like. These books almost always use diagrams toexplain the rules or show the evolution of a game. In the present chapter we look at a numberof examples showing how to prepare such graphical presentations with LATEX.

Most game packages are concerned with making available either a special font for type-setting the right symbols or macros for producing nice examples of the state of play. Thehighly developed field of chess notation, however, lends itself well to an algorithmic typeset-ting system like LATEX. The chess packages, with which we begin, keep track of the state ofmoves and allow various forms of output.

We move next to the rather similar games of Chinese chess and Go, followed bybackgammon. We then look at cards, where the classic game of bridge has a special pack-age, before concluding the chapter with the esoteric subject of crossword and Sudoku puz-zles. Although crossword design is not a game, it has some similar typesetting problems,and LATEX-using crossword makers will enjoy using the sophisticated package to help them.In the case of Sudoku, there is even a package that generates new puzzles or solves existingones.

Page 69: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/27 — 17:59 — page 682 — #16

682 PLAYING GAMES

\ahead \dummy \ddummy

It is, of course, also possible to talk about the next move in a commentary started with \[ or[: simply prefix the first move inside with\ahead .

If certain moves are irrelevant for the analysis you can use \dummy or \ddummy to ad-vance the game state by one or two half-moves, respectively. This means that skak can’t fol-low the position on the board any longer, so texmate immediately disables this functionalitywith \SkakOff upon encountering these commands for the remainder of the variation.

French Defense analysis:1. e4 e6 2. d4 d5 3.¤c3¥d4 4. e×d5 e×d5 5.¥d3¤c6 6. a3 ¥e7 7. ¥f4! [7. . .¤×d4?! 8. ¥b5+!¤c6 9. ¤×d5 ¥d6 10. £e2+ ¤ge7 11. ¦d1 ¥d712.¥×c6¥×c6 13.¤×c7+!h] 7. . . a6! [7. . .¥e68. ¤f3 ¤f6 (8. . .¥g4 9. h3! ¥h5 10. ¤b5!¦c8¥f5!h) 9. ¤b5! ¦c8 10. ¤e5! ¤×e5 11. d×e5 . . .12.¤×a7] 8.¤f3!

\usepackage{texmate}\setchessfontfamily{leipzig}

French Defense analysis:\\| e4 e6 ; d4 d5 ; Nc3 Bd4 ; exd5 exd5 ;Bd3 Nc6 ; a3 Be7 ; Bf4! [ \ahead Nxd4?! ;Bb5+! Nc6 ; Nxd5 Bd6 ; Qe2+ Nge7 ;Rd1 Bd7 ; Bxc6 Bxc6 ; Nxc7+!\wdecisive ]a6! [ Be6 ; Nf3 Nf6 [ Bg4 ; h3! Bh5 ; Nb5!Rc8 ; Bf5!\wdecisive] ; Nb5! Rc8 ;Ne5! Nxe5 ; dxe5 \dummy\,\dots Nxa7 ] Nf3! |

Example

10-1-19

If there are multiple variations to discuss as alternatives at a certain point in the game,you can use the variations environment or its starred form.

\begin{variations}\var variation1 \var variation2 . . . \end{variations}

Inside the variations environment, each variation is introduced with a \var command.This will typeset the first move of a variation in boldface and separate variations by a semi-colon. Alternatively, you can use \var*, in which case no special formatting is applied. Thestarred form variations* of the environment is equivalent to using \var* for all varia-tions.

*+*+q+*++*+*N*+**+*+mO*K+*+*+*+**+*+lNo++pO*+*+**+*Pp+v++*+*+*+*

Mate in 3 moves by Bayersdorfer, 1888

1. ¤d3!E2. £a8+ ¢d4 3. £a4# [1. . .¤d42. ¤c5+ ¢e5 (2. . .¢f4 3. £b8#) 3. £b8# ;1. . . c×d2 2. ¤f5! E£×e6# ¢d5 (2. . .¢×f53.£g6#) 3.£a8#]

\usepackage{texmate}\setchessfontfamily{leipzig}

\position{4Q3/4N3/4np1K/8/4kNp1/1Pp5/3PP1b1/8}\shortstack{\showboard\\

Mate in 3 moves by Bayersdorfer, 1888}

| Nd3! \Threat<\withidea Qa8+ Kd4 Qa4 \#>[\ahead\begin{variations}

\var Nd4 Nc5+ Ke5 [Kf4 Qb8 \#] Qb8 \#\var cxd2 Nf5! \threat<Qxe6 \#>

Kd5 [Kxf5 Qg6 \#] Qa8 \#\end{variations}] |

Example

10-1-20

ch-games.tex,v: 1.60 2007/06/27

Page 70: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/27 — 17:59 — page 689 — #23

10.2 Xiangqi—Chinese chess 689

Example

10-2-2�

��

��

��

��

��

���

��

��

���

��

��

���

� �� �� �� �

� �

� � � � �

� � � �

� �

Figure 10.1: Initial setup of Chinese chess game (xiangqi)

The following listing, a mate situation after four moves, gives an example of the use ofthis command. The board situation after these four moves is shown in Example 10-2-4 onthe following page.

Example

10-2-3

1. � h3–e3 � b0–a8

2. � e3×e7 � a0–a9

3. � b3–b5 � h0–g8

4. � b5–e5 mates!

\usepackage{cchess}

\newcommand\x{$\times$} % a shortcut to denote capture\begin{tabbing}1. \= \textpiece{c}h3--e3 \qquad

\=\textpiece{N}b0--a8 \\2. \> \textpiece{c}e3\x e7 \>\textpiece{R}a0--a9 \\3. \> \textpiece{c}b3--b5 \>\textpiece{N}h0--g8 \\4. \> \textpiece{c}b5--e5 mates!\end{tabbing}

The position environment draws a complete board. Within its body, the \piececommand is used to place the individual pieces.

ch-games.tex,v: 1.60 2007/06/27

Page 71: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/27 — 17:59 — page 692 — #26

692 PLAYING GAMES

indicates the color of the first stone being placed. This method is most suitable to recordgames or longer sequences where the order of play needs to be indicated.

����������������������������������������������������������������������

�����������������������������������������������������������������������������������

\usepackage{igo}

\white[\igonone]{q3,q5,p5,p6,p4,q7}\showgoban[m1,t8]\white[6]{r5,r6,s5,n6,m4}\showgoban

Example

10-3-2

If \whiteor \black is used without an optional argument or if the optional argumentis \igotriangle , \igosquare , \igocircle , or \igocross , then all stones typesetare of the same color and decorated with the respective glyph as specified by the optionalargument. This input method is most suitable for documenting Go problems, where theorder of stones placed previously is unimportant.

�����������������������������������������������������������������������

������������������������������������������������������� ��������������������

\usepackage{igo}

\white{o3,q2,q3,q4,r2,r5,r6,r7}\black{p5,q5,r3,r4,s4,s5,t3}\showgoban\black[\igotriangle]{s2}\white[\igosquare]{s1}\gobansymbol{s3}{a}\gobansymbol{t4}{b}\white[1]{t2,t1}\showgoban

Example

10-3-3

\cleargobansymbols

Once the progress in a game has been shown in a diagram, it is customary to showthe already placed stones in later diagrams without numbers, achieved by issuing a\cleargobansymbols command. This helps in identifying newly placed stones andmakes the diagrams more readable. Whether numbering is continued is a matter of taste.Although igo supports sequentially numbered stones for a full game, for readability it is usu-ally better to restart numbering when three-digit numbers are reached and you can affordto typeset more than a single diagram.

�����������������������������������������

������������������ �������������� ��������������������������������

�����������������������������������������������������������������������������������

\usepackage{igo}

\white{q3}\showgoban[p1,t8]\black[1]{q5,p5,p6,p4,q7}\gobansymbol{r5}{a}\gobansymbol{o6}{b}\showgoban[n1,t8]\cleargobansymbols\white[6]{r5,r6,s5,n6,m4}\showgoban

Example

10-3-4

ch-games.tex,v: 1.60 2007/06/27

Page 72: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/27 — 17:59 — page 696 — #30

696 PLAYING GAMES

10.4 BackgammonJörg Richter’s package bg defines two LATEX environments, position and game, to displaybackgammon games. The position environment draws a single board and is thus conve-nient for discussing a problem, while with the game environment you can enter each moveindividually. In the latter case the board positions are stored internally, allowing the “cur-rent” status to be drawn at any time.

By convention, the homes of both players are on the left-hand side, with white’s homeat the top and black’s home at the bottom. Unlike in the other packages discussed so far,positions on the board are not denoted with absolute coordinates but rather are numberedas viewed by the party whose move is being placed (e.g., white’s 24 corresponds to black’s 1,and so on). Moves are always performed from high to low numbers, and the cube is alwayson the right-hand side of the board.

\begin{position} . . .\end{position}

The position environment initializes an empty board into which stones are placed by thecommands described below. Some of these commands also allow you to customize someaspects of the board’s layout. The board is printed when the \end{position} commandis encountered. Example 10-4-1 shows the use of various commands of the position envi-ronment.

������������ �������������������

�����

�����

�����

�����

�����

�����

�����

�����

�����

�� ��

�����

!����

�����

�����

"#���

�����

����������������������

$%&'(

)*+,-

$%&'.

)*+/0

$%&12

)*3/0

�����

����4

�����

$%&12

)*+,0

$%&'(

)*+,0

$%&'(

)*+,-

������������������

�56789:���;<DZ>?@

�����������������

White to play 3–2

\usepackage{bg}

\begin{position}\normalboard\whitepoint{3}{2} \whitepoint{4}{2}\whitepoint{5}{2} \whitepoint{6}{3}\whitepoint{7}{3} \whitepoint{8}{1}\whitepoint{11}{1} \whitepoint{22}{1}\blackpoint{24}{1} \blackpoint{13}{2}\blackpoint{10}{1} \blackpoint{8}{1}\blackpoint{7}{2} \blackpoint{6}{3}\blackpoint{5}{2} \blackpoint{4}{2}\blackbar{1}\shownumbers \middlecube{1} \showcube\whiteonmove\boardcaption{White to play 3--2}\end{position}

Example

10-4-1

\blackpoint{p}{n} \whitepoint{p}{n}

These two commands are used to place stones on the board; n denotes the number of stonesto place and p denotes the point where they are positioned. It is important to remember thatthese points are numbered downwards from 24 relative to the home position of each player.

ch-games.tex,v: 1.60 2007/06/27

Page 73: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/27 — 17:59 — page 701 — #35

10.5 Card games 701

Example

10-5-4

♠ –♥ 7 4 2♦ J 6 3♣ 8 6

♠ J 10 9♥ 10 6♦ Q 9 7 2♣ –

♠ 8 5♥ Q J 8 3♦ K 4♣ –

♠ –♥ A K 9 5♦ A 10 8 5♣ –

\usepackage{bridge}

\crdima{}{}{\hand{--}{7 4 2}{J 6 3}{8 6}}{\hand{J 10 9}{10 6}{Q 9 7 2}{--}}{\hand{8 5}{Q J 8 3}{K 4}{--}}{\hand{--}{A K 9 5}{A 10 8 5}{--}}

In discussing certain techniques of play, often only the card distribution in a single suitis shown. In that case it would be nice not to use the \hand command in the arguments of\crdima, but unfortunately the result is not quite what we would expect.

Example

10-5-5

♣ A Q♣ J 5

♣ K 6

♣ 7 4

\usepackage{bridge}

\crdima{}{}{\club{} A Q}{\club{} J 5}{\club{} K 6}{\club{} 7 4}

In this case a solution using the tabular environment gives better results. The first ar-gument specifies the suit of interest, and the other arguments correspond to the four players(with the same order as in the \crdima command). Note the use of the \multicolumncommand to suppress the vertical lines in the first and last rows.

Example

10-5-6

♣ A Q

N

♣ J 5 W E ♣ K 6

S

♣ 7 4

\usepackage{bridge}\newcommand{\Crdexa}[5]{{\renewcommand\arraystretch{1.2}%

\begin{tabular}{l|@{}c@{}|l}\multicolumn{1}{c}{} & \multicolumn{1}{c}{#1 #2} \\\cline{2-2}

& N & \\#1 #3 &W\hfill\hfill E& #1 #4 \\

& S & \\\cline{2-2}\multicolumn{1}{c}{} & \multicolumn{1}{c}{#1 #5}

\end{tabular}}}

\Crdexa{\club}{A Q}{J 5}{K 6}{7 4}

Bidding

An important part of the bridge game is the initial bidding phase, in which the players decidewho plays the contract. To document such a bidding sequence, Kees van der Laan introduceda bidding environment as an application of LATEX’s standard tabbing environment.

ch-games.tex,v: 1.60 2007/06/27

Page 74: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/27 — 17:59 — page 703 — #37

10.6 Crosswords in various forms 703

Example

10-6-1

34

333231

3029

28272625

2423

222120

191817

1615

1413121110

9

876

54321

ACROSS2 Gap between tree node labels and the node in PSTricks

(5)4 Modern replacement for scissors and glue (4)6 A Unicode TEX variant (5)7 . . . you always wanted to know but never dared to ask

(3)8 A graphics key that needs four numbers (2)10 Called bb in Karl Berry’s font-naming schemes (5)12 A way to make your pages into thumbnails (5)15 You can do it to a box but it isn’t proper LATEX (5)19 In LATEX denotes ℘; in other circumstances might mean

a word processor (2)20 Result of a TEX run (3)21 A language whose name should probably have five

letters, but then it was developed for Unix (4)24 It’s not Intel (5)25 A pointer misspelled (3)27 Testing your LATEX knowledge: ≺ (4)28 Label for a signal line (3)29 Another name for the LATEX3 project team on c.t.t. (4)30 One way to get a sharp in MusiXTEX (2)31 A figure or plan intended to explain rather than

represent actual appearance (7)33 72.27 to an inch (2)34 see 1d (5)

DOWN1 & a34 Grand wizard of TEX (3,5)2 A ready-to-run TEX for Unix (5)3 A novice golfer’s dream (3)4 LATEX 2ε name for document style (5)5 Double beam above notes in MusiXTEX (4)9 Either/or—mathematically speaking (3)10 German beer (3)11 Save your coordinates (PSTricks) (5)12 Approximation of TEX’s version number (2)13 A PostScript operator (7)14 Probability function (2)16 A divine messenger misspelled (5)17 How do you get an Å? (2)18 ξ (2)22 LATEX has rigid and rubber ones (6)23 Amor uses them and XY-pic calls them (2)24 Length of the line segment where the connector

joins the first node (4)25 Files containing LATEX font-definition

documentation (3)26 η—don’t say this is all Greek to you (3)27 ⊥, also the first letters of everlasting (4)30 We plot it in Chapter 4 (3)32 TEX’s name for inch (2)33 Lula is chief of (2)

Figure 10.2: A sample crossword for you to fill in (done with crosswrd)

ch-games.tex,v: 1.60 2007/06/27

Page 75: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/27 — 17:59 — page 710 — #44

710 PLAYING GAMES

The size of the grid can be adjusted by setting\sudokusize(the default value is10cm),and the size and font for the numbers can be manipulated by redefining \sudokuformatas shown in Example 10-7-1. The default definition uses \Huge to fit the larger grid size.The package also offers the environment sudoku, which is simply an abbreviation forsudoku-block inside a center environment.

10.7.2 sudokubundle—Solving and generating SudokusIn 2006, Peter Wilson published a bundle of three packages that not only typeset but alsoattempt to solve existing Sudokus or generate new ones. In contrast to the sudoku package,with Wilson’s bundle the puzzles have to be stored in external files and require a somewhatdifferent input syntax.

In these external files, only the first nine lines are relevant. Each must consist of ninecharacters, either a dot (representing an empty cell) or one of the numbers 1 to 9 (indicatingprefilled cells). Any further lines can be used for comments and will not be read by LATEX.

The printsudoku package provides the command \sudoku for typesetting such files. Italso offers a \writepuzzle command to write external Sudokus into separate files, but forthis purpose a filecontents* environment, as used in the next example, or a simple texteditor is equally or even more suitable.

9 6 4

4

1 3 6 7 2

4 6 9

9 3

2 5 4

9 2 5 7 8

5

3 4 6

\usepackage{printsudoku}\begin{filecontents*}{sample.sud}..9....644........1..36..72..46....9...9.3...2....54..92..57..8........534....6..A moderate challenge\end{filecontents*}

\cluefont{\small}\cellsize{1.2\baselineskip}\sudoku{sample.sud}

Example

10-7-2

As seen in the previous example, the size of the puzzle and the numbers in-side are controlled through \cluefont (default \Huge) and \cellsize (default2.5\baselineskip), respectively. Note that compared to the sudoku package these aredeclarations, rather than length registers or macros, and thus are changed in a different way.For example, to get sans serif numbers, we would need to use \sffamily instead of using\textsf.

The solvesudoku package attempts to solve a given puzzle and prints the solution as faras it was able to produce it. Given that TEX isn’t the best language in which to implementcomplicated algorithms, it does a surprisingly good job and is able to fully resolve most

ch-games.tex,v: 1.60 2007/06/27

Page 76: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:39 — page 713 — #1

C H A P T E R 11

The World of Color11.1 An introduction to color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71411.2 Colors with LATEX — The color and xcolor packages . . . . . . . . . . . . . . . . . 71911.3 Coloring tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73711.4 Color slides with LATEX — The beamer class . . . . . . . . . . . . . . . . . . . . . . 752

For many people, color is indispensable for effective graphics. All of the modern interactivedrawing packages support coloring of lines, filling objects with color, etc., and all of the stan-dard bitmap file formats such as GIF (Graphics Interchange Format), PNG (Portable Net-work Graphic), JPEG (Joint Photographic Experts Group), PBM (Portable Bitmap), TIFF(Tagged Image File Format), BMP (Windows Bitmap), SVG (Scalable Vector Graphic), andEncapsulated PostScript support color. Thus, if you generate a picture with a drawing pack-age, and then import it into your LATEX document using the packages described in Chapter 2,you should have no problems if your printing or viewing device supports color. However,you do have to know something about how color is represented and which color model youare using. We discuss these issues in the first part of this chapter.

If you prepare your graphics using LATEX itself or simply want colored text, you needsome special support from both LATEX and your driver. The main body of this chapter de-scribes the extended LATEX xcolor package, which we believe is powerful enough to meetalmost all needs and is capable of working with most other packages. xcolor extends the oldcolor package with features such as color mixing, color sequences, and tabular shading.

LATEX users often request color for use in presentations. The xcolor package can, ofcourse, be used with old LATEX slides classes, but we devote some space to explaining a moresophisticated class, beamer, and give lots of examples of its facilities.

As the book is printed in two colors, it is possible to show some color effects in examples.All other colors will appear in grayscale throughout the text. However, we repeat selected ex-amples in the color plates. We indicate when the reader should refer to the full-color version.You can also take the example source code, run it through LATEX or pdfLATEX, and view thePostScript or PDF output.

Page 77: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:39 — page 724 — #12

724 THE WORLD OF COLOR

Some further examples (also in Color Plate XIII b) show how to control the exact formof the box with the \fbox parameters \fboxrule and \fboxsep, which specify the thick-ness of the rule and the size of the shaded area respectively.

Fun with color Fun with color

Fun with color Fun with color

\usepackage{color}

\setlength{\fboxrule}{6pt}%\setlength{\fboxsep}{10pt}%\colorbox{yellow}{Fun with color}\qquad\fcolorbox{red}{yellow}{Fun with color}\par\bigskip\par\setlength{\fboxrule}{2pt}%\setlength{\fboxsep}{5pt}%\colorbox{green}{Fun with color}\qquad\fcolorbox{red}{green}{Fun with color}

Example

11-2-6

Combining the use of PostScript fonts and color, you can construct lists with colorfulelements; the \ding command is part of the pifont package described in [83, p. 378].

❑ On the first day of Christmas mytrue love sent to me

☛ a partridge in a pear tree

❑ On the second day of Christmasmy true love sent to me

☛ two turtle doves

☛ and a partridge in a pear tree

❑ On the third day of Christmas mytrue love sent to me

☛ three French hens

☛ two turtle doves

☛ and a partridge in a pear tree

\usepackage{pifont,color}\newenvironment{coldinglist}[1]

{\begin{list}{\textcolor{blue}{\ding{#1}}}{}}{\end{list}}

\newcommand\OnThe[1]{On the \textcolor{blue}{#1} day ofChristmas my true love sent to me}

\begin{coldinglist}{113}\item \OnThe{first}\begin{coldinglist}{42}

\item a partridge in a pear tree\end{coldinglist}\item \OnThe{second}\begin{coldinglist}{42}

\item two turtle doves\item and a partridge in a pear tree

\end{coldinglist}\item \OnThe{third}\begin{coldinglist}{42}

\item three French hens\item two turtle doves\item and a partridge in a pear tree

\end{coldinglist}\end{coldinglist}

Example

11-2-7

More complicated color support can be obtained in the framework of the colortbl package,which allows you to produce colored tables (see Section 11.3) or the beamer class, whichmakes color slides (see Section 11.4).

ch-colour-xcolor.tex,v: 1.64 2007/06/13

Page 78: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:39 — page 731 — #19

11.2 Colors with LATEX — The color and xcolor packages 731

followed by a number. This number describes the percentage of this color to use in the mix,with the remainder being white.

Example

11-2-13

\usepackage{xcolor}

\newcommand\blob[1]{{\color{#1}\rule{1.5cm}{5mm}}}\blob{blue} \blob{blue!75} \\ \blob{blue!50} \blob{blue!25}

What we see in this example is actually an abbreviation of the more general syntax forTone and shademixing colors: if the second color in the mix is not white, you have to specify it as well by

adding it to the right, again separated by an exclamation mark. The next example shows themixing of blue with black (called adding tone) and gray (called shading).

Example

11-2-14

\usepackage{xcolor}

\newcommand\blob[1]{{\color{#1}\rule{1.5cm}{5mm}}}\blob{blue} \blob{blue}\\\blob{blue!75!black} \blob{blue!75!gray}\\\blob{blue!50!black} \blob{blue!50!gray}\\\blob{blue!25!black} \blob{blue!25!gray}

It is also possible to mix more than two colors in this way, but you have to understandColorful mixhow the algorithm works to do it successfully. Assume you have the three colors in individual

buckets and some empty buckets for mixing. You mix the first two colors according to thespecified percentage into a free bucket. That gives you a new color in that bucket. Then youuse this color and mix it with the third color again into a free bucket, etc.

If you want to mix several colors with a specific percentage in the final mix, that can stillbe quite tricky. The next example reimplements the mix of blue and gray (which is a 50%mix of black and white) from the previous example. Here it is clearly simpler to first mixblack and white and then blue to obtain the same results as before.

Example

11-2-15

\usepackage{xcolor}

\newcommand\blob[1]{{\color{#1}\rule{1.5cm}{5mm}}}\blob{blue} \blob{blue} \\\blob{white!50!black!25!blue} \blob{blue!75!gray}\\\blob{white!50!black!50!blue} \blob{blue!50!gray}\\\blob{white!50!black!75!blue} \blob{blue!25!gray}

It is also possible to specify the complement of a color or color mix with this syntax,by putting a minus sign before the specification. The complement is the color that, if com-bined with the original color, yields white. However, in the example below, mixing the colorstest and anti yields gray due to the fact that each of the colors in the mix consists of 50%white. Only the extended specification in the third row (explained afterwards) allows us touse 100% of each color, i.e., combine them.

Example

11-2-16

\usepackage{xcolor}\colorlet{test}{yellow!90} \colorlet{anti}{-test}

\newcommand\blob[1]{\fbox{\color{#1}\rule{1.5cm}{5mm}}}\blob{test} \blob{anti} \\\blob{test!50!anti} \blob{gray} \\\blob{rgb,1:test,1;anti,1}

ch-colour-xcolor.tex,v: 1.64 2007/06/13

Page 79: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:39 — page 746 — #34

746 THE WORLD OF COLOR

To draw attention to individual rows of a table, we can put a band of color behind them(Color Plate XVI e):

Table title

Description Column 1 Column 2

Row one mmmmm mmmmRow two mmmm mmmRow three mmmmm mmmmmRow four mmmmm mmmmTotals mmmmm mmmmm

\usepackage{colortbl}

\newcommand\panel[1]{\multicolumn{1}%{>{\columncolor{magenta}}#1}}

\begin{tabular}{lrr}\large\textbf{Table title}\\[2mm]\textbf{Description}

& \textbf{Column 1}& \textbf{Column 2}\\[1mm]

Row one & mmmmm & mmmm \\Row two & mmmm & mmm \\\panel{l}{Row three}

& \panel{r}{mmmmm}& \panel{r}{mmmmm} \\

Row four& mmmmm & mmmm \\ \cline{2-3}Totals & mmmmm & mmmmm

\end{tabular}Example

11-3-13

But we can do even better: color the whole table, and leave the row to be emphasizedwith a white background (Color Plate XVI f):

Table title

Description Column 1 Column 2

Row one mmmmm mmmmRow two mmmm mmmRow three mmmmm mmmmmRow four mmmmm mmmmTotals mmmmm mmmmm

\usepackage{colortbl}

\newcommand\panel[1]{\multicolumn{1}%{>{\columncolor{white}}#1}}

\colorbox{magenta}{%\arrayrulecolor{black}\begin{tabular}{lrr}\large\textbf{Table title}\\[2mm]\textbf{Description}

& \textbf{Column 1}& \textbf{Column 2}\\[1mm]

Row one & mmmmm & mmmm \\Row two & mmmm & mmm \\\panel{l}{Row three}

& \panel{r}{mmmmm}& \panel{r}{mmmmm} \\

Row four& mmmmm & mmmm \\ \cline{2-3}Totals & mmmmm & mmmmm

\end{tabular}}Example

11-3-14

This is completely analogous to the previous example except that the \columncolor com-mand now uses the color white, while the \colorbox at the beginning makes the wholetable magenta.

ch-colour-xcolorexalt.tex,v: 1.11 2007/06/05

Page 80: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:39 — page 747 — #35

11.3 Coloring tables 747

Now we look at ways to highlight columns rather than rows. We use the\columncolorcommand to specify the color of the columns (Color Plate XVI g):

Example

11-3-15

Table title

Description Column 1 Column 2

Row one mmmmm mmmmRow two mmmm mmmRow three mmmmm mmmmmRow four mmmmm mmmmTotals mmmmm mmmmm

\usepackage{colortbl}\definecolor{Bluec}{cmyk}{.60,0,0,0}

\begin{tabular}{l>{\columncolor{Bluec}}rr}\large\textbf{Table title}\\[2mm]\textbf{Description} & \textbf{Column 1}

& \textbf{Column 2} \\[1mm]Row one & mmmmm & mmmm \\Row two & mmmm & mmm \\Row three& mmmmm & mmmmm \\Row four & mmmmm & mmmm \\Totals & mmmmm & mmmmm\end{tabular}

Colored panels of this type are often used to highlight connected regions in a table. The blueshade (Bluec) is defined at the beginning with the standard \definecolor command,although we could also have combined it with \columncolor as

\columncolor[cmyk]{.60,0,0,0}

Another feature often encountered in color work is the color gradient (ColorPlate XVI h). Here we use various levels of cyan defined at the start for successive rows. Weuse the extended mixing possibilities of xcolor to achieve this effect:

Example

11-3-16

Table title

Description Column 1 Column 2

Row one mmmmm mmmmRow two mmmm mmmRow three mmmmm mmmmmRow four mmmmm mmmmTotals mmmmm mmmmm

\usepackage[table]{xcolor}\definecolor{Cyan}{cmyk}{1,0,0,0.3}

\begin{tabular}{l rr}\rowcolor{Cyan}\multicolumn{3}{l}

{\large\textbf{\strut Table title}}\\[2mm]\rowcolor{Cyan}\textbf{Description} & \textbf{Column 1}

& \textbf{Column 2} \\[1mm]\rowcolor{Cyan!20}Row one & mmmmm & mmmm \\\rowcolor{Cyan!40}Row two & mmmm & mmm \\\rowcolor{Cyan!60}Row three& mmmmm & mmmmm\\\rowcolor{Cyan!80}Row four & mmmmm & mmmm \\\rowcolor{Cyan} Totals & mmmmm & mmmmm\end{tabular}

Although this task requires specifying colors for each row, the result can be quite pleas-ing. This technique is certainly one of those most often used to produce attractive and easilyreadable tabular material.

One might expect to be able to achieve the same effect by defining a color series andstepping it through each row. However, as it turns out, this approach results in the colorchanging for every cell: due to the implementation, the color expression is evaluated each

ch-colour-xcolorexalt.tex,v: 1.11 2007/06/05

Page 81: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:39 — page 754 — #42

754 THE WORLD OF COLOR

11.4.2 Your first slidesThe beamer class comes with lengthy documentation, example files, and a lot of ready-madetemplates for different colors and layouts. The following example shows the default output. Itis difficult to choose the right layout for the presentation—when people are more impressedby the fancy layout than by the contents, then there is something wrong! For a first-time user,it is sensible to use some of the predefined themes of beamer, and to attempt to write yourown only after gaining some experience with this class.

Let us start with a simple pair of slides:

The Declaration of Independence of the ThirteenColonies.

by Thomas Jefferson et al.

July 4, 1776

Self-evident truths.

We hold these truths to be self-evident,� that all men are created equal,� that they are endowed by their Creator with certain

inalienable rights,� that among these are Life, Liberty and the Pursuit of

Happiness.� That, to secure these rights, Governments are instituted

among Men, deriving their just powers from the consent ofthe governed.

� That, when any form of government becomes destructive ofthese ends, it is the Right of the People to alter or abolish it.

\documentclass{beamer}

\title{The Declaration of Independence ofthe Thirteen Colonies.}

\author{by Thomas Jefferson et al.}\date{July 4, 1776}\frame{\maketitle}

\section{The unanimous Declaration}\begin{frame}\frametitle{Self-evident truths.}We hold these truths to be self-evident,\begin{itemize}\item \textbf{that} all men are created equal,\item \textbf{that} they are endowed by their

Creator with certain inalienable rights,\item \textbf{that} among these are Life,

Liberty and the Pursuit of Happiness.\item \textbf{That}, to secure these rights,Governments are instituted among Men, derivingtheir just powers from the consent of the governed.\item \textbf{That}, when any form of governmentbecomes destructive of these ends, it is the Rightof the People to alter or abolish it.\end{itemize}\end{frame}

Example

11-4-1

We can change appearance of the slides by choosing variants in five style levels forbeamer: the theme, the outer layout, the inner layout, the color theme, and the font theme.In each case you can use the standard LATEX \usepackage mechanism by precedingthe style name with the word beamertheme,beameroutertheme,beamerinnertheme,beamercolortheme, or beamerfonttheme respectively.

Table 11.4 lists the predefined styles that come with beamer. These themes are not offi-cial, and their contents and layout depend on what users have contributed to the community.

In the next step we choose the Malmoe main theme; this is just a name for the themeand not the official layout of the Swedish university!

ch-colour-beamer.tex,v: 1.89 2007/06/13

Page 82: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:39 — page 765 — #53

11.4 Color slides with LATEX — The beamer class 765

the end of the last column, the use of \onslidewithout a specification ensures that the firstcolumn on the next row is once more shown normally, so that the whole first column is seen(the last slide is also shown in Color Plate XVI x).

Example

11-4-11

Reveal a tablerow by row

Uncover atablecolumnwise

Uncover atable rowwiseII

Reveal rows and columns in a tableUsing the onslide macro

packagepstricks.texpst-3d.texpst-char.texpst-coil.texpst-eps.texpst-fill.texpst-grad.texpst-xkey.texpst-node.texpst-plot.texpst-text.texpst-tree.tex

Reveal a tablerow by row

Uncover atablecolumnwise

Uncover atable rowwiseII

Reveal rows and columns in a tableUsing the onslide macro

package datepstricks.tex 2004pst-3d.tex 1999pst-char.tex 1999pst-coil.tex 1999pst-eps.tex 1999pst-fill.tex 2004pst-grad.tex 2004pst-xkey.tex 2005pst-node.tex 2001pst-plot.tex 2000pst-text.tex 1999pst-tree.tex 2004

Reveal a tablerow by row

Uncover atablecolumnwise

Uncover atable rowwiseII

Reveal rows and columns in a tableUsing the onslide macro

package date functionpstricks.tex 2004 basic packagepst-3d.tex 1999 basic 3-D macrospst-char.tex 1999 character manipulationpst-coil.tex 1999 coils and zig zagspst-eps.tex 1999 EPS exportpst-fill.tex 2004 filling and tilingpst-grad.tex 2004 color gradientspst-xkey.tex 2005 key settingpst-node.tex 2001 nodes and connectionspst-plot.tex 2000 plotting functionspst-text.tex 1999 text manipulationspst-tree.tex 2004 trees

\documentclass[xcolor=table]{beamer}\usetheme{Malmoe}\useoutertheme{sidebar}\usecolortheme{dove}\newcommand\bfrm[1]

{\textbf{\textrm{\textcolor{white}{#1}}}}

\section{Reveal a table row by row}\begin{frame}

\frametitle{Reveal rows and columns in a table}\framesubtitle{Using the pause macro}...

\end{frame}\section{Uncover a table columnwise}\begin{frame}\frametitle{Reveal rows and columns in a table}\framesubtitle{Using the onslide macro}\rowcolors[]{1}{blue!40}{yellow!20}\begin{tabular}{>{\ttfamily}l<{\onslide<2->}|%>{\ttfamily}l<{\onslide<3->}l<{\onslide}@{}}

\rowcolor{gray}\bfrm{package}&\bfrm{date}&\bfrm{function} \\pstricks.tex & 2004 & basic package \\pst-3d.tex & 1999 & basic 3-D macros \\pst-char.tex & 1999 & character manipulation\\pst-coil.tex & 1999 & coils and zig zags \\pst-eps.tex & 1999 & EPS export \\pst-fill.tex & 2004 & filling and tiling \\

... further code omitted ...

\onslide can also be used to show specific rows of a table, as we saw earlier with\pause. The following example shows the third and fifth slides of the frame. Note that inthe example the \onslide commands are added at the end of the rows (affecting the next)and not at the beginning, as that would trigger the coloring of the row.

\documentclass[xcolor=table]{beamer}\usetheme{Malmoe} \useoutertheme{sidebar} \usecolortheme{dove}\newcommand\bfrm[1]{\textbf{\textrm{\textcolor{white}{#1}}}}\section{Reveal a table row by row} \begin{frame} ... \end{frame}\section{Uncover a table columnwise} \begin{frame} ... \end{frame}\section{Uncover a table rowwise II}\begin{frame}\frametitle{Reveal rows and columns in a table}

ch-colour-beamer.tex,v: 1.89 2007/06/13

Page 83: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 15:39 — page 792 — #80

792 THE WORLD OF COLOR

\includegraphics<overlay spec.> [key/vals] {file name}\pgfdeclareimage{key/vals}{beamer name }{file name}\pgfuseimage{key/vals}{beamer name}

The following example shows both ways of using a graphic. The screenshot is the thirteenthslide, which is easy to control because each line has five pictures. The automatic slide controlis done by the option <+-> together with the \only and \includegraphicsmacros.

A demonstration of using a graphicincludegraphics and pgfuseimage

\documentclass{beamer} \usetheme{Malmoe}\useoutertheme{sidebar} \usecolortheme{dove}\pgfdeclareimage[width=2cm]{fu}{fu-berlin}\newcommand\FU{\only<+->{\pgfuseimage{fu}}}\newcommand\fu

{\includegraphics<+->[width=2cm]{fu-berlin}}\logo{\includegraphics[width=1.5cm]{fu-berlin}}

\begin{frame}\frametitle{A demonstration of using a graphic}\framesubtitle{includegraphics and pgfuseimage}\FU \fu \FU \fu \FU\par \fu \FU \fu \FU \fu\par\FU \fu \FU \fu \FU\end{frame}

Example

11-4-34

Often a full-screen graphic is needed, which is possible with an empty frame (keywordplain) and filling the background canvas with the graphic.

\documentclass{beamer} \usetheme{Malmoe}\useoutertheme{sidebar} \usecolortheme{dove}

\setbeamertemplate{background canvas}{%\includegraphics[width=\paperwidth]%

{fu-berlin-air}}\begin{frame}[plain]\end{frame}

Example

11-4-35

This image shows the main campus of the Free University of Berlin and is courtesy ofFoster & Partners.

11.4.8 Managing your templatesThe beamer class is totally driven by templates, and nearly everything can be overwritten orsimply defined by the user. In general there are three kinds of templates:

ch-colour-beamer.tex,v: 1.89 2007/06/13

Page 84: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 837 — #19

General Index

Symbols! syntax (xcolor), 731, 732\! (LilyPond), 665!! syntax (xcolor), 735!!+ syntax (xcolor), 735!![num] syntax (xcolor), 732, 735"..." syntax

(abc), 608(pic), 19

’ syntax(LilyPond), 661, 662(MusiXTEX), 592(abc), 603

’’ syntax(LilyPond), 661, 665(MusiXTEX), 592

’’’ syntax(LilyPond), 661, 663, 665(MusiXTEX), 592

\( (pst-pdf), 800(" syntax (M-Tx), 655(...) syntax

(LilyPond), 663, 664, 665(M-Tx), 654, 655(PMX), 634, 635–638, 648(abc), 607, 608

(2 syntax (abc), 605(3 syntax (abc), 605(4 syntax (abc), 605(5 syntax (abc), 605

(6 syntax (abc), 605(7 syntax (abc), 605(8 syntax (abc), 605(~...)~ syntax (M-Tx), 655\) (pst-pdf), 800)( syntax (M-Tx), 655* syntax (cwpuzzle), 704, 705+ syntax

(PMX), 623, 624, 625(m-ch-en), 544(texmate), 683

, syntax(LilyPond), 661, 662(PMX), 624, 625(abc), 603

- syntax(LilyPond), 663(M-Tx), 655(PMX), 623, 624, 625, 628(abc), 607, 608, 611(m-ch-en), 544(xcolor), 731, 732

\- (circ), 579-- syntax

(LilyPond), 665(M-Tx), 655

. syntax(MusiXTEX), 594(PMX), 624, 625(abc), 607(cwpuzzle), 704, 705

Page 85: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 838 — #20

838 (Symbols) GENERAL INDEX

. syntax (cont.)(printsudoku), 710(sudoku), 709(xcolor), 733

\. (circ), 579.PE syntax (pic), 17, 583.PS syntax (pic), 17, 583.c syntax (pic), 19.n syntax (pic), 19.ne syntax (pic), 19.nw syntax (pic), 19.se syntax (pic), 19.sw syntax (pic), 19.| syntax (LilyPond), 661, 662.||. syntax (LilyPond), 661, 662/ syntax (abc), 608: syntax

(LilyPond), 661, 662(PMX), 631(xcolor), 732

:: syntax(M-Tx), 654(abc), 603

:| syntax(LilyPond), 661, 662(M-Tx), 654(abc), 603, 604

:|: syntax (LilyPond), 661, 662; syntax (xcolor), 732< syntax

(M-Tx), 658(MusiXTEX), 592(PMX), 624, 625(abc), 604, 605

<. syntax (M-Tx), 658<...> syntax (LilyPond), 663, 665<< syntax (abc), 604, 605<<...>> syntax (LilyPond), 664, 665<<< syntax (abc), 604= syntax

(MusiXTEX), 592(abc), 605

> syntax(M-Tx), 658(MusiXTEX), 592(PMX), 624, 625(abc), 604, 605(colortbl), 751

\> (LilyPond), 665>. syntax (M-Tx), 658>> syntax (abc), 604, 605>>> syntax (abc), 604? syntax (PMX), 629\[ (texmate), 680, 681, 682, 683, 686

[...] syntax(LilyPond), 663, 664, 665(M-Tx), 654(PMX), 631, 632, 634(abc), 608(cwpuzzle), 704, 705(texmate), 680, 681–683, 686, 687

[...]/ syntax (LilyPond), 664[1 syntax (abc), 603, 604[2 syntax (abc), 603, 604[j syntax (PMX), 633\# (texmate), 681–683& syntax (MusiXTEX), 591, 596^ syntax

(LilyPond), 663(MusiXTEX), 592, 593(abc), 605, 607(chemsym), 517

^^ syntax (abc), 605~ syntax

(M-Tx), 657(abc), 607(colortbl), 751

\ syntax (abc), 604, 608{" syntax (M-Tx), 655{...} syntax

(M-Tx), 655, 657(abc), 607

{~...}~ syntax (M-Tx), 655{} syntax (cwpuzzle), 704, 705}{ syntax (M-Tx), 655, 657_ syntax

(LilyPond), 663, 664(M-Tx), 655(MusiXTEX), 592, 593(abc), 605, 611(chemsym), 517

__ syntax (abc), 605\] (texmate), 680, 681]-[ syntax (PMX), 632][ syntax (PMX), 632]j syntax (PMX), 633‘ syntax

(MusiXTEX), 592(dvips), 35

| syntax, 668(LilyPond), 661, 662(M-Tx), 654, 657(MusiXTEX), 591, 596(abc), 601, 603, 604, 605, 607, 608(cwpuzzle), 704, 705(sudoku), 709(texmate), 680, 681, 683, 686

|. syntax (LilyPond), 661, 662

ch-end.tex,v: 1.24 2007/06/15

Page 86: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 839 — #21

GENERAL INDEX (Symbols–A) 839

|: syntax(LilyPond), 661, 662(M-Tx), 654(abc), 603

|] syntax(M-Tx), 654(abc), 601, 603, 604, 605, 607, 608

|| syntax(LilyPond), 661, 662(M-Tx), 654(abc), 603

0-0 syntax (texmate), 6860-0-0 syntax (texmate), 6831,4-dibromobenzene, 521, 52310pt option (beamer), 75312pt option (beamer), 75314pt option (beamer), 75317pt option (beamer), 75320pt option (beamer), 7533-D, see���� and PSTricks index8pt option (beamer), 7539pt option (beamer), 753

@@+ syntax (M-Tx), 658, 659@- syntax (M-Tx), 658@< syntax (M-Tx), 658@= syntax (M-Tx), 658@> syntax (M-Tx), 658@^ syntax (M-Tx), 658@v syntax (M-Tx), 658

AA syntax (PMX), 630\A (circ), 577, 581a syntax (PMX), 625, 631Aa syntax (PMX), 643Ab syntax (PMX), 632, 643abbreviations, scientific texts, 513.abc file extension, xxxiabc env. (abc), 612, 614, 615abc language, xxviii, 600–615, 654abc package, 612–615abc notation system, see music scores (abc2mtex)abc2midi program, 610, 648abc2mtex program, 590, 600–612, 662\abcinput (abc), 612, 615

abcm2ps program, 602, 610, 611, 614, 615, 617abcPlus language, 600, 609, 610, 617, 648.abcplus file extension, xxxiAbp syntax (PMX), 633absorption, color, 717accents (musical), 592, 607

LilyPond, 663

\acciaccatura (LilyPond), 663, 664accidentals (musical)

attaching to note names, 622examples, 592positioning, 624, 628symbols, 605

Acrobat Distiller program, 797, 798actions, slides, 770active option (pst-pdf), 800\ACtoDC (circ), 578Ad syntax (PMX), 643\adamantane (ccycle), 531

additive color space, 715addpgf key (chessboard), 669addpieces key (chessboard), 669ADJ syntax (m-ch-en), 544, 545Adobe Acrobat program, 21Adobe Reader program, 12, 804, 817Adobe Illustrator program, 1, 4, 21Adobe Photoshop program, 17Ae syntax (PMX), 643\afterb (texmate), 686\afterno (texmate), 686\afterw (texmate), 686againcovered key (beamer), 768\againframe (beamer), 759, 761\ahead (texmate), 681, 682, 683AI syntax (PMX), 643Ai syntax (PMX), 643AlDraTex package, 15\alert (beamer), 761, 771, 790, 791alertblock env. (beamer), 778, 779algorithmic display drawings, 5algorithmic structural drawings, 5alignment

nucleotide sequences, 548–550peptide sequences, 548–550

aliphat package, 520, 532aliphatic compounds, 532, 533all option (beamer), 753\allabreve (MusiXTEX), 592

allegro (musical), 646allegro vivace (musical), 644\allmatchspecial

(texshade), 548(textopo), 552

\allowdisplaybreaks (beamer), 759allowdisplaybreaks key (beamer), 759allowframebreaks key (beamer), 759, 782allowsframebreaks key (beamer), 759alltt package, 790\alt (beamer), 768altenv env. (beamer), 770alto syntax (LilyPond), 661, 664\altoclef (MusiXTEX), 592

ch-end.tex,v: 1.24 2007/06/15

Page 87: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 840 — #22

840 (A–B) GENERAL INDEX

\Amp (circ), 578\ampere (SIunits), 514, 515, 516\amperemetresecond (SIunits), 516

amsmath package, 752, 753, 759amssymb package, 515amstex package, 517amsthm package, 753\analysistop (texmate), 686\AND (circ), 578angle key (graphicx), 28, 31, 32\animate (beamer), 774\animatevalue (beamer), 774

animation, see���� indexanimation, slides, 774annotations, see also commentaries

chemical formulas, 547chess, 675music scores, 657, 658timing diagrams, 573

anthracene derivatives, 525\anthracenev (carom), 524, 525Ap syntax (PMX), 636, 643\appendix (beamer), 779\applyshading (textopo), 552Ar syntax (PMX), 643\Arc (curve2e), 47, 50arc (pic), 17arcs (Feynman diagrams)

edges, 572segments with arrows, 560

aromatic carbocycles, 525\arpeggio (MusiXTEX), 592

arpeggio (musical), 629array env., 8, 737array package, 737, 764\arrayrulecolor (colortbl), 741, 742, 745, 746, 749–751\arrayrulewidth rigid length, 742arrow (pic), 17\ArrowArc (axodraw), 558, 560\ArrowArcn (axodraw), 558\ArrowLine (axodraw), 558, 559–561

arrowsFeynman diagrams, 559–561styles, 44timing diagrams, 575

art graphics, 4, 22article option (beamer), 753article document class, xxxiAS syntax (PMX), 643As syntax (PMX), 643aspect ratio, keeping, 29, 31, 38\at (circ), 580atan (pic), 19\AtBeginPart (beamer), 780

atom derivation, 539

atoms, aligning with bonds, 546\atpin (circ), 580, 581\atto (SIunits), 515\author (beamer), 754, 757, 761\autoBeamOff (LilyPond), 663

AutoCAD program, 17, 21automata, see���� and PSTricks indexautomata drawings, 15Av syntax (PMX), 643axodraw package, 555, 558–561

BB syntax (m-ch-en), 542, 544b key (beamer), 759, 781b syntax (PMX), 635, 637\B2Text (axodraw), 558

babel package, 515Bach musical example, 590, 610backgammon, 696, 697, 698background syntax (beamer), 794, 795background color, documents, 723, 724, 725background canvas syntax (beamer), 792, 795\backturn (MusiXTEX), 592\bar

(LilyPond), 661, 662(MusiXTEX), 591, 594–596, 599

bar package, 15bar charts, see���� and PSTricks indexbar codes, see PSTricks indexbars (musical)

changes, 654double, 603repeats, 603, 639symbols, 603, 639thick, 603thin, 603

Bars/line: syntax (M-Tx), 652Bartok musical example, 596base units, 514basic option (circ), 577, 578basic duration (musical), 622\bass (MusiXTEX), 596bass syntax (LilyPond), 661, 665\bassclef (MusiXTEX), 592bb key (graphicx), 28, 29, 30\bbetter (texmate), 680, 681\BBox (axodraw), 558\BBoxc (axodraw), 558\BCirc (axodraw), 558beamer option (beamer), 753beamer document class, xxxi, 752, 753, 754–758, 759, 760–796beamerboxesrounded env. (beamer), 775, 776, 778beamercolorbox env. (beamer), 775, 776, 777, 794\beamergotobutton (beamer), 784, 785

beamerouterthemesidebar package, 774

ch-end.tex,v: 1.24 2007/06/15

Page 88: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 841 — #23

GENERAL INDEX (B) 841

beamerpauses counter (beamer), 788\beamertemplatearticlebibitems (beamer), 782\beamertemplatebookbibitems (beamer), 782

beams (musical)grouping notes, 606jumping staves, 633LilyPond, 663M-Tx, 654, 655MusiXTEX, 597PMX, 631, 632, 633xtuplets, 627, 628

\becquerel (SIunits), 514\beforeb (texmate), 686\beforeno (texmate), 686\belo (texmate), 683\benzofuranev (hetarom), 530\benzofuranevi (hetarom), 530\benzoxazolev (hetarom), 530\benzoxazolevi (hetarom), 530bes syntax (LilyPond), 662, 663\betteris (skak), 678

Bézier curvescubic, 47quadratic, 46, 47

\bfseries (chessfss), 671bg key (beamer), 776, 778, 794bg package, 696–698\Bi (chemsym), 518\bibitem (beamer), 782

bibliographies, slides, 782bibtex program, 801, 806\bicycheph (ccycle), 531\bicychepv (ccycle), 531\bid (tlgc), 702bidding env. (bridge), 699, 701, 702\bigboard (bg), 697bigger option (beamer), 753bioinformatics, see also scientific texts

membrane protein topology plots, 551–553nucleotide sequences

aligning, 548–550highlighting, 548–550sequence fingerprints, 550shading, 548–550

peptide sequencesaligning, 548–550highlighting, 548–550sequence fingerprints, 550shading, 548–550

\bishop (chessfss), 672\black (igo), 691, 692–695black syntax (xcolor), 722, 726“black box” drawings, 3, 4black-and-white, 721\blackbar (bg), 696, 697

\blackcube (bg), 697\blackname (texmate), 683\blackonmove (bg), 697\blackpoint (bg), 696\blackstone (igo), 695

blending color, 737\BLens (circ), 580, 581

blobs (Feynman diagrams), 566block env. (beamer), 777, 778, 779block environments, slides, 778, 779block body syntax (beamer), 778block title syntax (beamer), 778blocks (musical), 622blue syntax (xcolor), 722, 723, 726, 727\bluefbox (tlgc), 26

bm2font program, 7\bmove (skak), 679\bname (texmate), 685, 686

board games, see backgammon, see chess, see Go\boardcaption (bg), 696, 697, 698\boardfont (chessfss), 673boardfontencoding key (chessboard), 669\boardsymbol (chessfss), 673bodyCol syntax (beamer), 776bonds (chemical)

aligning atoms or molecules, 546between C atoms, 542derivation, 539description, 543directions, 535, 536identifiers, 544modifiers, 522

border key (chessboard), 669\bornane (ccycle), 531\bottomdiagramnames (texmate), 686

bounding boxaspect ratio, keeping, 29clipping graphics to, 29, 30comments, 25, 28draft mode, 25, 29, 30final mode, 25fitting to graphics, 26, 27height, 28, 29, 32\includegraphics syntax, 28–32resizing, 27rotated material, hiding, 25rotating, 27, 31, 32scaled material, hiding, 25scaling, 27, 29specifying, 28, 30trimming space, 28, 30viewports, 28, 30width, 28, 29

BoundingBox (PostScript), 25, 26, 28, 34, 35box (pic), 17, 19

ch-end.tex,v: 1.24 2007/06/15

Page 89: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 842 — #24

842 (B–C) GENERAL INDEX

box option (circ), 577\Boxc (axodraw), 558

boxes, see also framescolored, in documents, 723, 724slides, text in, 775, 776

\boxit (MusiXTEX), 592\bracket (MusiXTEX), 592\break (LilyPond), 661\breve (LilyPond), 663

bridge package, 699–702bridge (card game)

bidding, 702dealing, 699, 700, 701

bridge.tex file (bridge), 699, 700broken musical rhythms, 604brown syntax (xcolor), 726\BSplit (circ), 580, 581\BText (axodraw), 558\BTri (axodraw), 558\BUF (circ), 578\bundle (circ), 579\bupperhand (texmate), 680\bzdrh (carom), 521, 523, 524, 525, 534, 535, 536\bzdrv (carom), 521, 522, 524, 525, 536

CC syntax

(PMX), 639(m-ch-en), 544

\C (circ), 577c key (beamer), 759, 781c option (beamer), 753\C2Text (axodraw), 558C: syntax

(M-Tx), 656(abc), 608, 610

\ca (MusiXTEX), 593, 594, 595\caesura (MusiXTEX), 592

calc program, 21calculations, drawing tools for, 1calendars, see PSTricks index\Cam (circ), 580, 581\candela (SIunits), 514

captionschess, 684–686Go board, 694

carbocycles, 524carbocyclic compounds, 527CARBON syntax (m-ch-en), 541, 542\CArc (axodraw), 558, 560

card gamesbridge

bidding, 702dealing, 699, 700, 701

suits, representing, 698, 699

caret (^), sharp symbol, 605carets (^^), double flat symbol, 605carom package, 520, 524CB syntax (m-ch-en), 541\cbezier (pict2e), 46, 47\CBox

(axodraw), 558(tlgc), 733

\CBoxc (axodraw), 558\cbreath (MusiXTEX), 592\cc (circ), 579, 581\cca (MusiXTEX), 593, 594, 595\ccccl (MusiXTEX), 592, 594\ccccu (MusiXTEX), 592, 594\cccl (MusiXTEX), 592, 594\cccu (MusiXTEX), 592, 593

cchess package, 687–690cchessboard.tex file (cchess), 688\CCirc (axodraw), 558\ccl (MusiXTEX), 592, 593, 594, 595\ccu (MusiXTEX), 592, 593, 594, 595

ccycle package, 520, 530\cdfl (MusiXTEX), 592cdot option (SIunits), 515\cdsh (MusiXTEX), 592\Cel (circ), 577\cellcolor (colortbl), 741, 748, 749

cells (table), color, 741\cellsize

(createsudoku), 711(printsudoku), 710(solvesudoku), 711

\celsius (SIunits), 514center key (beamer), 777\centerto (circ), 581\centi (SIunits), 515, 516.cfg file extension (graphics), 25\cfl (MusiXTEX), 592

CGM language, 13CGM (Computer Graphics Metafile), 13CGM-Open Consortium, 13\CH (chemsym), 517\chair (ccycle), 531\changeunitlength

(xymtexps), 538, 539, 540(xymtex), 538

character-based diagrams and pictures, 13charges on atoms, 524, 526charts, see also���� and PSTricks index, see graphsChemDraw program, 21chemeqn env. (chemist), 540\chemical (m-ch-en), 541, 542, 543–545, 546, 547

chemical bonds, see bonds (chemical)

ch-end.tex,v: 1.24 2007/06/15

Page 90: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 843 — #25

GENERAL INDEX (C) 843

chemical formulas, see also scientific texts1,4-dibromobenzene, 521, 523aliphatic compounds, 532, 533annotation, 547anthracene derivatives, 525aromatic carbocycles, 525atom derivation, 539bonds

aligning atoms or molecules, 546derivation, 539description, 543directions, 535, 536identifiers, 544modifiers, 522

carbocycles, 524carbocyclic compounds, 527charges on atoms, 524, 526combinations, 543command syntax, 520–522configuration, 540conformations, 540conventions, 520cyclohexane chair forms, 531decaline derivatives, 525definitions, 543derivation, 539elements, symbols for, 512endocyclic bonds, 523ethylene derivatives, 533four-member carbon cycles, 528furanoses, 532fused five- and six-member rings, 530fused rings, 524fusing ring units, 536handidness of substituents, 522, 531, 535heterocyclic compounds, 528–530indane derivatives, 528inside paragraphs, 547lower-order cycles, 527, 528Periodic Table of the Elements, 519phenanthrene derivatives, 525polymethylene commands, 538PostScript output, 537, 538pyranoses derivatives, 532reaction schemes, 540stereochemical compounds, 530–532stereochemistry effects, 538steroid derivatives, 525, 526structures

atoms, aligning with bonds, 546basic commands for, 541, 542bond identifiers, 544bonds, 543bonds, aligning atoms or molecules, 546chemical bonds, 542

chemical formulas (cont.)combinations, 544, 545combining, 534complex, 534, 535libraries of, 543molecules, aligning with bonds, 546moving, 544, 545positioning, 544, 545reaction equations, 545rotating, 544, 545substructures, 543

substitution derivation, 539tetrahedral compounds, 532, 533tetrahedron carbon configurations, 533tetraline derivatives, 525three-member carbon cycles, 528tricyclic carbocycles, 525trigonal units, 532, 533

chemical symbols, 517, 518chemist package, 537, 540chemstr package, 520chemsym package, 512, 517, 518, 519chess

$ (dollar sign), comment indicator, 678board

annotations, 675displaying, 674, 675, 676, 677hiding pieces, 676highlighting, 676next move indicator, 676printing, 675size, 675specifying, 674–677

captions, 684–686Chinese, 687, 688–690

pieces, 688coloring the board, 668, 669diagrams

adjusting layout, 686, 687typesetting, 684, 685, 686

documenting a game, 679ending games, 683FEN (Forsyth-Edwards-Notation), 674fonts

Figurine symbols, 671generic mechanism, 669–673list of, 670normal characters, 671selecting, 672, 673switching, 672

informational symbols, 674moves

error detection, 678printing, 677recording, 675

ch-end.tex,v: 1.24 2007/06/15

Page 91: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 844 — #26

844 (C) GENERAL INDEX

chess (cont.)specifying, 677, 678style, changing, 679

nested variations, 679notation

commentaries, 681, 682overview, 680–683threats, 681variations, 680, 682, 683

online resources, 687overview, 668setting up position, 684starting games, 683titles, 683

chess package, 668, 677, 680, 687, 690, 691\chessboard (chessboard), 669

chessboard package, 668, 669, 673\chessevent (texmate), 683

chessfss package, 668, 669–673, 674, 678, 680\chessopening (texmate), 683\chl (MusiXTEX), 592

chmst-ps package, 537chords (musical)

abc2mtex, 608LilyPond, 663M-Tx, 656, 657MusiXTEX, 594PMX, 628, 629

\chu (MusiXTEX), 592CIE (Commission Internationale de l’Eclairage), color spaces,

715\cinnolinev (hetarom), 530\cinnolinevi (hetarom), 530\circ, 39

circ package, 576–582\circle, 43

(curve2e), 49(pict2e), 43, 45, 47

circle (pic), 17\circle*, 43

(pict2e), 43, 45\circleit (MusiXTEX), 592

circlesdrawing, 45

circuit env. (circ), 578, 581\cl (MusiXTEX), 592, 593, 599\clear (igo), 694, 695\cleargoban (igo), 694\cleargobansymbols (igo), 692, 695

clearing, Go board, 694\clef (LilyPond), 661, 664, 665

clef changes (musical), 639clefs (musical), 592, 653\cline (colortbl), 741clip key (graphicx), 28, 29, 30

clipping graphics to bounding box, 29, 30clockwise option (rotating), 42\club

(bridge), 701, 702(tlgc), 699

\clubsuit, 698, 699\Clue (cwpuzzle), 705, 706\clue (crosswrd), 703, 704\cluefont

(createsudoku), 711(printsudoku), 710(solvesudoku), 711

cmy option (xcolor), 721cmy syntax (xcolor), 728, 729cmyk option (xcolor), 721cmyk syntax

(color), 720(xcolor), 720, 723, 725, 727–730

CMYK (Cyan, Magenta, Yellow, Black) color, 715, 719\cna (MusiXTEX), 592\Co (chemsym), 518collision option (chemsym), 517color

absorption, 717adding tone, 731additive color space, 715and light, 714and readability, 718black-and-white, 721blending, 737categories of (PostScript), 715color package

defining colors, 726–728options, 720–722overview, 719, 720

Commission Internationale de l’Eclairage, 715complement, specifying, 731contrast, 718core model, 732Crayola colors, 719cultural connotations, 716defining

assigning to names, 734, 735, 736sets of colors, 727single colors, 726, 727

device color spaces, 715error warnings, 721expressions

current color, 733extended, 732PSTricks, 733standard, 732

Feynman diagrams, 567four-color harmonics, 718Grassman’s Law, 714

ch-end.tex,v: 1.24 2007/06/15

Page 92: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 845 — #27

GENERAL INDEX (C) 845

color (cont.)harmonic color circle, 717harmonies, 717, 718intensity, 718masking, 737mixing, 731models supported, 719monochrome, 721overview, 719, 720primary colors, 717purity, 718saturation, 717secondary colors, 717series, 734, 735, 736shading, 731slides, see slides (color)special color spaces, 715spectrum, displaying, 729subtractive color space, 715symbolic values, 716tables, see tables, colortext

documents, 725slides, 775, 776tables, 745, 748

theories, 714, 715three-color harmonics, 718three-color theory, 714tinting, 731two-color harmonics, 718undefined colors, 721within documents

background, 723, 724, 725colored boxes, 723, 724lists, 724mixing colors, 723, 725named colors, 725portability, 723special concerns, 725specifying by color model, 722specifying by name, 722stored boxes, 725tables, 724text inside a box, 725

xcolor packagecolor models, 728–730extended specification, 734options, 720–722overview, 719, 720

Young-Helmholtz Law, 714\color

(beamer), 788, 789(colortbl), 741(color), 741, 744, 745(curve2e), 48–50

\color (cont.)(xcolor), 720, 722, 723, 725

color key(beamer), 795(chessboard), 669

color package, 719–722, 726, 728, 730, 737color models

CIE color spaces, 715CMYK (Cyan, Magenta, Yellow, Black), 715, 719gray, 719HSB (Hue, Saturation, Brightness) color, 715, 719HSV (Hue, Saturation, Value) color, 715named

behavior options, 721in LATEX documents, 725support for, 719

overview, 715RGB (Red, Green, Blue) color, 715, 719target, specifying, 730xcolor package, 728–730

color.cfg file (xcolor), 720color.pro file (dvips), 725\colorbox

(color), 743, 744, 746, 749(xcolor), 720, 723, 724, 729, 733

colordvi package, 719coloremph key (chessboard), 669\colorlet (xcolor), 726, 727, 730\colorseriescycle (xcolor), 734

colortbl package, 720, 721, 737–751colsep key (beamer), 777colsep* key (beamer), 777\column (beamer), 781column env. (beamer), 780, 781\columncolor (colortbl), 737, 738, 739, 741, 746–748, 750, 751columns env. (beamer), 780, 781columns (table), color, 738, 747\columnwidth rigid length, 33

comma (,), octave indicator, 603command key (graphicx), 29commentaries, chess, 681, 682, see also annotationsCommission Internationale de l’Eclairage (CIE), color spaces,

715complementary color, specifying, 731complex numbers, representing, 49, 50complex vertices (Feynman diagrams), 567Composer: syntax (M-Tx), 651, 652compound time signatures (musical), 605Comprehensive TEX Archive Network, see CTANcompress option (beamer), 753computer generated drawings, 5Computer Graphics Metafile (CGM), 13\connection (circ), 581

contrast, 718\conttimingcounter (timing), 573

ch-end.tex,v: 1.24 2007/06/15

Page 93: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 846 — #28

846 (C–D) GENERAL INDEX

convert program, 806\COOH (chemsym), 517\copyfromgoban (igo), 694, 695

copying, Go board, 694, 695\copytogoban (igo), 694, 695\CopyVect (curve2e), 49, 50

Corel Draw program, 1corollory env. (beamer), 769cos (pic), 19\coulomb (SIunits), 514\coulombpercubicmetrenp (SIunits), 516counterclockwise option (rotating), 42\COval (axodraw), 558\cql (MusiXTEX), 592\cqu (MusiXTEX), 592

Crayola colors, 719\Crdexa (tlgc), 701\crdima (bridge), 699, 700, 701

createsudoku package, 710–712crossword env. (crosswrd), 703crosswords

{} (curly braces), empty cell indicator, 704, 705classical puzzles, 705, 706creating, 702, 703, 704, 705external puzzle generation, 709fill-in puzzles, 707layout adjustment, 708number puzzles, 707, 708

crosswrd package, 702–704CRZ syntax (m-ch-en), 546\csh (MusiXTEX), 592

CTAN (Comprehensive TEX Archive Network)archived files, finding and transferring, 813description, 810files, from the command line, 814TEX file catalogue, 811web access, 810, 811, 812, 813, 814

\CText (axodraw), 558\CTri (axodraw), 558\cu (MusiXTEX), 592, 593, 594, 595

cubic Bézier curves, 47cultural connotations of color, 716curly braces ({})

around arguments (musical), 596empty crossword cell indicator, 704, 705grace notes (musical), 607

currentsection key (beamer), 783currentsubsection key (beamer), 783\Curve

(axodraw), 558(curve2e), 47, 48, 49

curve2e package, 47–50curves

Béziercubic, 47

curves (cont.)quadratic, 46, 47

drawing, 47, 48–50curves package, 15, 47\Cvar (circ), 577

cwpuzzle package, 704–708, 709cyan syntax (xcolor), 722, 726Cyan, Magenta, Yellow, Black (CMYK) color, 715, 719\cyclobutane (lowcycle), 527, 528

cyclohexane chair forms, 531\cyclohexaneh (carom), 523, 524, 527, 535\cyclohexanev (carom), 522, 523, 524, 527, 535, 538\cyclopentaneh (lowcycle), 526, 527\cyclopentanehi (lowcycle), 527\cyclopentanev (lowcycle), 526, 527\cyclopentanevi (lowcycle), 526, 527\cyclopropane (lowcycle), 528\cyclopropaneh (lowcycle), 527\cyclopropanehi (lowcycle), 527\cyclopropanev (lowcycle), 527, 539\cyclopropanevi (lowcycle), 527

DD syntax (PMX), 638\D (circ), 577d syntax

(M-Tx), 654(PMX), 624, 625

“d” in integrands, 513D"..." syntax (PMX), 638D<...D> syntax (PMX), 638\DANTE (tlgc), 729darkgray syntax (xcolor), 726\DashArrowArc (axodraw), 558\DashArrowArcn (axodraw), 558\DashArrowLine (axodraw), 558\DashCArc (axodraw), 558\DashCurve (axodraw), 558\dashed (circ), 579dashed (pic), 19\dashhasheddash (xymtexps), 538\DashLine (axodraw), 559\date (beamer), 754, 757, 761date in head/foot syntax (beamer), 777DB syntax (m-ch-en), 544\Dcap (circ), 577

dcolumn package, 737\dcqu (MusiXTEX), 592dd syntax (PMX), 624, 625\ddummy (texmate), 682\deca (SIunits), 515\decaheteroh (hetarom), 529\decaheterohi (hetarom), 529\decaheterov (hetarom), 529, 530\decaheterovb (hetarom), 529

ch-end.tex,v: 1.24 2007/06/15

Page 94: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 847 — #29

GENERAL INDEX (D) 847

\decaheterovi (hetarom), 529\decaheterovt (hetarom), 529

decaline derivatives, 525\decalineh (carom), 524, 527\decalinev (carom), 524, 527\decalinevb (carom), 527\decalinevt (carom), 527\decamethylene (methylen), 538\decamethylenei (methylen), 538\deci (SIunits), 515\DeclareGraphicsExtensions (graphics/graphicx), 33, 34\DeclareGraphicsRule (graphics/graphicx), 29, 34, 35

dedicated drawing tools, see drawing tools (dedicated).def file extension (graphics/graphicx), 24\defconsensus (texshade), 548define (pic), 19\definechemical (m-ch-en), 543\definecolor

(color), 743, 747, 748, 751(xcolor), 720, 721, 726, 727, 734

\definecolorseries (xcolor), 734, 735, 736\definecolorset (xcolor), 727, 728definition env. (beamer), 769definitions env. (beamer), 769\DEP (MusiXTEX), 592\depth (graphics/graphicx), 38depth key (graphicx), 29derivation, 539derived units, 514description env. (beamer), 786device color spaces, 715\DFF (circ), 579\dhqu (MusiXTEX), 592

dia program, 1, 6\Diagram (feyn), 556, 557\diagram (texmate), 684\diagramcache (texmate), 685\diagrammove (texmate), 686\diagramnumber (texmate), 686

diagrams, see also graphscharacter-based, 13typesetting, 16

\diagramsign (texmate), 685\diam

(bridge), 702(tlgc), 699

\diamondsuit, 698, 699\dimethylene (methylen), 538\dimethylenei (methylen), 538\ding (pifont), 724direction key (beamer), 775\DirFromAngle (curve2e), 49, 50Disable: syntax (M-Tx), 652displaymath env. (pst-pdf), 800displaymath option (pst-pdf), 800

dissolves, slides, 774, 775diversity package, 549\DividE (curve2e), 49\DividECurve (curve2e), 49, 50\dmass (circ), 580document env., xxxidocumentation, see also online resources

command-line interface, 815panel interface, 816search by name, 815search by product, 816texdoc, 815texdock, 816

\documentclass, xxxidollar sign ($), comment indicator (chess), 678\dontindentwhite (bg), 698\dontshowcube (bg), 697, 698\dontshowmoves (bg), 698\dontshownumbers (bg), 697\doqu (MusiXTEX), 592

dotted notes (musical), 622dotted rhythms (musical), 604\dottedline (epic), 521

double bars (musical), 603double flat symbol (musical), 605double quotes ("..."), guitar chords, 608\doublerulesepcolor (colortbl), 742, 751

doublets (musical), 605doubly dotted notes (musical), 622down (pic), 19down fermata ornaments (musical), 630\downbow (MusiXTEX), 592\downtrio (MusiXTEX), 592dp key (beamer), 777dpic program, 583\dqu (MusiXTEX), 592DR syntax (m-ch-en), 544draft key (graphicx), 29, 30draft option

(beamer), 753(graphics/graphicx), 25(pst-pdf), 800

DraTex package, 5, 15drawing graphic objects, see graphics languages, see

manipulating graphic objectsdrawing tools (dedicated), see also graphics languages

calculations, 1Corel Draw, 1dia, 1for plotting, 2, 17gnuplot, 17Maple, 2Mathematica, 2MATLAB, 2Octave, 2

ch-end.tex,v: 1.24 2007/06/15

Page 95: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 848 — #30

848 (D–E) GENERAL INDEX

drawing tools (dedicated) (cont.)Octaviz, 2Octplot, 2overview, 1, 2xfig, 1

drawing typesalgorithmic display, 5algorithmic structural, 5art graphics

choosing a language for, 22description, 4

“black box”, 3, 4computer generated, 5derived from textual representation, 5free-hand pictures, 3, 4object-oriented, 4, 5overview, 3–6photographs, 4self-contained object-oriented, 4single object, 3, 4

\drumclef (MusiXTEX), 592\ds (MusiXTEX), 592, 594\dtetrastereo (aliphat), 533\Dtext (circ), 581\Dtrigonal (aliphat), 533\dtrigonal (aliphat), 533\dtrigpyramid (xymtexps), 540\duevolte (MusiXTEX), 592\dummy (texmate), 681, 682duration key (beamer), 775duration of musical notes, 622, 662Dusty Miller musical example, 608dvi2svg program, 13dvipdf option

(graphics/graphicx), 24(xcolor), 721

dvipdf program, 24dvipdfm option

(graphics/graphicx), 24(pict2e), 43(xcolor), 721

dvipdfm program, 24, 797, 798, 803dvipdfmx option (xcolor), 721dvipdfmx program, 797–799, 803, 804, 806dvips option

(graphics/graphicx), 24(pict2e), 43(xcolor), 721

dvips program, xxviii, 11, 16, 17, 24, 25, 558, 614, 618, 637, 719,721, 722, 725, 797–801, 803–806

dvips.def file (graphics/graphicx), 24dvipsnames option (xcolor), 721, 727dvipsone option

(graphics/graphicx), 24(xcolor), 721

dvipsone program, 17, 24dvisvg program, 13dvisvgm program, 13dviwin option

(graphics/graphicx), 24(xcolor), 721

dviwin program, 24dynamic key (beamer), 767dynamical marks (musical), 638

Ee syntax (PMX), 625, 628E: syntax (abc), 602, 608EB syntax (m-ch-en), 544\EBox (axodraw), 558\ECO (texmate), 683

edges (Feynman diagrams), 572eepic package, 17, 20, 511, 521, 522electrical circuits, see���� and PSTricks indexelectronic box symbols, 578electronics diagrams

drawing position, moving, 580electronic box symbols, 578font for, 576–582gate symbols, 578integrated circuit symbols, 579interactive generation, 586junctions, 579m4 macro processor, 583–585npn transistor, 581optics, 581pin connections, 579symbol connections, 579symbols, 577trigger symbols, 578

\elemskip rigid length (MusiXTEX), 595, 597, 602ellipse (pic), 17, 19emphfields key (chessboard), 669\empty, xxxi

emTeX program, 24emtex option

(graphics/graphicx), 24(xcolor), 721

Enable: syntax (M-Tx), 652encapsulation, 35, 36Encore program, 588\endextract (MusiXTEX), 594, 596

endocyclic bonds, 523\endpiece (MusiXTEX), 594, 599

engineering drawings, see bioinformatics, see chemical formulas,see Feynman diagrams, see scientific texts

\enotes (MusiXTEX), 591, 594–596, 599enpassant package, 670\ensuremath, 699enumerate env. (beamer), 770, 786

ch-end.tex,v: 1.24 2007/06/15

Page 96: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 849 — #31

GENERAL INDEX (E–F) 849

envcountsec option (beamer), 753environment key (beamer), 759Environment Variables

TEX (��������), 63, 64epic package, 15, 511, 520–522, 537ePiX language, 20ePiX program, 20.eps file extension, 35

(graphics/graphicx), 35EPS (Encapsulated PostScript), 35, 36epsfig package, 42epstopdf program, 804, 806eqnarray env. (pst-pdf), 800equal sign (=), natural symbol (musical), 605equation env. (pst-pdf), 800EQUILIBRIUM syntax (m-ch-en), 542, 546ER syntax (m-ch-en), 544etex program, 14\ethanestereo (aliphat), 533\ethylene (aliphat), 533

ethylene derivatives, 533\Ethylenev (aliphat), 533\ethylenev (aliphat), 533\ETri (axodraw), 558

evince program, 12\exa (SIunits), 515example env. (beamer), 769exampleblock env. (beamer), 778, 779examples, this book, xxxi, xxxiiiExcel program, 21exclamation points (!!), color expression, 732\ExecuteOptions, 25

expression marks (musical), 657, 658ext key (graphicx), 29external vertices (Feynman diagrams), 564\extrarowheight rigid length (array), 738–741

extsizes package, 753

F\f (MusiXTEX), 599f syntax (PMX), 624, 625, 631, 636fact env. (beamer), 769family key (beamer), 793family* key (beamer), 793FAQs (Frequently Asked Questions), 809, see also online

resources\farad (SIunits), 514\fboxrule rigid length (xcolor), 723, 724\fboxsep rigid length (xcolor), 724, 748fc syntax (PMX), 625\fcolorbox (xcolor), 720, 723, 724\fdmass (circ), 580\feature (texshade), 549\featureslarge (texshade), 549\femto (SIunits), 515

\femtobarn (hepunits), 516FEN (Forsyth-Edwards-Notation), 674\fenboard

(skak), 674, 675–677(texmate), 684

\fermatadown (MusiXTEX), 592\Fermataup (MusiXTEX), 592\fermataup (MusiXTEX), 592\Feyn (feyn), 557\feyn (feyn), 555–557

feyn package, 555–558FeynArts package, 555feynman package, 555Feynman diagrams, see also scientific texts

arc segments with arrows, 560arrows, 559–561direct use of���� commands, 572font for, 555–557history of, 555immediate mode

arcs, 572definition, 563diagrams in equations, 570edges, 572freezing diagrams, 570labels, 571loop diagrams, 569overview, 569–572

overview, 561–563photons, 561PostScript, 558–561transformers, 572vertex dots, 560vertex mode

algorithmic layout, 563–569blobs, 566coloring diagrams, 567complex vertices, 567definition, 563external vertices, placing, 564fill styles, 564freezing a diagram, 567internal vertices, 566labels, 567, 568, 569line styles, 565line thickness, 566line-drawing keywords, 566polygon keywords, 567, 568vertex styles, 564vertex-drawing keywords, 567vertices, as dots, 566vertices, connecting, 565

zigzag lines, 559, 560feynmf package, 561–572feynmp package, 562, 572

ch-end.tex,v: 1.24 2007/06/15

Page 97: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 850 — #32

850 (F) GENERAL INDEX

ff syntax (PMX), 625ffc syntax (PMX), 625\fff (circ), 579fg key (beamer), 776, 794, 795\figfont (chessfss), 670, 671\figsymbol (chessfss), 671figure env. (beamer), 780figures, slides, 780Figurine chess symbols, 671file extensions

search order, 33, 34specifying, 29, 34, 35

file name parsing, suppressing, 29file type, specifying, 34filecontents* env., 710fill styles (Feynman diagrams), 564fill-in puzzles, 707, see also crosswordsfinal option

(graphics/graphicx), 25(pst-pdf), 800

Finale program, 588\fingerprint (texshade), 550

finite state diagrams, see���� and PSTricks indexfirstsection key (beamer), 783FIVE syntax (m-ch-en), 542\fivefuseh (fusering), 537\fivefusehi (fusering), 537\fivefusev (fusering), 537\fivefusevi (fusering), 537\fiveheteroh (hetarom), 529\fiveheterohi (hetarom), 529\fiveheterov (hetarom), 528, 529, 539\fiveheterovi (hetarom), 529\fiveunitv (hetarom), 534\fiveunitvi (hetarom), 534\fla (MusiXTEX), 593\flageolett (MusiXTEX), 592

flat symbol (musical), 605Flats: syntax (M-Tx), 652, 656flow program, 16flow charts, 16, see also���� indexflow language, 16\fmf (feynmf), 561, 565, 567–572\fmfblob (feynmf), 566\fmfblobn (feynmf), 566\fmfbottom (feynmf), 565\fmfbottomn (feynmf), 565\fmfcmd (feynmf), 572\fmfcurved (feynmf), 565\fmfcyclen (feynmf), 565, 572\fmfdot (feynmf), 561, 566, 568, 569\fmfdotn (feynmf), 566, 570fmffile env. (feynmf), 562\fmffixed (feynmf), 569, 570\fmffreeze (feynmf), 567, 569, 570

fmfgraph env. (feynmf), 568, 569fmfgraph* env. (feynmf), 561, 568, 570–572\fmfi (feynmf), 569, 570\fmfiequ (feynmf), 569\fmfipair (feynmf), 570\fmfipath (feynmf), 569, 570\fmfiv (feynmf), 569, 570\fmflabel (feynmf), 568, 570\fmfleft (feynmf), 561, 565, 569–572\fmfleftn (feynmf), 565, 568, 569\fmfn (feynmf), 565\fmfpen (feynmf), 566\fmfpoly (feynmf), 567\fmfrcyclen (feynmf), 565\fmfright (feynmf), 561, 565, 569–572\fmfrightn (feynmf), 565, 568, 569\fmfstraight (feynmf), 565\fmfsurround (feynmf), 565\fmftop (feynmf), 565\fmftopn (feynmf), 565\fmfv (feynmf), 566\fmfvn (feynmf), 566\fmpolyn (feynmf), 567.fmt file extension (abc), 612

foiltex package, 719fontenc package, 752fonts

cchess46 (cchess), 688chess

Figurine symbols, 671generic mechanism, 669–673list of, 670normal characters, 671selecting, 672, 673switching, 672

electronics diagrams, 576–582feyn (feyn), 555–557Feynman diagrams, 555–557gosign50 (go), 691optics diagrams, 576–582skaknew (skak), 673slides, 758Symbol (pstricks), 250timing diagrams, 573ZapfDingbats (pstricks), 249, 250

footline syntax (beamer), 773, 777\footnote (beamer), 789

footnotes, slides, 789Forsyth-Edwards-Notation (FEN), 674FOUR syntax (m-ch-en), 542four-color harmonics, 718four-member carbon cycles, 528\fourhetero (hetarom), 528, 529

fractals, see���� and PSTricks indexfragile key (beamer), 759, 790, 791

ch-end.tex,v: 1.24 2007/06/15

Page 98: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 851 — #33

GENERAL INDEX (F–G) 851

\Frame (cwpuzzle), 704, 705\frame (beamer), 754, 758, 761frame env. (beamer), 754, 758, 759, 761, 776, 784, 790frame key (beamer), 789, 790\frameblock (texshade), 549

frames, see also boxesslides, creating, 758text in slides, 775, 776

\framesubtitle (beamer), 759framesubtitle syntax (beamer), 794\frametitle (beamer), 754, 755, 759frametitle syntax (beamer), 794free-hand pictures, 3, 4freezing a Feynman diagram, 567, 570Frequently Asked Questions (FAQs), see online resources\from (circ), 580from (pic), 19\frompin (circ), 580, 581\fullboard (bg), 697\fullincr (bg), 698\furanose (hcycle), 532, 539

furanoses, 532fused five- and six-member rings, 530fused rings, 524fusering package, 537fusing ring units, 536

G\G (circ), 578\G2Text (axodraw), 558game env. (bg), 696, 697, 698games, see backgammon, see bridge, see chess, see crosswords,

see Go, see Sudoku\gapchar (texshade), 550

gastex package, 15gate option (circ), 577gate symbols, 578\gauss (hepunits), 516\GBox (axodraw), 558\GBoxc (axodraw), 558\GCirc (axodraw), 558\generalmeter (MusiXTEX), 596, 599\generalsignature (MusiXTEX), 593, 596\generategrid (createsudoku), 711\genfile (createsudoku), 711gensud.sud file (createsudoku), 711\geometricskipscale (MusiXTEX), 595

geometry, see���� and PSTricks index\getproblem (solvesudoku), 711\getsequence (textopo), 551, 552\GeV (hepunits), 516.gf file extension (feynmf), 563

gftopk program, 563ghostscript program, xxv, xxvi, xxviii, 11, 12, 798ghostview program, xxvi, xxviii, 10, 36, 804

\GHz (hepunits), 516\giga (SIunits), 515

GIMP program, 4, 17gis syntax (LilyPond), 662GIVES syntax (m-ch-en), 546global A options (musical), 643\GlueArc (axodraw), 558\Gluon (axodraw), 558\GND (circ), 581

gnuplot program, 17, 18Go

goban (board)captions, 694clearing, 694copying, 694, 695displaying, 693, 694rotating, 695size, 694

history of, 690, 691stones

identifying, 692placing, 691, 692, 693typesetting, 695

go package, 690, 691\gobansize (igo), 693\gobansymbol (igo), 692, 693, 694\gosign (tlgc), 691\GOval (axodraw), 558

gpic program, 16, 17, 19, 583, 584grace notes (musical)

{} (curly braces), 607~ (tilde), 607in xtuplets, 627LilyPond, 663PMX, 627, 629, 630

gracings (musical), 607grad syntax (xcolor), 734–736gradients (table), color, 747, 748\gram (SIunits), 516

graphic objectsconflicting requirements, 3definition, 2drawing, see graphics languages, see manipulating graphic

objectsmanipulating, see manipulating graphic objectstypesetting, 2, 3

graphicselements, SVG, 12files, including, see including graphics filesrotating

bounding box, 27, 31, 32graphic objects, 39–42\includegraphics keys, 29reference points, 40–42

ch-end.tex,v: 1.24 2007/06/15

Page 99: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 852 — #34

852 (G–H) GENERAL INDEX

graphics (cont.)scaling

bounding box, 27, 29graphic objects, 37\includegraphics keys, 29, 30text, 37

slides, 792systems, typesetting, 2, 3

graphics package, 2, 3, 7, 8, 10, 23–27, 30, 33–40, 791graphics languages, see also drawing tools

AlDraTex package, 15DraTex package, 15CGM (Computer Graphics Metafile), 13character-based diagrams and pictures, 13choosing, 21, 22diagrams, typesetting, 16ePix, 20flow language, 16for basic objects, 17, 18, 19, 20for plotting, 17, 18gnuplot, 17pic, 17, 19graphs

drawing, 17, 18typesetting, 16

kernel drawing language, 16LATEX picture mode extensions, 15, 16��������, see���� indexPDF (Portable Document Format), 11, 12pic, 17–20PICTEX, 13, 14pictures, 17–20pictures from fonts, 13PostScript, 10, 11PSTricks, see PSTricks indexstructured drawing, 20SVG (Scalable Vector Graphics), 12, 13TEX-based, 13–17WebCGM, 13XY-pic, 16

graphics.cfg file (graphics/graphicx), 25\graphicspath (graphics/graphicx), 33

graphicx package, 23–25, 28–42, 800graphs, see also����, PSTricks, and XY-pic index, see also

diagrams, see also plottingdrawing, 17, 18graphics languages

drawing, 17, 18typesetting, 16

histogram, 14pie chart, 15typesetting, 16

GRASS program, 21Grassman’s Law, 714Gray option (xcolor), 721

Gray syntax (xcolor), 728, 729\gray (SIunits), 514gray option (xcolor), 721gray syntax

(color), 720(xcolor), 720, 723, 728–730

gray color model, 719\grcl (MusiXTEX), 592\grcu (MusiXTEX), 592green syntax (xcolor), 722, 726, 727\gregorianCclef (MusiXTEX), 592\gregorianFclef (MusiXTEX), 592grid key (beamer), 794grids, see���� and PSTricks index\GText (axodraw), 558\GTri (axodraw), 558

guitar chords, 608, 611, 612guitar diagrams, drawing, 612gunzip program, 35\Gvar (circ), 578

HH syntax (PMX), 636\H (chemsym), 517\h (chemsym), 517h syntax (PMX), 631, 632, 636\ha (MusiXTEX), 593\halfboard (bg), 697\halfincr (bg), 698\hand

(bridge), 700–702(tlgc), 699

handidness of substituents, 522, 531, 535handout option (beamer), 753\hanthracenev (lowcycle), 527\hanthracenv (carom), 524

harmonic color circle, 717harmonies, color, 717, 718\HBLens (circ), 580\hbox, 725

hcycle package, 520, 532headerCol syntax (beamer), 776headings (table), color, 748\heart

(bridge), 702(tlgc), 699

\heartsuit, 698, 699\hecto (SIunits), 515\height (graphics/graphicx), 38height (pic), 19height key (graphicx), 29, 31, 32helicalwheel env. (textopo), 551, 552helixwheel env. (textopo), 552help, see online resources\henry (SIunits), 514

ch-end.tex,v: 1.24 2007/06/15

Page 100: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 853 — #35

GENERAL INDEX (H–I) 853

hepnicenames package, 512, 560heppennames package, 512, 560\heptamethylene (methylen), 538\heptamethylenei (methylen), 538

hepunits package, 516, 517\hertz (SIunits), 514

hetarom package, 520, 528, 530, 534hetaromh package, 520, 528, 534heterocyclic compounds, 528–530\hexamethylene (methylen), 538\hexamethylenei (methylen), 538\hflipgoban (igo), 695HH syntax (PMX), 636\hhline

(colortbl), 751(hhline), 750

hhline package, 737, 742, 750hide key value (beamer), 753hideallsubsections key (beamer), 783\hideconsensus (texshade), 548hideerrors option (xcolor), 721\hidelegend (textopo), 553\hidemoves (skak), 677, 678, 679\hidenumbering (texshade), 549hideothersubsections key (beamer), 783hiderotate option (graphics/graphicx), 25\hiderowcolors (xcolor), 740hidescale option (graphics/graphicx), 25\hideTMlabels (textopo), 551

hiding/showingchess pieces, 676slides

alternative text, 769opaqueness, 768slide elements, 767specific rows, 765successive columns, 763successive rows, 763transparency, 768

high-energy physics, units, 516\highlight (skak), 676

highlightingchess, 676nucleotide sequences, 548–550peptide sequences, 548–550slides, parts of elements, 771table elements, with color, 745, 749, 750text in tables, 744

highlydynamic key (beamer), 767hiresbb key (graphicx), 28hiresbb option (graphics/graphicx), 25HiResBoundingBox (PostScript), 25, 28\hl (MusiXTEX), 592, 593\hline (colortbl), 741

How To Ask Questions The Smart Way, 810

\Hpause (MusiXTEX), 592\hpause (MusiXTEX), 592, 594, 599\hpausep (MusiXTEX), 592\hphenanthrenev

(carom), 524(lowcycle), 527

\HR (tlgc), 26\hs (MusiXTEX), 592HSB option (xcolor), 721HSB syntax (xcolor), 728, 729Hsb syntax (xcolor), 728, 729hsb option (xcolor), 721hsb syntax

(color), 720(xcolor), 720, 728, 729

HSB (Hue, Saturation, Brightness) color, 715, 719\HSLens (circ), 580

HSV (Hue, Saturation, Value) color, 715ht key (beamer), 777, 794HTML option (xcolor), 721HTML syntax (xcolor), 728, 729\htopin (circ), 579, 581\hu (MusiXTEX), 592, 593, 594\HVLens (circ), 580\hyperlink (beamer), 784, 785\hyperlinkappendixend (beamer), 786\hyperlinkappendixstart (beamer), 786\hyperlinkdocumentend (beamer), 786\hyperlinkdocumentstart (beamer), 786\hyperlinkframeend (beamer), 786\hyperlinkframeendprev (beamer), 786\hyperlinkframestart (beamer), 786\hyperlinkframestartnext (beamer), 786\hyperlinkmovie (beamer), 774\hyperlinkmute (beamer), 774\hyperlinkpresentationend (beamer), 786\hyperlinkpresentationstart (beamer), 786

hyperlinks, slides, 784–818\hyperlinkslidenext (beamer), 786\hyperlinkslideprev (beamer), 786\hyperlinksound (beamer), 774hyperref option

(beamer), 753(xcolor), 721

hyperref package, 721, 753, 783, 798, 803–805\hypertarget (beamer), 783, 784, 785

hyphen (-), tie symbol, 607, 608

II syntax (PMX), 648\I (circ), 577i syntax (pic), 19I: syntax (abc), 608\ib (MusiXTEX), 599\ibbu (MusiXTEX), 597

ch-end.tex,v: 1.24 2007/06/15

Page 101: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 854 — #36

854 (I) GENERAL INDEX

\ibl (MusiXTEX), 596, 597\ibu (MusiXTEX), 596, 597ic option (circ), 577\ifont (texmate), 687ignorebg key (beamer), 777ignoreonframetext option (beamer), 753igo package, 691–695\igobreakafterdiagram (igo), 694\igocircle (igo), 692\igocross (igo), 692, 695\igofontsize (igo), 693, 694\igonone (igo), 691, 692\igosquare (igo), 692, 695\igotriangle (igo), 692, 695\iiclose (texmate), 687\iiiclose (texmate), 687\iiifont (texmate), 687\iiiopen (texmate), 687\iiopen (texmate), 687

illustrations, see drawingIllustrator program, 586image file location, specifying, 33ImageMagick program, 7, 17images, see drawing\imidazolev (hetarom), 530\imidazolevi (hetarom), 530

immediate mode (Feynman diagrams)arcs, 572definition, 563diagrams in equations, 570edges, 572freezing diagrams, 570labels, 571loop diagrams, 569overview, 569–572

\Impulse (circ), 578inactive option (pst-pdf), 800\includegraphics

(beamer), 791, 792, 794(graphics), 26, 27, 33–35(graphicx), 24, 25, 28, 30–32, 33–35

\includegraphics*(graphics), 25, 27(graphicx), 28

including graphics filesaspect ratio, keeping, 29, 31bounding box

aspect ratio, keeping, 29clipping graphics to, 29, 30comments, 25, 28draft mode, 25, 29, 30final mode, 25fitting to graphics, 26, 27height, 28, 29, 32\includegraphics syntax, 28–32

including graphics files (cont.)resizing, 27rotated material, hiding, 25rotating, 27, 31, 32scaled material, hiding, 25scaling, 27, 29specifying, 28, 30trimming space, 28, 30viewports, 28, 30width, 28, 29

commands, inserting, 35declarations, 33–35default key values, setting, 32, 33draft mode, 25, 30encapsulation, 35, 36file extensions

search order, 33, 34specifying, 29, 34, 35

file name parsing, suppressing, 29file type, specifying, 34final mode, 25height, 28, 29, 31, 32image size, 29\includegraphics syntax, 25–32location of image files, 33options, 24, 25rotated material, hiding, 25rotation, 29, 31, 32scaled material, hiding, 25scaling, 29, 30scaling factor, 29, 30trimming space, 28, 30viewports, 28, 30width, 28, 29, 31

indane derivatives, 528\indaneh (lowcycle), 527\indanehi (lowcycle), 527, 528\indanev (lowcycle), 526, 527, 528\indanevi (lowcycle), 527Indent: syntax (M-Tx), 651, 652\indentwhite (bg), 698\indolev (hetarom), 530\indolevi (hetarom), 530\indolizinev (hetarom), 530\indolizinevi (hetarom), 530\inffont (chessfss), 673\infsymbol (chessfss), 673

inputenc package, 752, 753\insertbackfindforwardnavigationsymbol (beamer),

773\insertdocnavigationsymbol (beamer), 773\insertframenavigationsymbol (beamer), 773\insertframenumber (beamer), 777\insertframesubtitle (beamer), 794\insertlogo (beamer), 776, 777

ch-end.tex,v: 1.24 2007/06/15

Page 102: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 855 — #37

GENERAL INDEX (I–L) 855

\insertsectionnavigationsymbol (beamer), 773\insertshortdate (beamer), 777\insertshortframetitle (beamer), 759\insertslidenavigationsymbol (beamer), 773\insertsubsectionnavigationsymbol (beamer), 773\inserttotalframenumber (beamer), 777\inst (beamer), 761\institute (beamer), 761\instrumentnumber (MusiXTEX), 596

instruments (musical)clefs, 621definition, 617names, 621number of, 596, 619

integrated circuit symbols, 579intensity, color, 718internal vertices (Feynman diagrams), 566International System of Units (SI), 512–516internote spacing (musical), 602\invfemtobarn (hepunits), 516\invisible (beamer), 768, 784invisible key (beamer), 767invisibleenv env. (beamer), 770\invpicobarn (hepunits), 516\islurd (MusiXTEX), 597\isluru (MusiXTEX), 596, 597, 599\isobenzofuranev (hetarom), 530\isobenzofuranevi (hetarom), 530\isoindolev (hetarom), 520, 530\isoindolevi (hetarom), 530\isoquinolinev (hetarom), 530\isoquinolinevi (hetarom), 530\isotope (isotope), 518

isotope package, 518\isotopestyle (isotope), 518\isoxazolev (hetarom), 530\isoxazolevi (hetarom), 530\item (beamer), 770, 786, 787, 788itemize env. (beamer), 771, 772, 786, 787\itenu (MusiXTEX), 599\IvaR (circ), 577\ivfont (texmate), 687

Jj syntax (PMX), 631\JKMSFF (circ), 579\joule (SIunits), 514, 516\jouleperkilogramkelvinnp (SIunits), 516.jpeg file extension (pst-pdf), 806\junction (circ), 579

junctions, 579

KK syntax (PMX), 640, 641

K type slurs (musical), 636K: syntax (abc), 601, 603, 604–606\kat (SIunits), 514keepaspectratio key (graphicx), 29, 31, 32\keepreducing (solvesudoku), 711\kelvin (SIunits), 514, 516\kemtkn (chemsym), 517

kernel drawing language, 16\key (LilyPond), 662, 663–665

key (musical)changes, 641LilyPond, 662notation, 601signature, 620

keyval package, 33\kilo (SIunits), 515\kilogram (SIunits), 514\kilogrampersecondcubicmetrenp (SIunits), 516\king (chessfss), 672\kinveV (hepunits), 516\knight (chessfss), 672\kqu (MusiXTEX), 592

LL syntax (PMX), 642\L (circ), 577\l (MusiXTEX), 592l syntax (PMX), 625, 631, 633, 637, 641\l... (MusiXTEX), 594L: syntax

(M-Tx), 655, 659, 660(abc), 601, 603, 604

\La (circ), 577lab apparatus, see PSTricks index\label (beamer), 783, 785label key (beamer), 759, 761\labelregion (textopo), 553

labelsFeynman diagrams, 567, 568, 569, 571slides, 785timing diagrams, 573

\labelstyle (textopo), 553large option (skak), 675\largeboard

(cchess), 690(skak), 675

\largegoban (igo), 694\larw (timing), 575\Laser (circ), 580, 581last syntax (xcolor), 734\lastmove (skak), 679

latex program, 797, 800, 801, 803, 804, 806LATEX files, obtaining

web access, 810, 811, 812, 813, 814\LED (circ), 577

ch-end.tex,v: 1.24 2007/06/15

Page 103: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 856 — #38

856 (L–M) GENERAL INDEX

left (pic), 19left key (beamer), 777\leftdiagramturn (texmate), 686\leftrepeat (MusiXTEX), 592\leftrightrepeat (MusiXTEX), 592leftskip key (beamer), 777, 794libcct.m4 file (pic), 583\lifthpause (MusiXTEX), 592\liftpause (MusiXTEX), 592

light, and color, 714lightgray syntax (xcolor), 726LilyPond language, 661–665LilyPond program, xxviii, 661–665LilyPond notation system, see music scores (LilyPond)\LinAxis (axodraw), 559\LINE (curve2e), 47, 48–50\Line

(axodraw), 559(curve2e), 47, 48–50

\line, 43(curve2e), 47, 48–50(pict2e), 43, 44

line (pic), 17line graphics

arrow styles, 44Bézier curves

cubic, 47quadratic, 46, 47

circles, 45curves, 47, 48–50limitations, 42, 43ovals, 45, 46overview, 42, 43radii, specifying, 45, 46representing complex numbers, 49, 50slope arguments, 44

line styles (Feynman diagrams), 565line-drawing keywords (Feynman diagrams), 566lines (musical)

breaks, 642definition, 617

lines (rules), see also connectionsstyles

Feynman diagrams, 564, 565, 566thickness, 566

tables, coloradding, 748inside the table, 749partial, 751selected, 750whole table, 741width, 751

\linethickness, 47(pict2e), 44, 45, 46(timing), 576

\linewidth rigid length, 33linewidth key (chessboard), 669linguistics, see PSTricks and XY-pic indexlist env., 724list items, slides, 786–788listings package, 790lists, colored, 724\lmoiety (chemstr), 522, 526\ln (circ), 579\loadgame (skak), 679

locant package, 520.log file extension (feynmf), 562, 567\LogAxis (axodraw), 559

logical circuit diagrams, see XY-pic indexlogical meter (musical), 620\logo (beamer), 776, 777, 792, 794

logos, slides, 776, 777\longa (LilyPond), 663\LongArrow (axodraw), 559\LongArrowArc (axodraw), 559\LongArrowArcn (axodraw), 559

longtable package, 517, 737, 742loop diagrams (Feynman diagrams), 569\loopextent (textopo), 552, 553\loopfoot (textopo), 553

lowcycle package, 520, 526lower key (beamer), 778lower-order cycles, 527, 528\lppz (MusiXTEX), 592\lpz (MusiXTEX), 592\lpzst (MusiXTEX), 592\lsf (MusiXTEX), 592\lsfz (MusiXTEX), 592\lsqu (MusiXTEX), 592\lst (MusiXTEX), 592\ltetrahedralS (aliphat), 540\ltrigona (aliphat), 533.ltx file extension, xxxiltxarrows option (pict2e), 44.ltxb file extension, xxxi\lumiunits (hepunits), 516.ly file extension, xxxi

(LilyPond), 665\lyl (chemstr), 535, 536

lyrics (musical)global adjustment, 653M-Tx, 659, 660PMX, 647

Mm syntax (PMX), 629, 630, 631, 640M type slurs (musical), 637, 638m-ch-en package, 541–547M-Tx notation system, see music scores (M-Tx)M-Tx language, xxviii, 616, 617, 651–660

ch-end.tex,v: 1.24 2007/06/15

Page 104: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 857 — #39

GENERAL INDEX (M) 857

M-Tx program, 647.m4 file extension, xxxi

m4 program, 576, 583, 584M: syntax (abc), 601, 604, 605, 606magenta syntax (xcolor), 722, 726magnifying glass effect, see PSTricks index\mainline (skak), 677, 678, 679\major (LilyPond), 663–665\makeatletter, xxxii, xxxiii\makeatother, xxxii, xxxiii\makebarchess (texmate), 680\makebarother (texmate), 680\makebox

zero-width, 37(cwpuzzle), 705

makecirc package, 576\makediagrams (texmate), 685, 686\makediagramsfont (texmate), 686\makegametitle (texmate), 683

makeindex program, 806\maketitle (beamer), 754, 757, 761

manipulating graphic objectsaspect ratio, keeping, 38height, changing, 38, 39, see also bounding boxline graphics

arrow styles, 44circles, 45, see also circles, see also ovalscubic Bézier curves, 47curves, 47, 48–50limitations, 42, 43ovals, 45, 46overview, 42, 43quadratic Bézier curves, 46, 47radii, specifying, 45, 46representing complex numbers, 49, 50slope arguments, 44

resizing, 38, 39rotating

LATEX box, 39–42reference point, 40–42

scaling, 37width, changing, 38, 39

Maple program, 2markfields key (chessboard), 669markfile key (chessboard), 669markstyle key (chessboard), 669masking color, 737Mathematica program, 1, 21mathematical functions, symbols for, 512mathematical plots, see PSTricks index\mathrm, 512

MATLAB program, 2matrices, see PSTricks and XY-pic index\maxovalrad (pict2e), 45, 46

mechanical drawings, see���� index

mediumqspace option (SIunits), 515mediumspace option (SIunits), 515\mega (SIunits), 515

membrane protein topology plots, 551–553���� language, 21, see also���� index�������, see���� index������ package, see���� index��������, see���� indexmeter (musical)

abc notation system, 601changes, 640, 654logical, 620M-Tx, 654PMX, 640representation, 620

Meter: syntax (M-Tx), 651, 652\meterC (MusiXTEX), 592\meterfrac (MusiXTEX), 596, 599\meterplus (MusiXTEX), 592

methylen package, 537\metre (SIunits), 514, 516\metron (MusiXTEX), 592\Mev (hepunits), 516\MeVoverc (hepunits), 516\meVoverc (hepunits), 516\MeVovercsq (hepunits), 516

mfpic package, 21, 583\MHz (hepunits), 516\micro (SIunits), 515, 516.mid file extension (PMX), 648\middlecube (bg), 696, 697

MIDI language, 610, 647–649, 660MIDI mnemonics, 649\milli (SIunits), 515

minus sign (-), color expression, 732\Mirror (circ), 580, 581\mirrorgoban (igo), 695

mixing color, 731\mode (beamer), 760, 796\mode* (beamer), 753, 796\mole (SIunits), 514, 516

molecules, aligning with bonds, 546\momentum (feyn), 556, 557

monochrome, 721monochrome option (xcolor), 721\Mordent (MusiXTEX), 592\mordent (MusiXTEX), 592MOV syntax (m-ch-en), 544\move (bg), 697, 698move (pic), 19mover option (skak), 676\moverel (circ), 580moveroff option (skak), 676\movie (beamer), 774

movies, slides, 774

ch-end.tex,v: 1.24 2007/06/15

Page 105: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 858 — #40

858 (M) GENERAL INDEX

Mozart example, 651.mp file extension, xxxi

mpost program, 637\mrad (hepunits), 516\MRs (textopo), 551, 553.mtx file extension, xxxi\multicolumn, 701

(colortbl), 737, 739\multido (multido), 45

multimedia package, 774\MultVect (curve2e), 49, 50music env. (MusiXTEX), 594, 595, 596, 599music scores, overview, 587–589music scores (abc2mtex)

abc notation system, 600’ (right quote), octave indicator, 603(...), slur symbol, 607, 608, (comma), octave indicator, 603- (hyphen), tie symbol, 607, 608= (equal sign), natural symbol, 605[] (square brackets), chord symbols, 608"..." (double quotes), guitar chords, 608{} (curly braces), grace notes, 607~ (tilde), grace notes, 607^(caret), sharp symbol, 605^^(carets), double flat symbol, 605_ (underscore), flat symbol, 605__ (underscores), double flat symbol, 605accents, 607accidentals, 605bar symbols, 603bars, 603beams, 606broken rhythms, 604changing key, 606chords, 608compound time signatures, 605dotted rhythms, 604double bars, 603doublets, 605Dusty Miller example, 608fiddler instructions, 607gracings, 607guitar chords, 608information fields, description of, 601, 602information fields, table of, 602internote spacing, 602key, 601lowercase letters, 603meter, 601musical information, 601note length, 601, 603, 604note pitch, 603order of symbols, 608pitch, 603, 604

music scores (abc2mtex) (cont.)quadruplets, 605repeat symbols, 603sequence number, 602slurs, 607song title, 602staccato marks, 607tempo, 602ties, 607triplets, 605uppercase letters, 603writing source, 601

abcPlus extensions, 609–612Bach example, 610external programs, calling, 615guitar chords, 611, 612guitar diagrams, drawing, 612including in LATEX documents, 612–614, 615overview, 600PostScript definitions, 612writing to PDF, 614

music scores (LilyPond)accents, 663chords, 663notes

accents, 663beams, 663chords, 663duration, 662, 663grace notes, 663key, 662notation, 661ornaments, 664pitch, 662slurs, 663, 664triplets, 664

ornaments, 664rests, 663running LilyPond, 665slurs, 663, 664source language, 661–665triplets, 664

music scores (M-Tx)annotations, 657, 658bar changes, 654beams, 654, 655body of file, 654–658chords, 656, 657clefs, 653expression marks, 657, 658horizontal adjustment, 658instruments, definition, 617lines, definition, 617lyrics, 659, 660

global adjustment, 653

ch-end.tex,v: 1.24 2007/06/15

Page 106: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 859 — #41

GENERAL INDEX (M) 859

music scores (M-Tx) (cont.)meter changes, 654Mozart example, 651overview, 651, 652pickups, 654preamble of file, 652, 653slurs

blind, 655broken, 655description, 654, 655dotted, 655notation, 654

staves, 617, 652symbols, definition, 617systems, definition, 617vertical adjustment, 658voice

definition, 617labels, 653spacing after, 653

words, definition, 617music scores (MusiXTEX)

{} (curly braces), around arguments, 596Bach example, 590Bartok example, 596beams, 597chords, 594commands, 592instruments, number of, 596notes

commands, 595pitch, 590, 593spacing, 595symbols, 592, 593, 594timing, 590

preprocessors, 615, 616, 617running MusiXTEX, 597, 598, 599slurs, 597source structure, 591type sizes, 596

music scores (PMX)% (percent sign), comment indicator, 619allegro, 646allegro vivace, 644blocks, 622body of file, 621horizontal spacing, manual adjustment, 643inline TEX commands, 646instruments

clefs, 621definition, 617names, 621number of, 619

key signature, 620lines, definition, 617

music scores (PMX) (cont.)logical meter, 620lyrics, 647meter representation, 620MIDI, 647MIDI mnemonics, 649notation, all voices

bar symbols, 639bars, 639global A options, 643key changes, 641line breaks, 642meter changes, 640page breaks, 642page layout, 642page numbering, 642repeats, 639text blocks, 641title blocks, 641voltas, 640

notation, stavesaccidentals, 622, 624, 628arpeggio, 629basic duration, 622beams, 631, 632, 633beams for xtuplets, 627, 628chords, 628, 629clef changes, 639definition, 617dotted notes, 622doubly dotted notes, 622down fermata ornaments, 630duration of notes, 622dynamical marks, 638grace notes, 629, 630grace notes, in xtuplets, 627height, 620horizontal displacement, 624note parameters, 624, 625notes, 622, 623, 624number of, 619octaves, 623on staves, 622–624ornaments, 630, 631parameters, 623, 624, 625pitch, 622pointed rhythms, 624rests, 625, 626slurs, 634–638staccato ornaments, 630stems, 623, 624tenuto ornaments, 630ties, 634, 635, 637xtuplets, 626, 627, 628

ch-end.tex,v: 1.24 2007/06/15

Page 107: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 860 — #42

860 (M–N) GENERAL INDEX

music scores (PMX) (cont.)notes

accidentals, 622, 624, 628basic duration, 622dotted, 622doubly dotted, 622duration, 622grace notes, 629, 630horizontal displacement, 624octaves, 623on staves, 622–624parameters, 623, 624, 625pitch, 622pointed rhythms, 624stems, 623, 624

numerical parameters, 619, 620output path, 621overview, 618page height and width, 642pages, number of, 620parts of, 619pickup bar length, 620pickups, 620PMX commands, 650preamble of file, 619, 620, 621signature, 620splitting apart, 647, 648structure of a score, 619symbols, definition, 617systems

definition, 617indentation, 620number of, 620

voice, definition, 617words, definition, 617

music scores (TEX)inline commands, 646overview, 589, 590with�������, 666

music scores (TEXmuse), 666MusicTEX package, 589musixflx program, 595, 597, 599, 618musixlyr.tex package, 647, 659, 660musixpss program, 637MusiXTEX package, xxvi, xxviii, xxxi, 588, 589–599, 602, 615–617,

623, 628, 634, 635, 646–648, 658, 660, 661MusiXTEX notation system, see music scores (MusiXTEX).mx1 file extension (MusiXTEX), 597, 598, 599.mx2 file extension (MusiXTEX), 597, 598myhexagon.sty file (tlgc), xxxiii\MyRot (tlgc), 39

Nn syntax (PMX), 624, 625Name: syntax (M-Tx), 651, 652

named syntax(color), 720(xcolor), 720, 722, 727

named colorsbehavior options, 721support for, 719within documents, 725

\nameseq (texshade), 549\namesit (texshade), 549\namesrm (texshade), 549\NAND (circ), 578\nano (SIunits), 515\naphdrh (carom), 524, 525, 535, 536\naphdrv (carom), 524, 525\naphdrvb (carom), 525\naphdrvt (carom), 525

nassflow package, 15natheight key (graphicx), 28natural option (xcolor), 721natural symbol (musical), 605natwidth key (graphicx), 28navigation bar, slides, 772, 773, 774navigation symbols syntax (beamer), 773, 777\nbb (MusiXTEX), 599nc syntax (PMX), 625nesting chess variations, 679netpbm program, 7nets, drawing, 15\newcolumntype (array), 738\newgame

(skak), 674, 675, 678, 679(texmate), 683

NEWMAN syntax (m-ch-en), 542news groups, 810, see also online resources\newton (SIunits), 514

Newtonian mechanics symbols, 580\nextdiagrambottom (texmate), 685, 686\nextdiagramtop (texmate), 685, 686\nfet (circ), 577

nicefrac package, 513\nl (circ), 581noamsthm option (beamer), 753\nobarnumbers (MusiXTEX), 599\nodiagrammove (texmate), 686\nodiagramnames (texmate), 686\nodiagramnumber (texmate), 686\nodiagramturn (texmate), 686\nonaheteroh (hetarom), 529\nonaheterohi (hetarom), 529\nonaheterov (hetarom), 520, 529, 530\nonaheterovi (hetarom), 529, 539\nonamethylene (methylen), 538\nonamethylenei (methylen), 538nopstricks option (pst-pdf), 800\NOR (circ), 578

ch-end.tex,v: 1.24 2007/06/15

Page 108: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 861 — #43

GENERAL INDEX (N) 861

normal option (skak), 675normal text syntax (beamer), 795\normalboard

(bg), 697, 698(cchess), 690(skak), 675

\normalgoban (igo), 694\normalsize (LilyPond), 663

notation (chess)commentaries, 681, 682overview, 680–683threats, 681variations, 680, 682, 683

notation (musical), see also music scores (abc2mtex)all voices

bar symbols, 639bars, 639global A options, 643key changes, 641line breaks, 642meter changes, 640page breaks, 642page layout, 642page numbering, 642repeats, 639text blocks, 641title blocks, 641voltas, 640

stavesaccidentals, 622, 624, 628arpeggio, 629basic duration, 622beams, 631, 632, 633beams for xtuplets, 627, 628chords, 628, 629clef changes, 639definition, 617dotted notes, 622doubly dotted notes, 622down fermata ornaments, 630duration of notes, 622dynamical marks, 638grace notes, 629, 630grace notes, in xtuplets, 627height, 620horizontal displacement, 624note parameters, 624, 625notes, 622, 623, 624number of, 619octaves, 623on staves, 622–624ornaments, 630, 631parameters, 623, 624, 625pitch, 622pointed rhythms, 624

notation (musical) (cont.)rests, 625, 626slurs, 634–638staccato ornaments, 630stems, 623, 624tenuto ornaments, 630ties, 634, 635, 637xtuplets, 626, 627, 628

\notationOff (skak), 675notationoff option (skak), 675\notationOn (skak), 675notationon option (skak), 675noteedit program, 588\NOTEs (MusiXTEX), 595\NOTes (MusiXTEX), 595, 599\NOtes (MusiXTEX), 591, 595, 596, 599\Notes (MusiXTEX), 591, 594, 595, 596, 599\notes (MusiXTEX), 591, 595, 596, 599notes option (beamer), 753notes (annotations), see annotations, see commentariesnotes (musical)

accents (LilyPond), 663accidentals, 622, 624, 628basic duration, 622beams, 663chords (LilyPond), 663commands, 595describing staves, 622, 623, 624dotted, 622, 624doubly dotted, 622duration, 622

LilyPond, 662, 663examples, 592grace notes

{} (curly braces), 607~ (tilde), 607in xtuplets, 627LilyPond, 663PMX, 627, 629, 630

horizontal displacement, 624internote spacing, 602key (LilyPond), 662length, 601, 603, 604notation, 661octaves, 623on staves, 622–624ornaments (LilyPond), 664parameters, 623, 624, 625

accidentals, 624, 625beam inhibit, 624, 625dotted notes, 624, 625shift of position, 624, 625stems, 624, 625xtuplets, 625

ch-end.tex,v: 1.24 2007/06/15

Page 109: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 862 — #44

862 (N–O) GENERAL INDEX

notes (musical) (cont.)pitch

abc2mtex, 603, 604LilyPond, 662MusiXTEX, 590specifying, 593, 622

pointed rhythms, 624slurs (LilyPond), 663, 664spacing, 595stems, 623, 624symbols, 592, 593, 594timing, 590triplets (LilyPond), 664

\noteskip rigid length (MusiXTEX), 595\NOTesp (MusiXTEX), 595\NOtesp (MusiXTEX), 595, 599\Notesp (MusiXTEX), 595\notesp (MusiXTEX), 595notheorems option (beamer), 753notightpage option (pst-pdf), 800\npn (circ), 577, 581\NRSFF (circ), 579\Nterm (textopo), 553

nucleotide sequencesaligning, 548–550highlighting, 548–550sequence fingerprints, 550shading, 548–550

\NULL (circ), 579number puzzles, 707, 708, see also crosswordsnumbers, symbols for, 512\nv (circ), 579\nvmos (circ), 577

O\O (chemsym), 517o( syntax (PMX), 630, 631o) syntax (PMX), 630, 631o+ syntax (PMX), 630, 631o. syntax (PMX), 630, 631o.: syntax (PMX), 630O: syntax (abc), 608o: syntax (PMX), 630o> syntax (PMX), 630, 631oˆ syntax (PMX), 631o_ syntax (PMX), 630, 631o˜ syntax (PMX), 630\oa (circ), 581ob syntax (PMX), 630, 631object-oriented drawings, 4, 5oc syntax (PMX), 630, 631\octamethylene (methylen), 538\octamethylenei (methylen), 538

Octave program, 2Octave: syntax (M-Tx), 652

octaves (musical), 623Octaviz program, 2\octfindown (MusiXTEX), 592\octfinup (MusiXTEX), 592

Octplot program, 2oe? syntax (PMX), 630, 631oef syntax (PMX), 630, 631oef? syntax (PMX), 631oen syntax (PMX), 630, 631oen? syntax (PMX), 631oes syntax (PMX), 630, 631oes? syntax (PMX), 630, 631of syntax (PMX), 630, 631ofd syntax (PMX), 630, 631OFF syntax (m-ch-en), 546og syntax (PMX), 630, 631\OH (chemsym), 517\ohm (SIunits), 514oldgate option (circ), 577\oldGclef (MusiXTEX), 592\OM (circ), 581om syntax (PMX), 630, 631ONE syntax (m-ch-en), 542, 546online access to CTAN, 810, 811, 812, 813, 814online resources

Adobe Illustrator, 1Adobe Photoshop, 17archived files, finding and transferring, 813automata diagrams, 15CGM-Open Consortium, 13CTAN (Comprehensive TEX Archive Network), 810

web access, 810, 811, 812, 813, 814dedicated drawing tools, 1, 2documentation

command-line interface, 815panel interface, 816search by name, 815search by product, 816texdoc, 815texdock, 816

DVI to SVG conversion, 13FAQs (Frequently Asked Questions), 809files, getting from the command line, 814How To Ask Questions The Smart Way, 810nets, drawing, 15news groups, 810PDF viewers, 12plotting programs, 17program files, obtaining

web access, 810, 811, 812, 813, 814TEX file catalogue, 811TEX files, 810TEX user groups, 817, 818TUG home page, 810, 811

\only (beamer), 766, 767, 775, 780, 785, 786, 792

ch-end.tex,v: 1.24 2007/06/15

Page 110: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 863 — #45

GENERAL INDEX (O–P) 863

only key value (beamer), 753\onlyenv (beamer), 769onlyenv env. (beamer), 769, 770onlyslideswithnotes key value (beamer), 753onlytextwidth key (beamer), 781\onslide (beamer), 763, 764, 765, 767\OO (chemsym), 517op syntax (PMX), 630, 631\opaqueness (beamer), 767, 768

opaqueness, slides, 768openoffice program, 21optics option (circ), 577optics diagrams, see also���� and PSTricks index

example, 581font for, 576–582symbols, 580

Options: syntax (M-Tx), 652\OR (circ), 578orange syntax (xcolor), 726origin key (graphicx), 28, 33, 40, 41original option (pict2e), 43ornaments (musical)

description, 630, 631example, 630LilyPond, 664table of, 631

\oscillograph (circ), 578oscilloscope channels, see PSTricks indexoT syntax (PMX), 630, 631ot syntax (PMX), 630, 631oT0 syntax (PMX), 630oT1 syntax (PMX), 630oTO syntax (PMX), 631oTt syntax (PMX), 630, 631ou syntax (PMX), 630, 631\Oval (axodraw), 559\oval, 43

(pict2e), 43, 45, 46ovals, drawing, 45, 46overlayarea env. (beamer), 770overlays, slide, see slides (color), overlay specificationoverprint env. (beamer), 770ox syntax (PMX), 630, 631\oxazolev (hetarom), 530\oxazolevi (hetarom), 530\oxqu (MusiXTEX), 592oztex option (pict2e), 43

PP syntax (PMX), 642\P (chemsym), 517

packagesPICTEX, 5, 13, 14, 541XY-pic, xxvi, xxviii, 5, 9, 16, see also XY-pic indexXΥMTEX, 520–540

packages (cont.)abc, 612–615AlDraTex, 15aliphat, 520, 532alltt, 790amsmath, 361, 483, 484, 752, 753, 759amssymb, 515amstex, 517amsthm, 753array, 737, 764arrayjob, 322axodraw, 555, 558–561babel, 124, 515bar, 15, 162beamerouterthemesidebar, 774bg, 696–698bridge, 699–702calc, 323carom, 520, 524cchess, 687–690ccycle, 520, 530chemist, 537, 540chemstr, 520chemsym, 512, 517, 518, 519chess, 668, 677, 680, 687, 690, 691chessboard, 668, 669, 673chessfss, 668, 669–673, 674, 678, 680chmst-ps, 537circ, 576–582color, 215, 216, 235, 304, 719–722, 726, 728, 730, 737colordvi, 719colortbl, 720, 721, 737–751createsudoku, 710–712crosswrd, 702–704curve2e, 47–50curves, 15, 47cwpuzzle, 704–708, 709dcolumn, 737diagram, 482diagxy, 482diversity, 549DraTex, 5, 15eepic, 17, 20, 511, 521, 522emp, 120, 121, 167enpassant, 670epic, 15, 511, 520–522, 537epsfig, 42extsizes, 753feyn, 555–558FeynArts, 555feynman, 555feynmf, 120, 561–572feynmp, 120, 562, 572foiltex, 719fontenc, 752

ch-end.tex,v: 1.24 2007/06/15

Page 111: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 864 — #46

864 (P) GENERAL INDEX

packages (cont.)fp, 458fusering, 537gastex, 15, 438, 439go, 690, 691graphics, 2, 3, 7, 8, 10, 23–27, 30, 33–40, 72, 277, 791graphicx, 23–25, 28–42, 800hcycle, 520, 532hepnicenames, 512, 560heppennames, 512, 560hepunits, 516, 517hetarom, 520, 528, 530, 534hetaromh, 520, 528, 534hhline, 737, 742, 750hyperref, 721, 753, 783, 798, 803–805ifthen, 136, 323, 503igo, 691–695infix-RPN, 430inputenc, 752, 753isotope, 518keyval, 33, 217listings, 790locant, 520longtable, 517, 737, 742lowcycle, 520, 526m-ch-en, 541–547makecirc, 576makeplot, 430mathptm, 65methylen, 537mfpic, 21, 52, 120, 122–136, 139, 583mproof, 73, 74mpsproof, 73, 74multido, 216, 458, 459multimedia, 774MusicTEX, 589MusiXTEX, xxvi, xxviii, xxxi, 588, 589–599, 602, 615–617,

623, 628, 634, 635, 646–648, 658, 660, 661musixlyr.tex, 647, 659, 660nassflow, 15nicefrac, 513paralist, 683pict2e, 7, 15, 42–47, 511pictexwd, 14pifont, 724polymers, 537ppchtex, 541–547preview, 458, 800–802printsudoku, 710–712psfrag, 5psgo, 691pspicture, 47, 511pst-3d, 216, 388–400pst-3dplot, 217, 234, 313, 388, 400–416pst-all, 216, 313

packages (cont.)pst-asr, 217, 424pst-bar, 450pst-barcode, 453pst-blur, 449, 450pst-calendar, 452pst-circ, 309, 435pst-coil, 216, 455, 456pst-dbicons, 445pst-eps, 216, 457pst-eucl, VIII, 426pst-fill, 216, 255, 257, 383–387pst-fr3d, 388, 447pst-fractal, 456, 457pst-func, 427pst-geo, 437, 438pst-gr3d, 388, 447pst-grad, 216, 448pst-infixplot, 429, 430pst-jtree, 425pst-labo, 433pst-lens, 452pst-light3d, 447pst-map2d, 438pst-map2dII, 438pst-map3d, 438pst-map3dII, 388, 438pst-math, 224, 428, 429pst-node, 214, 216, 313, 334–366, 379, 424pst-ob3d, 388, 446pst-optic, 434pst-osci, 434pst-pdf, 457, 458, 797, 800–803, 805, 806pst-pdgr, 431pst-plot, 214, 216, 266, 313–334, 400, 406, 424, 426pst-poly, 431pst-slpe, 449pst-spectra, 432pst-stru, 436pst-text, 216, 451pst-tree, 214, 216, 366–382, 424pst-uml, 442, 443pst-view3d, 400pst-vue3d, 388, 393, 445pst-xkey, 217, 310–312pstcol, 215pstricks, 213–466, 515, 797, 800pstricks-add, 224, 257, 318, 323, 418–424rotating, 42, 392rrgtrees, 424, 425sfg, 442SIstyle, 513SIunits, 513–516sizeredc, 537skak, 668, 669, 673–679, 680, 682

ch-end.tex,v: 1.24 2007/06/15

Page 112: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 865 — #47

GENERAL INDEX (P) 865

packages (cont.)slashed, 557SliTEX, 752solvesudoku, 710–712sudoku, 709, 710texmate, 668, 669, 673, 679, 680–687texshade, 547–550, 552textopo, 547, 551–555tikz, 5timing, 572–576tlgc, 835ucs, 753uml, 443units, 513unitsdef, 513vaucanson-g, 439, 440xcolor, 7, 215, 216, 235, 258, 304, 406, 713, 719–737, 740,

747, 753xkeyval, 217, 310xq, 688xyling, 491xymtex, 520, 537xymtexps, 537xymtx-ps, 537xytree, 491

padding key (chessboard), 669\pagecolor (xcolor), 720, 725Pages syntax (M-Tx), 655pages (musical)

breaks, 642layout, 642numbering, 642

Pages: syntax (M-Tx), 652paralist package, 683\parbox, 37, 40

parens ((...)), slur symbol, 607, 608parent key (beamer), 778, 793\part (beamer), 779part key (beamer), 782, 783Part: syntax (M-Tx), 652\pascal (SIunits), 514\PAUSe (MusiXTEX), 592\PAuse (MusiXTEX), 592\pause

(MusiXTEX), 592, 594(beamer), 763, 764, 765, 783

\pausep (MusiXTEX), 592pausesections key (beamer), 782, 783pausesubsections key (beamer), 783\pawn (chessfss), 672

PBM (portable bitmap) format, 7pbmtopk program, 7PCTeX program, 11

pctex32 option(graphics/graphicx), 24(xcolor), 721

pctex32 program, 24pctexhp option

(graphics/graphicx), 24(xcolor), 721

pctexhp program, 24pctexps option

(graphics/graphicx), 24(xcolor), 721

pctexps program, 24pctexwin option

(graphics/graphicx), 24(xcolor), 721

pctexwin program, 24PDF language, 11, 12.pdf file extension (pst-pdf), 806

pdfcrop program, 804pdfinfo program, 804pdflatex program, xxvi, xxviii, 6, 7, 797, 800, 801, 803, 805, 806PDFs

creatingdvipdfm program, 798–800dvipdfmx program, 798–800from LATEX, 803–807from PostScript, 800, 801, 802, 803music scores, 614overview, 797pst-pdf package, 800, 801, 802, 803

description, 11, 12viewers, 12vs. PostScript, 11, 12

pdftex option(graphics/graphicx), 24(pict2e), 43(xcolor), 721

pdftex program, 14, 24, 618, 721, 797, 798pdftops program, 806\PED (MusiXTEX), 592\pentamethylene (methylen), 538\pentamethylenei (methylen), 538

peptide sequencesaligning, 548–550highlighting, 548–550sequence fingerprints, 550shading, 548–550

\per (SIunits), 516percent sign (%), comment indicator, 619Periodic Table of the Elements, 519pertab.tex file (chemsym), 517\peta (SIunits), 515\pfet (circ), 577pgfborder key (chessboard), 669\pgfdeclareimage (beamer), 776, 777, 792

ch-end.tex,v: 1.24 2007/06/15

Page 113: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 866 — #48

866 (P) GENERAL INDEX

\pgfuseimage (beamer), 777, 792pgn2ltx program, 687phenanthrene derivatives, 525\phenanthrenev (carom), 524, 525

photographs, 4\Photon (axodraw), 559, 561\PhotonArc (axodraw), 559

photons (Feynman diagrams), 561physics option (circ), 577physics diagrams, see���� index\PianoStaff (LilyPond), 665.pic file extension, xxxi

pic language, 17–20pic program, 17, 583, 585pickups (musical), 620, 654

bar length, 620\pico (SIunits), 515\picobarn (hepunits), 516

pict2e package, 7, 15, 42–47, 511PICTEX package, 5, 13, 14, 541pictexwd package, 14picture env., xxvii, 5–7, 9, 15, 16, 19, 20, 44, 520, 534, 541, 555,

568, 573, 797(axodraw), 559(cwpuzzle), 705, 708(pict2e), 42

pictures, see also drawingcharacter-based, 13from fonts, 13photographs, 4pic language, 17–20

pie charts, see���� index\piece (cchess), 688, 689, 690piececolor key (chessboard), 669pifont package, 724pin connections, 579\Pinhole (circ), 580, 581

pitch (musical)abc notation system, 603abc2mtex, 603LilyPond, 662MusiXTEX, 590, 593PMX, 622

.pk file extension (feynmf), 563placement, see positioningplain key (beamer), 759, 792plotting, see also graphs

drawing tools for, 2, 17gnuplot, 17, 18programs for, 17

PLUS syntax (m-ch-en), 546plus sign (+), color expression, 732\PM (circ), 580

PMX language, xxviii, 616, 617, 618–649, 651–654, 656, 657, 659,660

.pmx file extension, xxxi(PMX), 618, 647

PMX notation system, see music scores (PMX)PMX: syntax (M-Tx), 652pmxab program, 590, 618–649, 651pmxaerr.dat file (PMX), 618.png file extension (pst-pdf), 806\pnp (circ), 577Poet: syntax (M-Tx), 652pointed rhythms (musical), 624\Polar (circ), 580, 581

polygon keywords (Feynman diagrams), 567, 568\polyline (curve2e), 47, 49

polymers package, 537polymethylene commands, 538portable bitmap (PBM) format, 7\position (texmate), 682, 684position env.

(bg), 696, 697, 698(cchess), 688, 689, 690

postit syntax (beamer), 776PostScript

description, 10, 11drivers, 11Feynman diagrams, 558–561from TEX DVI, 11PDFs from, 800, 801, 802, 803viewing, 10, 11vs. PDF, 11, 12

PostScript language, 10, 11postscript env. (pst-pdf), 802\power (SIunits), 516\PP (chemsym), 517\pp (LilyPond), 664

ppchtex package, 541–547\Pr (chemsym), 517\pr (chemsym), 517\preparediagram (texmate), 685

prepmx program, 651–660presentation option (beamer), 753presentations, see slidespreview package, 800–802\PreviewEnvironment (pst-pdf), 801

primary colors, 717\printarrow (skak), 676\printboard (bg), 697, 698

printingchess board, 675chess moves, 675, 677

\printknightmove (skak), 676printsudoku package, 710–712program files, obtaining

web access, 810, 811, 812, 813, 814prologue option (xcolor), 721proof env. (beamer), 753, 769

ch-end.tex,v: 1.24 2007/06/15

Page 114: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 867 — #49

GENERAL INDEX (P–R) 867

\protect (igo), 695\providecolor (xcolor), 726, 727, 728\providecolorset (xcolor), 727, 728.ps file extension (graphics/graphicx), 35ps option (skak), 676.ps.bb file extension (graphics/graphicx), 35.ps.gz file extension (graphics/graphicx), 35

ps2eps program, 615ps2epsi program, 615ps2pdf program, 797, 801–806ps2pdf13 program, 804, 805psfrag package, 5\psframebox (xcolor), 733

psgo package, 691psmatrix env. (pst-pdf), 800pspicture env. (pst-pdf), 800pspicture package, 47, 511pst-eucl package, VIIIpst-pdf package, 797, 800–803, 805, 806\pst@object (pst-pdf), 800pstarrows option (pict2e), 44PSTricks, see PSTricks indexpstricks option (pst-pdf), 800pstricks package, 515, 797, 800\pt (MusiXTEX), 594\pteridinev (hetarom), 530\pteridinevi (hetarom), 530\PText (axodraw), 559.ptx file extension, xxxi\purinev (hetarom), 520, 530\purinevi (hetarom), 530

purity of color, 718purple syntax (xcolor), 726\put

(curve2e), 48, 49(cwpuzzle), 705

Puzzle env. (cwpuzzle), 704, 705, 707, 708\PuzzleBlackBox (cwpuzzle), 708\PuzzleClueFont (cwpuzzle), 708PuzzleClues env. (cwpuzzle), 705\PuzzleFont (cwpuzzle), 708\PuzzleHook (cwpuzzle), 705, 708\PuzzleLetters (cwpuzzle), 708\PuzzleLettersText (cwpuzzle), 708\PuzzleNumberFont (cwpuzzle), 708\PuzzleNumbers (cwpuzzle), 708

puzzles, see crosswords, see Sudoku\PuzzleSolution (cwpuzzle), 705, 706, 708\PuzzleUnitlength rigid length (cwpuzzle), 708\PuzzleUnsolved (cwpuzzle), 705PuzzleWords env. (cwpuzzle), 707\PuzzleWordsText (cwpuzzle), 707\pvmos (circ), 577\pyranose (hcycle), 532

pyranoses derivatives, 532

\pyrazinev (hetarom), 524, 530\pyrazolev (hetarom), 530\pyrazolevi (hetarom), 530\pyridazinev (hetarom), 530\pyridazinevi (hetarom), 530\pyridinev (hetarom), 530\pyridinevi (hetarom), 530\pyrimidinev (hetarom), 530\pyrimidinevi (hetarom), 530\pyrrolev (hetarom), 530\pyrrolevi (hetarom), 530

Python program, 661

Q\Q (circ), 577Q: syntax (abc), 602, 610\qa (MusiXTEX), 593, 594, 595\qb (MusiXTEX), 596, 597, 599\qbezier, 46, 47

(pict2e), 46, 47\qbeziermax, 46\ql (MusiXTEX), 592, 593, 596, 597, 599\qlp (MusiXTEX), 599\qp (MusiXTEX), 592, 594, 599\qqs (MusiXTEX), 592\qs (MusiXTEX), 592\qu (MusiXTEX), 592, 593, 594–596, 597

quadratic Bézier curves, 46, 47quadruplets (musical), 605\queen (chessfss), 672\quinazolinev (hetarom), 530\quinazolinevi (hetarom), 530\quinolinev (hetarom), 530\quinolinevi (hetarom), 530\quinoxalinev (hetarom), 530\qupp (MusiXTEX), 592

RR syntax

(PMX), 639(m-ch-en), 542, 544

\R (circ), 577, 581r syntax (PMX), 625, 626, 628\r... (MusiXTEX), 594R: syntax (abc), 608radii, specifying, 45, 46rand (pic), 19\rarw (timing), 575\rawboard (bg), 697Rb syntax (PMX), 639, 640rb syntax (PMX), 625, 626RD syntax (PMX), 639, 640Rd syntax (PMX), 639, 640Rdl syntax (PMX), 640

ch-end.tex,v: 1.24 2007/06/15

Page 115: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 868 — #50

868 (R–S) GENERAL INDEX

\Re (chemsym), 517\re (chemsym), 517

reaction equations, 545reaction schemes, 540\reactrarrow (chemist), 540read key (graphicx), 29, 34readability, and color, 718\reciprocal (SIunits), 516rect (pic), 19red syntax (xcolor), 722, 726, 727\reduceallcells (solvesudoku), 711\reducedsizepicture (xymtex), 538\reflectbox (graphics/graphicx), 37\relative (LilyPond), 662–665

repeat symbols (musical), 603repeats (musical), 639\RequirePackage, xxxii\resetcolorseries (xcolor), 734, 735, 736\resigns (texmate), 683\resizebox

(graphics/graphicx), 38, 39(graphics), 27

\resizebox* (graphics/graphicx), 38, 39resizing

bounding box, 27graphic objects, 38, 39text, 38, 39

\restoregame (skak), 679rests (musical), 592, 625, 626

LilyPond, 663\reverseallabreve (MusiXTEX), 592\reverseC (MusiXTEX), 592RGB option (xcolor), 721RGB syntax (xcolor), 728, 729rgb option (xcolor), 721rgb syntax

(color), 720(xcolor), 720, 722, 727–729, 732

RGB (Red, Green, Blue) color, 715, 719\rh (MusiXTEX), 594right (pic), 19right key (beamer), 777\rightdiagramturn (texmate), 686\rightrepeat (MusiXTEX), 592rightskip key (beamer), 777, 794Rl syntax (PMX), 640Rlr syntax (PMX), 640rm syntax (PMX), 625, 626\rmoiety (chemstr), 522\rook (chessfss), 672\roqu (MusiXTEX), 592

Rosegarden program, 588ROT syntax (m-ch-en), 544, 545rotate env. (rotating), 42

\rotatebox(graphics/graphicx), 36, 39, 40(graphics), 27(graphicx), 24, 33, 39, 40, 42

rotated material, hiding, 25\rotategoban (igo), 695\rotategobanleft (igo), 695\rotategobanright (igo), 695

rotatingbounding box, 27, 31, 32chemical structures, 544, 545Go board, 695graphic objects, 39–42\includegraphics keys, 29reference points, 40–42

rotating package, 42rounded key (beamer), 777, 778\rowcolor

(colortbl), 739, 740, 741, 747, 748, 750, 751(xcolor), 763, 765

\rowcolors (xcolor), 740, 741, 751, 763, 765rows (table), color

alternate, 739, 740selected, 746

rp syntax (PMX), 625, 626\rpcubed (SIunits), 516rpo syntax (PMX), 625, 626\rq (MusiXTEX), 596Rr syntax (PMX), 640\rsqu (MusiXTEX), 592\rtetrahedralS (aliphat), 540\rText (axodraw), 559\rtrigonal (aliphat), 533\Rvar (circ), 577\ryl (chemstr), 535, 536RZ syntax (m-ch-en), 542, 543, 544Rz syntax (PMX), 640

SS syntax (m-ch-en), 544\S

(chemsym), 517(circ), 577

s syntax(LilyPond), 662(PMX), 624, 625, 630, 634, 648

sample.sud file (tglc), 710, 711saturation, 717\savegame (skak), 679SB env. (chemsym), 517SB syntax (m-ch-en), 544Sb env. (amstex), 517\sbox, 725sc syntax (PMX), 625Scalable Vector Graphics (SVG), 12, 13

ch-end.tex,v: 1.24 2007/06/15

Page 116: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 869 — #51

GENERAL INDEX (S) 869

scale key (graphicx), 29, 30\scalebox

(beamer), 774(graphics/graphicx), 37(graphics), 27

scaled material, hiding, 25\scaletopo (textopo), 551, 553

scalingbounding box, 27, 29graphic objects, 37\includegraphics keys, 29, 30text, 37

scaling factor, 29, 30Scheme program, 661scid program, 687science diagrams, see PSTricks indexscientific texts, see also bioinformatics, see also chemical

formulas, see also Feynman diagramsabbreviations, 513chemical elements, symbols for, 512chemical symbols, 517, 518consistency, 512“d” in integrands, 513electronics diagrams

drawing position, moving, 580electronic box symbols, 578examples, 581, 582font for, 576–582gate symbols, 578integrated circuit symbols, 579interactive generation, 586junctions, 579m4 macro processor, 583–585pin connections, 579symbol connections, 579symbols, 577trigger symbols, 578

mathematical functions, symbols for, 512Newtonian mechanics symbols, 580numbers, symbols for, 512optics diagrams

experimental setup, 581font for, 576–582symbols, 580

state names, symbols for, 513symbols, 512table of, 512timing diagrams

annotation, 573arrows, 575customizing, 576fonts, specifying, 573labels, 573overview, 572–576separation between lines, 576

scientific texts (cont.)signal lines, 573symbols argument, 573, 575timing values, 573vertical line adjustment, 576vertical lines, 576

unitsbase, 514combining, 516derived, 514high-energy physics, 516prefixes, 514SI (International System of Units), 512–516spacing between, 515symbols for, 512typeset style, 515

wave names, symbols for, 513Scientific Word program, 24scor2prt program, 647\ScrL (circ), 580, 581\ScrTL (circ), 580\sDEP (MusiXTEX), 592\second (SIunits), 514, 516

secondary colors, 717\section (beamer), 779

sectioning commands, slides, 779sections key (beamer), 783sectionstyle key (beamer), 783\segno (MusiXTEX), 592\selectcolormodel (xcolor), 730

self-contained object-oriented drawings, 4semiverbatim env. (beamer), 790, 791sep key (beamer), 776, 777\seqtype (texshade), 549\sequence (textopo), 551, 553

sequence fingerprints, 550series key (beamer), 793, 794series* key (beamer), 793\setbeamercolor (beamer), 760, 776, 778, 793, 794\setbeamercovered (beamer), 760, 767\setbeamerfont (beamer), 778, 788, 789, 793, 794\setbeamertemplate (beamer), 773, 774, 777, 778, 793, 794,

795\setboardfontfamily

(chessfss), 673(skak), 675

\setboardfontsize (chessfss), 673\setchessboard (chessboard), 669\setchessfontfamily

(chessfss), 673(skak), 678, 679(texmate), 683, 686

\setclef (MusiXTEX), 596\SetColor (axodraw), 559\setends (texshade), 548–550

ch-end.tex,v: 1.24 2007/06/15

Page 117: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 870 — #52

870 (S) GENERAL INDEX

\setfigfontfamily(chessfss), 670, 671(skak), 678

\setfigstyle (chessfss), 672\setinffontfamily (chessfss), 673\setkeys

(graphicx), 33(keyval), 33

\SetOffset (axodraw), 559\SetPFont (axodraw), 559setpieces key (chessboard), 669\SetScale (axodraw), 559\SetScaledOffset (axodraw), 559\setstaffs (MusiXTEX), 596\setsudrandom (createsudoku), 711\setTextDecresc (LilyPond), 664, 665\settextfigchars (chessfss), 672\settextfigfontfamily (chessfss), 672\settextfiglanguage (chessfss), 672\setupboard (skak), 675\setupchemical (m-ch-en), 541, 545\setvolta (MusiXTEX), 592\setvoltabox (MusiXTEX), 592\SetWidth (axodraw), 559\sh (MusiXTEX), 593\shadincolors (texshade), 550

shadingcolor, 731nucleotide sequences, 548–550peptide sequences, 548–550

\shadingmode (texshade), 549, 550shadow key (beamer), 776, 777, 778\Shake (MusiXTEX), 592\shake (MusiXTEX), 592\Shakel (MusiXTEX), 592\Shakene (MusiXTEX), 592\Shakenw (MusiXTEX), 592\Shakesw (MusiXTEX), 592shape key (beamer), 789, 793shape* key (beamer), 793sharp symbol (musical), 605Sharps: syntax (M-Tx), 652, 658, 660\shift (circ), 580, 581shortenstart key (chessboard), 669\shortstack (igo), 693–695show key value (beamer), 753\showall (skak), 676, 677\showallbut (skak), 676, 677\showboard

(skak), 675, 676–678(texmate), 680, 684

\showconsensus (texshade), 548\showcube (bg), 696, 697showerrors option (xcolor), 721\showfullgoban (igo), 693

\showgoban (igo), 692, 693, 694, 695showing, see hiding/showing\showinverseboard (skak), 675\showlegend (texshade), 550showmover key (chessboard), 669\showmoverOff (skak), 676\showmoverOn (skak), 676\showmoves (bg), 698\shownames (texshade), 549\shownumbers (bg), 696, 697\showonly (skak), 676, 677\showonlyblack (skak), 676\showonlywhite (skak), 676\showrowcolors (xcolor), 740\showruler (texshade), 549shrink key (beamer), 759SI (International System of Units), 512–516Sibelius program, 588sidebar left syntax (beamer), 773sidebar right syntax (beamer), 777sidewaysfigure env. (rotating), 42sidewaystable env. (rotating), 42\sievert (SIunits), 514

signal lines, 573sin (pic), 19single-object drawings, 3, 4SIstyle package, 513\SIunits (SIunits), 515

SIunits package, 513–516SIunits.cfg file (SIunits), 516SIX syntax (m-ch-en), 542\sixfuseh (fusering), 537\sixfusehi (fusering), 537\sixfusev (fusering), 537\sixfusevi (fusering), 537\sixheteroh (hetarom), 529\sixheterohi (hetarom), 529\sixheterov (hetarom), 523, 528, 529\sixheterovi (hetarom), 529\sixunitv (hetarom), 534Size syntax (M-Tx), 655size key (beamer), 778, 793, 794size* key (beamer), 793Size: syntax (M-Tx), 652sizeredc package, 537\sk (MusiXTEX), 595

skak package, 668, 669, 673–679, 680, 682\SkakOff (texmate), 680, 682\slashed (slashed), 557

slashed package, 557\SLens (circ), 580, 581\slide (MusiXTEX), 592

slides document class, 713

ch-end.tex,v: 1.24 2007/06/15

Page 118: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 871 — #53

GENERAL INDEX (S) 871

slides (color)choosing colors, 756creating, 754–758fonts, 758frames, creating, 758hiding/showing, see slides (color), overlay specificationmacros, 758main features, 752modes, 752options

beamer class, 752conditional, 760frame environment, 759

presentation structure, 758, 759, 760, 761styles, 754tables, 780templates, 754themes, 754–757title pages, 761titles, 759

slides (color), overlay specificationactions, 770animation, 774bibliographies, 782block environments, 778, 779boxed text, 775, 776colored text, 775, 776creating, 763definition, 760, 762dissolves, 774, 775dynamic text, holding static, 770figures, 780footnotes, 789for existing LATEX environments, 769framing text, 775, 776graphics, 792hiding/showing

alternative text, 769opaqueness, 768slide elements, 767specific rows, 765successive columns, 763successive rows, 763transparency, 768

highlighting parts of elements, 771hyperlinks, 784–818labels, 785list items, 786–788logos, 776, 777movies, 774multiple columns, 780navigation bar, 772, 773, 774overlay areas, 770preformatted text, 790, 791sectioning commands, 779

slides (color), overlay specification (cont.)sound, 774source code representation, 791specifying, 765table of contents, 782tables, 780text styles, 789transitions, 774, 775verbatim text, 790, 791video, 774

\sline (timing), 574, 576SliTEX package, 752slope arguments, 44slurs (musical)

abc2mtex, 607blind, 655broken, 655description, 654, 655dotted, 655K type, 636LilyPond, 663, 664M type, 637, 638MusiXTEX commands, 597notation, 654PMX, 634, 635, 636–638

\small(LilyPond), 663(chessfss), 671

small option (skak), 675\smallaltoclef (MusiXTEX), 592\smallbassclef (MusiXTEX), 592\smallboard

(bg), 696, 697(cchess), 690(skak), 675, 678

smaller option (beamer), 753\smallgoban (igo), 694\smallmusicsize (MusiXTEX), 596\smalltrebleclef (MusiXTEX), 592

solvesudoku package, 710–712song title, 602\sound (beamer), 774

sound, slides, 774source code representation, slides, 791SPACE syntax (m-ch-en), 546Space syntax (M-Tx), 655space, trimming, 28, 30Space: syntax (M-Tx), 652, 659, 660\spade

(bridge), 700, 702(tlgc), 699

\spadesuit, 698, 699\special, 6–8, 9, 15–17, 20, 22, 35, 583, 690, 797

(tpic), 583(xcolor), 719

ch-end.tex,v: 1.24 2007/06/15

Page 119: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 872 — #54

872 (S) GENERAL INDEX

special color spaces, 715spectrum, displaying, 729\sPED (MusiXTEX), 592\spind (circ), 580\spinu (circ), 580spline (pic), 17, 19\spring (circ), 580

SPSS program, 21sqrt (pic), 19\squ (MusiXTEX), 592\square

(SIunits), 516(aliphat), 532

square brackets ([])chord symbols (musical), 608

\squared (SIunits), 516\squaremetrepersquaresecondnp (SIunits), 516squeeze key (beamer), 759SR syntax (m-ch-en), 544\SS (chemsym), 517ss syntax (PMX), 624, 625ssc syntax (PMX), 625\ST (circ), 578

staccato marks (musical), 607staccato ornaments (musical), 630\Staff (LilyPond), 665Start: syntax (M-Tx), 652\startchemical (m-ch-en), 541, 542, 543–546\startextract (MusiXTEX), 594, 596\startpiece (MusiXTEX), 594, 599

state names, symbols for, 513staves (musical)

accidentals, 622, 624, 628arpeggio, 629basic duration, 622beams, 631, 632, 633beams for xtuplets, 627, 628chords, 628, 629clef changes, 639defining, 652definition, 617dotted notes, 622doubly dotted notes, 622down fermata ornaments, 630duration of notes, 622dynamical marks, 638grace notes, 629, 630grace notes, in xtuplets, 627height, 620horizontal displacement, 624note parameters, 624, 625notes, 622, 623, 624number of, 619octaves, 623on staves, 622–624

staves (musical) (cont.)ornaments, 630, 631parameters, 623, 624, 625pitch, 622pointed rhythms, 624rests, 625, 626slurs, 634–638staccato ornaments, 630stems, 623, 624tenuto ornaments, 630ties, 634, 635, 637xtuplets, 626, 627, 628

\stemDown (LilyPond), 663\stemNeutral (LilyPond), 663\stemNeutraltiny (LilyPond), 663

stems (musical), 623, 624\stemUp (LilyPond), 663step key (beamer), 795step syntax (xcolor), 734, 736stereochemical compounds, 530–532stereochemistry effects, 538\steroid (carom), 524, 526

steroid derivatives, 525, 526\steroidchain (carom), 524stillcovered key (beamer), 768\STINV (circ), 578\stopchemical (m-ch-en), 541, 542, 543–546\storegame (skak), 679\structure (beamer), 788, 789structure syntax (beamer), 789structured drawing, 20structures, chemical

atoms, aligning with bonds, 546basic commands for, 541, 542bonds

aligning atoms or molecules, 546chemical, 542description, 543identifiers, 544

combinations, 544, 545combining, 534complex, 534, 535libraries of, 543molecules, aligning with bonds, 546moving, 544, 545positioning, 544, 545reaction equations, 545rotating, 544, 545substructures, 543

Style: syntax (M-Tx), 651, 652\styleA (skak), 679styleA option (skak), 679\styleB (skak), 679styleB option (skak), 679\styleC (skak), 679

ch-end.tex,v: 1.24 2007/06/15

Page 120: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 873 — #55

GENERAL INDEX (S–T) 873

styleC option (skak), 679styles

arrows (pict2e), 44chess moves, 679fills, 564, 565lines

Feynman diagrams, 564, 565, 566thickness, 566

slide text, 789slides, 754units typeset, 515vertices, 564, 565

SUB syntax (m-ch-en), 544, 545\subsection (beamer), 779subsectionstyle key (beamer), 783\substfont (xymtexps), 540\substfontsize (xymtexps), 540\substitutecolormodel (xcolor), 730

substitution derivation, 539\subtitle (beamer), 761

subtractive color space, 715sud.out file (solvesudoku), 711Sudoku, 709–711, 712\sudoku

(createsudoku), 711(printsudoku), 710(solvesudoku), 711

sudoku env. (sudoku), 710sudoku package, 709, 710sudoku-block env. (sudoku), 709, 710\sudokuformat (sudoku), 709, 710\sudokusize rigid length (sudoku), 709, 710\sudokusolve

(createsudoku), 711(solvesudoku), 711

SVG language, 12, 13SVG (Scalable Vector Graphics), 12, 13svgnames option (xcolor), 721svgnames* option (xcolor), 721\symbishop (chessfss), 671\symbol, 691

symbolschemical diagrams, 512, 517, 518electronics diagrams

connections, 579electronic box, 578gate, 578integrated circuits, 579state names, 513table of, 577trigger, 578wave names, 513

mathematical functions, 512musical

(...), slur symbol, 607, 608

symbols (cont.)- (hyphen), tie symbol, 607, 608= (equal sign), natural symbol, 605[] (square brackets), chord symbols, 608^(caret), sharp symbol, 605^^(carets), double flat symbol, 605_ (underscore), flat symbol, 605__ (underscores), double flat symbol, 605accidentals, 605bar symbols, 603, 639definition, 617notes, 592, 593, 594order of, 608repeat, 603

Newtonian mechanics, 580numbers, 512optics diagrams, 580scientific texts, 512units, 512wave names, 513

symbols argument, 573, 575\symking (chessfss), 671\symknight (chessfss), 671\sympawn (chessfss), 671\symqueen (chessfss), 671\symrook (chessfss), 671Systems syntax (M-Tx), 655systems (musical)

definition, 617indentation, 620number of, 620

Systems: syntax (M-Tx), 652

TT key (beamer), 781t key (beamer), 759, 781t option (beamer), 753T: syntax (abc), 601, 602, 603, 606, 608tabbing env., 688, 701table env. (beamer), 780table option (xcolor), 721, 737table of contents, slides, 782\tableofcontents (beamer), 752, 782, 783

tables, colorcells, 741columns, 738, 747entire table, 743gaps between lines, 742gradients, 747, 748headings, 748highlighting elements, 745, 749, 750light text on dark background, 744lines (rules)

adding, 748inside the table, 749

ch-end.tex,v: 1.24 2007/06/15

Page 121: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 874 — #56

874 (T) GENERAL INDEX

tables, color (cont.)partial, 751selected, 750whole table, 741width, 751

rowsalternate, 739, 740selected, 746

slides, 780text, 745, 748titles, 748

tabular env., 8, 39, 702, 737, 741(texmate), 680

tabular* env. (colortbl), 737\takecube (bg), 698TB syntax (m-ch-en), 544\tb (MusiXTEX), 599\tbl (MusiXTEX), 596, 597\tbu (MusiXTEX), 596, 597Tc syntax (PMX), 641tcidvi option

(graphics/graphicx), 24(xcolor), 721

templates, slides, 754tempo (musical), 602\temporal (beamer), 768tenor syntax (LilyPond), 661tenuto ornaments (musical), 630\tera (SIunits), 515\tesla (SIunits), 514\tetrahedral (aliphat), 532, 535, 540

tetrahedral compounds, 532, 533tetrahedron carbon configurations, 533tetraline derivatives, 525\tetralineh (carom), 524, 525\tetralinev (carom), 524, 525\tetralinevb (carom), 525\tetralinevt (carom), 525\tetramethylene (methylen), 538\tetramethylenei (methylen), 538\tetrastereo (aliphat), 533\TeVovercsq (hepunits), 516.tex file extension (PMX), 621

tex program, 618, 637TEX file archives, 810, see also CTANTEX files, obtaining

web access, 810, 811, 812, 813, 814TEX, interfaces

generating graphics, 8, 9graphic hooks

\special commands, 9built-in commands, 8fonts, 8

graphics integration\special commands, 6, 7

TEX, interfaces (cont.)fonts, 7, 8half-tones, 7, 8

manipulating graphics, 8overview, 6

TEX-based drawing languages, 13–17texdoc program, 815, 816texdoctk program, 815–817texmate env. (texmate), 680texmate package, 668, 669, 673, 679, 680–687texshade env. (texshade), 548, 549, 550texshade package, 547–550, 552\Text (axodraw), 559–561

textblocks, 641colored, inside a box, 725in documents, 725resizing, 38, 39scaling, 37slides

alternative, 769boxed, 775, 776colored, 775, 776framing, 775, 776holding static, 770preformatted, 790, 791styles, 789verbatim, 790, 791

tablescolor, 745, 748light on dark background, 744

\textbf (beamer), 788, 789\textbishop (chessfss), 671, 672\textcolor (xcolor), 720, 722, 723, 724\textit (beamer), 788, 789\textking (chessfss), 671\textknight (chessfss), 671, 672\textmove (bg), 698textopo env. (textopo), 551, 552, 553textopo package, 547, 551–555\textpawn (chessfss), 671\textpiece (cchess), 688, 689\textqueen (chessfss), 671\textrm (beamer), 788, 789\textrook (chessfss), 671\textsf (beamer), 788, 789\textsl (beamer), 788, 789textstyle option (SIunits), 515texttopo env. (textopo), 551Textures program, 11, 17, 24textures option

(graphics/graphicx), 24(xcolor), 721

\textwidth rigid length (beamer), 777.tfm file extension, 666

ch-end.tex,v: 1.24 2007/06/15

Page 122: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 875 — #57

GENERAL INDEX (T) 875

\tgqu (MusiXTEX), 592thebibliography env. (beamer), 782themes, slides, 754–757then (pic), 19theorem env. (beamer), 753, 769\thicklines

(curve2e), 49(pict2e), 45

thickqspace option (SIunits), 515thickspace option (SIunits), 515\thinlines

(curve2e), 48–50(pict2e), 45

thinqspace option (SIunits), 515thinspace option (SIunits), 515\Threat (texmate), 681, 682\threat (texmate), 681, 682THREE syntax (m-ch-en), 542three-color harmonics, 718three-color theory, 714three-member carbon cycles, 528\threefuseh (fusering), 537\threefusehi (fusering), 537\threefusev (fusering), 537\threefusevi (fusering), 537\threehetero (hetarom), 523, 528\threeheteroh (hetarom), 529\threeheterohi (hetarom), 529\threeheterov (hetarom), 529\threeheterovi (hetarom), 529tHsb syntax (xcolor), 728, 729\THz (hepunits), 516Ti syntax (PMX), 641ties (musical), 607, 637

PMX, 634, 635tightpage option (pst-pdf), 800tikz package, 5\til (timing), 573

tilde (~), grace notes, 607\timadjust (timing), 576\time (LilyPond), 663, 664, 665\times (LilyPond), 664\timescalefactor (timing), 576timing env. (timing), 573, 574timing package, 572–576timing diagrams

annotation, 573arrows, 575customizing, 576fonts, specifying, 573labels, 573overview, 572–576separation between lines, 576signal lines, 573symbols argument, 573, 575

timing diagrams (cont.)timing values, 573vertical line adjustment, 576vertical lines, 576

timing values, 573\timingcounter (timing), 573\tin (timing), 573, 574

tinting, 731\TinveV (hepunits), 516\tiny (LilyPond), 663tiny option (skak), 675\tinyboard

(skak), 675, 677(texmate), 686

\title (beamer), 754, 757, 761title blocks (musical), 641title pages, slides, 761Title: syntax (M-Tx), 652\titlepage (beamer), 761

titleschess, 683slides, 759tables, 748

\tnote (timing), 573, 574to (pic), 19\toD (texmate), 685\toD* (texmate), 685, 686\togglenumbers (bg), 697top key (beamer), 795\topdiagramnames (texmate), 686\totalheight (graphics/graphicx), 38totalheight key (graphicx), 29, 32totalwidth key (beamer), 781tpic program, 583, 584trans option (beamer), 753\transblindshorizontal (beamer), 774\transblindsvertical (beamer), 774\transboxin (beamer), 774\transboxout (beamer), 774\transdissolve (beamer), 774, 775\transduration (beamer), 774

transfig program, 13\transglitter (beamer), 774

transitions, slides, 774, 775transparency, slides, 768transparent key (beamer), 767\transsplithorizontalin (beamer), 774\transsplithorizontalout (beamer), 774\transsplitverticalin (beamer), 774\transsplitverticalout (beamer), 774\transwipe (beamer), 774\treble (MusiXTEX), 596treble syntax (LilyPond), 661, 664\trebleclef (MusiXTEX), 592

trees, see���� and PSTricks index

ch-end.tex,v: 1.24 2007/06/15

Page 123: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 876 — #58

876 (T–V) GENERAL INDEX

\triazinev (hetarom), 530\triazinevi (hetarom), 530

tricyclic carbocycles, 525trigger symbols, 578trigonal units, 532, 533\Trille (MusiXTEX), 592\trille (MusiXTEX), 592trim key (graphicx), 28, 29, 30\trimethylene (methylen), 538\trimethylenei (methylen), 538

trimming space, 28, 30triplets (musical), 605

LilyPond, 664troff program, 17TrueTeX program, 24truetex option

(graphics/graphicx), 24(xcolor), 721

\tslur (MusiXTEX), 596, 597, 599Tt syntax (PMX), 641\ttfamily (beamer), 764

TUG home page, 810, 811\turn (MusiXTEX), 592turn env. (rotating), 42turtle graphics, see���� indextwo-color harmonics, 718type key (graphicx), 29, 35typesetting, overview, 2, 3typographic conventions, this book, xxix, xxxi

U\U (circ), 577u syntax

(PMX), 625, 631, 633, 634, 636(abc), 607

U: syntax (M-Tx), 657, 658ucs option (beamer), 753ucs package, 753UML diagrams, see���� and PSTricks index\uncover (beamer), 767, 768, 785uncoverenv env. (beamer), 770\underline, 672

underscore (_), flat symbol (musical), 605underscores (__), double flat symbol (musical), 605\unit

(SIunits), 515, 516(hepunits), 516

\unitlength rigid length(curve2e), 48(pict2e), 45, 46(timing), 573

unitsbase, 514combining, 516derived, 514

units (cont.)high-energy physics, 516prefixes, 514SI (International System of Units), 512–516spacing between, 515symbols for, 512typeset style, 515

units key (graphicx), 40, 42units package, 513unitsdef package, 513\upbow (MusiXTEX), 592upper key (beamer), 776, 778\uppz (MusiXTEX), 592\Uptext (MusiXTEX), 599\uptrio (MusiXTEX), 592\upz (MusiXTEX), 592\upzst (MusiXTEX), 592\usebeamercolor (beamer), 794\usebeamerfont (beamer), 777, 794\usebeamertemplate (beamer), 777\usecolortheme (beamer), 758\usefonttheme (beamer), 758, 760\usegoban (igo), 694, 695\useinnertheme (beamer), 758usenames option (xcolor), 721\useoutertheme (beamer), 758, 773\useouthertheme (beamer), 758\usepackage, xxxii

(beamer), 754, 758usepdftitle option (beamer), 753\usesymfig (chessfss), 672\usetextfig (chessfss), 672\usetheme (beamer), 758, 760\usf (MusiXTEX), 592\usfz (MusiXTEX), 592\usk (SIunits), 515, 516\ust (MusiXTEX), 592utf8 option

(beamer), 753(inputenc), 753

\Utrigonal (aliphat), 533\utrigonal (aliphat), 533\Uvar (circ), 577

VV syntax (PMX), 640\V (circ), 577v syntax (abc), 607V: syntax (abc), 610\var (texmate), 682, 683\var* (texmate), 682\variation (skak), 677, 678, 679variations env. (texmate), 682, 683variations* env. (texmate), 682\VariationsEnvironment (texmate), 683

ch-end.tex,v: 1.24 2007/06/15

Page 124: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 877 — #59

GENERAL INDEX (V–X) 877

\VECTOR (curve2e), 47, 50\Vector (curve2e), 47, 48\vector, 43

(curve2e), 47, 48(pict2e), 43, 44, 46

\VectorARC (curve2e), 50\VectorArc (curve2e), 50\verb

rotating output, 42(beamer), 790

verbatim env., 13(beamer), 790

\Vertex (axodraw), 559, 560vertex dots (Feynman diagrams), 560vertex mode (Feynman diagrams)

algorithmic layout, 563–569blobs, 566coloring diagrams, 567complex vertices, 567definition, 563external vertices, placing, 564fill styles, 564, 565freezing a diagram, 567internal vertices, 566labels, 567, 568, 569line styles, 564, 565line thickness, 566line-drawing keywords, 566polygon keywords, 567, 568vertex styles, 564, 565vertex-drawing keywords, 567vertices, as dots, 566vertices, connecting, 565

vertex styles (Feynman diagrams), 564, 565vertex-drawing keywords (Feynman diagrams), 567\vertexlabel (feyn), 557vertical shading syntax (beamer), 795vertices (Feynman diagrams), 565, 566\vflipgoban (igo), 695

video, slides, 774viewport key (graphicx), 28, 29, 30viewports, 28, 30violet syntax (xcolor), 726\visible (beamer), 768, 791visibleenv env. (beamer), 770vlabellift key (chessboard), 669\VLens (circ), 580\vline (colortbl), 741vmode key (beamer), 777, 794voice (musical)

definition, 617labels, 653spacing after, 653

\volt (SIunits), 514, 515voltas (musical), 640

VTeX program, 11, 24, 797vtex option

(graphics/graphicx), 24(pict2e), 43(xcolor), 721

\vtopin (circ), 579, 581Vx syntax (PMX), 640

WW syntax (PMX), 630W. syntax (PMX), 643w.eps file (tlgc), 26W: syntax (abc), 608w: syntax (abc), 611\wall (circ), 580

watermarks, see PSTricks index\watt (SIunits), 514, 516\wattpersquaremetresteradiannp (SIunits), 516wave syntax (xcolor), 728, 729wave names, symbols for, 513\wbetter (skak), 678wd key (beamer), 776, 777, 794\wdecisive (texmate), 682

WebCGM, 13\weber (SIunits), 514\wedgehashedwedge (xymtexps), 538, 539\welo (texmate), 683

wget program, 814\wh (MusiXTEX), 592, 593, 594\white (igo), 691, 692–695white syntax (xcolor), 722, 723, 726\whitebar (bg), 697\whitecube (bg), 697\whitename (texmate), 683\whiteonmove (bg), 696, 697, 698\whitepoint (bg), 696\whitestone (igo), 695\whp (MusiXTEX), 592\width (graphics/graphicx), 38width (pic), 19width key

(beamer), 778, 792(graphicx), 28, 29, 31–33

\wire (circ), 579\withidea (texmate), 681\wmove (skak), 679\wname (texmate), 685, 686\Word (cwpuzzle), 707

words (musical), 617\writegame (solvesudoku), 711\writepuzzle (printsudoku), 710\wwire (circ), 579

XX syntax (PMX), 632, 633, 643

ch-end.tex,v: 1.24 2007/06/15

Page 125: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 878 — #60

878 (X–Z) GENERAL INDEX

x key (graphicx), 40, 41x syntax (PMX), 625, 627, 628, 630x11names option (xcolor), 721X: syntax

(PMX), 643(abc), 601, 602, 603, 608

XCircuit program, 576, 586xcolor option (beamer), 753xcolor package, 7, 713, 719–737, 740, 747, 753.xcp file extension (xcolor), 721xdvi option (pict2e), 43xdvi program, 24xetex option (xcolor), 720, 721xetex program, 798, 803xfig program, 1, 6, 13, 21, 586\xglobal (xcolor), 726

xiangqi chess, 687, 688–690\XNOR (circ), 578\XOR (circ), 578

xpdf program, 12, 804xq package, 688\xqu (MusiXTEX), 592

xtuplets (musical), 626, 627, 628XΥMTEX package, 520–540xymtex package, 520, 537xymtexps package, 537xymtx-ps package, 537XY-pic package, xxvi, xxviii, 5, 9, 16, see also XY-pic index

Yy key (graphicx), 40, 41

yellow syntax (xcolor), 722, 724, 726\yocto (SIunits), 515\yotta (SIunits), 515

Young-Helmholtz Law, 714\yqu (MusiXTEX), 592

ZZ syntax (m-ch-en), 544z syntax

(PMX), 628(abc), 603, 604, 607

\z... (MusiXTEX), 594Z0 syntax (m-ch-en), 544, 546\zbreve (MusiXTEX), 592\zcharnote (MusiXTEX), 599\ZD (circ), 577\zepto (SIunits), 515\zetta (SIunits), 515\zh (MusiXTEX), 594\ZigZag (axodraw), 559, 560

zigzag lines (Feynman diagrams), 559, 560zlib program, 799\zlonga (MusiXTEX), 592\zmaxima (MusiXTEX), 592\znotes (MusiXTEX), 595\zq (MusiXTEX), 596\zqb (MusiXTEX), 596\zw (MusiXTEX), 594\zwq (MusiXTEX), 592

35%14%

23%16%

12%

LionsTigers

Hyaena

Monkeys

Warthogs

start

end

DC

A

B

M1

M2

N1

N2

F

E

K

G

P1

P2 P3

P4

D1

D2

ZL300Ω

220V v

i(t)

5 AIcc

foo

Learn MetaUML -the MetaPost UML library

User

ch-end.tex,v: 1.24 2007/06/15

Page 126: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 879 — #61

�������� and�������

Symbols\( (pst-pdf), 800\) (pst-pdf), 800++ syntax (����), 52+-+ syntax (����), 52– syntax (����), 54.. syntax (����), 54_T (������), 1143-D extensions

animations, 209cubes, 210curve intersections, computing, 211globes, 209hexagonal meshes, 210labels in space, 211�������� files, creating, 209overview, 207packages for, 208–212perspective projection, 208physics diagrams, 209projected segments, 211requirements, 207

3DLDF program, 211, 2123d�������� package, 68, 207–2093dgeom�������� package, 208

Aabs (����), 56Acrobat Distiller program, 797, 798active option (pst-pdf), 800activities, UML

beginning, 187constructing, 187ending, 187

Activity (metaUML), 187Actor (metaUML), 187actors, 187addto (����), 143, 146, 150, 176\addtocounter (mfpic), 136

Adobe Reader program, 804, 817Adobe Illustrator program, 65, 137, 138affine transforms

mfpic, 136���� language, 53

align key (������), 101–103alignment (������)

boxeshorizontal, 101horizontal separation, 102mixed objects, 102, 103vertical, 101, 103within frames, 104

Page 127: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 880 — #62

880 (A–B) �������� AND�������

alignment (������) (cont.)trees, 107, 108

analytical curves (mfpic), 133angle (����), 53, 142, 191, 205angle key (������), 86angle dimensions (mfpic), 127angleA key (������), 85, 87–92, 94, 177angleB key (������), 85, 87, 88–91, 92, 94animation

3d package, 208m3d package, 209�������� techniques, 156, 157

annotationsmfpic, 134drawings, 134pictures, 61–64, 65

\arc (mfpic), 127, 128arcangle key (������), 86arcangleA key (������), 85, 88, 93arcangleB key (������), 85, 88, 93arclength (��������), 142, 191arcs

mfpic, 128������, 88

arctime (��������), 142arm key (������), 86armA key (������), 85, 89–91, 177armB key (������), 85, 89–91\arrow (mfpic), 127, 132, 135

arrowsmfpic

drawing, 132length, 132shape, 132

cmarrows, 188connections (������), 87

arrows key (������), 84, 85, 87, 94, 118�������� geometry, 195associations, UML, 186augment (graph), 161, 162, 164, 167, 169AutoCAD program, 137autogrid (graph), 158, 159, 163, 165–167\axes (mfpic), 123, 124, 127, 128, 130, 131, 132

axes, drawing (mfpic), 128\axis (mfpic), 128\axisheadlen rigid length (mfpic), 128, 132\axismarks (mfpic), 129

Bbabel package, 124bar package, 162bar charts

mfpic, 130graph, 162, 163, 164, 166

\barchart (mfpic), 130, 131

base (exteps), 156basic objects, 82, 83battery (makecirc), 197, 199bbox (��������), 62, 163, 165bcircle (metafun), 74\bclosed (mfpic), 127, 132Begin (metaUML), 187, 188beginchar (����), 68, 72begineps (exteps), 156beginfig (��������), 72, 73, 80, 156begingraph (graph), 157, 158, 169Bézier curves (������), 87, 88Bézier paths (mfpic), 128bibtex program, 801, 806Bigbrace (cmarrows), 189bigbrace (cmarrows), 189Biggbrace (cmarrows), 189biggbrace (cmarrows), 189bitmap (.gf) output files, 69, 70black (��������), 60block drawing, 177blockdraw�������� package, 177blue (��������), 60bluepart (��������), 150blurred effects, 152\bmarks (mfpic), 129

Bond graphs, 177boolean (����), 53, 56border key (������), 85bordercolor key (������), 85bot syntax (��������), 61bounded (��������), 67, 150bounding box (mfpic), 124BoundingBox (PostScript), 72Box (������ class), 95, 96, 99box-line diagrams, 178–180, 181boxdepth key (������), 85, 92boxes

alignment (������)centering, 103horizontal, 101horizontal separation, 102mixed objects, 102, 103vertical, 101, 103within frames, 104

empty, 82, 83boxes�������� package, 57, 75, 76, 79–81, 177boxheight key (������), 85, 92boxit (boxes), 76, 77, 78boxjoin (boxes), 76, 77, 78, 79boxsize key (������), 85, 92, 93bpath (��������), 77, 78, 79btex (��������), 61–63, 95, 157, 158, 159, 162, 164\btwnfcn (mfpic), 133

ch-end.tex,v: 1.24 2007/06/15

Page 128: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 881 — #63

�������� AND������� (B–C) 881

buildcycle (��������), 165

Ccapacitor (makecirc), 196, 197, 198, 199, 201capacitors, 196captions, centering, 124, 134card boxes, 180\cbclosed (mfpic), 132

Celtic artwork, 148centering (mfpic)

captions, 124, 134ellipses, 128symbols, 129

centerto (makecirc), 198, 199, 200, 202centreof (makecirc), 196, 198, 199, 202\chartbar (mfpic), 130Circle (������ class), 114\circle (mfpic), 127, 128circleit (boxes), 76, 77, 78, 79circles

connections (������), 92diagrams, 179diameter (mfpic), 132drawing (mfpic), 128filled and centered, 129filling (mfpic), 132nine points circle of a triangle, 190wedge of (mfpic), 129

circmargin (boxes), 76, 79circmargin key (������), 98, 100circular

containers (������), 98–100gradients, 143, 144

Class (metaUML), 181, 182, 183–186class

relations (UML diagrams), 184templates (UML diagrams), 183

classStereotypes (metaUML), 183ClassTemplate (metaUML), 183clearing (mfpic)

closed objects, 133symbols, 124

clearObj (������), 81\clearsymbols (mfpic), 124clink (metaUML), 186clip (��������), 63, 143, 145, 148, 150, 206\clipmfpic (mfpic), 124clipped (��������), 67, 150clipping

figures (mfpic), 124tools, 148

clipping (exteps), 156

closedobjects

clearing, 133filling, 133

polygons (mfpic), 129closefrm (��������), 67\closegraphsfile (mfpic), 125

closing objectsmfpic, 132���� language, 54

cmarrows�������� package, 188CMYK color, 75coilarm key (������), 86coilarmA key (������), 85, 94coilarmB key (������), 85, 94coilaspect key (������), 85, 94coilheight key (������), 85, 94coilinc key (������), 85, 94coils, connections (������), 94coilwidth key (������), 85, 94color

mfpic, 127CMYK, 75drawings, 127graying, 75labels, 120������� vs.��������, 60transparency, 75

color (��������), 60, 64, 79, 209commands (mfpic), 127comments (mfpic), 134Comprehensive TEX Archive Network, see CTANconnect env. (mfpic), 126, 132, 133connections (������)

arcs, 88arrow style, 87behind objects, 90Bézier curves, 87, 88circles, 92coils, 94curved boxes, 93double straight line, 87inside boxes, 92, 93labels for, 95line starting point, 87line style, 86line thickness, 86looping lines, 91, 92multi-segment lines, 89–91overview, 84–86rounded corners, 93straight lines, 86, 87zigzags, 94

connectors, diagrams, 180Container (������ class), 104

ch-end.tex,v: 1.24 2007/06/15

Page 129: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 882 — #64

882 (C–D) �������� AND�������

containers (������)circular, 98–100description, 95double-walled

box, 99, 100circle, 100ellipsis, 100

elliptical, 98–100margins, 96, 97oval boxes, 96polygons, 97rounded corners, 96simple box, 95square box, 95

contour (����), 143, 150control points, 53convert program, 806coordinate dimensions (mfpic), 127coordinate system, specifying (mfpic), 126coords env. (mfpic), 136Corel Draw program, 137, 138cosd (����), 53, 195CTAN (Comprehensive TEX Archive Network)

archived files, finding and transferring, 813description, 810files, from the command line, 814TEX file catalogue, 811web access, 810, 811, 812, 813, 814

ctext (makecirc), 200, 201cubes, 210curl (����), 54, 55current (makecirc), 197, 199, 201, 202currentpen (����), 146currentpicture (����), 62, 65, 66, 155, 156, 176\curve (mfpic), 127, 128, 136

curved box connections (������), 93curves

function drawing, 168, 169intersections, computing, 211���� language

3-D, 57, 58controlling, 55drawing, 54path data, 53

polar coordinates, 169through points (mfpic), 128

cutafter (��������), 77, 78, 79cutbefore (��������), 77, 78, 79cycle (����), 54, 56, 161, 162, 164\cyclic (mfpic), 128

DDalign key (������), 107, 110, 111, 114\darkershade (mfpic), 132dashed (��������), 79, 86, 88, 157, 158, 162

dashed lines (mfpic), 133dashes (expressg), 180dashes (mfpic)

gap between, 131, 133length, 132length of, 131lines, 133spacing, 132

\dashlen rigid length (mfpic), 131–133\dashlineset (mfpic), 132\dashspace rigid length (mfpic), 131–133

data types,���� language, 53DBox (������ class), 99debugging figures (mfpic), 125def (����), 57defaultdx (boxes), 76defaultdy (boxes), 76defaultfont (��������), 61, 79, 163, 165, 174defaultscale (��������), 61, 62, 78, 79, 163, 165–167DefinePattern (piechartMP), 175, 176diagrams

block drawing, 177Bond graphs, 177box-line, 178–180, 181card boxes, 180circles, 179connectors, 180diamond boxes, 180embedding in LATEX, 120, 121, 122flow charts, 177, 181graphs, 176index boxes, 180ovals, 179relations, 180rounded boxes, 179slanted rectangles, 179

diamond-shaped boxes, 180diode (makecirc), 197, 199, 202dir (����), 54, 55, 77–79direction (����), 142, 205disadvantages, 139displaymath env. (pst-pdf), 800displaymath option (pst-pdf), 800distance dimensions (mfpic), 127\doaxis (mfpic), 128

documentation, see also online resourcescommand-line interface, 815panel interface, 816search by name, 815search by product, 816texdoc, 815texdock, 816

dotlabel (��������), 61dotlabels (��������), 62\dotlineset (mfpic), 132

ch-end.tex,v: 1.24 2007/06/15

Page 130: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 883 — #65

�������� AND������� (D) 883

dots (shading), gap between (mfpic), 131, 133, 134\dotted (mfpic), 127, 133

dotted lines (mfpic), 133double-walled containers (������)

box, 99, 100circle, 100ellipsis, 100

doublearrow (cmarrows), 189doubleline key (������), 85, 87, 88, 94doublesep key (������), 85dpi (dots per inch), 70draft option (pst-pdf), 800\draw (mfpic), 133, 134draw (����), 54, 55, 56, 76, 84, 87, 158, 189draw_hatched_band (hatching), 150draw_Obj (������), 114, 118drawarrow (��������), 77, 78, 79, 84, 87, 189drawBINARY (expressg), 178drawBOOLEAN (expressg), 178drawboxed (boxes), 76, 77, 78drawboxes (boxes), 76, 77drawcardbox (expressg), 180drawcirclebox (expressg), 179, 181\drawcolor (mfpic), 127drawCOMPLEX (expressg), 178drawdashA (expressg), 180drawdashcircle (expressg), 179drawdashellipse (expressg), 179drawdashO (expressg), 180drawdashOA (expressg), 180drawdblarrow (��������), 77drawdiamondbox (expressg), 180, 181drawEXPRESSION (expressg), 178drawGENERIC (expressg), 178drawGEVENT (expressg), 179drawindexbox (expressg), 180drawing

animation, 156, 157blurred effects, 152boxes

commands for, 76committing to the page, 76joining, 77labeling connections, 78, 79relationships between, 76

Celtic artwork, 148circles, 74circular gradients, 143, 144clipping, 148diamonds, 74gradients, 143, 144grids, 147, 148–150hatching, 148–150lines

creating grids, 147

drawing (cont.)hiding, 145repeating, 147

morphing, 152multipaths, 145parallel gradients, 143, 144paths

interrupting, 145, 146multipaths, 145, 146

patterns, 147–150PostScript commands, 155, 156rounded corners, 75simplified paths, 75squares

creating grids, 147repeating, 147

squeezing shapes, 74text along a curve, 142tilings, 147–150transparency, 150, 151turtle graphics

classic style, 153turtle style, 153, 154

drawing (mfpic)affine transforms, 136analytical curves, 133angle dimensions, 127annotations, 134arcs, 128arrowheads

drawing, 132length, 132shape, 132

axes, 128bar charts, 130basic commands, 128–130Bézier paths, 128bounding box, 124centering

captions, 124, 134ellipses, 128symbols, 129

circlesdiameter, 132filling, 132simple, 128

clearingclosed objects, 133symbols, 124

clipping figures, 124closed polygons, 129closing open objects, 132color, 127commands, 127comments, 134

ch-end.tex,v: 1.24 2007/06/15

Page 131: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 884 — #66

884 (D–E) �������� AND�������

drawing (mfpic) (cont.)coordinate dimensions, 127coordinate system, specifying, 126curves through points, 128dashed lines, 133dashes

gap between, 131, 133length, 132length of, 131spacing, 132

debugging figures, 125distance dimensions, 127dots (shading), gap between, 131, 133, 134dotted lines, 133figure modifiers, 132, 133filled centered circles, 129filling closed objects, 133functions, 133global modifiers, 132grids, 129hash marks, length of, 131hatching, line spacing, 131, 133, 134joining objects, 126labels, 124, 134line segments, 129looping, 136�������mode, 123��������mode, 124modifiers, 127numbering pictures, 126object outlines, 133options, 124, 125pen, setting width, 132pie charts, 131plotting functions and parametric curves, 133, 135pretty printing, 137primitives, 126processing, 123rectangles, 129regular polygons, 129repetitive, 134reversing objects, 133rotating objects, 133, 135shading, dot spacing, 131, 132, 134size, specifying, 126spirals, 136symbolic names, 129syntax, 125–127unit length, basic, 132wedge of a circle, 129

drawINTEGER (expressg), 178drawLEVENT (expressg), 179, 181drawLOGICAL (expressg), 178drawnormalCA (expressg), 180drawnormalCD (expressg), 180

drawnormalD (expressg), 180drawnormalDCA (expressg), 180drawnormalF (expressg), 180drawnormalOA (expressg), 180drawnormalOD (expressg), 180drawNUMBER (expressg), 178drawObj (������), 81, 82, 83, 95, 177drawObject (metaUML), 182, 183, 186–188drawObjects (metaUML), 183, 184, 185–187drawoptions (��������), 148drawovalbox (expressg), 179, 181drawREAL (expressg), 178drawroundedbox (expressg), 179drawSTRING (expressg), 178drawthickO (expressg), 180drawunboxed (boxes), 76, 77, 79dual bar charts, 164duplicateObj (������), 117.dvi file extension (����), 63

dvipdfm program, 797, 798, 803dvipdfmx program, 797–799, 803, 804, 806dvips program, 62, 65, 797–801, 803–806dvitomp program, 63dx key (������), 96, 100, 104dy key (������), 96, 100, 104

Eelectrical circuits

capacitors, 196centering elements, 198centering text, 200–202command syntax, 199element abbreviations, 198element types, 199elements of, 196–199inductors, 196pin connections, 200resistors, 196symbols, 196, 197, 198wiring type, 198

\ellipse (mfpic), 128, 136ellipses

centered, 128in a parallelogram, 191

elliptical containers (������), 98–100emp env. (emp), 121emp package, 120, 121, 167empcmds env. (emp), 121empdef env. (emp), 121empfile env. (emp), 121empgraph env. (emp), 122\empprelude (emp), 122

empty boxes (������), 82, 83EmptyBox (������ class), 82, 83, 95\empuse (emp), 121

ch-end.tex,v: 1.24 2007/06/15

Page 132: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 885 — #67

�������� AND������� (E–G) 885

End (metaUML), 187, 188end (����), 72endchar (����), 68, 72endeps (exteps), 156endfig (��������), 65, 72, 73, 80endfor (����), 52, 55endgraph (graph), 157, 158, 169EntryPoint (metaUML), 188EPS output files, 72, 73epsdrawdot (exteps), 156epstopdf program, 804, 806eqnarray env. (pst-pdf), 800equation env. (pst-pdf), 800etex (��������), 61–63, 95, 157, 158, 159, 162, 164exitif (����), 56, 204ExitPoint (metaUML), 188��������, 137, 138expr (����), 57expressg �������� package, 177, 178, 181, 182extendObjLeft (������), 108extendObjRight (������), 108, 109extensiblebrace (cmarrows), 189exteps�������� package, 155

Ffanlinearc key (������), 114fanlinestyle key (������), 114FAQs (Frequently Asked Questions), 809, see also online

resources\fcncurve (mfpic), 128

featpost�������� package, 207, 209feynmf package, 120feynmp package, 120figure modifiers (mfpic), 132, 133file input/output, 67, 68fill (����), 56, 76, 150, 151, 158\fillcolor (mfpic), 127fillcolor key (������), 83, 104, 114filled (��������), 67filled key (������), 83, 96, 98, 100, 104, 114fills (mfpic)

centered circles, 129closed objects, 133

fills, closed objects, 133final option (pst-pdf), 800finite state diagram, 79fit key (������), 97, 98, 100, 102, 103, 177flipping trees (������), 110floor (����), 53flow charts, 177, 181font files, 69fonts

encoding, 65magsteps, 70, 71PostScript, 71

fonts (cont.)size, 70, 71

for (����), 52, 55, 59, 66, 150forever (����), 56, 204format (graph), 159fractals

Hilbert’s curve, 194Koch flake, 105������, 104, 105��������, 194, 195Sierpinski’s curve, 194Verhulst diagrams, 195

frame (graph), 158, 159, 160–162, 164–166framecolor key (������), 83, 104framed key (������), 82, 83, 104frames

aligning boxes (������), 104graphs, 158, 159trees (������), 112, 113

framestyle key (������), 177framewidth key (������), 83Frequently Asked Questions (FAQs), see online resourcesfullcircle (����), 63, 66, 74, 165fulldiamond (metafun), 74fullsquare (metafun), 74\function (mfpic), 123, 124, 133

functionsdrawing, 168, 169plotting (mfpic), 133, 135

G\gclear (mfpic), 133, 134gdata (graph), 160, 161, 162, 163, 165, 166, 167gdotlabel (graph), 158gdraw (graph), 157, 158, 160, 162, 164–166, 169gdrawarrow (graph), 158gdrawdblarrow (graph), 158generator (makecirc), 197, 199geometriesyr16�������� package, 192geometry

art, 195ellipse in a parallelogram, 191fractals, 194, 195golden ratio, 192hand-drawn figures, 192Hilbert’s curve, 194nine points circle of a triangle, 190plane, 190, 191, 192space, 192Verhulst diagrams, 195

.gf file extension (����), 69–71\gfill (mfpic), 127, 131, 133, 134gfill (graph), 159, 160, 161–165, 167gftopk program, 70ghostscript program, 798

ch-end.tex,v: 1.24 2007/06/15

Page 133: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 886 — #68

886 (G–I) �������� AND�������

ghostview program, 804glabel (graph), 157, 158, 162–167, 169global modifiers (mfpic), 132globes, 209gnuplot program, 137golden ratio, 192gpdata�������� package, 167gradients, tools, 143, 144grap program, 157graph�������� package, 75, 122, 157, 158, 159, 162,

167–169graphics package, 72graphicx package, 800graphs

bar charts, 162, 163, 164, 166Bond, 177data files

comment lines, 167reading, 160–162

dual bar charts, 164frames, 158, 159grids, 158, 159inserting in LATEX, 167labels

aligning, 173annotations, 134creating, 159, 160pie charts, 173, 174positioning, 173shifting, 173, 174

overview, 157, 158pie charts

drawing, 165, 171–173height, 171labels, 173, 174observation angle, 171offsets, 171radius, 171segments, 170, 171, 172, 175, 176setup for, 174, 175text handling, 174

scales, 158, 159text, printing, 167ticks, 158, 159types of, 162–167

graying, 75green (��������), 60greenpart (��������), 150\grid (mfpic), 129grid

(exteps), 156(graph), 158, 159

gridsmfpic, 129from lines, 147

grids (cont.)from multiple base patterns, 147from squares, 147graphs, 158, 159

ground (makecirc), 197, 199

Hhalign key (������), 116hand-drawn figures, 192hash marks, length of (mfpic), 131\hashlen rigid length (mfpic), 129, 131\hatch (mfpic), 131, 133hatch_match (hatching), 149hatchfill (hatching), 149, 150hatching

hatch macro, 148hatching package, 149, 150line spacing (mfpic), 131, 133, 134

hatching�������� package, 149hatchoptions (hatching), 149\hatchspace rigid length (mfpic), 131, 133HBox (������ class), 100, 102, 106hbsep key (������), 102, 107, 110, 111\headlen rigid length (mfpic), 132\headshape (mfpic), 132

help, see online resourceshexagonal meshes, 210hexagonaltrimesh (featpost), 210HFan (������ class), 113, 114hideleaves key (������), 110–114hiding/showing lines, 145Hilbert’s curve, 194History (metaUML), 188hookleftarrow (cmarrows), 189hookrightarrow (cmarrows), 189horizontal

box alignment (������), 101box separation (������), 102fans, trees (������), 113, 114, 115

How To Ask Questions The Smart Way, 810HRazor (������ class), 82, 114hsep key (������), 102, 108–113, 118hyperlinks, slides, 797–818hyperref package, 798, 803–805

Iifthen package, 136image (��������), 95, 146, 148, 149, 163, 165, 176imesh (makecirc), 199, 202impedance (makecirc), 197, 199, 202��������, 137, 138inactive option (pst-pdf), 800index boxes, 180inductor (makecirc), 196, 197, 198, 199, 200

ch-end.tex,v: 1.24 2007/06/15

Page 134: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 887 — #69

�������� AND������� (I–L) 887

inductors, 196infont (��������), 163, 165init_numbers (graph), 159initlatex

(latex), 64(makecirc), 196

input (����), 67, 75internal structures, 65, 66, 67interpath (����), 152interpol�������� package, 167interpolate (metafun), 152interpolating (��������), 167intersectionpoint (����), 191intersectiontimes (����), 148, 205introspection, 66, 67item (metaUML), 186itick (graph), 158, 159

Jjoining objects (mfpic), 126.jpeg file extension (pst-pdf), 806junction (makecirc), 197, 199, 200–202

Kkindofcube (featpost), 210, 211Koch flake, 105

Llabangle key (������), 95, 119labcard key (������), 119labcolor key (������), 119, 120labdir key (������), 95, 118, 119labdist key (������), 95Label (piechartMP), 170, 173, 174label (��������), 61, 64, 78, 119, 158, 200labelinspace (featpost), 211labeloffset (��������), 61labels

mfpic, 124, 134color, 120connections (������), 95erasing beneath, 120graphs

aligning, 173creating, 159, 160positioning, 173shifting, 173, 174

in pictures, 61, 62, 63, 64, 65in space, 211������, 118, 119, 120��������, 124on graphs (mfpic), 134pie charts, 173, 174positioning, 119

labels (cont.)rotating, 120shifting, 120

laberase key (������), 119, 120labpathid key (������), 118, 119labpathname key (������), 119labpic key (������), 95labpoint key (������), 119labpos key (������), 95, 119labrotate key (������), 119, 120labshift key (������), 119, 120Lalign key (������), 108, 110–113lamp (makecirc), 197, 199latex�������� package, 64, 196latex program, 797, 800, 801, 803, 804, 806LATEX files, obtaining

web access, 810, 811, 812, 813, 814latex.mp�������� package, 64latexMP�������� package, 59, 64, 151lcircle (metafun), 74\lclosed (mfpic), 132lefthalfarrow (cmarrows), 189length (����), 52, 66, 78, 79, 142lft syntax (��������), 61libraries

boxes package, 75–79metafun package, 74, 75

\lightershade (mfpic), 132linear equations, solving, 53linear transformation (������), 81linearc key (������), 85, 93, 94linecolor key (������), 85, 88–93lines

creating grids, 147hiding, 145repeating, 147segments (mfpic), 129starting point (������), 87styles (������), 86thickness (������), 86UML diagrams, 185

\lines (mfpic), 127, 129, 135linestyle key (������), 85, 86, 88, 93linetension key (������), 86, 88, 94linetensionA key (������), 85, 88linetensionB key (������), 85, 88linewidth key (������), 85, 86, 88–94link (metaUML), 184, 185, 188llcircle (metafun), 74llcorner (��������), 150llft syntax (��������), 61lltriangle (metafun), 74\lmarks (mfpic), 129.log file extension (mfpic), 124

ch-end.tex,v: 1.24 2007/06/15

Page 135: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 888 — #70

888 (L–M) �������� AND�������

loopingmfpic, 136commands, 56connection lines, 91, 92lines (������), 91, 92

loopsize key (������), 85, 91lrcircle (metafun), 74lrt syntax (��������), 61lrtriangle (metafun), 74

Mm3d�������� package, 209macros,���� language

arguments, 59default behavior, 59defining, 57–60key=value pairs, 59, 60parameters, 57string evaluation, 57types of, 57variable names, 57

magsteps, 70, 71makecirc�������� package, 196, 198makeindex program, 123, 806makempx program, 63makepen (����), 53Manhattan paths, 184mapstoarrow (cmarrows), 189margins, containers (������), 96, 97mathptm package, 65matlab�������� package, 167matpos (������), 118Matrix (������ class), 115mcangle (������), 118mcangles (������), 118mcarc (������), 118mcarcbox (������), 118mcbox (������), 118mccircle (������), 118mccoil (������), 118mccurve (������), 118mcdiag (������), 118mcdiagg (������), 118mcline (������), 84, 118mcloop (������), 118mczigzag (������), 118meains (makecirc), 197, 199mechanical drawings, 203message (����), 68���� language, 51–167

affine transforms, 53closing objects, 54control points, 53curves

3-D, 57, 58

���� language (cont.)controlling, 55drawing, 54path data, 53

data types, 53description, 52, 53drawing commands, storing, 53linear equations, solving, 53looping commands, 56macros

arguments, 59default behavior, 59defining, 57–60key=value pairs, 59, 60parameters, 57string evaluation, 57types of, 57variable names, 57

pair data, 53path data, 53paths, transforming, 56pen data, 53pens, 53, 55picture data, 53point representation, 53segments, 53straight lines, drawing, 54transform data, 53, 56

�������mode (mfpic), 123metafun�������� package, 61, 73–75, 138, 143, 151, 152Metagraf program, 209�������������� package, 80–120

basic objects, 82, 83box alignment

centering, 103horizontal, 101horizontal separation, 102mixed objects, 102, 103vertical, 101, 103within frames, 104

concepts, 81connections

arcs, 88arrow style, 87behind objects, 90Bézier curves, 87, 88circles, 92coils, 94curved boxes, 93double straight line, 87inside boxes, 92, 93labels for, 95line starting point, 87line style, 86line thickness, 86

ch-end.tex,v: 1.24 2007/06/15

Page 136: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 889 — #71

�������� AND������� (M–N) 889

�������������� package (cont.)looping lines, 91, 92multi-segment lines, 89–91overview, 84–86rounded corners, 93straight lines, 86, 87zigzags, 94

containerscircular, 98–100description, 95double-walled box, 99, 100double-walled circle, 100double-walled ellipsis, 100elliptical, 98–100margins, 96, 97oval boxes, 96polygons, 97rounded corners, 96simple box, 95square box, 95

description, 80empty boxes, 82, 83fractals, 104, 105labels, 118, 119, 120linear transformation, 81principles, 80recursive objects, 104, 105trees

aligning, 107, 108flipping, 110framing, 112, 113horizontal fans, 113, 114, 115left to right, 109mixed directions, 110mixed objects, 111overlapping subtrees, 111overview, 105right to left, 108root at the bottom, 109separating, 111vertical fans, 113, 114, 115

��������mode (mfpic), 124MetaUML�������� package, 181metric (.tfm) output files, 69\mfpdefinecolor (mfpic), 128\mfpic (mfpic), 124, 125mfpic env. (mfpic), 124, 125, 126, 135mfpic package, 52, 120, 122–136, 139\mfpicdebugfalse (mfpic), 124\mfpicdebugtrue (mfpic), 124\mfpicdraft (mfpic), 125\mfpicfinal (mfpic), 125\mfpicnowrite (mfpic), 125\mfpicnumber (mfpic), 126\mfpicunit rigid length (mfpic), 126, 132

\mfpverbtex (mfpic), 124mft program, 137mftoeps������� package, 138mode, 69, 70mode (����), 69mode_setup (����), 70modifiers (mfpic), 127morphing, 152motor (makecirc), 197, 199.mp file extension (��������), 63

mpattern�������� package, 148mpcirc�������� package, 196, 203mpos (������), 118mproof package, 73, 74.mps file extension (��������), 72

mpsproof package, 73, 74mpt program, 137mptopdf program, 73, 75mptotex program, 63.mpx file extension (��������), 63Mreadpath (graph), 167multi-segment lines (������), 89–91multipaths, 145

N\name (mfpic), 129name key (������), 85, 119naming output files, 70nb (������), 116, 117ncangle (������), 89, 90ncangles (������), 89, 90, 91ncarc (������), 88, 93ncarcbox (������), 85, 92, 93ncbar (������), 88, 89, 177ncbox (������), 85, 92, 93nccircle (������), 84, 92nccoil (������), 94nccurve (������), 85, 87, 88ncdiag (������), 90ncdiagg (������), 90ncline (������), 84, 86, 87, 95, 119, 177ncloop (������), 85, 90, 91nczigzag (������), 94new_Box (������), 81new_Box_ (������), 81new_Circle (������), 114new_HFan (������), 114new_HFan_ (������), 114new_RBox (������), 114newBox (������), 81, 95, 96, 100, 101, 102–104, 114, 177newCircle (������), 86, 99, 104, 177newContainer (������), 104\newcounter (mfpic), 136newDBox (������), 99, 100newDEllipse (������), 81, 100, 112, 113

ch-end.tex,v: 1.24 2007/06/15

Page 137: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 890 — #72

890 (N–P) �������� AND�������

newEllipse (������), 98, 100, 104, 113, 177newEmptyBox (������), 82newHBox (������), 100, 101, 102newHFan (������), 114newHRazor (������), 82, 83, 102newMatrix (������), 115, 116, 117newPolygon (������), 96, 97, 102, 103, 177newPTree (������), 105newRandomBox (������), 83newRBox (������), 96, 104, 114newRecursiveBox (������), 104news groups, 810, see also online resourcesnewTree (������), 105, 107, 108–113newVBox (������), 102, 103newVFan (������), 114newVonKochFlake (������), 105newVRazor (������), 82, 83, 103nine points circle of a triangle, 190\nocenteredcaptions (mfpic), 124\noclearsymbols (mfpic), 124\noclipmfpic (mfpic), 124nodesep key (������), 86nodesepA key (������), 85, 87, 92, 93nodesepB key (������), 85, 87, 92, 93\nomplabels (mfpic), 124\nooverlaylabels (mfpic), 124nopstricks option (pst-pdf), 800normaldeviate (����), 53notightpage option (pst-pdf), 800\notruebbox (mfpic), 124ntreepos (������), 120nullpen (����), 53nullpicture (����), 66, 150numbering pictures (mfpic), 126numeric (����), 53

OObj (������), 81, 84, 114, 118, 120object outlines (mfpic), 133ObjLabel (������), 118, 119observation angle, pie charts, 171offset key (������), 86offsetA key (������), 85, 87, 90, 91, 120offsetB key (������), 85, 87, 91, 120offsets, pie charts, 171oldtexarrow (cmarrows), 189online access to CTAN, 810, 811, 812, 813, 814online resources

archived files, finding and transferring, 813CTAN (Comprehensive TEX Archive Network), 810

web access, 810, 811, 812, 813, 814documentation

command-line interface, 815panel interface, 816search by name, 815

online resources (cont.)search by product, 816texdoc, 815texdock, 816

FAQs (Frequently Asked Questions), 809files, getting from the command line, 814How To Ask Questions The Smart Way, 810news groups, 810program files, obtaining

web access, 810, 811, 812, 813, 814TEX file catalogue, 811TEX files, 810TEX user groups, 817, 818TUG home page, 810, 811

open objects, closing, 132\opengraphsfile (mfpic), 124, 125

optical drawings, 204, 205, 206origin (����), 160, 161otick (graph), 158, 159, 166OUT syntax (��������), 158output files

bitmap (.gf), 69, 70EPS (Encapsulated PostScript), 72, 73metric (.tfm), 69naming, 70PDF (Portable Document Format), 72, 73

oval box containers (������), 96ovals, 179overlapping subtrees (������), 111\overlaylabels (mfpic), 124

Ppair (����), 53, 56, 60, 84\parafcn (mfpic), 133, 136

parallel gradients, 143, 144parallelarrows (cmarrows), 189paralleloppositearrows (cmarrows), 189paralleloppositelefthalfarrows (cmarrows), 189paralleloppositerighthalfarrows (cmarrows), 189parametric curves, plotting, 133, 135path (����), 53, 55, 56pathCut (metaUML), 185pathfillcolor key (������), 85pathfilled key (������), 85pathHorizontal (metaUML), 185pathManhattanX (metaUML), 184pathManhattanY (metaUML), 184pathofstraightline (featpost), 211pathpart (��������), 66, 150paths

between object centers, 186between objects, 185Bézier, 128interrupting, 145, 146multipaths, 145, 146

ch-end.tex,v: 1.24 2007/06/15

Page 138: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 891 — #73

�������� AND������� (P) 891

paths (cont.)transforming, 56UML diagrams

arbitrary, relations between, 184between object centers, 186between objects, 185lines, 185Manhattan, 184rectangular, 184stair-like, 184, 185

pathStepX (metaUML), 184pathStepY (metaUML), 184pathVertical (metaUML), 185patterns, 147–150.pdf file extension (pst-pdf), 806

PDF output files, 72, 73pdfcrop program, 804pdfinfo program, 804pdflatex program, 797, 800, 801, 803, 805, 806PDFs

creatingdvipdfm program, 798–800dvipdfmx program, 798–800from LATEX, 803–807from PostScript, 800, 801, 802, 803overview, 797pst-pdf package, 800, 801, 802, 803

pdftex program, 797, 798pdftops program, 806\pen (mfpic), 127, 132, 134pen (����), 53pencircle (����), 53, 55, 56, 79, 162pens

���� language, 53, 55setting width (mfpic), 132

pensquare (����), 166perspective projection, 208physics diagrams, 209pic (boxes), 76, 77, 79pic language, 75pickup (����), 55, 56, 79, 162, 166picture (����), 53, 62, 63, 65, 66, 95, 146, 206picture env., 797

(emp), 121pictures

annotating, 61, 62, 63, 64, 65numbering, 126size, specifying, 126text in, 61–64, 65

pie chartsmfpic, 131drawing, 131, 165, 171–173height, 171labels, 173, 174observation angle, 171

pie charts (cont.)offsets, 171radius, 171segments, 170, 171, 172, 175, 176setup for, 174, 175text handling, 174

PieChart (piechartMP), 170, 171, 172–174\piechart (mfpic), 131PiechartBBox (piechartMP), 176piechartMP�������� package, 143, 170, 176\piewedge (mfpic), 131

pin connections, 200.pk file extension (����), 69, 70

plain�������� package, 74, 75plane geometry, 190, 191, 192\plot (mfpic), 125plot (graph), 158\plotnodes (mfpic), 125\plotsymbol (mfpic), 124, 125, 129

plotting functions and parametric curves (mfpic), 133, 135\plrfcn (mfpic), 133\plrregion (mfpic), 133, 134.png file extension (pst-pdf), 806\point (mfpic), 124, 125, 129, 132point (����), 78, 79, 142point representation, 53\pointdef (mfpic), 129pointfilled boolean (mfpic), 132\pointfillfalse (mfpic), 125\pointfilltrue (mfpic), 125\pointsize rigid length (mfpic), 129, 132

polar coordinates, 169Polygon (������ class), 97\polygon (mfpic), 129

polygonsclosed, 129containers (������), 97regular, 129

\polylines (mfpic), 129polymargin key (������), 97, 102, 103, 177pos key (������), 84, 86posA key (������), 81, 84–86, 87posB key (������), 81, 84–86positioning labels

connections, 95overview, 119

PostScriptcommands, 155, 156fonts, 65PDFs from, 800, 801, 802, 803

postscript env. (pst-pdf), 802pretty printing (mfpic), 137preview package, 800–802\PreviewEnvironment (pst-pdf), 801

ch-end.tex,v: 1.24 2007/06/15

Page 139: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 892 — #74

892 (P–S) �������� AND�������

previewingcharacters, 69drawings, 73, 74

primitives (mfpic), 126printing text, 167PrivatePattern (piechartMP), 176program files, obtaining

web access, 810, 811, 812, 813, 814projected segments, 211prologues (��������), 64, 65ps2pdf program, 797, 801–806ps2pdf13 program, 804, 805psfonts.map file (dvips), 65psmatrix env. (pst-pdf), 800pspicture env. (pst-pdf), 800pst-pdf package, 797, 800–803, 805, 806\pst@object (pst-pdf), 800pstricks option (pst-pdf), 800pstricks package, 797, 800

Rradius, pie charts, 171Ralign key (������), 109–113random number generators, 203RandomBox (������ class), 83randomized (metafun), 74rbox_radius key (������), 96rboxes�������� package, 76rboxit (rboxes), 76rcircle (metafun), 74rdrawarrow (������), 84readfrom (��������), 67, 68rebindrelativeObj (������), 108, 109rebindVisibleObj (������), 112, 113\rect (mfpic), 129

rectanglesslanted, 179with corners (mfpic), 129

rectangular paths, 184recursive objects (������), 104, 105RecursiveBox (������ class), 104red (��������), 60redpart (��������), 150reflectedabout (����), 62\regpolygon (mfpic), 129

regular polygons (mfpic), 129relations, diagrams, 180repeating lines, 147repetitive drawings (mfpic), 134resistor (makecirc), 196, 197, 198, 199, 200, 201resistors, 196\reverse (mfpic), 133

reversing objects (mfpic), 133rheostat (makecirc), 197, 199righthalfarrow (cmarrows), 189

\rmarks (mfpic), 129rncangle (������), 118rncangles (������), 118rncarc (������), 118rncarcbox (������), 118rncbar (������), 118rncbox (������), 118rnccoil (������), 118rnccurve (������), 118rncdiag (������), 118rncdiagg (������), 118rncline (������), 118rncloop (������), 118rnczigzag (������), 118rotated (����), 55, 56, 63, 162–165rotatedabout (����), 62, 194rotatedaround (����), 56rotateObj (������), 81\rotatepath (mfpic), 133

rotatinglabels, 120objects (mfpic), 133, 135

round (����), 161rounded boxes, 179rounded corners (������)

connections, 93containers, 96

rpathHorizontal (metaUML), 185rpathManhattanX (metaUML), 184rpathManhattanY (metaUML), 184rpathVertical (metaUML), 185rt syntax (��������), 61running, 68–73

Sscaled (����), 55, 56, 62, 63, 66, 74, 79, 162, 163, 165, 166scaleObj (������), 81, 104, 105, 107–112, 113, 117scales, 158, 159scantokens (����), 57, 68, 160, 161–165, 166, 167science and engineering drawings

electrical circuitscapacitors, 196centering elements, 198centering text, 200–202command syntax, 199element abbreviations, 198element types, 199elements of, 196–199inductors, 196pin connections, 200resistors, 196symbols, 196, 197, 198wiring type, 198

mechanical drawings, 203optics, 204, 205, 206

ch-end.tex,v: 1.24 2007/06/15

Page 140: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 893 — #75

�������� AND������� (S–T) 893

science and engineering drawings (cont.)random number generators, 203simulation, 203

\sclosed (mfpic), 132\sector (mfpic), 129Segment (piechartMP), 170, 171–174, 176segments

���� language, 53pie charts, 170–172, 175, 176projected, 211

SegmentState (piechartMP), 171, 172, 173, 174setbounds (��������), 155, 156setcoords (graph), 160\setcounter (mfpic), 136setCurveDefaultOption (������), 84, 86setObjectDefaultOption (������), 110, 114setrange (graph), 160, 161, 162, 163, 166, 167\setrender (mfpic), 126SetupColors (piechartMP), 173, 174setupLaTeXMP (latexMP), 64SetupName (piechartMP), 175SetupNumbers (piechartMP), 174SetupPercent (piechartMP), 170, 174, 175SetupText (piechartMP), 174, 175SetupValue (piechartMP), 175\shade (mfpic), 127, 131, 133\shadespace rigid length (mfpic), 131–133

shading, dot spacing (mfpic), 131–133, 134shifted (����), 56, 62, 66, 142shifting labels, 120shortaxisarrow (cmarrows), 189show_empty_boxes (������), 82, 83Sierpinski’s curve, 194simplified (metafun), 75simulation, 203sind (����), 53slanted rectangles, 179slides (color), overlay specification

hyperlinks, 797–818smoothed (metafun), 75source (makecirc), 197, 199, 201, 202space geometry, 192spatialhalfcircle (featpost), 209\special, 797special (����), 155, 156spirals (mfpic), 136sqrt (����), 53, 195square box containers (������), 95squares

creating grids, 147repeating, 147

squeezed (metafun), 74stair-like paths, 184, 185State (metaUML), 187, 188

states, UMLcomposite, 188defining, 187internal transitions, 188special, 188

stateTransitions (metaUML), 188step (����), 55, 205stereotypes, UML, 183straight lines

connections (������), 86, 87drawing, 54

string (����), 53, 142stroked (��������), 66, 67styles

arrows, 188lines

connections, 86thickness, 86

turtle graphicsclassic, 153turtle, 153, 154

subpath (����), 146substring (����), 142suffix (����), 57switch (makecirc), 197, 199symbolic names (mfpic), 129symbols

centered, 129clearing, 124electrical circuit diagrams, 196, 197, 198

syntax (mfpic), 125–127

TT_ (������), 118tailarrow (cmarrows), 189TC (������), 114, 118Tc (������), 118tcangle (������), 118tcangles (������), 118\tcaption (mfpic), 124, 134, 135tcarc (������), 118tcarcbox (������), 118tcbox (������), 118tccircle (������), 118tccurve (������), 118tcdiag (������), 118tcdiagg (������), 118tcircle (metafun), 74tcline (������), 84, 118tcloop (������), 118Template (metaUML), 184template objects, UML, 184tension (����), 54, 78, 79Terminate (metaUML), 188TEX (TEX), 64

ch-end.tex,v: 1.24 2007/06/15

Page 141: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 894 — #76

894 (T–U) �������� AND�������

TEX�������� package, 64TEX file archives, 810, see also CTANTEX files, obtaining

web access, 810, 811, 812, 813, 814texarrow (cmarrows), 189texdoc program, 815, 816texdoctk program, 815–817text

along a curve, 142centering, 200–202in pictures, 61, 62, 63, 64, 65pie charts, 174printing, 167

text (����), 57, 59textext (latexMP), 64textual (��������), 67Tf (������), 96, 114.tfm file extension (����), 61, 70thelabel (��������), 62, 63, 142, 206ticks, 158, 159tightpage option (pst-pdf), 800tiling, 147–150time (����), 68\tlabel (mfpic), 134, 135\tmarks (mfpic), 129Tn (������), 82top syntax (��������), 61Toval_ (������), 98Tr_ (������), 96transform (����), 53transformer (makecirc), 197, 199, 202transistor (makecirc), 197, 199, 201transparency, 75, 150, 151Tree (������ class), 86, 106, 113treemode key (������), 108–113, 118trees (������)

aligning, 107, 108flipping, 110framing, 112, 113horizontal fans, 113, 114, 115left to right, 109mixed directions, 110mixed objects, 111overlapping subtrees, 111overview, 105right to left, 108root at the bottom, 109separating, 111vertical fans, 113, 114, 115

tripplearrow (cmarrows), 189troff program, 64, 65, 75tropicalglobe (featpost), 209true (����), 56TUG home page, 810, 811\turn (mfpic), 134, 136

\turtle (mfpic), 129turtle graphics

classic style, 153turtle style, 153, 154

twoheadarrow (cmarrows), 189twowayarrow (cmarrows), 189twowaydoublearrow (cmarrows), 189twowayoldarrow (cmarrows), 189txp�������� package, 142

UUalign key (������), 109, 110ulcircle (metafun), 74ulft syntax (��������), 61ultriangle (metafun), 74UML diagrams

activitiesbeginning, 187constructing, 187ending, 187

actors, 187arrows, 188associations, 186between object centers, 186between objects, 185braces, 188class relations, 184class templates, typesetting, 183overview, 181paths

arbitrary, relations between, 184between object centers, 186between objects, 185lines, 185Manhattan, 184rectangular, 184stair-like, 184, 185

rectangular, 184sample, 181stair-like, 184states

composite, 188defining, 187internal transitions, 188special, 188

stereotypes, defining, 183template objects, creating, 184use cases, 186

unfill (����), 56, 151, 163, 165, 206uniformdeviate (����), 53, 204, 210unit length, basic (mfpic), 132unitcircle (metafun), 74unitdiamond (metafun), 74\unitlength (emp), 121unitsquare (����), 74, 75, 151, 153

ch-end.tex,v: 1.24 2007/06/15

Page 142: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 895 — #77

�������� AND������� (U–Z) 895

unitvector (����), 191until (����), 55upto (����), 56urcircle (metafun), 74urcorner (��������), 142, 150urt syntax (��������), 61urtriangle (metafun), 74use cases, UML, 186Usecase (metaUML), 186\usecenteredcaptions (mfpic), 124\usemetapost (mfpic), 124\usemplabels (mfpic), 124\usetruebbox (mfpic), 124

Vvalign key (������), 116vardef (����), 57, 78VBox (������ class), 100, 102, 106vbsep key (������), 103verbatimtex (��������), 63, 124, 175Verhulst diagrams, 195vertical fans, trees (������), 113, 114, 115VFan (������ class), 113, 114viewcentr (featpost), 209visible key (������), 85VonKochFlake (������ class), 105VRazor (������ class), 83, 114vsep key (������), 110–113VTeX program, 797

Wwedge of a circle (mfpic), 129wget program, 814

whatever (����), 160, 162, 166, 190\whiledo (mfpic), 136white (��������), 60wire (makecirc), 196, 198, 199–202wireU (makecirc), 200, 202wiring type, 198withcolor (��������), 62, 66, 74, 79, 149, 158, 159,

161–163, 165, 167withdots (��������), 88, 162within (��������), 66, 67, 146, 150withpen (����), 158write (��������), 68

X\xaxis (mfpic), 128

xetex program, 798, 803\xmarks (mfpic), 129, 130xpart (����), 53, 56, 198xpdf program, 804xscaled (����), 149.gf (bitmap) output files, 69, 70.tfm (metric) output files, 69

Y\yaxis (mfpic), 128\ymarks (mfpic), 129ypart (����), 53, 56, 198yscaled (����), 55, 149

Zzigzag lines (������), 94zlib program, 799

ch-end.tex,v: 1.24 2007/06/15

Page 143: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 896 — #78

Grap

onT

heLA

TE

csC

ompanion

Th

AT

E XG

raphicsC

ompan

panionT

heLA

TE X

Graphics

aphicsC

ompanion

The

LAT

E X

heLA

TE X

Graphics

Com

panion

Com

panionT

heLA

TE X

Graphic

XG

raphicsC

ompanion

The

LAT

onT

heLA

TE X

Graphics

Com

pa

icsC

ompanion

The

LAT

E XG

ra

LAT

E XG

raphicsC

ompanion

The

panionT

heLA

TE X

Graphics

Co

Graphics

Com

panionT

heLA

TE X

The

LAT

E XG

raphicsC

ompanion

Com

panionT

heLA

TE X

Graphic

E XG

raphicsC

ompanion

The

LA

ionT

heLA

TE X

Graphics

Com

pa

icsC

ompanion

The

LAT

E XG

ra

LAT

E XG

raphicsC

ompanion

Th

mpanion

The

LAT

E XG

raphicsC

o

raphicsC

ompanion

The

LAT

E X

The

LAT

E XG

raphicsC

ompanio

Com

panionT

heLA

TE X

Graphic

E XG

raphicsC

ompanion

The

LA

nionT

heLA

TE X

Graphics

Com

p

phicsC

ompanion

The

LAT

E XG

ra

LAT

E XG

raphicsC

ompanion

Th

mpanion

The

LAT

E XG

raphicsC

Graphics

Com

panionT

heLA

TE X

The

LAT

E XG

raphicsC

ompanio

Com

panionT

heLA

TE X

Graph

TE X

Graphics

Com

panionT

heLA

ionT

heLA

TE X

Graphics

Com

p

phicsC

ompanion

The

LAT

E XG

eLA

TE X

Graphics

Com

panionT

mpanion

The

LAT

E XG

raphicsC

Graphics

Com

panionT

heLA

TE

nT

heLA

TE X

Graphics

Com

pani

Com

panionT

heLA

TE X

Graphi

AT

E XG

raphicsC

ompanion

The

panionT

heLA

TE X

Graphics

Com

phicsC

ompanion

The

LAT

E XG

eLA

TE X

Graphics

Com

panionT

ompanion

The

LAT

E XG

raphics

Graphics

Com

panionT

heLA

TE

The

LAT

E XG

raphicsC

ompan

Com

panionT

heLA

TE X

Grap

aphicsC

ompanion

The

L

TE X

Graphics

Com

The

LAT

E XG

anionT

x y

z

1.0

2.0

3.0

4.0

-1.0

-2.0

-3.0

-4.0

-5.0

1.0

2.0

3.0

4.0

-1.0

-2.0

-3.0

-4.0

1.0

2.0

3.0

4.0

-1.0

A

B

C

I

IC

IBIA

AOB

BOB

I1

I2�

I3�

I1C

I1B

I1A

I2B

I2C

I2A

I3A

I3C

I3B

1.0

2.0

3.0

.0

-1.0

-2.0

1.0

2.0

-1.0

-2.0

-3.0

-4.0

1.0

2.0

-1.0

Atrianglewithallimportan

tlin

esan

dcircles

andsome 3-D magic

The

LATEX

Graphics Compa

nio

nThe

LAT

EXGraphics Com

pani

onT

he

LATEX

Graphics Com

pani

on

The

LATEX

Graphics Compa

nio

n

The

L ATE X

Graphics Compan

ionThe

LATE

X

Graphics C

om

pan

ion

Page 144: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 897 — #79

PSTricks

Symbols\( (pst-pdf), 800(-) key value (pstricks), 261\) (pst-pdf), 800)-( key value (pstricks), 261* key value (pstricks), 252**-** key value (pstricks), 261*-* key value (pstricks), 261*0 key value (pstricks), 267*D key value (pstricks), 270, 271*L key value (pstricks), 270, 271*R key value (pstricks), 270, 271*U key value (pstricks), 270, 271+ key value (pstricks), 252- key value (pstricks), 261-) key value (pstricks), 263, 264-<< key value (pstricks), 260-> key value (pstricks), 259, 260, 262, 264-] key value (pstricks), 260, 264-o key value (pstricks), 264<-> key value (pstricks), 261<<- key value (pstricks), 260<<->> key value (pstricks), 261> syntax (pst-node), 356>- key value (pstricks), 260>-< key value (pstricks), 261>>-<< key value (pstricks), 261[-] key value (pstricks), 261\jobname.tmp file (pst-tree), 376{ } (curly braces), 304

^ syntax (pst-node), 356_ syntax (pst-node), 356]- key value (pstricks), 260]-[ key value (pstricks), 261]-o key value (pstricks), 260]-| key value (pstricks), 260| key value (pstricks), 252|*-|* key value (pstricks), 261|-| key value (pstricks), 261|<->| key value (pstricks), 261|>-<| key value (pstricks), 2613-D coordinates, 2193-D parallel projections

3-D lines, 402boxes, 404circles, 405coordinate axes, specifying, 401, 402dotted lines, 402ellipses, 405keywords for

axes labels, moving, renaming, 413circular arcs, 412coordinate system rotation, 410dimension scale, changing, 411drawing style, 414, 415edge appearance, 412elliptical arcs, 412hidden lines, drawing, 415, 416list of, 410plane, specifying, 413plot points, 411

Page 145: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 898 — #80

898 (Symbols–A) PSTricks

3-D parallel projections (cont.)positioning the origin, 414spherical coordinates, 416suppressing coordinate axes, 411

plotting mathematical functions and data, 407–409rectangles, 404spheres, 406square, 403triangle, 403

3-D representationbuttons, 447framed objects, 447geometric objects, 445, 446grids, 447hidden lines or surfaces, 445keywords, 395light effects, 447normal vector direction, 397–399rotating, 397, 399shading, 394sides hiding sides, 397types of objects, 393view angle, 397viewpoint, 395, 396, 397views, 219, 397

3-D views, 219

@\@ifnextchar, 328

Aa key value (pst-tree), 380\AAJ (rrgtrees), 425absolute key value (pstricks), 235, 239absorption key (pst-spectra), 432absorption spectra, 432Acrobat Distiller program, 797, 798active option (pst-pdf), 800Add key value (pstricks), 252addfillstyle key (pstricks), 253, 257\addto@pscode (pstricks), 292, 305

Adobe Reader program, 804, 817affected key (pst-pdgr), 431algebraic key (pstricks-add), 423alignment, tree node labels, 379, 381, 382all key value (pst-plot), 315, 318, 319Alpha key (pst-3dplot), 401, 408, 409, 410, 411\AltClipMode (pstricks), 276\altcolormode (pstricks), 304amplitude1 key (pst-osci), 434amsmath package, 361angle key (pst-node), 297, 299, 300, 343, 349, 351, 352angleA key (pst-node), 342–345, 346, 348, 349, 351, 352, 360,

361

angleB key (pst-node), 338, 342–345, 348, 349, 351, 352, 353,360, 361

anglesconnections, 351in arguments, 218specifications, 218, 302

Apollonius circles, 456arcangle key (pst-node), 341, 347, 349, 351, 355arcangleA key (pst-node), 349, 351arcangleB key (pst-node), 349, 351arced box connections, 347\ArcL (vaucanson-g), 440

arcs3-D parallel projections

circular, 412elliptical, 412

bent lines, 238commands for, 241, 242ellipses, 243separation, 247

arcsep key (pstricks), 247, 248arcsepA key (pstricks), 247arcsepB key (pstricks), 247\ARG (rrgtrees), 425arm key (pst-node), 341, 349, 351, 352, 360armA key (pst-node), 343, 344, 349, 351, 352, 360armB key (pst-node), 344, 345, 349, 351, 352armB key value (pst-node), 342array env., 361\arraycolsep rigid length, 364

arrayjob package, 322\arraystretch, 364ArrowA (PostScript), 294, 295ArrowB (PostScript), 294, 295ArrowFill key (pstricks-add), 418, 419, 420arrowinset key

(pstricks-add), 419(pstricks), 260, 262

ArrowInside key (pstricks-add), 418, 419, 420ArrowInsideNo key (pstricks-add), 419ArrowInsideOffset key (pstricks-add), 419ArrowInsidePos key (pstricks-add), 419arrowlength key (pstricks), 260, 262arrows

creating your own, 264, 265custom style, 295, 418, 419, 420inside lines and curves, 419keywords for, 260–264, 418length, 262line termination, 259, 260, 261, 263notch depth, 262pre-defined, 259–261round bracket termination, 263rounded ends, 261scaling factor, 264

ch-end.tex,v: 1.24 2007/06/15

Page 146: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 899 — #81

PSTricks (A–B) 899

arrows (cont.)size, 261square bracket termination, 263strut width, 263transparent, unfilled, 419unfilled, inside, 420

\arrows (pstricks), 294, 295arrows key (pstricks), 235, 237, 259, 260, 262–264arrowscale key (pstricks), 260, 263, 264, 365, 419arrowsize key (pstricks), 260, 261, 262art, geometry, 456, 457Asterisk key value (pstricks), 252asterisk key value (pstricks), 252\attributeof (pst-dbicons), 445auto key value (pst-fill), 386automata, 438, 439–442aux file (pst-tree), 376axes

3-D parallel projectionslabels, moving, 413renaming, 413specifying, 401, 402suppressing, 411

plotsorigin, 316specifying, 319

axes key value (pst-plot), 314, 315axesstyle key (pst-plot), 314, 315, 316, 321, 322, 391, 392

Bb key value (pst-tree), 380B+ key value (pstricks), 252B-cp key value (tlgc), 265BALLON key (pst-labo), 433Bar key value (pstricks), 252\Bar (pst-3d), 390

bar charts, 450bar codes, 453barstyle key (pst-bar), 450baseColor key (pst-fractal), 456Basterisk key value (pstricks), 252bbd key (pst-tree), 370, 378bbh key (pst-tree), 370, 378bbl key (pst-tree), 370, 378bbllx key (pst-eps), 457bblly key (pst-eps), 457bbr key (pst-tree), 370, 378bburx key (pst-eps), 457bbury key (pst-eps), 457Bdiamond key value (pstricks), 252beamer document class, 440\begin@AltOpenObj (pstricks), 307\begin@ClosedObj (pstricks), 307\begin@OpenObj (pstricks), 307\begin@SpecialObj (pstricks), 307

beginAngle key (pst-3dplot), 405, 410, 412, 416belowtext key (pst-pdgr), 431bending lines, 238Beta key (pst-3dplot), 401, 408, 409, 410, 411Bézier curves

connections, 345, 352drawing, 244, 245, 291

\bhpBox (tlgc), 274bibtex program, 801, 806black key value (pstricks), 216, 235blank spaces, tree nodes, 369\blue (pstricks), 216blue key value (pstricks), 216, 221, 232blur key (pst-blur), 450blurradius key (pst-blur), 450blurred shadows, 450Bo key value (pstricks), 252BoldAdd key value (pstricks), 252BoldAsterisk key value (pstricks), 252BoldBar key value (pstricks), 252BoldCircle key value (pstricks), 252BoldDiamond key value (pstricks), 252BoldHexagon key value (pstricks), 252BoldMul key value (pstricks), 252BoldOplus key value (pstricks), 252BoldOtimes key value (pstricks), 252BoldPentagon key value (pstricks), 252BoldSquare key value (pstricks), 252BoldTriangle key value (pstricks), 252Boolean keys, 311, 312border key (pstricks), 235, 239, 281, 346, 347bordercolor key (pstricks), 235, 239borders, 239bottom key value (pst-plot), 315, 320bounding boxes

creating, 220, 221shifting, 221–223tree nodes, 378

boxes, see also frames% (percent sign), comment character, 2773-D parallel projections, 404clipping, 274, 275, 276commands for, 271–273connection lines

drawing, 346, 347size, 353

diamond-shaped, 273double frame, 272equilateral triangle, 273framing, 270ignoring spaces, 277internal margins, 270isosceles triangle, 273keywords for, 270, 271math, 278, 279

ch-end.tex,v: 1.24 2007/06/15

Page 147: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 900 — #82

900 (B–C) PSTricks

boxes (cont.)oval-shaped, 273rotating, 276, 277scaling, 276, 277separation, 270shadows, 272simple, 271size, 270, 273, 274triangular frames, 271, 273verbatim, 278, 279

boxfill key value (pstricks), 253, 255, 257boxfill option (pst-fill), 383boxsep key (pstricks), 270, 273boxsize key (pst-node), 346, 347, 349, 353, 355Bpentagon key value (pstricks), 252br key value (pstricks), 267bracketlength key (pstricks), 260, 263, 265Bsquare key value (pstricks), 252Btriangle key value (pstricks), 252Bullet key value (pstricks), 252buttons, 3-D, 447B| key value (pstricks), 252

CC key value (pst-node), 362, 363C syntax (pstricks), 260, 261c key value (pst-node), 362c syntax (pstricks), 260, 261C-C key value (pstricks), 261c-c key value (pstricks), 261calc package, 323calendars, 452Cartesian coordinates, 224–226, 296cc syntax (pstricks), 260cc-cc key value (pstricks), 261ccurve key value (pst-plot), 332, 333, 334cells, matrices

empty cells, nodes for, 363names, 364spacing, 364

changeOrder key (pstricks-add), 422charts, see graphsCircle key value (pstricks), 252\Circle (tlgc), 255, 257circle key value (pst-node), 362, 363\circledipole (pst-circ), 435\circlenode (pst-node), 338, 363

circles3-D parallel projections, 405center, specifying, 241, 242degrees in, specifying, 218fills, 241keywords for, 247–249overview, 240sectors, 242

CircMultiply key value (tlgc), 250CircPlus key value (tlgc), 250circular

connection lines, 346nodes, 337, 338, 350

civil engineering analysis, 436\CLAUSE (rrgtrees), 425\clipbox (pstricks), 274, 275

clipping boxes, 274, 275, 276\closedshadow (pstricks), 289, 290\closepath (pstricks), 284closepath (PostScript), 284, 294closing paths, 284cm-> key value (tlgc), 264cm-cm key value (tlgc), 264cm-cp key value (tlgc), 264cmyk key (pst-lens), 452\Cnode (pst-node), 338, 350–352, 363, 365\cnode (pst-node), 273, 337, 338, 351, 353–361\cnodeput (pst-node), 338\code (pstricks), 234, 280, 292, 293–295, 305, 327coilaspect key (pst-coil), 455coilheight key (pst-coil), 455coils, 455coilwidth key (pst-coil), 455color

conflicts, resolving, 304fills, 255gradients, 448–450lines, 235overview, 216setting, 295

\color, 216color package, 215, 216, 235, 304colsep key (pst-node), 362, 363–365columns, matrices

combining, 362hooks, 362width, 365

comma key (pstricks-add), 418command summary, 459–466commands, 219, 220comment indicator, percent sign (%), 277commenting out grids, 230, 231components

basic packages, loading, 215, 216color, 216kernel, 214, 215

Comprehensive TEX Archive Network, see CTANconnections, see also lines, see also nodes

labelsabove the line, 357–359below the line, 357–359horizontal center, 359middle of line, 353, 354

ch-end.tex,v: 1.24 2007/06/15

Page 148: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 901 — #83

PSTricks (C–D) 901

connections (cont.)on specified segments, 355on the line, 357–359positioning, 357–359relative position, 356rotating, 354, 357short forms, 356vertical center, 359

package description (pst-node), 334, 335pst-coil, 455to node center, 347, 348to node edge

angle, 351arced box, 347Bézier curves, 345, 352box lines, 346, 347box size, 353circular lines, 346curved, 341, 351diagonal lines, 342, 343gradient angle, 351looped lines, 345, 352multiple per node, 360, 361parallel lines, 353railroad diagrams, 345segment arms, 352segmented line, 342, 344segments, counting, 355segments, maximum number of, 354separation from nodes, 350, 351straight line, 341

continuum spectra, 432convert program, 806\coor (pstricks), 293, 294

coordinates3-D, 2193-D parallel projections, rotating, 410angle specifications, 302axes, specifying, 401, 402calculating with PostScript, 296, 297, 298Cartesian, 296default, 219, 296determining, 296double, 298, 299overview, 223, 224plotting functions and data, 314polar, 296relative translations, 299, 300saving and restoring, 288, 305units, calculating, 421, 422

\CORE (rrgtrees), 425Corners key (pst-ob3d), 446CornersColor key (pst-ob3d), 446cornersize key (pstricks), 233, 235, 238, 239

\cput(pst-node), 338(pstricks), 269, 272

crosshatch key value (pstricks), 253, 255–257, 258crosshatch fills, 255crosshatch* key value (pstricks), 253, 255crossing lines, 239CTAN (Comprehensive TEX Archive Network)

archived files, finding and transferring, 813description, 810files, from the command line, 814TEX file catalogue, 811web access, 810, 811, 812, 813, 814

curly braces ({ }), 304curvature key

(pst-plot), 333(pstricks), 247, 248, 249

curve key value (pst-plot), 323, 332, 333curved line connections, 341, 351, 369, 376curves

arc separation, 247Bézier, 244, 245, 291coordinates relative to current point, 292curvature control, 247gradients, 248, 249keywords for, 247–249mathematical plots, closing, 333overview, 240parabolas, 245pen behavior, 240points, displaying, 237smooth

Bézier curves, 244, 245overview, 244through a list of points, 245, 246

\curveto (pstricks), 291, 292curveto (PostScript), 291, 295cyan key value (pstricks), 216\CylindreThreeD (pst-vue3d), 445

DD key value (pstricks), 270, 271d key value (pstricks), 269darkgray key value (pstricks), 216, 235dash key (pstricks), 235, 236, 300dashed key value (pstricks), 220, 221, 235, 236, 240, 281, 300, 302dashed lines, 235, 240\dashedV (tlgc), 280

dashes, 236\Data (tlgc), 328dataError.dat file (tlgc), 328, 329\dataplot (pst-plot), 323, 325\dataplotThreeD (pst-3dplot), 409deceased key (pst-pdgr), 431Decran key (pst-vue3d), 445

ch-end.tex,v: 1.24 2007/06/15

Page 149: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 902 — #84

902 (D–E) PSTricks

\def, 328\define@boolkey (pst-xkey), 311\define@key (pst-xkey), 311, 312\definecolor (color), 235, 258, 259\definecolorseries (xcolor), 459\defineTColor (pstricks-add), 257\DefList (pst-asr), 424\degrees (pstricks), 218, 219, 296, 297

degrees, specifying for circles, 218dia key value (pst-node), 362, 363diagonal connections, 342, 343, 377diagrams

ER, 442–445graphs

rotating, 327within text, 439–442

UML, 442–445Diamond key value (pstricks), 252diamond key value (pstricks), 252diamond* key value (pstricks), 252diamond-shaped boxes, 273, 339diamonds, 233\dianode (pst-node), 339, 363

differential equations, plotting, 424\dim (pstricks), 292, 293dimen key

(pst-node), 344(pstricks), 235, 237

dimension keys, 312dimension scale, changing, 411\diode (pst-circ), 435dirA key (pst-jtree), 425displaymath env. (pst-pdf), 800displaymath option (pst-pdf), 800\displaystyle (tex), 278\Distillation (pst-labo), 433dIter key (pst-fractal), 456, 457dl key value (pstricks), 269\DoCoordinate (tlgc), 329

documentation, see also online resourcescommand-line interface, 815panel interface, 816search by name, 815search by product, 816texdoc, 815texdock, 816

\dolinks (rrgtrees), 425\DontKillGlue (pstricks), 223, 303dot key value (pst-node), 362, 363dotangle key (pstricks), 251, 252dotGrid key value (tlgc), 228, 229\dotnode (pst-node), 339, 340, 363

dotsas nodes, 340defining, 250, 251

dots (cont.)definition, 249, 250keywords for, 251pre-defined styles, 251rotating coordinates, 252size, 251

dots key value (pst-plot), 332, 333dotscale key (pstricks), 236, 238, 251, 252, 298, 300, 302, 340dotsep key (pstricks), 235, 236dotsize key (pstricks), 236, 238, 250–252, 340dotstyle key (pstricks), 249, 250–252, 298, 340dotted key value (pstricks), 221, 235, 236, 240, 281, 300dotted lines, 235, 236, 240, 402double coordinates, 298, 299double frame boxes, 272double lines, 236doublecolor key (pstricks), 235, 236, 241doubleline key (pstricks), 235, 236, 238, 269, 281doublesep key (pstricks), 235, 236, 241dr key value (pstricks), 269draft option (pst-pdf), 800drawCoor key (pst-3dplot), 402–404, 411\drawedge (gastex), 439drawing key (pst-3dplot), 410, 411\drawloop (gastex), 439drawStyle key (pst-3dplot), 410, 414, 415, 416duplicate macro names, 458dvipdfm program, 797, 798, 803dvipdfmx program, 797–799, 803, 804, 806dvips program, 305, 306, 797–801, 803–806Dx key (pst-plot), 224, 315, 317, 318, 324, 325dx key (pst-plot), 315, 317, 318, 319, 324, 325Dy key (pst-plot), 315, 317, 318dy key (pst-plot), 315, 317, 318, 319

Eecurve key value (pst-plot), 332, 333, 334ED (PostScript), 365\edef (tex), 304edge key (pst-tree), 370, 376, 377\EdgeL (vaucanson-g), 440

edges, 3-D parallel projections, 412electrical circuits, pst-circ package, 435element key (pst-spectra), 432ellipses

3-D parallel projections, 405arcs, 243drawing, 243keywords for, 247–249overview, 240sectors, 243, 244

embedangle key (pst-3d), 395, 399emission spectra, 432emnode key (pst-node), 362, 363\empty, 380

ch-end.tex,v: 1.24 2007/06/15

Page 150: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 903 — #85

PSTricks (E–F) 903

\end@ClosedObj (pstricks), 307\end@OpenObj (pstricks), 307\end@SpecialObj (pstricks), 307endAngle key (pst-3dplot), 405, 410, 412, 416endX key (makeplot), 430endY key (makeplot), 430\entity (pst-dbicons), 445.eps file extension (pst-eps), 457

epstopdf program, 804, 806eqnarray env. (pst-pdf), 800equation env. (pst-pdf), 800equilateral triangle boxes, 273ER diagrams, 442–445error margins, mathematical plots, 329error messages, mathematical plots, 330Euclidean geometry, 426\everypsbox (pstricks), 278, 359

extensions, lines, 234

Ff key value (pst-node), 362, 363\FanEnd (rrgtrees), 425

fanned tree nodes, 369fansize key (pst-tree), 370FAQs (Frequently Asked Questions), 809, see also online

resources\fbox, 270, 272\fboxrule rigid length, 272\fboxsep rigid length, 270, 272female key (pst-pdgr), 431\file (pstricks), 280, 294\fileplot (pst-plot), 323, 324, 325\fileplotThreeD (pst-3dplot), 408, 409

files, inserting, 294\fill (pstricks), 285, 286fill (PostScript), 285fillangle key (pst-fill), 384fillcolor key (pstricks), 220, 233, 253, 254–256, 285, 289, 338,

392fillcycle key (pst-fill), 384, 385fillcyclex key (pst-fill), 384, 385, 387fillcycley key (pst-fill), 384, 385fillloopadd key (pst-fill), 383, 384, 386, 387fillloopaddx key (pst-fill), 384, 386fillloopaddy key (pst-fill), 384, 386fillmove key (pst-fill), 384, 385fillmovex key (pst-fill), 384, 385, 386fillmovey key (pst-fill), 384, 385, 386filloopadd key (pst-fill), 386fills, see also tiling

automatic vs. manual, 383, 386circles, 241color, 255complex patterns, 386creating your own, 257

fills (cont.)crosshatch, 255debugging, 387horizontal lines, 254keywords for, 253, 383–387line color, 257line distance, 256line gradient, 257line width, 256overview, 253package description (pst-fill), 383paths, 285rotating patterns, 384row/column shifting, 385simple patterns, 383solid, 254standard styles for, 253tile separation, 384vertical lines, 254whitespace, 256with graphics, 387with objects, 255without marginal lines, 286

fillsep key (pst-fill), 384fillsepx key (pst-fill), 384, 385fillsepy key (pst-fill), 384, 385fillsize key (pst-fill), 384, 386fillstyle key

(pst-fill), 383–387(pstricks), 220, 233, 253, 254–257, 279, 281, 284, 285, 289,

392, 448, 449, 451final option (pst-pdf), 800finite state diagrams, 438–442floating point number keys, 312Flower key value (tlgc), 250\fmark (gastex), 439\fnode (pst-node), 340, 350, 363\focalPoint (tlgc), 310, 311

four corner node definition, 336fp package, 458fractals, 456, 457frame key value (pst-plot), 314–316framearc key (pstricks), 233, 235, 238, 239, 258, 271, 272FrameBoxThreeDColorHSB key (pst-fr3d), 447FrameBoxThreeDOn key (pst-fr3d), 447frames, see also boxes

3-D objects, 447boxes, 270nodes, 340, 350rounded corners, 238, 239

framesep key (pstricks), 270, 271, 272framesize key (pst-node), 340, 349, 350\FrameThreeD (pst-vue3d), 445\FRectangle (tlgc), 383

Frequently Asked Questions (FAQs), see online resources

ch-end.tex,v: 1.24 2007/06/15

Page 151: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 904 — #86

904 (F–I) PSTricks

\FSquare (tlgc), 383full key value (pst-plot), 315, 320\func (tlgc), 406

Ggangle key (pstricks), 233, 235gastex package, 438, 439geographical representations, 438geometric objects, 3-D, 445, 446geometry

Apollonius circles, 456fractals, 456, 457Koch flake, 456Mandelbrot set, 456Phyllotaxis, 457Sierpinski triangle, 456

ghostscript program, 330, 798ghostview program, 804glue, 303gnuplot program, 330gradient angle connections, 351gradients

color, 448–450curves, 248, 249

graphics package, 277graphicx package, 800graphs, see also diagrams, see also plotting

rotating, 327within text, 439–442

gray key value (pstricks), 216green key value (pstricks), 216, 241\grestore (pstricks), 285, 286, 288, 290grestore (PostScript), 276, 284, 285, 286, 305, 306gridcolor key

(pst-gr3d), 447(pstricks), 226, 227, 228

griddots key(pst-plot), 332(pstricks), 226, 227, 228

gridlabelcolor key (pstricks), 227gridlabels key (pstricks), 227, 228, 394grids

3-D, 447Cartesian coordinate system, 224–226commands, defining new, 228commenting out, 230, 231creating, 225embellishing pictures, 229, 230highlighting, 226labels

font size, 227positioning, 225, 226

linescolor, specifying, 226, 227dotted, 226, 227

grids (cont.)width, specifying, 226

overview, 224–226subdivisions

creating, 227, 228line color, 228line width, 228

gridstyle key value (pstricks), 222GridThreeDNodes key (pst-gr3d), 447GridThreeDXPos key (pst-gr3d), 447GridThreeDYPos key (pst-gr3d), 447gridwidth key (pstricks), 226, 227, 228\gsave (pstricks), 285, 286, 288, 290gsave (PostScript), 276, 284, 285, 286, 305, 306

HHénon attractor, 326, 327hatchangle key (pstricks), 253, 254, 255–257hatchcolor key (pstricks), 253, 255, 256, 257, 279, 285hatchsep key (pstricks), 253, 256, 279hatchsepinc key (pstricks), 253, 256hatchwidth key (pstricks), 253, 255, 256, 279, 285hatchwidthinc key (pstricks), 253, 255, 256\hbox (tex), 270

header files, 302, 303help, see online resourcesHexagon key value (pstricks), 252hexagons, 308, 309hidden lines

3-D, 445algorithms, 414drawing, 415, 416

hidden surfaces, 3-D, 445hiddenLine key (pst-3dplot), 406, 410, 411, 414hiding/showing tick marks, 316high level macros, 309, 310highlighting grids, 226hlines key value (pstricks), 253, 254, 255, 256, 257, 281hlines* key value (pstricks), 253, 254, 255hooklength key (pstricks-add), 418hookwidth key (pstricks-add), 418horizontal lines, fills, 254How To Ask Questions The Smart Way, 810href key (pst-node), 348, 349HRInner key (tlgc), 308, 309\ht (tex), 229–231

hyperlinks, slides, 797–818hyperref package, 798, 803–805

Iiangle key (gastex), 439\IBox (tlgc), 229–231\ifcase, 322

ifthen package, 323

ch-end.tex,v: 1.24 2007/06/15

Page 152: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 905 — #87

PSTricks (I–L) 905

illustrations, see picturesimages, see pictures\imark (gastex), 439inactive option (pst-pdf), 800infix (algebraic) notation, 429, 430infix-RPN package, 430\infixtoRPN (pst-infixplot), 430

information theory, 439–442\Initial (vaucanson-g), 440inner key value (pstricks), 237\input (tex), 214

integer keys, 312intensitycolor key (pst-circ), 435intensitylabelcolor key (pst-circ), 435intensitywidth key (pst-circ), 435invisibleLineStyle key (pst-3dplot), 410, 415isosceles triangle boxes, 273isosceles triangles, 233

J\jobname (pst-tree), 376.jpeg file extension (pst-pdf), 806\jtlong (pst-jtree), 425\jtree (pst-jtree), 425

Kkey key (pst-dbicons), 445key/value interface

Boolean keys, 311, 312defining commands with, 310–312defining new keywords, 311dimension keys, 312floating point number keys, 312integer keys, 312low-level declaration, 310–312real number keys, 312string keys, 312

key/value specification, 217keyval package, 217keywords

3-D parallel projectionsaxes labels, moving, renaming, 413circular arcs, 412coordinate system rotation, 410dimension scale, changing, 411drawing style, 414, 415edge appearance, 412elliptical arcs, 412hidden lines, drawing, 415, 416list of, 410plane, specifying, 413plot points, 411positioning the origin, 414spherical coordinates, 416

keywords (cont.)suppressing coordinate axes, 411

3-D representation, 395arrows, 260–264, 418boxes, 270, 271circles, 247–249curves, 247–249dots, 251ellipses, 247–249fills, 253, 383–387lines, 234nodes, 370–378polygons, 234pspicture environment, 221–223PSTricks, summary, 459–466symbols, 251trees, 370–378

\KillGlue (pstricks), 223, 303Koch flake, 456

LL key value (pstricks), 270, 271l key value

(pst-node), 362(pst-tree), 380(pstricks), 269

lab apparatus, 433labels

3-D parallel projection axes, moving, 413centering on objects, 269commands for, 267connections

above the line, 357–359below the line, 357–359horizontal center, 359middle of line, 353, 354on specified segments, 355on the line, 357–359positioning, 357–359relative position, 356rotating, 354, 357short forms, 356vertical center, 359

coordinate axes, 268directions, short forms, 238grids

font size (labels), 227positioning, 225, 226

overwriting, 267plots

axis origin, 316axis, specifying, 318fonts (labels), 318hiding, 316omitting, 319

ch-end.tex,v: 1.24 2007/06/15

Page 153: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 906 — #88

906 (L) PSTricks

labels (cont.)origin, hiding, 319placing, 315point of origin, 316spacing, 317symbols as, 322, 323text as, 322, 323

points in a graphic, 268reference points, 266rotation angle, 266tree nodes

aligning, 379, 381, 382creating, 379examples of, 380positioning, 378separation, 381

labels key (pst-plot), 315, 318, 319–322labelsep key (pstricks), 240, 265, 268, 314, 315, 318, 345, 357latex program, 797, 800, 801, 803, 804, 806LATEX files, obtaining

web access, 810, 811, 812, 813, 814lB key value (pstricks), 267lb key value (pstricks), 229, 231, 267length

arrows, 262ticks, 321units

converting to TEX, 293setting and changing, 217

\lens (pst-optic), 434lenses, 434lensGlass key (pst-optic), 434LensMagnification key (pst-lens), 452lensScale key (pst-optic), 434levelsep key (pst-tree), 370, 372, 373, 374, 375–377, 382liftpen key (pstricks), 235, 240, 282, 283, 286–288light effects, 3-D, 447lightgray key value (pstricks), 216, 223LightThreeDColorPsCommand key (pst-light3d), 447line key value (pst-plot), 323, 332, 333lineAngle key (pstricks-add), 418linear rays, 434linearc key (pstricks), 232, 235, 238–240, 343, 345, 352, 355,

360lineColor key (pst-3dplot), 402linecolor key

(pst-node), 346, 347(pstricks), 219, 231–234, 235, 236, 239, 241, 281, 283, 285,

296, 298linejoin key (pst-3dplot), 234, 410, 412lines, see also connections, see also paths

3-D parallel projections, 402bending, 238borders, 239

lines (cont.)color

fills, 257grid subdivisions, 228user defined, 235

crossing, 239custom styles, 282, 283, 285–291double, 236drawing, 231, 232end markings, 237, 238extensions, 234fills, distance, 256from current point, 285–291gradient fills, 257grids

color, specifying, 226, 227dotted, 226, 227width, specifying, 226

hidden line algorithm, 414hidden, drawing, 415, 416keywords for, 234mathematical plots, customized, 328positioning, 237styles

custom, 282, 283, 285–291dashed, 235, 236, 240dotted, 235, 236, 240, 402fills, 256grid subdivisions, 228solid, 235width, 228, 256

width, 228, 234, 256zigzag, 455

lines key value (pst-plot), 330linestyle key (pstricks), 220, 235, 236, 276, 285, 315, 316, 332\lineto (pstricks), 291lineto (PostScript), 291, 294linetype key (pstricks), 235, 240linewidth key (pstricks), 220, 230, 232, 234, 235, 236, 239, 241,

248, 249, 251, 259, 261, 262, 268, 269, 281, 285linguistics, 424, 425Lissajou figures, 332\listplot

(pst-plot), 323, 325, 326, 327(pstricks-add), 421

\listplotThreeD (pst-3dplot), 409\loop (pstricks-add), 422

looped connection lines, 345, 352looping, 422\LoopL (vaucanson-g), 440\LoopN (vaucanson-g), 440\LoopS (vaucanson-g), 440loopsize key (pst-node), 344, 345, 349, 352loose key (pst-tree), 373low level macros, 307–309

ch-end.tex,v: 1.24 2007/06/15

Page 154: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 907 — #89

PSTricks (L–N) 907

lozenges, horizontal, 233LR (restricted horizontal Left-Right) mode, 269lrbox env., 276

Mmacros

assigned to tree node edges, 377duplicate names, 458high level, 309, 310low level, 307–309special, 303–307

magenta key value (pstricks), 216, 235, 279magnifying glass effect, 452\makeatletter, 264, 365\makeatother, 264, 365\makebox, 337

makeindex program, 806makeplot env. (makeplot), 430makeplot package, 430male key (pst-pdgr), 431Mandel key value (pst-fractal), 456Mandelbrot set, 456mapCountry key (pst-geo), 438maps, 438markZeros key (pst-func), 427math boxes, 278, 279mathematical plots

adding values to data points, 327curves, closing, 333customized lines, 328data delimiters, 324data file, size limits, 325error margins, 329error messages, 330external data, 324functions, 332Hénon attractor, 326, 327Lissajou figures, 332loading data records, 328maximum upper/lower deviations, 328package description (pst-plot), 323, 324, 325, 326plot points, 334plot style, 332, 333, 334printing, 330relative mean power values, 331rotating a graph, 327RPN (Reverse Polish Notation), 329saving data records, 328stack system, 329symbols in data files, 324tab characters, 324third degree parabola with inverse function, 331watermarks, 326

mathematicsdrawing polygons, 431Euclidean geometry, 426infix (algebraic) notation, 429, 430plotting matlab files, 430plotting special functions, 427Poisson distribution, 427PostScript extensions, 428RPN (Reverse Polish Notation), 430

\mathrm, 361matlab files, plotting, 430matrices

nodescell names, 364cell spacing, 364column width, 365combining columns, 362empty cells, nodes for, 363node type, defining, 363overview, 361positioning, 364row spacing, 364row/column hooks, 362

plotting, 422mcol key (pst-node), 362, 364medical pedigrees, 431middle key value (pstricks), 237minipage env., 393mirrors, 434mnode key (pst-node), 362, 363, 364mnodesize key (pst-node), 362, 364, 365Moiré effect, 258monohedral tiling, 383Month key (pst-calendar), 452\movepath (pstricks), 290\moveto (pstricks), 283, 284, 291, 292moveto (PostScript), 283, 294\mrestore (pstricks), 288\msave (pstricks), 288Mul key value (pstricks), 252\multidipole (pst-circ), 435\multido (multido), 236, 258, 296, 458, 459

multido package, 216, 458, 459\multips (pstricks), 269, 298\multirput

(pst-fill), 383(pstricks), 267, 268, 269

mv key (pst-dbicons), 445\myCoil (tlgc), 269\myGrid (tlgc), 229

N\n? put (pst-tree), 380nab key value (pst-node), 349, 355nAdjust key (gastex), 439

ch-end.tex,v: 1.24 2007/06/15

Page 155: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 908 — #90

908 (N) PSTricks

nAdjustdist key (gastex), 439name key (pst-node), 361, 362, 363, 364nameX key (pst-3dplot), 410, 413nameY key (pst-3dplot), 410, 413nameZ key (pst-3dplot), 410, 413naming nodes, 335\naput (pst-node), 343, 356, 357, 358nArrow key (pstricks-add), 418\nbput (pst-node), 345, 355, 356, 357, 358\nc???? (pst-node), 340\ncangle (pst-node), 343, 344, 351, 355\ncangles (pst-node), 344\ncarc (pst-node), 273, 337, 341, 350, 351, 355\ncarcbox (pst-node), 346, 347, 353, 355\ncbar (pst-node), 343, 352, 355, 360, 377, 378\ncbox (pst-node), 346, 353, 355\nccarcbox (pst-node), 346\nccircle (pst-node), 345, 346, 355\nccurve (pst-node), 338, 345, 351, 352, 355, 360, 361nccurve key (pst-node), 338\ncdiag

(pst-node), 341, 342, 343, 355(pstricks-add), 418

\ncdiagg (pst-node), 342, 343, 355, 377\ncline (pst-node), 230, 231, 335, 336, 338–340, 341, 342, 345,

349–351, 353–359, 362–365, 370, 374\ncloop (pst-node), 344, 345, 352, 354, 355\ncput (pst-node), 230, 231, 344, 345, 353–356, 357, 358, 359, 374\ncputicon (pst-uml), 442\ncSE (pst-uml), 442\ncSXE (pst-uml), 442ncurv key (pst-node), 345, 349, 352ncurvA key (pst-node), 349, 352ncurvB key (pst-node), 349, 352nEnd key (pstricks-add), 418nesting nodes, 335\newcommand, 228\newif, 311\newpath (pstricks), 284newpath (PostScript), 284\newpsfontdot (pstricks), 250, 251\newpsobject (pstricks), 228, 280\newpsstyle (pstricks), 222, 228, 279, 280\newpssytle (pst-3dplot), 414

news groups, 810, see also online resources\newtier (pst-asr), 424

nil tree nodes, 368Nmarks key (gastex), 439Nmr key (gastex), 439\node (gastex), 439nodealign key (pst-node), 362, 364\nodeBetween (tlgc), 337

nodescenter, determining, 335, 336center, moving, 348, 349

nodes (cont.)circular, 337, 338, 350connections, 455connector separation, 350, 351defined radius, 337diamond shaped, 339dots, 340four corner definition, 336frames, 340, 350in a matrix

cell names, 364cell spacing, 364column width, 365combining columns, 362empty cells, nodes for, 363node type, defining, 363overview, 361positioning, 364row spacing, 364row/column hooks, 362

in running text, 337multiple connections, 360, 361naming, 335nesting nodes, 335oval shaped, 339placing, 335plotting curves, 336positioning, 336, 337, 361radius, setting, 338simple, 335symbol size, 340trees

blank spaces, inserting, 369bounding boxes, 378command names, 367curved connectors, 369, 376diagonal connectors, 377distance between, 372–376fanned, 369keywords for, 370–378level separation, 375, 376macros, assigned to edges, 377nil, 368order, changing, 371predecessors, 367–369reference points, setting, 368reserving space for, 368sets of branches, combining, 370successors, 367–369tree direction, specifying, 371types, 367

trees, labelsalignment, 379, 381, 382creating, 379examples of, 380

ch-end.tex,v: 1.24 2007/06/15

Page 156: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 909 — #91

PSTricks (N–P) 909

nodes (cont.)positioning, 378separation, 381

triangular, 339nodesep key (pst-node), 251, 297, 299, 300, 335, 336, 340, 341,

343, 346, 348, 349, 350, 351, 353–356, 359, 360,362–364, 368, 374

nodesepA key (pst-node), 349, 350, 360nodesepB key (pst-node), 349, 350, 360, 368, 374, 377nodeWidth key (pst-geo), 438none key value

(pst-node), 349, 355, 362, 363(pst-plot), 314, 315, 316, 318, 319(pstricks), 220, 235, 236, 253, 276, 289, 290

nopstricks option (pst-pdf), 800normal key (pst-3d), 395, 397normal vector direction, 3-D, 397–399\NormalCoor (pstricks), 219, 296normaleLatitude key (pst-vue3d), 445normaleLongitude key (pst-vue3d), 445notightpage option (pst-pdf), 800noxcolor option (pstricks), 215, 216npos key (pst-node), 344, 345, 349, 354, 357, 358, 442\nput (pst-node), 344, 357, 359nrot key (pst-node), 344, 345, 349, 354, 358, 442nStart key (pstricks-add), 418nStep key (pstricks-add), 418\NUC (rrgtrees), 425Nw key (gastex), 439

Oo key value (pstricks), 251, 252o-o key value (pstricks), 261object types, 307objects, as fills, 255offset key (pst-node), 297, 299, 300, 349, 353, 354, 355, 360offsetA key (pst-node), 349, 353, 360offsetB key (pst-node), 349, 353, 360online access to CTAN, 810, 811, 812, 813, 814online resources

archived files, finding and transferring, 813CTAN (Comprehensive TEX Archive Network), 810

web access, 810, 811, 812, 813, 814documentation

command-line interface, 815panel interface, 816search by name, 815search by product, 816texdoc, 815texdock, 816

FAQs (Frequently Asked Questions), 809files, getting from the command line, 814How To Ask Questions The Smart Way, 810news groups, 810

online resources (cont.)program files, obtaining

web access, 810, 811, 812, 813, 814TEX file catalogue, 811TEX files, 810TEX user groups, 817, 818TUG home page, 810, 811

onset key (pst-asr), 424oo-oo key value (pstricks), 261\openshadow (pstricks), 289, 290operation key (pst-osci), 434Oplus key value (pstricks), 252oplus key value (pstricks), 252\OPR (rrgtrees), 425

optical systems, 434origin key

(pst-3dplot), 410(pstricks), 223, 224, 281

origin (3-D), positioning, 414origin of ordinates, translating, 286oscilloscope channels, 434Otimes key value (pstricks), 252otimes key value (pstricks), 252outer key value (pstricks), 235, 237oval key value (pst-node), 362, 363oval-shaped boxes, 273, 339\ovalnode (pst-node), 339, 342, 345, 348, 352, 353, 363Ox key (pst-plot), 315, 316Oy key (pst-plot), 315, 316, 317

Pp key value (pst-node), 362, 363\parabola (pstricks), 224, 245

parabolas, 245parallel connection lines, 353\parametricplot (pst-plot), 330, 332\parametricplotThreeD (pst-3dplot), 405, 407, 408\parbox, 272, 389, 393

paths, see also linesclosing, 284creating, 284deleting, 284filling, 285moving, 290stroke, 284, 285

\pc???? (pst-node), 348\pcangle (pst-node), 348\pcangles (pst-node), 348\pcarc (pst-node), 348\pcarcbox (pst-node), 348, 353\pcbar (pst-node), 348\pcbox (pst-node), 348\pccurve (pst-node), 348, 360

ch-end.tex,v: 1.24 2007/06/15

Page 157: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 910 — #92

910 (P) PSTricks

\pcdiag(pst-node), 348(pstricks-add), 418

\pcdiagg (pst-node), 348\pcline (pst-node), 251, 348\pcloop (pst-node), 348.pdf file extension (pst-pdf), 806

PDF files, 458pdfcrop program, 804pdfinfo program, 804pdflatex program, 457, 458, 797, 800, 801, 803, 805, 806PDFs

creatingdvipdfm program, 798–800dvipdfmx program, 798–800from LATEX, 803–807from PostScript, 800, 801, 802, 803overview, 797pst-pdf package, 800, 801, 802, 803

pdftex program, 797, 798pdftops program, 806pen behavior, 240Pentagon key value (pstricks), 252pentagon key value (pstricks), 252pentagon* key value (pstricks), 252percent sign (%), comment indicator, 277period1 key (pst-osci), 434perspective projection, see tiltingphB key (pst-asr), 424PHI key (pst-vue3d), 445Phyllotaxis, 457picture env., 223, 303, 797pictures, embellishing with grids, 229, 230placement, see positioningplain option (pstricks), 215plane key (pst-3dplot), 410, 413, 414plot points, 3-D parallel projections, 411plotpoints key (pst-plot), 224, 330, 332, 334, 405, 406plotstyle key (pst-plot), 224, 323, 324–327, 330–334, 411plotting, see also graphs

coordinate system, 314coordinate units, calculating, 421, 422differential equations, 424labels

axis origin, 316axis, specifying, 318fonts, 318hiding, 316omitting, 319origin, hiding, 319placing, 315point of origin, 316spacing, 317symbols as, 322, 323text as, 322, 323

plotting (cont.)looping, 422mathematical plots

3-D parallel projections, 407–409adding values to data points, 327curves, closing, 333customized lines, 328data delimiters, 324data file, size limits, 325error margins, 329error messages, 330external data, 324functions, 332Hénon attractor, 326, 327Lissajou figures, 332loading data records, 328maximum upper/lower deviations, 328package description (pst-plot), 323, 324, 325, 326plot points, 334plot style, 332, 333, 334printing, 330relative mean power values, 331rotating a graph, 327RPN (Reverse Polish Notation), 329saving data records, 328stack system, 329symbols in data files, 324tab characters, 324third degree parabola with inverse function, 331watermarks, 326

matlab files, 430matrices, 422package description, 313special functions, 427step functions, 423ticks

axes, specifying, 319axis origin, 316hiding, 316length, 321point of origin, 316position, 321size, 322style, 320, 321

.png file extension (pst-pdf), 806\pnode (pst-node), 230, 231, 299, 300, 310, 336, 337, 363, 436

pointscurrent, moving, 283curves, displaying, 237displaying, 237, 238

Poisson distribution, 427polar coordinates, 296polarplot key (pst-func), 427polygon key value (pst-plot), 332, 333

ch-end.tex,v: 1.24 2007/06/15

Page 158: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 911 — #93

PSTricks (P) 911

polygons, see also pecific polygonsdrawing, 232, 431keywords for, 234

PolyNbSides key (pst-poly), 431pOrigin key (pst-3dplot), 414PosAngle key (pst-eucl), 426positioning

labelsconnections, 357–359tree nodes, 378

lines, 237nodes, 336, 337, 361

PostScript% (percent sign), comment character, 265code, in PostScript output, 292, 305, 306, 307coordinates, converting to TEX, 293, 294mathematical extensions, 428PDFs from, 800, 801, 802, 803sending information to TEX, 365, 366stack state, saving, 286

postscript env. (pst-pdf), 802predecessor tree nodes, 367–369preview package, 458, 800–802\PreviewEnvironment (pst-pdf), 801

printing plots, 330printValue key (pst-func), 427.pro file extension (pstricks), 302

program files, obtainingweb access, 810, 811, 812, 813, 814

\protect (pst-node), 335, 337ps2pdf program, 797, 801–806ps2pdf13 program, 804, 805\psaddtolength (pstricks), 218\psAppolonius (pst-fractal), 456\psarc (pstricks), 241, 242, 247, 248, 281, 302, 344\psarcn (pstricks), 241, 242, 247, 281, 344\psArrowCivil (pst-stru), 436\psaxes

(pst-plot), 224, 266, 276, 314, 315–327, 329–334, 391, 392,459

(pstricks-add), 418\psbarchart (pst-bar), 450\psbarcode (pst-calendar), 453\psbarscale (pst-bar), 450\psbezier (pstricks), 244, 245, 282, 290, 291\psBinomialN (pst-func), 427\psboxfill (pst-fill), 255, 257, 383, 384–387\psCalDodecaeder (pst-calendar), 452\psCalendar (pst-calendar), 452\psccurve (pstricks), 246, 336\pscharpath (pst-text), 450\pscircle (pstricks), 234, 238, 241, 247, 255, 257, 259, 275, 308,

309\pscirclebox

(pst-node), 338

\pscirclebox (cont.)(pstricks), 269, 270, 272

\psclip (pstricks), 276psclip env. (pstricks), 259, 275, 276\psCoil (pst-coil), 455\pscolhook (pst-node), 362\pscolhook???? (pst-node), 362\pscurve (pstricks), 245, 246, 248, 249, 282, 283, 284\pscustom (pstricks), 234, 240, 276, 280, 281–290, 293, 294, 295,

305, 327, 436\psdblframebox (pstricks), 271, 272\psdiabox

(pst-node), 339(pstricks), 273

\psdiamond (pstricks), 233\psdot (pstricks), 236, 249, 250–252, 296, 298, 300, 302, 339\psdot* (pstricks), 252\psdots (pstricks), 249, 250, 282, 296\psecurve (pstricks), 246\psedge (pst-tree), 369, 376\psellipse (pstricks), 239, 243\psellipticarc (pstricks), 243\psellipticarcn (pstricks), 243\psellipticwedge (pstricks), 244\pserrorLine (tlgc), 329\psFArrow (pst-fractal), 456\psFern (pst-fractal), 456\psforeach (pstricks-add), 422\psFractal (pst-fractal), 456\psfractal (pst-fractal), 456\psframe (pstricks), 232, 233, 237, 238, 239, 267, 270, 303, 306,

340, 383, 393\psframebox (pstricks), 258, 270, 271, 272, 274, 278, 279, 352,

448, 449\psgraph (pstricks-add), 421psgraph env. (pstricks-add), 421\psgrid (pstricks), 225, 226, 227–230, 282, 324, 325, 331\psHexagon (tlgc), 307, 308, 309\pshlabel (pst-plot), 318, 322\psKochflake (pst-fractal), 456\pslabelsep rigid length (pstricks), 240\psLame (pst-func), 459\pslbrace (pstricks), 304\psline (pstricks), 218, 219, 231, 232, 234–236, 237, 238, 239,

247, 259–263, 268, 281–283, 291, 299, 300, 302, 365\psline* (pstricks), 220\pslinecolor (pstricks), 220\pslinewidth (pstricks), 235, 261, 263\psmathboxfalse (pstricks), 278\psmathboxtrue (pstricks), 278psmatrix env.

(pst-node), 361, 362–365(pst-pdf), 800

\psMatrixPlot (pstricks-add), 422\psovalbox (pstricks), 270, 272, 273, 339

ch-end.tex,v: 1.24 2007/06/15

Page 159: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 912 — #94

912 (P) PSTricks

\psPhyllotaxis (pst-fractal), 456, 457pspicture env.

(pst-pdf), 800(pstricks), 218, 220–223, 225, 229, 303, 457

pspicture environmentbounding boxes

creating, 220, 221shifting, 221–223

keywords for, 221–223missing values, determining, 221whitespace between commands, 223

pspicture* env. (pstricks), 220, 275\psPlot (pst-infixplot), 429\psplot (pst-plot), 224, 276, 283, 285–289, 306, 323, 330, 331,

333, 334, 428\psplotDiffEqn (pstricks-add), 423, 424\psplotImp (pst-func), 427\psplotThreeD (pst-3dplot), 406, 407, 411\pspolygon

(pst-plot), 320, 333(pstricks), 232, 237, 238, 248, 271, 310

\pspolygonbox (pst-poly), 431\pspred (pst-tree), 369, 376, 379\psPTree (pst-fractal), 456, 457\psrbrace (pstricks), 304\psrowhook (pst-node), 362\psrowhook???? (pst-node), 362\psrunit (pstricks), 218\psscalebox (pstricks), 277\psscaleboxto (pstricks), 277\psset (pstricks), 217, 218, 232, 259, 311, 418\pssetlength (pstricks), 218\psshadow (pst-3d), 388, 389\psshadowbox

(pst-tree), 378(pstricks), 272, 378

\psSier (pst-fractal), 456\psspan (pst-node), 361, 362\psspectrum (pst-spectra), 432\psStep (pstricks-add), 423\pssucc (pst-tree), 369, 376, 379

pst-3d package, 216, 388–400pst-3dplot package, 217, 234, 313, 388, 400–416pst-all package, 216, 313pst-asr package, 217, 424pst-bar package, 450pst-barcode package, 453pst-blur package, 449, 450pst-calendar package, 452pst-circ package, 309, 435pst-coil package, 216, 455, 456pst-dbicons package, 445pst-dots.pro file (pstricks), 250, 302pst-eps package, 216, 457pst-eucl package, 426

pst-fill package, 216, 255, 257, 383–387pst-fr3d package, 388, 447pst-fractal package, 456, 457pst-func package, 427pst-geo package, 437, 438pst-gr3d package, 388, 447pst-grad package, 216, 448pst-infixplot package, 429, 430pst-jtree package, 425pst-labo package, 433pst-lens package, 452pst-light3d package, 447pst-map2d package, 438pst-map2dII package, 438pst-map3d package, 438pst-map3dII package, 388, 438pst-math package, 224, 428, 429pst-node package, 214, 216, 313, 334–366, 379, 424pst-node.pro file (pstricks), 302pst-ob3d package, 388, 446pst-optic package, 434pst-osci package, 434pst-pdf package, 457, 458, 797, 800–803, 805, 806pst-pdgr package, 431pst-plot package, 214, 216, 266, 313–334, 400, 406, 424, 426pst-poly package, 431pst-slpe package, 449pst-spectra package, 432pst-stru package, 436pst-text package, 216, 451pst-tree package, 214, 216, 366–382, 424pst-uml package, 442, 443pst-view3d package, 400pst-vue3d package, 388, 393, 445pst-xkey package, 217, 310–312\pst@arrowtable (pstricks), 264\pst@checknum

(pst-xkey), 312(pstricks), 312

\pst@def (pstricks), 307\pst@getcoor (pstricks), 310\pst@getint

(pst-xkey), 312(pstricks), 312

\pst@getlength(pst-xkey), 312(pstricks), 312

\pst@object (pstricks), 253\pst@Verb (pstricks), 305\pst@object (pst-pdf), 800

pstcol package, 215PstDebug key (pst-fill), 384, 387\PstDie (pst-ob3d), 446\pstextpath (pst-text), 451\PstFrameBoxThreeD (pst-fr3d), 447

ch-end.tex,v: 1.24 2007/06/15

Page 160: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 913 — #95

PSTricks (P–R) 913

\PstGridThreeD (pst-gr3d), 447\pstheader (pstricks), 302, 303\psTilt (pst-3d), 389, 390, 391, 392\pstilt (pst-3d), 389, 390, 391, 392\psTilt{30}{\Bar} (pst-3d), 390\pstilt{30}{\Bar} (pst-3d), 390\pstInterLL (pst-eucl), 426\PstLens (pst-lens), 452\PstLightThreeDGraphic (pst-light3d), 447\PstLightThreeDText (pst-light3d), 447\pstPlanePut (pst-3dplot), 413–415\PstPolygonNode (pst-poly), 431\pstProjection (pst-eucl), 426psTree env. (pst-tree), 366\pstree (pst-tree), 366, 367–382\pstree,TC,Toval (pst-tree), 372\pstRelationship (pst-pdgr), 431\pstriangle (pstricks), 233\pstribox

(pst-node), 339(pstricks), 271, 273

pstricks option (pst-pdf), 800pstricks package, 213–466, 797, 800PSTricks packages, see 3-D parallel projections, see 3-D

representation, see specific packages, see arrows, seeconnections, see fills, see nodes, see plotting, seesciences, see trees

pstricks-add package, 224, 257, 318, 323, 418–424pstricks.pro file (pstricks), 302, 305, 307, 365pstricks.sty file (pstricks), 215pstricks.tex file (pstricks), 214, 215\PSTricksfalse (pstricks), 303\PSTricksOff (pstricks), 303\PSTricksOn (pstricks), 303\pstScalePoints (pstricks-add), 421\pstThreeDBox (pst-3dplot), 404, 415, 416\pstThreeDCircle (pst-3dplot), 405\pstThreeDCoor (pst-3dplot), 401, 402–416\pstThreeDDot (pst-3dplot), 402, 403–405, 411, 416\pstThreeDEllipse (pst-3dplot), 404, 405, 412, 416\pstThreeDLine (pst-3dplot), 402, 403\pstThreeDNode (pst-3dplot), 402\pstThreeDPut (pst-3dplot), 401, 402, 414\pstThreeDSphere (pst-3dplot), 405, 406\pstThreeDSquare (pst-3dplot), 403, 404\pstThreeDTriangle (pst-3dplot), 403, 412\PSTtoEPS (pst-eps), 457\pstTriangle (pst-eucl), 426\pstVerb (pstricks), 221, 224, 234, 303, 305, 306\pstverb (pstricks), 280, 303, 305, 306\pstverbscale (pstricks), 221, 305\psunit (pstricks), 218, 292\psverbboxfalse (pstricks), 279\psverbboxtrue (pstricks), 279\psvlabel (pst-plot), 318, 322

\pswedge (pstricks), 237, 242, 244\psxunit (pstricks), 218\psyunit (pstricks), 218, 222

Q\qdisk (pstricks), 224, 241, 268, 282\qline (pstricks), 232, 282

RR key value

(pst-node), 362, 363(pstricks), 270, 271

r key value(pst-node), 362, 363(pst-tree), 380(pstricks), 269

\radians (pstricks), 218, 219radius key

(pst-node), 338, 349, 350, 351, 352(pst-tree), 366, 369–374, 376, 379–382

railroad diagrams, 345\raisebox, 221rand (PostScript), 298RandomFaces key (pst-ob3d), 446rB key value (pstricks), 267rb key value

(pst-node), 353(pstricks), 267

rbracketlength key (pstricks), 260, 263rC key value (pstricks), 231\rcoor (pstricks), 294, 295\rcurveto (pstricks), 292rcurveto (PostScript), 292\readdata

(pst-3dplot), 409(pst-plot), 325, 328, 329

\readpsbardata (pst-bar), 450real number keys, 312rectangles

3-D parallel projections, 404horizontal, 232, 233

\red (pstricks), 216red key value (pstricks), 216ref key

(pst-node), 349, 353(pst-tree), 368

\reflectbox (graphics), 277refrigerantBoulles key (pst-labo), 433\relationshipbetween (pst-dbicons), 445relative key value (pstricks), 235, 239relative mean power values, 331\resetOptions (pstricks-add), 424

restricted horizontal Left-Right (LR) mode, 269\rlineto (pstricks), 291

ch-end.tex,v: 1.24 2007/06/15

Page 161: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 914 — #96

914 (R–S) PSTricks

rlineto (PostScript), 291, 294\Rnode (pst-node), 336, 348, 349, 359–361, 363\rnode

(pst-node), 299, 335, 336, 337, 341–348, 352, 353, 355, 360,363, 364

(pst-tree), 374–377rot key (pst-node), 349, 356, 357\rotate (pstricks), 287rotate (PostScript), 287\rotatebox (graphicx), 277, 397Rotatedown env. (pstricks), 277\rotatedown (pstricks), 276Rotateleft env. (pstricks), 277\rotateleft (pstricks), 276Rotateright env. (pstricks), 277\rotateright (pstricks), 276

rotating3-D objects, 397, 399boxes, 276, 277connection labels, 354, 357coordinate system, 410dot coordinates, 252fill patterns, 384graphs, 327objects, 287symbols, 252text, 392

rotating package, 392rows, matrices, 362, 364rowsep key (pst-node), 362, 364, 365\rPERIPH (rrgtrees), 425

RPN (Reverse Polish Notation), 329, 430\rput (pstricks), 229–231, 261, 266, 267, 268, 269, 271, 299, 331,

341, 342, 355, 368rrgtrees package, 424, 425\Rrnode (pst-node), 360runit key (pstricks), 218, 296

S\savedata (pst-plot), 328

savingcoordinates, 288, 305data records, 328PostScript stack state, 286

\sbox, 229\scale (pstricks), 287, 288scale (PostScript), 287Scalebox env. (pstricks), 277\scalebox (graphics), 277Scaleboxto env. (pstricks), 277\ScalePoints (pst-plot), 326

scalingboxes, 276, 277objects, 287

sciencesabsorption spectra, 432civil engineering analysis, 436continuum spectra, 432electrical circuits, 435emission spectra, 432geographical representations, 438lab apparatus, 433lenses, 434linear rays, 434maps, 438medical pedigrees, 431mirrors, 434optical systems, 434oscilloscope channels, 434

sectorscircles, 242ellipses, 243, 244

SegmentColor key (pst-3dplot), 406segmented connections

arms, 352counting, 355drawing, 342, 344maximum number of, 354

SegmentSymbol key (pst-eucl), 426setcmykcolor (PostScript), 298\setcolor (pstricks), 295setlinejoin (PostScript), 234, 294, 412setlinewidth (PostScript), 294sfg package, 442\sfgbranch (sfg), 442\sfgcurve (sfg), 442\sfgnode (sfg), 442\sfgtermnod (sfg), 442

shading2-D

as highlighting, 239, 240boxes, 272custom styles, 289packages, 388, 389

3-D, 394shadow key (pstricks), 233, 235, 239, 240, 272–274, 281, 303shadowangle key (pstricks), 233, 235, 239, 240, 289, 303shadowcolor key (pstricks), 233, 235, 239, 289, 303shadows

as highlighting, 239, 240boxes, 272custom styles, 289packages, 388, 389

shadowsize key (pstricks), 235, 239, 289, 290, 303shift key (pstricks), 221, 222shortput key (pst-node), 273, 349, 355, 356, 359showbbox key (pst-tree), 370showbox key (pst-tree), 378showFP key (tlgc), 311

ch-end.tex,v: 1.24 2007/06/15

Page 162: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 915 — #97

PSTricks (S) 915

showgrid key (pstricks), 222, 223showing, see hiding/showingshoworigin key (pst-plot), 315, 319, 323showpoints key (pstricks), 235, 237, 238, 243, 281, 323, 326,

327, 330, 331, 334, 405Sierpinski triangle, 456\skiplevel (pst-tree), 382\skiplevels (pst-tree), 382skiplevels env. (pst-tree), 382slanting, see tiltingslides (color), overlay specification

hyperlinks, 797–818smooth curves

Bézier curves, 244, 245overview, 244through a list of points, 245, 246

solid key value (pstricks), 220, 235, 236, 253, 255, 279, 283, 285solid fills, 254SolidAsterisk key value (pstricks), 252SolidDiamond key value (pstricks), 252SolidHexagon key value (pstricks), 252SolidOplus key value (pstricks), 252SolidOtimes key value (pstricks), 252SolidPentagon key value (pstricks), 252SolidSquare key value (pstricks), 252SolidTriangle key value (pstricks), 252space

as fill, 256between commands, 223ignoring/preserving, 277, 303inserting, 304

\space(pst-tree), 374(tex), 304

\special, 797(tex), 214, 280, 292, 302, 303, 304, 306

special.pro file, 305\SpecialCoor (pstricks), 219, 296, 298–300, 302, 310, 336, 337,

347, 348, 365SpericalCoor key (pst-3dplot), 410spheres, 3-D, 406spherical coordinates, 416SphericalCoor key (pst-3dplot), 411, 416spotX key (pst-3dplot), 410, 413spotY key (pst-3dplot), 410, 413spotZ key (pst-3dplot), 410, 413Square key value (pstricks), 252square key value (pstricks), 251, 252square* key value (pstricks), 252squares, 3-D parallel projections, 403stack system, 329startX key (makeplot), 430startY key (makeplot), 430\State (vaucanson-g), 440

step functions, 423

StepType key (pstricks-add), 423straight connection line, 341string keys, 312\stroke (pstricks), 284, 285stroke (PostScript), 284, 294stroke, paths, 284, 285style key

(pst-calendar), 452(pst-jtree), 425(pstricks), 229, 258, 279

styles3-D parallel projections, 414, 415arrows, 295, 418, 419, 420dots, 251fills, 253lines

custom, 282, 283, 285–291dashed, 235, 236, 240dotted, 235, 236, 240, 402fills, 256grid subdivisions, 228solid, 235width, 228, 256

mathematical plots, 332, 333, 334shadows, 289symbols, 251symbols, pre-defined, 251ticks, 320, 321user-defined

closed curves, concatenating, 281defining, 279, 280fills, 281lines, 281PostScript output, 280

subgridcolor key (pstricks), 227, 228subgriddiv key

(pst-plot), 332(pstricks), 227, 228

subgriddots key (pstricks), 227, 228subgridwidth key (pstricks), 226, 227, 228successor tree nodes, 367–369\swapaxes (pstricks), 287, 288swapaxes key (pstricks), 224, 232, 281swapping axes, 288syB key (pst-asr), 424symbols

defining, 250, 251definition, 249, 250in data files, 324keywords for, 251pre-defined styles, 251rotating, 252size, 251

ch-end.tex,v: 1.24 2007/06/15

Page 163: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 916 — #98

916 (T) PSTricks

Ttab key value (pst-node), 349, 355, 356tab characters, 324\tabcolsep rigid length, 272tablr key value (pst-node), 349, 355, 356tabular env., 272\taput (pst-node), 356, 358tbarsize key (pstricks), 260, 262, 263, 352\tbput (pst-node), 356, 358\TC (pst-tree), 366, 367, 369–371, 373, 374, 376, 378–382\Tc (pst-tree), 367, 378–382\TCircle (pst-tree), 367\Tcircle (pst-tree), 367, 371–373\Tdia (pst-tree), 367\Tdot (pst-tree), 367tensioncolor key (pst-circ), 435tensionlabelcolor key (pst-circ), 435tessellation, see tilingTEX

% (percent sign), comment character, 265getting information from PostScript, 365, 366

TEX file archives, 810, see also CTANTEX files, obtaining

web access, 810, 811, 812, 813, 814texdoc program, 815, 816texdoctk program, 815–817text

along a path, 451rotating, 392shapes, 448–450slanting, 392

\text (amsmath), 361\textcolor, 216\Tf (pst-tree), 367\Tfan (pst-tree), 368, 369, 370THETA key (pst-vue3d), 445third degree parabola with inverse function, 331thislevelsep key (pst-tree), 370, 374, 376, 379, 380thistreefit key (pst-tree), 370, 372, 373thistreenodesize key (pst-tree), 370, 373, 374thistreesep key (pst-tree), 370, 372, 379, 380\thput (pst-node), 358, 359

three dimensional, see 3-D\ThreeDput (pst-3d), 393, 394, 397, 399, 446

ticksaxes, specifying, 319axis origin, 316hiding, 316length, 321point of origin, 316position, 321size, 322style, 320, 321

ticks key (pst-plot), 315, 319, 320ticksize key (pst-plot), 315, 321, 322

tickstyle key (pst-plot), 315, 320, 321, 322tight key (pst-tree), 373tightpage option (pst-pdf), 800tiling, 383, see also fillstiling option (pst-fill), 383, 386tilting, 390–392\tlput (pst-node), 356, 358\Tn (pst-tree), 367, 368tndepth key (pst-tree), 380, 381tnheight key (pst-tree), 380, 381tnpos key (pst-tree), 380, 381tnsep key (pst-tree), 380, 381tnyref key (pst-tree), 380, 381, 382\TOP (rrgtrees), 425top key value (pst-plot), 315, 320\Toval (pst-tree), 366, 367, 369–380\Tp (pst-tree), 367tpos key

(pst-node), 349, 356(pst-tree), 378

\TR (pst-tree), 367, 368, 369, 374, 377\Tr (pst-tree), 367, 368, 374–377

transforms, see specific transforms\translate (pstricks), 286, 287–290translate (PostScript), 286transparency, 257, 258TransparentMagenta key value (tlgc), 279\transy (pst-calendar), 453treefit key (pst-tree), 370, 372treeflip key (pst-tree), 370, 371, 372treemode key (pst-tree), 367, 370, 371, 372, 374–377, 379, 380,

382treenodesize key (pst-tree), 367, 370, 373, 374trees

general syntax, 366nodes

blank spaces, inserting, 369bounding boxes, 378command names, 367curved connectors, 369, 376diagonal connectors, 377distance between, 372–376fanned, 369keywords for, 370–378level separation, 375, 376macros, assigned to edges, 377nil, 368order, changing, 371predecessors, 367, 369reference points, setting, 368reserving space for, 368sets of branches, combining, 370successors, 367–369tree direction, specifying, 371types, 367

ch-end.tex,v: 1.24 2007/06/15

Page 164: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 917 — #99

PSTricks (T–X) 917

trees (cont.)nodes, labels

aligning, 379alignment, 381, 382creating, 379examples of, 380positioning, 378separation, 381

skipping levels, 382treesep key (pst-tree), 369, 370, 372, 373, 380–382\Tri (pst-tree), 367tri key value (pst-node), 362, 363Triangle key value (pstricks), 252triangle key value (pstricks), 251, 252triangle* key value (pstricks), 252, 298triangles, 3-D parallel projections, 403triangular frames, 271, 273triangular nodes, 339trimode key

(pst-node), 339(pstricks), 270, 271, 273

\trinode (pst-node), 339, 363\trput (pst-node), 356, 358Tshadowangle key (pst-3d), 388, 389Tshadowcolor key (pst-3d), 388, 389, 390, 391Tshadowsize key (pst-3d), 388, 389\tspace (pst-tree), 369\Ttri (pst-tree), 367

TUG home page, 810, 811\tvput (pst-node), 358tx@NodeDict (PostScript), 365type key (pst-fractal), 456

UU key value (pstricks), 270, 271u key value (pstricks), 269ul key value (pstricks), 269uml package, 443UML diagrams, 442–445\umlArgument (uml), 443\umlAttribute (uml), 443\umlClass (pst-uml), 442\umlSchema (uml), 443\umlSubClass (uml), 443unit key (pstricks), 218, 262, 269\uput (pstricks), 224, 230, 231, 268, 300, 320, 331, 333ur key value (pstricks), 269\usebox, 229–231\usepackage, 215

Vvaucanson-g package, 439, 440VCPicture env. (vaucanson-g), 440\verb, 277, 279

verbatim env., 277verbatim boxes, 278, 279vertical lines as fills, 254view angle, 3-D objects, 397viewangle key (pst-3d), 395, 397, 399viewpoint key (pst-3d), 393, 394, 395, 396, 397, 398, 399viewpoint, 3-D objects, 395, 396, 397views (3-D), order of, 397visibleLineStyle key (pst-3dplot), 410, 415vlines key (pstricks), 392vlines key value (pstricks), 253, 254, 255, 256, 279, 281, 285vlines* key value (pstricks), 253, 254, 255vref key

(pst-node), 348, 349, 360(pst-tree), 381

\vspace (pst-tree), 366VTeX program, 365, 797

Wwatermarks, 326\wd (tex), 229–231

wget program, 814white key value (pstricks), 216, 235whitespace, see space\wire (pst-circ), 435\WORD (rrgtrees), 425\WorldMap (pst-geo), 438\write (tex), 304

writing objects into files, on the fly, 457

Xx key value

(pst-plot), 315, 318, 319(pstricks), 252

xAxisLabel key (pstricks-add), 421xAxisLabelPos key (pstricks-add), 421xbbd key (pst-tree), 370, 378xbbh key (pst-tree), 370, 378xbbl key (pst-tree), 370, 378xbbr key (pst-tree), 370, 378–380xcolor package, 215, 216, 235, 258, 304, 406xEnd key (pstricks-add), 418xetex program, 798, 803xgap key (pst-asr), 424xkeyval package, 217, 310xLines key value (pst-3dplot), 414xMax key (pst-3dplot), 401, 410, 411xMin key (pst-3dplot), 401, 410, 411Xnodesep key (pst-node), 297, 300, 349, 350, 351XnodesepA key (pst-node), 349, 350XnodesepB key (pst-node), 349xpdf program, 804xPlotPoints key (pst-3dplot), 407, 408xPlotpoints key (pst-3dplot), 406, 410, 411, 415

ch-end.tex,v: 1.24 2007/06/15

Page 165: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 918 — #100

918 (X–Z) PSTricks

xStart key (pstricks-add), 418xStep key (pstricks-add), 418xThreeDunit key (pst-3dplot), 410, 411xunit key (pstricks), 218, 224, 227, 296, 298, 323xWidth key (pst-fractal), 456xyAxes key (pstricks-add), 418xyDecimals key (pstricks-add), 418xyLines key value (pst-3dplot), 414

Yy key (pst-plot), 319y key value (pst-plot), 315, 318, 319yAxisLabel key (pstricks-add), 421yAxisLabelPos key (pstricks-add), 421Year key (pst-calendar), 452yellow key value (pstricks), 216yEnd key (pstricks-add), 418yLines key value (pst-3dplot), 414

yMax key (pst-3dplot), 401, 410, 411yMin key (pst-3dplot), 401, 410, 411Ynodesep key (pst-node), 297, 300, 349, 350, 351, 361YnodesepA key (pst-node), 349, 361YnodesepB key (pst-node), 349yPlotpoints key (pst-3dplot), 406, 407, 410, 411, 415yStart key (pstricks-add), 418yThreeDunit key (pst-3dplot), 410, 411yunit key (pstricks), 218, 224, 227, 296, 298, 306ywidth key (pst-fractal), 456yxLines key value (pst-3dplot), 414

Zzigzag lines, 455zlib program, 799zMax key (pst-3dplot), 401, 410, 411zMin key (pst-3dplot), 401, 410, 411zThreeDunit key (pst-3dplot), 410, 411

1

3 2

5

4

6

7

8

9������������

��������

������������

��

������

������������

��������

������������

�� ������ ����

�� ����

• •���� �� ��

���� ����

�� ����

• •����

• �� •

��•

� ����� ��

������ ����

���� �� ������

�����

��

�� ���� •

• �� •

A

B

outp

utla

yer

a

b

c

hidd

enla

yer

t1

t2

t3

t4

t5

inpu

tla

yer

s

Asaved d[2]

Bsaved d[2]

��

��

��

Csaved d[3]

d[1]��

������ ����

d[2]��

����

������������

��

d[3]��

���

����������������

��

in ���� ����1

b

�� a���� ����2

a

�� b���� ����3����

a

��

b���� ������������4

����

a

�����

����

b

��

ΣLϕr

��

ϕm

��

ΣR

ϕm∗

��

L

λL �������Lr

��i1�� r �� R

λR

������

Lm

i2

m

��

Kr,m��i3��

i4

m

��

r �� Rm∗

i6

m∗

��

ΣG

ϕr∗�� ΣH

G

λG�������

Gr∗��i5

��r∗

�� HλH

ch-end.tex,v: 1.24 2007/06/15

Page 166: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 919 — #101

XY-pic

Symbols! syntax, 472, 473, 488, 489, 494" syntax, 494"..." syntax, 470’ syntax, 480, 482, 494(..,..) syntax, 470(0.xx) syntax, 482* syntax, 468–470, 471, 472, 473, 475, 476–478, 481, 488, 503** syntax, 470, 471, 472, 475, 476, 477, 498+ syntax, 468, 471, 473, 475++ syntax, 471, 473, 485+= syntax, 473, syntax, 469- syntax, 473, 480, 487– syntax, 473/.../ syntax, 472/^.../ syntax, 472/_.../ syntax, 472/d.../ syntax, 485/l.../ syntax, 486, 487/r.../ syntax, 470, 486/u.../ syntax, 485: syntax, 470, 487; syntax, 470, 477, 479< syntax, 471, 504, 505<..,..> syntax, 469<<<< syntax, 482= syntax, 470, 473, 479, 494> syntax, 471, 504, 505? syntax, 471, 475, 476

?! syntax, 471?< syntax, 471?>>> syntax, 471[F] syntax, 468, 469, 471–473, 474, 478, 479, 485, 486, 488, 500[o] syntax, 471, 473, 475, 479, 485, 488, 499& syntax, 468, 475, 481, 487\〈c〉cross, 504\〈c〉twist, 504\〈cc〉compositemap, 493\〈cc〉lowertwocell, 493\〈cc〉twocell, 493\〈cc〉uppertwocell, 493^ syntax, 478, 480, 494, 502, 506~ syntax, 495, 507, 509~* syntax, 476, 496, 497, 499, 507, 508~** syntax, 476~: syntax, 497, 498, 499, 507, 508~< syntax, 496, 498, 499~<> syntax, 496, 497–499~<< syntax, 496, 497~= syntax, 496, 499, 500, 508~> syntax, 496, 497, 499, 507, 508~>< syntax, 496, 497~>> syntax, 496, 497\\, 468, 473, 481_ syntax, 478, 480, 494, 506‘ syntax, 480, 482, 490, 494| syntax, 480, 504, 5050 syntax, 470, 4781 syntax, 478

Page 167: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 920 — #102

920 (Symbols–D) XY-pic

2 syntax, 4782cell option, 4933 syntax, 478

@@ syntax, 472, 478@*[F] syntax, 486, 487@*[r] syntax, 481, 482@{*} syntax, 472, 473@{+} syntax, 472, 475, 476@{–} syntax, 470, 471, 500, 501@{-} syntax, 470, 471, 488, 490, 498, 499@{.} syntax, 470, 471, 498, 499@{<<} syntax, 471@{==} syntax, 476@{=} syntax, 470, 497@{>} syntax, 471@{o} syntax, 472@{x} syntax, 472@‘{...} syntax, 479, 508@H syntax, 486, 487@M syntax, 486@R syntax, 486@W syntax, 486, 487

AAdobe Reader program, 817all option, 468, 478amsmath package, 483, 484\ar, 468, 472, 478, 479–481, 485, 486, 488, 494, 495, 500–503arc option, 500arcs, 501, 502arrow option, 468, 478, 479, 480, 481, 487, 495, 503arrows

custom, 478, 479, 480in commutative diagrams, 481–484

Bbraids, 509

CC syntax, 472category theory, 509circles, 500, 501\circuit (private), 489, 490

CMacTeX program, 468cobordism of Morse theory, 510color option, 468, 474commutative diagrams

3 x 2 diagrams, 4843 x 3 diagrams, 484annotations, 483cubical, 481description, 481

commutative diagrams (cont.)pullbacks, 484square, 482, 483triangular, 483

Comprehensive TEX Archive Network, see CTANconnections, 470, 471\croplattice, 503

crossingsknots, 504, 505links, 504, 505

\crv, 475, 476CTAN (Comprehensive TEX Archive Network)

archived files, finding and transferring, 813description, 810files, from the command line, 814TEX file catalogue, 811web access, 810, 811, 812, 813, 814

curly braces ({ }), 477curve option, 468, 474, 475, 479, 500, 503curves, 475, 476

DD syntax, 472diagram package, 482diagxy package, 482documentation, see also online resources

command-line interface, 815panel interface, 816search by name, 815search by product, 816texdoc, 815texdock, 816

drawingarcs, 501, 502arrows

custom, 478, 479, 480in commutative diagrams, 481–484

braces, 477brackets, 476, 477, 478braids, 509category theory, 509circles, 500, 501cobordism of Morse theory, 510connections, 470, 471constructing pictures, 468curves, 475, 476ellipses, 500, 501extensions, 468features, 468frames, 476, 477, 478globular 3-morphisms, 509graphic notions, 467graphs

basic principle, 487hidden layers, 489

ch-end.tex,v: 1.24 2007/06/15

Page 168: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 921 — #103

XY-pic (D–K) 921

drawing (cont.)input layers, 489linguistics trees, 491, 492logical circuit diagrams, 489, 490neural network diagrams, 488, 489output layers, 489tree branching, 488

kernel, 467knots

crossings, 504, 505joins, 505–508, 509

lattices, 502, 503links

crossings, 504, 505joins, 505–508, 509

matrix-like diagrams3 x 2, 4843 x 3, 484annotations, 483command syntax, 480commutative diagrams, 481–484finite state diagrams, 485, 486, 487homology, 484pullback effect, 484square, 482, 483stack diagrams, 485, 486, 487

modules, 468object margins, 473objects

bounding box, 473definition, 468dropping, 471, 472, 473edge, 473shifting, 472sizing, 473

options, 468pentagonal sphere, 510polygons

3-D, 498cubes, 499general form, 495hexagons, 496, 497nesting, 499perspective drawings, 498

positionsabsolute, 469definition, 467initial, 469specifying, 469, 470

spline curves, 475, 476string diagram, 510text, in pictures, 473two-cell diagrams, 493–495web structures, 502, 503

\drop, 502, 503

E\ellipse, 490, 500, 501, 502

ellipses, 500, 501\endxy, 469, 479\entrymodifiers, 485

FFAQs (Frequently Asked Questions), 809, see also online

resourcesframe option, 468, 474, 476, 477, 479frames, 476, 477, 478Frequently Asked Questions (FAQs), see online resources\frm, 472, 476, 477, 478, 507

Gglobular 3-morphisms, 509graph option, 468, 487, 488, 506graphs

basic principle, 487hidden layers, 489input layers, 489linguistics trees, 491, 492logical circuit diagrams, 489, 490neural network diagrams, 488, 489output layers, 489tree branching, 488

H\hcap, 506

help, see online resourceshidden graph layers, 489How To Ask Questions The Smart Way, 810hyperlinks, slides, 809–818

Iifthen package, 503\ifthenelse (ifthen), 503\iiixii (diagxy), 484\iiixiii (diagxy), 484import option, 474input graph layers, 489

Jjoins

knots, 505–508, 509links, 505–508, 509

Kkernel, 467knot option, 478, 503\knotholesize, 507, 508

ch-end.tex,v: 1.24 2007/06/15

Page 169: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 922 — #104

922 (K–R) XY-pic

knotscrossings, 504, 505joins, 505–508, 509

LL syntax, 472\labelstyle, 494, 504–508

LATEX files, obtainingweb access, 810, 811, 812, 813, 814

\latticeA, 503\latticeB, 503\latticebody, 502, 503

lattices, 502, 503\latticeX, 503\latticeY, 503Lc syntax, 476line option, 468, 474linguistics trees, 491, 492links

crossings, 504, 505joins, 505–508, 509

logical circuit diagrams, 489, 490

Mmatrix option, 468, 478, 480, 481, 487matrix-like diagrams

3 x 2, 4843 x 3, 484annotations, 483command syntax, 480commutative diagrams, 481–484finite state diagrams, 485, 486, 487homology, 484pullback effect, 484square, 482, 483stack diagrams, 485, 486, 487

\morphism (diagxy), 482, 483

Nnesting, polygons, 499neural network diagrams, 488, 489\newdir, 470, 481, 482\newgraphescape, 488, 489, 490

news groups, 810, see also online resources

Oobject margins, 473\objectmargin rigid length, 496

objectsbounding box, 473definition, 468dropping, 471, 472, 473edge, 473shifting, 472sizing, 473

\objectstyle, 494, 497, 499, 504, 507, 508\omit, 493, 494, 495

online access to CTAN, 810, 811, 812, 813, 814online resources

archived files, finding and transferring, 813CTAN (Comprehensive TEX Archive Network), 810

web access, 810, 811, 812, 813, 814documentation

command-line interface, 815panel interface, 816search by name, 815search by product, 816texdoc, 815texdock, 816

FAQs (Frequently Asked Questions), 809files, getting from the command line, 814How To Ask Questions The Smart Way, 810news groups, 810program files, obtaining

web access, 810, 811, 812, 813, 814TEX file catalogue, 811TEX files, 810TEX user groups, 817, 818TUG home page, 810, 811

output graph layers, 489

Ppentagonal sphere, 510pic program, 487\place (diagxy), 483poly option, 495, 507polygons

3-D, 498cubes, 499general form, 495hexagons, 496, 497nesting, 499perspective drawings, 498

\POS, 480, 486, 488, 490positioning

absolute, 469definition, 467initial, 469specifying, 469, 470

program files, obtainingweb access, 810, 811, 812, 813, 814

ps option, 475\pullback (diagxy), 484

RR syntax, 472\restore, 486, 487, 488, 490, 507rotate option, 468, 474, 489\rrtwocell, 494, 495

ch-end.tex,v: 1.24 2007/06/15

Page 170: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 923 — #105

XY-pic (R–Y) 923

\rtwocell, 493, 494

S\save, 486, 487, 488, 490, 507

slides (color), overlay specificationhyperlinks, 809–818

\SloppyCurves, 476spline curves, 475, 476\splinetolerance, 476\Square (diagxy), 483\square (diagxy), 482, 483

square brackets ([]), 476, 477, 478string diagram, 510

TTEX file archives, 810, see also CTANTEX files, obtaining

web access, 810, 811, 812, 813, 814texdoc program, 815, 816texdoctk program, 815–817text, in pictures, 473tile option, 474tips option, 468, 474, 481\Tree (xyling), 491

tree branching, 488TUG home page, 810, 811\turnradius, 487

two-cell diagrams, 493–495\twoar (diagxy), 483\txt, 473

UU syntax, 472\UseAllTwocells, 493, 494\UseCompositeMaps, 493\UseHalfTwocells, 493\UseTwocells, 493, 495

V\vcap, 507

\vcross, 504\vloop, 508, 509\vover, 504, 506, 508\Vtrianglepair (diagxy), 483\vtwist, 504\vunder, 504

Wweb option, 502web structures, 502, 503wget program, 814

X\xoverv, 508\xtwocell, 493, 494, 495\xunderv, 507, 508, 509\xy, 469xy env., 469, 495\xybox, 497, 502, 503\xyconnect (xytree), 492\xygraph, 487, 488, 489, 490, 506–508\xylattice, 502

xyling package, 491\xymatrix, 468, 480, 481, 482, 485, 486, 493–495\xynode (xytree), 491, 492\xyoption, 468\xypolygon, 495, 496–499, 507\xypolyname, 499\xypolynode, 497, 499, 507, 508\xypolynum, 497\xytree (xytree), 492

xytree package, 491

Y\yynode (xytree), 491, 492\yytree (xytree), 492

ch-end.tex,v: 1.24 2007/06/15

Page 171: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 924 — #106

People

Abraham, Paul, 709Akhmadeeva, Leila, 431Aplevich, Dwight, 203, 583Apollonius, 192, 194Appelt, Wolfgang, 668Arnold, Doug, 491

Bächle, Dirk, 687Barnard, Frederick R., 1Barr, Michael, 482Bauke, Heiko, 518Beccari, Claudio, 47Beitz, Eric, xxxiv, 547, 551Berners-Lee, Tim, 12Berry, Karl, 69Bibby, Duane, 7Bleser, Joachim, 15Bolek, Piotr, 148Bos, Victor, 691Braams, Johannes, 15Brown, Terry, 16Buckley, Andy, 512, 516, 560Burton, Terry, 453Bustamante Argañaraz, Gustavo S.,

196, 576

Carlisle, David, 7, 47, 557, 719, 737Charpentier, Jean-Côme, 429Cho, Jin-Hwan, 798Cholewo, Tomasz, 203Chupin, Maxime, IIIClark, Adrian, 8Clark, James, 17Coulon, Jean-Pierre, 588Coxeter, Harold Scott MacDonald,

192

Díaz, José Luis, 64, 196Dahlgren, Mats, 517Deutsch, L. Peter, 11Diamantini, Maurice, 442Dirr, Ulrich, xxxiv, 673Duggan, Angus, 7Dunker, Rainer, 647, 659Dupuis, Étienne, 691

Edwards, Tim, 586Egler, Andreas, 589Ekola, Tommy, 188Els, Danie, 513Esser, Thomas, 815, 816

Fairbairns, Robin, 809, 810Finston, Laurence D., 211, 212Fischer, Ulrike, xxxiv, 668, 669Frampton, John, 424, 425Fraser, James, IIIFrischauf, Adrian, 13Fujita, Shinsaku, 520

Gäßlein, Hubert, xxxiv, 43, 457Gabo, Naum, 57, 58Garcia, Federico, xxxiv, 666, 668, 680Gardner, D. J., 424Gastin, Paul, 15, 438Geisler, Martin, 194Gheorghies, Ovidiu, 181Giese, Martin, 449Gieseking, Martin, 13Gilg, Jürgen, xxivGirou, Denis, 214, 431, 446, 447, 452,

457Gjelstad, Ellef, 443Gonzato, Guido, 609Gray, Norman, 555Gregorio, Enrico, 612Gurari, Eitan M., 15

Page 172: The LATEX Graphics Companion - Pearsoncmg

�“tlgc2” — 2007/6/15 — 17:23 — page 925 — #107

PEOPLE 925

Hàn, Thê Thành, 24, 798Haas, Roswitha T., 518Hafner, Jim, 719Hagen, Hans, 73, 138, 520, 541Hamilton Kelly, Brian, 702Happel, Patrick, 513Hefferon, Jim, 810Heldoorn, Marcel, 513Hilbert, David, 52, 194Hirata, Shunsaku, 798Hobby, John, 21, 71, 75, 80, 157Hoenig, Alan, 52, 56Hoffmann, Torben, 668, 673Hwang, Andrew D., 20

Jackowski, Bogusław, 138, 149Jalbert, François, 589Jeffrey, Alan, 65Jorssen, Christophe, 428, 429, 434,

435Jørgensen, Palle, 155

Kane, Kevin C., 518Kelley, Colin, 17Kern, Uwe, xxxiv, 719Kernighan, Brian, 17Kiffe, Thomas, 468Kinch, Richard, 24Kneifl, Stanislav, 636Knuth, Donald, 6–9, 51, 137, 698Koch, Helge von, 105, 194Kołodziejska, Hanna, 691Krysztofiak, Claudia, xxxiv

Lamers, Jürgen, 687Lamport, Leslie, 7, 8Lauda, Aaron, xxxiv, 509Laurie, Dirk, 590, 616, 647, 651, 659Leathrum, Thomas E., 122Leech O’Neale, Susan, xxxivLeilich, Jens, 572Lesenko, Sergey, 24Lester, Paul Martin, 1Levine, Michael, 555Lindenmayer, Aristid, 154Lombardy, Sylvain, 439Luecking, Daniel H., 73, 122Luque, Manuel, 433, 434, 437, 445,

452

Maclaine-cross, Ian, 15, 47Matarazzo, Giuseppe, 436, 437Mattes, Eberhard, 24May, Ludwig, 572May, Wolfgang, 445Milne, James, 481Mitchell, Ross, 589Mittelbach, Frank, 7, 688Moon, Alun, 148Moore, Ross, xxxiv, 16, 467, 488Morawski, Jens-Uwe, 59, 60, 64, 170Morimoto, Hiroaki, 637Muelas, Santiago, 142, 209

Navarria, Janice, xxxivNeugebauer, Gerd, 702, 704Newton, Isaac, 714Nienhuys, Han-Wen, xxxiv, 661Niepraschk, Rolf, 43, 457Nieuwenhuizen, Jan, 661Nobre Gonçalves, Luís, 209

Ohl, Thorsten, 120, 555, 561, 566Oswald, Urs, 194Otten, A. F., 520, 541

Phan, Anthony, II, 66, 150, 209Pianowski, Piotr, 138Pipping, Nils Johan, 193Podar, Sunil, 15Poulain, Christophe, 148, 192

Rahtz, Sebastian, 7, 42Ramek, Michael, 518Raymond, Eric, 810Reichert, Axel, 513Richer, Jacques, 688Richter, Jörg, 696Ristow, Alan, 450Rodriguez, Dominique, 423, 426Roegel, Denis, 80, 207, 208Rokicki, Tom, 11, 24, 65Rose, Kristoffer H., 16, 467Rowley, Chris, 7Rubinstein, Zalman, 668Ruedas, Thomas, 816Rycko, Marek, 138

Sabo, Rudolf, 13Sakarovitch, Jacques, 439

Sarlat, Jean-Michel, IV, 195Schöpf, Rainer, 810Scherer, Andreas, 167Schmid, Hanspeter, 442Schmittbuhl, Arnaud, 432Schnell, Andreas, 14Schofer, Angelika, 589Sendoukas, Hippocrates, 24Sierpinski, Wacław, 52, 194Simons, Don, 590, 616, 618Smith, Brian, 13Sowa, Friedhelm, 7Steinbach, Andrea, 589

Tannert, Sebastian, 576Taupin, Daniel, v, vi, 589, 591, 592Tidefelt, Henrik, 177Tille, Andreas, 576Tobin, Geoffrey, 122Tutelaers, Piet, 668

Un, Koaungli, 491

van der Laan, Kees, 57, 58, 147, 699,701

Van Zandt, Timothy, 214, 448, 451,455, 458

Verhulst, Ferdinand, 195Vermaseren, Jos, 555, 558Veytsman, Boris, 431Vieth, Ulrik, 67, 137, 167Vila-Forcen, Jose-Emilio, 430Voß, Herbert, 214, 434, 435, 437, 453Vogel, Ralf, xxxiv, 491Vulis, Michael, 11, 797

Walshaw, Chris, 600, 654Wanske, Helene, 587Weinhold, Stephan, 688White, Jan, 742Wichura, Michael, 13Wicks, Mark A., 24, 798Williams, Graham, 811Williams, Thomas, 17Wilson, Peter, 178, 181, 710Wyart, Damien, xxxivWythoff, Willem Abraham, 192

Yang, Yang, 167Young, Thomas, 714

ch-end.tex,v: 1.24 2007/06/15