28.03.2013 Views

Guide to LaTeX (4th Edition) (Tools and Techniques

Guide to LaTeX (4th Edition) (Tools and Techniques

Guide to LaTeX (4th Edition) (Tools and Techniques

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

A <strong>Guide</strong> <strong>to</strong><br />

LAT E X<br />

<strong>and</strong> Electronic Publishing<br />

Fourth edition<br />

Helmut Kopka<br />

Patrick W. Daly<br />

Addison-Wesley<br />

Harlow, Engl<strong>and</strong> Reading, Massachusetts Menlo Park, California<br />

New York Don Mills, Ontario Amsterdam Bonn Sydney Singapore<br />

Tokyo Madrid San Juan Milan Mexico City Seoul Taipei


© Addison Wesley Longman Limited 2004<br />

Addison Wesley Longman Limited<br />

Edinburgh Gate<br />

Harlow<br />

Essex CM20 2JE<br />

Engl<strong>and</strong><br />

<strong>and</strong> Associated Companies throughout the World.<br />

The rights of Helmut Kopka <strong>and</strong> Patrick W. Daly <strong>to</strong> be identified as authors of<br />

this Work have been asserted by them in accordance with the Copyright,<br />

Designs <strong>and</strong> Patents Act 1988.<br />

All rights reserved. No part of this publication may be reproduced, s<strong>to</strong>red in a<br />

retrieval system, or transmitted in any form or by any means, electronic,<br />

mechanical, pho<strong>to</strong>copying, recording or otherwise, without either the prior<br />

written permission of the publisher or a licence permitting restricted copying in<br />

the United Kingdom issued by the Copyright Licensing Agency Ltd,<br />

90 Tottenham Court Road, London W1P 9HE.<br />

The programs in this book have been included for their instructional value.<br />

They have been tested with care but are not guaranteed for any particular<br />

purpose. The publisher does not offer any warranties or representations nor<br />

does it accept any liabilities with respect <strong>to</strong> the programs.<br />

Many of the designations used by manufacturers <strong>and</strong> sellers <strong>to</strong> distinguish their<br />

products are claimed as trademarks. Addison Wesley Longman Limited has<br />

made every attempt <strong>to</strong> supply trademark information about manufacturers <strong>and</strong><br />

their products mentioned in this book. A list of the trademark designations <strong>and</strong><br />

their owners appears on page v.<br />

Cover designed by Designers & Partners, Oxford<br />

Typeset by the authors with the L AT E X Documentation System<br />

Printed in Great Britain by Henry Ling Ltd, at the Dorset Press, Dorchester,<br />

Dorset<br />

First published 1993<br />

Second edition 1995<br />

Third edition 1999. Reprinted 1999, 2000<br />

Fourth edition 2004<br />

ISBN ????????????<br />

British Library Cataloguing-in-Publication Data<br />

A catalogue record for this book is available from the British Library<br />

Library of Congress Cataloging-in-Publication Data<br />

Kopka, Helmut.<br />

A guide <strong>to</strong> L AT E X : <strong>and</strong> Electronic Publishing<br />

/ Helmut Kopka, Patrick W. Daly -- <strong>4th</strong> ed.<br />

p. cm.<br />

Includes bibliographical references <strong>and</strong> index.<br />

ISBN 0-201-39825-7<br />

1. L AT E X (Computer file) 2. Computerized typesetting. I. Daly,<br />

Patrick W. II. Title.<br />

????????????<br />

??????????? ???????<br />

CIP


Trademark notices<br />

METAFONT is a trademark of Addison-Wesley Publishing Company.<br />

T E X, A M S-T E X, <strong>and</strong> A M S-L AT E X are trademarks of the American<br />

Mathematical Society.<br />

Lucida is a trademark of Bigelow & Holmes.<br />

Microsoft , MS-DOS , Windows , Internet Explorer are registered<br />

trademarks of Microsoft Corporation.<br />

PostScript , Acrobat Reader , Acrobat logo are registered trademarks <strong>and</strong><br />

PDF a trademark of Adobe Systems Incorporated.<br />

UNIX is a registered trademark in the United States <strong>and</strong> other countries,<br />

licensed exclusively through X/Open Company, Limited.<br />

VAX <strong>and</strong> VMS are trademarks of Digital Equipment Corporation.<br />

IBM is a registered trademark <strong>and</strong> techexplorer Hypermedia Browser a<br />

trademark of International Business Machines Corporation.<br />

Netscape <strong>and</strong> Netscape Naviga<strong>to</strong>r are trademarks of Netscape<br />

Communications Corporation.<br />

TrueType is a trademark <strong>and</strong> Apple <strong>and</strong> Macin<strong>to</strong>sh are registered<br />

trademarks of Apple Computer Inc.<br />

v


Preface<br />

A new edition <strong>to</strong> A <strong>Guide</strong> <strong>to</strong> L AT E X begs the fundamental question: Has<br />

L AT E X changed so much since the appearance of the third edition in 1999<br />

that a new release of this manual is justified?<br />

The simple answer <strong>to</strong> that question is ‘Well . . . .’ In 1994, the L AT E X world<br />

was in upheaval with the issue of the new version L AT E X 2ε, <strong>and</strong> the second<br />

edition of the <strong>Guide</strong> came out just then <strong>to</strong> act as the bridge between the<br />

old <strong>and</strong> new versions. By 1998, the initial teething problems had been<br />

worked out <strong>and</strong> corrected through semi-annual releases, <strong>and</strong> the third<br />

edition could describe an established, working system. However, homage<br />

was still paid <strong>to</strong> the older 2.09 version since many users still employed its<br />

familiar syntax, although they were most likely <strong>to</strong> be using it in a L AT E X 2ε<br />

environment. L AT E X has now reached a degree of stability that since 2000<br />

the regular updates have been reduced <strong>to</strong> annual events, which often<br />

appear months after the nominal date, something that does not worry<br />

anyone. The old version 2.09 is obsolete <strong>and</strong> should no longer play any<br />

role in such a manual. In this fourth edition, it is reduced <strong>to</strong> an appendix<br />

just <strong>to</strong> document its syntax <strong>and</strong> usage.<br />

But if L AT E X itself has not changed substantially since 1999, many of its<br />

peripherals have. The rise of programs like pdfT E X <strong>and</strong> dvipdfm for PDF<br />

output adds new possibilities, which are realized, not in L AT E X directly, but<br />

by means of more modern packages <strong>to</strong> extend the basic features. The<br />

distribution of T E X/L AT E X installations has changed, such that most users<br />

are given a complete, ready-<strong>to</strong>-run setup, with all the ‘extras’ that one<br />

used <strong>to</strong> have <strong>to</strong> obtain oneself. Those extras include user-contributed<br />

packages, many of which are now considered indispensable. Today ‘the<br />

L AT E X system’ includes much more than the basic kernel by Leslie Lamport,<br />

encompassing the contributions of hundreds of other people. This edition<br />

reflects this increase in breadth.<br />

The changes <strong>to</strong> the fourth edition are mainly those of emphasis.<br />

1. The material has been reorganized in<strong>to</strong> ‘Basics’ <strong>and</strong> ‘Beyond the<br />

Basics’ (‘advanced’ sounds <strong>to</strong>o intimidating) while the appendices<br />

contain <strong>to</strong>pics that really can be skipped by most everyday users.<br />

Exception: Appendix H is an alphabetized comm<strong>and</strong> summary that<br />

many people find extremely useful (including ourselves).<br />

This reorganizing is meant <strong>to</strong> stress certain aspects over others. For<br />

vii


viii Preface<br />

example, the section on graphics inclusion <strong>and</strong> color was originally<br />

treated as an exotic freak, relegated <strong>to</strong> an appendix on extensions;<br />

in the third edition, it moved up <strong>to</strong> be included in a front chapter<br />

along with the picture environment <strong>and</strong> floats; now it dominates<br />

Chapter 6 all on its own, the floats come in the following Chapter 7,<br />

<strong>and</strong> picture is banished <strong>to</strong> the later Chapter 13. This is not <strong>to</strong> say<br />

that the picture features are no good, but only that they are very<br />

specialized. We add descriptions of additional drawing possibilities<br />

there <strong>to</strong>o.<br />

2. It is stressed as much as possible that L AT E X is a markup language,<br />

with separation of content <strong>and</strong> form. Typographical settings should<br />

be placed in the preamble, while the body contains only logical<br />

markup. This is in keeping with the modern ideas of XML, where<br />

form <strong>and</strong> content are radically segregated.<br />

3. Throughout this edition, contributed packages are explained at that<br />

point in the text where they are most relevant. The fancyhdr<br />

package comes in the section on page styles, natbib where literature<br />

citations are explained. This stresses that these ‘extensions’ are part<br />

of the L AT E X system as a whole. However, <strong>to</strong> remind the user that<br />

they must still be explicitly loaded, a marginal note is placed at the<br />

start of their descriptions.<br />

4. PDF output is taken for granted throughout the book, in addition<br />

<strong>to</strong> the classical DVI format. This means that the added possibilities<br />

of pdfT E X <strong>and</strong> dvipdfm are explained where they are relevant. A<br />

separate Chapter 10 on PostScript <strong>and</strong> PDF is still necessary, <strong>and</strong> the<br />

best interface <strong>to</strong> PDF output, the hyperref package by Sebastian<br />

Rahtz, is explained in detail. PDF is also included in Chapter 15 on<br />

presentation material.<br />

On the other h<strong>and</strong>, the other Web output formats, HTML <strong>and</strong> XML,<br />

are only dealt with briefly in Appendix E, since these are large <strong>to</strong>pics<br />

treated in other books, most noticeably the L AT E X Web Companion.<br />

5. This book is being distributed with the T E XLive CD, with the kind<br />

permission of Sebastian Rahtz who maintains it for the T E X Users<br />

Group. It contains a full T E X <strong>and</strong> L AT E X installation for Windows,<br />

Macin<strong>to</strong>sh, <strong>and</strong> Linux, plus many of the myriad extensions that<br />

exist.<br />

We once again express our hope that this <strong>Guide</strong> will prove more than<br />

useful <strong>to</strong> all those who wish <strong>to</strong> find their way through the intricate world<br />

of L AT E X. And with the addition of the T E XLive CD, that world is brought<br />

even closer <strong>to</strong> their doorsteps.<br />

Helmut Kopka <strong>and</strong> Patrick W. Daly<br />

June, 2003


Contents<br />

Preface vii<br />

I Basics 1<br />

1 Introduction 3<br />

1.1 Just what is L AT E X? . . . . . . . . . . . . . . . . . . . . . . . . . . 3<br />

1.2 Markup Languages . . . . . . . . . . . . . . . . . . . . . . . . . 4<br />

1.3 T E X <strong>and</strong> its offspring . . . . . . . . . . . . . . . . . . . . . . . . 6<br />

1.4 How <strong>to</strong> use this book . . . . . . . . . . . . . . . . . . . . . . . . 10<br />

1.5 Basics of a L AT E X file . . . . . . . . . . . . . . . . . . . . . . . . . 11<br />

1.6 T E X processing procedure . . . . . . . . . . . . . . . . . . . . . 14<br />

2 Text, Symbols, <strong>and</strong> Comm<strong>and</strong>s 17<br />

2.1 Comm<strong>and</strong> names <strong>and</strong> arguments . . . . . . . . . . . . . . . . 17<br />

2.2 Environments . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19<br />

2.3 Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20<br />

2.4 Lengths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21<br />

2.5 Special characters . . . . . . . . . . . . . . . . . . . . . . . . . . 22<br />

2.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27<br />

2.7 Fine-tuning text . . . . . . . . . . . . . . . . . . . . . . . . . . . 28<br />

2.8 Word division . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34<br />

3 Document Layout <strong>and</strong> Organization 37<br />

3.1 Document class . . . . . . . . . . . . . . . . . . . . . . . . . . . 37<br />

3.2 Page style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42<br />

3.3 Parts of the document . . . . . . . . . . . . . . . . . . . . . . . 52<br />

3.4 Table of contents . . . . . . . . . . . . . . . . . . . . . . . . . . 58<br />

4 Displayed Text 61<br />

4.1 Changing font . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61<br />

4.2 Centering <strong>and</strong> indenting . . . . . . . . . . . . . . . . . . . . . . 67<br />

4.3 Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69<br />

4.4 Generalized lists . . . . . . . . . . . . . . . . . . . . . . . . . . 74<br />

4.5 Theorem-like declarations . . . . . . . . . . . . . . . . . . . . 80<br />

ix


x CONTENTS<br />

4.6 Tabula<strong>to</strong>r s<strong>to</strong>ps . . . . . . . . . . . . . . . . . . . . . . . . . . . 81<br />

4.7 Boxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85<br />

4.8 Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95<br />

4.9 Printing literal text . . . . . . . . . . . . . . . . . . . . . . . . . 110<br />

4.10 Footnotes <strong>and</strong> marginal notes . . . . . . . . . . . . . . . . . . 112<br />

4.11 Comments within text . . . . . . . . . . . . . . . . . . . . . . . 118<br />

5 Mathematical Formulas 119<br />

5.1 Mathematical environments . . . . . . . . . . . . . . . . . . . 119<br />

5.2 Main elements of math mode . . . . . . . . . . . . . . . . . . 120<br />

5.3 Mathematical symbols . . . . . . . . . . . . . . . . . . . . . . . 124<br />

5.4 Additional elements . . . . . . . . . . . . . . . . . . . . . . . . 130<br />

5.5 Fine-tuning mathematics . . . . . . . . . . . . . . . . . . . . . 145<br />

5.6 Beyond st<strong>and</strong>ard L AT E X . . . . . . . . . . . . . . . . . . . . . . . 151<br />

6 Graphics Inclusion <strong>and</strong> Color 153<br />

6.1 The graphics packages . . . . . . . . . . . . . . . . . . . . . . 153<br />

6.2 Adding color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166<br />

7 Floating tables <strong>and</strong> figures 169<br />

7.1 Float placement . . . . . . . . . . . . . . . . . . . . . . . . . . . 169<br />

7.2 Postponing floats . . . . . . . . . . . . . . . . . . . . . . . . . . 171<br />

7.3 Style parameters for floats . . . . . . . . . . . . . . . . . . . . 171<br />

7.4 Float captions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173<br />

7.5 Float examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174<br />

7.6 References <strong>to</strong> figures <strong>and</strong> tables in text . . . . . . . . . . . . 177<br />

7.7 Some float packages . . . . . . . . . . . . . . . . . . . . . . . . 178<br />

8 User Cus<strong>to</strong>mizations 181<br />

8.1 Counters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181<br />

8.2 Lengths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184<br />

8.3 User-defined comm<strong>and</strong>s . . . . . . . . . . . . . . . . . . . . . . 185<br />

8.4 User-defined environments . . . . . . . . . . . . . . . . . . . . 195<br />

8.5 Some comments on user-defined structures . . . . . . . . . 200<br />

II Beyond the Basics 205<br />

9 Document Management 207<br />

9.1 Processing parts of a document . . . . . . . . . . . . . . . . . 207<br />

9.2 In-text references . . . . . . . . . . . . . . . . . . . . . . . . . . 213<br />

9.3 Bibliographies . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216<br />

9.4 Keyword index . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225


CONTENTS xi<br />

10 PostScript <strong>and</strong> PDF 231<br />

10.1 L AT E X <strong>and</strong> PostScript . . . . . . . . . . . . . . . . . . . . . . . . 231<br />

10.2 Portable Document Format . . . . . . . . . . . . . . . . . . . . 236<br />

11 Multilingual L AT E X 251<br />

11.1 The babel system . . . . . . . . . . . . . . . . . . . . . . . . . 252<br />

11.2 Contents of the language.dat file . . . . . . . . . . . . . . . 256<br />

12 Math Extensions with A M S-L AT E X 257<br />

12.1 Invoking A M S-L AT E X . . . . . . . . . . . . . . . . . . . . . . . . 258<br />

12.2 St<strong>and</strong>ard features of A M S-L AT E X . . . . . . . . . . . . . . . . . 258<br />

12.3 Further A M S-L AT E X packages . . . . . . . . . . . . . . . . . . . 280<br />

12.4 The A M S fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . 283<br />

13 Drawing with L AT E X 287<br />

13.1 The picture environment . . . . . . . . . . . . . . . . . . . . 287<br />

13.2 Extended pictures . . . . . . . . . . . . . . . . . . . . . . . . . . 302<br />

13.3 Other drawing packages . . . . . . . . . . . . . . . . . . . . . . 307<br />

14 Bibliographic Databases <strong>and</strong> BIBT E X 309<br />

14.1 The BIBT E X program . . . . . . . . . . . . . . . . . . . . . . . . . 309<br />

14.2 Creating a bibliographic database . . . . . . . . . . . . . . . . 311<br />

14.3 Cus<strong>to</strong>mizing bibliography styles . . . . . . . . . . . . . . . . 321<br />

15 Presentation Material 323<br />

15.1 Slide production with SLIT E X . . . . . . . . . . . . . . . . . . . 324<br />

15.2 Slide production with seminar . . . . . . . . . . . . . . . . . 330<br />

15.3 Electronic documents for screen viewing . . . . . . . . . . . 340<br />

15.4 Special effects with PDF . . . . . . . . . . . . . . . . . . . . . . 343<br />

16 Letters 351<br />

16.1 The L AT E X letter class . . . . . . . . . . . . . . . . . . . . . . . 351<br />

16.2 A house letter style . . . . . . . . . . . . . . . . . . . . . . . . . 356<br />

16.3 A model letter cus<strong>to</strong>mization . . . . . . . . . . . . . . . . . . 359<br />

Appendices<br />

A The New Font Selection Scheme (NFSS) 367<br />

A.1 Font attributes under NFSS . . . . . . . . . . . . . . . . . . . . 368<br />

A.2 Simplified font selection . . . . . . . . . . . . . . . . . . . . . . 370<br />

A.3 Installing fonts with NFSS . . . . . . . . . . . . . . . . . . . . . 372


xii CONTENTS<br />

B The L AT E X Clockwork 381<br />

B.1 Installing L AT E X . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381<br />

B.2 Obtaining the Adobe euro fonts . . . . . . . . . . . . . . . . . 387<br />

B.3 T E X direc<strong>to</strong>ry structure . . . . . . . . . . . . . . . . . . . . . . . 387<br />

B.4 The CTAN server . . . . . . . . . . . . . . . . . . . . . . . . . . 389<br />

B.5 Additional st<strong>and</strong>ard files . . . . . . . . . . . . . . . . . . . . . 391<br />

B.6 The various L AT E X files . . . . . . . . . . . . . . . . . . . . . . . 396<br />

C Error Messages 401<br />

C.1 Basic structure of error messages . . . . . . . . . . . . . . . . 401<br />

C.2 Some sample errors . . . . . . . . . . . . . . . . . . . . . . . . 409<br />

C.3 List of L AT E X error messages . . . . . . . . . . . . . . . . . . . . 415<br />

C.4 T E X error messages . . . . . . . . . . . . . . . . . . . . . . . . . 424<br />

C.5 Warnings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429<br />

C.6 Search for subtle errors . . . . . . . . . . . . . . . . . . . . . . 435<br />

D L AT E X Programming 437<br />

D.1 Class <strong>and</strong> package files . . . . . . . . . . . . . . . . . . . . . . 437<br />

D.2 L AT E X programming comm<strong>and</strong>s . . . . . . . . . . . . . . . . . . 440<br />

D.3 Sample packages . . . . . . . . . . . . . . . . . . . . . . . . . . 451<br />

D.4 Changing preprogrammed text . . . . . . . . . . . . . . . . . 459<br />

D.5 Direct typing of special letters . . . . . . . . . . . . . . . . . . 461<br />

D.6 Alternatives for special symbols . . . . . . . . . . . . . . . . . 462<br />

D.7 Managing code <strong>and</strong> documentation . . . . . . . . . . . . . . . 462<br />

E L AT E X <strong>and</strong> World Wide Web 475<br />

E.1 Converting <strong>to</strong> HTML . . . . . . . . . . . . . . . . . . . . . . . . 476<br />

E.2 The Extensible Markup Language: XML . . . . . . . . . . . . . 478<br />

E.3 The techexplorer Hypermedia Browser . . . . . . . . . . . 481<br />

F Obsolete L AT E X 483<br />

F.1 The 2.09 preamble . . . . . . . . . . . . . . . . . . . . . . . . . 483<br />

F.2 Font selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484<br />

F.3 Obsolete means obsolete . . . . . . . . . . . . . . . . . . . . . 485<br />

G T E X Fonts 487<br />

G.1 Font metrics <strong>and</strong> bitmaps . . . . . . . . . . . . . . . . . . . . . 487<br />

G.2 Computer Modern fonts . . . . . . . . . . . . . . . . . . . . . . 488<br />

G.3 The METAFONT program . . . . . . . . . . . . . . . . . . . . . 497<br />

G.4 Extended Computer fonts . . . . . . . . . . . . . . . . . . . . . 498<br />

G.5 PostScript fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . 503<br />

G.6 Computer Modern as PostScript fonts . . . . . . . . . . . . . 505


LIST OF TABLES xiii<br />

H Comm<strong>and</strong> Summary 507<br />

H.1 Brief description of the L AT E X comm<strong>and</strong>s . . . . . . . . . . . . 507<br />

H.2 Summary tables <strong>and</strong> figures . . . . . . . . . . . . . . . . . . . 595<br />

Bibliography 605<br />

Index 607<br />

List of Tables<br />

10.1 The psnfss packages <strong>and</strong> their fonts . . . . . . . . . . . . . 234<br />

10.2 Acrobat menu actions . . . . . . . . . . . . . . . . . . . . . . . 248<br />

A.1 The NFSS encoding schemes . . . . . . . . . . . . . . . . . . . 368<br />

A.2 The NFSS series attributes . . . . . . . . . . . . . . . . . . . . . 369<br />

A.3 Attributes of the Computer Modern fonts . . . . . . . . . . . 370<br />

D.1 Input coding schemes for inputenc package . . . . . . . . . 462<br />

D.2 Alternative comm<strong>and</strong>s for special symbols . . . . . . . . . . 463<br />

G.1 Computer Modern text fonts . . . . . . . . . . . . . . . . . . . 491<br />

G.2 Root names of the 35 st<strong>and</strong>ard PostScript fonts . . . . . . . 504<br />

G.3 Encoding suffixes . . . . . . . . . . . . . . . . . . . . . . . . . . 505<br />

H.1 Font attribute comm<strong>and</strong>s . . . . . . . . . . . . . . . . . . . . . 595<br />

H.2 Math alphabet comm<strong>and</strong>s . . . . . . . . . . . . . . . . . . . . . 595<br />

H.3 Font sizes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 595<br />

H.4 L AT E X 2.09 font declarations . . . . . . . . . . . . . . . . . . . . 595<br />

H.5 Dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 596<br />

H.6 Accents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 596<br />

H.7 Special letters from other languages . . . . . . . . . . . . . . 596<br />

H.8 Special symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . 596<br />

H.9 Comm<strong>and</strong> symbols . . . . . . . . . . . . . . . . . . . . . . . . . 596<br />

H.10 Greek letters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 596<br />

H.11 Binary operation symbols . . . . . . . . . . . . . . . . . . . . . 597<br />

H.12 Relational symbols . . . . . . . . . . . . . . . . . . . . . . . . . 597<br />

H.13 Negated relational symbols . . . . . . . . . . . . . . . . . . . . 597<br />

H.14 Brackets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 597<br />

H.15 Arrows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 598<br />

H.16 Miscellaneous symbols . . . . . . . . . . . . . . . . . . . . . . 598<br />

H.17 Mathematical symbols in two sizes . . . . . . . . . . . . . . . 598<br />

H.18 Function names . . . . . . . . . . . . . . . . . . . . . . . . . . . 598<br />

H.19 Math accents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 599<br />

H.20 A M S arrows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 599<br />

H.21 A M S binary operation symbols . . . . . . . . . . . . . . . . . 599


xiv CONTENTS<br />

H.22 A M S Greek <strong>and</strong> Hebrew letters . . . . . . . . . . . . . . . . . 600<br />

H.23 A M S delimiters . . . . . . . . . . . . . . . . . . . . . . . . . . . 600<br />

H.24 A M S relational symbols . . . . . . . . . . . . . . . . . . . . . . 600<br />

H.25 A M S negated relational symbols . . . . . . . . . . . . . . . . 601<br />

H.26 Miscellaneous A M S symbols . . . . . . . . . . . . . . . . . . . 601<br />

List of Figures<br />

1.1 Sample display with the WinEdt edi<strong>to</strong>r . . . . . . . . . . . . . 16<br />

3.1 Page layout parameters . . . . . . . . . . . . . . . . . . . . . . 48<br />

3.2 Sample title page . . . . . . . . . . . . . . . . . . . . . . . . . . 53<br />

4.1 The list parameters . . . . . . . . . . . . . . . . . . . . . . . 76<br />

6.1 An embellished image file . . . . . . . . . . . . . . . . . . . . . 160<br />

10.1 Output produced by pdfT E X with the hyperref package . . 240<br />

13.1 Comparison of eepic with eepicemu . . . . . . . . . . . . . 306<br />

15.2 Title page of a pdfscreen document . . . . . . . . . . . . . . 341<br />

B.1 The T E XLive welcome . . . . . . . . . . . . . . . . . . . . . . . . 383<br />

B.2 The T E XLive documentation browser . . . . . . . . . . . . . . 384<br />

B.3 The TDS direc<strong>to</strong>ry tree . . . . . . . . . . . . . . . . . . . . . . . 388<br />

B.4 Partial direc<strong>to</strong>ry tree of CTAN servers . . . . . . . . . . . . . 390<br />

E.1 Example of T E X4ht <strong>and</strong> techexplorer output . . . . . . . . 482<br />

H.1 Single column page format . . . . . . . . . . . . . . . . . . . . 602<br />

H.2 Double column page format . . . . . . . . . . . . . . . . . . . 603<br />

H.3 Format of the list environment . . . . . . . . . . . . . . . . 604


Part I<br />

Basics


1<br />

1.1 Just what is L AT E X?<br />

To summarize very briefly:<br />

Introduction<br />

• L AT E X is a comprehensive set of markup comm<strong>and</strong>s used with the<br />

powerful typesetting program T E X for the preparation of a wide<br />

variety of documents, from scientific articles, reports, <strong>to</strong> complex<br />

books.<br />

• L AT E X like T E X is an open software system, available free of charge.<br />

Its core is maintained by the L AT E X3 Project Group but it also benefits<br />

from extensions written by hundreds of user/contribu<strong>to</strong>rs, with all<br />

the advantages <strong>and</strong> disadvantages of such a democracy.<br />

• A L AT E X document consists of one or more source files containing<br />

plain text characters, the actual textual content plus markup<br />

comm<strong>and</strong>s. These include instructions which can insert graphical<br />

material produced by other programs.<br />

• It is processed by the T E X program <strong>to</strong> produce a binary file in DVI<br />

(device independent) format, containing precise directions for the<br />

typesetting of each character. This in turn can be viewed on a moni<strong>to</strong>r,<br />

or converted in<strong>to</strong> printer instructions, or some other electronic<br />

form such as PostScript, HTML, XML, or PDF.<br />

• A variant on the T E X program called pdfT E X produces PDF output<br />

directly from the source file without going through the DVI intermediary.<br />

With this, L AT E X can au<strong>to</strong>matically include internal links<br />

<strong>and</strong> bookmarks with little or no extra effort, plus PDF but<strong>to</strong>ns <strong>and</strong><br />

external links, in addition <strong>to</strong> graphics in a wide range of common<br />

formats.<br />

• T E X activities are coordinated by the T E X Users Group, TUG (www.<br />

tug.org) who distribute a set of CDs, called T E XLive, annually <strong>to</strong> its<br />

3


4 Chapter 1. Introduction<br />

members, containing a T E X/L AT E X installation for various computer<br />

types.<br />

The rest of this book attempts <strong>to</strong> fill in the gaps in the above summary.<br />

With the help of the included T E XLive CD for Windows, Macin<strong>to</strong>sh, <strong>and</strong><br />

Linux, which also contains a direc<strong>to</strong>ry specific <strong>to</strong> this book (\books\<br />

Kopka_<strong>and</strong>_Daly\), we hope that the user will have additional pleasure<br />

in learning the joys of L AT E X.<br />

1.2 Markup Languages<br />

1.2.1 Typographical markup<br />

In the days before computers, an author would prepare a manuscript<br />

either by h<strong>and</strong> or by typewriter, which he or she would submit <strong>to</strong> a publisher.<br />

Once accepted for publication (<strong>and</strong> after several rounds of corrections<br />

<strong>and</strong> modifications, each requiring a rewrite of the paper manuscript),<br />

it would be sent <strong>to</strong> a copy edi<strong>to</strong>r, a human being who would decorate the<br />

manuscript with markup, marginal notes that inform the typesetter (another<br />

human being) which fonts <strong>and</strong> spacings <strong>and</strong> other typographical<br />

features should be used <strong>to</strong> convert it <strong>to</strong> the final printed form that one<br />

expects of books <strong>and</strong> articles.<br />

Electronic processing of text <strong>to</strong>day follows a similar procedure, except<br />

that the humans have been replaced by computer programs. (So far the<br />

author has avoided this fate, but they are working on it.) The markup<br />

is normally included directly in the manuscript in such a way that it is<br />

converted immediately <strong>to</strong> its output form <strong>and</strong> displayed on the computer<br />

moni<strong>to</strong>r. This is known as WYSIWYG, or ‘what you see is what you get’.<br />

However, what you see is not always what you’ve got. An alternative<br />

that is used more <strong>and</strong> more by major publishers is markup languages,<br />

in which the raw text is interspersed with indica<strong>to</strong>rs ‘for the typesetter.’<br />

The result as seen on the moni<strong>to</strong>r is much the same as a typewritten<br />

manuscript, except that the markup is no longer abbreviated marginal<br />

notes, but cryptic code within the actual text. This source text, which<br />

can be prepared by a simple, dumb text edi<strong>to</strong>r program, is converted in<strong>to</strong><br />

typographically set output by a separate program.<br />

For example, <strong>to</strong> code the line<br />

He <strong>to</strong>ok a bold step forward.<br />

with HTML, the classical markup language of the World Wide Web, one<br />

enters in the source text:<br />

He <strong>to</strong>ok a bold step forward.<br />

In Plain T E X, the same sentence would be coded as:


He <strong>to</strong>ok a {\bf bold step} forward.<br />

1.2. Markup Languages 5<br />

The first example is <strong>to</strong> be processed (displayed) by a Web browser program<br />

that decides <strong>to</strong> set everything between <strong>and</strong> as bold face. The<br />

second example is intended for the T E X program (Section 1.3). The markup<br />

in these two examples follow different rules, different syntax, but the<br />

functionality is the same.<br />

1.2.2 Logical markup<br />

The above examples illustrate typographical markup, where the inserted<br />

comm<strong>and</strong>s or tags give direct instructions <strong>to</strong> alter the appearance of the<br />

output, here a change of font. An alternative is <strong>to</strong> indicate the purpose<br />

of the text. For example, HTML recognizes several levels of headings; <strong>to</strong><br />

place a title in<strong>to</strong> the highest level one enters:<br />

Logical Markup<br />

The equivalent L AT E X entry would be:<br />

\section{Logical Markup}<br />

With this logical markup, the author concentrates entirely on the content<br />

<strong>and</strong> leaves the typographical considerations <strong>to</strong> the experts. One<br />

merely marks the structure of the document, <strong>and</strong> has no means of controlling<br />

how the logical elements, like section titles, are <strong>to</strong> be rendered<br />

typographically. This information is put in<strong>to</strong> HTML style sheets or L AT E X<br />

classes <strong>and</strong> packages, which are external <strong>to</strong> the actual source file. This<br />

means that the entire layout of a document can be overhauled with only<br />

minimal or even no alterations <strong>to</strong> the source file.<br />

Today much effort is being put in<strong>to</strong> XML, the Extensible Markup Language,<br />

as the ultimate markup system, since it allows the markup, or<br />

tags, <strong>to</strong> be defined as needed, without any indication of how they are <strong>to</strong><br />

be implemented. That is left <strong>to</strong> XSL, the Extensible Stylesheet Language.<br />

It must be emphasized that neither XML nor XSL are programs at all; they<br />

are specifications for how documents <strong>and</strong> databases may be marked up,<br />

<strong>and</strong> how the markup tags may be translated in<strong>to</strong> real output. Programs<br />

still need <strong>to</strong> be found <strong>to</strong> do the actual job.<br />

And that is the fundamental idea behind markup languages: that the<br />

source text indicates the logical structure of its contents. Such source<br />

files, being written in plain ascii text, are extremely robust, not being<br />

married <strong>to</strong> any particular software package or computer type.<br />

What does all this have <strong>to</strong> do with L AT E X? In the next Section we outline<br />

the development of T E X <strong>and</strong> L AT E X, <strong>and</strong> go on <strong>to</strong> show that L AT E X, a product<br />

of the mid 1980’s, is a programmable markup language that is ideally<br />

suited for the modern world of electronic publishing.


6 Chapter 1. Introduction<br />

1.3 T E X <strong>and</strong> its offspring<br />

The most powerful formatting program for producing book quality text<br />

of scientific <strong>and</strong> technical works is that of Donald E. Knuth (Knuth, 1986a,<br />

1986b, 1986c, 1986d, 1986e). The program is called T E X, which is a<br />

rendering in capitals of the Greek letters τɛχ. For this reason the last<br />

letter is pronounced not as an x, but as the ch in Scottish loch or German<br />

ach, or as the Spanish j or Russian kh. The name is meant <strong>to</strong> emphasize<br />

that the printing of mathematical texts is an integral part of the program<br />

<strong>and</strong> not a cumbersome add-on. In addition <strong>to</strong> T E X, the same author has<br />

developed a further program called METAFONT for the production of<br />

character fonts. The st<strong>and</strong>ard T E X program package contains 75 fonts<br />

in various design sizes, each of which is also available in up <strong>to</strong> eight<br />

magnification steps. All these fonts were produced with the program<br />

METAFONT. With additional applications, further character fonts have<br />

been created, such as for Cyrillic, Chinese, <strong>and</strong> Japanese, with which texts<br />

in these alphabets can be printed in book quality.<br />

The T E X program is free, <strong>and</strong> the source code is readily available.<br />

Anybody may take it <strong>and</strong> modify it as they like, provided they call the<br />

result something other than T E X. This indeed has occurred, <strong>and</strong> several<br />

T E X variants do exist, including pdfT E X which we deal with later in this<br />

Chapter. Only Knuth is allowed <strong>to</strong> alter T E X itself, which he does only <strong>to</strong><br />

correct any obvious bugs. Otherwise, he considers T E X <strong>to</strong> be completed;<br />

the current version number is 3.14159, <strong>and</strong> with his death, the code will<br />

be frozen for all time, <strong>and</strong> the version number will become exactly π.<br />

1.3.1 The T E X program<br />

The basic T E X program only underst<strong>and</strong>s a set of very primitive comm<strong>and</strong>s<br />

that are adequate for the simplest of typesetting operations <strong>and</strong><br />

programming functions. However, it does allow more complex, higherlevel<br />

comm<strong>and</strong>s <strong>to</strong> be defined in terms of the primitive ones. In this way,<br />

a more user-friendly environment can be constructed out of the low-level<br />

building blocks.<br />

During a processing run, the program first reads in a so-called format<br />

file which contains the definitions of the higher-level comm<strong>and</strong>s in terms<br />

of the primitive ones, <strong>and</strong> which also contains the hyphenation patterns<br />

for word division. Only then does it read in the author’s source file containing<br />

the actual text <strong>to</strong> be processed, including formatting comm<strong>and</strong>s<br />

that are predefined in the format file.<br />

Creating new formats is something that should be left <strong>to</strong> very knowledgeable<br />

programmers. The definitions are written <strong>to</strong> a source file which<br />

is then processed with a special version of the T E X program called initex.<br />

It s<strong>to</strong>res the new format file in a compact manner so that it can be read<br />

in quickly by the regular T E X program.


1.3. T E X <strong>and</strong> its offspring 7<br />

Although the normal user will almost never write such a format, he<br />

or she may be presented with a new format source file that will need <strong>to</strong><br />

be installed with initex. For example, this is just what must be done <strong>to</strong><br />

upgrade L AT E X periodically. How <strong>to</strong> do this is described in Appendix B.<br />

1.3.2 Plain T E X<br />

1.3.3 L AT E X<br />

Knuth has provided a basic format named Plain T E X <strong>to</strong> interact with T E X<br />

at its simplest level. This is such a fundamental part of T E X processing<br />

that one tends <strong>to</strong> forget the distinction between the actual processing<br />

program T E X <strong>and</strong> this particular format. Most people who claim <strong>to</strong> ‘work<br />

only with T E X’ really mean that they only work with Plain T E X.<br />

Plain T E X is also the basis of every other format, something that only<br />

reinforces the impression that T E X <strong>and</strong> Plain T E X are one <strong>and</strong> the same.<br />

The emphasis of Plain T E X is still very much at the typesetter’s level,<br />

rather than the author’s. Furthermore, the exploitation of all its potential<br />

dem<strong>and</strong>s considerable experience with programming techniques. Its<br />

application thus remains the exclusive domain of typographic <strong>and</strong> programming<br />

professionals.<br />

For this reason, the American computer scientist Leslie Lamport has<br />

developed the L AT E X format (Lamport, 1985), which provides a set of<br />

higher-level comm<strong>and</strong>s for the production of complex documents. With<br />

it, even the user with no knowledge of typesetting or programming is in<br />

a position <strong>to</strong> take extensive advantage of the possibilities offered by T E X,<br />

<strong>and</strong> <strong>to</strong> be able <strong>to</strong> produce a variety of text outputs in book quality within<br />

a few days, if not hours. This is especially true for the production of<br />

complex tables <strong>and</strong> mathematical formulas.<br />

As pointed out in Section 1.2.2, L AT E X is very much more a logical<br />

markup language than the original Plain T E X, on which it is based. It<br />

contains provisions for au<strong>to</strong>matic running heads, sectioning, tables of<br />

contents, cross-referencing, equation numbering, citations, floating tables<br />

<strong>and</strong> figures, without the author having <strong>to</strong> know just how these are <strong>to</strong> be<br />

formatted. The layout information is s<strong>to</strong>red in additional class files which<br />

are referred <strong>to</strong> but not included in the input text. The predefined layouts<br />

may be accepted as they are, or replaced by others with minimal changes<br />

<strong>to</strong> the source file.<br />

Since its introduction in the mid-1980s, L AT E X has been periodically<br />

updated <strong>and</strong> revised, like all software products. For many years the<br />

version number was fixed at 2.09 <strong>and</strong> the revisions were only identified<br />

by their dates. The last major update occurred on December 1, 1991, with<br />

some minor corrections up <strong>to</strong> March 25, 1992, at which point L AT E X 2.09<br />

became frozen.


8 Chapter 1. Introduction<br />

1.3.4 L AT E X 2ε<br />

The enormous popularity of L AT E X <strong>and</strong> its expansion in<strong>to</strong> fields for which<br />

it was not originally intended, <strong>to</strong>gether with improvements in computer<br />

technology, especially dealing with cheap but powerful laser printers, had<br />

created a diversity of formats bearing the L AT E X label. In an effort <strong>to</strong><br />

re-establish a genuine, improved st<strong>and</strong>ard, the L AT E X3 Project was set up<br />

in 1989 by Leslie Lamport, Frank Mittelbach, Chris Rowley, <strong>and</strong> Rainer<br />

Schöpf. Their goal was <strong>to</strong> construct an optimized <strong>and</strong> efficient set of<br />

basic comm<strong>and</strong>s complemented by various packages <strong>to</strong> add specific functionality<br />

as needed.<br />

As the name of the project implies, its aim is <strong>to</strong> achieve a version 3<br />

for L AT E X. However, since that is the long-term goal, a first step <strong>to</strong>wards it<br />

was the release of L AT E X 2ε in mid-1994 <strong>to</strong>gether with the publication of<br />

the second edition of Lamport’s basic manual (Lamport, 1994) <strong>and</strong> of an<br />

additional book (Goossens et al., 1994) describing many of the extension<br />

packages available <strong>and</strong> L AT E X programming in the new system. Since then,<br />

two further books have appeared, Goossens et al. (1997) dealing with the<br />

inclusion of graphics <strong>and</strong> color, <strong>and</strong> Goossens <strong>and</strong> Rahtz (1999) explaining<br />

how L AT E X may be used with the World Wide Web. Both these <strong>to</strong>pics are<br />

also dealt with in this <strong>Guide</strong>.<br />

Initially updates <strong>to</strong> L AT E X 2ε were issued twice a year, in June <strong>and</strong><br />

December, but it has now become so stable that since 2000 the changes<br />

are released only once a year, nominally in June.<br />

L AT E X 2ε is now the st<strong>and</strong>ard version, <strong>and</strong> L AT E X 2.09 is considered<br />

obsolete, although source files intended for the older version may still be<br />

processed with the newer one. In this book, unless otherwise indicated,<br />

‘L AT E X’ will always mean L AT E X 2ε.<br />

1.3.5 T E X fonts<br />

T E X initially made use of its own set of fonts, called Computer Modern<br />

generated by Knuth’s METAFONT program. The reason for doing this<br />

was that printers at that time (<strong>and</strong> even <strong>to</strong>day) may contain their own<br />

preloaded fonts, but they are often slightly different from printer <strong>to</strong><br />

printer. Furthermore, they lacked the mathematical character sets that<br />

are essential <strong>to</strong> T E X’s main hallmark, mathematical typesetting. So Knuth<br />

created pixel fonts that could be sent <strong>to</strong> every printer ensuring the same<br />

results everywhere.<br />

Today the situation with fonts has changed dramatically. Outline fonts<br />

(also known as type 1 fonts) are more compact <strong>and</strong> versatile than the pixel<br />

fonts (type 3). They also have a far superior appearance <strong>and</strong> are drawn<br />

much faster in PDF files. The original Computer Modern fonts have been<br />

converted <strong>to</strong> outline fonts, but there is no reason <strong>to</strong> stick with them,<br />

except possibly for the mathematical symbols. It is L AT E X 2ε with its New


1.3. T E X <strong>and</strong> its offspring 9<br />

Font Selection Scheme that freed T E X from its rigid marriage <strong>to</strong> Computer<br />

Modern.<br />

Fonts are discussed in more detail in Appendix G.<br />

1.3.6 The L AT E X bazaar: user contributions<br />

Like the T E X program on which is relies, L AT E X is freeware. There may be<br />

a prejudice that what is free in not worth anything, but there are other<br />

examples in the computer world <strong>to</strong> contradict this statement. And since<br />

the L AT E X macros are provided in files containing plain text, there is no<br />

problem <strong>to</strong> exchange, modify, <strong>and</strong> supplement them. In other words, the<br />

user can participate in extending the basic L AT E X system.<br />

Taking advantage of a mechanism in L AT E X 2.09 that allowed options<br />

<strong>to</strong> the default layouts <strong>to</strong> be contained in so-called style option files, many<br />

users began writing their own ‘options’ <strong>to</strong> provide additional features <strong>to</strong><br />

the basic L AT E X. They then made these available <strong>to</strong> other users via the<br />

Internet. Many were intended for very specific problems, but many more<br />

proved <strong>to</strong> be of such general usefulness that they have become part of the<br />

st<strong>and</strong>ard L AT E X installation. In this way, the users themselves have built<br />

up a system that meets their needs.<br />

With L AT E X 2ε, these user contributions acquired official status: they<br />

became known as packages, they could be entered directly in<strong>to</strong> the document<br />

<strong>and</strong> not by the back door, guidelines were issued for writing them,<br />

<strong>and</strong> additional comm<strong>and</strong>s were introduced <strong>to</strong> assist package programming.<br />

Package files bear the extension.sty from L AT E X 2.09 days, so that<br />

the older style option files may still function as packages <strong>to</strong>day.<br />

Those packages that have established themselves as indispensable<br />

for sophisticated L AT E X processing are described in this book in those<br />

sections where they are most relevant. This does not imply that other<br />

packages are less worthwhile, but simply that this book does have <strong>to</strong><br />

make a selection. Many other packages are described fully in The L AT E X<br />

Companion (Goossens et al., 1994) <strong>and</strong> it would go beyond the bounds of<br />

this book <strong>to</strong> reproduce it here.<br />

1.3.7 L AT E X <strong>and</strong> electronic publishing<br />

The most significant development in computer usage in the last decade<br />

is the rise of the World Wide Web (or the hijacking of the Internet by the<br />

glitzy society). L AT E X makes its own contribution here with<br />

• programs <strong>to</strong> convert L AT E X files <strong>to</strong> HTML (Appendix E);<br />

• means of creating PDF output, with hypertext features such as links,<br />

bookmarks, active but<strong>to</strong>ns (Chapter 10);


10 Chapter 1. Introduction<br />

• interfacing <strong>to</strong> XML both by acting as an engine <strong>to</strong> render XML documents<br />

<strong>and</strong> with programs <strong>to</strong> convert L AT E X <strong>to</strong> XML <strong>and</strong> vice versa<br />

(Appendix E).<br />

All these forms of electronic publishing are alternatives <strong>to</strong> traditional<br />

paper output. We do not expect paper <strong>to</strong> disappear entirely so quickly,<br />

but it is rapidly being replaced by electronic forms, which can always<br />

reproduce the paper whenever needed.<br />

1.4 How <strong>to</strong> use this book<br />

This <strong>Guide</strong> is meant <strong>to</strong> be a mixture of textbook <strong>and</strong> reference manual.<br />

It explains all the essential elements of the current st<strong>and</strong>ard L AT E X 2ε, but<br />

compared <strong>to</strong> Lamport (1985, 1994), it goes in<strong>to</strong> more detail, offers more<br />

examples <strong>and</strong> exercises, <strong>and</strong> describes many ‘tricks’ based on the authors’<br />

experiences. It explains not only the core L AT E X installation, but also many<br />

of the contributed packages that have become essential <strong>to</strong> modern L AT E X<br />

processing, <strong>and</strong> thus quasi-st<strong>and</strong>ard. We necessarily have <strong>to</strong> be selective,<br />

for we cannot go <strong>to</strong> the same extend as The L AT E X Companion (Goossens et<br />

al., 1994), The L AT E X Graphics Companion (Goossens et al., 1997), <strong>and</strong> The<br />

L AT E X Web Companion (Goossens <strong>and</strong> Rahtz, 1999), which are still valid<br />

companions <strong>to</strong> this book.<br />

The first part of the book is entitled The Basics, <strong>and</strong> deals with the more<br />

fundamental aspects of L AT E X: inputting text <strong>and</strong> symbols, document organization,<br />

lists <strong>and</strong> tables, entering mathematics, <strong>and</strong> cus<strong>to</strong>mizations by<br />

the user. The second part is called Beyond the Basics, meaning it presents<br />

concepts which may be more advanced but which are still essential <strong>to</strong><br />

producing complex, sophisticated documents. The distinction is rather<br />

arbitrary. Finally, the appendices contain <strong>to</strong>pics that are not directly part<br />

of L AT E X itself, but useful for underst<strong>and</strong>ing its applications: installation,<br />

error messages, creating packages, World Wide Web, fonts. Appendix H<br />

is an alphabetized summary of most of the comm<strong>and</strong>s <strong>and</strong> their use,<br />

cross-referenced <strong>to</strong> their locations in the main text.<br />

1.4.1 Some conventions<br />

In the description of comm<strong>and</strong> syntax, typewriter type is used <strong>to</strong> indicate<br />

those parts that must be entered exactly as given, while italic is reserved<br />

for those parts that are variable or for the text itself. For example, the<br />

comm<strong>and</strong> <strong>to</strong> produce tables is presented as follows:<br />

\begin{tabular}{col form} lines \end{tabular}<br />

The parts in typewriter type are obliga<strong>to</strong>ry, while col form st<strong>and</strong>s for the<br />

definition of the column format that must be inserted here. The allowed


1.5. Basics of a L AT E X file 11<br />

values <strong>and</strong> their combinations are given in the detailed descriptions of<br />

the comm<strong>and</strong>s. In the above example, lines st<strong>and</strong>s for the line entries in<br />

the table <strong>and</strong> are thus part of the text itself.<br />

Sections describing a package, an extension <strong>to</strong> basic LAT Package:<br />

EX, have the<br />

sample name of that package printed as a marginal note, as demonstrated here<br />

for this paragraph. In this way, you are reminded that you must include<br />

it with \usepackage (Section 3.1.2) in order <strong>to</strong> obtain the additional<br />

features. Without it, you are likely <strong>to</strong> get an error message about undefined<br />

comm<strong>and</strong>s.<br />

Sections of text that are printed in a smaller typeface <strong>to</strong>gether with the boxed<br />

! exclamation mark at the left are meant as an extension <strong>to</strong> the basic description.<br />

They may be skipped over on a first reading. This information presents deeper<br />

insight in<strong>to</strong> the workings of LAT EX than is necessary for everyday usage, but which<br />

is invaluable for creating more refined control over the output.<br />

1.5 Basics of a L AT E X file<br />

1.5.1 Text <strong>and</strong> comm<strong>and</strong>s<br />

The source file for L AT E X processing, or simply the L AT E X file, contains the<br />

source text that is <strong>to</strong> be processed <strong>to</strong> produce the printed output. Splitting<br />

the text up in<strong>to</strong> lines of equal width, formatting it in<strong>to</strong> paragraphs, <strong>and</strong><br />

breaking it in<strong>to</strong> pages with page numbers <strong>and</strong> running heads are all<br />

functions of the processing program <strong>and</strong> not of the input text itself.<br />

For example, words in the source text are strings of letters terminated<br />

by some non-letter, such as punctuation, blanks, or end-of-lines (hard<br />

end-of-lines, ones that are really there, not the soft ones that move with<br />

the window width); whereas punctuation marks will be transferred <strong>to</strong> the<br />

output, blanks <strong>and</strong> end-of-lines merely indicate a gap between words.<br />

Multiple blanks in the input, or blanks at the beginning of a line, have no<br />

effect on the interword spacing in the output.<br />

Similarly, a new paragraph is indicated in the input text by an empty<br />

line; multiple empty lines have the same effect as a single one. In the<br />

output, the paragraph may be formatted either by indentation of the first<br />

line, or by extra interline spacing, but this is not affected in any way by<br />

the number of blank lines or extra spaces in the input.<br />

The source file contains more than just text, however; it is also interspersed<br />

with markup comm<strong>and</strong>s that control the formatting or indicate<br />

the structure. It is therefore necessary for the author <strong>to</strong> be able <strong>to</strong> recognize<br />

what is text <strong>and</strong> what is a comm<strong>and</strong>. Comm<strong>and</strong>s consist either<br />

of certain single characters that cannot be used as text characters, or of<br />

words preceded immediately by a special character, the backslash (\).<br />

The syntax of source text is explained in detail in Chapter 2.


12 Chapter 1. Introduction<br />

1.5.2 Contents of a L AT E X source file<br />

Every L AT E X file contains a preamble <strong>and</strong> a body.<br />

The preamble is a collection of comm<strong>and</strong>s that specify the global<br />

processing parameters for the following text, such as the paper format,<br />

the height <strong>and</strong> width of the text, the form of the output page with its<br />

pagination <strong>and</strong> au<strong>to</strong>matic page heads <strong>and</strong> footlines. As a minimum, the<br />

preamble must contain the comm<strong>and</strong> \documentclass <strong>to</strong> specify the<br />

document’s overall processing type. This is the first comm<strong>and</strong> in the<br />

preamble.<br />

If there are no other comm<strong>and</strong>s in the preamble, L AT E X selects st<strong>and</strong>ard<br />

values for the line width, margins, paragraph spacing, page height <strong>and</strong><br />

width, <strong>and</strong> much more. By default, these specifications are tailored <strong>to</strong><br />

the American norms. For European requirements, built-in options exist <strong>to</strong><br />

alter the text height <strong>and</strong> width <strong>to</strong> the A4 st<strong>and</strong>ard. Furthermore, there are<br />

language-specific packages <strong>to</strong> translate certain headings such as ‘Chapter’<br />

<strong>and</strong> ‘Abstract’.<br />

The preamble ends with \begin{document}. Everything that follows<br />

this comm<strong>and</strong> is interpreted as body. It consists of the actual text mixed<br />

with markup comm<strong>and</strong>s. In contrast <strong>to</strong> those in the preamble, these<br />

comm<strong>and</strong>s have only a local effect, meaning they apply only <strong>to</strong> a part of<br />

the text, such as indentation, equations, temporary change of font, <strong>and</strong> so<br />

on. The body ends with the comm<strong>and</strong> \end{document}. This is normally<br />

the end of the file as well.<br />

The general syntax of a L AT E X file is as follows:<br />

\documentclass[options]{class}<br />

Further global comm<strong>and</strong>s <strong>and</strong> specifications<br />

\begin{document}<br />

Text mixed with additional comm<strong>and</strong>s of local effect<br />

\end{document}<br />

The possible options <strong>and</strong> classes that may appear in the \documentclass<br />

comm<strong>and</strong> are presented in Section 3.1.1.<br />

A minimal L AT E X file named hi.tex contains just the following lines:<br />

\documentclass{article}<br />

\begin{document}<br />

Hi!<br />

\end{document}<br />

1.5.3 Extending L AT E X with packages<br />

Packages are a very important feature of L AT E X. These are extensions <strong>to</strong><br />

the basic L AT E X comm<strong>and</strong>s that are written <strong>to</strong> files with names that end<br />

in.sty <strong>and</strong> are loaded with the comm<strong>and</strong> \usepackage in the preamble.<br />

Packages can be classified by their origin:


1.5. Basics of a L AT E X file 13<br />

core packages are an integral part of the L AT E X basic installation <strong>and</strong> are<br />

therefore fully st<strong>and</strong>ard;<br />

<strong>to</strong>ols packages are a set written by members of the L AT E X3 Team, <strong>and</strong><br />

should always be in the installation;<br />

graphics packages are a st<strong>and</strong>ardized set for including pictures generated<br />

by other programs, <strong>and</strong> for h<strong>and</strong>ling color; they are on the same<br />

level as the <strong>to</strong>ols packages;<br />

A M S-L AT E X packages published by the American Mathematical Society,<br />

should be in any installation;<br />

contributed packages have been submitted by actual users; certain of<br />

these have established themselves as ‘essential’ <strong>to</strong> st<strong>and</strong>ard L AT E X<br />

usage, but all are useful.<br />

Only a limited number of these packages are described in this book, those<br />

that we consider indispensable. However, there is nothing <strong>to</strong> prevent<br />

the user from obtaining <strong>and</strong> incorporating any others that should prove<br />

beneficial for his or her purposes.<br />

There are over 1000 contributed packages on the included T E XLive CD.<br />

How can one begin <strong>to</strong> get an overview of what they offer? Graham Williams<br />

has compiled a list of brief descriptions which can be found online <strong>and</strong><br />

on the T E XLive CD at<br />

\texmf\doc\html\catalogue\catalogue.html<br />

How <strong>to</strong> load packages in<strong>to</strong> the L AT E X source file is explained in Section<br />

3.1.2.<br />

Documentation of contributed packages is somewhat haphazard, depending<br />

on how much the author has put in<strong>to</strong> it. The preferred method<br />

for distributing packages is <strong>to</strong> integrate the documentation with the<br />

code in<strong>to</strong> a single file with extension .dtx. A special program DocStrip<br />

(Section D.7.1) is used <strong>to</strong> extract the actual package file or files, while<br />

L AT E Xing the original .dtx file produces the instruction manual. Most<br />

ready-<strong>to</strong>-run installations will already have done all this for the user,<br />

with the resulting manuals s<strong>to</strong>red as DVI or PDF files somewhere in<br />

\texmf\doc\latex\. . . . However, you might have <strong>to</strong> generate the documentation<br />

output yourself by processing the.dtx file, which should be<br />

found in \texmf\source\latex\. . . . (Section B.3 explains the organization<br />

of the T E X direc<strong>to</strong>ry system.)<br />

Some package authors write their manuals as an extra .tex file, the<br />

output of which may or may not be pres<strong>to</strong>red in DVI or PDF form. Others<br />

provide HTML files. And still others simply add the instructions as<br />

comments in the package file itself. (This illustrates some of the joys of<br />

an open system.)


14 Chapter 1. Introduction<br />

1.6 T E X processing procedure<br />

Since L AT E X is a set of definitions for the T E X program, L AT E X processing itself<br />

is in fact T E X processing with the L AT E X format. What T E X does with this is<br />

the same as for any other of the many formats available (of which L AT E X is<br />

perhaps the most popular). All the typesetting work is done by T E X, while<br />

L AT E X h<strong>and</strong>les the conversion from the logical markup <strong>to</strong> the typesetting<br />

comm<strong>and</strong>s. It also enables cross-referencing, running headlines, table<br />

of contents, literature citations <strong>and</strong> bibliography, indexing, <strong>and</strong> more.<br />

However, the processing of the source file <strong>to</strong> final output is T E X’s task,<br />

regardless of the format being used.<br />

1.6.1 In the good old days<br />

T E X arose over 20 years ago before there were such things as PCs, graphical<br />

displays, <strong>and</strong> before computers were infected with windows or mice. T E X<br />

<strong>and</strong> its support programs were invoked from a comm<strong>and</strong> line, not with<br />

a mouse click. This may sound very old fashioned, but it did guarantee<br />

portability <strong>to</strong> all computer types.<br />

The processing steps that were taken in those days still exist with<br />

<strong>to</strong>day’s graphical interfaces, but are now executed more conveniently.<br />

One can still open a ‘comm<strong>and</strong> prompt window’ <strong>and</strong> run them from the<br />

comm<strong>and</strong> line.<br />

The first step is of course <strong>to</strong> use a text edi<strong>to</strong>r program <strong>to</strong> write the<br />

source file containing the actual text <strong>and</strong> markup. The rules for entering<br />

this source text are explained in Chapter 2. It goes in<strong>to</strong> a text file, or what<br />

is often called an ‘ascii’ file containing only st<strong>and</strong>ard punctuation marks,<br />

numbers, unaccented letters, upper <strong>and</strong> lower case. In other words, the<br />

text is that which can be produced from a st<strong>and</strong>ard English typewriter.<br />

The name of the source file normally has the extension.tex; it is then<br />

processed by T E X <strong>to</strong> produce a new file with the same base name <strong>and</strong> the<br />

extension.dvi, for device independent file. This is a binary file (all codes<br />

possible, not a text file) containing precise instructions for the selection<br />

<strong>and</strong> placement of every symbol, a coded description of the final printed<br />

page. The comm<strong>and</strong> <strong>to</strong> invoke T E X with the source file hi.tex is<br />

tex &latex hi<br />

meaning run the T E X program with the format latex. Usually the installation<br />

has defined a shortcut named latex <strong>to</strong> do this, so<br />

latex hi<br />

should be sufficient. It is only necessary <strong>to</strong> specify the extension of the<br />

source file name if it is something other than.tex.<br />

During the processing, T E X writes information, warnings, error messages<br />

<strong>to</strong> the computer moni<strong>to</strong>r, <strong>and</strong> <strong>to</strong> a transcript file with the extension<br />

.log. It is well worth inspecting this file when unexpected results appear.


1.6. T E X processing procedure 15<br />

The final step is <strong>to</strong> produce the printed pages from the DVI file. This<br />

requires another program, a driver, <strong>to</strong> generate the instructions specific<br />

<strong>to</strong> the given printer. For example, <strong>to</strong> produce a PostScript file, one runs<br />

dvips hi<br />

<strong>to</strong> obtain hi.ps from hi.dvi. And then one sends hi.ps <strong>to</strong> the PostScript<br />

printer with the regular comm<strong>and</strong> for that computer system.<br />

Previewing the DVI file on a computer moni<strong>to</strong>r before printing was<br />

a later development, requiring high quality graphics displays. These<br />

programs are essentially special drivers that send the output directly <strong>to</strong><br />

the moni<strong>to</strong>r rather than <strong>to</strong> a printer or printer file. One very popular<br />

previewer is called with<br />

xdvi hi<br />

<strong>to</strong> view hi.dvi before committing it <strong>to</strong> paper.<br />

1.6.2 And <strong>to</strong>day<br />

The various steps for L AT E X processing described above are still necessary<br />

<strong>to</strong>day, <strong>and</strong> one can open up a comm<strong>and</strong> prompt window <strong>and</strong> carry them<br />

out just as before. However, there now exist intelligent edi<strong>to</strong>rs with L AT E Xsavvy<br />

that not only assist writing the source text, but also will call the<br />

various programs, T E X, previewer, printer driver, BIBT E X, MakeIndex (these<br />

are explained later) with a mouse click.<br />

One such edi<strong>to</strong>r for Windows, available on the enclosed T E XLive CD in<br />

the support direc<strong>to</strong>ry, is called WinShell, written by Ingo H. de Boer (www.<br />

winshell.de). Although free of charge, its author appreciates donations<br />

<strong>to</strong> offset his expenses.<br />

Another such edi<strong>to</strong>r <strong>and</strong> L AT E X interface is WinEdt by Aleks<strong>and</strong>er Simonic<br />

(www.winedt.com). A sample window with the opening text of this<br />

chapter is shown in Figure 1.1. This program is available for a 30-day trial<br />

period, after which one must pay a nominal fee <strong>to</strong> obtain a licence. It is<br />

the edi<strong>to</strong>r that we ourselves use <strong>and</strong> we can highly recommend it.<br />

An alternative is LyX, a free, open source software for document processing<br />

in near WYSIWYG, acting as a front-end <strong>to</strong> L AT E X, where the user<br />

need not know anything about L AT E X. See its home page at www.lyx.org.<br />

It must be stressed that all the above are interfaces <strong>to</strong> an existing L AT E X<br />

installation. On the other h<strong>and</strong>, there are also commercial packages which<br />

include both the T E X/L AT E X installation <strong>and</strong> a graphics interface. These are<br />

listed in Section B.1.1.<br />

1.6.3 Alternative <strong>to</strong> T E X: pdfT E X<br />

As we mentioned earlier, it is permitted <strong>to</strong> use the T E X source code <strong>to</strong><br />

generate something else, as long as it bears another name. One such


16 Chapter 1. Introduction<br />

Figure 1.1: Sample display with the WinEdt edi<strong>to</strong>r for interfacing <strong>to</strong> L AT E X.<br />

modification is called pdfT E X, created by Hàn Thê ´ Thành. This program<br />

does everything T E X does, but it optionally writes its output directly <strong>to</strong> a<br />

PDF file, bypassing the DVI output of regular T E X. It therefore combines<br />

the T E X program with a DVI-<strong>to</strong>-PDF driver program. Normally this option<br />

is also the default.<br />

There are many advantages <strong>to</strong> producing PDF output directly this way,<br />

apart from saving a step. The PDF file is generated in exactly the same way<br />

as the DVI file with T E X, <strong>and</strong> can be viewed immediately with the Acrobat<br />

Reader or other PDF viewer. The results can be sent directly <strong>to</strong> a printer<br />

without going through the DVI-<strong>to</strong>-Printer program. It is also much easier<br />

<strong>to</strong> include the hypertext features of a true active PDF file, as we explain in<br />

Section 10.2.4.<br />

Adding the L AT E X macros <strong>to</strong> pdfT E X produces something one could call<br />

pdfL AT E X. This distinction is only meaningful for invoking the programplus-format<br />

<strong>to</strong> process the L AT E X source file. Except for some things that<br />

we note in Section 10.2.3, L AT E X comm<strong>and</strong>s are identical whether used with<br />

T E X or with pdfT E X. This makes the conversion extremely easy.<br />

The rest of this book deals essentially with L AT E X itself, regardless of<br />

what the end product is <strong>to</strong> be: paper, HTML, XML, or PDF.


2<br />

Text, Symbols, <strong>and</strong><br />

Comm<strong>and</strong>s<br />

The text that is <strong>to</strong> be the input <strong>to</strong> a L AT E X processing run is written <strong>to</strong> a<br />

source file with a name ending in.tex, the file name extension. This file is<br />

prepared with a text edi<strong>to</strong>r, either one that h<strong>and</strong>les straightforward plain<br />

text, or one that is configured <strong>to</strong> assist the writing <strong>and</strong> processing of L AT E X<br />

files. In either case, the contents of this file are plain ascii characters<br />

only, with no special symbols, no accented letters, preferably displayed in<br />

a fixed width typewriter font, with no frills like bold or italics, all in one<br />

size. All these aspects of true typesetting are produced afterwards by<br />

the T E X processing program with the help of markup comm<strong>and</strong>s inserted<br />

visibly in<strong>to</strong> the actual text. It is therefore vital <strong>to</strong> know how comm<strong>and</strong>s<br />

are distinguished from text that is <strong>to</strong> be printed, <strong>and</strong>, of course, how they<br />

function.<br />

(However, for languages other than English, native keyboard input may<br />

indeed be used, as shown in Section 2.5.9.)<br />

2.1 Comm<strong>and</strong> names <strong>and</strong> arguments<br />

A comm<strong>and</strong> is an instruction <strong>to</strong> L AT E X <strong>to</strong> do something special, like print<br />

some symbol or text not available <strong>to</strong> the restricted character set used<br />

in the input file, or <strong>to</strong> change the current typeface or other formatting<br />

properties. There are three types of comm<strong>and</strong> names:<br />

• the single characters # $ & ˜ _ ˆ % { } all have special meanings<br />

that are explained later in this chapter;<br />

• the backslash character \ plus a single non-letter character; for<br />

example \$ <strong>to</strong> print the $ sign; all the special characters listed above<br />

have a corresponding two-character comm<strong>and</strong> <strong>to</strong> print them literally;<br />

• the backslash character \ plus a sequence of letters, ending with the<br />

first non-letter; for example, \large <strong>to</strong> switch <strong>to</strong> a larger typeface.<br />

17


18 Chapter 2. Text, Symbols, <strong>and</strong> Comm<strong>and</strong>s<br />

Comm<strong>and</strong> names are case sensitive, so \large, \Large <strong>and</strong> \LARGE<br />

are distinct comm<strong>and</strong>s.<br />

Many comm<strong>and</strong>s operate on some short piece of text, which then<br />

appears as an argument in curly braces following the comm<strong>and</strong> name.<br />

For example, \emph{stress} is given <strong>to</strong> print the word stress in an<br />

emphasized typeface (here italic) as stress. Such arguments are said <strong>to</strong> be<br />

m<strong>and</strong>a<strong>to</strong>ry because they must always be given.<br />

Some comm<strong>and</strong>s take optional arguments, which are normally employed<br />

<strong>to</strong> modify the effects of the comm<strong>and</strong> somehow. The optional<br />

arguments appear in square braces.<br />

In this book we present the general syntax of comm<strong>and</strong>s as<br />

\name[optional]{m<strong>and</strong>a<strong>to</strong>ry}<br />

where typewriter characters must be typed exactly as illustrated <strong>and</strong><br />

italic text indicates something that must be substituted for. Optional<br />

arguments are put in<strong>to</strong> square brackets [ ] <strong>and</strong> the m<strong>and</strong>a<strong>to</strong>ry ones in<strong>to</strong><br />

curly braces { }. A comm<strong>and</strong> may have several optional arguments, each<br />

one in its set of brackets in the specified sequence. If none of the optional<br />

arguments is used, the square brackets may be omitted. Any number of<br />

blanks, or even a single new line, may appear between the comm<strong>and</strong> name<br />

<strong>and</strong> the arguments, <strong>to</strong> improve legibility.<br />

Some comm<strong>and</strong>s have several m<strong>and</strong>a<strong>to</strong>ry arguments. Each one must<br />

be put in<strong>to</strong> a { } pair <strong>and</strong> their sequence must be maintained as given in<br />

the comm<strong>and</strong> description. For example,<br />

\rule[lift]{width}{height}<br />

produces a black rectangle of size width <strong>and</strong> height, raised by an amount<br />

lift above the current baseline. A rectangle of width 10 mm <strong>and</strong> height<br />

3 mm is made with \rule{10mm}{3mm}. Since the optional argument lift<br />

is omitted, the rectangle is set on the baseline with no lifting, as .<br />

The arguments must appear in the order specified by the syntax <strong>and</strong> may<br />

not be interchanged.<br />

Some comm<strong>and</strong>s have a so-called *-form in addition <strong>to</strong> their normal<br />

appearance. A * is added <strong>to</strong> their name <strong>to</strong> modify their functionality<br />

somehow. For example, the \section comm<strong>and</strong> has a *-form \section*<br />

which, unlike the regular form, does not print an au<strong>to</strong>matic section number.<br />

For each such comm<strong>and</strong>, the difference between the normal <strong>and</strong><br />

*-form will be explained in the description of the individual comm<strong>and</strong>s.<br />

Comm<strong>and</strong> names consist only of letters, with the first non-letter indicating<br />

the end of the name. If there are optional or m<strong>and</strong>a<strong>to</strong>ry arguments<br />

following the comm<strong>and</strong> name, then it ends before the [ or { bracket,<br />

since these characters are not letters. Many comm<strong>and</strong>s, however, possess<br />

no arguments <strong>and</strong> are composed of only a name, such as the comm<strong>and</strong><br />

\<strong>LaTeX</strong> <strong>to</strong> produce the L AT E X logo. If such a comm<strong>and</strong> is followed by


2.2. Environments 19<br />

a punctuation mark, such as comma or period, it is obvious where the<br />

comm<strong>and</strong> ends. If it is followed by a normal word, the blank between<br />

the comm<strong>and</strong> name <strong>and</strong> the next word is interpreted as the comm<strong>and</strong><br />

termina<strong>to</strong>r: The \<strong>LaTeX</strong> logo results in ‘The L AT E Xlogo’, that is, the blank<br />

was seen only as the end of the comm<strong>and</strong> <strong>and</strong> not as spacing between<br />

two words. This is a result of the special rules for blanks, described in<br />

Section 2.5.1.<br />

In order <strong>to</strong> insert a space after a comm<strong>and</strong> that consists only of a name,<br />

either an empty structure {} or a space comm<strong>and</strong> (\ <strong>and</strong> blank) must be<br />

placed after the comm<strong>and</strong>. The proper way <strong>to</strong> produce ‘The L AT E X logo’ is<br />

<strong>to</strong> type either The \<strong>LaTeX</strong>{} logo or The \<strong>LaTeX</strong>\ logo. Alternatively,<br />

the comm<strong>and</strong> itself may be put in<strong>to</strong> curly braces, as The {\TeX} logo,<br />

which also yields the right output with the inserted blank: ‘The T E X logo’.<br />

Incidentally, the L AT E X 2ε logo is produced with \<strong>LaTeX</strong>e. Can you see why<br />

this logo comm<strong>and</strong> cannot be named \<strong>LaTeX</strong>2e?<br />

2.2 Environments<br />

An environment is initiated with the comm<strong>and</strong> \begin{name} <strong>and</strong> is<br />

terminated by \end{name}.<br />

An environment has the effect that the text within it is treated differently<br />

according <strong>to</strong> the environment parameters. It is possible <strong>to</strong> alter<br />

(temporarily) certain processing features, such as indentation, line width,<br />

typeface, <strong>and</strong> much more. The changes apply only within the environment.<br />

For example, with the quote environment,<br />

previous text<br />

\begin{quote}<br />

text1 \small text2 \bfseries text3<br />

\end{quote}<br />

following text<br />

the left <strong>and</strong> right margins are increased relative <strong>to</strong> those of the previous<br />

<strong>and</strong> following texts. In the example, this applies <strong>to</strong> the three texts text1,<br />

text2, <strong>and</strong> text3. After text1 comes the comm<strong>and</strong> \small, which has the<br />

effect of setting the next text in a smaller typeface. After text2, there is an<br />

additional comm<strong>and</strong> \bfseries <strong>to</strong> switch <strong>to</strong> bold face type. Both these<br />

comm<strong>and</strong>s only remain in effect up <strong>to</strong> the \end{quote}.<br />

The three texts within the quote environment are indented on<br />

both sides relative <strong>to</strong> the previous <strong>and</strong> following texts. The<br />

text1 appears in the normal typeface, the same one as outside<br />

the environment. The text2 <strong>and</strong> text3 appear in a smaller typeface,<br />

<strong>and</strong> text3 furthermore appears in bold face.<br />

After the end of the quote environment, the subsequent text appears in<br />

the same typeface that was in effect beforeh<strong>and</strong>.


20 Chapter 2. Text, Symbols, <strong>and</strong> Comm<strong>and</strong>s<br />

Note that if the names of the environment in the \begin{..} \end{..}<br />

pair do not match, an error message will be issued on processing.<br />

Most declaration comm<strong>and</strong> names (see next section) may also be used<br />

as environment names. In this case the comm<strong>and</strong> name is used without<br />

the preceding \ character. For example, the comm<strong>and</strong> \em switches <strong>to</strong><br />

an emphatic typeface, usually italic, <strong>and</strong> the corresponding environment<br />

\begin{em} will set all the text in italic until \end{em} is reached.<br />

A nameless environment can be simulated by a {...} pair. The effect<br />

of any comm<strong>and</strong> within it ends with the closing curly brace.<br />

The user can even create his or her own environments, as described in<br />

Section 8.4.<br />

2.3 Declarations<br />

A declaration is a comm<strong>and</strong> that changes the values or meanings of<br />

certain parameters or comm<strong>and</strong>s without printing any text. The effect of<br />

the declaration begins immediately <strong>and</strong> ends when another declaration<br />

of the same type is encountered. However, if the declaration occurs<br />

within an environment or a {...} pair, its scope extends only <strong>to</strong> the<br />

corresponding \end comm<strong>and</strong>, or <strong>to</strong> the closing brace }. The comm<strong>and</strong>s<br />

\bfseries <strong>and</strong> \small mentioned in the previous section are examples<br />

of such non-printing declarations that alter the current typeface.<br />

Some declarations have associated arguments, such as the comm<strong>and</strong><br />

\setlength which assigns a value <strong>to</strong> a length parameter (see Sections 2.4<br />

<strong>and</strong> 8.2).<br />

Examples:<br />

{\bfseries This text appears in bold face} The \bfseries declaration<br />

changes the typeface: This text appears in bold face. The<br />

effect of this declaration ends with the closing brace }.<br />

\setlength{\parindent}{0.5cm} The paragraph indentation is set <strong>to</strong><br />

0.5 cm. The effect of this declaration ends with the next encounter<br />

of the comm<strong>and</strong> \setlength{\parindent}, or at the latest with<br />

the \end comm<strong>and</strong> that terminates the current environment.<br />

\pagenumbering{roman} The page numbering is <strong>to</strong> be printed in Roman<br />

numerals.<br />

Some declarations, such as the last example, are global, that is, their<br />

effects are not limited <strong>to</strong> the current environment. The following declarations<br />

are of this nature, the meanings of which are given later:<br />

\newcounter \pagenumbering \newlength<br />

\setcounter \thispagestyle \newsavebox<br />

\add<strong>to</strong>counter


2.4. Lengths 21<br />

Declarations made with these comm<strong>and</strong>s are effective right away <strong>and</strong><br />

remain so until they are overridden by a new declaration of the same type.<br />

In the last example above, page numbering will be done in Roman numerals<br />

until counterm<strong>and</strong>ed by a new \pagenumbering{arabic} comm<strong>and</strong>.<br />

2.4 Lengths<br />

2.4.1 Fixed lengths<br />

Lengths consist of a decimal number with a possible sign in front (+ or<br />

-) followed by a m<strong>and</strong>a<strong>to</strong>ry dimensional unit. Permissible units <strong>and</strong> their<br />

abbreviated names are:<br />

cm centimeter,<br />

mm millimeter,<br />

in inch (1 in = 2.54 cm),<br />

pt point (1 in = 72.27 pt),<br />

bp big point (1 in = 72 bp),<br />

pc pica (1 pc = 12 pt),<br />

dd didôt point (1157 dd = 1238 pt),<br />

cc cicero (1 cc = 12 dd),<br />

em a font-specific size, the width of the capital M,<br />

ex another font-related size, the height of the letter x.<br />

Decimal numbers in T E X <strong>and</strong> L AT E X may be written in either the English<br />

or European manner, with a period or a comma: both 12.5cm <strong>and</strong> 12,5cm<br />

are permitted.<br />

Note that 0 is not a legitimate length since the unit specification is<br />

missing. To give a zero length it is necessary <strong>to</strong> add some unit, such as<br />

0pt or 0cm.<br />

Values are assigned <strong>to</strong> a length parameter by means of the L AT E X comm<strong>and</strong><br />

\setlength, which is described in Section 8.2 along with other<br />

comm<strong>and</strong>s for dealing with lengths. Its syntax is:<br />

\setlength{\length name}{length spec}<br />

For example, the width of a line of text is specified by the parameter<br />

\textwidth, which is normally set <strong>to</strong> a default value depending on the<br />

class, paper type, <strong>and</strong> font size. To change the line width <strong>to</strong> be 12.5 cm,<br />

one would give:<br />

2.4.2 Rubber lengths<br />

\setlength{\textwidth}{12.5cm}<br />

Some parameters expect a rubber length. These are lengths that can be<br />

stretched or shrunk by a certain amount. The syntax for a rubber length<br />

is:


22 Chapter 2. Text, Symbols, <strong>and</strong> Comm<strong>and</strong>s<br />

nominal value plus stretch value minus shrink value<br />

where the nominal value, stretch value, <strong>and</strong> shrink value are each a length.<br />

For example,<br />

\setlength{\parskip}{1ex plus0.5ex minus0.2ex}<br />

means: the extra line spacing between paragraphs, called \parskip, is <strong>to</strong><br />

be the height of the x in the current font, but it may be increased <strong>to</strong> 1.5<br />

or reduced <strong>to</strong> 0.8 times that size.<br />

One special rubber length is \fill. This has the natural length of<br />

zero but can be stretched <strong>to</strong> any size.<br />

2.5 Special characters<br />

2.5.1 Spaces<br />

The space or blank character has some properties different from those<br />

of normal characters, some of which have already been mentioned in<br />

Section 2.1. During processing, blanks in the input text are replaced by<br />

rubber lengths (Section 2.4.2) in order <strong>to</strong> allow the line <strong>to</strong> fill up <strong>to</strong> the<br />

full line width. As a result, some peculiar effects can occur if one is not<br />

aware of the following rules:<br />

• one blank is the same as a thous<strong>and</strong>, only the first one counts;<br />

• blanks at the beginning of an input line are ignored;<br />

• blanks terminating a comm<strong>and</strong> name are removed;<br />

• the end of a line is treated as a blank.<br />

Some of the consequences of these rules are that there may be as many<br />

blanks as desired between words or at the beginning of a line (<strong>to</strong> make<br />

the input text more legible) <strong>and</strong> that a word may come right at the end of<br />

a line without the spacing between it <strong>and</strong> the next word disappearing. To<br />

force a space <strong>to</strong> appear where it would otherwise be ignored, one must<br />

give the comm<strong>and</strong> \ (a \ followed by a space character, made visible here<br />

by the symbol ).<br />

To ensure that certain words remain <strong>to</strong>gether on the same line, a protected<br />

space is inserted between them with the ˜ character (Section 2.7.1,<br />

page 28). Multiple protected spaces are all printed out, in contrast <strong>to</strong><br />

normal spaces.<br />

Sometimes it is necessary <strong>to</strong> suppress the space that appears because<br />

of the new line. In this case, the last character in the line must be the<br />

comment character % (Section 4.11).<br />

Paragraphs are separated in the source text by blank lines. As for<br />

blank characters, one blank line is the same as a thous<strong>and</strong>.


2.5. Special characters 23<br />

Instead of a blank line, the comm<strong>and</strong> \par may also be used <strong>to</strong> indicate<br />

the end of a paragraph.<br />

2.5.2 Quotation marks<br />

The quotation marks found on the typewriter " are not used in book<br />

printing. Instead different characters are used at the beginning <strong>and</strong> end,<br />

such as ‘single quotes’ <strong>and</strong> “double quotes”. Single quotes are produced<br />

with ‘ <strong>and</strong> ’, while double quotes are made by typing the respective<br />

characters twice: ‘‘ for “ <strong>and</strong> ’’ for ”. Furthermore the typewriter<br />

character " will also generate the double closing quote ”. However, it<br />

should be avoided since it can lead <strong>to</strong> confusion.<br />

2.5.3 Hyphens <strong>and</strong> dashes<br />

In book printing, the character that appears on the typewriter as - comes<br />

in various lengths: -, –, —. The smallest of these, the hyphen, is used<br />

for compound words such as father-in-law <strong>and</strong> for word division at the<br />

end of a line; the middle-sized one, the en dash, is used in ranges of<br />

numbers, for example, pages 33–36; <strong>and</strong> the largest, the em dash, is used<br />

as punctuation—what is normally called the dash. These are generated<br />

by typing the hyphen character one, two, or three times, so that - yields<br />

-, while -- makes –, <strong>and</strong> --- produces —. A fourth type of dash is the<br />

minus sign −, which is entered in math mode as $-$ (Chapter 5).<br />

2.5.4 Printing comm<strong>and</strong> characters<br />

As mentioned in Section 2.1, the characters # $ ˜ _ ˆ % { } are interpreted<br />

as comm<strong>and</strong>s. To print them as text, one must give a comm<strong>and</strong><br />

consisting of \ plus that character.<br />

$ = \$ & = \& % = \% # = \# = \_ { = \{ } = \}<br />

2.5.5 The special characters , , , , <strong>and</strong> <br />

These special characters do not exist on the computer keyboard. They<br />

can however be generated by special comm<strong>and</strong>s as follows:<br />

§ = \S † = \dag ‡ = \ddag = \P © = \copyright £ = \pounds<br />

The production of Greek letters <strong>and</strong> other mathematical symbols is<br />

described in Chapter 5.


24 Chapter 2. Text, Symbols, <strong>and</strong> Comm<strong>and</strong>s<br />

2.5.6 Non-English letters<br />

Special letters that exist in languages other than English can also be<br />

generated with T E X. These are:<br />

œ={\oe} Œ={\OE} æ={\ae} Æ={\AE} ˚a={\aa} ˚A ={\AA} ¡ =!‘<br />

ø ={\o} Ø ={\O} ł ={\l} Ł ={\L} ß={\ss} SS={\SS} ¿=?‘<br />

˚Angstrøm may be written as {\AA}ngstr{\o}m while Karlstraße can be<br />

input as Karlstra{\ss}e. The ‘letter’ \SS is the upper case equivalent<br />

of \ss, used for au<strong>to</strong>matic conversion between upper <strong>and</strong> lower case.<br />

However, see Section 2.5.9 for the possibility of entering such characters<br />

directly.<br />

2.5.7 Accents<br />

In non-English languages, there is a multiplicity of diacritical marks or<br />

accents, most of which can be printed with T E X:<br />

ò =\‘{o} ó=\’{o} ô=\ˆ{o} ö=\"{o} õ=\˜{o}<br />

ō =\={o} ˙o=\.{o} ŏ=\u{o} ǒ=\v{o} ő=\H{o}<br />

oo=\t{oo} o¸=\c{o} o . =\d{o} ō=\b{o} ˚o=\r{o}<br />

The o above is given merely as an example: any letter may be used. With<br />

i <strong>and</strong> j it should be pointed out that the dot must first be removed. This<br />

is carried out by prefixing these letters with a backslash: the comm<strong>and</strong>s<br />

\i <strong>and</strong> \j yield ı <strong>and</strong> j. In this way ĭ <strong>and</strong> ˝j are formed by typing \u{\i}<br />

<strong>and</strong> \H{\j}.<br />

The accent comm<strong>and</strong>s consisting of a non-letter may also be given<br />

without the curly braces:<br />

ò=\‘o ó=\’o ô=\ˆo ö=\"o õ=\˜o ō=\=o ˙o=\.o<br />

The letter accent comm<strong>and</strong>s should always be used with the curly braces.<br />

2.5.8 The euro symbol<br />

Package:<br />

textcomp<br />

The euro symbol € (or e) is <strong>to</strong>o new <strong>to</strong> be part of the original L AT E X, but it<br />

can be produced with the help of some additional fonts <strong>and</strong> contributed<br />

packages. Just which package you may use depends on your installation,<br />

<strong>and</strong> whether you have access <strong>to</strong> these additional fonts.<br />

The Text Companion fonts, described in Section G.4.4, do contain a<br />

euro symbol. Since these fonts should be part of every modern L AT E X<br />

installation, you should be able <strong>to</strong> use their euro symbol if all else fails.<br />

The package textcomp must be loaded in the preamble with<br />

\usepackage{textcomp}


2.5. Special characters 25<br />

which defines many comm<strong>and</strong>s including \texteuro <strong>to</strong> print the symbol<br />

€. Since the European Commission originally dictated that it should only<br />

be printed in a sans serif font, it is better <strong>to</strong> issue \textsf{\texteuro} <strong>to</strong><br />

produce €. (The font selection comm<strong>and</strong>s are described in Section 4.1.4.)<br />

If you are going <strong>to</strong> use this very frequently, you might want <strong>to</strong> define a<br />

shortcut named \euro with<br />

\newcomm<strong>and</strong>{\euro}{\textsf{\texteuro}}<br />

as described in Section 8.3 on defining comm<strong>and</strong>s.<br />

Package: A better solution is presented by the eurosym package by Henrik<br />

eurosym Theiling <strong>and</strong> the associated fonts that come with it, which bear the names<br />

feymr10, feybr10, <strong>and</strong> so on. This package defines the \euro comm<strong>and</strong><br />

<strong>to</strong> print e, which changes au<strong>to</strong>matically <strong>to</strong> bold e <strong>and</strong> slanted e as<br />

needed.<br />

Package: The europs package by Joern Clausen interfaces <strong>to</strong> the type 1 (Posteurops<br />

Script) euro fonts published by Adobe. For licensing reasons, these fonts<br />

may only be obtained from Adobe directly, even though free of charge<br />

(see Section B.2). This package provides the comm<strong>and</strong> \EUR for a symbol<br />

that varies with font family (Roman €25, sans serif €25, <strong>and</strong> typewriter<br />

€25) as well as for bold €25 <strong>and</strong> slanted €25. There is also a comm<strong>and</strong><br />

\EURofc for the invariable symbol €.<br />

Package: Finally, the package eurosans by Walter Schmidt also addresses the<br />

eurosans Adobe euro fonts, again with the comm<strong>and</strong> \euro, with the same behavior<br />

as that of eurosym: always sans serif family, but changes with the other<br />

font attributes.<br />

The table below summarizes the above packages:<br />

Package Comm<strong>and</strong> Fonts Notes<br />

textcomp \texteuro Text Companion Non st<strong>and</strong>ard symbol<br />

eurosym \euro Eurosym Sans serif, variable<br />

europs \EUR PostScript Varies with font family<br />

\EURofc Invariable, official<br />

eurosans \euro PostScript Sans serif, variable<br />

So which package should one use? That really depends on the fonts<br />

available. Since the Adobe fonts can never be distributed with a T E X<br />

installation, they must be actively fetched <strong>and</strong> installed. However, it is<br />

worth doing so, because the European Commission has revised its initial<br />

directive <strong>and</strong> now allows the euro symbol <strong>to</strong> be typographically matched <strong>to</strong><br />

the text, which is also st<strong>and</strong>ard practice in Europe <strong>to</strong>day. This strengthens<br />

the case for the europs package <strong>and</strong> the \EUR comm<strong>and</strong> for €, at least for<br />

Roman fonts.


26 Chapter 2. Text, Symbols, <strong>and</strong> Comm<strong>and</strong>s<br />

2.5.9 Typing special symbols directly<br />

The comm<strong>and</strong>s for producing the special characters <strong>and</strong> accented letters in<br />

! the previous sections may be suitable for typing isolated ‘foreign’ words, but<br />

become quite tedious for inputting large amounts of text making regular use of<br />

such characters. Most computer systems provide non-English keyboards with<br />

appropriate fonts for typing these national variants directly. Unfortunately, the<br />

coding of such extra symbols is by no means st<strong>and</strong>ard, depending very much on<br />

the computer system.<br />

For example, the text Gauß meets Ampère entered with an MS-DOS edi<strong>to</strong>r<br />

(code page 437 or 850) appears in a Windows application as Gauá meets AmpˇSre<br />

<strong>and</strong> on a Macin<strong>to</strong>sh as Gau meets Ampäre. Since LAT EX is intended <strong>to</strong> run on<br />

all systems, it simply ignores all such extra character codes on the grounds that<br />

they are not properly defined.<br />

The inputenc package solves this problem. It not only informs LAT Package:<br />

EX which<br />

inputenc input coding scheme is being used, it also tells it what <strong>to</strong> do with the extra<br />

characters. One invokes it with<br />

\usepackage[code]{inputenc}<br />

where code is the name of the coding scheme <strong>to</strong> be used. The current list of<br />

allowed values for code (more are added with each L AT E X update) can be found in<br />

Table D.1 on page 462. For most users, the most interesting codes are:<br />

cp437 IBM code page 437 (DOS, North America)<br />

cp850 IBM code page 850 (DOS, Western Europe)<br />

applemac Macin<strong>to</strong>sh encoding<br />

ansinew Windows ANSI encoding<br />

In short, you should select applemac for a Macin<strong>to</strong>sh, <strong>and</strong> ansinew for Windows,<br />

<strong>and</strong> one of the others if you are working with DOS.<br />

Documents making use of this package are fully portable <strong>to</strong> other computer<br />

systems. The source text produced with a DOS edi<strong>to</strong>r may still look very strange<br />

<strong>to</strong> a human user reading it on a Macin<strong>to</strong>sh, but when the Macin<strong>to</strong>sh L AT E X processes<br />

it, the proper DOS interpretations will be applied so that the end result is what<br />

the author intended.<br />

See Section D.5 for more details.<br />

2.5.10 Ligatures<br />

In book printing, certain combinations of letters are not printed as individuals<br />

but as a single symbol, a so-called ligature. T E X processes the<br />

letter combinations ff, fi, fl, ffi, <strong>and</strong> ffl not as<br />

ff, fi, fl, ffi, ffl but rather as ff, fi, fl, ffi, ffl<br />

Ligatures may be broken, that is, forced <strong>to</strong> be printed as separate letters,<br />

by inserting \/ between the letters. This is sometimes desired for such<br />

words as shelfful (shelf\/ful), which looks rather strange when printed<br />

with the normal ff ligature, shelfful.


2.5.11 The date<br />

2.6. Exercises 27<br />

The current date can be placed at any point in the text with the comm<strong>and</strong><br />

\<strong>to</strong>day. The st<strong>and</strong>ard form for the date is the American style of month,<br />

day, year (for example, January 15, 2004). The British form (15th January<br />

2004) or the date in other languages can be generated with the help of the<br />

T E X comm<strong>and</strong>s \day, \month, <strong>and</strong> \year, which return the current values<br />

of these parameters as numbers. Examples of how such a new \<strong>to</strong>day<br />

comm<strong>and</strong> may be made are shown on page 461 in Section D.4.2.<br />

It is in fact better <strong>to</strong> enter the date explicitly, rather than <strong>to</strong> rely<br />

on \<strong>to</strong>day. Reprocessing a two-year-old L AT E X source file will yield a<br />

document with the processing date, not the date when the text was<br />

written.<br />

2.6 Exercises<br />

Exercise 2.1: This exercise tests the basic operations of running the L AT E X program<br />

with a short piece of text. A few simple comm<strong>and</strong>s are also included. Use a text<br />

edi<strong>to</strong>r <strong>to</strong> produce the following source text <strong>and</strong> s<strong>to</strong>re it in a file named exer.tex.<br />

\documentclass{article}<br />

\begin{document}<br />

Today (\<strong>to</strong>day) the rate of exchange between the British<br />

pound <strong>and</strong> American dollar is \pounds 1 = \$1.58, an<br />

increase of 1\% over yesterday.<br />

\end{document}<br />

Process this source file with L AT E X by clicking the appropriate icon, or by<br />

issuing latex exer in a comm<strong>and</strong> window. If the processing occurs without any<br />

error messages, the .dvi file exer.dvi will have been successfully created <strong>and</strong><br />

may be viewed by a dvi previewer or sent <strong>to</strong> a printer. The final printed result<br />

should look as follows except that your current date will appear:<br />

Today (January 15, 2004) the rate of exchange between the British pound <strong>and</strong><br />

American dollar is £1 = $1.58, an increase of 1% over yesterday.<br />

Note the following points about the comm<strong>and</strong>s used:<br />

no blank is necessary after \<strong>to</strong>day because the ) suffices <strong>to</strong> terminate it;<br />

the blank after \pounds is optional <strong>and</strong> it is not printed in the output;<br />

the comm<strong>and</strong>s \$ <strong>and</strong> \% do not require blanks <strong>to</strong> terminate them; if blanks<br />

are given, they will be printed.<br />

Exercise 2.2: Take some text of about 3/4 of a page long out of a book or journal<br />

article <strong>and</strong> type it in<strong>to</strong> a L AT E X source file. Pay attention that the paragraphs are<br />

separated by blank lines. Use the same set of comm<strong>and</strong>s as in Exercise 2.1, that<br />

is, put the text between the comm<strong>and</strong>s \begin{document}...\end{document}<br />

<strong>and</strong> repeat the procedures for obtaining the output.


28 Chapter 2. Text, Symbols, <strong>and</strong> Comm<strong>and</strong>s<br />

Exercise 2.3: If you are likely <strong>to</strong> need the euro symbol in your work, try redoing<br />

Exercise 2.1 as follows:<br />

\documentclass{article}<br />

\usepackage{eurosym}<br />

\begin{document}<br />

Today (\<strong>to</strong>day) the rate of exchange between the British<br />

pound <strong>and</strong> European euro is \pounds 1 = \euro1.46, an<br />

increase of 1\% over yesterday.<br />

\end{document}<br />

If this fails, try one of the other packages described in Section 2.5.8, substituting<br />

\textsf{\texteuro} or \EUR for \euro as required.<br />

2.7 Fine-tuning text<br />

The subject of the section concerns pure typographical markup, <strong>and</strong> has<br />

nothing <strong>to</strong> do with the logical markup that we wish <strong>to</strong> stress in this book.<br />

Unfortunately, there are times when the author or edi<strong>to</strong>r does have <strong>to</strong><br />

help the typesetting program <strong>to</strong> achieve good appearance.<br />

2.7.1 Word <strong>and</strong> character spacing<br />

The spacing between words <strong>and</strong> characters is normally set au<strong>to</strong>matically<br />

by T E X, which not only makes use of the natural width of the characters<br />

but also takes in<strong>to</strong> account alterations for certain character combinations.<br />

For example, an A followed by a V does not appear as AV but rather as AV;<br />

that is, they are moved <strong>to</strong>gether slightly for a more pleasing appearance.<br />

Interword spacing within one line is uniform, <strong>and</strong> is chosen so that the<br />

right <strong>and</strong> left ends match exactly with the side margins. This is called<br />

left <strong>and</strong> right justification. T E X also attempts <strong>to</strong> keep the word spacing for<br />

different lines as nearly the same as possible.<br />

Words that end with a punctuation mark are given extra spacing,<br />

depending on the character: following a period ‘.’ or exclamation mark ‘!’,<br />

there is more space than after a comma ‘,’. This corresponds <strong>to</strong> the rule in<br />

English typesetting that there should be extra spacing between sentences.<br />

In certain cases, the au<strong>to</strong>matic procedures do not work properly, or it is<br />

desirable <strong>to</strong> override them, as described in the next sections.<br />

Sentence termination <strong>and</strong> periods<br />

T E X interprets a period following a lower case letter <strong>to</strong> be the end of a<br />

sentence where additional interword spacing is <strong>to</strong> be inserted. This leads<br />

<strong>to</strong> confusion with abbreviations such as i. e., Prof. Jones, or Phys. Rev.,<br />

where the normal spacing is required. This can be achieved by using<br />

the characters ˜ or \ instead of the normal blank. (The character is


2.7. Fine-tuning text 29<br />

simply a symbol for the blank which is otherwise invisible.) Both these<br />

methods insert the normal interword spacing; in addition, ˜ is a protected<br />

space that prevents the line from being broken at this point. The above<br />

examples should be typed in as i.˜e., Prof.˜Jones, <strong>and</strong> Phys.\ Rev.,<br />

producing i. e., Prof. Jones, <strong>and</strong> Phys. Rev. with the correct spacing <strong>and</strong><br />

forcing the first two <strong>to</strong> be all on one line. In the third case, there is nothing<br />

wrong with putting Phys. <strong>and</strong> Rev. on different lines.<br />

A period following an upper case letter is not interpreted as the end<br />

of a sentence, but as an abbreviation. If it really is the end of a sentence,<br />

then it is necessary <strong>to</strong> add \@ before the period in order <strong>to</strong> achieve the<br />

extra spacing. For example, this sentence ends with NASA. It is typed in<br />

as This sentence ends with NASA\@.<br />

French spacing<br />

The additional interword spacing between sentences can be switched<br />

off with the comm<strong>and</strong> \frenchspacing, which remains in effect until<br />

counterm<strong>and</strong>ed with \nonfrenchspacing. In this case, the comm<strong>and</strong> \@<br />

is ignored <strong>and</strong> may be omitted. This paragraph has been printed with<br />

\frenchspacing turned on, so that all word spacings within one line are<br />

the same. It corresponds <strong>to</strong> the normal rule for non-English typesetting.<br />

Character combinations “ ‘ <strong>and</strong> ’ ”<br />

A small spacing is produced with the comm<strong>and</strong> \,. This may be used, for<br />

example, <strong>to</strong> separate the double quotes “ <strong>and</strong> ” from the corresponding<br />

single quotes ‘ <strong>and</strong> ’ when they appear <strong>to</strong>gether. For example, the text<br />

‘‘\,‘Beginning’ <strong>and</strong> ‘End’\,’’ produces “ ‘Beginning’ <strong>and</strong> ‘End’ ”.<br />

Inserting arbitrary spacing<br />

Spacing of any desired size may be inserted in<strong>to</strong> the text with the comm<strong>and</strong>s<br />

\hspace{space}<br />

\hspace*{space}<br />

where space is the length specification for the amount of spacing, for<br />

example 1.5cm or 3em. (Recall that one em is the width of the letter M in<br />

the current typeface.)<br />

This comm<strong>and</strong> puts blank space of width space at that point in the<br />

text where it appears. The st<strong>and</strong>ard form (without *) has no effect if it<br />

should come at the beginning of an output line, just as normal blanks are<br />

removed at the beginning of lines. The *-form, on the other h<strong>and</strong>, inserts<br />

the spacing no matter where it occurs.<br />

A blank before or after the comm<strong>and</strong> will also be included:


30 Chapter 2. Text, Symbols, <strong>and</strong> Comm<strong>and</strong>s<br />

This is\hspace{1cm}1cm This is 1cm<br />

This is \hspace{1cm}1cm This is 1cm<br />

This is \hspace{1cm} 1cm This is 1cm<br />

The length specification may be negative, in which case the comm<strong>and</strong><br />

works as a backspace for overprinting characters with other ones, or<br />

moving them closer <strong>to</strong>gether. For example, there is an energy unit in<br />

physics called electron volt, abbreviated ‘eV’, which looks much better if<br />

the two letters are nearer <strong>to</strong>gether, as ‘eV’, with e\hspace{-.12em}V.<br />

The comm<strong>and</strong> \hfill is an abbreviation for \hspace{\fill} (see<br />

Section 2.4.2). It inserts enough space at that point <strong>to</strong> force the text<br />

on either side <strong>to</strong> be pushed over <strong>to</strong> the left <strong>and</strong> right margins. With<br />

Left\hfill Right one produces<br />

Left Right<br />

Multiple occurrences of \hfill within one line will each insert the<br />

same amount of spacing so that the line becomes left <strong>and</strong> right justified.<br />

For example, the text Left\hfill Center\hfill Right generates<br />

Left Center Right<br />

If \hfill comes at the beginning of a line, the spacing is suppressed<br />

in accordance with the behavior of the st<strong>and</strong>ard form for \hspace. If<br />

a rubber space is really <strong>to</strong> be added at the beginning or end of a line,<br />

\hspace*{\fill} must be used instead. However, L AT E X also offers a<br />

number of comm<strong>and</strong>s <strong>and</strong> environments <strong>to</strong> simplify most such applications<br />

(see Section 4.2.2).<br />

A number of other fixed horizontal spacing comm<strong>and</strong>s are available:<br />

\quad <strong>and</strong> \qquad<br />

The comm<strong>and</strong> \quad inserts a horizontal space equal <strong>to</strong> the current type<br />

size, that is, 10 pt for a 10 pt typeface, whereas \qquad inserts twice as<br />

much.<br />

Inserting variable . . . . . . <strong>and</strong> sequences<br />

Two comm<strong>and</strong>s that work exactly the same way as \hfill are<br />

\dotfill <strong>and</strong> \hrulefill<br />

Instead of inserting empty space, these comm<strong>and</strong>s fill the gap with dots<br />

or a ruled line, as follows:<br />

Start \dotfill\ Finish\\ <strong>and</strong><br />

Left \hrulefill\ Center \hrulefill\ Right\\ produce<br />

Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Finish<br />

Left Center Right


2.7. Fine-tuning text 31<br />

Any combination of \hfill, \dotfill, <strong>and</strong> \hrulefill may be given<br />

on one line. If any of these comm<strong>and</strong>s appears more than once at one<br />

location, the corresponding filling will be printed that many more times<br />

than for a single occurrence.<br />

Departure \dotfill\dotfill\dotfill\ 8:30 \hfill\hfill<br />

Arrival \hrulefill\ 11:45\\<br />

Departure . . . . . . . . . . . . . . . . . . . . . 8:30 Arrival 11:45<br />

2.7.2 Line breaking<br />

Breaking text in<strong>to</strong> lines is done au<strong>to</strong>matically in T E X <strong>and</strong> L AT E X. However,<br />

there are times when a line break must be forced or encouraged, or when<br />

a line break is <strong>to</strong> be suppressed.<br />

The comm<strong>and</strong> \\<br />

A new line with or without additional line spacing can be achieved with<br />

the comm<strong>and</strong> \\. Its syntax is<br />

\\[space]<br />

\\*[space]<br />

The optional argument space is a length that specifies how much additional<br />

line spacing is <strong>to</strong> be put between the lines. If it is necessary <strong>to</strong> start<br />

a new page, the additional line spacing is not included <strong>and</strong> the new page<br />

begins with the next line of text. The *-form prevents a new page from<br />

occurring between the two lines.<br />

With \\*[10cm], the current line is ended <strong>and</strong> a vertical spacing of<br />

10 cm is inserted before the next line, which is forced <strong>to</strong> be on the same<br />

page as the current line. If a page break is necessary, it will be made<br />

before the current line, which is then positioned at the <strong>to</strong>p of the new<br />

page <strong>to</strong>gether with the 10 cm vertical spacing <strong>and</strong> the next text line.<br />

The comm<strong>and</strong> \newline is identical <strong>to</strong> \\ without the option space.<br />

That is, a new line is started with no additional spacing <strong>and</strong> a page break<br />

is possible at that point.<br />

Both comm<strong>and</strong>s may be given only within a paragraph, <strong>and</strong> not between<br />

them where they would be meaningless.<br />

Further line-breaking comm<strong>and</strong>s<br />

The comm<strong>and</strong> \linebreak is used <strong>to</strong> encourage or force a line break at<br />

a certain point in the text. Its form is<br />

\linebreak[num]


32 Chapter 2. Text, Symbols, <strong>and</strong> Comm<strong>and</strong>s<br />

where num is an optional argument, a number between 0 <strong>and</strong> 4 that<br />

specifies how important a line break is. The comm<strong>and</strong> recommends a line<br />

break, <strong>and</strong> the higher the number the stronger the recommendation. A<br />

value of 0 allows a break where it otherwise would not occur (like in the<br />

middle of a word), whereas 4 compels a line break, as does \linebreak<br />

without num. The difference between this comm<strong>and</strong> <strong>and</strong> \\ or \newline<br />

is that the current line will be fully justified, that is, interword spacing will<br />

be added so that the text fills the line completely. With \\ <strong>and</strong> \newline,<br />

however, the line is filled with empty space after the last word <strong>and</strong> the<br />

interword spacing remains normal.<br />

The opposite comm<strong>and</strong><br />

\nolinebreak[num]<br />

discourages a line break at the given position, with num specifying the<br />

degree of discouragement. Again, \nolinebreak without a num argument<br />

has the same effect as \nolinebreak[4], that is, a line break is<br />

absolutely impossible here.<br />

Another way of forcing text <strong>to</strong> stay <strong>to</strong>gether on one line is with the comm<strong>and</strong><br />

\mbox{text}. This is convenient for expressions such as ‘Voyager-1’<br />

<strong>to</strong> s<strong>to</strong>p a line break at the hyphen.<br />

2.7.3 Vertical spacing<br />

It is possible <strong>to</strong> add extra vertical spacing of amount space between<br />

particular paragraphs using the comm<strong>and</strong>s<br />

\vspace{space}<br />

\vspace*{space}<br />

The *-form will add the extra space even when a new page occurs, or<br />

when the comm<strong>and</strong> appears at the <strong>to</strong>p of a new page. The st<strong>and</strong>ard form<br />

ignores the extra vertical spacing in these situations.<br />

If these comm<strong>and</strong>s are given within a paragraph, the extra space is<br />

inserted after the current line, which is right <strong>and</strong> left justified as usual.<br />

The space parameter may even be negative, in order <strong>to</strong> move the<br />

following text higher up the page than where it would normally be printed.<br />

The comm<strong>and</strong> \vfill is an abbreviation for \vspace{\fill} (see<br />

Section 2.4.2). This is the equivalent of \hfill for vertical spacing,<br />

inserting enough blank vertical space <strong>to</strong> make the <strong>to</strong>p <strong>and</strong> bot<strong>to</strong>m of the<br />

text match up exactly with the upper <strong>and</strong> lower margins. The comments<br />

on multiple occurrences of \hfill also apply <strong>to</strong> \vfill. If this comm<strong>and</strong><br />

is given at the beginning of a page, it is ignored, just like the st<strong>and</strong>ard<br />

form of \vspace{\fill}. If a rubber space is <strong>to</strong> be put at the <strong>to</strong>p of a<br />

page, the *-form \vspace*{\fill} must be used.<br />

Further comm<strong>and</strong>s for increasing the spacing between paragraphs are


\bigskip \medskip \smallskip<br />

2.7. Fine-tuning text 33<br />

which add vertical spacing depending on the font size declared in the<br />

document class.<br />

2.7.4 Page breaking<br />

Breaking text in<strong>to</strong> pages occurs au<strong>to</strong>matically in T E X <strong>and</strong> L AT E X, just as<br />

for line breaking. Here again, it may be necessary <strong>to</strong> interfere with the<br />

program’s notion of where a break should take place.<br />

Normal pages<br />

The comm<strong>and</strong>s<br />

\pagebreak[num]<br />

\nopagebreak[num]<br />

are the equivalents of \linebreak <strong>and</strong> \nolinebreak for page breaking.<br />

If \pagebreak appears between two paragraphs, a new page will be forced<br />

at that point. If it comes within a paragraph, the new page will be<br />

implemented after the current line is completed. This line will be right<br />

<strong>and</strong> left justified as usual.<br />

The comm<strong>and</strong> \nopagebreak has the opposite effect: between paragraphs,<br />

it prevents a page break from occurring there, <strong>and</strong> within a<br />

paragraph, it s<strong>to</strong>ps a page break that might take place at the end of the<br />

current line.<br />

Optional numbers between 0 <strong>and</strong> 4 express the degree of encouragement<br />

or discouragement for a page break. The analogy with the comm<strong>and</strong><br />

\linebreak goes further: just as the line before the break is left <strong>and</strong> right<br />

justified with extra interword spacing, in the same way the page before<br />

the break is exp<strong>and</strong>ed with interline spacing <strong>to</strong> make it <strong>to</strong>p <strong>and</strong> bot<strong>to</strong>m<br />

justified.<br />

The proper comm<strong>and</strong> <strong>to</strong> end a page in the middle, fill it with blank<br />

spacing, <strong>and</strong> go on <strong>to</strong> a new page is<br />

\newpage<br />

which is equivalent <strong>to</strong> \newline with regard <strong>to</strong> page breaking.<br />

Pages with figures <strong>and</strong> tables<br />

If the text contains tables, pictures, or reserved space for figures, these<br />

are inserted at the location of the corresponding comm<strong>and</strong>, provided that<br />

there is enough room for them on the current page. If there is not enough<br />

space, the text continues <strong>and</strong> the figure or table is s<strong>to</strong>red <strong>to</strong> be put on a<br />

following page.<br />

The comm<strong>and</strong>


34 Chapter 2. Text, Symbols, <strong>and</strong> Comm<strong>and</strong>s<br />

\clearpage<br />

ends the current page like \newpage <strong>and</strong> in addition outputs all the<br />

pending figures <strong>and</strong> tables on one or more extra pages (Chapter 7).<br />

Two-column pages<br />

If the document class option twocolumn has been chosen, or the comm<strong>and</strong><br />

\twocolumn is in effect, then the two comm<strong>and</strong>s \pagebreak <strong>and</strong><br />

\newpage end the current column <strong>and</strong> begin a new one, treating columns<br />

as pages. On the other h<strong>and</strong>, \clearpage <strong>and</strong> \cleardoublepage (see<br />

below) terminate the current page, inserting an empty right column if<br />

necessary.<br />

Two-sided pages<br />

An additional page-breaking comm<strong>and</strong> is available when the document<br />

class option twoside has been selected:<br />

\cleardoublepage<br />

which functions exactly the same as \clearpage (the current page is<br />

terminated, all pending figures <strong>and</strong> tables are output) but in addition, the<br />

next text will be put on <strong>to</strong> an odd-numbered page. If necessary, an empty<br />

page with an even number is printed <strong>to</strong> achieve this.<br />

Controlling page breaks<br />

L AT E X provides the possibility of increasing the height of the current page<br />

slightly with comm<strong>and</strong>s<br />

\enlargethispage{size}<br />

\enlargethispage*{size}<br />

which add the length size <strong>to</strong> \textheight for this one page only. Sometimes<br />

the difference of a few points is all that is necessary <strong>to</strong> avoid a<br />

bad page break. The *-form of the comm<strong>and</strong> also shrinks any interline<br />

spacing as needed <strong>to</strong> maximize the amount of text on the page.<br />

2.8 Word division<br />

When a line is <strong>to</strong> be right <strong>and</strong> left justified, it often turns out that the<br />

break cannot be made between whole words without either shoving the<br />

text <strong>to</strong>o close <strong>to</strong>gether or inserting huge gaps between the words. It is<br />

then necessary <strong>to</strong> split a word. This fundamental task is performed by<br />

T E X, the underlying basis of L AT E X, by means of a word-dividing algorithm


2.8. Word division 35<br />

that works (almost) perfectly for English text, which is more than can<br />

be said for most authors. Nevertheless, even it makes mistakes at times<br />

which need <strong>to</strong> be corrected by human intervention.<br />

If normal T E X/L AT E X is used for other languages, or if foreign words appear<br />

in English text, incorrect hyphenations are very likely <strong>to</strong> appear. (See<br />

Section 2.8.4 <strong>and</strong> Chapter 11 for more about L AT E X with other languages.)<br />

In these cases <strong>to</strong>o, something must be done <strong>to</strong> override T E X’s hyphenation<br />

rules, as described below.<br />

2.8.1 Manual hyphenation<br />

The simplest way <strong>to</strong> correct a wrongly divided word is <strong>to</strong> include a \comm<strong>and</strong><br />

at the right place within the word. The word manuscript, for<br />

example, will not be hyphenated at all, so if it causes problems with<br />

breaking a line, write it as man\-u\-script. This tells T E X <strong>to</strong> divide the<br />

word as necessary either as man-uscript or as manu-script, <strong>and</strong> <strong>to</strong> ignore<br />

its normal rules.<br />

The \- comm<strong>and</strong> merely makes hyphenation possible at the indicated<br />

locations; it does not force it. If the author absolutely insists in dividing a<br />

word at a certain point, say between the u <strong>and</strong> s in manuscript, he or she<br />

can type manu-\linebreak script <strong>to</strong> achieve this. However, this brute<br />

force method is not recommended, because the line break will always<br />

occur here even if the text is later changed.<br />

For English text, the spelling of a word remains the same when it is<br />

hyphenated, something that is not true in other languages. In traditional<br />

German spelling, for example, if ck is split, it becomes k-k. T E X allows<br />

such behavior with the general hyphenation comm<strong>and</strong><br />

\discretionary{before}{after}{without}<br />

where before <strong>and</strong> after are the letters (with hyphen) that come on either<br />

side of the break if division takes place, <strong>and</strong> without is the normal text<br />

with no hyphenation. Thus Boris Becker’s name should be typed as<br />

Boris Be\discretionary{k-}{k}{ck}er<br />

something that one only wants <strong>to</strong> do in exceptional situations. Incidentally,<br />

the \- comm<strong>and</strong> is shorth<strong>and</strong> for \discretionary{-}{}{}.<br />

Note: In <strong>to</strong>day’s new German spelling, ck is never split. This reformed<br />

spelling is still controversial however.<br />

2.8.2 Hyphenation list<br />

Words that are incorrectly hyphenated <strong>and</strong> that appear frequently within<br />

the document can be put in<strong>to</strong> a list of exceptions in the preamble, <strong>to</strong> avoid<br />

laboriously inserting \- every time:


36 Chapter 2. Text, Symbols, <strong>and</strong> Comm<strong>and</strong>s<br />

\hyphenation{list}<br />

The list consists of a set of words, separated by blanks or new lines, with<br />

the allowed division points indicated by hyphens. For example,<br />

\hyphenation{man-u-script com-pu-ter gym-na-sium<br />

coun-try-man re-sus-ci-tate ... }<br />

The list may contain only words with the normal letters a–z, with no<br />

special characters or accents. However, if the inputenc package is loaded,<br />

then the directly typed letters are also be included in the au<strong>to</strong>matic<br />

hyphenation.<br />

2.8.3 Suppressing hyphenation<br />

Another means of avoiding bad word divisions is <strong>to</strong> turn hyphenation off,<br />

at least for a paragraph or two. Actually the comm<strong>and</strong><br />

\begin{sloppypar} paragraph text \end{sloppypar}<br />

does not prevent word division, but does permit larger interword spacings<br />

without giving a warning message. This means that practically all lines are<br />

broken between words. It is also possible <strong>to</strong> put the comm<strong>and</strong> \sloppy<br />

in the preamble or in the current environment <strong>to</strong> reduce the number of<br />

word divisions in the whole document or within the environment scope.<br />

This is recommended when the line width is rather narrow.<br />

When the comm<strong>and</strong> \sloppy is in effect, it is possible <strong>to</strong> undo it<br />

temporarily <strong>and</strong> <strong>to</strong> turn hyphenation back on with the comm<strong>and</strong> \fussy.<br />

2.8.4 Word division with multilingual text<br />

Multiple hyphenation lists may be included in the T E X format, making it possible<br />

! <strong>to</strong> switch hyphenation schemes within one document, using the T E X comm<strong>and</strong><br />

\language. This comm<strong>and</strong> may be used as part of language-specific adaptations<br />

<strong>to</strong> translate certain explicit English words in the output (such as ‘Contents’), <strong>to</strong><br />

simplify accents or punctuation, <strong>and</strong> <strong>to</strong> alter the definition of the date comm<strong>and</strong><br />

\<strong>to</strong>day. This <strong>to</strong>pic is treated in more detail in Chapter 11.


3<br />

3.1 Document class<br />

Document Layout <strong>and</strong><br />

Organization<br />

The first comm<strong>and</strong> in the preamble of a L AT E X file determines the global<br />

processing format for the entire document. Its syntax is:<br />

\documentclass[options]{class}<br />

where some value of class must be given, while [options] may be omitted<br />

if default values are acceptable.<br />

The st<strong>and</strong>ard values of class, of which one <strong>and</strong> only one may be given,<br />

are: book, report, article, or letter. (The properties of the letter<br />

class are explained in Chapter 16.) The basic differences between these<br />

classes lie not only in the page layouts, but also in the organization. An<br />

article may contain parts, sections, subsections, <strong>and</strong> so on, while a report<br />

can also have chapters. A book also has chapters, but treats even <strong>and</strong><br />

odd pages differently; also, it prints running heads on each page with the<br />

chapter <strong>and</strong> section titles.<br />

Other classes besides the st<strong>and</strong>ard ones exist, as contributions for<br />

specific journals, or for book projects. These will have their own set of<br />

options <strong>and</strong> additional comm<strong>and</strong>s, which should be described in separate<br />

documentation or instructions. However, since they are normally modifications<br />

of one of the st<strong>and</strong>ard classes, most of the following options<br />

apply <strong>to</strong> them <strong>to</strong>o.<br />

3.1.1 St<strong>and</strong>ard class options<br />

The options available allow various modifications <strong>to</strong> be made <strong>to</strong> the formatting.<br />

They can be grouped as follows.<br />

Selecting font size<br />

The basic font size is selected with one of the options<br />

37


38 Chapter 3. Document Layout <strong>and</strong> Organization<br />

10pt 11pt 12pt<br />

This is the size of the font in which the normal text in the document will<br />

be set. The default is 10pt, which means that this is the value assumed if<br />

no size option is specified. All other font size declarations are relative <strong>to</strong><br />

this st<strong>and</strong>ard size, so that the section titles, footnotes, <strong>and</strong> so on will all<br />

change size au<strong>to</strong>matically if a different basic font size is selected.<br />

Specifying paper size<br />

L AT E X calculates the text line width <strong>and</strong> lines per page according <strong>to</strong> the<br />

selected font size <strong>and</strong> paper mode. It also sets the margins so that the<br />

text is centered both horizontally <strong>and</strong> vertically. In order <strong>to</strong> do this, it<br />

needs <strong>to</strong> know which paper format is being used. This is specified by one<br />

of the following options:<br />

letterpaper (11 × 8.5 in) a4paper (29.7 × 21 cm)<br />

legalpaper (14 × 8.5 in) a5paper (21 × 14.8 cm)<br />

executivepaper (10.5 × 7.25 in) b5paper (25 × 17.6 cm)<br />

The default is letterpaper, American letter size paper, 11 × 8.5 in.<br />

Normally, the paper format is such that the longer dimension is the<br />

vertical one, the so-called portrait mode. With the option<br />

l<strong>and</strong>scape<br />

the shorter dimension becomes the vertical one, the l<strong>and</strong>scape mode.<br />

(One still has <strong>to</strong> ensure that the output is printed as l<strong>and</strong>scape; see for<br />

example page 232.)<br />

Page formats<br />

The text on the page may be formatted in<strong>to</strong> one or two columns with the<br />

options<br />

onecolumn twocolumn<br />

The default is onecolumn. In the case of the twocolumn option, the<br />

separation between the columns as well as the width of any rule between<br />

them may be specified by \columnsep <strong>and</strong> \columnseprule, described<br />

below.<br />

The even- <strong>and</strong> odd-numbered pages may be printed differently according<br />

<strong>to</strong> the options<br />

oneside twoside<br />

With oneside, all pages are printed the same; however, with twoside, the<br />

running heads are such that the page number appears on the right on odd


3.1. Document class 39<br />

pages <strong>and</strong> on the left on even pages. It does not force the printer <strong>to</strong> output<br />

double-sided. The idea is that when these are later printed back-<strong>to</strong>-back,<br />

the page numbers are always on the outside where they are more easily<br />

noticed. This is the default for the book class. For article <strong>and</strong> report,<br />

the default is oneside.<br />

With the book class, chapters normally start on a right-h<strong>and</strong>, odd-numbered<br />

page. The options<br />

openright openany<br />

control this feature: with openany a chapter always starts on the next<br />

page, but with openright, the default, a blank page may be inserted if<br />

necessary.<br />

Normally the title of a book or report will go on a separate page, while<br />

for an article, it is placed on the same page as the first text. With the<br />

options<br />

notitlepage titlepage<br />

this st<strong>and</strong>ard behavior may be overruled. See Sections 3.3.1 <strong>and</strong> 3.3.2.<br />

Further options<br />

The remaining st<strong>and</strong>ard options are:<br />

leqno Equation numbers in displayed formulas will appear on the left<br />

instead of the normal right side (Section 5.1).<br />

fleqn Displayed formulas will be set flush left instead of centered<br />

(Section 5.1). The amount of indentation may be set with the<br />

parameter \mathindent described below.<br />

openbib<br />

The format of bibliographies may be changed so that segments<br />

are set on new lines. By default, the texts for each entry are run<br />

<strong>to</strong>gether.<br />

draft If the L AT E X line-breaking mechanism does not function properly<br />

<strong>and</strong> text must stick out in<strong>to</strong> the right margin, then this is marked<br />

with a thick black bar, <strong>to</strong> make it noticeable.<br />

final The opposite of draft, <strong>and</strong> the default. Lines of text that are <strong>to</strong>o<br />

wide are not marked in any way.<br />

If multiple options are <strong>to</strong> be given, they are separated by commas, as<br />

for example, \documentclass[11pt,twoside,fleqn]{article}. The<br />

order of the options is unimportant. If two conflicting options are specified,<br />

say oneside <strong>and</strong> twoside, it is not obvious which one will be<br />

effective. That depends entirely on the definitions in the class file itself,<br />

so it would be best <strong>to</strong> avoid such situations.


40 Chapter 3. Document Layout <strong>and</strong> Organization<br />

Parameters associated with some options<br />

Some options make use of parameters that have been given certain default<br />

values:<br />

\mathindent<br />

specifies the indentation from the left margin for the equation<br />

numbers when fleqn is selected (Section 5.1);<br />

\columnsep<br />

specifies the space between the two columns for the twocolumn<br />

option (see Figure H.2 on page 603);<br />

\columnseprule<br />

determines the width of the vertical line between the two columns<br />

for the twocolumn option. The default is zero width, that is, no<br />

vertical rule (see Figure H.2).<br />

The st<strong>and</strong>ard values of these parameters may be changed with the<br />

L AT E X comm<strong>and</strong> \setlength. For example, <strong>to</strong> change \mathindent <strong>to</strong><br />

2.5 cm, give<br />

\setlength{\mathindent}{2.5cm}<br />

These parameters may be assigned values either in the preamble or<br />

at any place in the document. Parameters in the preamble apply <strong>to</strong> the<br />

entire document, whereas those within the text are in effect until the next<br />

change or until the end of the environment in which they were made<br />

(Section 2.3). In the latter case, the previous values become effective once<br />

more.<br />

Exercise 3.1: Take your text file from Exercise 2.2 <strong>and</strong> change the initial comm<strong>and</strong><br />

\documentclass{article} first <strong>to</strong> \documentclass[11pt]{article}<br />

<strong>and</strong> then <strong>to</strong> \documentclass[12pt]{article} <strong>and</strong> print the results of each<br />

L AT E X processing. Compare the line breaking of these outputs with that of Exercise<br />

2.2.<br />

Note: if there are some improper word divisions, you call tell L AT E X where the correct<br />

division should occur with the comm<strong>and</strong> \-, for example, man\-u\-script.<br />

(This is one of the few words that the T E X English word divider does not h<strong>and</strong>le<br />

properly.) Additional means of modifying word division are given in Section 2.8.<br />

If there are warnings of the sort Overfull \hbox ... during the L AT E X processing,<br />

T E X was not able <strong>to</strong> break the lines cleanly. In the output, these lines will<br />

extend beyond the right margin. The usual cause is that T E X was not able <strong>to</strong><br />

divide some word, either because it is indivisible or because T E X’s word division<br />

routines were not adequate. Here again a suggested hyphenation in the text can<br />

solve the problem. Other solutions will be given shortly.<br />

Exercise 3.2: Now employ \documentclass[twocolumn]{article} in your text<br />

file. If you now receive a number of warnings with Underfull \hbox ..., then<br />

these lines will indeed be left <strong>and</strong> right justified but will have <strong>to</strong>o much empty


3.1. Document class 41<br />

space between the words. Check the output yourself <strong>to</strong> see whether the word<br />

spacing is acceptable. If not, try giving some hyphenation suggestions in the first<br />

words of the next line.<br />

Note: if you use the classes book or report instead of article in the preceding<br />

exercises, you will notice no difference in the outputs. These classes affect<br />

the subsequent structural elements of the document. Basically, you should use<br />

article for short articles (say 10–20 pages) <strong>and</strong> report for longer reports that<br />

are <strong>to</strong> be organized in<strong>to</strong> chapters. The chapters always begin on a new page. The<br />

class book is available for producing books.<br />

3.1.2 Loading packages<br />

In Section 1.5.3 we explained how L AT E X can be extended by packages which<br />

are either part of the core installation or contributed by engaged users.<br />

How <strong>to</strong> write your own packages is described in Appendix D.<br />

A package is nothing more than a set of L AT E X (or T E X) comm<strong>and</strong>s<br />

s<strong>to</strong>red in a file with the extension .sty, although there are some special<br />

comm<strong>and</strong>s that may only appear within them. To invoke a package, simply<br />

call<br />

\usepackage{package}<br />

in the preamble, where package is the root name of the file. More than one<br />

package may be loaded with one call <strong>to</strong> \usepackage. For example, two<br />

packages provided with st<strong>and</strong>ard L AT E X are s<strong>to</strong>red in files makeidx.sty<br />

(Section 9.4.3) <strong>and</strong> ifthen.sty (Section 8.3.5). They may be read in<br />

<strong>to</strong>gether with<br />

\usepackage{makeidx,ifthen}<br />

A package may have options associated with it, which may be selected<br />

in the same way as for document classes: by including the option names<br />

within square braces. The general syntax is thus:<br />

\usepackage[opt1,opt2. . . ]{package1,package2,. . . }<br />

where all the listed options will be applied <strong>to</strong> all the selected packages.<br />

If any of the packages does not underst<strong>and</strong> one of the options, a warning<br />

message is output <strong>to</strong> the moni<strong>to</strong>r.<br />

3.1.3 Global <strong>and</strong> local options<br />

One interesting feature about options specified with the \documentclass com-<br />

! m<strong>and</strong> is that they also apply <strong>to</strong> any packages that follow. This means that<br />

if several packages all take the same option, it is only necessary <strong>to</strong> declare it<br />

once in \documentclass. For example, one might design a package <strong>to</strong> modify<br />

article for generating a local house style that might do different things for<br />

single or double column text; this package could make use of the class options<br />

onecolumn <strong>and</strong> twocolumn <strong>to</strong> achieve this. Or it could elaborate on the draft


42 Chapter 3. Document Layout <strong>and</strong> Organization<br />

option <strong>to</strong> produce double line spacing, as for a manuscript. Alternatively, several<br />

packages might have language-dependent features that could be activated<br />

with options like french or german; it is sufficient <strong>to</strong> list such options only in<br />

\documentclass <strong>to</strong> apply them <strong>to</strong> all packages. Such options are called global,<br />

for they are passed on <strong>to</strong> all subsequent packages au<strong>to</strong>matically.<br />

Global options need not be limited <strong>to</strong> the st<strong>and</strong>ard class options listed in<br />

Section 3.1.1. A warning message is printed only if neither the class nor any<br />

of the packages underst<strong>and</strong> one or more of them. By contrast, any options<br />

specified with \usepackage will be applied only <strong>to</strong> those packages listed in that<br />

one comm<strong>and</strong>; <strong>and</strong> it is applied <strong>to</strong> all of them. A warning is printed if one or<br />

more of those packages does not recognize any one of these local options.<br />

3.1.4 Class <strong>and</strong> package versions<br />

Class <strong>and</strong> package files normally have an internal version specification in the<br />

! form of their release date, as yyyy/mm/dd. If you wish <strong>to</strong> make use of some<br />

feature that you know was added on a certain date, you include that date in<br />

square brackets after the class or package name. An example of this is shown in<br />

Section 3.2.4 on page 46.<br />

The version date may also be added <strong>to</strong> the \documentclass comm<strong>and</strong> <strong>to</strong><br />

ensure that the right version of the class file is being employed. The reason for<br />

doing this is <strong>to</strong> ensure that the source files are processed properly, say on other<br />

systems.<br />

3.2 Page style<br />

The basic page format is determined by the page style. With one exception,<br />

this comm<strong>and</strong> is normally given in the preamble. Its form is:<br />

\pagestyle{style}<br />

The m<strong>and</strong>a<strong>to</strong>ry argument style takes on one of the following values:<br />

plain The page head is empty, the foot contains the centered page<br />

number. This is the default for the article <strong>and</strong> report classes<br />

when no \pagestyle is given in the preamble.<br />

empty Both head <strong>and</strong> footlines are empty; no page numbers are printed.<br />

headings<br />

The head contains the page number as well as title information<br />

(chapter <strong>and</strong> section headings); the foot is empty. This is the<br />

default for book class.<br />

myheadings<br />

The same as headings except that the page titles in the head are<br />

not chosen au<strong>to</strong>matically but rather are given explicitly by the<br />

comm<strong>and</strong>s \markright or \markboth (see below).


The comm<strong>and</strong><br />

\thispagestyle{style}<br />

3.2. Page style 43<br />

functions exactly as \pagestyle except that it affects only the current<br />

page. For example, the page numbering may be suppressed for just the<br />

current page with the comm<strong>and</strong> \thispagestyle{empty}. It is only the<br />

printing of the page number that is suppressed; the next page will be<br />

numbered just as though the comm<strong>and</strong> had never been given.<br />

3.2.1 Heading declarations<br />

For the page styles headings <strong>and</strong> myheadings, the information appearing<br />

in the headline may be given with the declarations<br />

\markright{right head}<br />

\markboth{left head}{right head}<br />

The declaration \markboth is used with the document class option<br />

twoside, with even-numbered pages considered <strong>to</strong> be on the left <strong>and</strong><br />

odd-numbered pages on the right. Furthermore, the page number is<br />

printed on the left side of the head for a left page <strong>and</strong> on the right side<br />

for a right page.<br />

For one-sided output, all pages are considered <strong>to</strong> be right-h<strong>and</strong>ed. In<br />

this case, the declaration \markright is appropriate. It may also be used<br />

with two-sided output <strong>to</strong> overwrite the right head given in \markboth.<br />

With the page style headings, the st<strong>and</strong>ard titles in the page headline<br />

are the chapter, section, or subsection headings, depending on the<br />

document <strong>and</strong> page style, according <strong>to</strong> the following scheme:<br />

Style Left Page Right Page<br />

book, report<br />

article<br />

one-sided — Chapter<br />

two-sided Chapter Section<br />

one-sided — Section<br />

two-sided Section Subsection<br />

If there are more than one \section or \subsection on a page, it is<br />

the heading of the last one that appears in the page head.<br />

3.2.2 Cus<strong>to</strong>mized head <strong>and</strong> footlines<br />

Package: The st<strong>and</strong>ard page styles described in Section 3.2 select how the head <strong>and</strong><br />

fancyhdr footlines are <strong>to</strong> appear, <strong>and</strong> what information they contain. This is a very<br />

limited choice, <strong>and</strong> the fancyhdr package by Piet van Oostrum offers the<br />

user considerable more flexibility.<br />

This package makes available an additional page style named fancy<br />

which the user can easily redefine. Head <strong>and</strong> footlines consist each of


44 Chapter 3. Document Layout <strong>and</strong> Organization<br />

three parts, left, center, right, each of which can be individually defined<br />

with<br />

\lhead{Left head} \chead{Center head} \rhead{Right head}<br />

\lfoot{Left foot} \cfoot{Center foot} \rfoot{Right foot}<br />

where the various texts may be explicit, or a comm<strong>and</strong> like \thepage <strong>to</strong><br />

print the current page number. Both head <strong>and</strong> footlines may be decorated<br />

with a rule, the widths of which are set by comm<strong>and</strong>s \headrulewidth<br />

<strong>and</strong> \footrulewidth. By default, the fancy head <strong>and</strong> footlines are much<br />

the same as for the headings page style, but the head rule is set <strong>to</strong> 0.4 pt<br />

<strong>and</strong> the foot rule set <strong>to</strong> 0 (no rule). The rules may be redefined with, for<br />

example,<br />

\renewcomm<strong>and</strong>{\footrulewidth}{0.4pt}<br />

<strong>to</strong> turn the foot rule on.<br />

The above defining comm<strong>and</strong>s are in fact specific examples of the<br />

more general comm<strong>and</strong>s \fancyhead <strong>and</strong> \fancyfoot, where<br />

\lhead{..} is \fancyhead[L]{..}<br />

\cfoot{..} is \fancyfoot[C]{..}<br />

<strong>and</strong> so on, with L C R st<strong>and</strong>ing for ‘left’, ‘center’, ‘right’.<br />

For two-sided output with the twoside option, one normally wants<br />

the left <strong>and</strong> right parts <strong>to</strong> alternate with page number. The easiest way <strong>to</strong><br />

do this is with<br />

\fancyhead[LE,RO]{Text 1} \fancyhead[LO,RE]{Text 2}<br />

<strong>to</strong> put the same Text 1 in the left part of even pages, <strong>and</strong> right part of<br />

odd pages, <strong>and</strong> Text 2 for the other way round. With \fancyhead{}, all<br />

head line parts are set <strong>to</strong> blanks, something that should be done before<br />

resetting them explicitly. Similarly \fancyfoot{} sets all foot entries <strong>to</strong><br />

blank.<br />

The default (two-sided) definitions for the fancy page style are<br />

\fancyhead[EL,OR]{\textsl{\rightmark}}<br />

\fancyhead[ER,OL]{\textsl{\leftmark}}<br />

where \rightmark <strong>and</strong> \leftmark contain the au<strong>to</strong>matic texts for the<br />

headings page style generated by the \chapter, \section, \subsection<br />

comm<strong>and</strong>s (Section 3.3.3), while \textsl (Section 4.1.4) sets its argument<br />

in a slanted typeface. The user may also make use of these <strong>to</strong> redefine<br />

the head line with au<strong>to</strong>matic texts.<br />

There is also the most general \fancyhf comm<strong>and</strong> taking optional<br />

arguments [H] <strong>and</strong> [F] <strong>to</strong> apply <strong>to</strong> head or footlines. Thus \fancyhf[HL]<br />

{..} is the same as \fancyhead[L]{..}. Clearly, \fancyhf{} resets<br />

everything.


3.2. Page style 45<br />

In many classes, the first page of a chapter, or the very first page<br />

of the document, is switched <strong>to</strong> plain au<strong>to</strong>matically. If the user wants<br />

<strong>to</strong> change this, he or she must redefine that page style. The fancyhdr<br />

package simplifies this task with<br />

\fancypagestyle{plain}{definitions}<br />

where definitions consist of \fancyhead, \fancyfoot, <strong>and</strong>/or rule redefinitions<br />

that are <strong>to</strong> apply <strong>to</strong> the revised plain style. In fact, any existing<br />

page style can be redefined in this way.<br />

3.2.3 Page numbering<br />

The declaration that specifies the style of the page numbering has the<br />

form<br />

\pagenumbering{num style}<br />

The allowed values of num style are:<br />

arabic for normal (Arabic) numerals,<br />

roman for lower case Roman numerals,<br />

Roman for upper case Roman numerals,<br />

alph for lower case letters,<br />

Alph for upper case letters.<br />

The st<strong>and</strong>ard value is arabic. This declaration resets the page counter<br />

<strong>to</strong> 1. In order <strong>to</strong> paginate the foreword of a document with Roman numerals<br />

<strong>and</strong> the rest with Arabic numbers beginning with page 1 for chapter 1,<br />

one must declare \pagenumbering{roman} at the start of the foreword<br />

<strong>and</strong> then reset the page numbering with \pagenumbering{arabic} immediately<br />

after the first \chapter comm<strong>and</strong>. (See Section 3.3.5 for the<br />

preferred method.)<br />

Pages may be numbered starting with a value different from 1 by giving<br />

the comm<strong>and</strong><br />

\setcounter{page}{page num}<br />

where page num is the number <strong>to</strong> appear on the current page.<br />

Exercise 3.3: Exp<strong>and</strong> your exercise text file so that it fills more than one page of<br />

output <strong>and</strong> include the following preamble:<br />

\documentclass{article}<br />

\pagestyle{myheadings} \markright{Exercises}<br />

\pagenumbering{Roman}<br />

\begin{document}


46 Chapter 3. Document Layout <strong>and</strong> Organization<br />

3.2.4 Paragraph formatting<br />

The following parameters affect the appearance of a paragraph <strong>and</strong> may<br />

be given new values with \setlength as explained in Section 8.2:<br />

\parskip<br />

The distance between paragraphs, expressed in units of ex so<br />

that it will au<strong>to</strong>matically change with character font size. This<br />

should be a rubber length.<br />

\parindent<br />

The amount of indentation for the first line of a paragraph.<br />

\baselinestretch<br />

This is a number that magnifies the normal distance between<br />

baselines, the line on which the letters sit. This number is initially<br />

1, for st<strong>and</strong>ard line spacing. It may be changed <strong>to</strong> another<br />

number with<br />

\renewcomm<strong>and</strong>{\baselinestretch}{fac<strong>to</strong>r}<br />

where fac<strong>to</strong>r is any decimal number, such as 1.5 for a 50% increase.<br />

This then applies <strong>to</strong> all font sizes. If this comm<strong>and</strong> is<br />

given outside the preamble, it does not come in<strong>to</strong> effect until<br />

another font size has been selected (Section 4.1.2).<br />

These parameters may be set either in the preamble or anywhere in the<br />

text of the document. In the latter case, the changes remain in effect until<br />

the next change or until the end of the environment in which they were<br />

made (Section 2.3).<br />

To suppress indentation for one paragraph, or <strong>to</strong> force it where it<br />

would otherwise not occur, place<br />

\noindent or \indent<br />

at the beginning of the paragraph <strong>to</strong> be affected.<br />

Package: Normally, the first paragraph of a section is not indented, not even with<br />

indent- \indent. However, by including the package indentfirst one ensures<br />

first<br />

that all paragraphs are indented.<br />

By default, LAT Package:<br />

EX indicates paragraphs by indenting the first line.<br />

parskip An alternative is without indentation but with extra spacing between<br />

paragraphs. One could redefine \parindent <strong>and</strong> \parskip accordingly,<br />

or one could employ one of the oldest <strong>and</strong> simplest packages dating<br />

back <strong>to</strong> LAT EX 2.09 days: parskip, written by H. Partl. For consistency, this<br />

package also makes some changes in the parameters for lists (Section 4.3).<br />

One loads this package with<br />

\usepackage{parskip}


3.2. Page style 47<br />

There is a recent update <strong>to</strong> the parskip package by Robin Fairbairns<br />

that includes the option parfill, given as<br />

\usepackage[parfill]{parskip}<br />

that avoids ugly-looking rectangular paragraphs by ensuring that there<br />

is always space at the end of the last line. This update is dated April 9,<br />

2001, so <strong>to</strong> be sure that this package version is loaded, add this date as<br />

\usepackage[parfill]{parskip}[2001/04/09]<br />

as explained in Section 3.1.4. A warning will be issued on processing if the<br />

actual version of parskip is earlier than this. There will also be warning<br />

about the unknown option parfill.<br />

Exercise 3.4: Add the following <strong>to</strong> the preamble of your exercise file:<br />

\usepackage{parskip}<br />

\renewcomm<strong>and</strong>{\baselinestretch}{1.2}<br />

After processing this exercise, repeat it with another value for the parameter<br />

\baselinestretch, say 1.5, in order <strong>to</strong> get a feeling for how it works. Remove<br />

these lines from the exercise file afterwards.<br />

3.2.5 Page format<br />

Each page consists of a head, the body containing the actual text, <strong>and</strong> a<br />

foot. The selection of the page style determines what information is <strong>to</strong> be<br />

found in the head <strong>and</strong> footlines.<br />

L AT E X uses default values for the distances between the head, body, <strong>and</strong><br />

foot, for the upper <strong>and</strong> left margins, <strong>and</strong> for the text line width <strong>and</strong> heights<br />

of the head, body, <strong>and</strong> foot. These formatting lengths are illustrated in<br />

Figure 3.1 on the next page. They may be changed by declaring new values<br />

for them, preferably in the preamble, with the comm<strong>and</strong> \setlength<br />

(Section 8.2). For example, give<br />

\setlength{\textwidth}{12.5cm}<br />

<strong>to</strong> make the text line width <strong>to</strong> be 12.5 cm.<br />

There is also a parameter \linewidth equal <strong>to</strong> the text line width in<br />

whatever environment one is currently in. This must never be changed,<br />

but is used when one needs <strong>to</strong> know this width.<br />

More detailed diagrams of the page formats for one- <strong>and</strong> two-column<br />

outputs are shown at the end of Appendix H in Figures H.1 <strong>and</strong> H.2.<br />

Package: You can examine your own page layout with the layout package from<br />

layout the <strong>to</strong>ols collection. Simply issue the comm<strong>and</strong> \layout <strong>and</strong> a diagram<br />

similar <strong>to</strong> that in Figure 3.1 will be drawn at that point, <strong>to</strong>gether with a<br />

list of the current values of the layout parameters. Naturally, you would<br />

not do this in the middle of the final version of a document, but only as<br />

diagnostic check.


48 Chapter 3. Document Layout <strong>and</strong> Organization<br />

\oddsidemargin<br />

left margin for odd pages,<br />

\evensidemargin<br />

left margin for even pages,<br />

\<strong>to</strong>pmargin<br />

upper margin <strong>to</strong> <strong>to</strong>p of head,<br />

\headheight<br />

height of head,<br />

\headsep<br />

distance from the bot<strong>to</strong>m of<br />

headline <strong>to</strong> <strong>to</strong>p of body,<br />

\<strong>to</strong>pskip<br />

distance from <strong>to</strong>p of body <strong>to</strong><br />

baseline of first line of text,<br />

\textheight, \textwidth<br />

height <strong>and</strong> width of main text,<br />

\footskip<br />

distance from bot<strong>to</strong>m of body<br />

<strong>to</strong> bot<strong>to</strong>m of foot,<br />

\paperwidth, \paperheight<br />

<strong>to</strong>tal width <strong>and</strong> height of paper<br />

as given by paper size option,<br />

including all margins.<br />

✻<br />

✲✛<br />

\paperheight<br />

❄<br />

1 inch<br />

• ❄✻ 1 inch<br />

❄<br />

Head<br />

\<strong>to</strong>pmargin<br />

✻❄ \headheight<br />

❄ \headsep<br />

✻ \<strong>to</strong>pskip<br />

❄ First line of text<br />

Body<br />

✛ ✲ \textheight<br />

✻✛<br />

\textwidth<br />

❄<br />

✝<br />

✲<br />

\footskip<br />

Foot ❄<br />

✞<br />

\oddsidemargin<br />

✝\evensidemargin<br />

✛ \paperwidth<br />

Figure 3.1: Page layout parameters<br />

In order <strong>to</strong> calculate the page layout precisely, one must realize that L AT E X<br />

! measures all distances from a point one inch from the <strong>to</strong>p of the paper <strong>and</strong> one<br />

inch from the left edge. Thus the <strong>to</strong>tal left margin is \oddsidemargin plus one<br />

inch. The L AT E X parameters \paperwidth <strong>and</strong> \paperheight, which include this<br />

extra inch, are given their values by the paper size option in the \documentclass<br />

comm<strong>and</strong>; they are used internally <strong>to</strong> calculate the margins so that the text is<br />

centered. The user may also take advantage of them for calculations.<br />

With document class book or with the option twoside, the bot<strong>to</strong>m edge of<br />

! the body will always appear at exactly the same position on every page. In the<br />

other classes or options, it will vary slightly. In the first two cases, the constant<br />

bot<strong>to</strong>m edge is produced by the internal comm<strong>and</strong> \flushbot<strong>to</strong>m, whereas the<br />

varying bot<strong>to</strong>m is produced by the comm<strong>and</strong> \raggedbot<strong>to</strong>m. The user may<br />

apply these declarations <strong>to</strong> change the behavior of the bot<strong>to</strong>m edge at any time,<br />

independent of document class <strong>and</strong> options.<br />

Exercise 3.5: You can change the page format of your text by altering the above<br />

parameters. Add the following <strong>to</strong> the preamble of your text:<br />

\setlength{\textwidth}{13cm} \setlength{\textheight}{20.5cm}<br />

The upper <strong>and</strong> left margins of your output will now seem <strong>to</strong>o small. Select<br />

new values for \oddsidemargin <strong>and</strong> \<strong>to</strong>pmargin <strong>to</strong> correct this. Note: do not<br />


3.2. Page style 49<br />

forget the 1 inch margin at the left <strong>and</strong> <strong>to</strong>p from which additional margins are<br />

measured. You must take this in<strong>to</strong> account when you select \oddsidemargin<br />

<strong>and</strong> \<strong>to</strong>pmargin.<br />

Exercise 3.6: Exp<strong>and</strong> your text so that the output requires more than two full<br />

pages with the reduced page format. Add \flushbot<strong>to</strong>m <strong>to</strong> the preamble <strong>and</strong><br />

check that the last line of all pages is at exactly the same location.<br />

Exercise 3.7: Remove the comm<strong>and</strong> \flushbot<strong>to</strong>m <strong>and</strong> select the document<br />

class \documentclass[twoside]{article}. Now the last lines are at the same<br />

location without the \flushbot<strong>to</strong>m comm<strong>and</strong>. On the other h<strong>and</strong>, the left margin<br />

of the odd pages probably does not agree with the right margin of the even pages.<br />

Adjust the value of \evensidemargin <strong>to</strong> correct this.<br />

3.2.6 Simplified page formatting<br />

Package: Getting the page layout <strong>to</strong> be exactly the way you want it can be very<br />

geometry tedious. Just centering the text on the page involves a complex set of<br />

settings that are not at all intuitive. The geometry package by Hideo<br />

Umeki offers considerable assistance.<br />

With this package, one can easily give values for some of the layout<br />

parameters, <strong>and</strong> the rest will be set au<strong>to</strong>matically, taking in<strong>to</strong> account<br />

the <strong>to</strong>tal paper size. For example, <strong>to</strong> set \textwidth <strong>to</strong> 15 cm <strong>and</strong><br />

\textheight <strong>to</strong> 25 cm on A4 paper, one gives<br />

\usepackage{geometry}<br />

\geometry{a4paper,textwidth=15cm,textheight=25cm}<br />

which will also au<strong>to</strong>matically set \oddsidemargin <strong>and</strong> \<strong>to</strong>pmargin so<br />

that the text is centered horizontally <strong>and</strong> vertically, including the head<br />

<strong>and</strong> footlines. Or, one can set all the margins <strong>to</strong> be 1 inch on US letter<br />

paper with<br />

\geometry{letterpaper,margin=1in}<br />

Rather than using the \geometry comm<strong>and</strong>, one may also place the<br />

parameters as options <strong>to</strong> \usepackage, for example as<br />

\usepackage[a4paper,left=3cm,right=2cm]{geometry}<br />

<strong>to</strong> set the left <strong>and</strong> right margins <strong>to</strong> definite values, <strong>and</strong> \textwidth <strong>to</strong><br />

what is left over.<br />

In general, all the parameters in Figure 3.1 may be specified by<br />

geometry by giving their names (without the backslash character). However,<br />

the package is far more powerful than that. Here we describe the<br />

essential features of version 2.3 from 2000/06/28.<br />

• The paper size is either inherited from the \documentclass option,<br />

given as a predefined option like a4paper, given explicitly as


50 Chapter 3. Document Layout <strong>and</strong> Organization<br />

paperwidth=pwidth <strong>and</strong> paperheight=pheight, or as papersize=<br />

{pwidth,pheight}.<br />

• By default, the other layout parameters are set so that \textwidth is<br />

80% of \paperwidth <strong>and</strong> \textheight + \headheight + \headsep<br />

+ \footskip is 90% of \paperheight, centered horizontally <strong>and</strong><br />

vertically.<br />

• The text width <strong>and</strong> height may be set explicitly with width=width<br />

<strong>and</strong> height=height, or with body={width,height}. The margins are<br />

then set <strong>to</strong> center. Here height means <strong>to</strong>tal text height including<br />

head <strong>and</strong> footlines.<br />

• Margins may be explicitly given with left=lmarg <strong>and</strong> right=rmarg,<br />

or with hmargin={lmarg,rmarg}. Similarly with <strong>to</strong>p=tmarg <strong>and</strong><br />

bot<strong>to</strong>m=bmarg, or vmargin={tmarg,bmarg}. If only one value of a<br />

pair is given, the other is set <strong>to</strong> that same value, unless the corresponding<br />

text height or width has been given explicitly. All margins<br />

may be set <strong>to</strong> a common value with margin=marg.<br />

Unlike L AT E X st<strong>and</strong>ard \oddsidemargin <strong>and</strong> \<strong>to</strong>pmargin, geometry’s<br />

margins are measured from the edge of the paper, <strong>and</strong> not from a<br />

point 1 inch removed.<br />

• With nohead, nofoot, noheadfoot, one tells geometry not <strong>to</strong> include<br />

the corresponding head or footline in the height calculation.<br />

Thus with noheadfoot, the <strong>to</strong>tal height is identical <strong>to</strong> \textheight.<br />

• With includemp, the marginal note parameters \marginparwidth<br />

<strong>and</strong> \marginparsep (Section 4.10.5) are included in the <strong>to</strong>tal width<br />

calculation, which is then less than \textwidth. With reversemp,<br />

the marginal notes appear in the left margin.<br />

• The text width <strong>and</strong> height may be set <strong>to</strong> a fraction of the paper<br />

size with hscale=h <strong>and</strong> vscale=v, or scale={h,v}. With scale=s,<br />

both h <strong>and</strong> v are set <strong>to</strong> s. For example, \geometry{scale=0.8}<br />

sets width <strong>and</strong> height <strong>to</strong> 80% of \paperwidth <strong>and</strong> \paperheight<br />

respectively.<br />

• For two-sided output, add the option twoside. In this case, the values<br />

of the left <strong>and</strong> right margins will switch for even page numbers.<br />

In addition, a quantity of 20 pt is added <strong>to</strong> <strong>and</strong> subtracted from<br />

the left margin of odd <strong>and</strong> even pages, respectively. This value may<br />

be changed with twosideshift=shift, which also sets the twoside<br />

option au<strong>to</strong>matically.<br />

• With the verbose option, the calculated values of all the layout<br />

parameters are printed <strong>to</strong> the moni<strong>to</strong>r <strong>and</strong> <strong>to</strong> the transcript file.


3.2. Page style 51<br />

As you see, the geometry package is an enormous aid <strong>to</strong> setting the<br />

page layout, working fairly intuitively, au<strong>to</strong>matically setting values for the<br />

unspecified parameters in a way that is normally what one would want<br />

anyway. There are many more aspects explained in the accompanying<br />

documentation, but the above synopsis should cover most requirements.<br />

3.2.7 Single <strong>and</strong> double column pages<br />

The document class option twocolumn sets the entire document in two<br />

columns per page. The default is one column per page. Individual pages<br />

may be output in one or two columns with the declarations:<br />

\twocolumn[header text]<br />

Terminates the current page, starting a new one with two columns<br />

per page. The optional header text is written at the <strong>to</strong>p of the<br />

page in one column with the width of the whole page.<br />

\onecolumn<br />

Terminates the current two-column page <strong>and</strong> continues with one<br />

column per page.<br />

The option twocolumn au<strong>to</strong>matically changes certain page style parameters,<br />

! such as indentation, compared with the one-column format. This does not occur<br />

with the comm<strong>and</strong> \twocolumn. These additional changes must be made with<br />

the corresponding \setlength declarations if they are desired. If the bulk of<br />

the document is in two-column format, the class option is <strong>to</strong> be preferred.<br />

An additional page style parameter is \columnwidth, the width of one column<br />

! of text. For single column text, this is the same as \textwidth, but when<br />

twocolumn has been selected, L AT E X calculates it from the values of \textwidth<br />

<strong>and</strong> \columnsep. The author should never change this parameter, but he or she<br />

may make use of it, for example <strong>to</strong> draw a rule the width of a column of text.<br />

The length \linewidth is even more general, always containing the text line<br />

! width in the current environment, minipage, parbox. Within a single column, it<br />

is the same as \columnwidth. It <strong>to</strong>o may never be changed.<br />

3.2.8 Multicolumn text<br />

Package: The comm<strong>and</strong>s \twocolumn <strong>and</strong> \onecolumn always start a new page,<br />

multicol <strong>and</strong> when two-column text is terminated, the two columns are of unequal<br />

length. These problems are solved with the multicol package in the<br />

<strong>to</strong>ols collection, written by Frank Mittelbach, which also allows up <strong>to</strong> 10<br />

columns of text. Once this package has been loaded, one can switch the<br />

number of columns in the middle of a page with<br />

\begin{multicols}{num cols}[header text][pre space]<br />

Text set in num cols columns<br />

\end{multicols}


52 Chapter 3. Document Layout <strong>and</strong> Organization<br />

where the optional header text is written across all the columns before<br />

switching <strong>to</strong> multicolumns.<br />

Some au<strong>to</strong>matic control for page breaking before <strong>and</strong> after switching<br />

<strong>to</strong> multicolumns is offered by the two lengths \premulticols <strong>and</strong><br />

\postmulticols: if the remaining space on the current page is less<br />

than \premulticols, a new page is started before switching <strong>to</strong> multicolumns.<br />

Similarly, if at the end of the environment, there is less than<br />

\postmulticols on the page, a page break is inserted before continuing.<br />

The st<strong>and</strong>ard values of these lengths may be altered by the user with<br />

\setlength, or in the case of \premulticols may be overridden by the<br />

second optional argument pre space.<br />

The lengths \columnsep <strong>and</strong> \columnseprule that apply <strong>to</strong> twocolumn<br />

texts are also in effect for the multicols environment, <strong>to</strong> set<br />

the widths of the gap between columns <strong>and</strong> a possible separating rule,<br />

respectively.<br />

There is also a starred version \begin{multicols*}{num cols}. . .<br />

\end{multicols*} for which the columns on the last page are not balanced,<br />

with all the remaining space put in<strong>to</strong> the final column.<br />

3.3 Parts of the document<br />

Every document is subdivided in<strong>to</strong> chapters, sections, subsections, <strong>and</strong><br />

so on. There can be an appendix at the end <strong>and</strong> at the beginning a title<br />

page, table of contents, an abstract, etc. L AT E X has a number of markup<br />

comm<strong>and</strong>s available <strong>to</strong> indicate these structures. In addition, sequential<br />

numbering <strong>and</strong> sub-numbering of headings take place au<strong>to</strong>matically. Even<br />

a table of contents may be produced with a single comm<strong>and</strong>.<br />

The effects of some sectioning comm<strong>and</strong>s depend on the selected<br />

document class <strong>and</strong> not all comm<strong>and</strong>s are available in every class.<br />

3.3.1 Title page<br />

A title page can be produced either unformatted with the environment<br />

\begin{titlepage} Title page text \end{titlepage}<br />

or with the comm<strong>and</strong>s<br />

\title{Title text}<br />

\author{Author names <strong>and</strong> addresses}<br />

\date{Date text}<br />

\maketitle<br />

in the preprogrammed L AT E X style.<br />

In the st<strong>and</strong>ard L AT E X layout for the title page, all entries are centered<br />

on the lines in which they appear. If the title is <strong>to</strong>o long, it will be broken


\title{%<br />

How <strong>to</strong> Write DVI Drivers}<br />

\author{%<br />

Helmut Kopka\thanks{Tel.<br />

[+49] 5556--401--451}\\<br />

Max--Planck--Institut\\<br />

f\"ur Aeronomie<br />

\<strong>and</strong><br />

Phillip G. Hardy<br />

\thanks{Tel.<br />

[+1] 319--824--7134}\\<br />

University\\of Iowa}<br />

\maketitle<br />

3.3. Parts of the document 53<br />

How <strong>to</strong> Write DVI Drivers<br />

Helmut Kopka 1<br />

Max–Planck–Institut<br />

für Aeronomie<br />

1 Tel. [+49] 5556–401–451<br />

2 Tel. [+1] 319–824–7134<br />

January 15, 2004<br />

Phillip G. Hardy 2<br />

University<br />

of Iowa<br />

Figure 3.2: Sample title page <strong>and</strong> the text that produced it<br />

up au<strong>to</strong>matically. The author may select the break points himself with<br />

the \\ comm<strong>and</strong>, that is, by giving \title{...\\...\\...}.<br />

If there are several authors, their names may be separated with \<strong>and</strong><br />

from one another, such as \author{G. Smith \<strong>and</strong> J. Jones}. These<br />

names will be printed next <strong>to</strong> each other in one line. The sequence<br />

\author{Author1\\Institute1\\Address1<br />

\<strong>and</strong> Author2\\Institute2\\Address2}<br />

separately centers the entries, one per line, in each of the sets Author1,<br />

Institute1, Address1 <strong>and</strong> Author2, Institute2, Address2 <strong>and</strong> places the two<br />

blocks of centered entries beside each other on the title page.<br />

Instead of printing the author names next <strong>to</strong> each other, one may<br />

position them on <strong>to</strong>p of one another by replacing \<strong>and</strong> with the \\<br />

comm<strong>and</strong>. In this case, the vertical spacing may be adjusted with an<br />

optional length specification [space] following the \\.<br />

If the comm<strong>and</strong> \date is omitted, the current date is printed au<strong>to</strong>matically<br />

below the author entries on the title page. On the other h<strong>and</strong>,<br />

the comm<strong>and</strong> \date{Date text} puts the text Date text in place of the<br />

current date. Any desired text may be inserted here, including line break<br />

comm<strong>and</strong>s \\ for more than one line of centered text.


54 Chapter 3. Document Layout <strong>and</strong> Organization<br />

The comm<strong>and</strong><br />

\thanks{Footnote text}<br />

may be given at any point in the title, author, or date text. This puts a<br />

marker at that point where the comm<strong>and</strong> appears <strong>and</strong> writes footnote text<br />

as a footnote on the title page.<br />

The title page is created using the entries in \title, \author, \date,<br />

<strong>and</strong> \thanks when the comm<strong>and</strong><br />

\maketitle<br />

is issued. The title page itself does not possess a page number <strong>and</strong><br />

the first page of the following document is number 1. (For book, the<br />

page numbering is controlled by the special comm<strong>and</strong>s in Section 3.3.5.)<br />

A separate title page is only produced for document classes book <strong>and</strong><br />

report. For article, the comm<strong>and</strong> \maketitle creates a title heading<br />

on the first page using the centered entries from the \title, \author,<br />

<strong>and</strong>, if present, \date <strong>and</strong> \thanks declarations. If the document class<br />

option titlepage has been given, the title appears on a separate page<br />

even for the article class.<br />

An example of a title page in the st<strong>and</strong>ard L AT E X format is shown in<br />

Figure 3.2 on the previous page. Note that the current date appears<br />

au<strong>to</strong>matically since the comm<strong>and</strong> \date is missing in the definition of<br />

the title page. This comm<strong>and</strong> may be used <strong>to</strong> put any desired text in place<br />

of the date.<br />

For the unformatted title page produced with the titlepage environment,<br />

the comm<strong>and</strong>s \title <strong>and</strong> \author are left out <strong>and</strong> the entire<br />

title page is designed according <strong>to</strong> the author’s specifications within the<br />

environment. To this end he or she may make use of all the structuring<br />

comm<strong>and</strong>s described in Chapter 4. In this case the printing of the title<br />

page is implemented at the end of the titlepage environment, so the<br />

comm<strong>and</strong> \maketitle is also left out.<br />

Exercise 3.8: Remove the declarations for changing the page format in Exercises<br />

3.5–3.7. Add <strong>to</strong> your exercise text a title heading with the title ‘Exercises’,<br />

your name as author, <strong>and</strong> your address, <strong>to</strong>gether with a date entry in the form<br />

‘place, date’. To do this, write the following comm<strong>and</strong>s after \begin{document}:<br />

\title{Exercises} \author{Your name\\Your address}<br />

\date{Your <strong>to</strong>wn, \<strong>to</strong>day} \maketitle<br />

Make sure that you have selected document class article. After printing the<br />

document, change the document class comm<strong>and</strong> <strong>to</strong><br />

\documentclass[titlepage]{article}<br />

<strong>to</strong> put the title information on <strong>to</strong> a title page instead of a title heading. Deactivate<br />

these comm<strong>and</strong>s by putting the comment character % at the beginning of each of<br />

the lines. In this way you avoid getting a title page in the following exercises but<br />

you can easily reactivate the comm<strong>and</strong>s simply by removing the % characters.


3.3.2 Abstract<br />

The abstract is produced with the comm<strong>and</strong><br />

3.3. Parts of the document 55<br />

\begin{abstract} Text for the abstract \end{abstract}<br />

In document class report, the abstract appears on a separate page without<br />

a page number; in article, it comes after the title heading on the<br />

first page, unless the document class option titlepage has been selected,<br />

in which case it is also printed on a separate page. An abstract is not<br />

possible in document class book.<br />

3.3.3 Sections<br />

The following comm<strong>and</strong>s are available for producing au<strong>to</strong>matic, sequential<br />

sectioning:<br />

\part \chapter \subsection \paragraph<br />

\section \subsubsection \subparagraph<br />

With the exception of \part, these comm<strong>and</strong>s form a sectioning hierarchy.<br />

In document classes book <strong>and</strong> report, the highest sectioning level<br />

is \chapter. The chapters are divided in<strong>to</strong> sections using the \section<br />

comm<strong>and</strong>, which are further subdivided by means of \subsection, <strong>and</strong><br />

so on. In document class article, the hierarchy begins with \section<br />

since \chapter is not available.<br />

The syntax of all these comm<strong>and</strong>s is<br />

\sec comm<strong>and</strong>[short title]{title} or<br />

\sec comm<strong>and</strong>*{title}<br />

In the first case, the section is given the next number in the sequence,<br />

which is then printed <strong>to</strong>gether with a heading using the text title. The text<br />

short title becomes the entry in the table of contents (Section 3.4) <strong>and</strong> the<br />

page head (provided that page style headings has been selected). If the<br />

optional short title is omitted, it is set equal <strong>to</strong> title; this is the normal<br />

situation unless title is <strong>to</strong>o long <strong>to</strong> serve for the other entries.<br />

In the second (*-form) case, no section number is printed <strong>and</strong> no entry<br />

in the table of contents is made (however, see Section 3.4.3).<br />

The size of the title heading <strong>and</strong> the depth of the numbering depend<br />

on the position of the sectioning comm<strong>and</strong> within the hierarchy. For<br />

document class article, the \section comm<strong>and</strong> generates a single<br />

number (say 7), the \subsection comm<strong>and</strong> a double number with a<br />

period between the two parts (say 7.3), <strong>and</strong> so on.<br />

In document classes book <strong>and</strong> report, the chapter headings are given a<br />

single number with the \chapter comm<strong>and</strong>, the \section comm<strong>and</strong> creates<br />

the double number, <strong>and</strong> so on. Furthermore, the comm<strong>and</strong> \chapter<br />

always starts a new page <strong>and</strong> prints Chapter n over the chapter title, where


56 Chapter 3. Document Layout <strong>and</strong> Organization<br />

n is the current chapter number. At this point in the present book, we are<br />

in Chapter 3, Section 3.3, Subsection 3.3.3.<br />

For each sectioning comm<strong>and</strong> there is an internal counter that is<br />

incremented by one every time that comm<strong>and</strong> is called, <strong>and</strong> reset <strong>to</strong> zero<br />

on every call <strong>to</strong> the next higher sectioning comm<strong>and</strong>. These counters are<br />

not altered by the *-forms, a fact that can lead <strong>to</strong> difficulties if st<strong>and</strong>ard<br />

<strong>and</strong> *-forms of the comm<strong>and</strong>s are mixed such that the *-forms are higher<br />

in the hierarchy than the st<strong>and</strong>ard forms. There are no problems, however,<br />

if the *-forms are always lower than the st<strong>and</strong>ard forms. The sequence<br />

\section ... \subsection ... \subsubsection* ...<br />

numbers the headings for \section <strong>and</strong> \subsection while leaving the<br />

headings for \subsubsection without any numbering.<br />

The sectioning comm<strong>and</strong> \part is a special case <strong>and</strong> does not affect<br />

the numbering of the other comm<strong>and</strong>s.<br />

The au<strong>to</strong>matic numbering of sections means that the numbers might<br />

not necessarily be known at the time of writing. The author may be writing<br />

them out of their final order, or might later introduce new sections or even<br />

remove some. If he or she wants <strong>to</strong> refer <strong>to</strong> a section number in the text,<br />

some mechanism other than typing the number explicitly will be needed.<br />

The L AT E X cross-reference system, described in detail in Section 9.2.1,<br />

accomplishes this task with the two basic comm<strong>and</strong>s<br />

\label{name} \ref{name}<br />

the first of which assigns a keyword name <strong>to</strong> the section number, while the<br />

second may be used as reference in the text for printing that number. The<br />

keyword name may be any combination of letters, numbers, or symbols.<br />

For example, in this book the comm<strong>and</strong> \label{sec:xref} has been<br />

typed in at the start of Section 9.2.1, so that this sentence contains the<br />

input text at the start of Section \ref{sec:xref}.<br />

A second referencing comm<strong>and</strong> is \pageref for printing the page<br />

number where the corresponding \label is defined.<br />

The referencing comm<strong>and</strong>s may be used in many other situations for<br />

labeling items that are numbered au<strong>to</strong>matically, such as figures, tables,<br />

equations.<br />

Every sectioning comm<strong>and</strong> is assigned a level number such that \section<br />

! is always level 1, \subsection level 2, . . . \subparagraph level 5. In document<br />

class article, \part is level 0 while in book <strong>and</strong> report classes, \part is level<br />

−1 <strong>and</strong> \chapter becomes level 0. Section numbering is carried out down <strong>to</strong><br />

the level given by the number secnumdepth. This limit is set <strong>to</strong> 2 for book<br />

<strong>and</strong> report, <strong>and</strong> <strong>to</strong> 3 for article. This means that for book <strong>and</strong> report, the<br />

section numbering extends only <strong>to</strong> the level of \subsection <strong>and</strong> for article <strong>to</strong><br />

\subsubsection.<br />

In order <strong>to</strong> extend (or reduce) the level of the section numbering, it is necessary<br />

<strong>to</strong> change the value of secnumdepth. This is done with the comm<strong>and</strong><br />

\setcounter{secnumdepth}{num}


3.3. Parts of the document 57<br />

(The comm<strong>and</strong> \setcounter is explained in Section 8.1.) In article, num may<br />

take on values from 0 <strong>to</strong> 5, <strong>and</strong> in book <strong>and</strong> report from −1 <strong>to</strong> 5.<br />

It is possible <strong>to</strong> change the initial value of a sectioning comm<strong>and</strong> within a<br />

document with the comm<strong>and</strong><br />

\setcounter{sec name}{num}<br />

where sec name is the name of the sectioning comm<strong>and</strong> without the preceding<br />

\ character. This procedure may be useful when individual sections are <strong>to</strong> be<br />

processed by L AT E X as single files. For example,<br />

\setcounter{chapter}{2}<br />

sets the \chapter counter <strong>to</strong> 2. The counter will be incremented on the next call<br />

<strong>to</strong> \chapter which then produces Chapter 3.<br />

3.3.4 Appendix<br />

An appendix is introduced with the declaration<br />

\appendix<br />

It has the effect of resetting the section counter for article <strong>and</strong> the<br />

chapter counter for book <strong>and</strong> report <strong>and</strong> changing the form of the numbering<br />

for these sectioning comm<strong>and</strong>s from numerals <strong>to</strong> capital letters A,<br />

B, . . . . Furthermore, the word ‘Chapter’ is replaced by ‘Appendix’ so that<br />

subsequent chapter headings are preceded by ‘Appendix A’, ‘Appendix B’,<br />

etc. The numbering of lower sectioning comm<strong>and</strong>s contains the letter in<br />

place of the chapter number, for example A.2.1.<br />

3.3.5 Book structure<br />

To simplify the structuring of a book, the comm<strong>and</strong>s<br />

\frontmatter<br />

preface, table of contents<br />

\mainmatter<br />

main body of text<br />

\backmatter<br />

bibliography, index, colophon<br />

are provided in the book class. The \frontmatter comm<strong>and</strong> switches<br />

page numbering <strong>to</strong> Roman numerals <strong>and</strong> suppresses the numbering of<br />

chapters; \mainmatter resets the page numbering <strong>to</strong> 1 with Arabic numbers<br />

<strong>and</strong> reactivates the chapter numbering; this is once again turned off<br />

with \backmatter.<br />

Exercise 3.9: Insert at the beginning of your exercise text the comm<strong>and</strong><br />

\section{Title A} <strong>and</strong> at some appropriate place near the middle \section{Title<br />

B}. Select some suitable text for Title A <strong>and</strong> Title B. Insert at appropriate places


58 Chapter 3. Document Layout <strong>and</strong> Organization<br />

some \subsection comm<strong>and</strong>s with reasonable subtitles. Remove the comm<strong>and</strong>s<br />

included from Exercise 3.3:<br />

\pagestyle{myheadings} \markright{Exercises}<br />

\pagenumbering{Roman}<br />

<strong>and</strong> print the results.<br />

Exercise 3.10: Include the additional comm<strong>and</strong> \chapter{Chapter title} with<br />

your own appropriate Chapter title before your first \section comm<strong>and</strong>. Change<br />

the document class comm<strong>and</strong> <strong>to</strong> \documentclass[twoside]{report} <strong>and</strong> call<br />

the page style comm<strong>and</strong> \pagestyle{headings} in the preamble. Note the<br />

twofold effect of the sectioning comm<strong>and</strong>s in the headings <strong>and</strong> in the page<br />

headlines. Compare the results with the table in Section 3.2.1.<br />

Exercise 3.11: Change the chapter comm<strong>and</strong> <strong>to</strong><br />

\chapter[Short form]{Chapter title}<br />

by putting an abbreviated version of Chapter title for Short form. Now the page<br />

head contains the shortened title where the full chapter title previously appeared.<br />

3.4 Table of contents<br />

3.4.1 Au<strong>to</strong>matic entries<br />

L AT E X can prepare <strong>and</strong> print a table of contents au<strong>to</strong>matically for the<br />

whole document. It will contain the section numbers <strong>and</strong> corresponding<br />

headings as given in the st<strong>and</strong>ard form of the sectioning comm<strong>and</strong>s,<br />

<strong>to</strong>gether with the page numbers on which they begin. The sectioning<br />

depth <strong>to</strong> which entries are made in the table of contents can be set in the<br />

preamble with the comm<strong>and</strong><br />

\setcounter{<strong>to</strong>cdepth}{num}<br />

The value num has exactly the same meaning <strong>and</strong> effect as it does for the<br />

counter secnumdepth described above, by which the maximum level of<br />

au<strong>to</strong>matic subsectioning is fixed. By default, the depth <strong>to</strong> which entries<br />

are included in the table of contents is the same as the st<strong>and</strong>ard level<br />

<strong>to</strong> which au<strong>to</strong>matic sectioning is done: that is, <strong>to</strong> level \subsection for<br />

book <strong>and</strong> report <strong>and</strong> <strong>to</strong> level \subsubsection for article.<br />

3.4.2 Printing the table of contents<br />

The table of contents is generated <strong>and</strong> printed with the comm<strong>and</strong><br />

\tableofcontents


3.4. Table of contents 59<br />

given at the location where the table of contents is <strong>to</strong> appear, which is<br />

normally after the title page <strong>and</strong> abstract.<br />

This leads <strong>to</strong> a paradox, for the information in the table of contents is<br />

<strong>to</strong> be printed near the beginning of the document, information that cannot<br />

be known until the end. L AT E X solves this problem as follows: the first<br />

time the document is processed, no table of contents can be included but<br />

instead L AT E X opens a new file with the same name as the source file but<br />

with the extension .<strong>to</strong>c; the entries for the table of contents are written<br />

<strong>to</strong> this file during the rest of the processing.<br />

The next time L AT E X is run on this document, the \tableofcontents<br />

comm<strong>and</strong> causes the .<strong>to</strong>c file <strong>to</strong> be read <strong>and</strong> the table of contents is<br />

printed. As the processing continues, the .<strong>to</strong>c file is updated in case<br />

there have been major changes since the previous run. This means that<br />

the table of contents that is printed is always the one corresponding <strong>to</strong> the<br />

previous version of the document. For this reason, it may be necessary <strong>to</strong><br />

run L AT E X more than once on the final version.<br />

3.4.3 Additional entries<br />

The *-form sectioning comm<strong>and</strong>s are not entered au<strong>to</strong>matically in the table of<br />

! contents. To insert them, or any other additional entry, the comm<strong>and</strong>s<br />

\addcontentsline{<strong>to</strong>c}{sec name}{entry text}<br />

\add<strong>to</strong>contents{<strong>to</strong>c}{entry text}<br />

may be used.<br />

With the first comm<strong>and</strong>, the entries will conform <strong>to</strong> the format of the table of<br />

contents, whereby section headings are indented more than those for chapter<br />

but less than those for subsection. This is determined by the value of the<br />

argument sec name, which is the same as one of the sectioning comm<strong>and</strong>s<br />

without the \ character (for example, section). The entry text is inserted in the<br />

table of contents along with the page number. This comm<strong>and</strong> is most useful <strong>to</strong><br />

enter unnumbered section headings in<strong>to</strong> the table of contents. For example,<br />

\section*{Author addresses}<br />

\addcontentsline{<strong>to</strong>c}{section}{Author addresses}<br />

The \add<strong>to</strong>contents comm<strong>and</strong> puts any desired comm<strong>and</strong> or text in<strong>to</strong> the<br />

.<strong>to</strong>c file. This could be a formatting comm<strong>and</strong>, say \newpage, which takes effect<br />

when the table of contents is printed.<br />

3.4.4 Other lists<br />

In addition <strong>to</strong> the table of contents, lists of figures <strong>and</strong> tables can also be<br />

! generated <strong>and</strong> printed au<strong>to</strong>matically by L AT E X. The comm<strong>and</strong>s <strong>to</strong> produce these<br />

lists are<br />

\lis<strong>to</strong>ffigures reads <strong>and</strong>/or produces file.lof<br />

\lis<strong>to</strong>ftables reads <strong>and</strong>/or produces file.lot


60 Chapter 3. Document Layout <strong>and</strong> Organization<br />

The entries in these lists are made au<strong>to</strong>matically by the \caption comm<strong>and</strong><br />

in the figure <strong>and</strong> table environments (see Section 7.4). Additional entries are<br />

made with the same comm<strong>and</strong>s as for the table of contents, the general form of<br />

which is<br />

\addcontentsline{file}{format}{entry}<br />

\add<strong>to</strong>contents{file}{entry}<br />

where file st<strong>and</strong>s for one of the three types <strong>to</strong>c (table of contents), lof (list of<br />

figures), or lot (list of tables). The argument format is one of the sectioning<br />

comm<strong>and</strong>s for the table of contents, as described above, or figure for the list<br />

of figures, or table for the list of tables. The argument entry st<strong>and</strong>s for the text<br />

that is <strong>to</strong> be inserted in<strong>to</strong> the appropriate file.<br />

Exercise 3.12: In your exercise file, insert after the deactivated title page comm<strong>and</strong>s<br />

\pagenumbering{roman}<br />

\tableofcontents \newpage<br />

\pagenumbering{arabic}<br />

Process your exercise file twice with L AT E X <strong>and</strong> print out the second results.<br />

Deactivate the above comm<strong>and</strong>s with % before doing the next run.


4<br />

Displayed Text<br />

There are a variety of ways <strong>to</strong> display or emphasize the text: changing<br />

font style or font size, centering, indentation, marking the paragraphs,<br />

<strong>and</strong> so on. L AT E X supplies us with comm<strong>and</strong>s for the most common forms<br />

of display.<br />

Many parts of this chapter violate the concept of logical markup,<br />

especially those dealing with selection of fonts. The author should not<br />

attempt <strong>to</strong> decorate the document with arbitrary switches of font size <strong>and</strong><br />

style, but should pack his or her source text in<strong>to</strong> a structure that indicates<br />

its purpose. The exercises in this book are an example of this. Rather<br />

than starting each one with the word ‘Exercise’ in bold face followed by<br />

an explicit number, <strong>and</strong> then shifting <strong>to</strong> a slanted font, we defined an<br />

exercise environment <strong>to</strong> do all that au<strong>to</strong>matically. This not only ensures<br />

consistency, it also allows a change of style <strong>to</strong> be easily implemented,<br />

simply by redefining the environment. This is where the typographical<br />

font comm<strong>and</strong>s come in<strong>to</strong> play. They should not appear in the main text<br />

at all, but rather in the preamble as part of the definitions of environments<br />

<strong>and</strong> comm<strong>and</strong>s.<br />

On the other h<strong>and</strong>, many of the <strong>to</strong>pics in this chapter really do involve<br />

logical markup, such as the verse, quote, <strong>and</strong> quotation environments,<br />

lists, bibliographies, theorems, <strong>and</strong> tables.<br />

4.1 Changing font<br />

In typography, a set of letters, numbers, <strong>and</strong> characters of a certain<br />

size <strong>and</strong> appearance is called a font. The st<strong>and</strong>ard font in L AT E X for the<br />

main body of text is an upright, Roman one of medium weight, in the<br />

size specified in the \documentclass statement at the start. The three<br />

possible basic sizes are 10, 11, <strong>and</strong> 12 pt, depending on the size options<br />

10pt (default), 11pt, <strong>and</strong> 12pt. (Recall, there are 72.27 points per inch<br />

or about 28.45 pt per cm.) The parenthesis characters ( ) extend the full<br />

height <strong>and</strong> depth of the font size.<br />

61


62 Chapter 4. Displayed Text<br />

The differences in the visual appearance of the three st<strong>and</strong>ard sizes<br />

are greater than would be expected from the ratios of the numbers:<br />

4.1.1 Emphasis<br />

This is an example of the 10 pt font. ( )<br />

And this is the 11 pt font for comparison. ( )<br />

And finally this is a sample of 12 pt font. ( )<br />

The usual way <strong>to</strong> emphasize text in a typewritten manuscript is by<br />

underlining. The typesetter will transform underlined text in<strong>to</strong> italics<br />

for the printed version. Switching from st<strong>and</strong>ard <strong>to</strong> emphasized text is<br />

carried out in L AT E X with the comm<strong>and</strong> \emph or the declaration \em.<br />

The \em declaration functions just as the other font declarations described<br />

below: the change of font remains in effect until negated by<br />

another appropriate declaration (which can be \em itself), or until the end<br />

of the current environment (Section 2.2). An environment may also be<br />

created with a pair of curly braces {...}. The comm<strong>and</strong> \emph, on the<br />

other h<strong>and</strong>, operates only on the text in the following argument. This is<br />

easiest way <strong>to</strong> emphasize short pieces of text, as for example:<br />

This is the easiest way <strong>to</strong> \emph{emphasize} short ...<br />

The \em declaration is more appropriate for longer text that is enclosed<br />

in an environment, named or nameless.<br />

...enclosed in an environment, {\em named or nameless.}<br />

Note carefully the difference between the declaration that remains in<br />

effect until the local environment is ended with the closing curly brace,<br />

<strong>and</strong> the comm<strong>and</strong> that operates on an argument enclosed in curly braces.<br />

Another more subtle difference is that the comm<strong>and</strong> \emph au<strong>to</strong>matically<br />

inserts extra spacing at the end if necessary, the so-called italic correction,<br />

<strong>to</strong> improve the appearance at the interface between sloping <strong>and</strong> upright<br />

fonts.<br />

Both the declaration <strong>and</strong> the comm<strong>and</strong> switch <strong>to</strong> an emphasizing font.<br />

That means, if the current font is upright it switches <strong>to</strong> italics, whereas if<br />

the text is already slanted, an upright font is selected.<br />

Nested emphasis is possible <strong>and</strong> is simple <strong>to</strong> underst<strong>and</strong>:<br />

The \emph{first}, second, <strong>and</strong> \emph{third font switch}<br />

The {\em first, {\em second, <strong>and</strong> {\em third font switch}}}<br />

both produce ‘The first, second, <strong>and</strong> third font switch’.<br />

4.1.2 Choice of font size<br />

The following declarations are available in L AT E X for changing the font size:


\tiny smallest<br />

\scriptsize very small<br />

\footnotesize smaller<br />

\small small<br />

\normalsize normal<br />

\large large<br />

4.1. Changing font 63<br />

\Large larger<br />

\LARGE even larger<br />

\huge still larger<br />

\Huge largest<br />

all of which are relative <strong>to</strong> the st<strong>and</strong>ard size selected in the document<br />

class option. In this book, the st<strong>and</strong>ard size is 10 pt, which is then the<br />

size selected with \normalsize.<br />

The font size declarations behave as all other declarations: they make<br />

an immediate change that remains in effect until counteracted by another<br />

size declaration, or until the current environment comes <strong>to</strong> an end. If<br />

issued within curly braces {..}, the effect of the declaration extends only<br />

<strong>to</strong> the closing brace, as in a nameless environment:<br />

normal {\large large \Large larger} normal again<br />

normal large larger normal again<br />

Changing the font size with one of the above comm<strong>and</strong>s also au<strong>to</strong>matically<br />

! changes the interline spacing. For every font size, there is a corresponding natural<br />

line spacing \baselineskip. This may be altered at any time. If the natural<br />

line spacing is 12 pt, the comm<strong>and</strong> \setlength{\baselineskip}{15pt} will<br />

increase it <strong>to</strong> 15 pt.<br />

The value of \baselineskip that is effective at the end of the paragraph<br />

is used <strong>to</strong> make up the whole paragraph. This means that if there are several<br />

changes <strong>to</strong> \baselineskip within a paragraph, only the last value given will be<br />

taken in<strong>to</strong> account.<br />

With every change in font size, \baselineskip is reset <strong>to</strong> its natural value<br />

for that size. Any previous setting with \setlength will be nullified.<br />

In order <strong>to</strong> create a change in the line spacing that is valid for all font sizes,<br />

one must make use of the fac<strong>to</strong>r \baselinestretch, which has a normal value<br />

of 1. The true interline spacing is really<br />

\baselinestretch×\baselineskip<br />

which maintains the same relative spacing for all font sizes. The user may change<br />

this spacing at any time with:<br />

\renewcomm<strong>and</strong>{\baselinestretch}{fac<strong>to</strong>r}<br />

where fac<strong>to</strong>r is any decimal number. A value of 1.5 increases the interline spacing<br />

(baseline <strong>to</strong> baseline) by 50% over its natural size for all font sizes.<br />

The new value of \baselinestretch does not take effect until the next<br />

change in font size. In order <strong>to</strong> implement a new value in the current font size, it<br />

is necessary <strong>to</strong> switch <strong>to</strong> another size <strong>and</strong> back again immediately. If the present<br />

font size is \normalsize, the sequence<br />

\small\normalsize<br />

will do the trick. Any size comm<strong>and</strong> may be used in place of \small.


64 Chapter 4. Displayed Text<br />

4.1.3 Font attributes<br />

The size of a font is only one of several attributes that may be used<br />

<strong>to</strong> describe it. With the New Font Selection Scheme (NFSS), which was<br />

introduced as part of L AT E X 2ε, it is possible <strong>to</strong> select fonts strictly by<br />

these attributes, as described in Appendix A. However, for normal usage,<br />

there are some declarations <strong>and</strong> corresponding comm<strong>and</strong>s <strong>to</strong> simplify<br />

this procedure.<br />

For the Computer Modern fonts provided with T E X <strong>and</strong> L AT E X, the following<br />

attributes <strong>and</strong> values exist:<br />

Family: for the general overall style. Traditional typographical families<br />

have names like Baskerville, Bodoni, Times Roman, Helvetica, <strong>and</strong><br />

so on. The st<strong>and</strong>ard L AT E X installation provides three families with<br />

declarations<br />

\rmfamily <strong>to</strong> switch (back) <strong>to</strong> a Roman font;<br />

\ttfamily <strong>to</strong> switch <strong>to</strong> a typewriter font;<br />

\sffamily <strong>to</strong> select a sans serif font.<br />

Shape: for the form of the font. The shape declarations available with<br />

the st<strong>and</strong>ard installation are<br />

\upshape <strong>to</strong> switch (back) <strong>to</strong> an upright font;<br />

\itshape <strong>to</strong> select an italic shape;<br />

\slshape <strong>to</strong> choose a font that is slanted;<br />

\scshape <strong>to</strong> switch <strong>to</strong> Caps <strong>and</strong> Small Caps.<br />

Series: for the width <strong>and</strong>/or weight (boldness) of the font. The declarations<br />

possible are<br />

\mdseries <strong>to</strong> switch (back) <strong>to</strong> medium weight;<br />

\bfseries <strong>to</strong> select a bold face font.<br />

These do not exhaust all the possible attribute settings, but they do cover<br />

the most st<strong>and</strong>ard ones, especially for the Computer Modern fonts. For<br />

other fonts, especially PostScript ones, additional attribute values exist.<br />

See Section A.1 for more details.<br />

These declarations are used just like any others, normally enclosed<br />

in a pair of curly braces {...}, such as {\scshape Romeo <strong>and</strong> Juliet}<br />

producing Romeo <strong>and</strong> Juliet. For longer sections of text, an environment<br />

is preferable:<br />

\begin{font style} . . . text in new font . . . \end{font style}<br />

This keeps better track of the beginning <strong>and</strong> end of the switch-over. For<br />

font style, any of the above font comm<strong>and</strong>s may be used, leaving off the<br />

initial \ character.<br />

Since changing any one attribute leaves the others as they were, all<br />

possible combinations may be obtained. (However, this does not mean


4.1. Changing font 65<br />

that a font exists for each possible combination; if not, a substitution<br />

will be made.) If we select first a bold series with \bfseries, <strong>and</strong> then a<br />

slanted shape with \slshape, we obtain a bold, slanted font.<br />

normal <strong>and</strong> {\bfseries bold <strong>and</strong><br />

{\slshape slanted} <strong>and</strong> back} again.<br />

produces: normal <strong>and</strong> bold <strong>and</strong> slanted <strong>and</strong> back again.<br />

Finally, the declaration \normalfont resets all the attributes (except<br />

size) back <strong>to</strong> their defaults: Roman, upright, medium weight. It is often<br />

useful <strong>to</strong> issue this comm<strong>and</strong> just <strong>to</strong> be sure of the font in effect.<br />

4.1.4 Font comm<strong>and</strong>s<br />

For each of the font declarations listed above, there is a corresponding<br />

font comm<strong>and</strong> that sets its argument in a font with the specified attribute.<br />

Family: \textrm{text} \texttt{text} \textsf{text}<br />

Shape: \textup{text} \textit{text} \textsl{text}<br />

\textsc{text}<br />

Series: \textmd{text} \textbf{text}<br />

Default: \textnormal{text}<br />

Emphasis: \emph{text}<br />

Note that the \emph comm<strong>and</strong> is included here, corresponding <strong>to</strong> the<br />

declaration \em. The argument of \textnormal is set in the st<strong>and</strong>ard<br />

font selected with \normalfont.<br />

The use of such comm<strong>and</strong>s <strong>to</strong> change the font for short pieces of text,<br />

or single words, is much more logical than placing a declaration inside an<br />

implied environment. The previous example now becomes<br />

normal <strong>and</strong> \textbf{bold <strong>and</strong> \textsl{slanted}<br />

<strong>and</strong> back} again.<br />

<strong>to</strong> make: normal <strong>and</strong> bold <strong>and</strong> slanted <strong>and</strong> back again.<br />

As for the \emph comm<strong>and</strong>, these font comm<strong>and</strong>s au<strong>to</strong>matically add<br />

any necessary italic correction between upright <strong>and</strong> slanted/italic fonts.<br />

The old two-letter T E X declarations such as \bf <strong>and</strong> \tt, which were<br />

part of L AT E X 2.09, are still available but are now considered obsolete <strong>and</strong><br />

should be avoided. They are listed for reference in Appendix F.<br />

4.1.5 Additional fonts<br />

It is likely that your computing center or your T E X installation has even more<br />

! fonts <strong>and</strong> sizes than those listed above. If so, they may be made available for<br />

use within a L AT E X document either by referring <strong>to</strong> them by name, or by their<br />

attributes, if they have been set up for NFSS.<br />

To load a new font explicitly by name, the comm<strong>and</strong>


66 Chapter 4. Displayed Text<br />

\newfont{\fnt}{name scaled fac<strong>to</strong>r} or<br />

\newfont{\fnt}{name at size}<br />

is given, which assigns the font <strong>to</strong> the new comm<strong>and</strong> named \fnt. In the first case,<br />

fac<strong>to</strong>r is a number 1000 times the scaling fac<strong>to</strong>r that is <strong>to</strong> be used <strong>to</strong> magnify<br />

or reduce the font from its basic or design size. In the second case, the font<br />

is scaled <strong>to</strong> be of the size specified. To install a slanted, sans serif font of size<br />

20.74 pt, as \sss, we load cmssi17 at 20.74pt with<br />

\newfont{\sss}{cmssi17 at 20.74pt}<br />

Now the declaration \sss switches directly <strong>to</strong> this font but without altering the<br />

baseline separation.<br />

Alternatively, the new font declaration can be made by attributes with (see<br />

Section A.3.2)<br />

\DeclareFixedFont{\sss}{OT1}{cmss}{m}{sl}{20.74}<br />

Indeed, if one wants <strong>to</strong> use the current encoding <strong>and</strong> \sffamily without knowing<br />

what they are, or without worrying so precisely what size must be stated, it is<br />

also possible <strong>to</strong> give<br />

\DeclareFixedFont{\sss}{\encodingdefault}{\sfdefault}<br />

{m}{sl}{20}<br />

(The defaults are explained in Section A.3.1.)<br />

4.1.6 Character sets <strong>and</strong> symbols<br />

The individual character sets are each s<strong>to</strong>red in their own files. The names of the<br />

! 75 st<strong>and</strong>ard T E X fonts are listed in Section G.2.2, where many of them are also<br />

printed out.<br />

Each symbol within a character set is addressed by means of a number<br />

between 0 <strong>and</strong> 127 (or 255). The comm<strong>and</strong><br />

\symbol{num}<br />

will produce that symbol with the internal identification number num in the<br />

current font. The symbol ¿ in the present font has the internal number 62<br />

<strong>and</strong> can be printed with the comm<strong>and</strong> \symbol{62}. The identification number<br />

may also be given as an octal (prefix ’) or hexadecimal (prefix ") number. Thus<br />

the symbol comm<strong>and</strong>s \symbol{28}, \symbol{’34}, <strong>and</strong> \symbol{"1C} are all<br />

identical, producing ‘ø’.<br />

The \symbol comm<strong>and</strong> may also be used <strong>to</strong> generate symbols for which<br />

no other comm<strong>and</strong> has been defined: for example, {\ttfamily\symbol{’40}<br />

\symbol{’42} \symbol{’134}} produces " \ in typewriter font.<br />

Section G.2.2 presents the assignments of the identification numbers with<br />

the characters for the different symbol families.


4.2 Centering <strong>and</strong> indenting<br />

4.2.1 Centered text<br />

The environment<br />

4.2. Centering <strong>and</strong> indenting 67<br />

\begin{center} line 1 \\ line 2 \\ . . . line n \end{center}<br />

centers the sections of text that are separated by the \\ comm<strong>and</strong>. (An<br />

optional additional line spacing may be inserted with \\[len].) If the text<br />

is <strong>to</strong>o long for one line, it is split over several lines using uniform word<br />

spacing, filling the whole line width as best it can, except for the last line.<br />

Word division does not occur.<br />

Within an environment, the comm<strong>and</strong> \centering may be used <strong>to</strong><br />

center the following text, again with \\ as the line divider. The effect of<br />

this declaration lasts until the end of that environment.<br />

A single line may be centered by typing its text as the argument of the<br />

T E X comm<strong>and</strong> \centerline{text}.<br />

4.2.2 One-sided justification<br />

The environments<br />

\begin{flushleft} line 1 \\ line 2 \\ . . . line 2 \end{flushleft}<br />

\begin{flushright} line 1 \\ line 2 \\ . . . line 2 \end{flushright}<br />

produce text that is left (flushleft) or right (flushright) justified. If a<br />

section of text does not fit on <strong>to</strong> one line, it is spread over several with<br />

fixed word spacing, the same as for the center environment. Again, word<br />

division does not occur.<br />

The same results may be produced within an environment with the<br />

declarations<br />

\raggedright replacing the flushleft environment, <strong>and</strong><br />

\raggedleft replacing the flushright environment.<br />

4.2.3 Two-sided indentation<br />

A section of text may be displayed by indenting it by an equal amount on<br />

both sides, with the environments<br />

\begin{quote} text \end{quote}<br />

\begin{quotation} text \end{quotation}<br />

Additional vertical spacing is inserted above <strong>and</strong> below the<br />

displayed text <strong>to</strong> separate it visually from the normal text.<br />

The text <strong>to</strong> be displayed may be of any length; it can be part of<br />

a sentence, a whole paragraph, or several paragraphs.


68 Chapter 4. Displayed Text<br />

Paragraphs are separated as usual with an empty line, although<br />

no empty lines are needed at the beginning <strong>and</strong> end of the<br />

displayed text since additional vertical spacing is inserted here<br />

anyway.<br />

The difference between the above two forms is thus:<br />

In the quotation environment, paragraphs are marked by<br />

extra indentation of the first line, whereas in the quote environment,<br />

they are indicated with more vertical spacing between<br />

them.<br />

The present text is produced within the quotation environment,<br />

while the sample above was done with the quote<br />

environment.<br />

The quotation environment is only really meaningful when<br />

the regular text makes use of first-line indentation <strong>to</strong> show off<br />

new paragraphs.<br />

4.2.4 Verse indentations<br />

For indenting rhymes, poetry, verses, etc. on both sides, the environment<br />

\begin{verse} poem \end{verse}<br />

is more appropriate.<br />

Stanzas are separated by blank lines<br />

while the individual lines of the stanza are divided by the \\<br />

comm<strong>and</strong>.<br />

If a line is <strong>to</strong>o long for the reduced text width, it will be left<br />

<strong>and</strong> right justified <strong>and</strong> continued on the next line, which is<br />

indented even further.<br />

The above indenting schemes may be nested inside one another. Within<br />

a quote environment there may be another quote, quotation, or verse<br />

environment. Each time, additional indentations are created on both sides<br />

of the text <strong>and</strong> vertical spacing is added above <strong>and</strong> below; these quantities<br />

however decrease as the depth of nesting increases. A maximum of six<br />

such nestings is allowed.<br />

Exercise 4.1: Put some appropriate sections of text in your exercise file in<strong>to</strong> the<br />

quote <strong>and</strong> quotation environments, that is, enclose these sections within<br />

\begin{quote} . . . . . . . \end{quote} or<br />

\begin{quotation} . . . . . \end{quotation}<br />

comm<strong>and</strong>s.


4.3 Lists<br />

4.3. Lists 69<br />

Exercise 4.2: Make up a new file with the name poem.tex <strong>and</strong> type your favorite<br />

poem in the verse environment. Select 12pt as the st<strong>and</strong>ard font size <strong>and</strong> italic<br />

as the typeface. Put the title of the poem before the verse environment in a<br />

larger bold typeface, such as \Large\bfseries. Include the name of the poet<br />

right justified.<br />

Note: remember that you may include declarations <strong>to</strong> change the font style or<br />

size within an environment <strong>and</strong> that these remain in effect only until the end of<br />

that environment.<br />

Exercise 4.3: Make up another file with the name title.tex. Do you recall<br />

the titlepage environment for producing a free-form title page? If not, refer<br />

<strong>to</strong> Section 3.3.1. Create a title page with this environment using font sizes <strong>and</strong><br />

styles of your choice, centering all the entries.<br />

Note: within the titlepage environment you may of course make use of the<br />

center environment, but it is also sufficient <strong>to</strong> give the \centering declaration<br />

instead, since this will remain in effect only until the end of the titlepage<br />

environment.<br />

Choose the individual line spacings with the comm<strong>and</strong> \\[len] using an<br />

appropriate value for the spacing len. Remember that vertical spacing before the<br />

first line of text must be entered with the *-form of the comm<strong>and</strong> \vspace*[len]<br />

(see Section 2.7.3).<br />

Experiment with different font sizes <strong>and</strong> styles for the various parts of the<br />

title page, such as title, author’s name, address, until you are satisfied with the<br />

results.<br />

Compare your own title page with that of Exercise 3.8. If your creation appeals<br />

<strong>to</strong> you more, include it in your st<strong>and</strong>ard exercise file by replacing the comm<strong>and</strong>s<br />

\title, \author, \date, <strong>and</strong> \maketitle with the titlepage environment <strong>and</strong><br />

your own entries.<br />

There are three environments available for producing formatted lists:<br />

\begin{itemize} list text \end{itemize}<br />

\begin{enumerate} list text \end{enumerate}<br />

\begin{description} list text \end{description}<br />

In each of these environments, the list text is indented from the left margin<br />

<strong>and</strong> a label, or marker, is included. What type of label is used depends<br />

on the selected list environment. The comm<strong>and</strong> <strong>to</strong> produce the label is<br />

\item.<br />

4.3.1 Sample itemize<br />

• The individual entries are indicated with a black dot, a so-called<br />

bullet, as the label.


70 Chapter 4. Displayed Text<br />

• The text in the entries may be of any length. The label appears at<br />

the beginning of the first line of text.<br />

• Successive entries are separated from one another by additional<br />

vertical spacing.<br />

The above text was produced as follows:<br />

\begin{itemize}<br />

\item The individual entries are indicated with a black dot, a<br />

so-called \emph{bullet}, as the label.<br />

\item The text in the entries may be of any length. The label<br />

appears at the beginning of the first line of text.<br />

\item Successive entries are separated from one another by<br />

additional vertical spacing.<br />

\end{itemize}<br />

4.3.2 Sample enumerate<br />

1. The labels consist of sequential numbers.<br />

2. The numbering starts at 1 with every call <strong>to</strong> the enumerate environment.<br />

The above example was generated with the following text:<br />

\begin{enumerate}<br />

\item The labels consist of sequential numbers.<br />

\item The numbering starts at 1 with every call <strong>to</strong> the<br />

\texttt{enumerate} environment.<br />

\end{enumerate}<br />

4.3.3 Sample description<br />

purpose This environment is appropriate when a number of words or<br />

expressions are <strong>to</strong> be defined.<br />

example A keyword is used as the label <strong>and</strong> the entry contains a clarification<br />

or explanation.<br />

other uses It may also be used as an author list in a bibliography.<br />

The above sample was created using the following:<br />

\begin{description}<br />

\item[purpose] This environment is appropriate when a number of<br />

words or expressions are <strong>to</strong> be defined.<br />

\item[example] A keyword is used as the label <strong>and</strong> the entry<br />

contains a clarification or explanation.<br />

\item[other uses] It may also be used as an author list in a<br />

bibliography.<br />

\end{description}


4.3. Lists 71<br />

The \item[option] comm<strong>and</strong> contains an optional argument that appears<br />

in bold face as the label.<br />

4.3.4 Nested lists<br />

The above lists may be included within one another, either mixed or of<br />

one type, <strong>to</strong> a depth of four levels. The type of label used depends on the<br />

depth of the nesting. The indentation is always relative <strong>to</strong> the left margin<br />

of the enclosing list. A fourfold nesting of the itemize environment<br />

appears as follows:<br />

• The label for the first level is a black dot, a bullet.<br />

– That of the second level is a long dash.<br />

∗ That of the third level is an asterisk.<br />

· And the label for the fourth level is a simple dot.<br />

· At the same time, the vertical spacing is decreased with<br />

increasing depth.<br />

∗ Back <strong>to</strong> the third level.<br />

– Back <strong>to</strong> the second level.<br />

• And here we are at the first level of itemize once again.<br />

Similarly for the enumerate environment, where the style of the numbering<br />

changes with the nesting level:<br />

1. The numbering at the first level is with Arabic numerals followed by<br />

a period.<br />

(a) At the second level, it is with lower case letters in parentheses.<br />

i. The third level is numbered with lower case Roman numerals<br />

with a period.<br />

A. At the fourth level, capital letters are used.<br />

B. The label style can be changed, as described in the next<br />

section.<br />

ii. Back <strong>to</strong> the third level.<br />

(b) Back <strong>to</strong> the second level.<br />

2. And the first level of enumerate again.<br />

An example of a nested list with mixed types:<br />

• The itemize label at the first level is a bullet.<br />

1. The numbering is with Arabic numerals since this is the first<br />

level of the enumerate environment.


72 Chapter 4. Displayed Text<br />

– This is the third level of the nesting, but the second itemize<br />

level.<br />

(a) And this is the fourth level of the overall nesting, but<br />

only the second of the enumerate environment.<br />

(b) Thus the numbering is with lower case letters in parentheses.<br />

– The label at this level is a long dash.<br />

2. Every list should contain at least two points.<br />

• Blank lines ahead of an \item comm<strong>and</strong> have no effect.<br />

The above mixed list was produced with the following text:<br />

\begin{itemize}<br />

\item The \texttt{itemize} label at the first level is a ...<br />

\begin{enumerate}<br />

\item The numbering is with Arabic numerals since this ...<br />

\begin{itemize}<br />

\item This is the third level of the nesting, but the ...<br />

\begin{enumerate}<br />

\item And this is the fourth level of the overall ...<br />

\item Thus the numbering is with lower case letters ...<br />

\end{enumerate}<br />

\item The label at this level is a long dash.<br />

\end{itemize}<br />

\item Every list should contain at least two points.<br />

\end{enumerate}<br />

\item Blank lines ahead of an \verb+\item+ comm<strong>and</strong> ...<br />

\end{itemize}<br />

Exercise 4.4: Produce a nested list using the itemize <strong>and</strong> enumerate environments<br />

as in the above example, but with a different sequence of these comm<strong>and</strong>s.<br />

Exercise 4.5: Prepare a list of conference participants with their place of residence<br />

using the description environment, where the name of the participant appears<br />

as the argument in the \item comm<strong>and</strong>.<br />

Note: for all three types of lists, any text before the first \item comm<strong>and</strong> will<br />

yield an error message on processing.<br />

4.3.5 Changing label style<br />

The labels, or markers, used in the itemize <strong>and</strong> enumerate environments<br />

can be easily changed by means of the optional argument in the \item<br />

comm<strong>and</strong>. With \item[+] the label becomes +, <strong>and</strong> with \item[2.1:]<br />

it is 2.1:. The optional argument takes precedence over the st<strong>and</strong>ard


4.3. Lists 73<br />

label. For the enumerate environment, this means that the corresponding<br />

counter is not au<strong>to</strong>matically incremented <strong>and</strong> the user must do the<br />

numbering manually.<br />

The optional label appears right justified within the area reserved for<br />

the label. The width of this area is the amount of indentation at that level<br />

less the separation between label <strong>and</strong> text; this means that the left edge<br />

of the label area is flush with the left margin of the enclosing level.<br />

It is also possible <strong>to</strong> change the st<strong>and</strong>ard labels for all or part of the<br />

document. The labels are generated with the internal comm<strong>and</strong>s<br />

\labelitemi , \labelitemii , \labelitemiii , \labelitemiv<br />

\labelenumi , \labelenumii , \labelenumiii , \labelenumiv<br />

The endings i, ii, iii, <strong>and</strong> iv refer <strong>to</strong> the four possible levels.<br />

These comm<strong>and</strong>s may be altered with \renewcomm<strong>and</strong>. For example,<br />

<strong>to</strong> change the label of the third level of the itemize environment from ∗<br />

<strong>to</strong> +, give<br />

\renewcomm<strong>and</strong>{\labelitemiii}{+}<br />

Similarly the st<strong>and</strong>ard labels for the enumerate environment may be<br />

changed. However, here there is an additional complication that there<br />

is a counter for each enumerate level, named enumi, enumii, enumiii,<br />

<strong>and</strong> enumiv. As explained in Section 8.1.4, the value of a counter can be<br />

printed using one of the comm<strong>and</strong>s \arabic, \roman, \Roman, \alph,<br />

or \Alph, where the style of each comm<strong>and</strong> should be obvious from its<br />

name. That is, \Roman{xyz} prints the current value of the counter xyz<br />

in upper case Roman numerals, whereas \alph{xyz} prints it as a lower<br />

case letter (with a corresponding <strong>to</strong> 1 <strong>and</strong> z <strong>to</strong> 26).<br />

These counters, <strong>to</strong>gether with the counter style comm<strong>and</strong>s, must be<br />

used in the redefinitions of the label comm<strong>and</strong>s. For example, <strong>to</strong> change<br />

the second-level label <strong>to</strong> Arabic numerals followed by ‘.)’, it is necessary<br />

<strong>to</strong> give<br />

\renewcomm<strong>and</strong>{\labelenumii}{\arabic{enumii}.)}<br />

which redefines \labelenumii <strong>to</strong> the value of counter enumii printed in<br />

Arabic, plus the characters ‘.)’. In this way, all the numbering levels may<br />

be changed. It is even possible <strong>to</strong> include more than one counter:<br />

\renewcomm<strong>and</strong>{\labelenumii}{\Alph{enumi}.\arabic{enumii}}<br />

which will produce for every call <strong>to</strong> \item at level two the value of the<br />

counter enumi as a capital letter followed by the value of counter enumii<br />

as a number: that is, in the form A.1, A.2, . . . , B.1, B.2, . . . <strong>and</strong> so on.<br />

If the new st<strong>and</strong>ard labels are <strong>to</strong> apply <strong>to</strong> the whole document, the<br />

redefining comm<strong>and</strong>s should be included in the preamble. Otherwise,<br />

they are valid only within the environment in which they appear.


74 Chapter 4. Displayed Text<br />

Package:<br />

enumerate<br />

Exercise 4.6: Change the st<strong>and</strong>ard labels for the itemize environment in<strong>to</strong> a<br />

long dash — (written ---) for the first level, <strong>to</strong> a medium dash – (--) for the<br />

second level, <strong>and</strong> <strong>to</strong> a hyphen - for the third level.<br />

Exercise 4.7: Change the st<strong>and</strong>ard labels for the enumerate environment for the<br />

first level <strong>to</strong> (I), (II), . . . , <strong>and</strong> for the second level <strong>to</strong> the Roman numerals of the<br />

first level followed by the number for the second level in the form I–1:, I–2:, . . . ,<br />

II–1:, II–2:, . . . .<br />

An alternative method of cus<strong>to</strong>mizing the enumeration labels is with<br />

the enumerate package in the <strong>to</strong>ols collection (Section B.5.4). Once this<br />

package has been loaded, the enumerate environment accepts an optional<br />

argument specifying the text of the label. The characters A a I i 1<br />

represent the number in alphabetical, Roman, Arabic styles. If these<br />

characters appear elsewhere in the label text, they must be in {}. For<br />

example,<br />

\begin{enumerate}[{Case} A]<br />

\item Witness tells the truth<br />

\item Witness is lying<br />

\end{enumerate}<br />

4.4 Generalized lists<br />

=⇒<br />

Case A Witness tells the truth<br />

Case B Witness is lying<br />

Lists such as those in the three environments itemize, enumerate, <strong>and</strong><br />

description can be formed in a quite general way. The type of label <strong>and</strong><br />

its width, the depth of indentation, spacings for paragraphs <strong>and</strong> labels,<br />

<strong>and</strong> so on, may be wholly or partially set by the user by means of the list<br />

environment:<br />

\begin{list}{stnd lbl}{list decl} item list \end{list}<br />

Here item list consists of the text for the listed entries, each of which<br />

begins with an \item comm<strong>and</strong> that generates the corresponding label.<br />

The stnd lbl contains the definition of the label <strong>to</strong> be produced by the<br />

\item comm<strong>and</strong> when the optional argument is missing (see below).<br />

The list parameters described in Section 4.4.2 are set by list decl <strong>to</strong><br />

whatever new values the user wishes.<br />

4.4.1 St<strong>and</strong>ard label<br />

The first argument in the list environment defines the stnd lbl, that<br />

is, the label that is produced by the \item comm<strong>and</strong> when it appears<br />

without an argument. In the case of an unchanging label, such as for the<br />

itemize environment, this is simply the desired symbol. If this is <strong>to</strong> be a<br />

mathematical symbol, it must be given as symbol name, enclosed in <br />

signs. For example, <strong>to</strong> select ⇒ as the label, stnd lbl must be defined <strong>to</strong><br />

be $\Rightarrow$.


4.4. Generalized lists 75<br />

However, the label is often required <strong>to</strong> contain a sequential numeration.<br />

For this purpose, a counter must be created with the \newcounter{name}<br />

comm<strong>and</strong>, where name is its designation. This comm<strong>and</strong> must appear<br />

before the first application of the counter in a list environment. Suppose<br />

a counter named marker has been defined for this use, then the argument<br />

stnd lbl could be any of the comm<strong>and</strong>s for printing counters described in<br />

Section 4.3.5: for example, \arabic{marker} produces a running Arabic<br />

number.<br />

Even more complex labels can be made up in this way. If the sequential<br />

labels are <strong>to</strong> be A–I, A–II, . . . , stnd lbl is set <strong>to</strong> A--\Roman{marker}.<br />

Before a counter can function properly within the st<strong>and</strong>ard label, it<br />

must be associated with that list by including in the list decl the comm<strong>and</strong><br />

\usecounter{counter}, where counter is the name of the counter <strong>to</strong> be<br />

assigned (marker in the above example).<br />

The st<strong>and</strong>ard label is actually generated by the comm<strong>and</strong> \makelabel{label},<br />

! which is called by the \item comm<strong>and</strong>. The user can redefine \makelabel with<br />

the aid of the \renewcomm<strong>and</strong> in the list declaration:<br />

\renewcomm<strong>and</strong>{\makelabel}{new definition}<br />

If the st<strong>and</strong>ard label is defined in this manner, the corresponding entry in the<br />

list environment is left blank. This is because \makelabel is the more general<br />

comm<strong>and</strong> <strong>and</strong> overrides the other definition.<br />

4.4.2 List style parameters<br />

There are a number of style parameters used for formatting lists that<br />

are set by L AT E X <strong>to</strong> certain st<strong>and</strong>ard values. These values may be altered<br />

by the user in the list decl for that particular list. The assignment is<br />

made in the usual way with the \setlength comm<strong>and</strong>. However, if the<br />

assignment is made outside the list environment, in most cases it will<br />

simply be ignored. This is because there are preset default values for<br />

each parameter at each level that can only be overridden by list decl.<br />

The style parameters are listed below <strong>and</strong> are also illustrated in Figure<br />

4.1 on the next page, which is based on one taken from Lamport (1985,<br />

1994).<br />

\<strong>to</strong>psep<br />

is the vertical spacing in addition <strong>to</strong> \parskip that is inserted<br />

between the list <strong>and</strong> the enclosing text above <strong>and</strong> below. Its<br />

default value is set at each list level <strong>and</strong> cannot be globally<br />

redefined outside the list decl.<br />

\par<strong>to</strong>psep<br />

is the vertical spacing in addition <strong>to</strong> \<strong>to</strong>psep + \parskip that<br />

is inserted above <strong>and</strong> below the list when a blank line precedes<br />

the first or follows the last \item entry. It may be redefined<br />

globally, but only for the first <strong>and</strong> second levels.


76 Chapter 4. Displayed Text<br />

Preceding text<br />

✻<br />

\<strong>to</strong>psep + \parskip [+ \par<strong>to</strong>psep]<br />

\labelsep<br />

✛ ✲<br />

❄<br />

✛ ✲<br />

Label<br />

\rightmargin<br />

✛ ✲ ✛ ✲<br />

Item 1<br />

✛<br />

\labelwidth<br />

✲ \itemindent Paragraph 1<br />

\leftmargin<br />

\listparindent ✻\parsep<br />

✛ ✲ ❄<br />

Item 1<br />

Paragraph 2<br />

Label<br />

✻\itemsep<br />

+ \parsep<br />

❄<br />

Item 2<br />

✻<br />

\<strong>to</strong>psep + \parskip [+ \par<strong>to</strong>psep]<br />

❄<br />

Following text<br />

Figure 4.1: The list parameters<br />

\parsep<br />

is the vertical spacing between paragraphs of a single \item. Its<br />

default value is reset at each level, as for \<strong>to</strong>psep.<br />

\itemsep<br />

is the vertical spacing in addition <strong>to</strong> \parsep that is inserted<br />

between two \item entries. As for \<strong>to</strong>psep <strong>and</strong> \parsep, its<br />

default value is reset at each level <strong>and</strong> cannot be globally changed.<br />

\leftmargin<br />

is the distance from the left edge of the current environment<br />

<strong>to</strong> the left margin of the list text. There are default values for<br />

it at each level that may be globally redefined, as described in<br />

Section 4.4.6.<br />

\rightmargin<br />

is the distance from the right edge of the current environment <strong>to</strong><br />

the right margin of the list text. Its st<strong>and</strong>ard value is 0 pt, which<br />

can only be altered in list decl.<br />

\listparindent<br />

is the indentation depth of the first line of a paragraph within<br />

an \item with respect <strong>to</strong> the left margin of the list text. It is


4.4. Generalized lists 77<br />

normally set <strong>to</strong> 0 pt so that no indentation occurs. This can only<br />

be changed in list decl.<br />

\labelwidth<br />

is the width of the box reserved for the label. The text of the<br />

label is printed right justified within this space. A new default<br />

value may be set globally which then applies <strong>to</strong> all list levels.<br />

\labelsep<br />

is the spacing between the label box <strong>and</strong> the list text. A new value<br />

may be assigned globally, but it is only effective at the first level.<br />

\itemindent<br />

is the distance by which the label <strong>and</strong> the first line of text in an<br />

\item are indented <strong>to</strong> the right. It is normally set <strong>to</strong> 0 pt <strong>and</strong> so<br />

has no effect. This value can only be redefined in list decl.<br />

When changing the vertical spacings from their st<strong>and</strong>ard values, it is<br />

recommended that a rubber length (Section 2.4.2) be used.<br />

The label created by the \item comm<strong>and</strong> normally appears right justified<br />

within a box of width \labelwidth. It is possible <strong>to</strong> make it left<br />

justified, as in the following list of parameters, by putting \hfill at the<br />

end of the definition of the st<strong>and</strong>ard label or in the \makelabel comm<strong>and</strong>.<br />

4.4.3 Example of a user’s list<br />

List of Figures:<br />

Figure 1: Page format with head, body, <strong>and</strong> foot, showing the<br />

meaning of the various elements involved.<br />

Figure 2: Format of a general list showing its elements.<br />

Figure 3: A demonstration of some of the possibilities for<br />

drawing pictures with L AT E X.<br />

This list was produced with the following input:<br />

\newcounter{fig}<br />

\begin{list}{\bfseries\upshape Figure \arabic{fig}:}<br />

{\usecounter{fig}<br />

\setlength{\labelwidth}{2cm}\setlength{\leftmargin}{2.6cm}<br />

\setlength{\labelsep}{0.5cm}\setlength{\rightmargin}{1cm}<br />

\setlength{\parsep}{0.5ex plus0.2ex minus0.1ex}<br />

\setlength{\itemsep}{0ex plus0.2ex} \slshape}<br />

\item Page format with head, body, <strong>and</strong> foot, showing the<br />

meaning of the various elements involved.<br />

\item Format of a general list showing its elements.<br />

\item A demonstration of some of the possibilities for<br />

drawing pictures with \<strong>LaTeX</strong>.<br />

\end{list}


78 Chapter 4. Displayed Text<br />

The comm<strong>and</strong> \newcounter{fig} sets up the counter fig. The st<strong>and</strong>ard<br />

label is defined <strong>to</strong> be the word Figure in upright, bold face, followed<br />

by the running Arabic number, terminated by :. This label is printed for<br />

each \item comm<strong>and</strong>.<br />

The list declaration contains \usecounter{fig} as its first comm<strong>and</strong>,<br />

which makes the counter fig operational within the list. The width of<br />

the label box (\labelwidth) is set <strong>to</strong> 2.0 cm, the left margin of the list<br />

text (\leftmargin) <strong>to</strong> 2.6 cm, the distance between the label <strong>and</strong> the text<br />

(\labelsep) <strong>to</strong> 0.5 cm, <strong>and</strong> the right edge of the list (\rightmargin) is<br />

set <strong>to</strong> be 1 cm from that of the enclosing text.<br />

The vertical spacing between paragraphs within an item (\parsep)<br />

is 0.5 ex but can be stretched an extra 0.2 ex or shrunk by 0.1 ex. The<br />

additional spacing between items (\itemsep) is 0 ex, stretchable <strong>to</strong> 0.2 ex.<br />

St<strong>and</strong>ard values are used for all the other list parameters. The last<br />

comm<strong>and</strong> in the list declaration is \slshape, which sets the list text in a<br />

slanted typeface.<br />

Note: If \upshape were not given in the label definition, the text of each<br />

\item would also be slanted, as Figure 1:.<br />

4.4.4 Lists as new environments<br />

If a particular type of list is employed several times within a document, it<br />

can become tiresome typing the same stnd lbl <strong>and</strong> list decl in<strong>to</strong> the list<br />

environment every time. L AT E X offers the possibility of defining a given list<br />

as an environment under its own name. This is achieved by means of the<br />

\newenvironment comm<strong>and</strong>.<br />

For example, the list in the above example can be s<strong>to</strong>red so that it may<br />

be called at any time with the name figlist:<br />

\newenvironment{figlist}{\begin{list}<br />

{\bfseries\upshape Figure \arabic{fig}:}<br />

{\usecounter{fig} ... {0ex plus0.2ex}\slshape}}<br />

{\end{list}}<br />

It can then be called with<br />

\begin{figlist} item list \end{figlist}<br />

so that it behaves as a predefined list environment.<br />

Exercise 4.8: Define a new environment with the name sample that produces a<br />

list in which every call <strong>to</strong> \item prints labels Sample A, Sample B, <strong>and</strong> so on. The<br />

labels are <strong>to</strong> be left justified within a box of width 20mm, <strong>and</strong> the distance between<br />

the label box <strong>and</strong> the item text is <strong>to</strong> be 2mm, with a <strong>to</strong>tal left margin of 22mm. The<br />

right edge of the text is <strong>to</strong> be moved in 5mm from that of the enclosing text. The<br />

extra vertical spacing between two items is <strong>to</strong> be 1ex plus0.5ex minus0.4ex<br />

in addition <strong>to</strong> the normal paragraph spacing. Secondary paragraphs within an


4.4. Generalized lists 79<br />

item are <strong>to</strong> be indented by 1em. The normal paragraph separation should be 0ex,<br />

exp<strong>and</strong>able <strong>to</strong> 0.5ex.<br />

L AT E X itself makes frequent use of the list environment <strong>to</strong> define a number of<br />

! other structures. For example, the quote environment is defined as<br />

\newenvironment{quote}{\begin{list}{}<br />

{setlength{\rightmargin}{\leftmargin}}<br />

\item[]}{\end{list}}<br />

This environment is thus a list in which the value of \rightmargin is set <strong>to</strong> the<br />

current value of \leftmargin which has a default value of 2.5 em. The list itself<br />

consists of a single \item call with an empty label, a call that is au<strong>to</strong>matically<br />

included in the definition of quote with the entry \item[].<br />

In the same way, L AT E X defines the quotation <strong>and</strong> verse environments internally<br />

as special list environments. The left margins <strong>and</strong> the vertical spacings<br />

around the structures are left as the st<strong>and</strong>ard values for the list environment,<br />

<strong>and</strong> are therefore changed only when the st<strong>and</strong>ard values themselves are altered.<br />

Finally, as an example of a possible user-defined special list we offer<br />

\newenvironment{lquote}{\begin{list}{}{}\item[]}{\end{list}}<br />

which creates an lquote environment that does nothing more than indent its<br />

enclosed text by the amount \leftmargin, with the right edge flush with that of<br />

the normal text, since \rightmargin has the st<strong>and</strong>ard value of 0 pt.<br />

4.4.5 Trivial lists<br />

!<br />

L AT E X also contains a trivlist environment, with syntax<br />

\begin{trivlist} enclosed text \end{trivlist}<br />

in which the arguments stnd lbl <strong>and</strong> list decl are omitted. This is the same as<br />

a list environment for which the label is empty, \leftmargin, \labelwidth,<br />

<strong>and</strong> \itemindent are all assigned the value 0 pt, while \listparindent is set<br />

equal <strong>to</strong> \parindent <strong>and</strong> \parsep <strong>to</strong> \parskip.<br />

L AT E X uses this environment <strong>to</strong> create further structures. For example, the call<br />

<strong>to</strong> the center environment generates internally the sequence<br />

\begin{trivlist} \centering \item[] enclosed text \end{trivlist}<br />

The environments flushleft <strong>and</strong> flushright are similarly defined.<br />

4.4.6 Nested lists<br />

Lists can be nested within one another with the list environments itemize,<br />

enumerate, <strong>and</strong> description, <strong>to</strong> a maximum depth of six. At each level,<br />

the new left margin is indented by the amount \leftmargin relative <strong>to</strong><br />

that of the next higher one.<br />

As mentioned earlier, it is only possible <strong>to</strong> change the st<strong>and</strong>ard values of a<br />

! limited number of the list parameters with declarations in the preamble. One<br />

exception is the indentations of the left margins for the different nesting levels.


80 Chapter 4. Displayed Text<br />

These are set internally by the parameters \leftmarginn, where n st<strong>and</strong>s for i,<br />

ii, iii, iv, v, or vi. These values can be changed by the user; for example, by<br />

declaring \setlength{\leftmarginiv}{12mm}, the left margin of the fourthlevel<br />

list is shifted 12 mm from that of the third. These declarations must be<br />

made outside of the list environments <strong>and</strong> not in the list decl.<br />

At each level of list nesting, the internal macro \@listn (n being i <strong>to</strong> vi) is<br />

called. This sets the value of \leftmargin equal <strong>to</strong> that of the corresponding<br />

\leftmarginn, unless \leftmargin is explicitly declared in the list environment.<br />

That is, there does not exist a single st<strong>and</strong>ard value for \leftmargin<br />

externally, but rather six different ones. The parameter \leftmargin has meaning<br />

only within a list environment.<br />

4.5 Theorem-like declarations<br />

In scientific literature one often has text structures like<br />

Theorem 1 (Balzano–Weierstrass) Every infinite set of bounded points<br />

possesses at least one maximum point.<br />

or<br />

Axiom 4.1 The natural numbers form a set S of distinct elements. For any<br />

two elements a, b, they are either identical, a = b, or different from one<br />

another, a ≠ b.<br />

Similar structures frequently appear with names such as Definition,<br />

Corollary, Declaration, Lemma, instead of Theorem or Axiom. What they<br />

have in common is that a keyword <strong>and</strong> a running number are printed in<br />

bold face <strong>and</strong> the corresponding text in italic.<br />

Of course, these could be generated by the user by explicitly giving the<br />

type styles <strong>and</strong> appropriate number, but if a new structure of that type is<br />

later inserted in the middle of the text, the user would have the tedious<br />

job of renumbering all the following occurrences. With the comm<strong>and</strong><br />

\newtheorem{struct type}{struct title}[in counter]<br />

L AT E X will keep track of the numbering au<strong>to</strong>matically. Here struct type is<br />

the user’s arbitrary designation for the structure, while struct title is the<br />

word that is printed in bold face followed by the running number (for<br />

example, Theorem). If the optional argument in counter is missing, the<br />

numbering is carried out sequentially throughout the entire document.<br />

However, if the name of an existing counter, such as chapter, is given for<br />

in counter, the numbering is reset every time that counter is augmented,<br />

<strong>and</strong> both are printed <strong>to</strong>gether, as in Axiom 4.1 above.<br />

The predefined structures are called with the comm<strong>and</strong><br />

\begin{struct type}[extra title] text \end{struct type}


4.6. Tabula<strong>to</strong>r s<strong>to</strong>ps 81<br />

which also increments the necessary counter <strong>and</strong> generates the proper<br />

number. The above examples were produced with<br />

\newtheorem{theorem}{Theorem} \newtheorem{axiom}{Axiom}[chapter]<br />

. . . . . . . . . . . . . . . .<br />

\begin{theorem}[Balzano--Weierstrass] Every .... \end{theorem}<br />

\begin{axiom} The natural numbers form ........... \end{axiom}<br />

The optional extra title also appears in bold face within parentheses ( )<br />

following the running number.<br />

Occasionally a structure is not numbered on its own but <strong>to</strong>gether with<br />

another structure. This can be included in the definition with another<br />

optional argument<br />

\newtheorem{struct type}[num like]{struct name}<br />

where num like is the name of an existing theorem structure that shares<br />

the same counter. Thus by defining \newtheorem{subthrm}[theorem]<br />

{Sub-Theorem}, the two structures theorem <strong>and</strong> subthrm will be numbered<br />

as a single series: Theorem 1, Sub-Theorem 2, Sub-Theorem 3,<br />

Theorem 4, <strong>and</strong> so on.<br />

For more powerful theorem <strong>to</strong>ols, see the A M S amsthm package (Section<br />

12.3.1) <strong>and</strong> the theorem package in the <strong>to</strong>ols collection (Section B.5.4).<br />

4.6 Tabula<strong>to</strong>r s<strong>to</strong>ps<br />

4.6.1 Basics<br />

On a typewriter it is possible <strong>to</strong> set tabula<strong>to</strong>r s<strong>to</strong>ps at various positions<br />

within a line; then by pressing the tab key the print head or carriage jumps<br />

<strong>to</strong> the next tab location.<br />

A similar possibility exists in L AT E X with the tabbing environment:<br />

\begin{tabbing} lines \end{tabbing}<br />

One can think of the set tab s<strong>to</strong>ps as being numbered from left <strong>to</strong> right.<br />

At the beginning of the tabbing environment, no tabs are set, except for<br />

the left border, which is called the zeroth tab s<strong>to</strong>p. The s<strong>to</strong>ps can be set<br />

at any spot within a line with the comm<strong>and</strong> \=, <strong>and</strong> a line is terminated<br />

by the \\ comm<strong>and</strong>:<br />

Here is the \=first tab s<strong>to</strong>p, followed by\= the second\\<br />

sets the first tab s<strong>to</strong>p after the blank following the word the, <strong>and</strong> the<br />

second immediately after the word by.<br />

After the tab s<strong>to</strong>ps have been set in this way, one can jump <strong>to</strong> each of<br />

the s<strong>to</strong>ps in the subsequent lines, starting from the left margin, with the<br />

comm<strong>and</strong> \>. A new line is started with the usual \\ comm<strong>and</strong>.


82 Chapter 4. Displayed Text<br />

Example:<br />

Type Quality Color Price<br />

Paper med. white low<br />

Leather good brown high<br />

Card bad gray med.<br />

4.6.2 Sample line<br />

\begin{tabbing}<br />

Type\qquad\= Quality\quad\=<br />

Color\quad\= Price\\[0.8ex]<br />

Paper \> med. \> white \> low\\<br />

Leather \> good \> brown \> high\\<br />

Card \> bad \> gray \> med.<br />

\end{tabbing}<br />

It is often advantageous or even necessary <strong>to</strong> set the tab s<strong>to</strong>ps in a sample<br />

line that is not actually printed. It could contain, for example, the widest<br />

entries in the various columns that appear later, or the smallest intercolumn<br />

spacing between s<strong>to</strong>ps. The sample line may also contain \hspace<br />

comm<strong>and</strong>s <strong>to</strong> force the distance between s<strong>to</strong>ps <strong>to</strong> be a predetermined<br />

amount.<br />

To suppress the printing of the sample line, it is ended with the<br />

comm<strong>and</strong> \kill instead of the \\ termina<strong>to</strong>r.<br />

\hspace*{3cm}\=sample column \=\hspace{4cm}\= \kill<br />

In addition <strong>to</strong> the left border, the above statement sets three tab s<strong>to</strong>ps:<br />

Left border<br />

3cm<br />

1st tab s<strong>to</strong>p<br />

❄<br />

✲sample<br />

column<br />

2nd tab s<strong>to</strong>p<br />

❄<br />

3rd tab s<strong>to</strong>p<br />

❄<br />

4cm ✲<br />

An \hspace comm<strong>and</strong> at the beginning of a sample line must be of the<br />

*-form, otherwise the inserted spacing will be deleted at the line margin.<br />

4.6.3 Tab s<strong>to</strong>ps <strong>and</strong> the left margin<br />

The left border of each line of the tabbing environment is at first identical<br />

with the left margin of the enclosing environment, <strong>and</strong> is designated the<br />

zeroth s<strong>to</strong>p. By activating the ‘tab key’ \> at the start of a line, one sets<br />

the following text beginning at the first tab s<strong>to</strong>p. However, the comm<strong>and</strong><br />

\+ has the same effect, putting the left border permanently at the first<br />

s<strong>to</strong>p, for all subsequent lines. With \+\+ at the beginning or end of a line,<br />

all the next lines will start two s<strong>to</strong>ps further along. There can be as many<br />

\+ comm<strong>and</strong>s in all as there are tab s<strong>to</strong>ps set on the line.<br />

The comm<strong>and</strong> \- has the opposite effect: it shifts the left border for<br />

the following lines one s<strong>to</strong>p <strong>to</strong> the left. It is not possible <strong>to</strong> set this border<br />

<strong>to</strong> be <strong>to</strong> the left of the zeroth s<strong>to</strong>p.<br />

The effect of the \+ comm<strong>and</strong>s may be overridden for a single line by<br />

putting \< at the start for each tab <strong>to</strong> be removed. This line then starts so<br />

many tabs <strong>to</strong> the left of the present border. With the next \\ comm<strong>and</strong>,<br />

the new line begins at the current left border determined by the <strong>to</strong>tal<br />

number of \+ <strong>and</strong> \- comm<strong>and</strong>s.


4.6.4 Further tabbing comm<strong>and</strong>s<br />

4.6. Tabula<strong>to</strong>r s<strong>to</strong>ps 83<br />

Tab s<strong>to</strong>ps can be reset or added in every line. The comm<strong>and</strong> \= will add<br />

a s<strong>to</strong>p if there have been sufficient \> comm<strong>and</strong>s <strong>to</strong> have jumped <strong>to</strong> the<br />

last s<strong>to</strong>p, otherwise it will reset the next s<strong>to</strong>p.<br />

For example:<br />

Old column 1 Old column 2<br />

Left column Middle col Extra col<br />

New col 1 New col 2 Old col 3<br />

Column 1 Column 2 Column 3<br />

Old column 1 \= Old column 2\\<br />

Left column \> Middle col<br />

\= Extra col\\<br />

New col 1 \= New col 2 \><br />

Old col 3\\<br />

Column 1\> Column 2 \> Column 3<br />

\end{tabbing}<br />

Occasionally it is desirable <strong>to</strong> be able <strong>to</strong> reset the tab s<strong>to</strong>ps <strong>and</strong> then<br />

<strong>to</strong> reuse the original ones later. The comm<strong>and</strong> \pushtabs accomplishes<br />

this by s<strong>to</strong>ring the current tabs <strong>and</strong> removing them from the active line.<br />

All the tab s<strong>to</strong>ps can then be set once again. The s<strong>to</strong>red s<strong>to</strong>ps can be<br />

reactivated with the comm<strong>and</strong> \poptabs. The \pushtabs comm<strong>and</strong> may<br />

be given as many times as needed, but there must be the same number of<br />

\poptabs comm<strong>and</strong>s within any one tabbing environment.<br />

It is possible <strong>to</strong> position text on a tab s<strong>to</strong>p with left text \’ right text,<br />

where left text goes just before the current tab (or left border) with a<br />

bit of spacing, while right text starts exactly at the s<strong>to</strong>p. The amount<br />

of spacing between the left text <strong>and</strong> the tab s<strong>to</strong>p is determined by the<br />

tabbing parameter \tabbingsep. This may be changed by the user with<br />

the \setlength comm<strong>and</strong> as usual.<br />

Text may be right justified up against the right border of a line with<br />

the comm<strong>and</strong> \‘ text. There must not be any more \> or \= comm<strong>and</strong>s<br />

in the remainder of the line.<br />

The comm<strong>and</strong>s \=, \‘, <strong>and</strong> \’ function as accent comm<strong>and</strong>s outside<br />

of the tabbing environment (Section 2.5.7). If these accents are actually<br />

needed within tabbing, they must be produced with \a=, \a‘, <strong>and</strong> \a’<br />

instead. For example, <strong>to</strong> produce ó, ò, or ō inside a tabbing environment,<br />

one must give \a’o, \a‘o, or \a=o. The comm<strong>and</strong> \- also has another<br />

meaning outside of the tabbing environment (suggested word division)<br />

but since lines are not broken au<strong>to</strong>matically within this environment,<br />

there is no need for an alternative form.<br />

Here is an example illustrating all the tabbing comm<strong>and</strong>s:


84 Chapter 4. Displayed Text<br />

Apples: consumed by: people<br />

horses<br />

<strong>and</strong> sheep<br />

reasonably juicy<br />

Grapefruits: a delicacy<br />

(see also: melons<br />

pumpkins)<br />

Horses feed on apples<br />

4.6.5 Remarks on tabbing<br />

\begin{tabbing}<br />

Grapefruits: \= \kill<br />

Apples: \> consumed by: \= people\+\+\\<br />

horses \\<br />

<strong>and</strong> \’ sheep\-\\<br />

reasonably juicy\-\\<br />

Grapefruits: \> a delicacy\\<br />

\pushtabs<br />

(see also: \= melons\\<br />

\> pumpkins)\\<br />

\poptabs<br />

Horses \> feed on \> apples<br />

\end{tabbing}<br />

T E X treats the tabbing environment like a normal paragraph, breaking<br />

a page if necessary between two lines within the environment. However,<br />

the comm<strong>and</strong>s \newpage <strong>and</strong> \clearpage are not allowed within it, <strong>and</strong><br />

the comm<strong>and</strong> \pagebreak is simply ignored. If the user wishes <strong>to</strong> force<br />

a page break within the tabbing environment, there is a trick that he or<br />

she may employ: specify a very large interline spacing at the end of the<br />

line where the break should occur (for example, \\[10cm]). This forces<br />

the break <strong>and</strong> the spacing disappears at the start of the new page.<br />

Each line of text is effectively within a { } pair, so that any size or font<br />

declarations remain in force only for that one line. The text need not be<br />

put explicitly inside a pair of curly braces.<br />

It is not possible <strong>to</strong> nest tabbing environments within one another.<br />

Beware: the tab jump comm<strong>and</strong> \> always moves <strong>to</strong> the next logical<br />

tab s<strong>to</strong>p. This could actually be a move backwards if the previous text<br />

is longer than the space available between the last two s<strong>to</strong>ps. This is in<br />

contrast <strong>to</strong> the way the tabula<strong>to</strong>r works on a typewriter.<br />

There is no au<strong>to</strong>matic line breaking within the tabbing environment.<br />

Each line continues until terminated by a \\ comm<strong>and</strong>. The text could<br />

extend beyond the right margin of the page. The user must take care that<br />

this does not happen.<br />

The comm<strong>and</strong>s \hfill, \hrulefill, <strong>and</strong> \dotfill have no effect<br />

inside a tabbing environment, since no stretching takes place here.<br />

Exercise 4.9: Generate the following table with the tabbing environment.<br />

Project: Total Requirements = $900 000.00<br />

of which 2003 = $450 000.00<br />

2004 = $350 000.00<br />

2005 = $100 000.00<br />

2003 approved: $350 000.00 Deficiency: $100 000.00<br />

2004 $300 000.00 $150 000.00<br />

2005 $250 000.00 Surplus: $150 000.00


4.7. Boxes 85<br />

tentative 2004 = $100 000.00 for deficiency 2003<br />

2005 = $ 50 000.00 2004<br />

+ $100 000.00 excess for 2003 in 2004<br />

Commitments 2003 = $100 000.00<br />

2004 = $150 000.00 signed: H. André<br />

Hint: the first line in the tabbing environment should read<br />

Project: \=Total Requirements\= = \$900\,000.00 \+\\<br />

What is the effect of the \+ comm<strong>and</strong> at the end of this line? How do you arrange,<br />

using these tab s<strong>to</strong>ps, for the years 2003, 2004, <strong>and</strong> 2005 in the second <strong>to</strong> fourth<br />

lines all <strong>to</strong> be positioned before the second tab s<strong>to</strong>p? Which comm<strong>and</strong> should<br />

be at the end of the second line just before the \\termina<strong>to</strong>r?<br />

Lines 1–4 <strong>and</strong> 8–12 all use the same set of tab s<strong>to</strong>ps, even though there are<br />

additional s<strong>to</strong>ps set in the eighth line. With \$1\=00\,000.00 one can align the<br />

entry \$\>50\,000.00 in the ninth line <strong>to</strong> match the decimal places of the lines<br />

above.<br />

Lines 5–7 have their own tab s<strong>to</strong>ps. Use the save <strong>and</strong> recall feature <strong>to</strong> s<strong>to</strong>re the<br />

preset tab s<strong>to</strong>ps <strong>and</strong> <strong>to</strong> bring them back. The left border of lines 5–7 correspond<br />

<strong>to</strong> the first s<strong>to</strong>p of the first group. What comm<strong>and</strong> is at the end of the fourth line<br />

<strong>to</strong> ensure that the left border is reset <strong>to</strong> one s<strong>to</strong>p earlier? How is the left border<br />

of the second-<strong>to</strong>-last line reset?<br />

The last line contains ‘signed: H. André’ right justified. With what tabbing<br />

comm<strong>and</strong> was this produced? Watch out for the accent é in this entry within the<br />

tabbing environment!<br />

4.7 Boxes<br />

A box is a piece of text that T E X treats as a unit, like a single character. A<br />

box (along with the text within it) can be moved left, right, up, or down.<br />

Since the box is a unit, T E X cannot break it up again, even it was originally<br />

made up of smaller individual boxes. It is, however, possible <strong>to</strong> put those<br />

smaller boxes <strong>to</strong>gether as one pleases when constructing the overall box.<br />

This is exactly what T E X does internally when it carries out the formatting:<br />

the individual characters are packed in character boxes, which<br />

are put <strong>to</strong>gether in<strong>to</strong> line boxes horizontally with rubber lengths inserted<br />

between the words. The line boxes are stacked vertically in<strong>to</strong> paragraph<br />

boxes, again with rubber lengths separating them. These then go in<strong>to</strong> the<br />

page body box, which with the head <strong>and</strong> foot boxes constitutes the page<br />

box.<br />

L AT E X offers the user a choice of three box types: LR boxes, paragraph<br />

boxes, <strong>and</strong> rule boxes. The LR (left–right) box contains material that is<br />

ordered horizontally from left <strong>to</strong> right in a single line. A paragraph box<br />

will have its contents made in<strong>to</strong> vertically stacked lines. A rule box is<br />

a rectangle filled solidly with black, usually for drawing horizontal <strong>and</strong><br />

vertical lines.


86 Chapter 4. Displayed Text<br />

4.7.1 LR boxes<br />

To create LR boxes containing single line text the comm<strong>and</strong>s<br />

\mbox{text} <strong>and</strong> \makebox[width][pos]{text}<br />

\fbox{text} <strong>and</strong> \framebox[width][pos]{text}<br />

are available. The two comm<strong>and</strong>s at the left produce an LR box with a<br />

width exactly equal <strong>to</strong> that of the text given between the braces { }. The<br />

\fbox comm<strong>and</strong> is the same as \mbox except that the text is also framed.<br />

With the two comm<strong>and</strong>s at the right, the width is predetermined by<br />

the optional length argument width. The other optional argument pos<br />

specifies how the text is positioned within the box. With no value given,<br />

the text is centered. Otherwise pos may be<br />

l <strong>to</strong> left justify the text,<br />

r <strong>to</strong> right justify it,<br />

s <strong>to</strong> stretch it <strong>to</strong> fill up the full width.<br />

Thus \makebox[3.5cm]{centered text} creates a box of width 3.5 cm<br />

in which the text is centered, as centered text , filled with white<br />

space, while with \framebox[3.5cm][r]{right justified} the text is<br />

right justified inside a framed box of width 3.5 cm: right justified .<br />

One may also give<br />

\framebox[3.5cm][s]{stretched\dotfill text}<br />

<strong>to</strong> fill up the box, as stretched . . . . . . . text , in which case some rubber<br />

length (Section 2.4.2) or other filler (page 30) must be added where the<br />

stretching is <strong>to</strong> occur.<br />

If the text has a natural width that is larger than that specified in width,<br />

it will stick out of the box on the left, right, or both sides, depending on<br />

the choice of pos. For example,<br />

\framebox[2mm]{centered} produces centered .<br />

The above application may appear rather silly for \framebox, but it<br />

can indeed be very useful for \makebox. A width specification of 0 pt for<br />

\makebox can generate a centered, left, or right justified positioning of<br />

text in diagrams made with the picture environment (see Chapter 13 for<br />

examples). It may also be used <strong>to</strong> cause two pieces of text <strong>to</strong> overlap, as<br />

\makebox[0pt][l]{/}S prints a slash through an S, as /S.<br />

Note: Length specifications must always contain a dimensional unit, even<br />

when they are zero. Thus 0pt must be given for the width, not 0.<br />

It is also possible <strong>to</strong> specify the width of an LR box relative <strong>to</strong> its<br />

natural dimensions (those produced by the simple \mbox comm<strong>and</strong>):<br />

\width is the natural width of the box,<br />

\height is the distance from baseline <strong>to</strong> <strong>to</strong>p,<br />

\depth is the distance from baseline <strong>to</strong> bot<strong>to</strong>m,<br />

\<strong>to</strong>talheight is \height plus \depth.


4.7. Boxes 87<br />

To make a framed box such that the width is six times the <strong>to</strong>tal height,<br />

containing centered text,<br />

\framebox[6\<strong>to</strong>talheight]{Text} Text<br />

Note: These special length parameters only have meaning within the<br />

width specification of an LR box, or within the height specification of a<br />

paragraph box, as shown below. In any other context, they will produce<br />

an error message.<br />

If a set piece of text is <strong>to</strong> appear in several places within the document,<br />

it can be s<strong>to</strong>red by first giving the comm<strong>and</strong><br />

\newsavebox{\boxname}<br />

<strong>to</strong> create a box with the name \boxname. This name must conform <strong>to</strong><br />

L AT E X comm<strong>and</strong> name syntax (letters only) with an initial \. The name<br />

must not conflict with any existing L AT E X comm<strong>and</strong> names. After such a<br />

box has been initiated, the comm<strong>and</strong>s<br />

\sbox{\boxname}{text} or<br />

\savebox{\boxname}[width][pos]{text}<br />

will s<strong>to</strong>re the contents text for future use. The optional arguments width<br />

<strong>and</strong> pos have the same meanings as for \makebox <strong>and</strong> \framebox. Now<br />

with the comm<strong>and</strong><br />

\usebox{\boxname}<br />

the s<strong>to</strong>red contents are inserted in<strong>to</strong> the document text wherever desired,<br />

as a single unit.<br />

The contents of an LR box may also be s<strong>to</strong>red with the environment<br />

\begin{lrbox}{boxname}<br />

text<br />

\end{lrbox}<br />

This is equivalent <strong>to</strong> \sbox{\boxname}{text}. Its advantage is that it<br />

allows text within a user-defined environment (Section 8.4) <strong>to</strong> be s<strong>to</strong>red<br />

for future use with \usebox.<br />

4.7.2 Vertical shifting of LR boxes<br />

The comm<strong>and</strong><br />

\raisebox{lift}[height][depth]{text}<br />

produces an \mbox with contents text, raised above the current baseline<br />

by an amount lift. The optional arguments tell L AT E X <strong>to</strong> treat the box as<br />

though its extension above the baseline were height <strong>and</strong> that below were<br />

depth. Without these arguments, the box has its natural size determined<br />

by text <strong>and</strong> lift. Note that lift, height, <strong>and</strong> depth are lengths (Section 2.4.1).<br />

If lift is negative, the box is lowered below the baseline.<br />

For example:


88 Chapter 4. Displayed Text<br />

Baseline \raisebox{1ex}{high} <strong>and</strong> \raisebox{-1ex}{low}<br />

<strong>and</strong> back again<br />

produces: Baseline high <strong>and</strong> low <strong>and</strong> back again.<br />

The values for height <strong>and</strong> depth can be <strong>to</strong>tally different from the actual<br />

ones of the text. Their effect is <strong>to</strong> determine how far away the previous <strong>and</strong><br />

next lines of text should be from the current line, based on the heights<br />

<strong>and</strong> depths of all the boxes (characters are also boxes) in the line. By<br />

raising a box but specifying height <strong>to</strong> be the regular character size, the<br />

raised box will overprint the line above, <strong>and</strong> similarly for depth when a<br />

box is lowered.<br />

4.7.3 Parboxes <strong>and</strong> minipages<br />

Whole paragraphs can be put in<strong>to</strong> separate vertical boxes (or parboxes in<br />

the L AT E X jargon) with the comm<strong>and</strong><br />

\parbox[pos]{width}{text}<br />

or with the environment<br />

\begin{minipage}[pos]{width} text \end{minipage}<br />

Both produce a vertical box of width width, in which the lines of text are<br />

stacked on <strong>to</strong>p of each other as in normal paragraph mode.<br />

The optional positioning argument pos can take on the values<br />

b <strong>to</strong> align the bot<strong>to</strong>m edge of the box with the current baseline,<br />

t <strong>to</strong> align the <strong>to</strong>p line of text with the current baseline.<br />

Without any positioning argument, the parbox is centered vertically on<br />

the baseline of the external line of text.<br />

The positioning argument is only meaningful when the \parbox comm<strong>and</strong><br />

or the minipage environment occurs within a line of text, for<br />

otherwise the current line <strong>and</strong> its baseline have no meaning. If the parbox<br />

is immediately preceded by a blank line, it begins a new paragraph. In<br />

this case, the vertical positioning of the parbox is made with reference<br />

<strong>to</strong> the following elements of the paragraph. These could be further parboxes.<br />

If the paragraph consists of only a single parbox or minipage, the<br />

positioning argument is meaningless <strong>and</strong> has no effect.<br />

Examples:<br />

\parbox{3.5cm}{\sloppy This is a 3.5 cm wide parbox. It is<br />

vertically centered on the}<br />

\hfill CURRENT LINE \hfill<br />

\parbox{5.5cm}{Narrow pages are hard <strong>to</strong> format. They usually<br />

produce many warning messages on the moni<strong>to</strong>r. The comm<strong>and</strong><br />

\texttt{\symbol{92}sloppy} can s<strong>to</strong>p this.}


This is a 3.5 cm wide<br />

parbox. It is vertically<br />

centered on the<br />

CURRENT LINE<br />

4.7. Boxes 89<br />

Narrow pages are hard <strong>to</strong> format.<br />

They usually produce many warning<br />

messages on the moni<strong>to</strong>r. The comm<strong>and</strong><br />

\sloppy can s<strong>to</strong>p this.<br />

\begin{minipage}[b]{4.3cm}<br />

The minipage environment creates a vertical box like the parbox<br />

comm<strong>and</strong>. The bot<strong>to</strong>m line of this minipage is aligned with the<br />

\end{minipage}\hfill<br />

\parbox{3.0cm}{middle of this narrow parbox, which in turn is<br />

aligned with}<br />

\hfill<br />

\begin{minipage}[t]{3.8cm}<br />

the <strong>to</strong>p line of the right h<strong>and</strong> minipage. It is recommended that<br />

the user experiment with the positioning arguments <strong>to</strong> get used<br />

<strong>to</strong> their effects.<br />

\end{minipage}<br />

The minipage environment<br />

creates a vertical box like the<br />

parbox comm<strong>and</strong>. The bot<strong>to</strong>m<br />

line of this minipage is<br />

aligned with the<br />

middle of this narrow<br />

parbox, which in<br />

turn is aligned with<br />

the <strong>to</strong>p line of the right<br />

h<strong>and</strong> minipage. It is recommended<br />

that the user<br />

experiment with the positioning<br />

arguments <strong>to</strong> get<br />

used <strong>to</strong> their effects.<br />

In Section 4.7.7 we demonstrate how parboxes can be vertically stacked<br />

in any desired manner relative <strong>to</strong> one another.<br />

The \parbox comm<strong>and</strong> produces a vertical box containing the text<br />

just like the minipage environment. However, the latter is more general.<br />

The text in a \parbox may not contain any of the centering, list, or other<br />

environments described in Sections 4.2–4.5. These may, on the other<br />

h<strong>and</strong>, appear within a minipage environment. That is, a minipage can<br />

include centered or indented text, as well as lists <strong>and</strong> tabbings.<br />

4.7.4 Problems with vertical placement<br />

Vertical positioning of minipages <strong>and</strong> parboxes can often lead <strong>to</strong> unexpected<br />

! results, which can be explained by showing more graphically how a box is treated<br />

by L AT E X. Suppose we want <strong>to</strong> place two parboxes of different heights side by<br />

side, aligned on their first lines, <strong>and</strong> the two <strong>to</strong>gether set on the current line of<br />

text at the bot<strong>to</strong>m. The ‘obvious’ way of doing this is<br />

\begin{minipage}[b]{..}<br />

\parbox[t]{..}{..} \hfill \parbox[t]{..}{..}<br />

\end{minipage}


90 Chapter 4. Displayed Text<br />

which does not work, for it produces instead the following results:<br />

Current line ••The boxes are made•<br />

•<strong>and</strong> by marking••<br />

of text.<br />

visible here by fram- the baselines (the<br />

ing them,<br />

vertical alignment<br />

points) with black<br />

dots.<br />

The reason for this is that each parbox or minipage is treated externally as a<br />

single character with its own height <strong>and</strong> depth above <strong>and</strong> below the baseline. As<br />

far as the outer minipage is concerned, it contains only two ‘characters’ on the<br />

same line, <strong>and</strong> that line is both the <strong>to</strong>p <strong>and</strong> bot<strong>to</strong>m one. Thus the bot<strong>to</strong>m line of<br />

the outer minipage is indeed aligned with the line of text, but that bot<strong>to</strong>m line is<br />

simultaneously the <strong>to</strong>p line. The solution is <strong>to</strong> add a dummy second line <strong>to</strong> the<br />

outer box, as<br />

\parbox[t]{..}{..} \hfill \parbox[t]{..}{..} \\ \mbox{}<br />

The dummy line may not be entirely empty, hence the \mbox.<br />

•The boxes are made•<br />

•<strong>and</strong> by marking•<br />

visible here by fram- the baselines (the<br />

ing them,<br />

vertical alignment<br />

points) with black<br />

dots.<br />

Current line • • • of text.<br />

A similar problem occurs if two boxes are <strong>to</strong> be aligned with their bot<strong>to</strong>m<br />

lines, <strong>and</strong> the pair aligned at the <strong>to</strong>p with the current line of text. Here there are<br />

two possibilities <strong>to</strong> add a dummy first line.<br />

\mbox{} \\ aligns with the very <strong>to</strong>p, or<br />

\mbox{} \\[-\baselineskip] aligns with the first text line.<br />

An example of the first case is shown on page 176. Dummy lines are also needed<br />

for the solution of Exercise 4.10 on page 93.<br />

4.7.5 Paragraph boxes of specific height<br />

The complete syntax of the \parbox comm<strong>and</strong> <strong>and</strong> minipage environment<br />

includes two more optional arguments:<br />

\parbox[pos][height][inner pos]{width}{text}<br />

\begin{minipage}[pos][height][inner pos]{width}<br />

text<br />

\end{minipage}<br />

In both cases, height is a length specifying the height of the box; the parameters<br />

\height, \width, \depth, <strong>and</strong> \<strong>to</strong>talheight may be employed<br />

within the height argument in the same way as in the width argument of<br />

\makebox <strong>and</strong> \framebox (page 86).


4.7. Boxes 91<br />

The optional argument inner pos states how the text is <strong>to</strong> be positioned<br />

internally, something that is only meaningful if height has been given. Its<br />

possible values are:<br />

t <strong>to</strong> push the text <strong>to</strong> the <strong>to</strong>p of the box,<br />

b <strong>to</strong> shove it <strong>to</strong> the bot<strong>to</strong>m,<br />

c <strong>to</strong> center it vertically,<br />

s <strong>to</strong> stretch it <strong>to</strong> fill up the whole box.<br />

In the last case, rubber lengths (Section 2.4.2) should be present where<br />

the vertical stretching is <strong>to</strong> take place.<br />

Note the difference between the external positioning argument pos <strong>and</strong><br />

the internal one inner pos: the former states how the box is <strong>to</strong> be aligned<br />

with the surrounding text, while the latter determines how the contents<br />

are placed within the box itself.<br />

Example:<br />

\begin{minipage}[t][2cm][t]{3cm}<br />

This is a minipage of height 2˜cm with the text<br />

at the <strong>to</strong>p.<br />

\end{minipage}\hrulefill<br />

\parbox[t][2cm][c]{3cm}{In this parbox, the text<br />

is centered on the same height.}\hrulefill<br />

\begin{minipage}[t][2cm][b]{3cm}<br />

In this third paragraph box, the text is at the bot<strong>to</strong>m.<br />

\end{minipage}<br />

This is a minipage<br />

of height 2 cm<br />

with the text at the<br />

<strong>to</strong>p.<br />

In this parbox, the<br />

text is centered on<br />

the same height.<br />

In this third paragraph<br />

box, the text<br />

is at the bot<strong>to</strong>m.<br />

The \hrulefill comm<strong>and</strong>s between the boxes show where the baselines<br />

are. All three boxes are the same size <strong>and</strong> differ only in their values of<br />

inner pos.<br />

4.7.6 Rule boxes<br />

A rule box is a basically a filled-in black rectangle. The syntax for the<br />

general comm<strong>and</strong> is:<br />

\rule[lift]{width}{height}<br />

which produces a solid rectangle of width width <strong>and</strong> height height, raised<br />

above the baseline by an amount lift. Thus \rule{8mm}{3mm} generates<br />

. Without the optional argument lift, the rectangle is set on the<br />

baseline of the current line of text.


92 Chapter 4. Displayed Text<br />

The parameters lift, width, <strong>and</strong> height are all lengths (Section 2.4.1). If<br />

lift has a negative value, the rectangle is set below the baseline.<br />

It is also possible <strong>to</strong> have a rule box of zero width. This creates an<br />

invisible line with the given height. Such a construction is called a strut<br />

<strong>and</strong> is used <strong>to</strong> force a horizontal box <strong>to</strong> have a desired height or depth<br />

that is different from that of its contents. For this purpose, \vspace is<br />

inappropriate because it adds additional vertical space <strong>to</strong> that which is<br />

already there.<br />

For example: \fbox{Text} produces Text . In order <strong>to</strong> print Text ,<br />

one has <strong>to</strong> tell T E X that the box contents extend above <strong>and</strong> below the<br />

baseline by the desired amounts. This was done with \fbox{\rule[-2mm]<br />

{0cm}{6mm}Text}. What this says is that the text <strong>to</strong> be framed consists<br />

of ‘an invisible bar beginning 2 mm below the baseline, 6 mm long,<br />

followed by the word Text’. The vertical bar indeed remains unseen, but<br />

it determines the upper <strong>and</strong> lower edges of the frame.<br />

4.7.7 Nested boxes<br />

The box comm<strong>and</strong>s described above may be nested <strong>to</strong> any desired level.<br />

Including an LR box within a parbox or a minipage causes no obvious<br />

conceptual difficulties. The opposite, a parbox within an LR box, is also<br />

possible, <strong>and</strong> is easy <strong>to</strong> visualize if one keeps in mind that every box is a<br />

unit, treated by L AT E X as a single character of the corresponding size.<br />

A parbox inside an \fbox comm<strong>and</strong> has the effect that the<br />

entire parbox is framed. The present structure was made with<br />

\fbox{\fbox{\parbox{10cm}{A parbox...}}}<br />

This is a parbox of width 10 cm inside a framebox inside a<br />

second framebox, which thus produces the double framing<br />

effect.<br />

Enclosing a parbox inside a \raisebox allows vertical<br />

displacements of any desired amount. The two boxes<br />

here both have positioning [b], but the one at the right<br />

has been produced with:<br />

\raisebox{1cm}{\begin{minipage}[b]{2.5cm}<br />

a b c d e ... x y z\\<br />

\underline{baseline}<br />

\end{minipage} }<br />

a b c d e f g h i<br />

j k l m n o p q r<br />

s t u v w x y z<br />

baseline<br />

which displaces it upwards by 1 cm. baseline<br />

A very useful structure is one in which minipage environments are<br />

positioned relative <strong>to</strong> one another inside an enclosing minipage. The<br />

positioning argument of the outside minipage can be used <strong>to</strong> align its


4.7. Boxes 93<br />

contents as a unit with the neighboring text or boxes. An example of this<br />

is given in Exercise 4.10.<br />

Finally, vertical boxes such as \parbox comm<strong>and</strong>s <strong>and</strong> minipage environments<br />

may be saved as the text in an \sbox or \savebox comm<strong>and</strong>,<br />

<strong>to</strong> be recalled later with \usebox, as described in Section 4.7.1.<br />

4.7.8 Box style parameters<br />

There are two style parameters for the frame boxes \fbox <strong>and</strong> \framebox that<br />

! may be reset by the user:<br />

\fboxrule determines the thickness of the frame lines,<br />

\fboxsep sets the amount of spacing between the frame <strong>and</strong> enclosed text.<br />

New values are assigned <strong>to</strong> these length parameters in the usual L AT E X manner with<br />

the comm<strong>and</strong> \setlength: the line thickness for all the following \framebox<br />

<strong>and</strong> \fbox comm<strong>and</strong>s is set <strong>to</strong> 0.5 mm with \setlength{\fboxrule}{0.5mm}.<br />

The scope of these settings also obeys the usual rule: if they are found<br />

in the preamble then they apply <strong>to</strong> the entire document; if they are within an<br />

environment then they are valid only until the end of that environment.<br />

These parameters do not influence the \framebox comm<strong>and</strong> that is employed<br />

within the picture environment (Section 13.1.4) <strong>and</strong> which has different syntax<br />

<strong>and</strong> functionality from those of the normal \framebox comm<strong>and</strong>.<br />

Exercise 4.10: How can the following nested structure be generated? (Note: font<br />

size is \footnotesize)<br />

The first line of this 3.5 cm<br />

wide minipage or parbox is<br />

aligned with the first line<br />

of the neighboring minipage<br />

or parbox.<br />

This 4.5 cm wide minipage or parbox<br />

is positioned so that its <strong>to</strong>p<br />

line is at the same level as that of<br />

the box on the left, while its bot<strong>to</strong>m<br />

line is even with that of the<br />

box on the right. The naïve notion<br />

that this arrangement may be<br />

achieved with the positioning arguments<br />

set <strong>to</strong> t, t, <strong>and</strong> b is incorrect.<br />

Why? What would this<br />

selection really produce?<br />

The true solution<br />

involves the nesting<br />

of two of the three<br />

structures in an enclosing<br />

minipage,<br />

which is then separately<br />

aligned with the<br />

third one.<br />

Note: there are two variants for the solution, depending on whether the left <strong>and</strong><br />

middle structures are first enclosed in a minipage, or the middle <strong>and</strong> right ones.<br />

Try <strong>to</strong> work out both solutions. Incidentally, the third minipage is 3 cm wide.<br />

Note: the problems of correctly aligning two side-by-side boxes as a pair on a<br />

line of text (Section 4.7.4) arises here once more. It will be necessary <strong>to</strong> add a<br />

dummy line <strong>to</strong> get the vertical alignment correct.<br />

Exercise 4.11: Produce the framed structure shown below <strong>and</strong> s<strong>to</strong>re it with<br />

the comm<strong>and</strong> \sbox{\warning}{structure}. You will first have <strong>to</strong> create a<br />

box named \warning with the \newsavebox{\warning} comm<strong>and</strong>. Print this<br />

warning at various places in your exercise file by giving \usebox{\warning}.


94 Chapter 4. Displayed Text<br />

Vertical placement of minipages <strong>and</strong> parboxes can lead <strong>to</strong><br />

surprising results which may be corrected by the use of dummy<br />

lines.<br />

Note: the parbox width is 10 cm. There should be no difficulty producing the<br />

framed structure if one follows the previous example for the double framed box.<br />

Watch out when writing \sbox{\warning}{structure} that you have the correct<br />

number of closing braces at the end.<br />

Next, change the values for the line thickness (\fboxrule) <strong>and</strong> frame spacing<br />

(\fboxsep) <strong>and</strong> print your results once more.<br />

4.7.9 Further framed boxes<br />

Package: The fancybox package, by Timothy van Z<strong>and</strong>t, allows additional framed<br />

fancybox boxes of various styles. These all make use of the length \fboxsep <strong>to</strong><br />

set the distance between frame <strong>and</strong> text, the same as for \fbox <strong>and</strong><br />

\framebox. Depending on the box type, additional new lengths are also<br />

applicable. They may be changed with \setlength <strong>to</strong> modify the box<br />

appearance. These new framed boxes are:<br />

\shadowbox{text}<br />

The width of the shadow is given by the length<br />

\shadowsize, default 4 pt. Multiline text must be placed<br />

in a minipage environment, the same as for \fbox.<br />

\doublebox{text}<br />

The width of the inner frame is 0.75\fboxrule, that of the<br />

outer frame 1.5\fboxrule, <strong>and</strong> the spacing between the<br />

frames is 1.5\fboxrule plus 0.5 pt.<br />

✬<br />

\ovalbox{text}<br />

The thickness of the frame is that of \thinlines (Section<br />

13.1.4), the diameter of the corners is set with the<br />

comm<strong>and</strong> \cornersize{frac}, <strong>to</strong> frac times the smaller<br />

of the box width or height, or with \cornersize*{size} <strong>to</strong><br />

the length size. The default is frac=.5.<br />

✫<br />

✬<br />

\Ovalbox{text}<br />

The frame thickness is set by \thicklines, but otherwise<br />

is the same as \ovalbox.<br />

✫<br />

✩<br />

✪<br />

✩<br />


4.8. Tables 95<br />

This package also allows all pages <strong>to</strong> be boxed as part of the page style.<br />

This is done by issuing \fancypage{cmds1}{cmds2}, where cmds1 <strong>and</strong><br />

cmds2 are comm<strong>and</strong>s setting box parameters, terminated by one of the<br />

box comm<strong>and</strong>s \fbox, \shadowbox, <strong>and</strong> so on. The first set, cmds1, form<br />

a box with the head <strong>and</strong> footlines outside, while the second set draw a<br />

box including them. Normally one would only specify one set, leaving the<br />

other blank, such as:<br />

\fancypage{\setlength{\fboxsep}{5pt}<br />

\setlength{\shadowsize}{3pt}\shadowbox}{}<br />

for a shadow box on each page excluding head <strong>and</strong> footlines. There is also<br />

the comm<strong>and</strong> \thisfancypage{cmds1}{cmds2} <strong>to</strong> box just the current<br />

page.<br />

4.8 Tables<br />

With the box elements <strong>and</strong> tabbing environment from the previous sections<br />

it would be possible <strong>to</strong> produce all sorts of framed <strong>and</strong> unframed<br />

tables. However, L AT E X offers the user far more convenient ways <strong>to</strong> build<br />

such complicated structures.<br />

4.8.1 Constructing tables<br />

The environments tabular, tabular*, <strong>and</strong> array are the basic <strong>to</strong>ols<br />

with which tables <strong>and</strong> matrices can be constructed. The syntax for these<br />

environments is<br />

\begin{array}[pos]{cols} rows \end{array}<br />

\begin{tabular}[pos]{cols} rows \end{tabular}<br />

\begin{tabular*}{width}[pos]{cols} rows \end{tabular*}<br />

The array environment can only be applied in mathematical mode (see<br />

Chapter 5). It is described here only because its syntax <strong>and</strong> the meaning of<br />

its arguments are exactly the same as those of the tabular environment.<br />

All three environments actually create a minipage. The meaning of the<br />

arguments is as follows:<br />

pos Vertical positioning argument (see also the explanation of this argument<br />

for parboxes in Section 4.7.3). It can take on the values<br />

t the <strong>to</strong>p line of the table is aligned with the baseline of the<br />

current external line of text;<br />

b the bot<strong>to</strong>m line of the table is aligned with the external baseline;<br />

with no positioning argument given, the table is centered on<br />

the external baseline.


96 Chapter 4. Displayed Text<br />

width This argument applies only <strong>to</strong> the tabular* environment <strong>and</strong> determines<br />

its overall width. In this case, the cols argument must<br />

contain the @-expression (see below) @{\extracolsep{\fill}}<br />

somewhere after the first entry. For the other two environments,<br />

the <strong>to</strong>tal width is fixed by the textual content.<br />

cols The column formatting argument. There must be an entry for<br />

every column, as well as possible extra entries for the left <strong>and</strong> right<br />

borders of the table or for the intercolumn spacings.<br />

The possible column formatting symbols are<br />

l the column contents are left justified;<br />

r the column contents are right justified;<br />

c the column contents are centered;<br />

p{wth} the text in this column is set in<strong>to</strong> lines of width wth, <strong>and</strong><br />

the <strong>to</strong>p line is aligned with the other columns. In fact, the text is<br />

set in a parbox with the comm<strong>and</strong> \parbox[t]{wth}{column<br />

text};<br />

*{num}{cols} the column format contained in cols is reproduced<br />

num times, so that *{5}{|c}| is the same as |c|c|c|c|c|.<br />

The available formatting symbols for the left <strong>and</strong> right borders <strong>and</strong><br />

for the intercolumn spacing are<br />

| draws a vertical line;<br />

|| draws two vertical lines next <strong>to</strong> each other;<br />

@{text} this entry is referred <strong>to</strong> as an @-expression, <strong>and</strong> inserts text<br />

in every line of the table between the two columns where it<br />

appears.<br />

An @-expression removes the intercolumn spacing that is au<strong>to</strong>matically<br />

put between each pair of columns. If white space<br />

is needed between the inserted text <strong>and</strong> the next column, this<br />

must be explicitly included with \hspace{ } within the text<br />

of the @-expression. If the intercolumn spacing between two<br />

particular columns is <strong>to</strong> be something other than the st<strong>and</strong>ard,<br />

this may be easily achieved by placing @{\hspace{wth}} between<br />

the appropriate columns in the formatting argument.<br />

This replaces the st<strong>and</strong>ard intercolumn spacing with the width<br />

wth.<br />

An \extracolsep{wth} within an @-expression will put extra<br />

spacing of amount wth between all the following columns,<br />

until counterm<strong>and</strong>ed by another \extracolsep comm<strong>and</strong>. In<br />

contrast <strong>to</strong> the st<strong>and</strong>ard spacing, this additional spacing is not<br />

removed by later @-expressions. In the tabular* environment,<br />

there must be a comm<strong>and</strong> @{\extracolsep\fill} somewhere<br />

in the column format so that all the subsequent intercolumn<br />

spacings can stretch out <strong>to</strong> fill the predefined table width.


4.8. Tables 97<br />

If the left or right borders of the table do not consist of a<br />

vertical line, spacing is added there of an amount equal <strong>to</strong> half<br />

the normal intercolumn spacing. If this spacing is not wanted,<br />

it may be suppressed by including an empty @-expression @{}<br />

at the beginning or end of the column format.<br />

rows contain the actual entries in the table, each horizontal row being<br />

terminated with a \\ comm<strong>and</strong>. These rows consist of a sequence<br />

of column entries separated from each other by the & symbol. Thus<br />

each row in the table contains the same number of column entries<br />

as in the column definition cols. Some entries may be empty. The<br />

individual column entries are treated by L AT E X as though they were<br />

enclosed in braces { }, so that any changes in type style or size are<br />

restricted <strong>to</strong> that one column.<br />

\hline This comm<strong>and</strong> may only appear before the first row or<br />

immediately after a \\ row termination. It draws a horizontal<br />

line the full width of the table below the row that was just<br />

ended, or at the <strong>to</strong>p of the table if it comes at the beginning.<br />

Two \hline comm<strong>and</strong>s <strong>to</strong>gether draw two horizontal lines<br />

with a little space between them.<br />

\cline{m − n} This comm<strong>and</strong> draws a horizontal line from the<br />

left side of column m <strong>to</strong> the right side of column n. Like<br />

\hline, it may only be given just after a \\ row termination<br />

<strong>and</strong> there may be more than one after another. The comm<strong>and</strong><br />

\cline{1-3} \cline{5-7} draws two horizontal lines from<br />

column 1 <strong>to</strong> 3 <strong>and</strong> from column 5 <strong>to</strong> 7, below the row that was<br />

just ended. In each case, the full column widths are underlined.<br />

\multicolumn{num}{col}{text} This comm<strong>and</strong> combines the following<br />

num columns in<strong>to</strong> a single column with their <strong>to</strong>tal width<br />

including intercolumn spacings. The argument col contains exactly<br />

one of the positioning symbols l, r, or c, with possible<br />

@-expressions <strong>and</strong> vertical lines |. A value of 1 may be given<br />

for num when the positioning argument is <strong>to</strong> be changed for<br />

that column in one particular row.<br />

In this context, a ‘column’ starts with a positioning symbol<br />

l, r, or c, <strong>and</strong> includes everything up <strong>to</strong> but excluding the next<br />

one. The first column also includes everything before the first<br />

positioning symbol. Thus |c@{}rl| contains three columns:<br />

the first is |c@{}, the second r, <strong>and</strong> the third l|.<br />

The \multicolumn comm<strong>and</strong> may only come at the start of<br />

a row or right after a column separation symbol &.<br />

\vline This comm<strong>and</strong> draws a vertical line with the height of the<br />

row at the location where it appears. In this way, vertical lines<br />

that do not extend the whole height of the table may be inserted<br />

within a column.


98 Chapter 4. Displayed Text<br />

If a p-type column contains \raggedright or \centering, the \\ forces a<br />

! new line within the column entry <strong>and</strong> not the end of the whole row. If this occurs<br />

in the last column, then \\ cannot be used <strong>to</strong> terminate the row; instead one<br />

must use \tabularnewline <strong>to</strong> end such a row.<br />

Since a table is a vertical box of the same sort as parbox <strong>and</strong> minipage,<br />

it may be positioned horizontally with other boxes or text (see examples<br />

in Section 4.7.3). In particular, the table must be enclosed within<br />

\begin{center} table \end{center}<br />

in order <strong>to</strong> center it on the page.<br />

4.8.2 Table style parameters<br />

There are a number of style parameters used in generating tables which L AT E X sets<br />

! <strong>to</strong> st<strong>and</strong>ard values. These may be altered by the user, either globally within the<br />

preamble or locally inside an environment. They should not be changed within<br />

the tabular environment itself.<br />

\tabcolsep is half the width of the spacing that is inserted between columns<br />

in the tabular <strong>and</strong> tabular* environments;<br />

\arraycolsep is the corresponding half intercolumn spacing for the array<br />

environment;<br />

\arrayrulewidth is the thickness of the vertical <strong>and</strong> horizontal lines within a<br />

table;<br />

\doublerulesep is the separation between the lines of a double rule.<br />

Changes in these parameters can be made with the \setlength comm<strong>and</strong> as<br />

usual. For example, <strong>to</strong> make the line thickness <strong>to</strong> be 0.5 mm, give \setlength<br />

{\arrayrulewidth}{0.5mm}. Furthermore, the parameter<br />

\arraystretch can be used <strong>to</strong> change the distance between the rows of a table.<br />

This is a multiplying fac<strong>to</strong>r, with a st<strong>and</strong>ard value of 1. A value of 1.5<br />

means that the inter-row spacing is increased by 50%. A new value is set<br />

by redefining the parameter with the comm<strong>and</strong><br />

4.8.3 Table examples<br />

\renewcomm<strong>and</strong>{\arraystretch}{fac<strong>to</strong>r}<br />

Creating tables is much easier in practice than it would seem from the<br />

above list of formatting possibilities. This is best illustrated with a few<br />

examples.<br />

The simplest table consists of a row of columns in which the text<br />

entries are either centered or justified <strong>to</strong> one side. The column widths,<br />

the spacing between the columns, <strong>and</strong> thus the entire width of the table<br />

are au<strong>to</strong>matically calculated.


4.8. Tables 99<br />

Position Club Games W T L Goals Points<br />

1 Amesville Rockets 33 19 13 1 66:31 51:15<br />

2 Borden Comets 33 18 9 6 65:37 45:21<br />

3 Clarkson Chargers 33 17 7 9 70:44 41:25<br />

4 Daysdon Bombers 33 14 10 9 66:50 38:28<br />

5 Edgar<strong>to</strong>wn Devils 33 16 6 11 63:53 38:28<br />

6 Freeburg Fighters 33 15 7 11 64:47 37:29<br />

7 Gadsby Tigers 33 15 7 11 52:37 37:29<br />

8 Harrisville Hotshots 33 12 11 10 62:58 35:31<br />

9 Idle<strong>to</strong>n Shovers 33 13 9 11 49:51 35:31<br />

10 James<strong>to</strong>wn Hornets 33 11 11 11 48:47 33:33<br />

11 Kings<strong>to</strong>n Cowboys 33 13 6 14 54:45 32:34<br />

12 Lonsdale S<strong>to</strong>mpers 33 12 8 13 50:57 32:34<br />

13 Marsdon Heroes 33 9 13 11 50:42 31:35<br />

14 Norburg Flames 33 10 8 15 50:68 28:38<br />

15 Ollison Champions 33 8 9 16 42:49 25:41<br />

16 Petersville Lancers 33 6 8 19 31:77 20:46<br />

17 Quincy Giants 33 7 5 21 40:89 19:47<br />

18 Rals<strong>to</strong>n Regulars 33 3 11 19 37:74 17:49<br />

The above table is made up of eight columns, the first of which is<br />

right justified, the second left justified, the third centered, the next three<br />

right justified again, <strong>and</strong> the last two centered. The column formatting<br />

argument in the tabular environment thus appears as<br />

{rlcrrrcc}<br />

The text <strong>to</strong> produce this table is<br />

\begin{tabular}{rlcrrrcc}<br />

Position & Club & Games & W & T & L & Goals & Points\\[0.5ex]<br />

1 & Amesville Rockets & 33 & 19 & 13 & 1 & 66:31 & 51:15 \\<br />

2 & Borden Comets & 33 & 18 & 9 & 6 & 65:37 & 45:21 \\<br />

... & ..... & .. & .. & .. & .. & ... & ... \\<br />

17 & Quincy Giants & 33 & 7 & 5 & 21 & 40:89 & 19:47 \\<br />

18 & Rals<strong>to</strong>n Regulars & 33 & 3 & 11 & 19 & 37:74 & 17:49<br />

\end{tabular}<br />

In each row, the individual columns are separated from one another by<br />

the symbol & <strong>and</strong> the row itself is terminated with the \\ comm<strong>and</strong>. The<br />

[0.5ex] at the end of the first row adds extra vertical spacing between<br />

the first two rows. The last row does not need the termination symbol<br />

since it is ended au<strong>to</strong>matically by the \end{tabular} comm<strong>and</strong>.<br />

The columns may be separated by vertical rules by including the<br />

symbol | in the column formatting argument. Changing the first line <strong>to</strong><br />

\begin{tabular}{r|l||c|rrr|c|c}


100 Chapter 4. Displayed Text<br />

results in<br />

Position Club Games W T L Goals Points<br />

1 Amesville Rockets 33 19 13 1 66:31 51:15<br />

2 Borden Comets 33 18 9 6 65:37 45:21<br />

.<br />

.<br />

.<br />

17 Quincy Giants 33 7 5 21 40:89 19:47<br />

18 Rals<strong>to</strong>n Regulars 33 3 11 19 37:74 17:49<br />

The same symbol | before the first or after the last column format<br />

generates a vertical line on the outside edge of the table. Two symbols ||<br />

produce a double vertical line. Horizontal lines over the whole width of<br />

the table are created with the comm<strong>and</strong> \hline. They may only appear<br />

right after a row termination \\ or at the very beginning of the table. Two<br />

such comm<strong>and</strong>s \hline\hline draw a double horizontal line.<br />

\begin{tabular}{|r|l||c|rrr|c|c|} \hline<br />

Position & Club & Games & W & T & L & Goals & Points\\<br />

\hline\hline<br />

1 & Amesville Rockets & 33 & 19 & 13 & 1 & 66:31 & 51:15 \\<br />

\hline<br />

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<br />

18 & Rals<strong>to</strong>n Regulars & 33 & 3 & 11 & 19 & 37:74 & 17:49 \\<br />

\hline<br />

\end{tabular}<br />

The table now appears as<br />

Position Club Games W T L Goals Points<br />

1 Amesville Rockets 33 19 13 1 66:31 51:15<br />

2 Borden Comets 33 18 9 6 65:37 45:21<br />

.<br />

.<br />

.<br />

17 Quincy Giants 33 7 5 21 40:89 19:47<br />

18 Rals<strong>to</strong>n Regulars 33 3 11 19 37:74 17:49<br />

In this case, the row termination \\ must be given for the last row <strong>to</strong>o<br />

because of the presence of \hline at the end of the table.<br />

In this example, all rows contain the same entry in the third column,<br />

that is, 33. Such a common entry can be au<strong>to</strong>matically inserted in the<br />

column format as an @-expression of the form @{text}, which places text<br />

between the neighboring columns. This could be accomplished for our<br />

example by changing the column format <strong>to</strong><br />

{rl@{ 33 }rrrcc} or {|r|l||@{ 33 }|rrr|c|c|}<br />

so that the text ‘ 33 ’, blanks included, appears between the second <strong>and</strong><br />

third columns in every row. This produces the same table with slightly<br />

different row entries: for example, the fourth row would now be given as


4.8. Tables 101<br />

4 & Daysdon Bombers & 14 & 10 & 9 & 66:50 & 38:28 \\<br />

The column format now consists of only seven column definitions, rlrrrcc.<br />

! The previous third column c has been removed, <strong>and</strong> so each row contains one less<br />

column separation symbol &. The new third column, the number of games won,<br />

begins with the second & <strong>and</strong> is separated from the club name by the contents<br />

of @{ 33 }, which is entered au<strong>to</strong>matically without any additional & symbol.<br />

The last two columns give the relations between goals <strong>and</strong> points won<br />

<strong>and</strong> lost as a centered entry of the form m:n. The colons ‘:’ are only<br />

coincidentally ordered exactly over one another since two-digit numbers<br />

appear in every case on both sides of the colon. If one entry had been<br />

9:101, the colon would have been shifted slightly <strong>to</strong> the left as the entire<br />

entry was centered.<br />

A vertical alignment of the ‘:’ independent of the number of digits<br />

can also be achieved using an @-expression of the form r@{:}l in the<br />

column format. This means that a colon is placed in every row between a<br />

right <strong>and</strong> a left justified column. The column formatting argument in the<br />

example now becomes<br />

{rl@{ 33 }rrrr@{:}lr@{:}l} or<br />

{|r|l||@{ 33 }|rrr|r@{:}l|r@{:}l|}<br />

<strong>and</strong> the row entry is<br />

4 & Daysdon Bombers & 14 & 10 & 9 & 66 & 50 & 38 & 28 \\<br />

Each of the former c columns has been replaced by the two columns in<br />

! r@{:}l. An @-expression inserts its text between the neighboring columns,<br />

removing the intercolumn spacing that would normally be there. Thus the r<br />

column is justified flush right with the ‘:’ <strong>and</strong> the following l column flush left.<br />

The same method can be employed when a column consists of numbers with<br />

decimal points <strong>and</strong> a varying number of digits.<br />

The entries for the goal <strong>and</strong> point relationships are now made up of<br />

two columns positioned about the ‘:’ symbol. This causes no problems<br />

for entering the number of goals won <strong>and</strong> lost or for the number of plus<br />

<strong>and</strong> minus points, since each entry has its own column. The column<br />

headings, however, are the words ‘Goals’ <strong>and</strong> ‘Points’, stretching over<br />

two columns each <strong>and</strong> without the colon. This is accomplished with the<br />

\multicolumn comm<strong>and</strong>, which merges selected columns in a particular<br />

row <strong>and</strong> redefines the column format. The first row of the unframed<br />

soccer table is then<br />

Position& Club & W & T & L & \multicolumn{2}{c}{Goals}<br />

& \multicolumn{2}{c}{Points}\\[0.5ex]<br />

Here \multicolumn{2}{c}{Goals} means that the next two columns<br />

are <strong>to</strong> be combined in<strong>to</strong> a centered column, containing the text ‘Goals’.<br />

For the framed table, the new formatting argument in the \multicolumn<br />

comm<strong>and</strong>s must be {c|} since the vertical line symbol | was also removed<br />

when the old columns were combined. In deciding what belongs <strong>to</strong> a given


102 Chapter 4. Displayed Text<br />

column, use the rule that a column ‘owns’ everything up <strong>to</strong> but excluding<br />

the next r, l, or c.<br />

The table of final results for our soccer league 2002/03 is <strong>to</strong> have the<br />

following title:<br />

\begin{tabular}{|r|l||rrr|r@{:}l|r@{:}l||c|}\hline<br />

\multicolumn{10}{|c|}{\bfseries 1st Regional Soccer League ---<br />

Final Results 2002/03}\\ \hline<br />

&\itshape Club &\itshape W &\itshape T &\itshape L &<br />

\multicolumn{2}{c|}{\itshape Goals}<br />

& \multicolumn{2}{c||}{\itshape Points}<br />

& \itshape Remarks \\ \hline\hline<br />

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<br />

1st Regional Soccer League — Final Results 2002/03<br />

Club W T L Goals Points Remarks<br />

1 Amesville Rockets 19 13 1 66:31 51:15 League Champs<br />

2 Borden Comets 18 9 6 65:37 45:21 Trophy Winners<br />

3 Clarkson Chargers 17 7 9 70:44 41:25 C<strong>and</strong>idates<br />

4 Daysdon Bombers 14 10 9 66:50 38:28 for<br />

5 Edgar<strong>to</strong>wn Devils 16 6 11 63:53 38:28 National<br />

6 Freeburg Fighters 15 7 11 64:47 37:29 League<br />

7 Gadsby Tigers 15 7 11 52:37 37:29<br />

8 Harrisville Hotshots 12 11 10 62:58 35:31<br />

9 Idle<strong>to</strong>n Shovers 13 9 11 49:51 35:31<br />

10 James<strong>to</strong>wn Hornets 11 11 11 48:47 33:33<br />

11 Kings<strong>to</strong>n Cowboys 13 6 14 54:45 32:34 Medium Teams<br />

12 Lonsdale S<strong>to</strong>mpers 12 8 13 50:57 32:34<br />

13 Marsdon Heroes 9 13 11 50:42 31:35<br />

14 Norburg Flames 10 8 15 50:68 28:38<br />

15 Ollison Champions 8 9 16 42:49 25:41<br />

16 Petersville Lancers 6 8 19 31:77 20:46 Disb<strong>and</strong>ing<br />

17<br />

18<br />

Quincy Giants<br />

Rals<strong>to</strong>n Regulars<br />

7<br />

3<br />

5<br />

11<br />

21<br />

19<br />

40:89<br />

37:74<br />

19:47<br />

17:49<br />

Demoted<br />

The horizontal lines for positions 3–5, 7–14, <strong>and</strong> 17 were made with<br />

the comm<strong>and</strong> \cline{1-9} while all the others used \hline:<br />

11 & Kings<strong>to</strong>n Cowboys & 13 & 6 & 14 & 54&45 & 32&34 &<br />

Medium Teams \\ \cline{1-9}<br />

The last two rows of the table deserve a comment. The remark ‘Demoted’ is<br />

! vertically placed in the middle of the two rows. This is accomplished by typing<br />

18 & Rals<strong>to</strong>n Regulars & 3 & 11 & 19 & 37&74 & 17&49<br />

& \raisebox{1.5ex}[0pt]{Demoted}\\ \hline


4.8. Tables 103<br />

The \raisebox comm<strong>and</strong> lifts the text ‘Demoted’ by 1.5 ex. If the optional<br />

argument [0pt] had been left out, this lifting of the box would have increased the<br />

<strong>to</strong>tal height of the last row by 1.5 ex. This would have resulted in correspondingly<br />

more vertical spacing between the horizontal line of row 17 <strong>and</strong> the text of row<br />

18. This additional spacing is suppressed by the optional argument height =<br />

[0pt]. (See Section 4.7.2 for a description of the \raisebox comm<strong>and</strong>.)<br />

Occasionally one wants <strong>to</strong> increase the vertical spacing between horizontal<br />

lines <strong>and</strong> enclosed text. The soccer table would look better if the<br />

heading were thus:<br />

1st Regional Soccer League — Final Results 2002/03<br />

Club W T L Goals Points Remarks<br />

This is done by inserting an invisible vertical rule, a strut (Section 4.7.6),<br />

in<strong>to</strong> the heading text:<br />

\multicolumn{10}{|c|}{\rule[-3mm]{0mm}{8mm}\bfseries 1st<br />

Regional Soccer League --- Final Results 2002/03}\\ \hline<br />

The included rule has a width of 0 mm, which makes it invisible,<br />

extends 3 mm below the baseline, <strong>and</strong> is 8 mm high. It thus stretches<br />

5 mm (8 − 3) above the baseline. It effectively pushes the horizontal lines<br />

away from the baseline in both directions. If a row consists of more than<br />

one column, it is sufficient <strong>to</strong> include a strut in only one of them since<br />

the size of the whole row is determined by the largest column.<br />

Exercise 4.12: Produce your own table for the final results of your favorite team<br />

sport in the same manner as for the soccer results above. Watch out that the<br />

colons ‘:’ are properly aligned for the goals <strong>and</strong> points relationships.<br />

Exercise 4.13: Generate the following timetable.<br />

Day Subj.<br />

Mon. UNIX<br />

Tues. L AT E X<br />

Wed. UNIX<br />

Fri. L AT E X<br />

6.15–7.15 pm 7.20–8.20 pm 8.30–9.30 pm<br />

Teacher Teacher Teacher<br />

Subj.<br />

Subj.<br />

Room<br />

Room<br />

Room<br />

Dr. Smith Ms. Clarke Mr. Mills<br />

Fortran Math.<br />

Comp. Ctr<br />

Hall A<br />

Hall A<br />

Miss Baker Ms. Clarke Mr. Mills<br />

Conf. Room Fortran<br />

Math.<br />

Conf. Room<br />

Hall A<br />

Dr. Smith Dr. Jones Dr. Jones<br />

C<br />

ComSci.<br />

Comp. Ctr<br />

Hall B<br />

Hall B<br />

Miss Baker Ms. Clarke<br />

C++<br />

Conf. Room<br />

Conf. Room<br />

canceled


104 Chapter 4. Displayed Text<br />

The entries ‘Day’ <strong>and</strong> ‘Subj.’ are raised in the same way as ‘Demoted’ was in<br />

the soccer table. To simplify its application, one can introduce a user-defined<br />

comm<strong>and</strong> with<br />

\newcomm<strong>and</strong>{\rb}[1]{\raisebox{1.5ex}[0pt]{#1}} (see Section 8.3.2)<br />

so that \rb{entry} behaves the same as \raisebox{1.5ex}[0pt]{entry}. This<br />

can be used, for example, as \rb{ Mon.} or \rb{UNIX} <strong>to</strong> elevate the entries by<br />

the necessary amount.<br />

In all the above examples, the entries in the individual columns are<br />

each a single line. Some tables contain certain columns with several lines<br />

of text that are somewhat separated from the rest of the row:<br />

Model Description Price<br />

FBD 360 Desk<strong>to</strong>p: XP3600+ Processor, 512 MB DDR-RAM,<br />

80 GB hard disk, 16x DVD drive, 32x CDRW drive,<br />

64 MB TV output, Windows XP, 15” moni<strong>to</strong>r<br />

FBD 480 Desk<strong>to</strong>p DeLuxe: same as FBD 360 but with<br />

XP4800+ Processor, 48x CDRW drive, 17” moni<strong>to</strong>r<br />

FBT 240 Lap<strong>to</strong>p: XP2400+, 512 MB RAM, 40 GB hard disk,<br />

56 kb modem, 32x speed DVD/CD-RW drive, 2x USB,<br />

15” display, Windows XP, Infrared interface<br />

999.00<br />

1399.00<br />

1299.00<br />

The above table is made up of three columns, the first left justified,<br />

the third right justified. The middle column contains several lines of text<br />

with a line width of 7.5 cm. This is generated with the column formatting<br />

symbol p{width}. The whole column formatting argument in this example<br />

is {lp{7.5cm}r}.<br />

\begin{tabular}{lp{7.5cm}r}<br />

\bfseries Model & Description & \bfseries Price \\[1ex]<br />

FBD 360 &\small{\bfseries Desk<strong>to</strong>p}: XP3600+ Processor,<br />

512˜MB DDR-RAM, 80˜GB hard disk, 16x DVD drive,<br />

32x CDRW drive, 64˜MB TV˜output,<br />

Windows˜XP, 15’’ moni<strong>to</strong>r & 999.00\\<br />

. . . . . . . . . . . .<br />

15’’ display, Windows˜XP, Infrared interface& 1299.00<br />

\end{tabular}<br />

The text for the middle column is simply typed in, being broken up<br />

in<strong>to</strong> lines of width 8.0 cm au<strong>to</strong>matically. The column is separated from<br />

the others with the & symbol in the usual way.<br />

Warning: The line termination comm<strong>and</strong> \\ is ambiguous within a p<br />

column, for it can either start a whole new row, or if \raggedright or<br />

\centering have been given, it ends a line of text within that column<br />

entry. In this case, if this is the last column in the row, the only way <strong>to</strong>


4.8. Tables 105<br />

terminate the row is with \tabularnewline which always starts a new<br />

row.<br />

Exercise 4.14: Produce the following table.<br />

Course <strong>and</strong> Date Brief Description Prerequisites<br />

Introduction <strong>to</strong> LSEDIT<br />

March 14 – 16<br />

Introduction <strong>to</strong> LAT E X<br />

March 21 – 25<br />

Logging on — explanation of the VMS file system<br />

— explanation <strong>and</strong> intensive application<br />

of the VMS edi<strong>to</strong>r LSEDIT — user modifications<br />

Word processors <strong>and</strong> formatting programs —<br />

text <strong>and</strong> comm<strong>and</strong>s — environments — document<br />

<strong>and</strong> page styles — displayed text — math<br />

equations — simple user-defined structures<br />

none<br />

LSEDIT<br />

The final example describes a blank form produced as a framed table.<br />

The difficulty here is <strong>to</strong> set the heights <strong>and</strong> widths of the empty boxes,<br />

since these are normally determined au<strong>to</strong>matically by the text entries.<br />

The example shows how this may be accomplished with the help of struts<br />

<strong>and</strong> \hspace comm<strong>and</strong>s.<br />

Budget Plan 2003–2004<br />

Project Nr. Name<br />

Year 2003 2004 2005<br />

€ US $ € US $ € US $<br />

Investment<br />

Costs<br />

Operating<br />

Costs<br />

Industrial<br />

Contracts<br />

Signature Authorization<br />

\newsavebox{\k}\newsavebox{\kkk}<br />

\sbox{\k}{\framebox[4mm]{\rule{0mm}{3mm}}}<br />

\sbox{\kkk}{\usebox{\k}\usebox{\k}\usebox{\k}}<br />

\begin{tabular} {|l|c|c|c|}\hline<br />

\multicolumn{4}{|c|}{\rule[-0.3cm]{0mm}{0.8cm}\bfseries<br />

Budget Plan 2003--2004}\\<br />

\hline\hline<br />

\rule[-0.4cm]{0mm}{1cm}Project<br />

& \multicolumn{3}{l|}{Nr. \usebox{\kkk}\hspace{0.5cm}<br />

\vline\hspace{0.5cm}Name\usebox{\kkk}\usebox{\kkk}\usebox{\kkk}<br />

\usebox{\kk}}\\ \hline


106 Chapter 4. Displayed Text<br />

\multicolumn{1}{|r|}{Year} & 2003 & 2004 & 2005 \\<br />

\cline{2-4}<br />

& \euro\ \vline\ US \$ & \euro\ \vline\ US \$<br />

& \euro\ \vline\ US \$ \\ \hline<br />

Investment & \hspace{2.5cm}& \hspace{2.5cm}& \hspace{2.5cm} \\<br />

Costs & & & \\ \hline<br />

Operating & & & \\<br />

Costs & & & \\ \hline<br />

Industrial& & & \\<br />

Contracts & & & \\ \hline<br />

\multicolumn{4}{|l|}{\rule[-1.0cm]{0mm}{1.3cm}Signature<br />

\hspace{5cm}\vline˜Authorization} \\ \hline<br />

\end{tabular}<br />

The first three lines are only indirectly related <strong>to</strong> the table construc-<br />

tion. They arrange for three empty boxes <strong>to</strong> be drawn when the<br />

comm<strong>and</strong> \usebox{\kkk} is given (see Section 4.7.1).<br />

Except for the comm<strong>and</strong> \hspace{2.5cm} <strong>to</strong> set the column widths<br />

of the last three columns <strong>and</strong> the comm<strong>and</strong> \vline <strong>to</strong> draw a vertical line<br />

within a column, this example contains nothing new that was not in the<br />

previous examples. It is only necessary <strong>to</strong> give a brief explanation of the<br />

last row in the table:<br />

The comm<strong>and</strong> \multicolumn{4}{|l|} merges all four table columns<br />

in<strong>to</strong> one, in which the text is set flush with the left margin. This text<br />

consists first of a strut \rule[-12mm]{0mm}{15mm} that says the height<br />

of the last row begins 12 mm below the baseline <strong>and</strong> is a <strong>to</strong>tal of 15 mm<br />

high. Then, beginning at the left margin, comes the word Signature,<br />

followed 5 cm later by \vline, a vertical line. The word Authorization<br />

is separated from the vertical line by a blank space (˜).<br />

The above examples clearly illustrate how the column widths <strong>and</strong> row<br />

heights are au<strong>to</strong>matically determined for tables. These sizes, however,<br />

may be influenced by struts <strong>and</strong> \hspace comm<strong>and</strong>s. In addition, the<br />

comm<strong>and</strong>s described in Section 4.8.2 permit the intercolumn <strong>and</strong> interrow<br />

spacings as well as line thickness <strong>to</strong> be altered. For example,<br />

\setlength{\tabcolsep}{5mm}<br />

inserts 5 mm of spacing before <strong>and</strong> after every column; that is, it produces<br />

an intercolumn spacing of 10 mm. Section 4.8.2 gives more information<br />

about the use of these table style parameters.<br />

4.8.4 Extension packages for tables<br />

As powerful as the tabular environment is, it does have limitations. For<br />

this reason, there are a number of <strong>to</strong>ols packages (Section B.5.4) that add<br />

additional features for constructing tables.


4.8. Tables 107<br />

Package: The array package extends the normal functionality of the tabular<br />

array <strong>and</strong> array environments by adding several column formatting arguments,<br />

<strong>and</strong> by allowing the user <strong>to</strong> be able <strong>to</strong> define his or her own such arguments.<br />

m{wth} produces a column of width wth which is aligned vertically in the<br />

middle. (The st<strong>and</strong>ard p{wth} aligns the text with the <strong>to</strong>p line.)<br />

b{wth} is like p <strong>and</strong> m but aligns the text on the bot<strong>to</strong>m line.<br />

>{decl} inserts decl before the next column; thus >{\bfseries} sets the<br />

entire column in bold face without having <strong>to</strong> type \bfseries in each<br />

row.<br />

{$}c{$}c


108 Chapter 4. Displayed Text<br />

Package: The delarray package loads the array package <strong>and</strong> redefines the<br />

delarray array environment so that it may be enclosed in braces that are au<strong>to</strong>matically<br />

adjusted in size, as with the \left <strong>and</strong> \right comm<strong>and</strong>s of<br />

Section 5.4.1. The braces surround the column specifier. For example,<br />

<br />

a b<br />

\begin{array}[{cc}] a & b \\ c & d \end{array} ⇒<br />

c d<br />

Package:<br />

longtable<br />

The longtable package produces tables extending over several pages.<br />

It does not require the array package, but does recognize its extra features<br />

if loaded. The longtable environment takes the same column formatting<br />

argument as tabular <strong>and</strong> array, but has additional row entries at the<br />

start <strong>to</strong> determine:<br />

• those rows that appear at the start of the table, terminated by<br />

\endfirsthead; this often includes the main \caption;<br />

• those at the <strong>to</strong>p of every continuation page, terminated by \endhead;<br />

these normally include an additional \caption <strong>and</strong> the column<br />

headers;<br />

• those at the bot<strong>to</strong>m of each page, terminated by \endfoot;<br />

• <strong>and</strong> those rows at the end of the table, terminated by \endlastfoot.<br />

An example of a long table is:<br />

\begin{longtable}{|l|c|r|}<br />

\caption[Short title]{Demonstration of a long table}\\<br />

\hline<br />

Left & Center & Right \\<br />

\hline \endfirsthead<br />

\caption[]{\emph{continued}}\\<br />

\hline<br />

Left & Center & Right \\<br />

\hline \endhead<br />

\hline<br />

\multicolumn{3}{r}{\emph{continued on next page}}<br />

\endfoot<br />

\hline\endlastfoot<br />

Twenty-two & fifty & A hundred <strong>and</strong> eighty \\<br />

22 & 50 & 180 \\<br />

. . . . . .<br />

\end{longtable}<br />

The \caption comm<strong>and</strong> normally may only appear within table <strong>and</strong><br />

figure environments (Section 7.4) but may also be used within longtable<br />

which never goes in<strong>to</strong> a table environment; in a continued row, \caption<br />

must have an empty optional argument [] <strong>to</strong> prevent multiple entries in<br />

the list of tables.<br />

A \newpage comm<strong>and</strong> forces a new page within the long table.<br />

Up <strong>to</strong> four L AT E X runs may be needed <strong>to</strong> get the column widths right.


Primary Energy Consumption<br />

4.8. Tables 109<br />

Energy Source 1975 1980 1986<br />

Total Consumption<br />

(in million <strong>to</strong>ns of BCU a ) 347.7 390.2 385.0<br />

of which (percentages)<br />

petroleum 52.1 47.6 43.2<br />

bituminous coal 19.1 19.8 20.0<br />

brown coal 9.9 10.0 8.6<br />

natural gas 14.2 16.5 15.1<br />

nuclear energy 2.0 3.7 10.1<br />

other b 2.7 2.3 3.0<br />

a BCU = Bituminous Coal Unit (1 <strong>to</strong>n BCU corresponds <strong>to</strong> the heating equivalent of 1 <strong>to</strong>n<br />

of bituminous coal = 8140 kwh)<br />

b Wind, water, solar energy, etc.<br />

Source: Energy Balance Study Group, Essen 1987.<br />

4.8.5 Floating tables<br />

In Chapter 7 we explain how figures <strong>and</strong> tables can be made <strong>to</strong> float, that<br />

is, <strong>to</strong> be moved <strong>to</strong> the <strong>to</strong>p or bot<strong>to</strong>m of a page, or <strong>to</strong> a separate page<br />

al<strong>to</strong>gether. The reason for doing this is that the author does not know<br />

in advance where the page breaks will occur, <strong>and</strong> so does not know if<br />

there is enough room on the current page for such a large object. The<br />

float mechanism allows the material <strong>to</strong> be saved <strong>and</strong> then placed later at<br />

an appropriate location. It also allows for table <strong>and</strong> figure captions <strong>and</strong><br />

au<strong>to</strong>matic numbering.<br />

Table material is made <strong>to</strong> float with the environment:<br />

\begin{table} head text table foot text \end{table}<br />

where table st<strong>and</strong>s for the entire table as defined in a tabular environment,<br />

head text for whatever text appears above the table, <strong>and</strong> foot text<br />

for that below. Widths, spacing, <strong>and</strong> positioning of the texts relative <strong>to</strong><br />

the table are all matters for the user <strong>to</strong> arrange.<br />

Independently of the enclosed text, everything that appears between<br />

\begin{table} <strong>and</strong> \end{table} is normally placed at the start of the<br />

current page. If a table already occupies the <strong>to</strong>p of the page, an attempt<br />

is made <strong>to</strong> place it at the page bot<strong>to</strong>m, if there is enough space for it.<br />

Otherwise, it will be placed on the next page, where further tables may be<br />

accumulated. The surrounding text is printed as though the table were<br />

not there. For further details about floats in general, including au<strong>to</strong>matic<br />

sequential numbering, see Chapter 7.<br />

The table at the <strong>to</strong>p of this page was generated within the text at this<br />

location with the following (excluding the footnotes, which are described<br />

later in Section 4.10.4):


110 Chapter 4. Displayed Text<br />

\begin{table} {\bfseries Primary Energy Consumption}\\[1ex]<br />

\begin{tabular*}{118mm}{@{}ll...rr@{}}<br />

. . . . . . . . . . . . . . . . . . . .<br />

\end{tabular*}\\[0.5ex]<br />

\emph{Source:} Energy Balance Study Group, . . .<br />

\end{table}<br />

There are a number of formatting parameters that may be used in<br />

connection with the table environment, which are described <strong>to</strong>gether<br />

with those for figures in Section 7.3.<br />

Exercise 4.15: Complete the above text for the table on the previous page (without<br />

the footnotes). Pay attention <strong>to</strong> the following questions (check the explanations<br />

for the @-expressions in Section 4.8.1):<br />

1. What is the effect of the @{} entries at the beginning <strong>and</strong> end of the<br />

formatting definition?<br />

2. The tabular* environment generates a table with a given width, here<br />

118 mm. What would be the effect of @{extracolsep{\fill}} at the<br />

beginning of the formatting definition?<br />

3. Where in the formatting definition should @{extracolsep{\fill}} <strong>and</strong><br />

the counterm<strong>and</strong>ing @{\hspace{1em}}@{\extracolsep{1em}} appear in<br />

order <strong>to</strong> format the table as it is printed here? How would the table appear<br />

if only @{\extracolsep{1em}} were given as counterm<strong>and</strong>?<br />

4.9 Printing literal text<br />

Occasionally it is necessary <strong>to</strong> print text exactly as it is typed, with all<br />

special characters, blanks, <strong>and</strong> line breaks appearing literally, unformatted,<br />

<strong>and</strong> in a typewriter font. Lines of computer code or samples of L AT E X<br />

input text are examples of such literal text. This is accomplished with the<br />

environments<br />

\begin{verbatim} text \end{verbatim}<br />

\begin{verbatim*} text \end{verbatim*}<br />

A new line is inserted before <strong>and</strong> after these environments.<br />

With the *-form, blanks are printed with the symbol <strong>to</strong> make them<br />

visible.<br />

As an example, on page 115 some input text is printed <strong>to</strong> demonstrate<br />

the use of footnotes in forbidden modes. This was done with<br />

\begin{verbatim}<br />

\add<strong>to</strong>counter{footnote}{-1}\footnotetext{Small insects}<br />

\stepcounter{footnote}\footnotetext{Large mammals}<br />

\end{verbatim}<br />

Literal text may also be printed within a line using the comm<strong>and</strong>s<br />

\verb <strong>and</strong> \verb*, as for example


4.9. Printing literal text 111<br />

\verb=\emph{words of text}= \emph{words of text}<br />

\verb*=\emph{words of text}= \emph{words of text}<br />

where the first character after \verb or \verb* (here =) is the delimiter,<br />

such that all text up <strong>to</strong> the next occurrence of that character is printed<br />

literally. This character may not appear in the literal text, obviously.<br />

In contrast <strong>to</strong> the behavior in the verbatim environment, the literal<br />

text must be all on one line in the input text, otherwise an error message<br />

is printed. This is <strong>to</strong> indicate that you just might have forgotten <strong>to</strong> repeat<br />

the delimiting character.<br />

Important: neither the verbatim environment nor the \verb comm<strong>and</strong><br />

may be used in an argument of any other comm<strong>and</strong>!<br />

Exercise 4.16: Reproduce some input lines from this book as literal text.<br />

4.9.1 Extension packages for literal text<br />

Package: The st<strong>and</strong>ard package alltt (Section B.5.3, page 392) provides an alltt<br />

alltt environment that also prints its contents literally in a typewriter font,<br />

except that the characters \ { } retain their normal meaning. Thus LAT EX comm<strong>and</strong>s can be included within the literal text. For example,<br />

\begin{alltt}<br />

Underlining \underline{typewriter}<br />

text is also possible.<br />

Note that dollar ($) <strong>and</strong><br />

percent (%) signs are<br />

treated \emph{literally}.<br />

\end{alltt}<br />

Underlining typewriter<br />

text is also possible.<br />

Note that dollar () <strong>and</strong><br />

percent (%) signs are<br />

treated literally.<br />

Package: The st<strong>and</strong>ard package shortvrb (Section B.5.3, page 393) offers a<br />

shortvrb shorth<strong>and</strong> for the \verb comm<strong>and</strong>. After issuing \MakeShortVerb{\|},<br />

one can print short literal text with |text|. The counter comm<strong>and</strong><br />

\DeleteShortVerb{\|} then res<strong>to</strong>res the original meaning <strong>to</strong> |. Any<br />

character may be temporarily turned in<strong>to</strong> a literal switch this way.<br />

Package: One problem with the verbatim environment is that the entire litverbatim<br />

eral text is input <strong>and</strong> s<strong>to</strong>red before processing, something that can lead<br />

<strong>to</strong> memory overflows. The verbatim package in the <strong>to</strong>ols collection<br />

(Section B.5.4, page 396) re-implements the environment <strong>to</strong> avoid this<br />

problem. A minor drawback is that there must not be any other text on<br />

the same line as the \end{verbatim}.<br />

The verbatim package offers two other extra features. It provides<br />

a comment environment that simply ignores its contents, as though<br />

each line started with a % sign (Section 4.11). And it adds a comm<strong>and</strong><br />

\verbatiminput{filename} <strong>to</strong> input the specified file as literal text. This<br />

is useful for listing actual computer programs rather than copying them<br />

in<strong>to</strong> the LAT EX file.


112 Chapter 4. Displayed Text<br />

4.9.2 Email <strong>and</strong> Internet addresses<br />

Package: Email <strong>and</strong> Internet addresses present some special problems that are<br />

url solved with the url package by Donald Arseneau. These addresses are<br />

best listed in a typewriter font, often contain special symbols, <strong>and</strong> should<br />

never be hyphenated, since the hyphen could be interpreted as part of<br />

the address. The obvious solution would be <strong>to</strong> use the \verb comm<strong>and</strong>,<br />

which fulfills all these conditions. However, if the address does not fit<br />

on the current line, it will stick out in<strong>to</strong> the right margin. Using \texttt<br />

instead will allow the words in the address <strong>to</strong> be broken over two lines,<br />

but at the price of inserting an ambiguous hyphen.<br />

Inserting the address with the \url comm<strong>and</strong> allows it <strong>to</strong> be broken at<br />

non-letters between words, without a hyphen. Moreover, its argument is<br />

treated literally, so all special characters are printed as given, just as with<br />

\verb. In fact, the argument of the \url comm<strong>and</strong> may either be enclosed<br />

in curly braces as usual, or delimited by some arbitrary character, just as<br />

with \verb.<br />

An Internet address is given as<br />

An Internet address may be given as<br />

http://address.edu/home/<br />

\url{http://address.edu/home/page/}<br />

page/ or an email address<br />

or an email address might be given as<br />

might be given as fred.smith@<br />

\url=fred.smith@general.services.gov=<br />

general.services.gov<br />

The \url comm<strong>and</strong> is <strong>to</strong> be preferred for another reason: it conforms<br />

<strong>to</strong> logical markup indicating the purpose of its argument. In fact, the<br />

hyperref package of Section 10.2.4 will even turn the argument in<strong>to</strong> an<br />

active link, something it does not do for \verb arguments.<br />

The printed appearance of the address can be controlled by specifying<br />

\urlstyle{style}, where style is one of tt (default), rm, sf, or same, for<br />

typewriter, Roman, sans serif, or unchanged font, respectively.<br />

A fixed address can be predefined with, e.g.,<br />

\urldef{\myurl}\url{myname@mydomain.uk}<br />

Now \myurl is used <strong>to</strong> print myname@mydomain.uk.<br />

There is also a \path comm<strong>and</strong> for giving direc<strong>to</strong>ry/folder names, with<br />

the same syntax as \url. As logical markup, it has a different significance;<br />

for example, the hyperref package does not turn it in<strong>to</strong> a link.<br />

For further information on advanced uses of this package, see the<br />

comments at the end of the file url.sty.<br />

4.10 Footnotes <strong>and</strong> marginal notes<br />

4.10.1 St<strong>and</strong>ard footnotes<br />

Footnotes are generated with the comm<strong>and</strong><br />

\footnote{footnote text}


4.10. Footnotes <strong>and</strong> marginal notes 113<br />

which comes immediately after the word requiring an explanation in a<br />

footnote. The text footnote text appears as a footnote in a smaller typeface<br />

at the bot<strong>to</strong>m of the page. The first line of the footnote is indented <strong>and</strong><br />

is given the same footnote marker as that inserted in the main text. The<br />

first footnote on a page is separated from the rest of the page text by<br />

means of a short horizontal line.<br />

The st<strong>and</strong>ard footnote marker is a small, raised number 1 , which is<br />

sequentially numbered. This footnote is produced with:<br />

... raised number\footnote{The usual method of marking<br />

footnotes in a typewritten ... same page.}, which is ...<br />

The footnote numbering is incremented throughout the whole document<br />

for the article class, whereas it is reset <strong>to</strong> 1 for each new chapter<br />

in the report <strong>and</strong> book classes.<br />

The \footnote comm<strong>and</strong> may only be given within the normal paragraph<br />

mode, <strong>and</strong> not within math or LR modes. In practice, this means it<br />

may not appear within an LR box (Section 4.7.1) or a parbox (Section 4.7.3).<br />

However, it may be used within a minipage environment, in which case<br />

the footnote text is printed beneath the minipage <strong>and</strong> not at the bot<strong>to</strong>m<br />

of the actual page. 2<br />

The \footnote comm<strong>and</strong> must immediately follow the word that is <strong>to</strong><br />

receive the note, without any intervening blanks or spacing. A footnote at<br />

the end of a sentence can be given after the period, as in the last example<br />

above:<br />

... of the actual page.\footnote{With nested ... wrong place.}<br />

4.10.2 Non-st<strong>and</strong>ard footnotes<br />

If the user wishes the footnote numbering <strong>to</strong> be reset <strong>to</strong> 1 for each<br />

\section comm<strong>and</strong> with the article class, this may be achieved with<br />

\setcounter{footnote}{0}<br />

just before or after a \section comm<strong>and</strong>.<br />

The internal footnote counter has the name footnote. Each call <strong>to</strong><br />

\footnote increments this counter by one <strong>and</strong> prints the new value in<br />

Arabic numbering as the footnote marker. A different style of marker can<br />

be implemented with the comm<strong>and</strong><br />

\renewcomm<strong>and</strong>{\thefootnote}{\number style{footnote}}<br />

1 The usual method of marking footnotes in a typewritten manuscript with *, **, etc.,<br />

could also be done; however, since the page breaks are not known at the time of typing the<br />

text, there would be a problem of avoiding duplication of the symbols on the same page.<br />

2 With nested minipages, the footnote comes after the next \end{minipage} comm<strong>and</strong>,<br />

which could be at the wrong place.


114 Chapter 4. Displayed Text<br />

where number style is one of the counter print comm<strong>and</strong>s described in<br />

Section 4.3.5: \arabic, \roman, \Roman, \alph, or \Alph. However,<br />

for the counter footnote, there is an additional counter print comm<strong>and</strong><br />

available, \fnsymbol, which prints the counter values 1–9 as one of nine<br />

symbols:<br />

* † ‡ § ** †† ‡‡<br />

It is up <strong>to</strong> the user <strong>to</strong> see that the footnote counter is reset <strong>to</strong> zero<br />

sometime before the tenth \footnote call.<br />

An optional argument may be added <strong>to</strong> the \footnote comm<strong>and</strong><br />

\footnote[num]{footnote text}<br />

where num is a positive integer that is used instead of the value of the<br />

footnote counter for the marker. In this case, the footnote counter is not<br />

incremented. For example ∗∗ ,<br />

\renewcomm<strong>and</strong>{\thefootnote}{\fnsymbol{footnote}}<br />

For example\footnote[7]{The 7th symbol ... marker.},<br />

\renewcomm<strong>and</strong>{\thefootnote}{\arabic{footnote}}<br />

where the last line is necessary <strong>to</strong> res<strong>to</strong>re the footnote marker style <strong>to</strong><br />

its st<strong>and</strong>ard form. Otherwise, all future footnotes would be marked with<br />

symbols <strong>and</strong> not with numbers.<br />

4.10.3 Footnotes in forbidden modes<br />

A footnote marker can be inserted in the text with the comm<strong>and</strong><br />

\footnotemark[num]<br />

even where the \footnote comm<strong>and</strong> is normally not allowed, that is,<br />

in LR boxes, tables, <strong>and</strong> math mode. The marker is either the optional<br />

argument num or, if it is omitted, the incremented value of the footnote<br />

counter. The footnote itself is not generated. This must be done external<br />

<strong>to</strong> the forbidden mode with the comm<strong>and</strong><br />

\footnotetext[num]{footnote text}<br />

If the optional argument has been used for the footnote marker, the same<br />

num must be given as the option for the text comm<strong>and</strong>. Similarly, if no<br />

option was used for the marker, none may appear with the text. The<br />

footnote will be generated with the value of num or with that of the<br />

footnote counter.<br />

This counter is incremented by a call <strong>to</strong> \footnotemark without an<br />

optional argument. The corresponding \footnotetext comm<strong>and</strong>, on the<br />

other h<strong>and</strong>, does not alter the counter.<br />

∗∗ The 7th symbol appears as the footnote marker.


4.10. Footnotes <strong>and</strong> marginal notes 115<br />

If there are a number of \footnotemark comm<strong>and</strong>s without optional<br />

arguments appearing before the next \footnotetext comm<strong>and</strong>, it is<br />

necessary <strong>to</strong> adjust the counter with the comm<strong>and</strong><br />

\add<strong>to</strong>counter{footnote}{dif }<br />

where dif is a negative number saying how many times the counter must<br />

be set back. Then before every \footnotetext comm<strong>and</strong>, the counter<br />

must be incremented by one. This can be done either with the comm<strong>and</strong><br />

\add<strong>to</strong>counter, with dif =1, or with the comm<strong>and</strong><br />

\stepcounter{footnote}<br />

which adds 1 <strong>to</strong> the given counter.<br />

For example: mosqui<strong>to</strong>es 3 <strong>and</strong> elephants 4<br />

For example: \fbox{mosqui<strong>to</strong>es\footnotemark\ <strong>and</strong><br />

elephants\footnotemark}<br />

generates the footnote markers 3 <strong>and</strong> 4 . Now the counter has the value 4.<br />

In order for the first \footnotetext outside the framed box <strong>to</strong> operate<br />

with the correct counter value, it must first be decremented by one. The<br />

two footnote texts are made with<br />

\add<strong>to</strong>counter{footnote}{-1}\footnotetext{Small insects}<br />

\stepcounter{footnote}\footnotetext{Large mammals}<br />

immediately following the \fbox{} comm<strong>and</strong>. The footnote counter now<br />

has the same value as it did on leaving the \fbox.<br />

4.10.4 Footnotes in minipages<br />

As mentioned in Section 4.10.1, footnote comm<strong>and</strong>s are allowed inside<br />

the minipage environment. However, the footnote appears underneath<br />

the minipage, not below the main page.<br />

Footnote comm<strong>and</strong>s within a minipage<br />

a have a different marker style.<br />

The footnote comes after the next<br />

\end{minipage} comm<strong>and</strong>. b Minipage<br />

footnotes have a counter separate from<br />

that of the main page, called mpfootnote,<br />

counting independently of footnote.<br />

a The marker is a raised lower-case letter.<br />

b Watch out for nested minipages.<br />

\begin{minipage}{6cm}<br />

Footnote comm<strong>and</strong>s within<br />

a minipage\footnote{The<br />

marker is a raised<br />

lower-case letter.} have<br />

a different...<br />

\end{minipage}<br />

Footnotes within a tabular environment can normally only be generated<br />

! with the comm<strong>and</strong>s described above: \footnotemark within the table <strong>and</strong><br />

3 Small insects<br />

4 Large mammals


116 Chapter 4. Displayed Text<br />

\footnotetext outside the environment. However, if the tabular environment<br />

is inside a minipage, normal \footnote comm<strong>and</strong>s may also be used inside the<br />

table. The footnote appears below the table where the minipage comes <strong>to</strong> an end.<br />

Exercise 4.17: Produce a number of footnotes in your st<strong>and</strong>ard exercise file by<br />

inserting them where you think fit <strong>and</strong> by selecting some appropriate footnote<br />

text.<br />

Exercise 4.18: Redefine the comm<strong>and</strong> \thefootnote so that the footnote markers<br />

become the symbols illustrated in Section 4.10.2. Add the redefinition <strong>to</strong> the<br />

preamble of your st<strong>and</strong>ard exercise file.<br />

Exercise 4.19: Complete Exercise 4.15 so that the footnotes a <strong>and</strong> b appear as in<br />

the table on page 109.<br />

4.10.5 Marginal notes<br />

This<br />

is a<br />

marginal<br />

note<br />

=⇒<br />

Notes in the page margin are produced with the comm<strong>and</strong><br />

\marginpar{note text}<br />

which puts the text note text in<strong>to</strong> the margin beginning at the level of the<br />

line where the comm<strong>and</strong> is given. The marginal note appearing here was<br />

generated with<br />

... The marginal note \marginpar{This\\ is a\\ margin-\\al note}<br />

appearing here ...<br />

The text is normally enclosed in a parbox of width 1.9 cm (0.75 in).<br />

Such a narrow box causes great difficulties with line breaking, which is<br />

why the lines are manually broken with the \\ comm<strong>and</strong> in the above<br />

example. Such a box is far more appropriate for marginal notes in the<br />

form of a single symbol, such as the arrow shown here.<br />

Another common use for the marginal note is <strong>to</strong> draw attention <strong>to</strong><br />

certain text passages by marking them with a vertical bar in the margin.<br />

This is often done <strong>to</strong> indicate changes in a text, for comparison with<br />

earlier versions after updated single sheets have been redistributed. The<br />

example marking this paragraph was made by including<br />

\marginpar{\rule[-17.5mm]{1mm}{20mm}}<br />

in the first line.<br />

The width of the marginal note can be changed with a style parameter<br />

described in the next section. The user must watch out that the <strong>to</strong>tal page<br />

width does not become <strong>to</strong>o big for the printer.<br />

By default, marginal notes appear in the right-h<strong>and</strong> margin of the page,<br />

or in the outer margin when the twoside option has been selected. ‘Outer’<br />

means the right margin for odd pages, <strong>and</strong> left for even ones. With the<br />

twocolumn option, they are placed in the outside margins: left for the left<br />

column <strong>and</strong> right for the right one.


4.10. Footnotes <strong>and</strong> marginal notes 117<br />

This leads <strong>to</strong> a problem for marginal markings such as the arrow<br />

illustrated on the previous page. On this page, it must point in the<br />

opposite direction. In fact, its direction depends on which side of the ⇐=<br />

page it is <strong>to</strong> appear, <strong>and</strong> that in turns depends on the page number or<br />

column. Since these are not known at the time of writing (<strong>and</strong> may even<br />

change with later revisions) it is necessary <strong>to</strong> have another solution. This<br />

is provided by the extended syntax of the \marginpar comm<strong>and</strong><br />

\marginpar[left text]{right text}<br />

This form of the comm<strong>and</strong> contains two versions of the marginal text,<br />

left text <strong>to</strong> go in<strong>to</strong> the left margin, <strong>and</strong> right text for the right margin,<br />

depending on which one is selected. Both the arrows on this <strong>and</strong> the<br />

previous page were generated with the same comm<strong>and</strong><br />

\marginpar[\hfill$\Longrightarrow$]{$\Longleftarrow$}<br />

(The mathematical arrow comm<strong>and</strong>s are explained in Section 5.3.5.)<br />

Without the \hfill comm<strong>and</strong> in the above \marginpar example, the arrow<br />

! in the left margin appears as it does at the side of this paragraph, <strong>to</strong>o far over <strong>to</strong><br />

the left. The reason for this is that the \marginpar comm<strong>and</strong> sets its contents<br />

flush with the left edge of the narrow margin box, made visible here with a frame.<br />

This left edge is aligned with the main text only when the note is put on the right<br />

=⇒ side; however, in the left margin, it is displaced from the main text. The \hfill<br />

comm<strong>and</strong> has the effect of setting the contents flush with the right edge of the<br />

margin box, which is then properly aligned with the main text.<br />

A similar device was used <strong>to</strong> make the first marginal note in this section. The<br />

actual comm<strong>and</strong> given was<br />

=⇒<br />

\marginpar[\flushright This\\ is a\\ margin-\\al note]<br />

{This\\ is a\\ margin-\\al note}<br />

Here \flushright (Section 4.2.2) is equivalent <strong>to</strong> putting an \hfill on each line.<br />

The st<strong>and</strong>ard positioning of the marginal notes can be switched with<br />

the comm<strong>and</strong> \reversemarginpar. Once this comm<strong>and</strong> has been given,<br />

marginal notes will appear in the left margin, or in the ‘inner’ margin for<br />

the twoside option. The comm<strong>and</strong> \normalmarginpar res<strong>to</strong>res normal<br />

behavior. These comm<strong>and</strong>s have no effect with the twocolumn option.<br />

If the note appears at the bot<strong>to</strong>m of a page, it will extend downwards<br />

below the last line of regular text. For this reason, <strong>and</strong> because of the<br />

difficulties with line breaking for narrow columns, marginal notes should<br />

be kept short, limited <strong>to</strong> a few words or a symbol.<br />

4.10.6 Style parameters for footnotes <strong>and</strong> marginal notes<br />

There are two footnote style parameters that may be changed as needed, either<br />

! in the preamble or locally within an environment.<br />

\footnotesep<br />

The vertical spacing between two footnotes. This is a length that can<br />

be changed with the \setlength comm<strong>and</strong>.


118 Chapter 4. Displayed Text<br />

\footnoterule<br />

The comm<strong>and</strong> that draws a horizontal line between the page text <strong>and</strong><br />

the footnotes. It should not add any net vertical spacing. It may be<br />

changed, for example, by<br />

\renewcomm<strong>and</strong>{\footnoterule}<br />

{\rule{wth}{hght}\vspace{-hght}}<br />

A value of 0 cm for the hght produces an invisible line of zero thickness.<br />

The following style parameters may be changed <strong>to</strong> redefine how marginal<br />

notes appear:<br />

\marginparwidth<br />

determines the width of the margin box;<br />

\marginparsep<br />

sets the separation between the margin box <strong>and</strong> the main text;<br />

\marginparpush<br />

is the smallest vertical distance between two marginal notes.<br />

These parameters are all lengths <strong>and</strong> are assigned new values as usual with the<br />

\setlength comm<strong>and</strong>.<br />

4.11 Comments within text<br />

All computer languages provide a means of inserting comments in<strong>to</strong> the<br />

code. These are explana<strong>to</strong>ry notes, documentation, his<strong>to</strong>ry of development,<br />

or alternative text or code that has been temporarily deactivated.<br />

Comment lines are completely ignored during processing. They are only<br />

intended for human readers inspecting the source text.<br />

In L AT E X, the comment character is the percent sign %. When this<br />

character appears in the text, it <strong>and</strong> the rest of the line are ignored. If a<br />

comment is several lines long, each line must be prefixed with %.<br />

As for other single character comm<strong>and</strong>s, the percent sign itself is<br />

printed with the comm<strong>and</strong> \%, as explained in Section 2.5.4.<br />

The comment character % is also useful for experimenting with text<br />

or definitions of user comm<strong>and</strong>s or formatting parameters, <strong>to</strong> try alternatives<br />

without deleting the old versions. By ‘commenting out’ selective<br />

lines, one can play around with variations without losing them.<br />

Large sections of text may be more effectively commented out with the<br />

comment environment from the verbatim package (page 111).<br />

Finally, the % character has an important role <strong>to</strong> play in suppressing<br />

implied blanks at the end of a line. This is especially desirable in user definitions<br />

where unexpected blanks can creep in between otherwise invisible<br />

declarations with arguments. See Section 8.5.2.<br />

Exercise 4.20: Comment out the changes from Exercise 4.18 in your preamble.<br />

These comm<strong>and</strong>s may be reactivated later by removing the % character.


5<br />

Mathematical Formulas<br />

Mathematics is the soul of T E X. It was because the setting of mathematical<br />

formulas is so complicated in normal printing, not <strong>to</strong> mention on a<br />

typewriter, that Donald Knuth invented his text formatting system. On<br />

the other h<strong>and</strong>, the soul of L AT E X is logical markup. Nevertheless, all the<br />

power of T E X’s math setting is also available in L AT E X, offering an unbeatable<br />

combination.<br />

In this chapter, we confine ourselves <strong>to</strong> the elements of mathematical<br />

typesetting available in st<strong>and</strong>ard L AT E X. The simplifications <strong>and</strong> additional<br />

elements provided by A M S-L AT E X are reserved for Chapter 12.<br />

Mathematical formulas are produced by typing special descriptive<br />

text. This means that L AT E X must be informed that the following text is<br />

<strong>to</strong> be interpreted as a mathematical formula, <strong>and</strong> it must also be <strong>to</strong>ld<br />

when the math text has come <strong>to</strong> an end <strong>and</strong> normal text recommences.<br />

The processing of math text is carried out by switching <strong>to</strong> math mode.<br />

Mathematical environments serve this purpose.<br />

5.1 Mathematical environments<br />

Mathematical formulas may occur within a line of text, as (a + b) 2 =<br />

a 2 + 2ab + b 2 , or separated from the main text as<br />

∞<br />

0<br />

f (x) dx ≈<br />

n<br />

wie xif (xi)<br />

These two types are distinguished by referring <strong>to</strong> them as text <strong>and</strong> displayed<br />

formulas respectively.<br />

Text formulas, or equations, are generated with the environment<br />

i=1<br />

\begin{math} formula text \end{math}<br />

Since text formulas are often very short, sometimes consisting of only a<br />

single character, a shorth<strong>and</strong> version is available as \( formula text \).<br />

119


120 Chapter 5. Mathematical Formulas<br />

However, most authors prefer the very short form $formula text $ which<br />

is actually the T E X method. All three are essentially the same, <strong>and</strong> there<br />

is no reason not <strong>to</strong> use the $ sign.<br />

The contents of the formula, formula text, consist of math constructs,<br />

which are described in the following sections.<br />

Displayed formulas, or equations, are produced in the environments<br />

\begin{displaymath} formula text \end{displaymath}<br />

\begin{equation} formula text \end{equation}<br />

The difference between these two is that the equation environment au<strong>to</strong>matically<br />

adds a sequential equation number. The displaymath environment<br />

may be given with the shorth<strong>and</strong> forms \[ . . . \] or $$. . . $$.<br />

By default displayed formulas are centered horizontally with the equation<br />

number, if it is present, set flush with the right margin. By selecting<br />

the document class option fleqn (Section 3.1.1), the formulas are set left<br />

justified with an adjustable indentation. This option remains valid for the<br />

entire document whereas the amount of indentation may be changed at<br />

will with \setlength{\mathindent}{indent}, where indent is a length<br />

specification. Moreover, the document class option leqno sets the equation<br />

numbers flush with the left margin throughout the whole document.<br />

Finally, multiline formulas can be created with the environments<br />

\begin{eqnarray} formula text \end{eqnarray}<br />

\begin{eqnarray*} formula text \end{eqnarray*}<br />

where the st<strong>and</strong>ard form adds a sequential equation number for each line<br />

<strong>and</strong> the *-form is without equation numbers.<br />

5.2 Main elements of math mode<br />

5.2.1 Constants <strong>and</strong> variables<br />

Numbers that appear within formulas are called constants, whereas simple<br />

variables are represented by single letters. The universal practice<br />

in mathematical typesetting is <strong>to</strong> put constants in Roman typeface <strong>and</strong><br />

variables in italics. L AT E X adheres <strong>to</strong> this rule au<strong>to</strong>matically in math mode.<br />

Blanks are <strong>to</strong>tally ignored <strong>and</strong> are included in the input text simply <strong>to</strong> improve<br />

the appearance for the writer. Spacing between constants, variables,<br />

<strong>and</strong> opera<strong>to</strong>rs like +, −, = are set au<strong>to</strong>matically by L AT E X. For example<br />

$z=2a+3y$, $ z = 2 a + 3 y $ both produce z = 2a + 3y.<br />

Mathematical symbols that are available on the keyboard are<br />

+ - = < > / : ! ’ | [ ] ( )<br />

all of which may be used directly in formulas. The curly braces { } serve<br />

the purpose of logically combining parts of the formula <strong>and</strong> therefore


5.2. Main elements of math mode 121<br />

cannot act as printable characters. To include braces in a formula, the<br />

same comm<strong>and</strong>s \{ <strong>and</strong> \} are used as in normal text.<br />

M(s) < M(t) < |M| = m $M(s)


122 Chapter 5. Mathematical Formulas<br />

5.2.3 Fractions<br />

Short fractions, especially within a text formula, are best represented<br />

using the slash character /, as in $(n+m)/2$ for (n + m)/2. For more<br />

complicated fractions, the comm<strong>and</strong><br />

\frac{numera<strong>to</strong>r}{denomina<strong>to</strong>r}<br />

is employed <strong>to</strong> write the numera<strong>to</strong>r on <strong>to</strong>p of the denomina<strong>to</strong>r with a<br />

horizontal fraction line of the right width between them.<br />

1<br />

x + y<br />

\[ \frac{1}{x+y} \]<br />

a 2 − b 2<br />

5.2.4 Roots<br />

a + b = a − b \[ \frac{aˆ2 - bˆ2}{a+b} = a-b \]<br />

Fractions may be nested <strong>to</strong> any depth within one another.<br />

a b<br />

x−y + x+y<br />

1 + a−b<br />

a+b<br />

\[ \frac{\frac{a}{x-y} + \frac{b}{x+y}}<br />

{1 + \frac{a-b}{a+b}} \]<br />

L AT E X sets fractions within fractions in a smaller typeface. Section 5.5.2<br />

describes how the au<strong>to</strong>matic type sizes may be overridden if L AT E X’s choice<br />

is unsuitable.<br />

Roots are printed with the comm<strong>and</strong><br />

\sqrt[n]{arg}<br />

as in the example: $\sqrt[3]{8} = 2$ produces 3√ 8 = 2. If the optional<br />

argument n is omitted, the square root is generated: $\sqrt{a} yields<br />

√<br />

a.<br />

The size <strong>and</strong> length of the root signare au<strong>to</strong>matically fitted <strong>to</strong> arg:<br />

$\sqrt{xˆ2 + yˆ2 + 2xy} = x+y$ x2 + y2 + 2xy = x + y, or<br />

<br />

n<br />

x n − y n<br />

1 + u 2n<br />

\[ \sqrt[n]{\frac{xˆn - yˆn}{1 + uˆ{2n}}} \]<br />

Roots may be nested inside one another <strong>to</strong> any depth:<br />

<br />

3<br />

−q +<br />

<br />

q2 + p3 \[ \sqrt[3]{-q + \sqrt{qˆ2 + pˆ3}} \]


5.2.5 Sums <strong>and</strong> integrals<br />

5.2. Main elements of math mode 123<br />

Summation <strong>and</strong> integral signs are made with the two comm<strong>and</strong>s \sum<br />

<strong>and</strong> \int, which may appear in two different sizes depending on whether<br />

they occur in a text or displayed formula.<br />

Sums <strong>and</strong> integrals very often possess upper <strong>and</strong> lower limits. These<br />

are printed with the exponent <strong>and</strong> index comm<strong>and</strong>s ˆ <strong>and</strong> _. The positioning<br />

of the limits also depends on whether the formula is in text or<br />

displayed.<br />

In a text formula \sum_{i=1}ˆn <strong>and</strong> \int_aˆb produce n i=1 <strong>and</strong> b<br />

a ,<br />

whereas in a displayed formula they appear as at the left below:<br />

n<br />

i=1<br />

b<br />

a<br />

Some authors prefer the limits for the integral <strong>to</strong> be<br />

placed above <strong>and</strong> below the integral sign, the same<br />

as for summation. This is achieved with the comm<strong>and</strong><br />

\limits immediately following the integral<br />

sign: \int\limits_{x=0}ˆ{x=1}<br />

The rest of the formula text coming before <strong>and</strong> after the sum <strong>and</strong><br />

integral signs is correctly aligned with them.<br />

2<br />

n<br />

i=1<br />

ai<br />

b<br />

a<br />

fi(x)gi(x) dx<br />

x=1 <br />

x=0<br />

\[ 2\sum_{i=1}ˆn a_i \intˆb_a<br />

f_i(x)g_i(x)\,\mathrm{d}x \]<br />

Two points must be made regarding integrals such as y dx <strong>and</strong> f (z) dz.<br />

! First, there should be a little extra spacing between the differential opera<strong>to</strong>rs<br />

dx <strong>and</strong> dz <strong>and</strong> the integr<strong>and</strong>s preceding them. This is achieved with the small<br />

spacing comm<strong>and</strong> \, mentioned in Section 2.7.1, not with a blank which is<br />

ignored in math mode. Second, the differential opera<strong>to</strong>r should be written<br />

upright, not italic, as explained in Section 5.4.10. This is accomplished by setting<br />

it within a \mathrm comm<strong>and</strong> (Section 5.4.2). Thus \int y\,\mathrm{d}x <strong>and</strong><br />

\int f{z}\,\mathrm{d}z produce the desired results shown above, whereas<br />

\int y dx <strong>and</strong> \int f(z) dz yield ydx <strong>and</strong> f (z)dz.<br />

5.2.6 Continuation dots—ellipsis<br />

Formulas occasionally contain a row of dots . . . , meaning <strong>and</strong> so on.<br />

Simply typing a period three times in a row produces an undesirable<br />

result: ..., that is, the dots are <strong>to</strong>o close <strong>to</strong>gether. Therefore L AT E X provides<br />

several comm<strong>and</strong>s<br />

\ldots . . . low dots \cdots · · · center dots<br />

\vdots<br />

. vertical dots \ddots<br />

. ..<br />

diagonal dots<br />

<strong>to</strong> space the dots correctly. The difference between the first two comm<strong>and</strong>s<br />

is best illustrated by the examples a0, a1, . . . , an <strong>and</strong> a0 + a1 +<br />

· · · + an, which are produced with $a_0,a_1,\ldots,a_n$ for the first<br />

<strong>and</strong> $a_0 + a_1 + \cdots + a_n$ for the second.


124 Chapter 5. Mathematical Formulas<br />

The comm<strong>and</strong> \ldots is also available in normal text mode, whereas<br />

the other three are only allowed in math mode. In text mode, the comm<strong>and</strong><br />

\dots may be used in place of \ldots with the same effect.<br />

Exercise 5.2: Generate the following output:<br />

The reduced cubic equation y 3 + 3py + 2q = 0 has one real <strong>and</strong> two complex<br />

solutions when D = q 2 + p 3 > 0. These are given by Cardan’s formula as<br />

where<br />

u + v<br />

y1 = u + v, y2 = −<br />

2<br />

i u + v<br />

+ 3(u − v), y3 = −<br />

2<br />

2<br />

u = 3<br />

<br />

<br />

−q + q2 + p3 , v = 3<br />

<br />

<br />

−q − q2 + p3 i <br />

− 3(u − v)<br />

2<br />

Note: the spacings between the parts of the displayed equations are made with<br />

the spacing comm<strong>and</strong>s \quad <strong>and</strong> \qquad.<br />

Exercise 5.3: Select the option fleqn in the document class comm<strong>and</strong> <strong>and</strong> include<br />

the specification \setlength{\mathindent}{2cm} in the preamble. Redo<br />

the three y equations above, each as a separate displayed formula, using the<br />

equation environment instead of displaymath or \[. . . \] brackets.<br />

Exercise 5.4: Create the following text:<br />

Each of the measurements x1 < x2 < · · · < xr occurs p1, p2, . . . , pr times. The<br />

mean value <strong>and</strong> st<strong>and</strong>ard deviation are then<br />

<br />

x = 1<br />

n<br />

r<br />

<br />

<br />

pixi, s = 1<br />

n<br />

i=1<br />

where n = p1 + p2 + · · · + pr .<br />

r<br />

pi(xi − x) 2<br />

Exercise 5.5: Although this equation looks very complicated, it should not<br />

present any great difficulties:<br />

(ax + b) 3<br />

x<br />

dx = 2 (ax + b) 3<br />

3<br />

i=1<br />

<br />

+ 2b ax + b + b 2<br />

<br />

The same applies <strong>to</strong> 8<br />

−1 (dx/ 3√ x) = 3<br />

2 (82/3 + 1 2/3 ) = 15/2.<br />

5.3 Mathematical symbols<br />

dx<br />

x √ ax + b<br />

There is a very wide range of symbols used in mathematical text, of which<br />

only a few are directly available from the keyboard. L AT E X provides many of<br />

the mathematical symbols that are commonly used. They are called with<br />

the symbol name prefixed with the \ character. The names themselves<br />

are derived from their mathematical meanings.


5.3.1 Greek letters<br />

5.3. Mathematical symbols 125<br />

Lower case letters<br />

α \alpha θ \theta o o τ \tau<br />

β \beta ϑ \vartheta π \pi υ \upsilon<br />

γ \gamma ι \iota ϖ \varpi φ \phi<br />

δ \delta κ \kappa ρ \rho ϕ \varphi<br />

ɛ \epsilon λ \lambda ϱ \varrho χ \chi<br />

ε \varepsilon µ \mu σ \sigma ψ \psi<br />

ζ \zeta ν \nu ς \varsigma ω \omega<br />

η \eta ξ \xi<br />

Upper case letters<br />

Γ \Gamma Λ \Lambda Σ \Sigma Ψ \Psi<br />

∆ \Delta Ξ \Xi Υ \Upsilon Ω \Omega<br />

Θ \Theta Π \Pi Φ \Phi<br />

The Greek letters are made simply by putting the comm<strong>and</strong> character \<br />

before the name of the letter. Upper case (capital) letters are distinguished<br />

by capitalizing the first letter of the name. Greek letters that do not appear<br />

in the above list are identical with some corresponding Latin letter. For<br />

example, upper case ρ is the same as Latin P <strong>and</strong> so needs no special<br />

symbol.<br />

L AT E X normally sets the upper case Greek letters in Roman (upright)<br />

type within a mathematical formula. If they need <strong>to</strong> be in italics, this<br />

can be brought about with the math alphabet comm<strong>and</strong> \mathnormal:<br />

$\mathnormal{\Gamma\Pi\Phi}$ appears as Γ ΠΦ.<br />

Greek letters may only be used in math mode. If they are needed in<br />

normal text, the comm<strong>and</strong> must be enclosed in $. . . $ signs.<br />

5.3.2 Calligraphic letters<br />

The following 26 calligraphic letters may also be used in math formulas:<br />

A, B, C, D, E, F, G, H , I, J, K, L, M, N , O, P, Q, R, S, T, U, V, W, X, Y, Z<br />

These are called with the math alphabet comm<strong>and</strong> \mathcal:<br />

$\mathcal{A, B, C,...,Z}$<br />

5.3.3 Binary opera<strong>to</strong>rs<br />

Two mathematical quantities combined with one another <strong>to</strong> make a new<br />

quantity are said <strong>to</strong> be joined by a binary operation. The symbols that are<br />

available for use as binary opera<strong>to</strong>rs are


126 Chapter 5. Mathematical Formulas<br />

Package:<br />

latexsym<br />

amsfonts<br />

± \pm ∩ \cap ◦ \circ ○ \bigcirc<br />

∓ \mp ∪ \cup • \bullet \Box<br />

× \times ⊎ \uplus ⋄ \diamond ♦ \Diamond<br />

÷ \div ⊓ \sqcap ⊳ \lhd △ \bigtriangleup<br />

· \cdot ⊔ \sqcup ⊲ \rhd ▽ \bigtriangledown<br />

∗ \ast ∨ \vee ⊴ \unlhd ⊳ \triangleleft<br />

⋆ \star ∧ \wedge ⊵ \unrhd ⊲ \triangleright<br />

† \dagger ⊕ \oplus ⊘ \oslash \ \setminus<br />

‡ \ddagger ⊖ \ominus ⊙ \odot ≀ \wr<br />

∐ \amalg ⊗ \otimes<br />

The underlined symbol names in the above <strong>and</strong> following tables are<br />

only available if one of the packages latexsym (Section B.5.3) or amsfonts<br />

(Section 12.4.4) has been loaded.<br />

5.3.4 Relations <strong>and</strong> their negations<br />

When two mathematical quantities are compared, they are connected<br />

by a relation. The different types of relational symbols for the various<br />

comparisons are<br />

≤ \le<br />

≪ \ll<br />

\leq ≥ \ge<br />

≫ \gg<br />

\geq ≠ \neq<br />

.<br />

= \doteq<br />

∼ \sim<br />

\simeq<br />

⊂ \subset ⊃ \supset ≈ \approx ≍ \asymp<br />

⊆ \subseteq ⊇ \supseteq ≅ \cong ⌣ \smile<br />

⊏ \sqsubset ⊐ \sqsupset ≡ \equiv ⌢ \frown<br />

⊑ \sqsubseteq ⊒ \sqsupseteq ∝ \prop<strong>to</strong> ⋈ \bowtie<br />

∈ \in ∋ \ni ≺ \prec ≻ \succ<br />

⊢ \vdash ⊣ \dashv \preceq \succeq<br />

⊨ \models ⊥ \perp \parallel \| | \mid |<br />

A number of the above symbols may be called by more than one name.<br />

For example, ≤ may be produced with either \le or \leq.<br />

The opposite, or negated, meaning of the relation is indicated in mathematics<br />

with a slash / through the symbol: = <strong>and</strong> = mean equals <strong>and</strong><br />

not equals. One may put a slash through any of the above symbols by<br />

prefixing its name with \not. Thus \not\in yields ∈. The same is true<br />

for the keyboard characters: \not=, \not>, <strong>and</strong> \not< produce =, >, <strong>and</strong><br />


5.3. Mathematical symbols 127<br />

< \not< > \not> = \not=<br />

≤ \not\le ≥ \not\ge ≡ \not\equiv<br />

≺ \not\prec ≻ \not\succ ∼ \not\sim<br />

\not\preceq \not\succeq \not\simeq<br />

⊂ \not\subset ⊃ \not\supset ≈ \not\approx<br />

⊆ \not\subseteq ⊇ \not\supseteq ≅ \not\cong<br />

⊑ \not\sqsubseteq ⊒ \not\sqsupseteq ≍ \not\asymp<br />

∈ \not\in ∉ \notin<br />

5.3.5 Arrows <strong>and</strong> pointers<br />

Mathematical manuscripts often contain arrow symbols, also called pointers.<br />

The following arrow symbols are available:<br />

← \leftarrow \gets ←− \longleftarrow ↑ \uparrow<br />

⇐ \Leftarrow ⇐= \Longleftarrow ⇑ \Uparrow<br />

→ \rightarrow \<strong>to</strong> −→ \longrightarrow ↓ \downarrow<br />

⇒ \Rightarrow =⇒ \Longrightarrow ⇓ \Downarrow<br />

↔ \leftrightarrow ←→ \longleftrightarrow \updownarrow<br />

⇔ \Leftrightarrow ⇐⇒ \Longleftrightarrow \Updownarrow<br />

↦→ \maps<strong>to</strong> ↦−→ \longmaps<strong>to</strong> ↗ \nearrow<br />

←↪ \hookleftarrow ↩→ \hookrightarrow ↘ \searrow<br />

↼ \leftharpoonup ⇀ \rightharpoonup ↙ \swarrow<br />

↽ \leftharpoondown ⇁ \rightharpoondown ↖ \nwarrow<br />

⇌ \rightleftharpoons ⇝ \leads<strong>to</strong><br />

Here again the symbols → <strong>and</strong> ← may also be referred <strong>to</strong> under the names<br />

\<strong>to</strong> <strong>and</strong> \gets. Furthermore, the comm<strong>and</strong> \Longleftrightarrow may<br />

be substituted by \iff, although the latter ( ⇐⇒ ) has a little more spacing<br />

on either side than the former (⇐⇒).<br />

5.3.6 Various other symbols<br />

The above lists by no means exhaust the complete reper<strong>to</strong>ire of mathematical<br />

symbols. However, the following are additional characters that<br />

st<strong>and</strong>ard L AT E X does make available. (Even more symbols are possible with<br />

the A M S symbol fonts <strong>and</strong> amssymb package, Section 12.4.4.)<br />

ℵ \aleph ′ \prime ∀ \forall \Box<br />

ℏ \hbar ∅ \emptyset ∃ \exists ♦ \Diamond<br />

ı \imath ∇ \nabla ¬ \neg △ \triangle<br />

j \jmath √ \surd ♭ \flat ♣ \clubsuit<br />

ℓ \ell ∂ \partial ♮ \natural ♦ \diamondsuit<br />

℘ \wp ⊤ \<strong>to</strong>p ♯ \sharp ♥ \heartsuit<br />

ℜ \Re ⊥ \bot \| ♠ \spadesuit<br />

ℑ \Im ⊢ \vdash ∠ \angle ⋈ \Join<br />

\mho ⊣ \dashv \ \backslash ∞ \infty


128 Chapter 5. Mathematical Formulas<br />

5.3.7 Symbols with two sizes<br />

The following symbols are printed in different sizes depending on whether<br />

they appear in text or displayed formulas:<br />

<br />

\sum<br />

\bigcap<br />

\bigodot<br />

<br />

<br />

<br />

\int<br />

\bigcup<br />

\bigotimes<br />

<br />

<br />

<br />

\oint<br />

\bigsqcup \bigoplus<br />

<br />

\prod<br />

\bigvee<br />

\biguplus<br />

<br />

\coprod \bigwedge<br />

The symbols \int <strong>and</strong> \sum have already been introduced in Section 5.2.5.<br />

There it was shown how these symbols may take on upper <strong>and</strong> lower limits;<br />

in the same way, all the above symbols may also be assigned upper <strong>and</strong><br />

lower limits using the shifting comm<strong>and</strong>s ˆ <strong>and</strong> _. The positioning of<br />

the limits varies for some symbols depending on whether they occur in<br />

text or displayed formulas. As indicated in Section 5.2.5, the comm<strong>and</strong><br />

\limits forces the limits <strong>to</strong> be written above <strong>and</strong> below the symbol where<br />

they would otherwise be placed beside it. Similarly the complementary<br />

comm<strong>and</strong> \nolimits sets them beside the symbol when the st<strong>and</strong>ard<br />

positioning is above <strong>and</strong> below.<br />

∞<br />

0<br />

n<br />

ν=0<br />

∞<br />

0<br />

n ν=0<br />

5.3.8 Function names<br />

\[ \ointˆ\infty_0 \oint\limitsˆ\infty_0 \]<br />

\[ \prodˆn_{\nu=0} \prod\nolimitsˆn_{\nu=0} \]<br />

The universal st<strong>and</strong>ard for mathematical formulas is <strong>to</strong> set variable names<br />

in italics but the names of functions in Roman. If one were simply <strong>to</strong> write<br />

the function names sin or log in math mode, L AT E X would interpret these<br />

as variables s i n <strong>and</strong> l o g <strong>and</strong> write them as sin <strong>and</strong> log. In order<br />

<strong>to</strong> tell L AT E X that a function name is wanted, it is necessary <strong>to</strong> enter a<br />

comm<strong>and</strong> consisting of the backslash \ plus the function name. The<br />

following names are recognized by L AT E X:<br />

\arccos \cosh \det \inf \limsup \Pr \tan<br />

\arcsin \cot \dim \ker \ln \sec \tanh<br />

\arctan \coth \exp \lg \log \sin<br />

\arg \csc \gcd \lim \max \sinh<br />

\cos \deg \hom \liminf \min \sup


5.3. Mathematical symbols 129<br />

Some of these functions may also appear with limits attached <strong>to</strong> them.<br />

This is easily achieved by means of the subscript comm<strong>and</strong> after the name<br />

of the function: \lim_{x\<strong>to</strong>\infty} yields<br />

<strong>and</strong><br />

limx→∞ in text formulas<br />

lim<br />

x→∞<br />

in displayed formulas<br />

The following function names may accept a limit with the lowering<br />

(index) comm<strong>and</strong> _:<br />

\det \gcd \inf \lim \liminf \limsup \max \min<br />

\Pr \sup<br />

Finally, there are the function comm<strong>and</strong>s \bmod <strong>and</strong> \pmod{arg}, both<br />

of which produce the function mod in one of two forms:<br />

$ a \bmod b $ ⇒ a mod b<br />

$ y \pmod{a+b} $ ⇒ y (mod a + b).<br />

With A M S-L AT E X (Section 12.2.5) it is possible <strong>to</strong> define additional<br />

function names.<br />

5.3.9 Mathematical accents<br />

The following mathematical accents are available within math mode:<br />

â \hat{a} ă \breve{a} à \grave{a} ā \bar{a}<br />

ǎ \check{a} á \acute{a} ã \tilde{a} a \vec{a}<br />

˙a \dot{a} ä \ddot{a} ˚a \mathring{a}<br />

The letters i <strong>and</strong> j should be printed without their dots when they<br />

are given an accent. To accomplish this, type the symbols \imath <strong>and</strong><br />

\jmath instead of the letters, as in<br />

$\vec{\imath} + \tilde{\jmath}$: ı + ˜j<br />

There are wider versions of \hat <strong>and</strong> \tilde available with the names<br />

\widehat <strong>and</strong> \widetilde. In this way, these accents may be placed over<br />

parts of a formula:<br />

1 − x = −y $\widehat{1-x}=\widehat{-y}$<br />

xyz $\widetilde{xyz}$<br />

Exercise 5.6: The union of two sets A <strong>and</strong> B is the set of all elements that<br />

are in at least one of the two sets, <strong>and</strong> is designated as A ∪ B. This operation<br />

is commutative A ∪ B = B ∪ A <strong>and</strong> associative (A ∪ B) ∪ C = A ∪ (B ∪ C). If<br />

A ⊆ B, then A ∪ B = B. It then follows that A ∪ A = A, A ∪ {∅} = A <strong>and</strong><br />

J ∪ A = J.<br />

Exercise 5.7: Applying l’Hôpital’s rule, one has<br />

ln sin πx<br />

lim<br />

= lim<br />

x→0 ln sin x x→0<br />

cos πx<br />

π sin πx<br />

cos x<br />

sin x<br />

π tan x π/ cos<br />

= lim = lim<br />

x→0 tan πx x→0<br />

2 x<br />

π/ cos2 cos<br />

= lim<br />

πx x→0<br />

2 πx<br />

cos2 = 1<br />

x


130 Chapter 5. Mathematical Formulas<br />

Exercise 5.8: The gamma function Γ (x) is defined as<br />

Γ (x) ≡ lim<br />

n−1 <br />

n→∞<br />

ν=0<br />

n! n x−1<br />

x + ν<br />

n! n<br />

= lim<br />

n→∞<br />

x−1<br />

x(x + 1)(x + 2) · · · (x + n − 1) ≡<br />

∞<br />

e<br />

0<br />

−t t x−1 dt<br />

The integral definition is valid only for x > 0 (2nd Euler integral).<br />

Exercise 5.9: Remove the option fleqn from the document class comm<strong>and</strong> in<br />

Exercise 5.3 <strong>and</strong> redo the output.<br />

Exercise 5.10:<br />

αx = xα, αβx = βαx, (α + β)x = αx + βx, α(x + y) = αx + α y.<br />

x y = y x but x × y = − y × x, x y = 0 for x ⊥ y, x × y = 0, for x y.<br />

Exercise 5.11: Reproduce Equations 5.1 <strong>and</strong> 5.2 from the next section.<br />

5.4 Additional elements<br />

The math elements described in the previous sections already permit the<br />

construction of very complex formulas, such as<br />

√<br />

1 + x − 1 (<br />

lim<br />

= lim<br />

x→0 x<br />

x→0<br />

√ 1 + x − 1)( √ 1 + x + 1)<br />

x( √ 1<br />

= lim √ =<br />

1 + x + 1)<br />

x→0 1 + x + 1 1<br />

(5.1)<br />

2<br />

I(z)=sin( π<br />

2 z2 ∞<br />

)<br />

∂2U ∂x2 + ∂2U ∂y 2 = 0 =⇒ UM = 1<br />

<br />

<br />

1 ∂U 1<br />

ds −<br />

4π r ∂n 4π<br />

Σ<br />

Σ<br />

n=0<br />

(−1) n π 2n<br />

1 · 3 · · · (4n + 1) z4n+1 − cos( π<br />

2 z2 )<br />

n=0<br />

∂ 1<br />

r<br />

U ds (5.2)<br />

∂n<br />

∞ (−1) nπ 2n+1<br />

1 · 3 · · · (4n + 3) z4n+3<br />

(5.3)<br />

By reading the formulas from left <strong>to</strong> right there should be no difficulty<br />

in reconstructing the text that produced them. For example, the last<br />

equation is generated with<br />

\begin{equation}<br />

I(z) = \sin( \frac{\pi}{2} zˆ2 ) \sum_{n=0}ˆ\infty<br />

\frac{ (-1)ˆn \piˆ{2n} }{1 \cdot 3 \cdots (4n+1) } zˆ{4n+1}<br />

-\cos( \frac{\pi}{2} zˆ2 ) \sum_{n=0}ˆ\infty<br />

\frac{ (-1)ˆn \piˆ{2n+1} }{ 1 \cdot 3 \cdots (4n+3) } zˆ{4n+3}<br />

\end{equation}<br />

The above examples were made using the equation environment instead<br />

of the displaymath environment or its abbreviated form \[. . . \],<br />

which has the effect of adding the equation numbers au<strong>to</strong>matically. In the<br />

document classes book <strong>and</strong> report, equations are sequentially numbered<br />

within the chapter, the number being preceded by the chapter number<br />

<strong>and</strong> set within parentheses ( ), as illustrated above. For document class


5.4. Additional elements 131<br />

article, the equations are numbered sequentially throughout the entire<br />

document.<br />

By default the equation number appears right justified <strong>and</strong> vertically<br />

centered with the equation. If there is not enough room for it on the<br />

same line, it is printed right justified below the equation. If the document<br />

class option leqno has been selected, the equation numbers are set left<br />

justified for the entire document.<br />

The au<strong>to</strong>matic numbering of equations means that the author may<br />

not know at the time of writing just what the equation number is. The<br />

L AT E X cross-reference system described in Section 9.2.1 has already been<br />

explained for referring <strong>to</strong> section numbers (Section 3.3.3) <strong>and</strong> may also<br />

be used for equation numbers. By including a comm<strong>and</strong> \label{name}<br />

within the equation environment, one can print the unknown equation<br />

number in the text with the comm<strong>and</strong> \ref{name}, where name is a<br />

keyword consisting of any combination of letters, numbers, or symbols.<br />

Examining Equation 5.3 more closely, one notices that the two parentheses<br />

pairs ( ) in cos() <strong>and</strong> sin() could be somewhat larger. Furthermore,<br />

this equation just fills the line width, <strong>and</strong> if it were any longer, it would<br />

have <strong>to</strong> be broken at some appropriate spot <strong>and</strong> the parts positioned in<br />

a meaningful way relative <strong>to</strong> one another. None of the math elements<br />

described so far can accomplish these requirements.<br />

Even something so simple as including some normal text within a<br />

formula has not yet been mentioned. The rest of this section addresses<br />

these problems.<br />

Finally, there are times when one is not happy with the sizes that TEX has chosen, as for example in the last integral of Equation 5.2 where ∂ 1<br />

r<br />

would be more desirable than ∂ 1<br />

r . This <strong>and</strong> other formatting aids, such<br />

as adjusting horizontal spacing between parts of formulas, are dealt with<br />

in Section 5.5.<br />

5.4.1 Au<strong>to</strong>matic sizing of bracket symbols<br />

Mathematics often contains bracketing symbols, usually in pairs that<br />

enclose part of the formula. When printed, these bracket symbols should<br />

be the same size as the included partial formula. L AT E X provides a pair of<br />

comm<strong>and</strong>s<br />

\left lbrack sub form \right rbrack<br />

<strong>to</strong> accomplish this. The comm<strong>and</strong> \left is placed immediately before<br />

the opening (left h<strong>and</strong>) bracket symbol lbrack while \right comes just<br />

before the closing (right h<strong>and</strong>) symbol rbrack.


132 Chapter 5. Mathematical Formulas<br />

<br />

x=1 +<br />

x=0<br />

\[ \left[ \int + \int \right]_{x=0}ˆ{x=1} \]<br />

The pair of brackets [ ] is adjusted <strong>to</strong> the size of the enclosed<br />

formula, as are the raised exponent <strong>and</strong> lowered<br />

index as well.<br />

The comm<strong>and</strong>s \left <strong>and</strong> \right must appear as a pair. For every<br />

\left comm<strong>and</strong> there must be a corresponding \right comm<strong>and</strong> somewhere<br />

afterwards. The pairs may be nested. The first \left is paired with<br />

the last \right; the following \left with the second last \right, <strong>and</strong> so<br />

on. There must be the same number of \right as \left comm<strong>and</strong>s in a<br />

nesting.<br />

The corresponding bracket symbols lbrack <strong>and</strong> rbrack may be perfectly<br />

arbitrary <strong>and</strong> do not need <strong>to</strong> be a logical pair.<br />

x + y + z =<br />

a<br />

b<br />

<br />

This set of brackets is admittedly unusual but<br />

permissible.<br />

\[ \vec{x} + \vec{y} + \vec{z} =<br />

\left( ... \right[ \]<br />

Sometimes a formula contains only a single opening or closing bracket<br />

without a corresponding counterpart. However, the \left. . . \right<br />

comm<strong>and</strong>s must still be given as a pair, but with a period ‘.’ as an invisible<br />

bracket symbol.<br />

⎧<br />

⎪⎨ −1 : x < 0<br />

y =<br />

⎪⎩<br />

0<br />

+1<br />

:<br />

:<br />

x = 0<br />

x > 0<br />

\[ y = \left\{ \begin{array}<br />

{r@{\quad:\quad}l}<br />

-1 & x0<br />

\end{array} \right. \]<br />

The array environment in the above example is described in Section 4.8.1<br />

<strong>and</strong> produces a table in math mode.<br />

The \left. . . \right comm<strong>and</strong>s may be applied <strong>to</strong> a <strong>to</strong>tal of 22 different<br />

symbols. These are<br />

( ( ) ) ⌊ \lfloor ⌋ \rfloor<br />

[ [ ] ] ⌈ \lceil ⌉ \rceil<br />

{ \{ } \} 〈 \langle 〉 \rangle<br />

| | \| ↑ \uparrow ⇑ \Uparrow<br />

/ / \ \backslash ↓<br />

<br />

\downarrow<br />

\updownarrow<br />

⇓<br />

<br />

\Downarrow<br />

\Updownarrow<br />

For example, \left|. . . \right| produces two vertical bars adjusted in<br />

height <strong>to</strong> contain the enclosed formula text.<br />

<br />

π<br />

Exercise 5.12: In Equation 5.3, generate cos<br />

2 z2<br />

<br />

π<br />

<strong>and</strong> sin<br />

2 z2<br />

<br />

instead of<br />

cos( π<br />

2 z2 ) <strong>and</strong> sin( π<br />

2 z2 ).


5.4.2 Ordinary text within a formula<br />

5.4. Additional elements 133<br />

It is often necessary <strong>to</strong> include some normal text within a formula, for<br />

example single words such as <strong>and</strong>, or, if, <strong>and</strong> so on. In this case one<br />

must switch <strong>to</strong> LR mode (Section 4.7.1) while staying in math mode. This<br />

is carried out with the comm<strong>and</strong> \mbox{normal text} given inside the<br />

formula, <strong>to</strong>gether with horizontal spacing comm<strong>and</strong>s such as \quad or<br />

\hspace. For example:<br />

Xn = Xk if <strong>and</strong> only if Yn = Yk <strong>and</strong> Zn = Zk<br />

\[ X_n = X_k \qquad\mbox{if <strong>and</strong> only if}\qquad<br />

Y_n = Y_k \quad\mbox{<strong>and</strong>}\quad Z_n = Z_k \]<br />

In order <strong>to</strong> set a longer piece of text beside a displayed formula, as<br />

in some of the above examples, it is more appropriate <strong>to</strong> put both the<br />

formula <strong>and</strong> the text in their own parboxes or minipages, placed side by<br />

side with the proper vertical positioning.<br />

On the other h<strong>and</strong>, if letters from text fonts are required as mathematical<br />

symbols, they should be entered with the math alphabet comm<strong>and</strong>s:<br />

\mathrm \mathtt \mathbf<br />

\mathsf \mathit \mathcal<br />

We have already met \mathcal in Section 5.3.2 on calligraphic letters. All<br />

these comm<strong>and</strong>s function the same way: they set their argument in the<br />

corresponding font.<br />

B 0 (x) T i<br />

j<br />

$\mathbf{B}ˆ0(x)$ \quad $\mathsf{T}ˆi_j$<br />

The comm<strong>and</strong> \mathnormal in Section 5.3.1 also belongs <strong>to</strong> this group.<br />

The difference between it <strong>and</strong> \mathit is that it sets its argument in the<br />

regular math italic font, while the latter uses the normal text italic. The<br />

letters are the same, but the spacing is different.<br />

$\mathnormal{differ} \ne \mathit{differ}$<br />

dif f er = differ<br />

All the math alphabet comm<strong>and</strong>s set their text in math mode, which<br />

means that spaces are ignored as usual. This is not the case for text<br />

placed in an \mbox.<br />

5.4.3 Matrices <strong>and</strong> arrays<br />

a11 a12 · · · a1n<br />

.<br />

.<br />

. ..<br />

.<br />

an1 an2 · · · ann<br />

Structures like the one at the left are the<br />

basis for matrices, determinants, system of<br />

equations, <strong>and</strong> so on. They will all be referred<br />

<strong>to</strong> here as arrays.


134 Chapter 5. Mathematical Formulas<br />

Arrays are produced by means of the array environment, whose syntax<br />

<strong>and</strong> construction are described in Section 4.8.1 on tables. The array<br />

environment generates a table in math mode, that is, the column entries<br />

are interpreted as formula text. For example:<br />

a11x1 + a12x2 + · · · + a1nxn = b1<br />

a22x1 + a22x2 + · · · + a2nxn = b2<br />

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<br />

an1x1 + an2x2 + · · · + annxn = bn<br />

\[ \begin{array}{*{3}{c@{\:+\:}}c@{\;=\;}c}<br />

a_{11}x_1 & a_{12}x_2 & \cdots & a_{1n}x_n & b_1 \\<br />

a_{22}x_1 & a_{22}x_2 & \cdots & a_{2n}x_n & b_2 \\<br />

\multicolumn{5}{c}{\dotfill} \\<br />

a_{n1}x_1 & a_{n2}x_2 & \cdots & a_{nn}x_n & b_n<br />

\end{array} \]<br />

As a reminder of the table construction elements (Section 4.8.1): @{t} in-<br />

! serts the contents of t between the adjacent columns. In the above example,<br />

this is \:+\: <strong>and</strong> \;+\;. The comm<strong>and</strong>s \: <strong>and</strong> \; have not yet been<br />

introduced but they produce small horizontal spacing in math mode (Section<br />

5.5.1). *{3}{c@{\:+\:}} is an abbreviation for three repetitions of the<br />

column definition c@{\:+\:}. c defines the column <strong>to</strong> be one of centered text.<br />

\multicolumn{5}{c} says that the next five columns are <strong>to</strong> be merged <strong>and</strong> replaced<br />

by one with centered text. The comm<strong>and</strong> \dotfill fills the column with<br />

dots.<br />

It is possible <strong>to</strong> nest array environments:<br />

⎛ <br />

<br />

<br />

⎜ <br />

⎜ <br />

⎜<br />

⎝<br />

x11 x12<br />

x21 x22<br />

y<br />

z<br />

<br />

⎞<br />

<br />

<br />

<br />

⎟<br />

⎠<br />

\[ \left( \begin{array}{c}<br />

\left| \begin{array}{cc}<br />

x_{11} & x_{12} \\ x_{21} & x_{22}<br />

\end{array} \right| \\<br />

y \\ z \end{array} \right) \]<br />

The outermost array consists of one column with centered text (c).<br />

The first entry in this column is also an array, with two centered columns.<br />

This array is surrounded left <strong>and</strong> right by vertical lines with adjusted<br />

sizes.<br />

The array environment is structurally the same as a vertical box. This<br />

means that it is treated as a single character within the surrounding environment,<br />

so that it may be coupled with other symbols <strong>and</strong> construction<br />

elements.<br />

<br />

<br />

<br />

<br />

(1,2,...,n) <br />

p1


5.4. Additional elements 135<br />

\[ \sum_{p_1


136 Chapter 5. Mathematical Formulas<br />

is given by the expression<br />

<br />

<br />

<br />

<br />

<br />

<br />

±<br />

l1 m1<br />

l2 m2<br />

x1 − x2 y1 − y2 z1 − z2<br />

l1 m1 n1<br />

l2 m2 n2<br />

<br />

2<br />

<br />

<br />

<br />

+ <br />

<br />

m1 n1<br />

m2 n2<br />

<br />

2<br />

<br />

<br />

<br />

+ <br />

<br />

n1 l1<br />

n2 l2<br />

If the numera<strong>to</strong>r is zero, the two lines meet somewhere.<br />

Note: we do not recommend using {|cc|} in the formatting argument of<br />

the three determinants in the denomina<strong>to</strong>r under the root sign. Here the<br />

\left|. . . \right| pair should be applied. Try out both possibilities for yourself<br />

<strong>and</strong> compare the results.<br />

Exercise 5.15: Laurent expansion: using cn = 1 <br />

−n−1 (ζ −a) f (ζ) dζ, for every<br />

2πi<br />

function f (z) the following representation is valid (n = 0, ±1, ±2, . . . )<br />

+∞ <br />

f (x) = cn(z − a)<br />

n=−∞<br />

n ⎧<br />

⎪⎨ c0 + c1(z − a) + c2(z − a)<br />

=<br />

⎪⎩<br />

2 + · · · + cn(z − a) n + · · ·<br />

+ c−1(z − a) −1 + c−2(z − a) −2 + · · ·<br />

+ c−n(z − a) −n + · · ·<br />

Tip: the right-h<strong>and</strong> side of the equation can be created with an array environment<br />

consisting of only one column. What is its formatting argument?<br />

5.4.4 Lines above <strong>and</strong> below formulas<br />

The comm<strong>and</strong>s<br />

\overline{sub form} <strong>and</strong> \underline{sub form}<br />

can be used <strong>to</strong> draw lines over or under a formula or sub-formula. They<br />

may be nested <strong>to</strong> any level:<br />

a 2 + xy + z<br />

\[ \overline{\overline{a}ˆ2 + \underline{xy}<br />

+ \overline{\overline{z}}} \]<br />

The comm<strong>and</strong> \underline may also be employed in normal text mode<br />

<strong>to</strong> underline text, whereas \overline is allowed only in math mode.<br />

Exactly analogous <strong>to</strong> these are the two comm<strong>and</strong>s<br />

\overbrace{sub form} <strong>and</strong> \underbrace{sub form}<br />

which put horizontal curly braces above or below the sub-formula.<br />

<br />

a + b<br />

<br />

+ c<br />

+d<br />

\overbrace{a + \underbrace{b+c} + d}<br />

In displayed formulas, these comm<strong>and</strong>s may have exponents or indices<br />

attached <strong>to</strong> them. The (raised) exponent is set above the overbrace while<br />

the (lowered) index is placed below the underbrace.<br />

<br />

<br />

<br />

<br />

<br />

2


123<br />

<br />

a + b + · · · + y +z<br />

<br />

αβγ<br />

5.4. Additional elements 137<br />

\[ \underbrace{a + \overbrace{b + \cdots +<br />

y}ˆ{123} + z}_{\alpha\beta\gamma} \]<br />

Exercise 5.16: The <strong>to</strong>tal number of permutations of n elements taken m at a<br />

time (symbol P m n ) is<br />

5.4.5 Stacked symbols<br />

P m m−1 <br />

n!<br />

n = (n − i) = n(n − 1)(n − 2) . . . (n − m + 1) =<br />

(n − m)!<br />

i=0<br />

<strong>to</strong>tal of m fac<strong>to</strong>rs<br />

The comm<strong>and</strong><br />

\stackrel{upper sym}{lower sym}<br />

places the symbol upper sym centered on <strong>to</strong>p of lower sym, whereby the<br />

symbol on <strong>to</strong>p is set in a smaller typeface.<br />

x def<br />

= (x1, . . . xn) $ \vec{x} \stackrel{\mathrm{def}}{=} (x_1,...$<br />

A α′<br />

−→ B β′<br />

←− C $ A \stackrel{\alpha’}{\longrightarrow} B ... $<br />

By making use of math font size comm<strong>and</strong>s (Section 5.5.2) it is possible<br />

<strong>to</strong> construct new symbols with this comm<strong>and</strong>. For example, some authors<br />

prefer <strong>to</strong> have the \le symbol appear as < = instead of ≤. This is achieved<br />

by combining < <strong>and</strong> = with $\stackrel{\textstyle


138 Chapter 5. Mathematical Formulas<br />

⎛<br />

<br />

⎝ <br />

j≥0<br />

k≥0<br />

ajkz k<br />

⎞<br />

<br />

⎠ =<br />

n≥0<br />

z n<br />

⎛<br />

⎜<br />

⎝<br />

<br />

k0,k1,...≥0<br />

k0+k1+···=0<br />

a0k0<br />

⎞<br />

⎟<br />

a1k1 . . . ⎟<br />

⎠<br />

\[ \prod_{j\ge0}\left( \sum_{k\ge0} a_{jk}zˆk \right) =<br />

\sum_{n\ge0} zˆn \left(\sum_{k_0,k_1\ldots\ge0 \a<strong>to</strong>p<br />

k_0+k_1+\cdots=0} a_{0k_0} a_{1k_1}\ldots \right) \]<br />

Similar structures can be generated with the L AT E X environments<br />

\begin{array}{c} upper line \\ lower line \end{array} (a<strong>to</strong>p)<br />

\left(\begin{array}{c} upper \\ lower \end{array}\right) (choose)<br />

The difference between these array structures <strong>and</strong> those of the T E X<br />

comm<strong>and</strong>s is that the former are always printed in the size <strong>and</strong> style of<br />

normal text formulas, whereas the latter will have varying sizes depending<br />

on where they appear within the formula.<br />

For comparison<br />

∆p1p2···pn−k<br />

p1p2···pn−k<br />

∆ p1p2 · · · pn−k<br />

p1p2 · · · pn−k<br />

The index array is produced using \a<strong>to</strong>p<br />

The index array is produced using \array<br />

The above TEX comm<strong>and</strong>s may also<br />

<br />

be<br />

<br />

employed<br />

<br />

<strong>to</strong><br />

<br />

produce small<br />

1 0 a b c<br />

matrices within text formulas, such as 0 1 or l m n . Here the first<br />

matrix was typed in with<br />

${1\,0\choose0\,1}$<br />

<strong>and</strong> the second with<br />

$\left({a\a<strong>to</strong>p l}{b\a<strong>to</strong>p m}{c\a<strong>to</strong>p n}\right)$<br />

The syntax of these Plain T E X comm<strong>and</strong>s is radically different from that<br />

! normally used by L AT E X. See page 189 for a way <strong>to</strong> correct this.<br />

5.4.7 Multiline equations<br />

A multiline equation is one that is developed over several lines in which<br />

the relation symbols (for example, = or ≤) in each line are all vertically<br />

aligned with each other. For this purpose, the environments<br />

\begin{eqnarray} line 1\\ ... \\ line n end{eqnarray}<br />

\begin{eqnarray*} line 1\\ ... \\ line n end{eqnarray*}<br />

are used <strong>to</strong> set several lines of formulas or equations in displayed math<br />

mode. The individual lines of the equation or formula are separated from<br />

one another by \\. Each entry line has the form


left formula & mid formula & right formula \\<br />

5.4. Additional elements 139<br />

When printed, all the left formulas appear right justified in a left column,<br />

the right formulas left justified in a right column, <strong>and</strong> the mid formulas<br />

centered in between. The column separation character & designates<br />

the various parts of the formula. Normally the mid formula is a single<br />

math character, the relation opera<strong>to</strong>r mentioned above. The individual<br />

lines thus have the same behavior as they would in a \begin{array}<br />

{rcl}. . . \end{array} environment.<br />

The difference between the array <strong>and</strong> eqnarray environments is that in the<br />

! latter the lines are set as displayed formulas. This means that for those symbols<br />

listed in Section 5.3.7 the larger form will be selected, <strong>and</strong> that the numera<strong>to</strong>r<br />

<strong>and</strong> denomina<strong>to</strong>r of fractions will be in normal size. On the other h<strong>and</strong>, for the<br />

array environment the column entries will be set as text formulas, the smaller<br />

form of these symbols will be chosen <strong>and</strong> the parts of the fraction will appear in<br />

a smaller type size.<br />

The st<strong>and</strong>ard form of the eqnarray environment adds an au<strong>to</strong>matic<br />

sequential equation number, which is missing in the *-form. To suppress<br />

the equation number for a single line in the st<strong>and</strong>ard form, add the<br />

comm<strong>and</strong> \nonumber just before the line termination \\.<br />

The equation numbers may be referred <strong>to</strong> in the text with the comm<strong>and</strong><br />

\ref{name} once the keyword name has been assigned <strong>to</strong> the equation<br />

number with the \label{name} comm<strong>and</strong> somewhere in the line of the<br />

equation. See Section 9.2.1 for more details.<br />

Examples:<br />

(x + y)(x − y) = x 2 − xy + xy − y 2<br />

= x 2 − y 2<br />

(x + y) 2 = x 2 + 2xy + y 2<br />

\begin{eqnarray}<br />

(x+y)(x-y) & = & xˆ2-xy+xy-yˆ2 \nonumber\\<br />

& = & xˆ2 - yˆ2 \\<br />

(x+y)ˆ2 & = & xˆ2 + 2xy + yˆ2<br />

\end{eqnarray}<br />

xnu1 + · · · + xn+t−1ut = xnu1 + (axn + c)u2 + · · ·<br />

<br />

+ a t−1 xn + c(a t−2 <br />

+ · · · + 1)<br />

ut<br />

(5.4)<br />

(5.5)<br />

= (u1 + au2 + · · · + a t−1 ut)xn + h(u1, . . . , ut)<br />

\begin{eqnarray*}<br />

x_nu_1 + \cdots + x_{n+t-1}u_t & = & x_nu_1 + (ax_n + c)u_2 +<br />

\cdots\\<br />

& & + \left(aˆ{t-1}x_n + c(aˆ{t-2} + \cdots+1)\right)u_t\\<br />

& = & (u_1 + au_2 + \cdots + aˆ{t-1}u_t)x_n + h(u_1,\ldots,u_t)<br />

\end{eqnarray*}


140 Chapter 5. Mathematical Formulas<br />

The second example requires some explanation. In the second line<br />

there is a \left(. . . \right) pair for the au<strong>to</strong>matic sizing of the (). Such<br />

a pair may only appear within a single line; that is, it may not be broken<br />

by the \\ line termina<strong>to</strong>r! If au<strong>to</strong>matic bracket sizing is <strong>to</strong> occur in a<br />

multiline equation, it may only be found within a single line.<br />

If bracket pairs must appear on different lines, one can try using the<br />

construction \left(· · · \right. \\ \left.· · · \right). In the first line,<br />

the \left( is paired with the invisible bracket \right., while the second<br />

begins with the invisible \left. which is paired with the closing \right).<br />

However, this will only work satisfac<strong>to</strong>rily if both parts of the equation<br />

have roughly the same height so that the two au<strong>to</strong>matic sizings yield<br />

much the same results. Section 5.5.3 describes how <strong>to</strong> select bracket<br />

sizes manually in the event that the au<strong>to</strong>matic method fails.<br />

The + sign at the beginning of the second line also requires a remark.<br />

The signs + <strong>and</strong> − have two meanings in mathematics: between two math<br />

quantities they act as a coupling (binary opera<strong>to</strong>r), but coming before a<br />

math symbol they serve as a sign designation (positive or negative). L AT E X<br />

stresses this difference by inserting different spacing in the two cases (for<br />

example, compare +b with a + b).<br />

y = a + b + c + d<br />

+e + f + g<br />

+ h + i + j<br />

If a long formula is broken in<strong>to</strong> several lines<br />

<strong>and</strong> one of them begins with + or −, L AT E X<br />

regards it as a sign designation <strong>and</strong> moves it<br />

closer <strong>to</strong> the next character.<br />

The solution is <strong>to</strong> introduce an invisible character of zero width at the<br />

beginning of such a line. This may be the empty structure {}. Compare<br />

the effects of && +e+f+g <strong>and</strong> &&{}+h+i+j in the above equation.<br />

Since the extra spacing is always inserted between + <strong>and</strong> an opening<br />

parenthesis (, it was not necessary <strong>to</strong> give the {} at the beginning of the<br />

second line of the eqnarray* example on the previous page.<br />

Occasionally it is better <strong>to</strong> break long multiline equations as follows:<br />

that is, the second <strong>and</strong> subsequent lines are<br />

w + x + y + z =<br />

not aligned with the equals sign but are left<br />

a + b + c + d + e + f + justified with a certain indentation from the<br />

g + h + i + j + k + l beginning of the first line.<br />

\begin{eqnarray*}<br />

\lefteqn{w+x+y+z = } \\<br />

& & a+b+c+d+e+f+ \\<br />

& & g+h+i+j+k+l<br />

\end{eqnarray*}<br />

The comm<strong>and</strong> \lefteqn{w+x+y+z =} \\<br />

in the first line has the effect that the contents<br />

of the argument are indeed printed<br />

out, but that L AT E X considers them <strong>to</strong> have<br />

zero width. The left-h<strong>and</strong> column then<br />

contains only intercolumn spacing, which<br />

produces the indentation for the rest of the lines.<br />

The indentation depth may be altered by inserting \hspace{depth}<br />

between the \lefteqn{. . . } <strong>and</strong> the \\ line termination. A positive value<br />

for depth increases the indentation, a negative value decreases it.


5.4. Additional elements 141<br />

Exercise 5.17: The following equations are <strong>to</strong> be broken as shown:<br />

arcsin x = − arcsin(−x) = π<br />

<br />

− arccos x = arccos 1 − x<br />

2 2<br />

<br />

x<br />

= arctan √<br />

1 − x2 =<br />

√ <br />

1 − x2 arccot<br />

x<br />

<br />

∂f (x, y) ∂f (x, y)<br />

f (x + h, y + k) = f (x, y) +<br />

h + k<br />

∂x<br />

∂y<br />

+ 1<br />

<br />

2 ∂ f (x, y)<br />

2 ∂x2 h 2 + 2 ∂2f (x, y)<br />

∂x∂y kh + ∂2f (x, y)<br />

∂y 2<br />

k 2<br />

<br />

+ 1<br />

1<br />

{· · · } + · · · + {· · · } + Rn<br />

6 n!<br />

Note on possible error messages:<br />

Long formulas with many sets of logical brackets, especially<br />

deeply nested ones, will almost always contain errors at first. The<br />

cause is often brackets that have been incorrectly ordered or overlooked.<br />

If L AT E X produces error messages during formula processing, which<br />

the beginner is not able <strong>to</strong> interpret correctly (error messages are<br />

described in detail in Appendix C), he or she should check the bracket<br />

pairing very carefully in the formula text. Some text edi<strong>to</strong>rs can do<br />

the search for the matching bracket, which greatly simplifies the task.<br />

If the error is not found in this way, one can try pressing the return<br />

key at the error message in order <strong>to</strong> proceed with the processing. The<br />

resulting prin<strong>to</strong>ut can indicate where things may have gone wrong.<br />

(5.6)<br />

(5.7)<br />

Exercise 5.18: The eqnarray environment inserts additional spacing where the<br />

column separation character & appears. This is undesirable when an equation is<br />

<strong>to</strong> be broken <strong>and</strong> aligned on + or − within a long summation. For example:<br />

The inverse function of the polynomial expansion y = f (x) = ax + bx 2 + cx 3 +<br />

dx 4 + ex 5 + f x 6 + · · · (a = 0) begins with the elements<br />

x = ϕ(y) = 1<br />

y<br />

a<br />

−<br />

b<br />

a3 y 2 + 1<br />

a5 (2b2 − ac)y 3<br />

+<br />

1<br />

a7 (5abc − z2d − f b 3 )y 4<br />

+<br />

+<br />

1<br />

a9 (6a2bd + 3a 2 c 2 + 14b 4 − a 3 e − 21ab 2 c)y 5<br />

1<br />

a11 (7a3be + 7a 3 cd + 84ab 3 c − a 4 f −<br />

28a 2 b 2 d − 28a 2 bc 2 − 43b 5 )y 6 +· · ·<br />

Select a value for the declaration \arraycolsep (Section 4.8.2) such that the<br />

distance between the + <strong>and</strong> − <strong>and</strong> the break points are as near as possible <strong>to</strong><br />

those in the rest of the formula.


142 Chapter 5. Mathematical Formulas<br />

5.4.8 Framed or side-by-side formulas<br />

Displayed formulas or equations may be put in<strong>to</strong> vertical boxes of appropriate<br />

! width, that is, in a \parbox comm<strong>and</strong> or minipage environment. Within the vertical<br />

box, the formulas are horizontally centered or left justified with indentation<br />

\mathindent according <strong>to</strong> the selected document class option.<br />

Vertical boxes may be positioned relative <strong>to</strong> one another just like single<br />

characters (Sections 4.7.3 <strong>and</strong> 4.7.7). In this way the user may place displayed<br />

formulas or equations side by side.<br />

α = f (z) (5.8)<br />

β = f (z 2 ) (5.9)<br />

γ = f (z 3 ) (5.10)<br />

x = α 2 − β 2<br />

y = 2αβ<br />

The left-h<strong>and</strong> set of equations<br />

is set in a \parbox of width<br />

4 cm, the right-h<strong>and</strong> set in one<br />

of width 2.5 cm, while this text<br />

is inside a minipage of width<br />

4.5 cm.<br />

\parbox{4cm}{\begin{eqnarray} \alpha &=& f(z)...\end{eqnarray}}<br />

\hfill \parbox{2.5cm}{\begin{eqnarray*}<br />

x &=& \alphaˆ2 - \betaˆ2\\ y &=& 2\alpha\beta \end{eqnarray*}}<br />

\hfill \begin{minipage}{4.5cm} The left-h<strong>and</strong> ... \end{minipage}<br />

Vertical boxes can also be useful when equation numbers are placed in an<br />

! unconventional manner. The eqnarray environment generates an equation number<br />

for every line, which may be suppressed with \nonumber. To add a vertically<br />

centered equation number <strong>to</strong> a set of equations, for example,<br />

P(x) = a0 + a1x + a2x 2 + · · · + anx n<br />

P(−x) = a0 − a1x + a2x 2 − · · · + (−1) n anx n (5.11)<br />

the following text may be given:<br />

\parbox{10cm}{\begin{eqnarray*} ... \end{eqnarray*}} \hfill<br />

\parbox{1cm}{\begin{eqnarray}\end{eqnarray}}<br />

The actual set of equations is produced here in the eqnarray* environment,<br />

within a vertical box of width 10 cm, followed by an empty eqnarray environment<br />

in a box of width 1 cm that generates the equation number. Both boxes are<br />

vertically aligned along their center lines.<br />

Emphasizing formulas by framing requires no new construction elements. It<br />

! is sufficient <strong>to</strong> put them in<strong>to</strong> an \fbox (Section 4.7.7). Text formulas a + b<br />

are simply framed with \fbox{$a+b$}. For displayed formulas, \displaystyle<br />

(Section 5.5.2) must be issued, else they are set as text formulas.<br />

is produced with<br />

∞<br />

0<br />

f (x) dx ≈<br />

n<br />

wie xif (xi)<br />

\[\fbox{$\displaystyle \intˆ\infty_0 f(x)\,\mathrm{d}x ..$}\]<br />

An alternative method <strong>to</strong> frame displayed equations is with the A M S-L AT E X \boxed<br />

comm<strong>and</strong>, page 270.<br />

i=1


5.4. Additional elements 143<br />

5.4.9 Chemical formulas <strong>and</strong> bold face in math formulas<br />

In mathematics it is sometimes necessary <strong>to</strong> set individual characters or<br />

parts of the formula in bold face. This can be achieved simply with the<br />

math alphabet comm<strong>and</strong> \mathbf that we met in Section 5.4.2:<br />

$\mathbf{Sˆ{-1}TS = dg(\omega_1,\ldots,\omega_n) = \Lambda}$<br />

produces S −1 TS = dg(ω1, . . . , ωn) = Λ.<br />

In this example, the entire formula has been set as the argument of<br />

\mathbf so that everything should be set in bold face. In fact, only<br />

numbers, lower <strong>and</strong> upper case Latin letters, <strong>and</strong> upper case Greek letters<br />

are set in bold Roman with \mathbf. Lower case Greek letters <strong>and</strong> other<br />

math symbols appear in the normal math font.<br />

If only part of the formula is <strong>to</strong> be set in bold face, that part must be<br />

given as the argument of the \mathbf comm<strong>and</strong>.<br />

$\mathbf{2\sqrt{x}/y} = z$ 2 √ x/y = z<br />

The math font style comm<strong>and</strong> \boldmath will set all characters in<br />

bold face, with the following exceptions:<br />

• raised <strong>and</strong> lowered symbols (exponents <strong>and</strong> indices)<br />

• the characters + : ; ! ? ( ) [ ]<br />

• symbols that exist in two sizes (Section 5.3.7)<br />

The \boldmath declaration may not appear in math mode. It must<br />

be called before switching <strong>to</strong> math mode or within a parbox or minipage.<br />

The countercomm<strong>and</strong> \unboldmath resets the math fonts back <strong>to</strong> the<br />

normal ones.<br />

<br />

\boldmath \[ \oint\limits_C V<br />

V dτ = ∇ × V dσ \,\mathrm{d}\tau =\oint\limits_\Sigma<br />

\nabla\times V\,d\sigma \] \unboldmath<br />

C<br />

Σ<br />

If \boldmath has been turned on outside the math mode, it may be<br />

temporarily turned off inside with \mbox{\unboldmath$. . . $}.<br />

\boldmath\( P = \mbox{\unboldmath$m$}b\)\unboldmath<br />

yields: P = mb. Similarly, \boldmath can be temporarily turned on<br />

within math mode with the structure \mbox{\boldmath$. . . $}: Wr =<br />

M dϕ = r 2 mω 2 /2<br />

\( W_r = \int\mbox{\boldmath$M\,\mathrm{d}\varphi$} =..\)<br />

An alternative method of printing single symbols in bold face is provided<br />

by the bm package described on page 394.<br />

Chemical formulas are normally set in Roman type, not in italics as<br />

for mathematical formulas. This may be brought about by setting the<br />

formula as the argument of the font comm<strong>and</strong> \mathrm:<br />

$\mathrm{Fe_2ˆ{2+}Cr_2O_4}$ Fe 2+<br />

2 Cr2O4


144 Chapter 5. Mathematical Formulas<br />

5.4.10 International typesetting st<strong>and</strong>ards<br />

The International St<strong>and</strong>ards Organization (ISO) has established the recognized<br />

! conventions for typesetting mathematics, the essential elements of which are<br />

presented in an article by Beccari (1997), along with a description of how they<br />

may be realized with L AT E X. Some of these rules have already been mentioned <strong>and</strong><br />

demonstrated in the examples. Here are the major points.<br />

1. Simple variables are represented by italic letters, as a b c x y z.<br />

2. Vec<strong>to</strong>rs are written in bold face italic, as B v ω.<br />

3. Tensors of 2nd order <strong>and</strong> matrices may appear in a sans serif font, as<br />

M D I.<br />

4. The special numbers e, i, π, as well as the differential opera<strong>to</strong>r d, are <strong>to</strong> be<br />

written in an upright font <strong>to</strong> emphasize that they are not variables.<br />

5. A measurement consisting of a number plus a dimension is an indivisible<br />

unit, with a smaller than normal space between them, as 5.3 km <strong>and</strong> 62 kg.<br />

The dimension is in an upright font.<br />

Point 1 is fulfilled au<strong>to</strong>matically by L AT E X. Point 5 is easily achieved by inserting<br />

the small space \, comm<strong>and</strong> between the number <strong>and</strong> dimension, as 5.3\,km<br />

<strong>and</strong> 62\,kg. Using the protected space ˜ instead is very common practice among<br />

L AT E X users, which ensures that the two parts are not split, but with regular, not<br />

small spacing: 5.3 km <strong>and</strong> 62 kg.<br />

Point 2 is not satisfied with the \vec comm<strong>and</strong>, which produces B. Nor does<br />

\mathbf help, for this yields B, in an upright font. The best solution is <strong>to</strong> use<br />

the \boldsymbol comm<strong>and</strong> from the A M S package amsbsy (Section 12.2.1) or<br />

the \bm comm<strong>and</strong> from the <strong>to</strong>ols package bm (Section B.5.4). Otherwise one must<br />

resort <strong>to</strong> defining<br />

\renewcomm<strong>and</strong>{\vec}[1]{\mbox{\boldmath$#1$}}<br />

for a revised \vec comm<strong>and</strong>.<br />

Similarly point 3 can be met with the math alphabet comm<strong>and</strong> \mathsf.<br />

However, Beccari does point out that even tensor variables should probably be<br />

italic. This is more difficult, but it can be accomplished. See example 5 on<br />

page 191.<br />

Point 4 is the one that is most often violated, especially for the differential d.<br />

We have demonstrated it in the examples in this book <strong>and</strong> have shown how it may<br />

be achieved with the \mathrm math alphabet comm<strong>and</strong>. However, <strong>to</strong> simplify the<br />

application, it is recommended <strong>to</strong> create some user-defined comm<strong>and</strong>s, such as<br />

\newcomm<strong>and</strong>{\me}{\mathrm{e}} for math e<br />

\newcomm<strong>and</strong>{\mi}{\mathrm{i}} for math i<br />

\newcomm<strong>and</strong>{\dif}{\mathrm{d}} for differential opera<strong>to</strong>r d<br />

An upright π is not so easy since this is not provided in the usual math fonts.<br />

With these new comm<strong>and</strong>s, the equation on page 119 is more conveniently<br />

set with<br />

\[ \intˆ{\infty}_0 f(x)\,\dif x \approx<br />

\sumˆn_{i=1}w_i \meˆ{x_i} f(x_i) \]


5.5 Fine-tuning mathematics<br />

5.5.1 Horizontal spacing<br />

5.5. Fine-tuning mathematics 145<br />

Even though T E X has a thorough knowledge of the rules of mathematical<br />

typesetting, it cannot hope <strong>to</strong> underst<strong>and</strong> the mathematical meaning. For<br />

example, y dx normally means the joining of the variable y with the<br />

differential opera<strong>to</strong>r dx, <strong>and</strong> this joining is designated by a small space<br />

between the two. However, T E X removes the blank in the entry y dx <strong>and</strong><br />

prints ydx, the product of three variables y, d, <strong>and</strong> x. At this point, L AT E X<br />

needs some fine-tuning assistance. (And the d should really be upright,<br />

the \dif or \mathrm{d} of the previous section.)<br />

Small amounts of horizontal spacing can be added in math mode with<br />

the comm<strong>and</strong>s<br />

\, small space = 3/18 of a quad<br />

\: medium space = 4/18 of a quad<br />

\; large space = 5/18 of a quad<br />

\! negative space = −3/18 of a quad<br />

In the following examples, the third column contains the results without<br />

the additional horizontal spacing comm<strong>and</strong>.<br />

√ √<br />

$\sqrt{2}\,x$<br />

2 x<br />

2x<br />

<br />

$\sqrt{\,\log x}$<br />

log x<br />

log x<br />

$O\left(1/\sqrt{n}\,\right)$ O (1/ √ n ) O (1/ √ n)<br />

$[\,0,1)$ [ 0, 1) [0, 1)<br />

$log n\,(\log\log n)ˆ2$ log n (log log n) 2 log n(log log n) 2<br />

$xˆ2\!/2$ x 2 /2 x 2 /2<br />

$n/\!\log n$ n/log n n/ log n<br />

$\Gamma_{\!2}+\Deltaˆ{\!2}$ Γ2 + ∆ 2 Γ2 + ∆ 2<br />

$R_i{}ˆj{}_{\!kl}$ Ri j kl Ri j kl<br />

$\int_0ˆx\!\int_0ˆy<br />

x<br />

0<br />

y<br />

0<br />

dF(u, v)<br />

\mathrm{d}F(u,v)$<br />

<br />

\[ \int\!\!\!\int_D<br />

dx dy<br />

\mathrm{d}x\,\mathrm{d}y \]<br />

D<br />

x<br />

0<br />

y<br />

0<br />

dF(u, v)<br />

<br />

dxdy<br />

D<br />

Note: In the third last example R_i{}ˆj is so constructed that an invisible<br />

character of zero width comes after the index of Ri, <strong>and</strong> it is this dummy<br />

character that receives the following exponent. The result is Ri j , instead<br />

of R j<br />

i which is produced by R_iˆj.<br />

There are no hard <strong>and</strong> fast rules for applying the math spacing comm<strong>and</strong>s.<br />

Some c<strong>and</strong>idates are the differential opera<strong>to</strong>r, small root signs<br />

in text formulas followed by a variable, the dividing sign /, <strong>and</strong> multiple<br />

integral signs. The above examples illustrate many suitable situations.


146 Chapter 5. Mathematical Formulas<br />

5.5.2 Selecting font size in formulas<br />

It is possible <strong>to</strong> alter the font sizes that T E X selects for the various parts<br />

of the formula. First we must explain what sizes are available in math<br />

mode <strong>and</strong> what T E X’s selection rules are.<br />

In math mode there are four font sizes that may be chosen, their actual<br />

sizes being relative <strong>to</strong> the basic font size of the document class:<br />

\displaystyle D Normal size for displayed formulas<br />

\textstyle T Normal size for text formulas<br />

\scriptstyle S Normal size for first sub-, superscript<br />

\scriptscriptstyle SS Normal size for later sub-, superscripts<br />

From now on we shall make use of the symbolic abbreviations D, T , S,<br />

<strong>and</strong> SS. When math mode is switched on, the active font size becomes D<br />

for displayed <strong>and</strong> T for text formulas. Their only difference lies in those<br />

symbols that appear in two sizes, plus the corresponding style of those<br />

superscripts <strong>and</strong> subscripts (Section 5.3.7). The larger symbols belong <strong>to</strong><br />

D, the smaller <strong>to</strong> T .<br />

Starting from these base sizes, various math elements will be set in<br />

other sizes. Once another size has been chosen for an element, it remains<br />

the active size within that element.<br />

The table below shows the selection<br />

rules:<br />

Active Fractions Super-,<br />

size upper lower subscripts<br />

D T T S<br />

T S S S<br />

S SS SS SS<br />

SS SS SS SS<br />

If the active size is D, size T is selected<br />

for both parts of the fraction. That is,<br />

for both numera<strong>to</strong>r <strong>and</strong> denomina<strong>to</strong>r<br />

T becomes the active size. If they in<br />

turn contain further fractions, these<br />

will be set in S. If the active size is<br />

D or T , superscripts <strong>and</strong> subscripts<br />

(exponents <strong>and</strong> indices) appear in S;<br />

within them S is the active size <strong>and</strong><br />

any fractions or shiftings inside them<br />

will be set in SS.<br />

The T E X elements { \a<strong>to</strong>p } <strong>and</strong> { \choose } are treated as fractions.<br />

The active font size inside an array environment is T .<br />

The smallest available math font size is SS. Once it has been reached,<br />

no further reduction is possible, so that all subsequent superscripts <strong>and</strong><br />

subscripts appear in SS as well.<br />

From the table one easily sees that<br />

\[ a_0 + \frac{1}{a_1 + \frac{1}{a_2<br />

+ \frac{1}{a_3 + \frac{1}{a_4}}}} \]<br />

must appear as shown at the right.<br />

a0 +<br />

a1 +<br />

1<br />

1<br />

a2+ 1<br />

a 3 + 1<br />

a 4<br />

Such a math structure, called a continued fraction, is normally printed as


a0 +<br />

a1 +<br />

1<br />

a2 +<br />

1<br />

1<br />

a3 + 1<br />

a4<br />

5.5. Fine-tuning mathematics 147<br />

\[ a_0 + \frac{1}{\displaystyle a_1<br />

+ \frac{1}{\displaystyle a_2<br />

+ \frac{1}{\displaystyle a_3<br />

+ \frac{1}{a_4}}}} \]<br />

By explicitly giving the font size within each element, one makes that<br />

size active rather than relying on the internally selected size. In this<br />

example, D is chosen for each denomina<strong>to</strong>r. Thus the next fraction acts<br />

as though it were outermost. The \displaystyle comm<strong>and</strong> may be<br />

omitted in the last fraction. (Can you see why?)<br />

The selection table allows one <strong>to</strong> predict precisely which math font size<br />

will be applied at any part of the formula so that an explicit specification<br />

may be made if necessary. The effects of such a choice may also be<br />

calculated for the following math elements.<br />

In the examples below, the right-h<strong>and</strong> column shows how the formulas<br />

would appear if the math font size is not explicitly specified.<br />

a b<br />

+<br />

x − y x + y<br />

a − b<br />

1 +<br />

a + b<br />

⎛<br />

⎜<br />

⎝<br />

xi−xj<br />

−<br />

e ni +nj <br />

ab e + f<br />

cd<br />

0<br />

g<br />

<br />

− h<br />

<br />

<br />

ij<br />

<br />

<br />

<br />

kl<br />

<br />

\[ \frac{\displaystyle\frac{a}{x-y}<br />

+\frac{b}{x+y}}<br />

{\displaystyle 1+\frac{a-b}{a+b}} \]<br />

a b<br />

x−y + x+y<br />

1 + a−b<br />

a+b<br />

\[ eˆ{\textstyle -<br />

\frac{x_i-x_j}{nˆi+nˆj}} \] e − x i −x j<br />

n i +n j<br />

⎞<br />

⎟<br />

⎠<br />

\[ \left(\begin{array}{cc}<br />

\displaystyle{ab\choose cd} &<br />

\displaystyle\frac{e+f}{g-h}\\<br />

0 & \displaystyle \left|<br />

{ij\a<strong>to</strong>p kl} \right|<br />

\end{array}\right) \]<br />

⎛<br />

⎝<br />

<br />

ab<br />

cd<br />

0<br />

e+f<br />

g−h<br />

<br />

ij<br />

kl<br />

⎞<br />

⎠<br />

<br />

<br />

If an explicit size specification is <strong>to</strong> be given frequently within a document—say<br />

within every entry in an array environment—then considerable<br />

writing effort may be avoided by adding <strong>to</strong> the preamble<br />

\newcomm<strong>and</strong>{\D}{\displaystyle}\newcomm<strong>and</strong>{\T}{\textstyle}...<br />

In this way the size comm<strong>and</strong> may be given simply by typing \D or \T,<br />

etc.<br />

The math font size selection rules given above are in fact a simplification. For<br />

! those readers who wish <strong>to</strong> know the exact details, we now present the complete<br />

description.


148 Chapter 5. Mathematical Formulas<br />

For each of the four math font sizes D,<br />

T, S, SS there is a modified version D ′ ,<br />

T ′ , S ′ , SS ′ . The difference is that with<br />

D, T, S, SS the superscripts (exponents)<br />

are somewhat higher than they are with<br />

D ′ , T ′ , S ′ , SS ′ . Compare the positions<br />

of the exponent 2 above <strong>and</strong> below the<br />

Active Fractions Super- Subsize<br />

upper lower scripts scripts<br />

D T T ′ S S ′<br />

D ′ T ′ T ′ S ′ S ′<br />

T S S ′ S S ′<br />

T ′ S ′ S ′ S ′ S ′<br />

S, SS SS SS ′ SS SS ′<br />

S ′ , SS ′ SS ′ SS ′ SS ′ SS ′<br />

line: x2<br />

. Otherwise the primed <strong>and</strong><br />

x2 unprimed font sizes are identical. The<br />

true selection rules are given in the table<br />

at the right.<br />

When the font size is explicitly stated within a numera<strong>to</strong>r or superscript,<br />

the unprimed version is selected; <strong>and</strong> in the denomina<strong>to</strong>rs <strong>and</strong> subscripts, the<br />

primed fonts.<br />

5.5.3 Manual sizing of bracket symbols<br />

The \left. . . \right comm<strong>and</strong>s preceding one of the 22 bracket symbols<br />

listed in Section 5.4.1 adjust the symbol size au<strong>to</strong>matically according <strong>to</strong><br />

the height of the enclosed formula text. However, it is possible <strong>to</strong> select<br />

a size explicitly by placing one of the T E X comm<strong>and</strong>s \big, \Big, \bigg,<br />

or \Bigg before the bracket symbol.<br />

none<br />

\big<br />

( ) [ ]{ } ⌊ ⌋ ⌈ ⌉ 〈 〉 / \ | ↑ ⇑ ↓ ⇓ ↕ ⇕<br />

⏐ <br />

⏐ <br />

\Big<br />

⏐ <br />

⏐ ⏐ ⏐ <br />

⏐ <br />

\bigg<br />

\Bigg<br />

⏐ <br />

⏐ ⏐ ⏐ <br />

⏐ ⏐ ⏐ <br />

⏐ <br />

⏐ <br />

⏐ ⏐ ⏐ <br />

⏐ ⏐ ⏐ <br />

⏐ ⏐ ⏐ <br />

⏐ <br />

In contrast <strong>to</strong> the \left. . . \right pairs, the explicit bracket size<br />

comm<strong>and</strong>s do not have <strong>to</strong> be contained within one line of a multiline<br />

formula. The opening <strong>and</strong> closing brackets may appear on different lines.<br />

This applies also <strong>to</strong> the comm<strong>and</strong>s described in the next paragraph.<br />

5.5.4 Math style parameters<br />

The mathematical style parameters listed below are set <strong>to</strong> st<strong>and</strong>ard values by<br />

! L AT E X. The user may alter them at any time with the \setlength comm<strong>and</strong> in the<br />

usual manner.


5.5. Fine-tuning mathematics 149<br />

\arraycolsep<br />

Half the width of the intercolumn spacing for the array environment<br />

(see also Section 4.8.2).<br />

\jot Extra vertical spacing that appears between the rows of multiline equations<br />

in the eqnarray <strong>and</strong> eqnarray* environments.<br />

\mathindent<br />

The amount of indentation for math formulas when the document class<br />

option fleqn has been selected.<br />

\abovedisplayskip<br />

The vertical spacing above displayed formulas when the left side of the<br />

formula is closer <strong>to</strong> the left margin than the end of the preceding line<br />

of text. Such a formula is designated long.<br />

\belowdisplayskip<br />

The vertical spacing inserted below a long displayed formula.<br />

\abovedisplayshortskip<br />

Vertical spacing added above a short displayed formula. This is one in<br />

which the left edge is <strong>to</strong> the right of the end of the preceding line of<br />

text.<br />

\belowdisplayshortskip<br />

Vertical spacing inserted after a short displayed formula.<br />

\<strong>to</strong>psep<br />

The above four spacings are not used with the document class option<br />

fleqn where instead \<strong>to</strong>psep is inserted above <strong>and</strong> below displayed<br />

formulas (see Section 4.4.2).<br />

All the above parameters, except \jot, should be rubber lengths (Section 2.4.2).<br />

5.5.5 Some further advice<br />

Sometimes authors desire horizontal <strong>and</strong> vertical alignments of their<br />

formulas that just cannot be achieved using the means described so far.<br />

They should consider placing their formulas inside horizontal or vertical<br />

boxes which may then be positioned wherever they please.<br />

Similarly the array environment <strong>to</strong>gether with explicit size declarations<br />

<strong>and</strong> the table construction <strong>and</strong> style elements from Sections 4.8.1<br />

<strong>and</strong> 4.8.2 should be able <strong>to</strong> accomplish just about any horizontal <strong>and</strong><br />

vertical alignment.<br />

Exercise 5.19: Generate this continued fraction.<br />

Note: in contrast <strong>to</strong> the example on page 146, the<br />

1 here in the numera<strong>to</strong>r appears left justified.<br />

Hint: do you remember the comm<strong>and</strong> \hfill?<br />

a0 + 1<br />

a1 + 1<br />

a2 + 1<br />

a3 + 1<br />

Exercise 5.20: Produce the following set of equations with the array environment.<br />

sin 2α = 2 sin α cos α, cos 2α = cos 2 α − sin 2 α<br />

sin 3α = 3 sin α − 4 sin 3 α cos 3α = 3 cos 3 α − 3 cos α<br />

sin 4α = 8 cos 3 α sin α − 4 cos α sin α cos 4α = 8 cos 4 α − 8 cos 2 α + 1<br />

a4


150 Chapter 5. Mathematical Formulas<br />

Hint: recall that @{...} expressions in the formatting field of the array environment<br />

can be used <strong>to</strong> insert horizontal spacing <strong>and</strong>/or mathematical text between<br />

the columns (see the first example in Section 5.4.3).<br />

Exercise 5.21: Create the following output with the array environment.<br />

Equations for the tangential plane <strong>and</strong> surface normal<br />

Equation<br />

for the Tangential plane Surface normal<br />

surface<br />

F(x, y, z) = 0<br />

∂F<br />

∂F<br />

(X − x) + (Y − y)<br />

∂x ∂y<br />

+ ∂F<br />

(Z − z) = 0<br />

∂z<br />

z = f (x, y) Z − z = p(X − x) + q(Y − y)<br />

x = x(u, v)<br />

y = y(u, v)<br />

z = z(u, v)<br />

r = r(u, v)<br />

X − x Y − y Z − z<br />

∂x<br />

∂u<br />

∂x<br />

∂v<br />

∂y<br />

∂u<br />

∂y<br />

∂v<br />

∂z<br />

∂u<br />

∂z<br />

∂v<br />

(R − r)(r1 × r2) = 0<br />

or (R − r)N = 0<br />

= 0<br />

X − x<br />

∂F<br />

∂x<br />

= Y − y<br />

∂F<br />

∂y<br />

= Z − z<br />

∂F<br />

∂z<br />

X − x Y − y<br />

=<br />

p q<br />

Z − z<br />

=<br />

−1<br />

<br />

<br />

<br />

<br />

<br />

<br />

X − x<br />

∂y ∂z<br />

∂u ∂u<br />

<br />

<br />

=<br />

<br />

<br />

<br />

<br />

Y − y<br />

<br />

<br />

<br />

<br />

<br />

<br />

∂z ∂x<br />

∂u ∂u<br />

<br />

<br />

<br />

<br />

<br />

<br />

∂y<br />

∂v<br />

∂z<br />

∂v<br />

∂z<br />

∂v<br />

∂x<br />

∂v<br />

= Z − z<br />

<br />

∂x ∂y <br />

<br />

∂u ∂u <br />

<br />

<br />

<br />

∂x<br />

∂v<br />

∂y<br />

∂v<br />

R = r + λ(r1 × r2)<br />

or R = r + λN<br />

In this Table x, y, z <strong>and</strong> r are the coordinates <strong>and</strong> the radius vec<strong>to</strong>r of a fixed<br />

point M on the curve; X, Y , Z <strong>and</strong> R are the coordinates <strong>and</strong> radius vec<strong>to</strong>r<br />

of a point on the tangential plane or surface normal with reference <strong>to</strong> M;<br />

furthermore p = ∂z<br />

∂x<br />

, q = ∂z<br />

∂y <strong>and</strong> r1 = ∂r/∂u, r2 = ∂r/∂v.<br />

Note: If you succeed in reproducing this mathematical table you should have no<br />

more problems with positioning formulas <strong>and</strong> their parts!<br />

Hints for the solution:<br />

1. Define abbreviations such as \D for \displaystyle <strong>and</strong> \bm for \boldmath<br />

<strong>and</strong> possibly even \ba <strong>and</strong> \ea for \begin{array} <strong>and</strong> \end{array}.<br />

2. Build the table in stages. Start with the head <strong>and</strong> only proceed further<br />

when it looks reasonable. Watch out that normal text within the array<br />

environment must be included inside an \mbox.<br />

3. Continue with the first mathematical row. Here the first entry in the second<br />

column is also an array environment that is aligned with the rest of the<br />

row by means of the [t] positioning argument. Do not forget <strong>to</strong> activate<br />

the size \D at the necessary places in the inner structures. Insert a possible<br />

strut (Section 4.7.6) <strong>to</strong> generate the right distance from the head. The<br />

distance <strong>to</strong> the next row can be adjusted with a length specification added<br />

<strong>to</strong> the row terminating comm<strong>and</strong> \\[..].


5.6. Beyond st<strong>and</strong>ard L AT E X 151<br />

4. After this row has been completed successfully, the next should pose no<br />

difficulties.<br />

5. In the third mathematical row, both the first column <strong>and</strong> the left side of the<br />

second column consist of array environments. The third column contains<br />

three fractions whose denomina<strong>to</strong>rs may be produced either with array<br />

or with the T E X {...\a<strong>to</strong>p...} comm<strong>and</strong>; the fractions themselves are<br />

placed in two rows with another array environment.<br />

6. The second <strong>and</strong> third columns of the last mathematical row again contain<br />

array environments. Some of the sub-formulas in this row appear in<br />

\boldmath. Recall that this comm<strong>and</strong> may only be invoked within text<br />

mode, that is, within an \mbox.<br />

7. In the last row, all three columns of the outer array environment are<br />

merged <strong>to</strong>gether <strong>and</strong> the text is set within a parbox of appropriate width:<br />

\multicolumn{3}{|c|}{\parbox{..}{......}}<br />

5.6 Beyond st<strong>and</strong>ard L AT E X<br />

The typesetting elements presented in this chapter should be able <strong>to</strong><br />

h<strong>and</strong>le many of the everyday problems of mathematical composition. The<br />

American Mathematical Society, A M S, which has supported T E X from its<br />

beginning, has developed a set of packages <strong>to</strong> assist authors in composing<br />

even more complicated formulas with L AT E X. Known as A M S-L AT E X, it<br />

includes many extra comm<strong>and</strong>s, further environments <strong>to</strong> supplement<br />

eqnarray, <strong>and</strong> many additional symbols. This system is presented in<br />

Chapter 12.<br />

In any event, typesetting mathematics is a very complicated issue. It<br />

was for this reason that Donald Knuth selected the $ sign as the switch <strong>to</strong><br />

math mode: in the old days of movable lead type, setting mathematical<br />

formulas was an expensive business because of the extra workload it<br />

entailed. Even <strong>to</strong>day, electronic typesetting is far more involved for math<br />

than for simple text.


6<br />

Graphics Inclusion <strong>and</strong><br />

Color<br />

The two <strong>to</strong>pics of this chapter have one thing in common: neither is<br />

h<strong>and</strong>led by T E X at all, <strong>and</strong> thus neither by L AT E X. Outputting graphics<br />

files produced by other programs, or printing in color, are functions of<br />

the output device, that is, the printer, the moni<strong>to</strong>r, the electronic output<br />

file, <strong>and</strong> these are controlled by the DVI driver program that converts the<br />

DVI output of L AT E X in<strong>to</strong> the final output form. For each output type, a<br />

different set of comm<strong>and</strong>s is needed <strong>to</strong> switch color or <strong>to</strong> send an image.<br />

What T E X does have is a way of sending special driver-specific comm<strong>and</strong>s<br />

<strong>to</strong> the driver by placing them in the.dvi file; the comm<strong>and</strong> <strong>to</strong> do<br />

this is even named \special. L AT E X exploits this feature <strong>to</strong> pass driver<br />

comm<strong>and</strong>s <strong>to</strong> the.dvi file, but <strong>to</strong> do so, it needs <strong>to</strong> know which driver is<br />

going <strong>to</strong> be used for the further processing.<br />

With the advent of L AT E X 2ε, a st<strong>and</strong>ardized syntax was introduced,<br />

replacing the driver-specific comm<strong>and</strong>s that abounded with L AT E X 2.09<br />

<strong>and</strong> which caused much confusion. At last the importation of external<br />

images had become a basic part of L AT E X usage, <strong>and</strong> was no longer an<br />

exotic, magical art. Well . . . , nearly.<br />

It is still necessary <strong>to</strong> tell L AT E X which driver will be used afterwards,<br />

as an option <strong>to</strong> the graphics <strong>and</strong> color packages, but once that is done,<br />

all the driver-specific special comm<strong>and</strong>s are loaded from a corresponding<br />

.def files, which the user does not have <strong>to</strong> worry about. The <strong>to</strong>p-level<br />

syntax remains the same for all types.<br />

It is also important <strong>to</strong> realize that not all image formats can be h<strong>and</strong>led<br />

by every driver. PostScript drivers for example will only accept PostScript<br />

images, <strong>and</strong> then only as encapsulated PostScript. Image format conversion<br />

may be required.<br />

6.1 The graphics packages<br />

Strictly speaking, these packages, referred <strong>to</strong> as the graphics collection,<br />

are extensions <strong>to</strong> the basic L AT E X installation. We describe them here<br />

153


154 Chapter 6. Graphics Inclusion <strong>and</strong> Color<br />

because of their indispensability in producing professional documents<br />

<strong>and</strong> camera-ready copy. Provided by Sebastian Rahtz <strong>and</strong> David Carlisle<br />

<strong>and</strong> many other contribu<strong>to</strong>rs, they can be expected <strong>to</strong> be part of every L AT E X<br />

installation. A basic manual is provided in a file named grfguide.tex,<br />

which may already be preprocessed <strong>to</strong>.dvi or some other form. Even more<br />

details on these packages <strong>and</strong> on advanced applications of PostScript <strong>to</strong><br />

L AT E X are <strong>to</strong> be found in the book The L AT E X Graphics Companion (Goossens<br />

et al., 1997).<br />

The comm<strong>and</strong>s defined by these packages are the building blocks<br />

for other packages that either emulate the older driver-specific ones or<br />

provide a more comfortable syntax for these functions. As long as these<br />

other packages are based on graphics <strong>and</strong> color, they should be equally<br />

compatible with all the supported drivers.<br />

These features are not limited <strong>to</strong> PostScript drivers. As long as a<br />

driver can support the inclusion <strong>and</strong> manipulation (scaling, rotation) of<br />

graphics, <strong>and</strong>/or the use of color, a.def file can be written <strong>to</strong> enable it <strong>to</strong><br />

make use of the st<strong>and</strong>ardized graphics <strong>and</strong> color comm<strong>and</strong>s.<br />

Driver names that may be used as options are<br />

dvipdf<br />

dvipdfm<br />

dvips<br />

dvipsone<br />

dviwin ◭⊲⇑<br />

emtex ◭⊲⇑<br />

oztex<br />

pctex32<br />

pctexhp ◭⊲⇑<br />

pctexps<br />

pctexwin ◭⊲⇑<br />

pdftex<br />

tcidvi ⇑<br />

textures<br />

truetex ⇑<br />

vtex<br />

(Limited functionality: ◭⊲ no color support; no scaling; ⇑ no rotation.)<br />

The xdvi previewer (<strong>and</strong> its Windows equivalent windvi) work with<br />

PostScript graphics; although there is also an xdvi option, it is only an<br />

alias for dvips.<br />

A driver option must be specified when loading the graphics <strong>and</strong><br />

color packages, for example, as<br />

\usepackage[dvips]{graphics,color}<br />

However, it is possible <strong>to</strong> establish a default for the local configuration,<br />

as described in Section 6.1.7. It is conceivable that your installation has<br />

already done this, so it is worth doing an experiment <strong>to</strong> see if a default<br />

driver option already exists.<br />

6.1.1 Importing external graphics<br />

We wish <strong>to</strong> have a graphics file produced by some other program included<br />

in the document, possibly scaled <strong>to</strong> a desired size or rotated by 90 ◦ . One<br />

wants <strong>to</strong> do by computer what used <strong>to</strong> be done with scissors <strong>and</strong> glue.<br />

There are two packages available for importing <strong>and</strong> manipulating external<br />

graphics files: the basic graphics package <strong>and</strong> the more extended<br />

graphicx one. They both offer identical functionality, differing only in<br />

their syntax.


6.1. The graphics packages 155<br />

In addition <strong>to</strong> the driver names, there are some other options that may<br />

be invoked when the packages graphics or graphicx are loaded:<br />

draft does not import but places a framed box where the graphic<br />

would appear, with the file name printed inside; this speeds up<br />

the processing considerably when one is only working on the<br />

text;<br />

final counteracts draft; needed when the draft option has been<br />

issued globally in \documentclass;<br />

hidescale<br />

leaves blank space where scaled text should be;<br />

hiderotate<br />

leaves blank space where rotated text should be; this <strong>and</strong> the option<br />

hidescale are useful if the previewer cannot h<strong>and</strong>le scaling<br />

or rotation;<br />

hiresbb<br />

look for bounding box values in %%HiResBoundingBox instead<br />

of the normal %%BoundingBox line.<br />

6.1.2 Importing with the graphics package<br />

Package:<br />

graphics<br />

The basic importing comm<strong>and</strong> with the graphics package is<br />

\includegraphics[llx,lly][urx,ury]{file name}<br />

where llx, lly are the coordinates of the lower left corner, <strong>and</strong> urx, ury<br />

those of the upper right corner of the bounding box containing the part<br />

of the picture that is <strong>to</strong> be included. In other words, they say where the<br />

scissors are <strong>to</strong> be applied. Units may be specified (like [3cm, 2in]) but<br />

if they are omitted, big points (bp, 72 per inch, 28.3464. . . per cm) are<br />

assumed. If only one optional argument is given, it is the upper right<br />

corner, <strong>and</strong> the lower left is assumed <strong>to</strong> be [0,0].<br />

If no bounding box coordinates are given, the driver<br />

XII<br />

will obtain them some other way, depending on the<br />

IX III<br />

type of graphics file. For example, for the very com-<br />

VI<br />

mon encapsulated PostScript files with extension .eps,<br />

the bounding box information is extracted from the<br />

graphics file itself. The figure at the right is s<strong>to</strong>red in such a file <strong>and</strong> is<br />

included simply with the comm<strong>and</strong><br />

\includegraphics{clock}<br />

(It is not necessary, nor recommended, <strong>to</strong> include the file extension.eps<br />

in the file name designation; L AT E X will au<strong>to</strong>matically test for all the extensions<br />

allowed by the selected driver option, something that permits<br />

greater flexibility in the source text.)


156 Chapter 6. Graphics Inclusion <strong>and</strong> Color<br />

With \includegraphics*, the figure is clipped, so that any drawing<br />

outside the specified bounding box is suppressed. This is useful if only<br />

part of a figure is <strong>to</strong> be reproduced. It is also vital with some perverse<br />

figures that paint the whole page white!<br />

Scaling<br />

The graphics file in the above comm<strong>and</strong>s is transferred <strong>to</strong> the document in<br />

its original size. In order <strong>to</strong> rescale it, there are two comm<strong>and</strong>s available:<br />

\scalebox{h scale}[v scale]{text}<br />

which applies horizontal <strong>and</strong> vertical scale fac<strong>to</strong>rs <strong>to</strong> the contents text; if<br />

v scale is omitted, it is the same as h scale;<br />

\resizebox{h length}{v length}{text}<br />

adjusts the figure <strong>to</strong> fit in<strong>to</strong> the specified horizontal <strong>and</strong> vertical sizes; if<br />

either length is given as !, the one scale fac<strong>to</strong>r is used for both dimensions.<br />

A *-form allows v length <strong>to</strong> refer <strong>to</strong> the height + depth of the box, rather<br />

than just <strong>to</strong> the height. In both cases, the contents text may be an<br />

\includegraphics comm<strong>and</strong>, but it may also be any arbitrary text.<br />

Reflection<br />

The contents of a box may be reflected horizontally with<br />

Rotation<br />

\reflectbox{text}<br />

Rotation of a box about the left-h<strong>and</strong> end of its baseline is done with<br />

\rotatebox{angle}{text}<br />

where angle is in degrees, <strong>and</strong> the rotation is counterclockwise.<br />

IX<br />

XII<br />

figure <strong>to</strong> a height of 2 cm <strong>and</strong> then rotated it by 30◦ ,<br />

using the comm<strong>and</strong>s<br />

To illustrate this, we have scaled the previous clock<br />

III<br />

VI<br />

\rotatebox{30}{\resizebox{!}{2cm}{%<br />

\includegraphics{clock}}}<br />

For demonstration purposes, we have added framed boxes around the<br />

figure before <strong>and</strong> after the rotation. It is the inner (tilted) box that is<br />

2 cm high, while the overall outer box is somewhat higher <strong>and</strong> broader<br />

due <strong>to</strong> its inclined contents. Without these frames the figure seems <strong>to</strong><br />

have extraneous space above <strong>and</strong> <strong>to</strong> the left, something that can be very


6.1. The graphics packages 157<br />

puzzling even <strong>to</strong> experienced users. (The frames would not normally<br />

appear with the above comm<strong>and</strong>s.)<br />

Exercise 6.1: Copy the lines<br />

at the right <strong>to</strong> a file named<br />

demo.eps <strong>and</strong> then include it<br />

in a L AT E X document, with some<br />

normal text above <strong>and</strong> below it.<br />

The result should appear as:<br />

%!PS-Adobe-3.0 EPSF-3.0<br />

%%BoundingBox: 169 158 233 242<br />

220 200 move<strong>to</strong><br />

200 200 20 0 360 arc<br />

170 170 move<strong>to</strong><br />

230 220 line<strong>to</strong><br />

170 210 line<strong>to</strong><br />

225 160 line<strong>to</strong><br />

205 240 line<strong>to</strong><br />

170 170 line<strong>to</strong><br />

stroke<br />

showpage<br />

Note: This file can be copied from the enclosed CD in the direc<strong>to</strong>ry<br />

\books\Kopka_<strong>and</strong>_Daly\, where it is also available in PDF format.<br />

6.1.3 Importing, scaling, rotating with the graphicx package<br />

Package: If one selects the graphicx rather than the graphics package, a different<br />

graphicx interface is available for both importing <strong>and</strong> rotation, one making use of<br />

keys <strong>and</strong> values:<br />

\includegraphics[key=value,. . . ]{file name}<br />

The keys are of two types: those that take a numerical value, <strong>and</strong> those<br />

that are flags with the values true or false. Simply giving the name of a<br />

flag without a value is equivalent <strong>to</strong> setting it <strong>to</strong> true. Possible keys <strong>and</strong><br />

their values are:<br />

scale= number; enters the number by which the figure size should be<br />

magnified over its natural size;<br />

width= length; specifies the width <strong>to</strong> which the figure should be scaled;<br />

if height not given, it is scaled with the same fac<strong>to</strong>r as the width;<br />

height= length; specifies the height <strong>to</strong> which the figure should be scaled;<br />

if width is not given, it is scaled with the same fac<strong>to</strong>r as the height;<br />

<strong>to</strong>talheight= length; like height but specifies the height plus depth of<br />

the figure; should always be used in place of height if the figure<br />

has been rotated;<br />

keepaspectratio (=true|false); if both height <strong>and</strong> width are specified,<br />

this flag ensures that the original height/width ratio remains<br />

unchanged; the figure will not exceed either of the given dimensions;


158 Chapter 6. Graphics Inclusion <strong>and</strong> Color<br />

angle= number; the angle by which the figure is <strong>to</strong> be rotated counterclockwise,<br />

in degrees; any height or width specifications coming<br />

before this key are also rotated, so that the height becomes the<br />

width, while the width becomes either the height (positive angle) or<br />

depth (negative angle);<br />

origin= loc; determines the point about which the rotation occurs; default<br />

is bl for bot<strong>to</strong>m left corner; also possible are c for center, t for<br />

<strong>to</strong>p, r for right, <strong>and</strong> B for baseline; any sensible combination, such<br />

as tr, is allowed;<br />

draft (=true|false); like the draft package option but applied <strong>to</strong> the<br />

one graphics file; the figure is not imported, but rather a framed box<br />

of the correct size is printed containing the name of the file;<br />

clip (=true|false); suppresses the printing of any graphic outside the<br />

bounding box;<br />

bb= llx lly urx ury; enters the coordinates of the bounding box manually, if<br />

they are missing or incorrect in the graphics file, or <strong>to</strong> be deliberately<br />

altered; the specifications are four lengths separated by blanks; units<br />

may be given, but if omitted, big points (bp) are assumed; this option<br />

should never be used with pdfT E X;<br />

viewport= llx lly urx ury; specifies the bounding box but relative <strong>to</strong> the<br />

lower left corner of the existing one; this is the preferred method for<br />

correcting the bounding box, or (with clip) <strong>to</strong> select only a portion<br />

of the whole figure; with pdfT E X, this option must be used rather<br />

than bb;<br />

trim= dllx dlly durx dury; reduces the existing bounding box by the<br />

amounts specified;<br />

hiresbb (=true|false); like the hiresbb package option but applied<br />

<strong>to</strong> the one graphics file; reads bounding box information from the<br />

%%HiResBoundingBox line in the graphics file.<br />

The keys are all optional; they are included as needed. Their order is<br />

not important other than that angle interchanges any previous height<br />

<strong>and</strong> width meanings. The sets of key/values are separated from each<br />

other by commas. It is often best <strong>to</strong> set width relative <strong>to</strong> the current line<br />

width \linewidth, say as width=0.8\linewidth.<br />

With the key/value syntax, the tilted, scaled graphic on page 156 is<br />

produced with<br />

\includegraphics[height=2cm,angle=30]{clock}


6.1. The graphics packages 159<br />

For compatibility with the graphics package, there also exists an<br />

\includegraphics* version that clips the imported figure; this is equivalent<br />

<strong>to</strong> including the key clip.<br />

With the graphicx package, the \rotatebox comm<strong>and</strong> is similarly<br />

redefined <strong>to</strong> accept the optional key origin.<br />

Exercise 6.2: Include the graphics file demo.eps from Exercise 6.1 scaled by a<br />

fac<strong>to</strong>r of 2 <strong>and</strong> rotated by 45 ◦ using the \includegraphics comm<strong>and</strong> with the<br />

graphicx package. Experiment with various keys, in particular with height <strong>and</strong><br />

width <strong>to</strong>gether.<br />

6.1.4 Additional graphics packages<br />

Package: Sebastian Rahtz has provided a package epsfig that not only updates the<br />

epsfig earlier (LAT EX 2.09) version, but also re-implements Rokicki’s epsf package<br />

by means of the graphics comm<strong>and</strong>s. This is helpful for users who are<br />

accus<strong>to</strong>med <strong>to</strong> those syntaxes. For epsf, this is<br />

\epsfysize=y size or \epsfxsize=x size<br />

\epsf[llx lly urx ury]{file name}<br />

The epsfig package also defines an importing comm<strong>and</strong> that makes<br />

use of the regular keys <strong>and</strong> values <strong>to</strong> enter its parameters:<br />

\epsfig{file=file name,key=value,. . . }<br />

For compatibility with some older versions, there is a \psfig comm<strong>and</strong><br />

which is synonymous with the above.<br />

The epsfig package is included in the bundle of graphics packages<br />

<strong>and</strong> drivers.<br />

Package: Another extra package in the graphics bundle is lscape, by David<br />

lscape Carlisle. This defines a l<strong>and</strong>scape environment that prints its contents<br />

rotated 90◦ on a page for itself. Head <strong>and</strong> footlines remain as normal.<br />

This is intended primarily for inserting figures that are in l<strong>and</strong>scape mode,<br />

that is, wider than they are high.<br />

Package: The rotating package by Sebastian Rahtz <strong>and</strong> Leonor Barroca tries<br />

rotating <strong>to</strong> make the interface for rotation somewhat simpler. It defines<br />

\begin{sideways} text \end{sideways}<br />

\begin{turn}{angle} text \end{turn}<br />

\begin{rotate}{angle} text \end{rotate}<br />

\turnbox{angle}{text}<br />

where sideways rotates text by 90 ◦ , turn by an arbitrary angle. The<br />

environment rotate <strong>and</strong> comm<strong>and</strong> turnbox are equivalent: they rotate<br />

but in a box of zero size, so that the contents overlap the surroundings.<br />

This package is not part of the graphics bundle <strong>and</strong> must be obtained<br />

separately.


160 Chapter 6. Graphics Inclusion <strong>and</strong> Color<br />

6.1.5 Superimposing images<br />

❛ ❛<br />

❍<br />

❛<br />

❍<br />

❛ ❛<br />

❍<br />

❛<br />

❍<br />

❛<br />

❍<br />

❛<br />

❍<br />

❛ ❛<br />

❍<br />

❛<br />

❍<br />

❛<br />

❍<br />

❛ ❛<br />

❍<br />

❛ ❍<br />

❛ ❍<br />

❛ ❍<br />

❛ ❛<br />

❍<br />

❛ ❍<br />

❛ ❍<br />

❛ ❛<br />

❍<br />

❍<br />

❤❤❤❤<br />

❵<br />

❤<br />

❵<br />

❤<br />

❵<br />

❤❤<br />

❵<br />

❤<br />

❵<br />

❤<br />

❵<br />

❤❤<br />

❵<br />

❤<br />

❵<br />

❤ ❵<br />

❤ ❵<br />

❤❤<br />

❵<br />

❤<br />

❵<br />

❤ ❵<br />

❤❤<br />

❵<br />

❤<br />

❵<br />

❤ ❵ ❵ ❵<br />

✄<br />

✄<br />

✄✄✄✄✗<br />

Blow-Up<br />

Figure 6.1: An embellished image file<br />

Sometimes it is desired <strong>to</strong> superimpose one image file over part of another,<br />

! say <strong>to</strong> add an inset in a corner. Or one may want <strong>to</strong> add text elements, or even<br />

lines <strong>and</strong> arrows pointing <strong>to</strong> some feature in the image. One might even want<br />

<strong>to</strong> make some area of the image in<strong>to</strong> a link <strong>to</strong> another document. The picture<br />

environment described in Section 13.1 can be used <strong>to</strong> allow exact placement of<br />

such objects.<br />

For example, in the figure on this page, we embellish the T E XLive welcome<br />

image from Figure B.1 on page 383 by adding a blow-up of a small section,<br />

pointing a labeled arrow <strong>to</strong> it, <strong>and</strong> making the area around the text ‘T E XLive!’ in<strong>to</strong><br />

a link. We do this with the following input:<br />

\setlength{\unitlength}{0.01\linewidth}<br />

\setlength{\fboxsep}{0pt}<br />

\setlength{\fboxrule}{1.5pt}<br />

\begin{picture}(80,80)<br />

\thicklines<br />

\put(0,0){\includegraphics[width=.8\linewidth]{texlive}}<br />

\put(57,26){\framebox(14.2,14.6){}}<br />

\drawline(57,26)(-10,36.7)


6.1. The graphics packages 161<br />

\drawline(71.2,26)(20.5,36.7)<br />

\drawline(71.2,40.6)(20.5,67.2)<br />

\drawline(57,40.6)(-10,67.2)<br />

\put(-10,37){\fbox{\includegraphics[width=.3\linewidth,<br />

viewport=390 180 490 280,clip]{texlive}}}<br />

\put(-9,19){\vec<strong>to</strong>r(1,4){4}}<br />

\put(-9,18){\makebox(0,0)[t]{\large Blow-Up}}<br />

\put(43,2){\hyperlink{info}{\makebox(30,7){}}}<br />

\end{picture}<br />

Here the unit length for the picture placement has been set <strong>to</strong> 1/100 of the<br />

current line width \linewidth, so we can conveniently use 100 units for the full<br />

width. The picture environment reserves a space of 80×80 units; the image<br />

file texlive is placed at the lower left corner (location 0,0) <strong>and</strong> set <strong>to</strong> a width<br />

of 80% of \linewidth. We then draw a framed box around a portion of this<br />

image, <strong>and</strong> then add that portion as a second image (selected with viewport<br />

<strong>and</strong> clipped) as a blow-up. The \drawline comm<strong>and</strong>s (from the epic package)<br />

join the corners of the original <strong>and</strong> blown-up areas. The order here is important<br />

since later images overwrite the earlier ones. Then we add an arrow (\vec<strong>to</strong>r)<br />

<strong>and</strong> the text ‘Blow-up’ (with \makebox). Finally, the \hyperlink comm<strong>and</strong> from<br />

the hyperref package turns the 30×7 unit area around the text ‘T E XLive!’ in<strong>to</strong> a<br />

active link <strong>to</strong> the target named info.<br />

One can also place objects outside of the reserved picture area, so arrows<br />

could be added pointing from the main text <strong>to</strong> some part of an image. This is<br />

more appropriate for the production of slides (Chapter 15) where one wants rigid<br />

control over the relative locations of graphics <strong>and</strong> text.<br />

6.1.6 How importation can go wrong<br />

In order <strong>to</strong> underst<strong>and</strong> better what can go wrong when a graphics file is imported,<br />

! <strong>and</strong> <strong>to</strong> know what <strong>to</strong> do about it, it is important <strong>to</strong> realize how the interplay<br />

between L AT E X <strong>and</strong> the driver program functions.<br />

L AT E X has no idea what is in the graphics file; for it, the figure is simply a box<br />

of a given height, width, <strong>and</strong> depth, as indeed are all the characters that L AT E X<br />

processes. The information on the graphic’s natural size is somehow obtained,<br />

either by information in the graphics file itself, or through the optional entries<br />

in the \includegraphics comm<strong>and</strong> or equivalent. After scaling <strong>and</strong> rotating,<br />

L AT E X knows the final size that it must reserve in the output text for the figure.<br />

What is then written <strong>to</strong> the .dvi file is the name of the graphics file <strong>and</strong><br />

information on how it should be transformed. Just how this information is<br />

coded depends on the graphics driver selected. When the printer driver program<br />

processes the .dvi file, it interprets these special instructions, reads in the<br />

specified graphics file, performs the transformations, <strong>and</strong> places the result where<br />

L AT E X has said it should go. The end result is that the area inside the designated<br />

bounding box coincides with the box that L AT E X has reserved for it. If the bounding<br />

box information is incorrect, the figure is obviously going <strong>to</strong> be misplaced.


162 Chapter 6. Graphics Inclusion <strong>and</strong> Color<br />

PostScript output<br />

Graphics inclusion was originally developed for PostScript graphics adhering <strong>to</strong><br />

the encapsulated specification that was designed <strong>to</strong> allow PostScript code <strong>to</strong> be<br />

included within another PostScript file. Tomas Rokicki <strong>and</strong> his dvips driver broke<br />

the ground in this field <strong>and</strong> thus established the st<strong>and</strong>ards. It is for that reason<br />

that we place so much emphasis on PostScript graphics here. Encapsulated<br />

PostScript files may not contain any comm<strong>and</strong>s that reset the whole graphics<br />

page, <strong>and</strong> furthermore, they must contain a comment line of the form<br />

%%BoundingBox: llx lly urx ury<br />

giving the coordinates of the lower left <strong>and</strong> upper right corners of the bounding<br />

box. The units are never specified, always being big points.<br />

PDF output<br />

Today PDF is an important alternative <strong>to</strong> PostScript, <strong>and</strong> the pdfT E X program<br />

(Section 10.2.3) is the most convenient way <strong>to</strong> produce it with L AT E X. However,<br />

pdfT E X is not only a replacement for the classical T E X program, producing identical<br />

output, it also combines the functionality of a DVI-<strong>to</strong>-PDF driver. Thus no<br />

intermediate .dvi file is generated at all, with the .pdf file being generated<br />

directly from the L AT E X source file in one operation. This has consequences for<br />

graphics inclusion with pdfT E X. First of all, the number of allowed graphics<br />

formats is increased: images may be PNG (.png files), JPEG (.jpg or .jpeg files),<br />

TIFF (.tif or.tiff files) or even a single image in a one-page PDF file. Ironically,<br />

PostScript images are absolutely out! Secondly, the concept of bounding box does<br />

not really apply <strong>to</strong> these formats, since they have a natural size anyway. The<br />

viewport option should therefore be used <strong>to</strong> make a cu<strong>to</strong>ut from the original<br />

rather than bb.<br />

An alternative method of obtaining PDF output is <strong>to</strong> employ the true DVI<strong>to</strong>-PDF<br />

driver, dvipdfm, written by Mark A. Wicks. In this case, a .dvi file is<br />

produced as usual (with the graphics option dvipdfm), <strong>and</strong> then the PDF output<br />

is generated with this conversion program. The same set of graphics formats is<br />

allowed as for pdfT E X, for much the same reasons.<br />

The third method would be <strong>to</strong> generate DVI, then PostScript, <strong>and</strong> then convert<br />

it <strong>to</strong> PDF. As far as the graphics are concerned, this is the same as PostScript.<br />

Having pointed out how the importation takes place, we can now discuss<br />

what can go wrong along this chain of processes.<br />

Problems with importation: pdfT E X<br />

The single most common error when importing a graphics file with pdfT E X<br />

is that it does not exist in one of the permitted formats. Many users who<br />

are used <strong>to</strong> using classical T E X with PostScript simply switch <strong>to</strong> pdfT E X<br />

<strong>and</strong> are as<strong>to</strong>nished <strong>to</strong> get the error message:<br />

! <strong>LaTeX</strong> Error: Unknown graphics extension: .eps.<br />

As explained above, pdfT E X cannot h<strong>and</strong>le PostScript files, so the graphics<br />

must be converted <strong>to</strong>, or regenerated in, another format.


6.1. The graphics packages 163<br />

The above error message will appear only if one has specified the full<br />

name of the graphics file including the extension .eps. If the extension<br />

is absent, which we recommend, the error message will report that the<br />

file cannot be found. This means that it cannot be found with any of the<br />

allowed extensions. It might very well be that it exists with the extension<br />

.eps, but since that is not allowed for pdfT E X, it will not be sought.<br />

To maintain flexibility, one can have the same graphics file available<br />

both as an .eps <strong>and</strong> as a .pdf file. Leaving the extension off in the<br />

\includegraphics comm<strong>and</strong> means one does not need <strong>to</strong> make any<br />

changes <strong>to</strong> the file name when switching between regular T E X <strong>and</strong> pdfT E X.<br />

Problems with importation: PostScript<br />

The most common problems encountered when importing encapsulated<br />

PostScript files are listed here.<br />

No bounding box. If the bounding box information is <strong>to</strong>tally missing<br />

from the graphics file, L AT E X issues the error message<br />

! <strong>LaTeX</strong> Error: Cannot determine size of graphic<br />

in ... (no BoundingBox).<br />

The solution is <strong>to</strong> determine the bounding box coordinates somehow<br />

(see next point) <strong>and</strong> <strong>to</strong> include them, either in the \includegraphics<br />

comm<strong>and</strong>, or by editing the graphics file itself. However, if there<br />

really is no bounding box information in the file, it is unlikely <strong>to</strong> conform<br />

<strong>to</strong> the encapsulated st<strong>and</strong>ard <strong>and</strong> will cause other problems.<br />

The placement is incorrect. Both L AT E X <strong>and</strong> the driver process without<br />

error messages, but the figure is either displaced from the expected<br />

position, or is far <strong>to</strong>o small.<br />

Most likely the bounding box information is incorrect. Many applications<br />

that produce PostScript files are <strong>to</strong>o lazy <strong>to</strong> calculate the true<br />

bounding box, or they think they are generating a whole page with<br />

a figure somewhere in the middle. In either case, the bounding box<br />

corresponds <strong>to</strong> the full page even though the printed figure occupies<br />

only a portion of it.<br />

Find the true bounding box by one of the following methods:<br />

1. Print the figure, mark the lower left <strong>and</strong> upper right corners<br />

of the box containing the figure, <strong>and</strong> measure their distances<br />

from the left <strong>and</strong> bot<strong>to</strong>m edges. Enter these distances in the<br />

\includegraphics comm<strong>and</strong>, or edit the PostScript file. In the<br />

latter case, convert <strong>to</strong> big points.<br />

Difficulties with this are that some encapsulated PostScript files<br />

cannot be printed on their own, <strong>and</strong> that the left <strong>and</strong> bot<strong>to</strong>m


164 Chapter 6. Graphics Inclusion <strong>and</strong> Color<br />

edges of the paper need not be the exact lines from which the<br />

printer really measures.<br />

2. Include the figure in a short L AT E X file such as<br />

\setlength{\fboxsep}{-\fboxrule}<br />

\fbox{\includegraphics{test.eps}}<br />

<strong>and</strong> print the output. The apparent bounding box appears as<br />

a framed box. Measure the true bounding box relative <strong>to</strong> the<br />

left <strong>and</strong> bot<strong>to</strong>m edges of the apparent one, <strong>and</strong> enter the values<br />

in the \includegraphics comm<strong>and</strong> with the viewport= key.<br />

If necessary, scale the figure down <strong>to</strong> fit on the page, but then<br />

remember <strong>to</strong> increase the measurements by the same scale<br />

fac<strong>to</strong>r.<br />

3. Use the GhostView program <strong>to</strong> fix up the bounding box, either<br />

au<strong>to</strong>matically or manually. This is the most convenient method<br />

if you have this utility for viewing <strong>and</strong> manipulating PostScript<br />

files.<br />

Immovable graphic. It does not shift, nor scale nor rotate, no matter what<br />

is specified. In this case, it violates the encapsulated PostScript rules<br />

<strong>and</strong> contains some global plotting comm<strong>and</strong>s. Graphics produced<br />

by word processing programs are no<strong>to</strong>rious for this. Often the<br />

offending comm<strong>and</strong> is setpagedevice.<br />

There is little that can be done <strong>to</strong> correct this, other than trying <strong>to</strong> regenerate<br />

the graphics file with an option for encapsulated PostScript.<br />

Judicious editing can remove the troublesome lines, but this could<br />

result in the file becoming <strong>to</strong>tally unreadable.<br />

6.1.7 Configuring graphics importation<br />

Although the graphics syntax has been st<strong>and</strong>ardized, <strong>and</strong> most of the driver-<br />

! specific coding hidden in the .def files, there are still a number of items that<br />

must be set up for any particular installation <strong>and</strong> operating system. These are<br />

most conveniently placed in the local configuration file graphics.cfg which is<br />

read in if it is present.<br />

Many installations come with a ready-made configuration file, so there may<br />

not be any need <strong>to</strong> make up your own. On the other h<strong>and</strong>, you may want <strong>to</strong> edit<br />

or replace it for you own purposes.<br />

Default driver<br />

The choice of driver option must always be given, but a local default can be<br />

specified in the configuration file. For example, if dvips is the st<strong>and</strong>ard graphics<br />

driver, you may add


\ExecuteOptions{dvips}<br />

6.1. The graphics packages 165<br />

<strong>to</strong> graphics.cfg <strong>and</strong> you do not need <strong>to</strong> give the option dvips when loading<br />

graphics or graphicx. You may still specify any other graphics driver option if<br />

you wish.<br />

Many supplied configuration files go further <strong>and</strong> determine whether pdfT E X<br />

is activated or not; if so, the default graphics option is set <strong>to</strong> pdftex, otherwise<br />

<strong>to</strong> dvips.<br />

The rest of the configuring comm<strong>and</strong>s in this section can be issued either in<br />

the graphics.cfg file, or in the document.<br />

Search path for graphics files<br />

One can specify the direc<strong>to</strong>ries where L AT E X is <strong>to</strong> look for graphics files with<br />

\graphicspath{dir list}<br />

where dir list is a list of direc<strong>to</strong>ry names, each enclosed in brackets { }, with no<br />

other separa<strong>to</strong>r. The syntax of the local operating system must be used. Without<br />

this comm<strong>and</strong>, L AT E X searches for graphics files in the same direc<strong>to</strong>ries as for all<br />

other T E X files. Example,<br />

\graphicspath{{figs/}{eps/}} for Unix, DOS, Windows<br />

\graphicspath{{:figs:}{:eps:}} for Macin<strong>to</strong>sh<br />

\graphicspath{{[.figs]}{[.eps]}} for VMS<br />

Note: The Unix syntax works even with DOS <strong>and</strong> Windows, since the normal<br />

backslash in the direc<strong>to</strong>ry names must be replaced by a slash / <strong>to</strong> avoid looking<br />

like a comm<strong>and</strong> name.<br />

Default extensions<br />

A list of default extensions for the graphics files can be defined with<br />

\DeclareGraphicsExtensions{ext list}<br />

This means that only the root name of the file must be given <strong>and</strong> L AT E X will<br />

attempt <strong>to</strong> find it by attaching all the possible extensions. For PostScript drivers,<br />

the ext list is usually set <strong>to</strong> .eps,.ps. At our installation, we also include the<br />

non-st<strong>and</strong>ard extension.psc. Note that the above comm<strong>and</strong> does not add <strong>to</strong> the<br />

list of extensions but rewrites it anew; if you wish <strong>to</strong> add <strong>to</strong> the list, you must<br />

include all the allowed extensions in the one declaration.<br />

Graphics types<br />

Defining the extensions is only part of the task: one must also associate each<br />

extension with a graphics type so that L AT E X knows how <strong>to</strong> process it. PostScript<br />

recognizes only one type, eps, encapsulated PostScript, but there do exist other<br />

types such as bmp <strong>and</strong> pcx for other drivers. For the non-st<strong>and</strong>ard.psc extension<br />

above, we must also give<br />

\DeclareGraphicsRule{.psc}{eps}{}{}<br />

<strong>to</strong> inform L AT E X that this extension belongs <strong>to</strong> type eps. The other two (empty)<br />

arguments specify that the bounding box information is <strong>to</strong> be read from the file<br />

itself, <strong>and</strong> that no other program needs <strong>to</strong> be applied <strong>to</strong> the file.


166 Chapter 6. Graphics Inclusion <strong>and</strong> Color<br />

Compressing graphics files<br />

Since PostScript files are often extremely large, it makes sense <strong>to</strong> try <strong>to</strong> compress<br />

them with either the zip or gzip programs. In such a case, the .eps file is<br />

replaced by a file with extension.zip, or.eps.gz, or.eps-gz. Two problems now<br />

arise: first, L AT E X cannot read such files <strong>to</strong> obtain the bounding box information,<br />

<strong>and</strong> secondly, the driver needs <strong>to</strong> unpack such a file <strong>to</strong> include it in the final<br />

output. This can be accomplished with, for example,<br />

\DeclareGraphicsRule{.eps.gz}{eps}{.eps.bb}{‘gunzip -c #1}<br />

which establishes the graphics type as eps, with the bounding box information in<br />

the file of the same name <strong>and</strong> extension.eps.bb, <strong>and</strong> that the operating system<br />

comm<strong>and</strong> gunzip -c must be applied <strong>to</strong> the file (represented as #1). The single<br />

quote ‘ is required <strong>to</strong> indicate a system comm<strong>and</strong>. The %%BoundingBox line of<br />

the original file must be copied <strong>and</strong> s<strong>to</strong>red in the.eps.bb file.<br />

Such decompression rules are system dependent <strong>and</strong> thus need <strong>to</strong> be configured<br />

for the local installation. For example, under the VMS operating system,<br />

the gzip program produces files with extension .eps-gz <strong>and</strong> decompression<br />

is performed with gzip -d rather than with gunzip. The corresponding rule<br />

becomes<br />

6.2 Adding color<br />

\DeclareGraphicsRule{.eps-gz}{eps}{.bb}{‘gzip -d -c #1}<br />

The color package accepts the same driver options listed on page 154<br />

for the graphics package. In addition, it also recognizes the options:<br />

monochrome<br />

<strong>to</strong> convert all color comm<strong>and</strong>s <strong>to</strong> black <strong>and</strong> white, for previewers<br />

that cannot h<strong>and</strong>le color;<br />

dvipsnames<br />

makes the named color model of dvips (Section 6.2.1) available<br />

<strong>to</strong> other drivers;<br />

nodvipsnames<br />

disables the named model for dvips, <strong>to</strong> save memory;<br />

usenames<br />

loads all the named colors as defined ones; again, see Section 6.2.1<br />

for details.<br />

A local configuration file color.cfg can be set up in the same way as for<br />

! the graphics package. The default driver option is specified in exactly the same<br />

way as in Section 6.1.7.<br />

Colors are specified either by a defined name, or by the form<br />

[model]{specs}


6.2. Adding color 167<br />

where model is one of rgb (red, green, blue), cmyk (cyan, magenta, yellow,<br />

black), gray, or named. The specs is a list of numbers from 0 <strong>to</strong> 1 giving the<br />

strengths of the components in the model. Thus [rgb]{1,0,0} defines<br />

red, [cmyk]{0,0,1,0} yellow. The gray model takes only one number.<br />

The named model accesses colors by internal names that were originally<br />

built in<strong>to</strong> the dvips driver, but which may now be used by some other<br />

drivers <strong>to</strong>o. This model is described in Section 6.2.1.<br />

A color can be defined with<br />

\definecolor{name}{model}{specs}<br />

<strong>and</strong> then the name may be used in all the following color comm<strong>and</strong>s.<br />

Certain colors are au<strong>to</strong>matically predefined for all drivers: red, green,<br />

blue, yellow, cyan, magenta, black, white.<br />

In the following color comm<strong>and</strong>s, col spec is either the name of a<br />

defined color, like {blue}, or [model]{spec}, like [rgb]{0,1,0}.<br />

\pagecolor col spec sets the background color for the current <strong>and</strong><br />

following pages;<br />

\color col spec is a declaration <strong>to</strong> switch <strong>to</strong> setting text in the given<br />

color;<br />

\textcolor col spec{text} sets the text of its argument in the given<br />

color;<br />

\colorbox col spec{text} sets its argument in a box with the given color<br />

as background;<br />

\fcolorbox col spec1 col spec2{text} like \colorbox, with a frame of<br />

col spec1 around a box of background color col spec2; the two specifications<br />

must either both be defined ones, or both use the same<br />

model, which is given only once; for example, \fcolorbox{red}<br />

{green}{Text} sets ‘Text’ in the current text color on a green background<br />

with a red frame;<br />

\normalcolor switches <strong>to</strong> the color that was active at the end of the<br />

preamble. Thus placing a \color comm<strong>and</strong> in the preamble can<br />

change the st<strong>and</strong>ard color for the whole document. This is the<br />

equivalent <strong>to</strong> \normalfont for font selection.<br />

Normally one would try <strong>to</strong> define all the colors needed as names for the<br />

col spec entries. This simplifies changing the color definition everywhere<br />

should fine-tuning be required after the initial printed results are seen.<br />

The same color definition can produce quite different effects on different<br />

printers. Even the display on the moni<strong>to</strong>r is no reliable guide as <strong>to</strong> how<br />

the output will appear on paper.


168 Chapter 6. Graphics Inclusion <strong>and</strong> Color<br />

6.2.1 The named color model<br />

One very useful color model is called named <strong>and</strong> is based on the 68<br />

predefined internal colors of the dvips PostScript driver. Sample names<br />

are BurntOrange or DarkOrchid. This model can be activated for other<br />

drivers with the option dvipsnames, in which case one can define colors<br />

as, for example<br />

\definecolor{titlecol}{named}{DarkOrchid}<br />

The color titlecol can then be used as col spec in the various color<br />

comm<strong>and</strong>s.<br />

The named colors can be defined with their own names if one invokes<br />

the option usenames, which effectively declares<br />

\definecolor{BurntOrange}{named}{BurntOrange}<br />

<strong>and</strong> so on, for all 68 colors.<br />

It is possible <strong>to</strong> generate a palette of the named colors by processing<br />

the following short L AT E X file <strong>and</strong> sending the output <strong>to</strong> the desired printer.<br />

\documentclass[12pt,a4paper]{article}<br />

\usepackage[dvipsnames]{color}<br />

\usepackage{multicol}<br />

\pagestyle{empty}<br />

\setlength{\oddsidemargin}{0pt}<br />

\setlength{\textwidth}{16cm}<br />

\setlength{\textheight}{22cm}<br />

\setlength{\parindent}{0pt}<br />

\setlength{\parskip}{0pt}<br />

\begin{document}<br />

\renewcomm<strong>and</strong>*{\DefineNamedColor}[4]{%<br />

\textcolor[named]{#2}{\rule{7mm}{7mm}}\quad<br />

\texttt{#2}\strut\\}<br />

\begin{center}\Large Named colors in \texttt{dvipsnam.def}<br />

\end{center}<br />

\begin{multicols}{3}<br />

\input{dvipsnam.def}<br />

\end{multicols}<br />

\end{document}<br />

Remember, each printer can reproduce the colors differently, so it is<br />

important <strong>to</strong> test this table with every color printer that might be used.<br />

Exercise 6.3: Copy the above lines <strong>to</strong> a file named palette.tex or copy it from<br />

the enclosed CD from \books\Kopka_<strong>and</strong>_Daly\. Process it <strong>and</strong> view the output<br />

on a color moni<strong>to</strong>r or send it <strong>to</strong> a color printer.


7<br />

Floating tables <strong>and</strong><br />

figures<br />

Whether a figure is imported with \includegraphics (Chapter 6) or<br />

produced with the picture environment of Chapter 13, it is inserted in<br />

the text where the drawing or importing comm<strong>and</strong>s are issued, coming<br />

between the previous <strong>and</strong> following texts. This can present the same<br />

difficulties as for tables, described in Section 4.8.5: if the figure is so<br />

high that it no longer fits on the current page, that page is prematurely<br />

terminated <strong>and</strong> the figure is placed at the <strong>to</strong>p of the next page, with <strong>to</strong>o<br />

much empty space left on the original page.<br />

In Section 4.8.5 we mention how this problem is solved for tables. Here<br />

we now give a complete description of the float procedures that apply <strong>to</strong><br />

both figures <strong>and</strong> tables.<br />

7.1 Float placement<br />

L AT E X does make it possible <strong>to</strong> float figures <strong>and</strong> tables, <strong>to</strong>gether with their<br />

headlines <strong>and</strong> captions, <strong>to</strong> an appropriate location without interrupting<br />

the text. This is invoked with the environments<br />

\begin{figure}[where] figure \end{figure}<br />

\begin{figure*}[where] figure \end{figure*}<br />

\begin{table}[where] table \end{table}<br />

\begin{table*}[where] table \end{table*}<br />

The *-forms apply only <strong>to</strong> the two-column page format <strong>and</strong> insert the<br />

figure or table across both columns instead of the normal single column.<br />

They function exactly the same as the st<strong>and</strong>ard forms when the page<br />

format is single column.<br />

In the above syntax, figure <strong>and</strong> table are the texts for the contents of the<br />

float, either a picture or tabular environment, or an \includegraphics<br />

comm<strong>and</strong>, <strong>to</strong>gether with a possible \caption comm<strong>and</strong>, as described<br />

later in Section 7.4.<br />

169


170 Chapter 7. Floating tables <strong>and</strong> figures<br />

The argument where specifies the allowed locations for the figure or<br />

table. There are several possibilities so that where consists of from zero<br />

<strong>to</strong> four letters with the following meanings:<br />

h here: the float may appear at that point in the text where the<br />

environment is typed in; this is not permitted for the *-form; see<br />

also the here package <strong>and</strong> the H parameter, page 178;<br />

t <strong>to</strong>p: the float may appear at the <strong>to</strong>p of the current page, provided<br />

there is enough room for both it <strong>and</strong> the previous text; if this is not<br />

the case, it is added at the <strong>to</strong>p of the next page; the subsequent text<br />

continues on the current page until the next normal page break; (for<br />

two-column format, read column in place of page);<br />

b bot<strong>to</strong>m: the float may be placed at the bot<strong>to</strong>m of the page; the<br />

subsequent text continues until the room left on the current page<br />

is just enough for the float; if there is already insufficient room, the<br />

float will be put at the bot<strong>to</strong>m of the next page; this is not permitted<br />

for the *-form;<br />

p page: the float may be put on a special page (or column) containing<br />

only figures <strong>and</strong>/or tables;<br />

! used <strong>to</strong>gether with any combination of the other letters, suspends<br />

all the spacing <strong>and</strong> number restrictions described in Section 7.3.<br />

The argument values may be combined <strong>to</strong> allow several possibilities. If<br />

none is given, L AT E X assumes the st<strong>and</strong>ard combination tbp.<br />

The placement arguments permit certain possibilities for locating the<br />

float, but the actual insertion takes place at the earliest possible point in<br />

accordance with the following rules:<br />

• no float appears on a page prior <strong>to</strong> that where it is defined;<br />

• figures <strong>and</strong> tables are output in the order in which they were defined<br />

in the text, so that no float appears before a previously defined float<br />

of the same type; figures <strong>and</strong> tables may, however, be mixed in their<br />

output sequence; in two-column format, the double column *-floats<br />

may also appear out of sequence;<br />

• floats will be located only at one of the allowed positions given by<br />

the placement argument where; without an argument, the st<strong>and</strong>ard<br />

combination tbp is used;<br />

• unless the ! is included in where, the positioning obeys the limitations<br />

of the style parameters described in Section 7.3;<br />

• for the combination ht, the argument h takes priority; the float is<br />

inserted at the point of its definition even if there is enough room<br />

for it at the <strong>to</strong>p of the page.


Package:<br />

afterpage<br />

7.3. Style parameters for floats 171<br />

When any of the comm<strong>and</strong>s \clearpage, \cleardoublepage, or<br />

\end{document} is given, all floats that have not yet been output will<br />

be printed on a separate page or column regardless of their placement<br />

arguments.<br />

Sometimes LAT EX gets stuck on a float which holds up the entire queue<br />

until the end of the document. One way <strong>to</strong> clear the queue is <strong>to</strong> issue<br />

\clearpage right after the troublesome float. However, that would insert<br />

a new page at that point, something that may not be desired. The<br />

package afterpage in the <strong>to</strong>ols collection (Section B.5.4) provides the<br />

comm<strong>and</strong> \afterpage which executes its argument at the end of the<br />

current page. Thus \afterpage{\clearpage} solves this problem by<br />

delaying the \clearpage comm<strong>and</strong> until the actual page break.<br />

7.2 Postponing floats<br />

Occasionally one wants <strong>to</strong> prevent floats from appearing on a certain<br />

page, for example at the <strong>to</strong>p of a title page. (L AT E X au<strong>to</strong>matically corrects<br />

that case.) However, there are other situations where a float should be<br />

suppressed temporarily. One might want it at the <strong>to</strong>p of a page, but not<br />

before the start of the section that refers <strong>to</strong> it. The comm<strong>and</strong><br />

\suppressfloats[loc]<br />

sees <strong>to</strong> it that for the current page only no further floats of the specified<br />

placement loc should appear. If the optional loc is omitted, all floats are<br />

suppressed; otherwise loc may be either t or b, but not both.<br />

Note that \suppressfloats does not suppress all floats for the current<br />

page, but only further ones that come between the issuing of this<br />

comm<strong>and</strong> <strong>and</strong> the end of the page. Thus it is still possible for floats from<br />

a previous section <strong>to</strong> appear on the page.<br />

Package: Alternatively, the package flafter (Section B.5.3) may be loaded <strong>to</strong><br />

flafter ensure that all floats appear only after their position in the text.<br />

The comm<strong>and</strong> \suppressfloats <strong>and</strong> the location parameter ! are<br />

attempts <strong>to</strong> give the author more control over the sometimes capricious<br />

actions of float placement.<br />

7.3 Style parameters for floats<br />

There are a number of style parameters that influence the placement of floats,<br />

! which may be altered by the user as desired.<br />

<strong>to</strong>pnumber<br />

The maximum number of floats that may appear at the <strong>to</strong>p of a page.<br />

bot<strong>to</strong>mnumber<br />

The maximum number of floats that may appear at the bot<strong>to</strong>m of a<br />

page.


172 Chapter 7. Floating tables <strong>and</strong> figures<br />

<strong>to</strong>talnumber<br />

The maximum number of floats that may appear on any page regardless<br />

of position.<br />

dbl<strong>to</strong>pnumber<br />

The same as <strong>to</strong>pnumber but for floats that extend over both columns<br />

in two-column page format.<br />

The above parameters are all counters <strong>and</strong> may be reset <strong>to</strong> new values with<br />

the comm<strong>and</strong> \setcounter{ctr}{num}, where ctr is the name of the counter<br />

<strong>and</strong> num the new value that it is <strong>to</strong> take on.<br />

\<strong>to</strong>pfraction<br />

A decimal number that specifies what fraction of the page may be used<br />

for floats at the <strong>to</strong>p.<br />

\bot<strong>to</strong>mfraction<br />

A decimal number that specifies what fraction of the page may be used<br />

for floats at the bot<strong>to</strong>m.<br />

\textfraction<br />

The fraction of a page that must be filled with text. This is a minimum,<br />

so that the fraction available for floats, whether <strong>to</strong>p or bot<strong>to</strong>m, can<br />

never be more than 1−\textfraction.<br />

\floatpagefraction<br />

The smallest fraction of a float page that is <strong>to</strong> be filled with floats before<br />

a new page is called.<br />

\dbl<strong>to</strong>pfraction<br />

The same as \<strong>to</strong>pfraction but for double column floats in two-column<br />

page format.<br />

\dblfloatpagefraction<br />

The same as \floatpagefraction but for double column floats in<br />

two-column page format.<br />

These style parameters are altered with \renewcomm<strong>and</strong>{cmd}{frac} where<br />

cmd st<strong>and</strong>s for the parameter name <strong>and</strong> frac for the new decimal value, which<br />

in every case must be less than 1.<br />

\floatsep<br />

The vertical spacing between floats appearing either at the <strong>to</strong>p or at the<br />

bot<strong>to</strong>m of a page.<br />

\textfloatsep<br />

The vertical spacing between floats <strong>and</strong> text, for both <strong>to</strong>p <strong>and</strong> bot<strong>to</strong>m<br />

floats.<br />

\intextsep<br />

The vertical spacing above <strong>and</strong> below a float that appears in the middle<br />

of a text page with the h placement argument.<br />

\dblfloatsep<br />

The same as \floatsep but for double column floats in two-column<br />

page format.<br />

\dbltextfloatsep<br />

The same as \textfloatsep but for double column floats in twocolumn<br />

page format.


7.4. Float captions 173<br />

This group of style declarations are rubber lengths that may be changed with<br />

the \setlength comm<strong>and</strong> (Section 2.4.2).<br />

\<strong>to</strong>pfigrule<br />

A comm<strong>and</strong> that is executed after a float at the <strong>to</strong>p of a page. It may be<br />

used <strong>to</strong> add a rule <strong>to</strong> separate the float from the main text. Whatever it<br />

adds must have zero height.<br />

\botfigrule<br />

Similar <strong>to</strong> \<strong>to</strong>pfigrule, but is executed before a float that appears at<br />

the bot<strong>to</strong>m of a page.<br />

\dblfigrule<br />

Similar <strong>to</strong> \<strong>to</strong>pfigrule, but for double column floats.<br />

These three comm<strong>and</strong>s normally do nothing, but they may be redefined if<br />

necessary. For example, <strong>to</strong> add a rule of thickness 0.4 pt below a <strong>to</strong>p float,<br />

\renewcomm<strong>and</strong>{\<strong>to</strong>pfigrule}{\vspace*{-3pt}<br />

\rule{\columnwidth}{0.4pt}\vspace{2.6pt} }<br />

Because of the negative argument in \vspace*, the <strong>to</strong>tal vertical spacing is zero,<br />

as required.<br />

All the one-column style parameters also function within the two-column<br />

page format, but they apply only <strong>to</strong> floats that fill up one column.<br />

If the style parameters are set <strong>to</strong> new values within the preamble, they apply<br />

from the first page onwards. However, if they are changed within a document,<br />

they do not take effect until the next page.<br />

7.4 Float captions<br />

A figure caption or table title is produced with the comm<strong>and</strong><br />

\caption[short title]{caption text}<br />

inside the figure or table environment. The caption text is the text that<br />

is printed with the float <strong>and</strong> may be fairly long. The short title is optional<br />

<strong>and</strong> is the text that appears in the list of figures or tables (Section 3.4.4).<br />

If it is missing, it is set equal <strong>to</strong> caption text. The short title should be<br />

given if the caption text is longer than about 300 characters, or if it is<br />

more than one line long.<br />

In the table environment, the \caption comm<strong>and</strong> generates a title of<br />

the form ‘Table n: caption text’, <strong>and</strong> in the figure environment ‘Figure n:<br />

caption text’, where n is a sequential number that is au<strong>to</strong>matically incremented.<br />

In document class article, the figures <strong>and</strong> tables are numbered<br />

from 1 through <strong>to</strong> the end of the document. For the report <strong>and</strong> book<br />

classes, they are numbered within each chapter in the form c.n, where c<br />

is the current chapter number <strong>and</strong> n is the sequential number reset <strong>to</strong> 1 at<br />

the start of each chapter. Figures <strong>and</strong> tables are numbered independently<br />

of one another.


174 Chapter 7. Floating tables <strong>and</strong> figures<br />

Table 7.1: Computer Center Budget for 2004<br />

Nr. Item 51505 52201 53998 Total<br />

1.1 Maintenance 130 000 15 000 145 000<br />

1.2 Network costs 5 000 23 000 28 000<br />

1.3 Repairs 25 000 6 000 31 000<br />

1.4 Expendables 68 000 68 000<br />

1. Total 160 000 74 000 38 000 272 000<br />

The \caption comm<strong>and</strong> may be omitted if numbering is unwanted,<br />

since any text included in the float environment will accompany the<br />

contents. The advantages of \caption over simple text are the au<strong>to</strong>matic<br />

numbering <strong>and</strong> entries in the lists of figures <strong>and</strong> tables. However, a<br />

manual entry in these lists may be made as described in Section 3.4.4<br />

using<br />

\addcontentsline <strong>and</strong> \add<strong>to</strong>contents<br />

A title, or headline, is produced with \caption when the comm<strong>and</strong><br />

comes at the beginning of the material in the float environment: the<br />

number <strong>and</strong> text are printed above the table or figure. A caption is added<br />

below the object if the comm<strong>and</strong> comes after all the other float comm<strong>and</strong>s.<br />

In other words, the \caption is just another item within the float <strong>and</strong><br />

whether its text appears at the <strong>to</strong>p (as title) or below (as caption) depends<br />

on how the user places it.<br />

The caption text will be centered if it is shorter than one line, otherwise<br />

it is set as a normal paragraph. The <strong>to</strong>tal width may be adjusted <strong>to</strong> that of<br />

the table or figure by placing the comm<strong>and</strong> inside a parbox or minipage.<br />

For example,<br />

\parbox{width}{\caption{caption text}}<br />

The following demonstrations contain further examples of how text,<br />

table, <strong>and</strong> picture comm<strong>and</strong>s may be combined in floats.<br />

7.5 Float examples<br />

The first two tables are produced with the following texts:<br />

\begin{table} \caption{Computer Center Budget for 2004}<br />

\begin{tabular}{|l|l||r|r|r|r|} ... ... \end{tabular}<br />

\end{table}<br />

(This text was typed in before the last paragraph of the previous section. The<br />

second table is entered here in the current text.)


7.5. Float examples 175<br />

Table 7.2: Estimates for 2004. A continuation of the previous budget is<br />

no longer practical since, with the installation of the new computing system<br />

in 2003, the operating conditions have been completely overhauled.<br />

Nr. Item 51505 52201 53998 Total<br />

1.1 Maintenance 240 000 240 000<br />

1.2 Line costs 12 000 8 000 36 000 56 000<br />

1.3 Training 50 000 50 000<br />

1.4 Expansion 80 000 3 000 83 000<br />

1.5 Expendables 42 000 42 000<br />

1. Total 332 000 53 000 86 000 471 000<br />

\begin{table}<br />

\caption{\textbf{Estimates for 2004} \emph{A continuation...}}<br />

\begin{tabular}{|l|l||r|r|r|r|} ... ... ... \end{tabular}<br />

\end{table}<br />

Because the placement argument is missing from the table environments,<br />

the st<strong>and</strong>ard values tbp are used. The first was placed at the<br />

<strong>to</strong>p on the facing page because it was typed in early enough (during the<br />

last section) that there was still room for it there. Then the comm<strong>and</strong><br />

\suppressfloats (Section 7.2) was issued <strong>to</strong> prevent any more floats<br />

appearing on the same page. The second table is therefore forced <strong>to</strong> float<br />

<strong>to</strong> the <strong>to</strong>p of this page.<br />

Narrow figures or tables may be set beside each other, as shown in<br />

the following example (which appears at the bot<strong>to</strong>m of this page). (The<br />

picture environment is explained in Chapter 13.)<br />

\begin{figure}[b]<br />

\setlength{\unitlength}{1cm}<br />

\begin{minipage}[t]{5.0cm}<br />

\begin{picture}(5.0,2.5) ... ... \end{picture}\par<br />

\caption{Left}<br />

\end{minipage}<br />

✻<br />

Space for Left Figure<br />

2.5 cm<br />

✛<br />

❄<br />

5.0 cm ✲<br />

Figure 7.1: Left<br />

✻<br />

Space for Right Figure<br />

3.0 cm<br />

✛<br />

❄<br />

6.0 cm ✲<br />

Figure 7.2: Right


176 Chapter 7. Floating tables <strong>and</strong> figures<br />

\hfill<br />

\begin{minipage}[t]{6.0cm}<br />

\begin{picture}(6.0,3.0) ... ... \end{picture}\par<br />

\caption{Right}<br />

\end{minipage}<br />

\end{figure}<br />

The two figures along with their captions are each set in a minipage<br />

environment of widths 5 <strong>and</strong> 6 cm. The minipages are separated from one<br />

another by an \hfill space. The positioning argument t has the effect<br />

that the minipages are aligned along their first lines (Section 4.7.3). The<br />

entire structure within the figure environment floats as a single entity.<br />

The question might now arise as <strong>to</strong> why, since the two figures have<br />

unequal heights <strong>and</strong> are supposedly aligned vertically along their <strong>to</strong>p<br />

lines, their bot<strong>to</strong>m edges are at the same level. The explanation is that<br />

a picture environment establishes an LR box (Section 4.7.1) <strong>to</strong> contain<br />

all the picture comm<strong>and</strong>s, <strong>and</strong> that is viewed by L AT E X as a single line of<br />

output text with the baseline at the bot<strong>to</strong>m edge of the picture. In both<br />

minipages, the picture environment is the first entry <strong>and</strong> is therefore<br />

the first logical line of text. It is these baselines that are taken for the<br />

vertical alignment of the minipages.<br />

If the two pictures were <strong>to</strong> be aligned along their <strong>to</strong>p edges, it would be<br />

necessary <strong>to</strong> include a dummy first line (Section 4.7.4) in each minipage<br />

before the picture environments. This could be something like \mbox{},<br />

for example.<br />

The application of box comm<strong>and</strong>s within a float permits completely<br />

free positioning. If the caption text is <strong>to</strong> appear, say, beside the table or<br />

figure, instead of above or below it, the objects may be put in<strong>to</strong> minipages<br />

or parboxes with suitable alignment arguments. Here is an example:<br />

\begin{table}[b]<br />

\centerline{\bfseries Results <strong>and</strong> Seat Distribution of the...}<br />

\mbox{\small<br />

\begin{minipage}[b]{7.7cm}<br />

Pros<br />

140<br />

Results <strong>and</strong> Seat Distribution of the 2003 General Election<br />

Cons<br />

186<br />

Ups<br />

Downs<br />

60<br />

42<br />

Seat Distribution<br />

in the Assembly of<br />

2004–2006<br />

Party Votes %<br />

Results:<br />

2003 General<br />

Election<br />

Pros 15 031 287 37.7<br />

Cons 12 637 418 31.7<br />

Ups 6 499 210 16.3<br />

Downs 4 486 514 11.3<br />

Others 1 201 078 3.0


7.6. References <strong>to</strong> figures <strong>and</strong> tables in text 177<br />

\begin{minipage}[t]{4.4cm}<br />

\mbox{}\\ \setlength{\unitlength}{0.75cm}<br />

\begin{picture}(5.75,5.0) ... ... ... \end{picture}<br />

\end{minipage} \hfill<br />

\parbox[t]{3.2cm}{\makebox[0cm]{}\\{\bfseries Seat ...} ...}<br />

\end{minipage}<br />

\hspace{-3cm}<br />

\begin{minipage}[b]{7cm}<br />

\parbox[b]{2.5cm}{{\bfseries Results:}\\ General Election..}<br />

\hfill<br />

\begin{tabular}[b]{|l||r|r|} ... ... \end{tabular}<br />

\end{minipage} }<br />

\end{table}<br />

Here the vertical boxes are nested inside one another. The left side, consisting<br />

! of graphics <strong>and</strong> a title at the upper right, is contained in a minipage of width<br />

7.7 cm, in which the picture is in another minipage of width 4.4 cm while the text<br />

is in a parbox of width 3.2 cm. Both are aligned with the <strong>to</strong>p lines. A dummy line<br />

containing \mbox{} (Section 4.7.4) is added before the first picture <strong>to</strong> provide<br />

a <strong>to</strong>p line with which the second parbox can be aligned.<br />

The right-h<strong>and</strong> side consists of a minipage of width 7 cm, shifted <strong>to</strong> the left<br />

by 3 cm, aligned with the left-h<strong>and</strong> minipage along the bot<strong>to</strong>m lines. It contains<br />

a parbox of width 2.5 cm for the text as well as a table, which is au<strong>to</strong>matically a<br />

vertical box. Both of these are aligned with the bot<strong>to</strong>m lines.<br />

7.6 References <strong>to</strong> figures <strong>and</strong> tables in text<br />

The au<strong>to</strong>matic numbering of tables <strong>and</strong> figures has the consequence that<br />

the author does not know the numbers at the time of writing. Since he<br />

or she would like <strong>to</strong> be able <strong>to</strong> refer <strong>to</strong> these objects by number, as ‘see<br />

Figure 3’ or ‘Table 5 illustrates’, another means of referencing must be<br />

found. It is not sufficient <strong>to</strong> keep track of the number of \caption calls<br />

that have been made, since the document may not be written in the order<br />

in which it finally appears, <strong>and</strong> new figures or tables may be inserted<br />

during revision, or some removed.<br />

These problems are solved with the L AT E X cross-reference system, described<br />

in more detail in Section 9.2.1. The basic comm<strong>and</strong>s are<br />

\label{name} \ref{name}<br />

which assign a keyword name <strong>to</strong> the figure or table number that may be<br />

used as reference in the text. The keyword name may be any combination<br />

of letters, numbers or symbols. The assignment is made with the \label<br />

comm<strong>and</strong> given anywhere within the caption text of the \caption comm<strong>and</strong>;<br />

in the main text, the comm<strong>and</strong> \ref inserts the number that is<br />

associated with its keyword.<br />

This is best shown with an example. The budget table on page 174<br />

was actually written as


178 Chapter 7. Floating tables <strong>and</strong> figures<br />

\caption{\label{budget04} Computer Center ... }<br />

so that Table \ref{budget04} produces ‘Table 7.1’ when used in the<br />

main text.<br />

There is a second referencing comm<strong>and</strong> \pageref <strong>to</strong> generate the<br />

page number where the referenced object is <strong>to</strong> be found. For example, a<br />

few lines up, the input text on page \pageref{budget04} was used <strong>to</strong><br />

create the text ‘. . . on page 174’.<br />

7.7 Some float packages<br />

7.7.1 Placing a float right here<br />

Package: The float placement parameter h, described on page 170, only permits a<br />

here float <strong>to</strong> be placed at the current location, it does not force it <strong>to</strong> appear<br />

there. With Frank Mittelbach’s package here, an additional parameter H<br />

is provided which places the float immediately where it appears in the<br />

source text. If there is not enough room for it on the current page, a<br />

\pagebreak comm<strong>and</strong> is first issued. This will most likely lead <strong>to</strong> an ugly<br />

page break.<br />

7.7.2 Flowing text around a float<br />

Package: The package floatflt by Mats Dahlgren (based on the earlier <strong>and</strong> now<br />

floatflt obsolete floatfig by Thomas Kneser) permits one <strong>to</strong> mix text <strong>and</strong> floats<br />

side by side, with the text flowing around the float at the end, as in the<br />

next paragraph.<br />

A figure is placed within<br />

the text as shown in the box<br />

\begin{floatingfigure}[pos]{wth}<br />

at the right. Here pos de-<br />

Figure comm<strong>and</strong>s with or without a<br />

termines on which side the<br />

\caption comm<strong>and</strong><br />

figure is <strong>to</strong> appear; it may<br />

\end{floatingfigure}<br />

be r (right), l (left), p (right<br />

for odd, left for even pages), or v (like p unless a package option is given,<br />

in which case, it is used). The m<strong>and</strong>a<strong>to</strong>ry argument wth is the width<br />

of the figure itself; in fact, some additional space will be included for a<br />

border between text <strong>and</strong> figure. It is advisable <strong>to</strong> include a \centering<br />

comm<strong>and</strong> at the start of the figure material.<br />

The material in the floatingfigure environment need not actually<br />

be a figure. In the above example, some boxed text in a minipage was<br />

used for demonstration purposes. However, if the \caption comm<strong>and</strong><br />

is included in the environment, then a figure number will be printed, in<br />

sequence with those of the regular figure environment.<br />

Rather than giving the pos parameter each time, one can specify a<br />

default value as an option when loading the package with \usepackage:


7.7. Some float packages 179<br />

rflt (right), lflt (left), or vflt (variable, i.e. p). If no option is given, the<br />

default is vflt.<br />

\begin{floatingtable}[pos]{<br />

\begin{tabular}{table specs}<br />

table entries<br />

\end{tabular}}<br />

Optional \caption comm<strong>and</strong><br />

\end{floatingtable}<br />

To include a table with text,<br />

the usage is slightly different, as<br />

shown at the left. That is, the entire<br />

table appears in place of the<br />

wth for a figure, <strong>and</strong> only the caption<br />

in placed in the environment<br />

itself.<br />

Both these environments are<br />

<strong>to</strong> be placed at the start of the paragraph that is <strong>to</strong> flow around the figure<br />

or table. The flowing cannot start in the middle of a paragraph.<br />

There is some very tricky coding <strong>to</strong> get the flowing text <strong>to</strong> work properly,<br />

<strong>and</strong> needless <strong>to</strong> say, there are many things that can go wrong. Please<br />

read the accompanying manual for more details.<br />

7.7.3 Defining new floats <strong>and</strong> styles<br />

Package: For authors who are not satisfied with the st<strong>and</strong>ard float style, or who<br />

float need additional floating environments, we recommend the float package<br />

by Anselm Lingnau. With this package, one defines a new float type with<br />

\newfloat{name}{loc}{ext}[within]<br />

where name is the name of the new float environment, loc is the default<br />

placement letters (selection of tbhpH), ext is the extension of the file<br />

containing the list of this float type, <strong>and</strong> the optional within is the name<br />

of a counter (e.g., chapter) within which the numbering is reset.<br />

For example, <strong>to</strong> define a plate environment that behaves just like<br />

figure but which is numbered separately as Plate xxx, with the numbers<br />

reset within each chapter, give<br />

\newfloat{plate}{p}{lop}[chapter]<br />

\floatname{plate}{Plate}<br />

The first line defines the new environment, with default placement on a<br />

float page. The second states that the captions associated with this float<br />

are <strong>to</strong> start with the word ‘Plate’; without this, they would be labeled as<br />

‘plate’, the same as the environment name itself.<br />

The information for the list of plates is s<strong>to</strong>red in a file with extension<br />

.lop, in the same way that the list of figures is in a file with extension<br />

.lof (Section 3.4.4). This list is printed by reading in this file with the<br />

comm<strong>and</strong><br />

\lis<strong>to</strong>f{plate}{List of Plates}<br />

where ‘List of Plates’ is the list title.<br />

The default placement parameters for any float environment, including<br />

the st<strong>and</strong>ard figure <strong>and</strong> table ones, can be redefined with


180 Chapter 7. Floating tables <strong>and</strong> figures<br />

\floatplacement{name}{loc}<br />

The float package also defines 4 float styles:<br />

plain much like st<strong>and</strong>ard L AT E X except the caption is always below the<br />

float contents;<br />

plain<strong>to</strong>p<br />

like plain but with the caption always above the contents;<br />

boxed in which the contents are in a framed box with the caption below<br />

it;<br />

ruled with the caption above, <strong>and</strong> with rules above, below, <strong>and</strong> between<br />

caption <strong>and</strong> float contents.<br />

One selects a float style by issuing \floatstyle{style}, where style is<br />

one of the above possibilities. The style then applies <strong>to</strong> all new float<br />

environments defined with \newfloat, until a new style is issued.<br />

Note: the style selection affects the subsequent float definitions, not<br />

the float environments that are then used. To change the float style for<br />

the st<strong>and</strong>ard figure <strong>and</strong> table floats, issue<br />

\floatstyle{ruled}<br />

\restylefloat{figure}<br />

\restylefloat{table}<br />

The float package also contains the H placement parameter for ‘here<br />

<strong>and</strong> I mean it’, so it is not necessary <strong>to</strong> include the here package with it.


8<br />

User Cus<strong>to</strong>mizations<br />

L AT E X allows the user <strong>to</strong> define his or her own comm<strong>and</strong>s <strong>and</strong> environments.<br />

However, since these make extensive use of the L AT E X counters <strong>and</strong> lengths,<br />

we will first present a more detailed discussion of these objects <strong>and</strong> how<br />

they may be manipulated.<br />

8.1 Counters<br />

8.1.1 L AT E X counters<br />

L AT E X manages a number of counters by giving them initial values at the<br />

start <strong>and</strong> by changing these values when certain comm<strong>and</strong>s are called.<br />

Most of these counters have the same name as the comm<strong>and</strong>s that alter<br />

them:<br />

part chapter paragraph figure enumi<br />

section subparagraph table enumii<br />

subsection page footnote enumiii<br />

subsubsection equation mpfootnote enumiv<br />

The meanings of most of these counters are obvious from their names<br />

<strong>and</strong> need no further explanation. The counters enumi . . . enumiv refer <strong>to</strong><br />

the four levels of the enumerate environment (Sections 4.3.4 <strong>and</strong> 4.3.5),<br />

while the counter mpfootnote controls the footnote numbering within<br />

the minipage environment (Section 4.10.4).<br />

The value of a counter is an integer number, usually non-negative. A<br />

comm<strong>and</strong> may output several numbers at once: the current \subsection<br />

comm<strong>and</strong> outputs 8.1.1, which addresses three counters in all. For example,<br />

the \subsection comm<strong>and</strong> increments the value of the subsection<br />

counter by one, <strong>and</strong> prints the values of the chapter, section, <strong>and</strong><br />

subsection counters, separated by periods. At the same time, this comm<strong>and</strong><br />

sets the subsubsection counter <strong>to</strong> zero.<br />

181


182 Chapter 8. User Cus<strong>to</strong>mizations<br />

8.1.2 User-defined counters<br />

The user may create new counters with the comm<strong>and</strong><br />

\newcounter{counter name}[in counter]<br />

where counter name is the name of the newly established counter. This<br />

may be any combination of letters that is not already the name of an<br />

existing counter. Thus none of the names of the L AT E X counters listed<br />

above may be used as counter name nor any name of a previously defined<br />

user counter.<br />

The optional argument in counter is the name of another counter<br />

that already exists (L AT E X or user defined) <strong>and</strong> has the effect that the newly<br />

defined counter is reset <strong>to</strong> zero whenever in counter is incremented by one<br />

of the comm<strong>and</strong>s \stepcounter or \refstepcounter (see below). For<br />

example, the subsection counter is reset <strong>to</strong> zero whenever the section<br />

counter is incremented.<br />

The \newcounter comm<strong>and</strong> may not appear in any file that is read in<br />

with the \include comm<strong>and</strong> (Section 9.1.2). It is therefore best <strong>to</strong> put all<br />

\newcounter comm<strong>and</strong>s in<strong>to</strong> the preamble.<br />

8.1.3 Changing counter values<br />

Every counter, whether L AT E X or user defined, has an initial value of zero;<br />

this can be altered with the following comm<strong>and</strong>s:<br />

\setcounter{counter}{num}<br />

This comm<strong>and</strong> is self-explana<strong>to</strong>ry: the specified counter is assigned<br />

the integer value num.<br />

\add<strong>to</strong>counter{counter}{num}<br />

With this comm<strong>and</strong>, the value of the counter is increased by the<br />

integer num, which may be positive or negative.<br />

\stepcounter{counter}<br />

The value of the counter is increased by one, <strong>and</strong> at the same<br />

time all its sub-counters (that is, those that have this counter as<br />

their in counter) are reset <strong>to</strong> zero (see above).<br />

\refstepcounter{counter}<br />

This comm<strong>and</strong> has the same effect as \stepcounter but also<br />

makes counter the current counter for the cross-referencing comm<strong>and</strong><br />

\label (see Section 9.2.1).<br />

This last comm<strong>and</strong> may be applied, for example, within the figure<br />

or table environments when the \caption comm<strong>and</strong> is missing <strong>and</strong> yet<br />

there is <strong>to</strong> be a reference in the text <strong>to</strong> the figure or table number using the<br />

\ref comm<strong>and</strong>. Then \refstepcounter{figure} or \refstepcounter<br />

{table} is given within that float environment <strong>to</strong> bring the corresponding


8.1. Counters 183<br />

counter <strong>to</strong> the right value <strong>and</strong> <strong>to</strong> allow that value <strong>to</strong> be assigned a keyword<br />

with the \label comm<strong>and</strong> (Section 9.2.1).<br />

The value of a counter may be treated as a number with the comm<strong>and</strong><br />

\value{counter}<br />

which does not change the value at all. This comm<strong>and</strong> is mostly used<br />

in connection with \setcounter or \add<strong>to</strong>counter. For example, if the<br />

user-defined counter mypage has been created, it may be set <strong>to</strong> the same<br />

value as the page counter page by giving \setcounter{mypage}{\value<br />

{page}}.<br />

8.1.4 Printing counter values<br />

The numerical value in a counter can be printed with the comm<strong>and</strong>s<br />

\arabic{counter} as an Arabic number,<br />

\Roman{counter} as a capital Roman numeral,<br />

\roman{counter} as a lower case Roman numeral,<br />

\alph{counter} as a lower case letter,<br />

\Alph{counter} as a capital letter,<br />

\fnsymbol{counter} as a footnote symbol.<br />

For the comm<strong>and</strong>s \alph <strong>and</strong> \Alph, the numbers 1. . . 26 correspond <strong>to</strong><br />

the letters a. . . z <strong>and</strong> A. . . Z. It is up <strong>to</strong> the user <strong>to</strong> ensure that the counter<br />

value lies within this range. For \fnsymbol, the numbers 1. . . 9 are output<br />

as the symbols * † ‡ § ** †† ‡‡. Here again, the user must<br />

take care that the counter does not reach a value of 10 or more.<br />

For each counter, a comm<strong>and</strong> of the form<br />

\thecounter<br />

is also available, consisting of \the immediately followed by the name<br />

of that counter, such as \thepage. This type of comm<strong>and</strong> is initially<br />

identical <strong>to</strong> \arabic{counter}, but may redefined <strong>to</strong> be composed of<br />

several counter comm<strong>and</strong>s. In the document classes book <strong>and</strong> report,<br />

for example, the comm<strong>and</strong> \thesection is defined in terms of both the<br />

chapter <strong>and</strong> section numbers: \arabic{chapter}.\arabic{section}.<br />

Here is the result of printing \thesection at this point: 8.1.<br />

The au<strong>to</strong>matic printing of counter values such as the page, equation,<br />

or sectioning numbers is accomplished by means of calls <strong>to</strong> the appropriate<br />

\thecounter comm<strong>and</strong>s. If a different format for some au<strong>to</strong>matic<br />

numbering is desired, say alphabetical equation numbers, the definition<br />

of the corresponding \thecounter comm<strong>and</strong> can be altered using the<br />

methods described in Section 8.3.<br />

Exercise 8.1: Take your st<strong>and</strong>ard exercise.tex file <strong>and</strong> print out the final values<br />

of the L AT E X counters with \arabic{counter} comm<strong>and</strong>s at the end. Change some<br />

the values with the \setcounter <strong>and</strong> \add<strong>to</strong>counter comm<strong>and</strong>s <strong>and</strong> print the<br />

values out once more.


184 Chapter 8. User Cus<strong>to</strong>mizations<br />

8.2 Lengths<br />

It has been constantly pointed out in all the descriptions of the length<br />

parameters such as \parskip or \textwidth that new values may be<br />

assigned with the \setlength comm<strong>and</strong>. Some of these parameters<br />

expect rubber length values that may stretch or shrink. These are mainly<br />

parameters that produce vertical spacing. The types of length units,<br />

both fixed <strong>and</strong> rubber, are described in detail in Section 2.4. This will<br />

not be repeated here, but rather additional comm<strong>and</strong>s for assigning <strong>and</strong><br />

h<strong>and</strong>ling lengths are discussed in this section.<br />

The st<strong>and</strong>ard L AT E X method for assigning a value <strong>to</strong> a length parameter<br />

is with the comm<strong>and</strong><br />

\setlength{\length cmd}{length spec}<br />

where length spec may be a length specification (with units) or another<br />

length parameter. In the latter case, \length cmd takes on the current<br />

value of that other parameter. Thus with \setlength{\rightmargin}<br />

{\leftmargin} the right-h<strong>and</strong> margin in a list environment is set <strong>to</strong><br />

the same value as that of the left-h<strong>and</strong> margin.<br />

Lengths may be increased with<br />

\add<strong>to</strong>length{\length cmd}{length spec}<br />

which adds length spec <strong>to</strong> the value of the length parameter \length cmd.<br />

A negative value for length spec decreases \length cmd by that amount.<br />

Once again, another length parameter may be used for length spec, with or<br />

without a preceding minus sign, <strong>and</strong> its value will be added or subtracted.<br />

A decimal number just before a length parameter multiplies its value by<br />

that quantity: 0.5\textwidth means half the width of the text column<br />

<strong>and</strong> 2\parskip twice the inter-paragraph spacing.<br />

With the comm<strong>and</strong><br />

\set<strong>to</strong>width{\length cmd}{text}<br />

the length parameter \length cmd is set equal <strong>to</strong> the natural length of a<br />

piece of text.<br />

Similarly the comm<strong>and</strong>s<br />

\set<strong>to</strong>height{\length cmd}{text}<br />

\set<strong>to</strong>depth{\length cmd}{text}<br />

set the \length cmd equal <strong>to</strong> the height <strong>and</strong> depth of the text above <strong>and</strong><br />

below the baseline, respectively.<br />

Finally, the comm<strong>and</strong><br />

\stretch{decimal num}<br />

yields a rubber length that is decimal num times as stretchable as \fill<br />

(Section 2.4.2).<br />

A user-defined length parameter is created with


!<br />

\newlength{\new len cmd}<br />

8.3. User-defined comm<strong>and</strong>s 185<br />

which establishes \new len cmd as a length with a value of 0pt. All the<br />

above comm<strong>and</strong>s may be used <strong>to</strong> manipulate its value further.<br />

The comm<strong>and</strong><br />

\addvspace{length spec}<br />

inserts extra vertical spacing of the amount length spec at that point where it<br />

appears. If more than one such comm<strong>and</strong> is given, the <strong>to</strong>tal inserted spacing will<br />

be that of the largest argument <strong>and</strong> not the sum of them all. This comm<strong>and</strong> may<br />

only be given between paragraphs. Its application for user-defined comm<strong>and</strong>s<br />

<strong>and</strong> environments lies in the generation of structures that should behave like<br />

paragraphs.<br />

8.3 User-defined comm<strong>and</strong>s<br />

New comm<strong>and</strong>s may be defined or redefined under L AT E X with the comm<strong>and</strong>s<br />

\newcomm<strong>and</strong>{\com name}[narg][opt]{def }<br />

\renewcomm<strong>and</strong>{\com name}[narg][opt]{def }<br />

The first version is used <strong>to</strong> define a comm<strong>and</strong> \com name that does not<br />

yet exist. Its name may be any combination of letters that do not form<br />

the name of another comm<strong>and</strong>. The second version redefines an already<br />

existing comm<strong>and</strong> \com name. In both cases, an error message is printed<br />

if the incorrect variant is called. The first optional argument narg is a<br />

number between 1 <strong>and</strong> 9 specifying how many arguments the new or<br />

altered comm<strong>and</strong> is <strong>to</strong> have. A second optional argument opt gives the<br />

default value for an optional argument that the new comm<strong>and</strong> may take.<br />

The actual definition of the comm<strong>and</strong> is contained in the text def.<br />

8.3.1 Comm<strong>and</strong>s without arguments<br />

We will first illustrate the use of the \newcomm<strong>and</strong> without the optional<br />

argument [narg]. This form is applied when a fixed combination of<br />

L AT E X or user comm<strong>and</strong>s is <strong>to</strong> be repeated frequently as a comm<strong>and</strong> with<br />

its own name. For example, the structure x1, . . . , xn, called an x-vec<strong>to</strong>r,<br />

often occurs in mathematical formulas <strong>and</strong> is formed in math mode with<br />

x_1,\ldots,x_n. Typing<br />

\newcomm<strong>and</strong>{\xvec}{x_1,\ldots,x_n}<br />

creates a new comm<strong>and</strong> named \xvec that may be called <strong>and</strong> used just<br />

like any other comm<strong>and</strong>. When called, it inserts the sequence of text <strong>and</strong><br />

comm<strong>and</strong>s, in this case x_1,\ldots,x_n, in<strong>to</strong> the current text exactly as


186 Chapter 8. User Cus<strong>to</strong>mizations<br />

if one had typed it oneself. In fact, this is precisely what happens: when<br />

\xvec is called, it is its definition that goes in<strong>to</strong> the L AT E X processing.<br />

Since the new comm<strong>and</strong> \xvec contains a math comm<strong>and</strong> (the subscript<br />

comm<strong>and</strong> ), it may only be called within math mode. Thus $\xvec$<br />

is required <strong>to</strong> produce x1, . . . , xn in text mode. It might therefore seem a<br />

good idea <strong>to</strong> include the switching <strong>to</strong> math mode in the definition itself,<br />

as<br />

\newcomm<strong>and</strong>{\xvec}{$x_1,\ldots,x_n$}<br />

Now \xvec yields x1, . . . , xn. However, this comm<strong>and</strong> may only be applied<br />

in text <strong>and</strong> never in math mode. There is a trick <strong>to</strong> enable the comm<strong>and</strong><br />

<strong>to</strong> be called in both modes: define it as<br />

\newcomm<strong>and</strong>{\xvec}{\ensuremath{x_1,\ldots,x_n}}<br />

Now both \xvec <strong>and</strong> $\xvec$ are allowed, both with the same result.<br />

The above text mode example was actually written as \xvec{}, since<br />

TEX treats it as a comm<strong>and</strong> without arguments, terminating its name with<br />

the first non-letter that it finds. If this character is a blank, it only ends<br />

the comm<strong>and</strong> name <strong>and</strong> does not insert interword spacing (Section 2.1).<br />

Thus \xvec <strong>and</strong> ... produces ‘x1, . . . , xn<strong>and</strong> . . . ’ without any spacing<br />

between. This problem is solved by adding a space comm<strong>and</strong> \ or the<br />

empty structure {} after the comm<strong>and</strong> name, in this case as \xvec\<br />

\xvec{}.<br />

or<br />

Package:<br />

It would also have been possible <strong>to</strong> include the blank in the definition of<br />

\xvec, as {\ensuremath{x_1,\ldots,x_n} }. Now the blank following<br />

the comm<strong>and</strong> name is still removed, but the comm<strong>and</strong> itself inserts one<br />

<strong>to</strong> make up for it. However, this is not recommended practice since this<br />

‘programmed’ blank will always be present, even when some punctuation<br />

or other symbol directly follows the comm<strong>and</strong>.<br />

A better solution is provided by the xspace package in the <strong>to</strong>ols<br />

xspace collection (Section B.5.4). With this package, one adds the comm<strong>and</strong><br />

\xspace at the end of a definition where a space may appear:<br />

\newcomm<strong>and</strong>{\xvec}{\ensuremath{x_1,\ldots,x_n}\xspace}<br />

This comm<strong>and</strong> prints a blank unless it is followed by punctuation, in<br />

which case it does nothing.<br />

The different versions of the above example were all illustrated with<br />

the comm<strong>and</strong> \newcomm<strong>and</strong>, although in fact this comm<strong>and</strong> may only be<br />

used once <strong>to</strong> initiate a user-defined comm<strong>and</strong> that does not already exist.<br />

Once \xvec has been created, a revised definition can only be given with<br />

the comm<strong>and</strong> \renewcomm<strong>and</strong>. This was indeed done with the second<br />

<strong>and</strong> subsequent definitions of \xvec.<br />

Following this example, the user may employ \newcomm<strong>and</strong> (or alternatively<br />

\renewcomm<strong>and</strong>) <strong>to</strong> combine any set of comm<strong>and</strong>s <strong>and</strong> text <strong>to</strong><br />

form a comm<strong>and</strong> under a new name that may then be called whenever


8.3. User-defined comm<strong>and</strong>s 187<br />

necessary. In this way, a considerable amount of typing can be avoided<br />

<strong>and</strong> the possibility of error reduced, especially for complex mathematical<br />

structures.<br />

If it is not known whether or not a comm<strong>and</strong> with the chosen name<br />

already exists, one may use instead<br />

\providecomm<strong>and</strong>{\com name}[narg][opt]{def }<br />

which has the same syntax as \newcomm<strong>and</strong> <strong>and</strong> \renewcomm<strong>and</strong>. The<br />

difference is that if the comm<strong>and</strong> already exists, the new definition will<br />

be ignored. The opposite effect (overwriting the current definition of a<br />

comm<strong>and</strong> without knowing if it already exists) can be achieved by first<br />

calling \providecomm<strong>and</strong> <strong>to</strong> ensure the comm<strong>and</strong> exists, <strong>and</strong> then issuing<br />

the true definition with \renewcomm<strong>and</strong>. However, this should be done<br />

only with great care!<br />

Exercise 8.2: Define the comm<strong>and</strong>s \iint, \iiint,<br />

<strong>and</strong> \idotsint, <strong>to</strong> make the multiple integrals shown<br />

at the right as displayed formulas, or as the following<br />

text formulas: , , · · · <br />

<br />

<br />

· · ·<br />

Exercise 8.3: Change the \thechapter, \thesection, <strong>and</strong> \thesubsection<br />

comm<strong>and</strong>s so that for the document classes book <strong>and</strong> report the chapter numbering<br />

is done with capital letters, such as B, the section numbering with capital<br />

Roman numerals after the chapter letter, in the form B–III, <strong>and</strong> the subsection<br />

numbering with lower case Roman numerals following a comma: B–III,v.<br />

Hint: the original versions of these comm<strong>and</strong>s in book <strong>and</strong> report are defined<br />

as<br />

\newcomm<strong>and</strong>{\thechapter}{\arabic{chapter}}<br />

\newcomm<strong>and</strong>{\thesection}{\thechapter.\arabic{section}}<br />

\newcomm<strong>and</strong>{\thesubsection}{\thesection.\arabic{subsection}}<br />

Now apply \renewcomm<strong>and</strong> <strong>to</strong> make the required changes.<br />

8.3.2 Comm<strong>and</strong>s with arguments<br />

In addition <strong>to</strong> the vec<strong>to</strong>r x1, . . . , xn, there are equivalent vec<strong>to</strong>rs y1, . . . , yn<br />

<strong>and</strong> z1, . . . , zn in mathematics. It would be possible <strong>to</strong> define comm<strong>and</strong>s<br />

\yvec <strong>and</strong> \zvec following the pattern for \xvec. However, it is also possible<br />

<strong>to</strong> define a generalized vec<strong>to</strong>r comm<strong>and</strong> <strong>and</strong> <strong>to</strong> specify the variable<br />

part as an argument. In the present example, the variable part is the letter<br />

x, y, or z. A comm<strong>and</strong> with one variable part is created with the optional<br />

argument [1]. For example,<br />

\newcomm<strong>and</strong>{\avec}[1]{\ensuremath{#1_1,\ldots,#1_n}}<br />

defines the general vec<strong>to</strong>r comm<strong>and</strong> \avec{arg}. Calling \avec{x} yields<br />

x1, . . . , xn while invoking \avec{y} prints out y1, . . . , yn. The character


188 Chapter 8. User Cus<strong>to</strong>mizations<br />

#1 in the comm<strong>and</strong> definition is a dummy argument representing the text<br />

of arg that replaces all occurrences of #1 when the comm<strong>and</strong> is called.<br />

By imagining an x or a y at each location of the #1 in the definition, the<br />

desired structures in each case can be recognized.<br />

The digit 1 in the dummy argument #1 seems at first <strong>to</strong> be rather<br />

pointless. In fact, for a comm<strong>and</strong> with only one argument it really has<br />

no meaning. However, its function becomes more obvious for comm<strong>and</strong>s<br />

with multiple arguments. Let us say, for example, that we want a comm<strong>and</strong><br />

<strong>to</strong> generate structures such as u1, . . . , um as well as v1, . . . , vn. This<br />

requires two arguments, one <strong>to</strong> specify the letter u, v, etc., <strong>and</strong> a second<br />

<strong>to</strong> determine the last subscript n, m, <strong>and</strong> so on. Such a comm<strong>and</strong> is<br />

created with<br />

\newcomm<strong>and</strong>{\anvec}[2]{\ensuremath{#1_1,\ldots,#1_#2}}<br />

<strong>and</strong> invoked as \anvec{u}{n} for u1, . . . , un <strong>and</strong> as \anvec{v}{m} for<br />

u1, . . . , um. The optional argument [2] for \newcomm<strong>and</strong> says that the<br />

comm<strong>and</strong> being defined contains two arguments; in the definition part,<br />

#1 is replaced by the first argument <strong>and</strong> #2 by the second. By imagining<br />

u or v in place of #1 <strong>and</strong> n or m where #2 st<strong>and</strong>s, one can see how the<br />

comm<strong>and</strong> \anvec{arg1}{arg2} operates.<br />

This pattern may be carried on for even more arguments. With<br />

\newcomm<strong>and</strong>{\subvec}[3]{\ensuremath{#1_#2,\ldots,#1_#3}}<br />

a comm<strong>and</strong> \subvec is defined with three arguments. It should be clear<br />

from the definition that calling \subvec{a}{i}{j} produces ai, . . . , aj.<br />

A comm<strong>and</strong> argument that consists of only a single character need not be<br />

! put in<strong>to</strong> curly brackets { } but may be given directly. If it is the first argument,<br />

it must be separated from the comm<strong>and</strong> name with a blank, as usual. Thus the<br />

sequence \subvec aik is the same as \subvec{a}{i}{k}, <strong>and</strong> \subvec x1n<br />

produces the same structure x1, . . . , xn as our first user-defined example \xvec.<br />

Arguments must be enclosed in curly brackets { } when they contain more<br />

than one character, since the brackets indicate that the contents are <strong>to</strong> be treated<br />

as a unit. Thus \subvec{A}{ij}{lk} prints out Aij, . . . , Alk. The three replacement<br />

arguments are A for #1, ij for #2, <strong>and</strong> lk for #3.<br />

Why does \subvec{A}{ij}{lk} produce Aij, . . . , Alk <strong>and</strong> not the expected<br />

result Aij, . . . , Alk? The answer is that, although the arguments within curly<br />

brackets are set as units in<strong>to</strong> the definition text, the brackets themselves are<br />

not. The comm<strong>and</strong> text after replacement is \ensuremath{A_ij,\ldots,A_lk}<br />

so that only the first characters following the subscript symbols _ are actually<br />

lowered. In order that both letters be lowered, they must be seen as a unit within<br />

the comm<strong>and</strong> text, that is as A_{ij},. . . ,A_{lk}. This may be achieved with<br />

the \subvec comm<strong>and</strong> by including an extra set of brackets in the arguments:<br />

\subvec{A}{{ij}}{{lk}}. A better solution, however, is <strong>to</strong> put the brackets in<br />

the definition <strong>to</strong> begin with:<br />

\renewcomm<strong>and</strong>{\subvec}[3]{\ensuremath{#1_{#2},\ldots,#1_{#3}}}<br />

which will always produce the desired result with only a single set of brackets<br />

per argument: \subvec{A}{ij}{lk} prints Aij, . . . , Alk.


8.3.3 Comm<strong>and</strong>s with an optional argument<br />

8.3. User-defined comm<strong>and</strong>s 189<br />

As we have seen, many L AT E X comm<strong>and</strong>s may take optional arguments, including<br />

! the comm<strong>and</strong> \newcomm<strong>and</strong> itself. It is also possible <strong>to</strong> define user comm<strong>and</strong>s<br />

with one optional argument. The advantage of this is that, although an argument<br />

is provided, in most applications it will usually take some st<strong>and</strong>ard value that<br />

need not be given explicitly.<br />

As an example, the user-defined vec<strong>to</strong>r comm<strong>and</strong> \subvec in the last section<br />

has three arguments, for the letter <strong>and</strong> for the first <strong>and</strong> last subscripts. However,<br />

it may be that the letter is normally x, so it makes sense <strong>to</strong> include it as an<br />

optional argument, which is <strong>to</strong> be specified only for a different letter. This is<br />

accomplished with<br />

\renewcomm<strong>and</strong>{\subvec}[3][x]<br />

{\ensuremath{#1_{#2},\ldots,#1_{#3}}}<br />

The difference between this <strong>and</strong> the previous definition is the addition of [x]<br />

after the [3] argument. This states that the first of the three arguments is <strong>to</strong> be<br />

optional, <strong>and</strong> its st<strong>and</strong>ard value is x. Now \subvec{i}{j} prints xi, . . . , xj while<br />

\subvec[a]{1}{n} produces a1, . . . , an.<br />

There may only be one optional argument in the user-defined comm<strong>and</strong>, <strong>and</strong><br />

it will always be the first one, the #1 in the definition.<br />

8.3.4 Additional examples of user-defined comm<strong>and</strong>s<br />

In the above explanation of user-defined comm<strong>and</strong>s, a very simple case<br />

of a vec<strong>to</strong>r structure was taken as an example. We would now like <strong>to</strong><br />

demonstrate some more complex situations, in which counters, lengths,<br />

<strong>and</strong> even some special T E X comm<strong>and</strong>s are applied.<br />

Example 1: In Section 5.4.6, the T E X comm<strong>and</strong>s \a<strong>to</strong>p <strong>and</strong> \choose were<br />

presented as useful mathematical comm<strong>and</strong>s even for L AT E X applications.<br />

Unfortunately, the syntax of these comm<strong>and</strong>s deviates considerably from<br />

that of the similar L AT E X comm<strong>and</strong> \frac. However,<br />

\newcomm<strong>and</strong>{\la<strong>to</strong>p}[2]{{#1\a<strong>to</strong>p#2}} <strong>and</strong><br />

\newcomm<strong>and</strong>{\lchoose}[2]{{#1\choose#2}}<br />

define two comm<strong>and</strong>s \la<strong>to</strong>p <strong>and</strong> \lchoose that yield the same results<br />

with a syntax like that of L AT E X: \la<strong>to</strong>p{upper}{lower}.<br />

Example 2: The comm<strong>and</strong> \defbox{sample text} is <strong>to</strong> set a box width<br />

equal <strong>to</strong> the length of the text sample text. A subsequent call <strong>to</strong> the<br />

comm<strong>and</strong> \textbox{text} centers text within a frame with the same<br />

width as sample text.<br />

\newlength{\wdth}<br />

\newcomm<strong>and</strong>{\defbox}[1]{\set<strong>to</strong>width{\wdth}{#1}}<br />

\newcomm<strong>and</strong>{\textbox}[1]{\framebox[\wdth]{#1}}


190 Chapter 8. User Cus<strong>to</strong>mizations<br />

First, a new length parameter \wdth is created, then \defbox is defined<br />

so that \wdth is set equal <strong>to</strong> the length of its argument (Section 8.2), <strong>and</strong><br />

finally \textbox makes a framed box of that same width containing its<br />

argument, centered. (Do not name the length parameter \width, for this<br />

already exists, Section 4.7.5.)<br />

as wide as this text\\<br />

\defbox{as wide as this text}\textbox{}\\<br />

\textbox{text}\\<br />

\textbox{longer text}<br />

as wide as this text<br />

text<br />

longer text<br />

Example 3: A footnote comm<strong>and</strong> \myftnote is <strong>to</strong> be created that behaves<br />

as the normal comm<strong>and</strong> \footnote{text} in putting text in<strong>to</strong> a footnote,<br />

but instead of using numbers as the marker, it should take the symbols<br />

∗ † ‡ § ∗∗ †† ‡‡ one after the other, starting again with the symbol ∗<br />

on each new page. First a new counter must be established that will be<br />

reset <strong>to</strong> zero every time the page counter is incremented. This is done<br />

with (see Section 8.1.2)<br />

\newcounter{myfn}[page]<br />

making a user-defined counter myfn that is set <strong>to</strong> zero every time the<br />

page counter is incremented. ∗ Next the comm<strong>and</strong><br />

\renewcomm<strong>and</strong>{\thefootnote}{\fnsymbol{footnote}}<br />

redefines the footnote marker <strong>to</strong> be that symbol in the sequence given<br />

by the counter footnote (Sections 4.10.2 <strong>and</strong> 8.1.4). Now the actual new<br />

footnote comm<strong>and</strong> can be constructed with<br />

\newcomm<strong>and</strong>{\myftnote}[1]{\setcounter{footnote}{\value{myfn}}%<br />

\footnote{#1}\stepcounter{myfn}}<br />

yielding the desired results. The user-defined comm<strong>and</strong> \myftnote possesses<br />

one argument, which is passed <strong>to</strong> the L AT E X \footnote comm<strong>and</strong><br />

after the L AT E X counter footnote has been set equal <strong>to</strong> the value of the<br />

user counter myfn. Once the comm<strong>and</strong> \footnote has been executed,<br />

the counter myfn is then incremented by one with \stepcounter{myfn}.<br />

This counter, however, is reset <strong>to</strong> zero whenever the page counter is<br />

incremented, that is, whenever a new page begins.<br />

The footnote on the previous page was generated with the comm<strong>and</strong><br />

\myftnote as described. It is now used here † <strong>and</strong> again here ‡ , demonstrating<br />

how the symbols have been reset on a new page.<br />

Example 4: A comm<strong>and</strong> \alpheqn is <strong>to</strong> be set up so that once it has been<br />

called, the subsequent equations will all have the same number but be<br />

∗ Actually the page counter is not incremented exactly at the end of the page; LAT E X reads<br />

in the whole paragraph before it decides if <strong>and</strong> where a page break should occur. This can<br />

cause problems with resetting the myfn counter near the <strong>to</strong>p of a page.<br />

† another footnote<br />

‡ <strong>and</strong> yet another footnote


8.3. User-defined comm<strong>and</strong>s 191<br />

followed by letters a, b, . . . , separated by a hyphen ‘-’ from the number.<br />

The comm<strong>and</strong> \reseteqn res<strong>to</strong>res the numbering scheme <strong>to</strong> its original<br />

style. Thus a sequence of equation numbers could be 4, 5, 6-a, 6-b, 7.<br />

\newcounter{saveeqn}<br />

\newcomm<strong>and</strong>{\alpheqn}{\setcounter{saveeqn}{\value{equation}}%<br />

\stepcounter{saveeqn}\setcounter{equation}{0}%<br />

\renewcomm<strong>and</strong>{\theequation}<br />

{\mbox{\arabic{saveeqn}-\alph{equation}}}}<br />

\newcomm<strong>and</strong>{\reseteqn}{\setcounter{equation}{\value{saveeqn}}%<br />

\renewcomm<strong>and</strong>{\theequation}{\arabic{equation}}}<br />

The example should be easy <strong>to</strong> comprehend with the help of the comm<strong>and</strong>s<br />

<strong>and</strong> counters in Section 8.1. The current value of counter equation<br />

is saved in the counter saveeqn <strong>and</strong> then incremented, while equation<br />

itself is set <strong>to</strong> zero. The form of the equation marker, \theequation, is<br />

redefined using these two counters. The equation numbering routines will<br />

operate on equation as usual, leaving saveeqn unchanged. The resetting<br />

comm<strong>and</strong> \reseteqn puts the value of saveeqn back in<strong>to</strong> equation <strong>and</strong><br />

res<strong>to</strong>res the definition of \theequation.<br />

This example is only appropriate for the document class article. For<br />

report <strong>and</strong> book, the definition of \theequation is<br />

\arabic{chapter}.\arabic{equation}<br />

The necessary modifications are left as an exercise for the user.<br />

The \mbox comm<strong>and</strong> in the first \renewcomm<strong>and</strong>{\theequation} defining<br />

! the combined equation number is necessary because the result will be printed<br />

in math mode, where the hyphen ‘-’ is interpreted as a binary opera<strong>to</strong>r (minus<br />

sign) with extra spacing between it <strong>and</strong> its two ‘oper<strong>and</strong>s’, \arabic{saveeqn}<br />

<strong>and</strong> \alph{equation}. Thus 6 − a would be output instead of 6-a. The \mbox<br />

comm<strong>and</strong> causes a temporary switch out of math in<strong>to</strong> text mode.<br />

Example 5: In Section 5.4.10, the international st<strong>and</strong>ards for mathematical<br />

typesetting are outlined, in which tensor <strong>and</strong> matrix variables should<br />

be set in a sans serif typeface, preferably italic or slanted. The math<br />

alphabet comm<strong>and</strong> \mathsf accomplishes this only for an upright font.<br />

The solution is <strong>to</strong> create a new math alphabet \mathsfsl for use in a<br />

\tensor comm<strong>and</strong>.<br />

\DeclareMathAlphabet{\mathsfsl}{OT1}{cmss}{m}{sl}<br />

\newcomm<strong>and</strong>{\tensor}[1]{\mathsfsl{#1}}<br />

The NFSS system of font attributes is presented in Section A.1, <strong>and</strong> the<br />

\DeclareMathAlphabet comm<strong>and</strong> is explained in Section A.3.3.<br />

The Computer Modern sans serif fonts do not possess an italic form<br />

which is why the slanted shape is taken instead. If one were <strong>to</strong> select<br />

italic with {i} in place of {sl}, L AT E X would au<strong>to</strong>matically substitute the<br />

slanted version.


192 Chapter 8. User Cus<strong>to</strong>mizations<br />

In Section 5.4.10, several new comm<strong>and</strong>s are suggested <strong>to</strong> simplify<br />

typing math according <strong>to</strong> the ISO st<strong>and</strong>ard. These are:<br />

\newcomm<strong>and</strong>{\me}{\mathrm{e}}<br />

\newcomm<strong>and</strong>{\mi}{\mathrm{i}}<br />

\newcomm<strong>and</strong>{\dif}{\mathrm{d}}<br />

\renewcomm<strong>and</strong>{\vec}[1]{\boldsymbol{#1}}<br />

These permit the constants e, i, <strong>and</strong> differential opera<strong>to</strong>r d <strong>to</strong> be printed<br />

upright, <strong>and</strong> not italic. The redefinition of the \vec comm<strong>and</strong> requires<br />

the A M S math package amsbsy, either directly or as part of the amsmath<br />

package (Chapter 12).<br />

Here one could also include the abbreviation for the electron volt,<br />

mentioned on page 30, <strong>and</strong> its multiples:<br />

\newcomm<strong>and</strong>{\eV}{\mbox{e\hspace{-.12em}V}}<br />

\newcomm<strong>and</strong>{\keV}{\mbox{k\eV}}<br />

\newcomm<strong>and</strong>{\MeV}{\mbox{M\eV}}<br />

If these comm<strong>and</strong>s are used frequently in many different documents,<br />

we recommend saving them in a separate file, say isomath.tex, <strong>to</strong> be<br />

input at the start of those documents, with \input{isomath}.<br />

Exercise 8.4: Define L AT E X comm<strong>and</strong>s \Lbrack <strong>and</strong> \Lbrace in the same manner<br />

as in Example 1 for \la<strong>to</strong>p <strong>and</strong> \lchoose corresponding <strong>to</strong> the T E X comm<strong>and</strong>s<br />

\brack <strong>and</strong> \brace. These T E X comm<strong>and</strong>s behave as \choose from Section 5.4.6<br />

except that they enclose their contents in square brackets [\Lbrack] or curly<br />

braces {\Lbrace}. (Note that the names \lbrack <strong>and</strong> \lbrace are already<br />

defined <strong>and</strong> so should not be used for these comm<strong>and</strong>s.)<br />

Exercise 8.5: Generalize Example 4 with a comm<strong>and</strong> \vareqn{num}{type} <strong>to</strong><br />

make the subsequent equation numbers have the value num followed by a running<br />

number in square brackets printed as \alph . . . \Roman, as given by the argument<br />

type. For example, 33[A], 33[B], would result from calling \vareqn{33}{\Alph}.<br />

Exercise 8.6: Generalize the integral comm<strong>and</strong>s in Exercise<br />

8.2 <strong>to</strong> include an argument <strong>to</strong> represent the area<br />

of integration set centered below the entire symbol.<br />

Thus \iint{(D)}, \iiint{V}, <strong>and</strong> \idotsint{G}<br />

should produce:<br />

<br />

(D)<br />

<br />

<br />

V<br />

<br />

· · ·<br />

G<br />

Hint: the second comm<strong>and</strong> can be made simply with a subscript on the middle<br />

integral (but see \limits in Section 5.2.5). For the other two, negative horizontal<br />

shifting of the subscripted symbol is needed using \hspace{-..}.<br />

Exercise 8.7: The \tensor comm<strong>and</strong> defined in Example 5 above sets tensor<br />

variables in a slanted, sans serif font. If matrices are <strong>to</strong> be set instead in an<br />

upright, sans serif font, define a comm<strong>and</strong> \mtrx <strong>to</strong> produce this.<br />

Note: do not name this comm<strong>and</strong> \matrix because that already exists <strong>to</strong> produce<br />

matrices, not their variable names.


8.3.5 Conditional text<br />

8.3. User-defined comm<strong>and</strong>s 193<br />

Package: Practiced TEX users will be familiar with the conditional comm<strong>and</strong>s that<br />

ifthen are available, both for TEX <strong>and</strong> LAT EX. However, their usage is not always<br />

straightforward <strong>and</strong> often requires extensive knowledge of TEX’s deeper<br />

principles. Leslie Lamport has provided a package named ifthen, extended<br />

by David Carlisle, which not only simplifies their application, but<br />

also gives them a LAT EX syntax.<br />

The package is loaded as usual with the comm<strong>and</strong><br />

\usepackage{ifthen}<br />

in the preamble. It then makes available the two comm<strong>and</strong>s \ifthenelse<br />

<strong>and</strong> \whiledo, which have the following syntaxes:<br />

\ifthenelse{test}{then text}{else text}<br />

\whiledo{test}{do text}<br />

In both cases, test is a logical statement (explained below); for the first<br />

comm<strong>and</strong>, then text or else text is inserted in<strong>to</strong> the text depending on<br />

whether test is 〈true〉 or 〈false〉. For the second comm<strong>and</strong>, the do text is<br />

inserted (executed) as long as test evaluates <strong>to</strong> 〈true〉. (The do text must<br />

alter the inputs <strong>to</strong> test or it will never s<strong>to</strong>p!) The texts may also contain<br />

comm<strong>and</strong>s, or even define or redefine comm<strong>and</strong>s.<br />

There are four types of basic logical statements which may be combined<br />

<strong>to</strong> form more complicated ones.<br />

Testing numbers<br />

To compare two numbers or comm<strong>and</strong>s that evaluate <strong>to</strong> numbers, simply<br />

put one of the relational opera<strong>to</strong>rs between them, which st<strong>and</strong><br />

for less than, equals, <strong>and</strong> greater than, respectively. The value of a<br />

counter may be tested by putting its name as the argument of the \value<br />

comm<strong>and</strong>. Examples:<br />

\newcomm<strong>and</strong>{\three}{3}<br />

\ifthenelse {\three = 3} {O.K.} {What?}<br />

\ifthenelse {\value{page} < 100 }<br />

{Page xx} {Page xxx}<br />

The first case prints ‘O.K.’ since \three is equal <strong>to</strong> 3; in the second<br />

case Page xx is printed if the current page number is less than 100, else<br />

Page xxx. (The blanks above are added for clarity, since spaces between<br />

arguments are always ignored.)<br />

Whether a number is even or odd can be tested with \isodd<br />

\ifthenelse {\isodd{\value{page}}<br />

{odd} {even}


194 Chapter 8. User Cus<strong>to</strong>mizations<br />

Testing text<br />

To test if two comm<strong>and</strong>s evaluate <strong>to</strong> the same piece of text, or if a<br />

comm<strong>and</strong> is defined as a certain string of text, use<br />

\equal{string1}{string2}<br />

where string1 <strong>and</strong> string2 are texts or comm<strong>and</strong>s that reduce <strong>to</strong> text. For<br />

example, with<br />

\ifthenelse {\equal{\name}{Fred}} {Frederick} {??}<br />

the text Frederick is inserted if \name has been defined <strong>to</strong> be Fred (with<br />

\newcomm<strong>and</strong>), otherwise two question marks are printed.<br />

Testing lengths<br />

Another logical statement compares two lengths.<br />

\lengthtest{relation}<br />

where relation consists of two lengths or length comm<strong>and</strong>s separated by<br />

a relational opera<strong>to</strong>r . For example,<br />

\newlength{\horiz} \newlength{\vert}<br />

\newlength{\min}<br />

. . . . . . .<br />

\ifthenelse {\lengthtest{\horiz > \vert}}<br />

{\setlength{\min}{\vert}} {\setlength{\min}{\horiz}<br />

sets \min <strong>to</strong> be the smaller of \horiz <strong>and</strong> \vert.<br />

Testing switches<br />

A boolean switch is a parameter that is either 〈true〉 or 〈false〉, also called<br />

a flag. Three comm<strong>and</strong>s exist <strong>to</strong> h<strong>and</strong>le them:<br />

\newboolean{string} creates a new switch<br />

\setboolean{string}{value} assigns a value true or false<br />

\boolean{string} tests its value<br />

The last of these is used as test in \ifthenelse <strong>and</strong> \whiledo.<br />

There are a number of internal L AT E X switches that may also be tested<br />

(but never reset!). The most useful of these are @twoside <strong>and</strong> @twocolumn<br />

for checking if two-side or two-column modes are active. Since they<br />

contain the character @, they may only be used inside a class or package<br />

file (Appendix D).


Combining logical statements<br />

8.4. User-defined environments 195<br />

Any of the above logical statements may be combined <strong>to</strong> form a more<br />

complex statement by means of the logical opera<strong>to</strong>rs<br />

\<strong>and</strong> \or \not \( \)<br />

which should be straightforward <strong>to</strong> anyone familiar with boolean logic.<br />

For example, <strong>to</strong> set \textwidth <strong>to</strong> 10 cm if two-column mode is active or<br />

if \paperwidth is greater than 15 cm <strong>and</strong> the page counter is below 100,<br />

\ifthenelse {\lengthtest{\textwidth > 10cm} \or<br />

\( \lengthtest{\paperwidth > 15cm} \<strong>and</strong><br />

\value{page} < 100 \) }<br />

{\setlength{\textwidth}{10cm}} {}<br />

will accomplish this.<br />

Such conditionals are fairly complicated, <strong>and</strong> they are most appropriate<br />

for defining new comm<strong>and</strong>s that may have alternative actions, or for<br />

including in package <strong>and</strong> class files (Appendix D).<br />

A relatively simple example: suppose one is uncertain whether British<br />

or American spelling is wanted by the publisher. One can write the<br />

document with both included in the text, with a switch in the preamble<br />

<strong>to</strong> make the final selection.<br />

\newboolean{US}<br />

\setboolean{US}{true} %For American spelling<br />

%\setboolean{US}{false} %For British spelling<br />

\newcomm<strong>and</strong>{\USUK}[2]{\ifthenelse{\boolean{US}}{#1}{#2}}<br />

Now \USUK is a comm<strong>and</strong> that prints its first or second argument according<br />

<strong>to</strong> the setting of the flag US. Thus in the text one may write<br />

... the \USUK{color}{colour} of music ...<br />

which will yield American spelling if \setboolean{US}{true} has been<br />

specified, otherwise the British version. In fact, different sections of the<br />

work could have different spelling simply by changing the value of the<br />

switch at the appropriate point.<br />

As an example of \whiledo: one wishes <strong>to</strong> write some text n times,<br />

where both the text <strong>and</strong> n are <strong>to</strong> be variable.<br />

\newcounter{mycount}<br />

\newcomm<strong>and</strong>{\replicate}[2]{\setcounter{mycount}{#1}<br />

\whiledo{\value{mycount}>0}{#2\add<strong>to</strong>counter{mycount}{-1}}}<br />

Now \replicate{30}{?} will print 30 question marks.<br />

8.4 User-defined environments<br />

Environments may be created or changed with the comm<strong>and</strong>s


196 Chapter 8. User Cus<strong>to</strong>mizations<br />

\newenvironment{env name}[narg][opt]{beg def }{end def }<br />

\renewenvironment{env name}[narg][opt]{beg def }{end def }<br />

where the arguments have the following meanings:<br />

env name: the name of the environment; for \newenvironment, it may<br />

not be the same as any existing environment or comm<strong>and</strong> name,<br />

whether L AT E X or user-defined. For \renewenvironment, on the other<br />

h<strong>and</strong>, there must already be an environment bearing this name. Any<br />

changes <strong>to</strong> L AT E X environments should only be undertaken if the user<br />

knows what he or she is doing.<br />

narg: a number between 1 <strong>and</strong> 9 that states how many arguments the<br />

environment is <strong>to</strong> have; if the optional argument narg is omitted,<br />

the environment is <strong>to</strong> have no arguments.<br />

opt: the default text for the first argument (#1) if it is <strong>to</strong> be optional; this<br />

behaves the same as for \(re)newcomm<strong>and</strong> (page 185).<br />

beg def: the initial text <strong>to</strong> be inserted when \begin{env name} is called;<br />

if this text contains entries of the form #n, with n = 1, . . .,narg, then<br />

when the environment is started with the call<br />

\begin{env name}{arg 1}...{arg n}...<br />

each occurrence of #n within beg def is replaced by the text of the<br />

argument arg n.<br />

end def: the final text that is inserted when \end{env name} is called;<br />

here the dummy arguments #n are not allowed since they are only<br />

<strong>to</strong> appear in the beg def text.<br />

8.4.1 Environments without arguments<br />

Just as for user-defined comm<strong>and</strong>s, environments without the optional<br />

argument narg will be illustrated first. A user-defined environment named<br />

sitquote is created with<br />

\newenvironment{sitquote}{\begin{quote}\small<br />

\itshape}{\end{quote}}<br />

which sets the text appearing between \begin{sitquote} text \end<br />

{sitquote} in the typeface \small\itshape, <strong>and</strong> indented on both<br />

sides from the main margins, as demonstrated here.<br />

In this case, beg def consists of the comm<strong>and</strong> sequence \begin{quote}<br />

\small\itshape while end def is simply \end{quote}. Now the call<br />

\begin{sitquote} text \end{sitquote} is the same as<br />

\begin{quote}\small\itshape text \end{quote}


8.4. User-defined environments 197<br />

which produces the desired result.<br />

This example does not appear <strong>to</strong> be very practical since the same<br />

effect can be achieved with less typing by adding \small\itshape at<br />

the beginning of the quote environment. However, it is more consistent<br />

with the concept of logical markup introduced in Section 1.2.2. This<br />

special quotation environment may be used throughout the document<br />

without worrying about its typographical details, which are specified in<br />

its definition located in the document preamble. Doing it this way not<br />

only ensures consistency, it also simplifies any substitution that may be<br />

dem<strong>and</strong>ed later by a typographical expert.<br />

Let us exp<strong>and</strong> the previous example somewhat as follows:<br />

\newcounter{com}<br />

\newenvironment{comment}<br />

{\noindent\slshape Comment:\begin{quote}\small\itshape}<br />

{\stepcounter{com}\hfill(\arabic{com})\end{quote}}<br />

where now beg def contains the text <strong>and</strong> comm<strong>and</strong>s<br />

\noindent\slshape Comment:\begin{quote}\small\itshape<br />

<strong>and</strong> end def is<br />

\stepcounter{com}\hfill(\arabic{com})\end{quote}<br />

where com is a user counter created by the \newcounter comm<strong>and</strong>. Now<br />

since the comm<strong>and</strong> \begin{comment} inserts the text beg def at the start<br />

of the environment <strong>and</strong> \end{comment} the text end def at the finish, it<br />

should be clear that<br />

\begin{comment} This is a comment.<br />

Comments should ...<br />

... in round parentheses.<br />

\end{comment}<br />

will generate the following type of structure:<br />

Comment:<br />

This is a comment. Comments should be preceded by the word Comment:<br />

the text being in a small, italic typeface, indented on both sides<br />

from the main margins. Each comment receives a running comment<br />

number at the lower right in round parentheses. (1)<br />

The user should examine the sequence of comm<strong>and</strong>s with the replacement<br />

text of this example <strong>to</strong> see precisely what the effect of this<br />

environment is. Two weaknesses should become apparent: what would<br />

happen if \begin{comment} were called in the middle of a line of text<br />

without a blank line before, <strong>and</strong> what would happen if the last line of the<br />

comment text were so long that there was no more room for the running<br />

comment number on the same line?<br />

The following revision removes these two problems:


198 Chapter 8. User Cus<strong>to</strong>mizations<br />

\renewenvironment{comment}<br />

{\begin{sloppypar}\noindent\slshape Comment:<br />

\begin{quote}\small\itshape}<br />

{\stepcounter{com}\hspace*{\fill}(\arabic{com})\end{quote}<br />

\end{sloppypar}}<br />

With the \begin{sloppypar} comm<strong>and</strong>, the call <strong>to</strong> the environment<br />

always starts a new paragraph in which no overfull line can occur upon<br />

line breaking. If the comment number does not fit on the last line of<br />

text, a new line begins with the number right justified because of the<br />

comm<strong>and</strong> \hspace*{\fill}. Again the user should examine carefully<br />

just what is inserted in<strong>to</strong> the processing between the \begin{comment}<br />

<strong>and</strong> the \end{comment}.<br />

8.4.2 Environments with arguments<br />

Passing arguments over <strong>to</strong> an environment is carried out exactly as for<br />

comm<strong>and</strong>s. As an example, the comment environment will be modified so<br />

that the name of the person making the comment is added after the word<br />

Comment:, <strong>and</strong> this name will be an argument when the environment is<br />

invoked.<br />

\renewenvironment{comment}[1]<br />

{\begin{sloppypar}\noindent\slshape Comment: #1<br />

\begin{quote}\small\itshape}<br />

{\stepcounter{com}\hspace*{\fill}(\arabic{com})%<br />

\end{quote}\end{sloppypar}}<br />

The text<br />

\begin{comment}{Helmut Kopka} This is a modified ...<br />

... environment argument \end{comment}<br />

now produces<br />

Comment: Helmut Kopka<br />

This is a modified comment. Comments should be preceded by the<br />

word Comment:, followed by the name of the commenter, with the text<br />

of the comment being in a small, italic typeface, indented on both sides<br />

from the main margins. Each comment receives a running comment<br />

number at the lower right in round parentheses. The name of the<br />

commenter is transferred as an environment argument. (2)<br />

This example will now be modified once again by interchanging the<br />

comment number <strong>and</strong> the name of the commenter. Placing the running<br />

number after the word Comment: is no problem, for it is simply necessary<br />

<strong>to</strong> insert those comm<strong>and</strong>s from {end def } at the location of the #1 dummy<br />

argument. However, putting the symbol #1 where the comment number<br />

used <strong>to</strong> be will produce an error message during the L AT E X processing since


8.4. User-defined environments 199<br />

this violates the syntax of the \newenvironment comm<strong>and</strong>: ‘No dummy<br />

arguments shall appear within the {end def}.’ If the dummy argument<br />

comes after \begin{quote}, the name will be printed at the wrong place,<br />

at the beginning of the comment text.<br />

There is a trick <strong>to</strong> solve this problem:<br />

\newsavebox{\comname}<br />

\renewenvironment{comment}[1]<br />

{\begin{sloppypar}\noindent\stepcounter{com}\slshape<br />

Comment \arabic{com}\sbox{\comname}{#1}<br />

\begin{quote}\small\itshape}<br />

{\hspace*{\fill}\usebox{\comname}\end{quote}\end{sloppypar}}<br />

The comm<strong>and</strong>s \newsavebox, \sbox, <strong>and</strong> \usebox are all described in<br />

Section 4.7.1. Here \comname is the name of a box that has been created<br />

with \newsavebox, in which the first argument, the commenter’s name,<br />

is s<strong>to</strong>red. With this new definition, a comment now appears as follows:<br />

Comment 3<br />

In this form, every comment is assigned a sequential number after<br />

the word Comment. The comment text appears as before, while the<br />

name of the commenter is entered as the environment argument <strong>and</strong><br />

is placed at the right of the last line. Helmut Kopka<br />

The implementation of more than one argument for environments is<br />

the same as for comm<strong>and</strong>s <strong>and</strong> needs no further explanation.<br />

8.4.3 Environments with an optional argument<br />

Similarly, environments may be defined with an optional argument, just<br />

as comm<strong>and</strong>s. To take our last example once more, if we feel that most<br />

comments will be made by Helmut Kopka, we could alter the first line of<br />

the definition <strong>to</strong><br />

\renewenvironment{comment}[1][Helmut Kopka]{..}{..}<br />

Now it is only necessary <strong>to</strong> specify the name of the commenter if it is<br />

someone else. With<br />

we obtain<br />

\begin{comment}[Patrick W. Daly]More than ...<br />

... appropriate.\end{comment}<br />

Comment 4<br />

More than one person may want <strong>to</strong> make a comment, but perhaps<br />

one person makes more than others do. An optional argument for the<br />

name is then appropriate. Patrick W. Daly


200 Chapter 8. User Cus<strong>to</strong>mizations<br />

Exercise 8.8: Extend the definition of the comment environment so that a page<br />

break cannot occur either between the heading ‘Comment n’ <strong>and</strong> the comment<br />

text or between the comment text <strong>and</strong> the commenter’s name.<br />

Exercise 8.9: Create a new environment making use of the minipage environment,<br />

<strong>to</strong> be named varpage <strong>and</strong> possessing one argument that is a sample text<br />

<strong>to</strong> determine the width of the minipage. The call<br />

\begin{varbox}{‘As wide as this sample text’}<br />

. . . . . . . . . . . . . . . . . . .\end{varbox}<br />

should pack the enclosed text in<strong>to</strong> a minipage that has a width equal <strong>to</strong> that of<br />

the text ‘As wide as this sample text’.<br />

Hint: a user-defined length parameter must first be established, say \varwidth.<br />

See Section 8.2 for details on assigning lengths <strong>to</strong> text widths.<br />

Exercise 8.10: Generate an environment named varlist with two arguments<br />

that behaves as a generalization of the sample list in Section 4.4.3. The first<br />

argument is <strong>to</strong> be the item word that is printed on each call <strong>to</strong> \item; the second<br />

is the numbering style of the item numeration. For example, with the call<br />

\begin{varlist}{Sample}{\Alph} . . . . . \end{varlist}<br />

every \item comm<strong>and</strong> within the environment should produce the sequence<br />

‘Sample A’, ‘Sample B’, . . . . The indentation should be 1 cm larger than the width<br />

of the item word, which itself should be left justified within the label box.<br />

Hint: once again a user-defined length, say \itemwidth, is necessary for this<br />

solution. After the length of the item word has been s<strong>to</strong>red with \set<strong>to</strong>width,<br />

the indentation may be set with<br />

\setlength{\leftmargin}{\itemwidth}<br />

<strong>to</strong> be equal <strong>to</strong> the width of the item word, <strong>and</strong> then with<br />

\add<strong>to</strong>length{\leftmargin}{1cm}<br />

<strong>to</strong> be 1 cm larger. Length assignments for \labelwidth <strong>and</strong> \labelsep may be<br />

similarly set <strong>to</strong> appropriate values.<br />

All further details may be obtained from Section 4.4.<br />

8.5 Some comments on user-defined structures<br />

8.5.1 Reusing sets of definitions<br />

User definitions are created <strong>to</strong> alter page formats, <strong>to</strong> reorganize the document<br />

layout, <strong>to</strong> invent new structures, <strong>and</strong> <strong>to</strong> define shortcuts. That<br />

is, they either directly specify typographical elements like the text width,<br />

or indicate how new or existing logical elements are <strong>to</strong> be rendered typographically.<br />

As such, they belong in the preamble, where they can be<br />

conveniently redefined as needed, effecting the entire document.<br />

Once a set of user definitions has been established, what is the best<br />

way <strong>to</strong> reuse them? There are several possibilities:


8.5. Some comments on user-defined structures 201<br />

1. Write a new class file based on an existing one, incorporating the<br />

your own changes. This should be reserved for major changes <strong>to</strong> the<br />

layout or document organization, which will be used very frequently.<br />

2. Write your definitions <strong>to</strong> a package file with the extension.sty <strong>to</strong> be<br />

loaded with the \usepackage comm<strong>and</strong>. You can take advantage of<br />

special package features, like internal comm<strong>and</strong>s <strong>and</strong> options.<br />

3. Write the definitions <strong>to</strong> a file with the extension.tex <strong>and</strong> load it with<br />

\input{filename}. No extra features are possible, <strong>and</strong> the file can<br />

be loaded anywhere within the source file.<br />

4. Just copy the definitions from one source file <strong>to</strong> the next.<br />

Methods 1 <strong>and</strong> 2 are more sophisticated, <strong>and</strong> should be considered for<br />

user definitions that have a wide generality. They are explained in Appendix<br />

D. Method 3 is perfectly good for a personal collection of shortcut<br />

comm<strong>and</strong>s, or common (re)definitions that are applied <strong>to</strong> many documents.<br />

By having one deposi<strong>to</strong>ry for all such cus<strong>to</strong>mizations, it is easier<br />

<strong>to</strong> maintain them centrally.<br />

Finally method 4 is applicable for a short list of uncomplicated definitions.<br />

8.5.2 Unwanted spaces<br />

Occasionally user-defined structures generate spacing where none was<br />

expected, or more spacing than was desired. This is almost always due<br />

<strong>to</strong> blanks or new lines in the definition, included only <strong>to</strong> improve the<br />

legibility of the input text but interpreted as spacing when the structure<br />

is invoked.<br />

For example, if the % character had been left out of the first line of the<br />

\myftnote definition on page 190, a new line would have been added <strong>to</strong><br />

the comm<strong>and</strong> text at that point, <strong>and</strong> converted in<strong>to</strong> a blank. This blank<br />

would be inserted between the previous word which should receive the<br />

footnote marker <strong>and</strong> the call <strong>to</strong> the \footnote comm<strong>and</strong> that actually<br />

generates the marker, with the result that it would be displaced from that<br />

word (for example, wrong ∗ instead of right ∗ ).<br />

At this point we should like <strong>to</strong> point out that many L AT E X comm<strong>and</strong>s are<br />

! invisible, in that they do not produce any text at the point where they are called.<br />

If such an invisible comm<strong>and</strong> is given separated by blanks from the surrounding<br />

text, it is possible that two blanks will appear.<br />

For example \rule{0pt}{0pt} produces<br />

‘For example produces’ twice the interword spacing between ‘example’ <strong>and</strong><br />

‘produces’. Invisible comm<strong>and</strong>s without arguments do not present this problem<br />

since the trailing blank acts solely as a comm<strong>and</strong> name termina<strong>to</strong>r <strong>and</strong> disappears.<br />

Furthermore, the following L AT E X comm<strong>and</strong>s <strong>and</strong> environments always remove the<br />

subsequent blanks even when arguments are present.


202 Chapter 8. User Cus<strong>to</strong>mizations<br />

\pagebreak \linebreak \label \glossary \vspace figure<br />

\nopagebreak \nolinebreak \index \marginpar table<br />

8.5.3 Identical comm<strong>and</strong> <strong>and</strong> counter names<br />

In the previous examples a number of counters were introduced for<br />

application <strong>to</strong> specific comm<strong>and</strong>s or environments, such as myfn for the<br />

comm<strong>and</strong> \myfootnote on page 190, or com for the environment comment<br />

on page 197. In these cases, the counter <strong>and</strong> the corresponding comm<strong>and</strong><br />

or environment were given different names. This was not necessary:<br />

counters may have a name that is identical <strong>to</strong> that of a comm<strong>and</strong> or<br />

environment. L AT E X knows from the context whether the name refers <strong>to</strong> a<br />

counter or <strong>to</strong> a comm<strong>and</strong>/environment.<br />

The different names were chosen in the examples in order <strong>to</strong> avoid<br />

confusion for the beginner. In fact, it is reasonable <strong>to</strong> give a counter the<br />

same name as the comm<strong>and</strong> or environment with which it is coupled, a<br />

practice that L AT E X itself constantly employs (Section 8.1.1). In the abovementioned<br />

examples, the counters could just as easily have been named<br />

myfootnote <strong>and</strong> comment <strong>to</strong> emphasize their interdependence with the<br />

comm<strong>and</strong> <strong>and</strong> environment of the same names.<br />

8.5.4 Scope of user definitions<br />

User structures that are defined within the preamble are valid for the<br />

entire document. Comm<strong>and</strong> <strong>and</strong> environment definitions that are made<br />

inside an environment remain in effect only until its end. Even their<br />

names are unknown <strong>to</strong> L AT E X outside the environment in which they were<br />

defined. Thus if they are <strong>to</strong> be defined once again in another environment,<br />

it is \newcomm<strong>and</strong> or \newenvironment that must be used <strong>and</strong> not the<br />

\renew versions.<br />

For comm<strong>and</strong> <strong>and</strong> environment names that have been globally defined,<br />

that is, in the preamble, all further new definitions of these names must<br />

be made with the \renew version. However, these subsequent definitions<br />

will apply only locally within the environment in which they are declared;<br />

outside, the previous global definitions will be valid once more.<br />

The same applies <strong>to</strong> structure definitions within nested environments.<br />

A definition in the outer environment is effective within all inner ones, but<br />

a new definition must be made at the deeper levels with \renewcomm<strong>and</strong><br />

or \renewenvironment. On leaving the inner environment, the new<br />

definition will no longer be operative, but rather the old one will be<br />

re-established.<br />

Warning: Structures that have been created with \newsavebox or with<br />

\newcounter are globally defined. If they are given within an environment,<br />

their definitions remain effective even outside that environment.<br />

Similarly \setcounter functions globally, although \savebox does not.


8.5. Some comments on user-defined structures 203<br />

Local definitions are really not <strong>to</strong> be recommended. It is far better <strong>to</strong><br />

place all user definitions at the beginning, in the preamble, where they<br />

are most easily visible. A local redefinition of a st<strong>and</strong>ard comm<strong>and</strong> can<br />

lead <strong>to</strong> puzzling effects that are hard for others, or even for the author,<br />

<strong>to</strong> trace down. Of course, some special effects might just be wanted.<br />

8.5.5 Order of definitions<br />

User-defined structures may be nested within one another. If one user<br />

definition contains another user-defined structure, it is often the case that<br />

the inner one has already been defined. However, this is not necessary.<br />

User definitions may contain other user structures that are defined afterwards.<br />

What is important is that the other structure is defined before the<br />

first comm<strong>and</strong> is invoked.<br />

For example, a normal sequence of definitions would be<br />

\newcomm<strong>and</strong>{\A}{defa}<br />

\newcomm<strong>and</strong>{\B}{defb}<br />

\newcomm<strong>and</strong>{\C}{\A \B}<br />

where \C is defined in terms of \A <strong>and</strong> \B. However, it is also permissible<br />

<strong>to</strong> write<br />

\newcomm<strong>and</strong>{\C}{\A \B}<br />

normal text, but without calling \C<br />

\newcomm<strong>and</strong>{\B}{defb}<br />

\newcomm<strong>and</strong>{\A}{defa}<br />

further text with any number of calls <strong>to</strong> \A, \B <strong>and</strong> \C<br />

8.5.6 Nested definitions<br />

User definitions may be nested inside one another. A structure such as<br />

! \newcomm<strong>and</strong>{\outer}{{\newcomm<strong>and</strong>{\inner}...}}<br />

is permissible. The comm<strong>and</strong> that is defined with the name {\inner} is valid<br />

<strong>and</strong> known only within the comm<strong>and</strong> {\outer}, according <strong>to</strong> the remarks on the<br />

scope of definitions on the facing page. Although the T E X macros make copious<br />

use of nested comm<strong>and</strong> definitions <strong>to</strong> limit the lifetime of temporary comm<strong>and</strong>s,<br />

it is not recommended <strong>to</strong> nest L AT E X definitions excessively since it is <strong>to</strong>o easy<br />

<strong>to</strong> lose track of the bracketing. A forgotten bracket pair will produce an error<br />

message on the second call <strong>to</strong> the outer comm<strong>and</strong>, since the inner definition still<br />

exists as a lef<strong>to</strong>ver from the first call. Nevertheless, here is an example:<br />

\newcomm<strong>and</strong>{\twentylove}<br />

{{\newcomm<strong>and</strong>{\fivelove}<br />

{{{\newcomm<strong>and</strong>{\onelove}<br />

{I love \<strong>LaTeX</strong>!}%<br />

\onelove\ \onelove\ \onelove\ \onelove\ \onelove}}}<br />

\fivelove\\ \fivelove\\ \fivelove\\ \fivelove}}


204 Chapter 8. User Cus<strong>to</strong>mizations<br />

The entry My opinion of \<strong>LaTeX</strong>:\\ \twentylove now produces:<br />

My opinion of L AT E X:<br />

I love L AT E X! I love L AT E X! I love L AT E X! I love L AT E X! I love L AT E X!<br />

I love L AT E X! I love L AT E X! I love L AT E X! I love L AT E X! I love L AT E X!<br />

I love L AT E X! I love L AT E X! I love L AT E X! I love L AT E X! I love L AT E X!<br />

I love L AT E X! I love L AT E X! I love L AT E X! I love L AT E X! I love L AT E X!<br />

Indenting the lines of the definition, as shown above, can help <strong>to</strong> keep track of<br />

the nesting levels; each line of the same level starts in the same column, ignoring<br />

braces.<br />

If both the inner <strong>and</strong> outer definitions are <strong>to</strong> be provided with arguments,<br />

! the symbols for the inner <strong>and</strong> outer dummy arguments must be distinguished.<br />

The symbols for the inner definition are ##1 ... ##9, while those for the outer<br />

one are the normal #1 ... #9. For example:<br />

\newcomm<strong>and</strong>{\thing}[1]{{\newcomm<strong>and</strong>{\color}[2]{The ##1 is ##2.}<br />

\color{#1}{red} \color{#1}{green} \color{#1}{blue}}}<br />

The entry The colors of the objects are\\<br />

\thing{dress}\\ \thing{book}\\ \thing{car} produces<br />

The colors of the objects are<br />

The dress is red. The dress is green. The dress is blue.<br />

The book is red. The book is green. The book is blue.<br />

The car is red. The car is green. The car is blue.<br />

The separate definition <strong>and</strong> calling as in Section 8.5.5 is easier <strong>to</strong> follow <strong>and</strong><br />

would be:<br />

\newcomm<strong>and</strong>{\thing[1]}{\color{#1}{red} \color{#1}{green}<br />

\color{#1}{blue}<br />

\newcomm<strong>and</strong>{\color}[2]{The #1 is #2.}<br />

If one were ever <strong>to</strong> go <strong>to</strong> a third level of definitions, the dummy arguments<br />

! are given as ####1 . . . ####9. And for the fourth level one writes 8 # signs!


Part II<br />

Beyond the Basics


9<br />

Document<br />

Management<br />

This chapter describes those features of L AT E X that justify the subtitle<br />

of Leslie Lamport’s original books, ‘A Document Preparation System’.<br />

Whereas in the previous chapters we have concentrated more on markup,<br />

logical <strong>and</strong> typographical, we now present <strong>to</strong>pics that are essential for<br />

producing large, complex documents in an efficient manner. The subjects<br />

included here are the splitting of a document in<strong>to</strong> several files,<br />

selective processing of parts of a document, cross-references <strong>to</strong> sections,<br />

figures, <strong>and</strong> equations, au<strong>to</strong>mated production of bibliographies, indices,<br />

<strong>and</strong> glossaries.<br />

9.1 Processing parts of a document<br />

As often pointed out, a L AT E X document consists of a preamble <strong>and</strong> the<br />

actual text part. Short documents, such as those that a beginner might<br />

have, are written <strong>to</strong> a single file by means of a text edi<strong>to</strong>r, <strong>and</strong> might be<br />

corrected after the first trial printing. As the user gathers experience <strong>and</strong><br />

confidence, the L AT E X documents will rapidly exp<strong>and</strong> in length until one is<br />

faced with the task of producing an entire book of more than a hundred<br />

pages.<br />

Such long documents could theoretically be kept in one file, although<br />

that would make the whole operation increasingly clumsy. The file edi<strong>to</strong>r<br />

functions less efficiently on longer files <strong>and</strong> the L AT E X processing takes<br />

correspondingly more time. A better idea is <strong>to</strong> split the work in<strong>to</strong> several<br />

files which L AT E X then merges during the processing.<br />

9.1.1 The \input comm<strong>and</strong><br />

The contents of another file may be read in<strong>to</strong> a L AT E X document with the<br />

comm<strong>and</strong><br />

\input{filename}<br />

207


208 Chapter 9. Document Management<br />

where the name of the other file is filename.tex. It is only necessary <strong>to</strong><br />

specify the full name of the file if the extension is something other than<br />

.tex. During the L AT E X processing, the text contained in this second file<br />

is read in at that location in the first file where the comm<strong>and</strong> is given.<br />

The result of the \input comm<strong>and</strong> is the same as if the contents<br />

of the file filename.tex had been typed in<strong>to</strong> the document file at that<br />

position. The comm<strong>and</strong> may be given anywhere in the document, either<br />

in the preamble or within the text part.<br />

Since the \input comm<strong>and</strong> may be given in the preamble, it is possible<br />

<strong>to</strong> put the whole preamble text itself in<strong>to</strong> a separate file. The actual L AT E X<br />

processing file could even be reduced <strong>to</strong> simply \begin{document} ...<br />

\end{document} with a number of \input comm<strong>and</strong>s. A preamble<br />

file makes sense if one has a series of documents all of the same type<br />

requiring a common preamble. This also simplifies any later change <strong>to</strong><br />

the specifications that must be made in all the documents. Different<br />

preamble files may be prepared for various types of processing <strong>and</strong> may<br />

then be selected with \input{proc type}.<br />

A file that is read in by means of the \input comm<strong>and</strong> may also<br />

contain further \input comm<strong>and</strong>s. The nesting depth is limited only by<br />

the capacities of the computer.<br />

In order <strong>to</strong> obtain a listing of all extra files read in, give the comm<strong>and</strong><br />

\listfiles<br />

in the preamble. The list appears both on the computer moni<strong>to</strong>r <strong>and</strong> in<br />

the transcript file, at the end of the processing run. The version numbers<br />

<strong>and</strong> any other loading information are also printed. This provides a check<br />

as <strong>to</strong> which files have been input. See Section D.2.9 for a demonstration.<br />

Exercise 9.1: Put the preamble of your st<strong>and</strong>ard exercise file exercise.tex in<strong>to</strong><br />

a separate file preamble.tex. Split the text part in<strong>to</strong> three files exer1.tex,<br />

exer2.tex, <strong>and</strong> exer3.tex. What should the main file now contain <strong>to</strong> ensure<br />

that L AT E X processes the whole exercise text?<br />

9.1.2 The \include comm<strong>and</strong><br />

Splitting the document in<strong>to</strong> several files may be practical for writing <strong>and</strong><br />

editing, but when the files are merged with the \input comm<strong>and</strong>s, it is<br />

still the entire document that is processed. Even if only one file contains<br />

a small correction, all files will be read in <strong>and</strong> processed once again. It<br />

would therefore be desirable <strong>to</strong> be able <strong>to</strong> reprocess only the one corrected<br />

file.<br />

One rough-<strong>and</strong>-ready method is <strong>to</strong> write a temporary main file containing<br />

only the preamble (which may be read in) <strong>and</strong> an \input comm<strong>and</strong> <strong>to</strong><br />

read in that specific file. The disadvantage is that all au<strong>to</strong>matic numbering<br />

of page numbers, sections, figures, equations, etc. will start from 1, since


9.1. Processing parts of a document 209<br />

all the information from the previous files will be missing. Furthermore,<br />

all cross-references from other files will be absent.<br />

A much better method is <strong>to</strong> employ the L AT E X comm<strong>and</strong><br />

\include{filename}<br />

which is only allowed within the text part of the document, <strong>to</strong>gether with<br />

\includeonly{file list}<br />

in the preamble, containing a list file list of those files that are <strong>to</strong> be read<br />

in. The file names are separated by commas <strong>and</strong> the extension.tex is left<br />

off.<br />

If filename is in the file list, or if \includeonly is missing from the<br />

preamble, the comm<strong>and</strong> \include{filename} is identical <strong>to</strong><br />

\clearpage \input{filename} \clearpage<br />

However, if filename is not contained within the file list, \include is<br />

equivalent <strong>to</strong> \clearpage <strong>and</strong> the file contents are not read in. However,<br />

an auxiliary .aux file is read in that sets all the counters <strong>and</strong> crossreferencing<br />

information for that file.<br />

Since \include always begins a new page, the document must be split<br />

in<strong>to</strong> files at those points where a new page occurs, such as between chapters.<br />

Furthermore, \include comm<strong>and</strong>s may not be nested: they may<br />

only appear in the main processing file. However, an \input comm<strong>and</strong><br />

may be given within a file that is \included.<br />

The great advantage of the \include comm<strong>and</strong> is that the additional<br />

information about page, section, <strong>and</strong> equation numbers will be supplied<br />

by the .aux files that are read in in place of the .tex files so that the<br />

selective processing takes place with the correct values of these counters.<br />

Cross-reference information from the other files is also available so that<br />

the \ref <strong>and</strong> \pageref comm<strong>and</strong>s (Section 9.2.1) yield the correct results.<br />

All these values will have been determined during a previous processing<br />

of the entire document.<br />

If the changes in the file that is being selectively processed lead <strong>to</strong> an<br />

increase or reduction in the number of pages, the following files will also<br />

have <strong>to</strong> be reprocessed <strong>to</strong> correct their page numbers. The same is true if<br />

sections are added or removed, or if the number of equations, footnotes,<br />

figures, etc. is altered.<br />

For example, suppose file 3 ends on page 17, but after the selective<br />

processing it now extends <strong>to</strong> page 22. The following file 4 still begins on<br />

page 18, <strong>and</strong> all further files also have their original starting page numbers.<br />

If file 4 is now selectively processed, it will receive the correct number for<br />

its first page, 23, based on the s<strong>to</strong>red information in the revised file 3. So<br />

far so good. However, if instead file 6 were <strong>to</strong> be selectively processed<br />

right after file 3, it would receive its starting page number from file 5,<br />

which has not yet been corrected <strong>and</strong> would be in error by 5. The same


210 Chapter 9. Document Management<br />

applies <strong>to</strong> all other structure counters. Their correct values can only be<br />

guaranteed when the files have been reprocessed in their proper order.<br />

In spite of these restrictions, the \include comm<strong>and</strong> is extremely useful<br />

for large documents, saving considerable computation time. Longer<br />

documents are normally written <strong>and</strong> edited in many stages. The \include<br />

comm<strong>and</strong> permits one <strong>to</strong> reprocess selective alterations in a short time,<br />

even if the numbering systems temporarily go awry. This can be repaired<br />

later on with a complete reprocessing of the entire document, by<br />

deactivating the \includeonly comm<strong>and</strong> in the preamble.<br />

A file that is read in with \include may not contain any \newcounter<br />

declarations. This is not much of a restriction, since they should normally<br />

be given in the preamble.<br />

For example, each chapter of a book might be written <strong>to</strong> a separate<br />

file with names chap1.tex, chap2.tex, . . . . The processing file itself<br />

contains the text<br />

\documentclass{book}<br />

. . . . . . . . . . . . . . . .<br />

\includeonly{...}<br />

\begin{document}<br />

\frontmatter<br />

\include{<strong>to</strong>c}<br />

\mainmatter<br />

\include{chap1}<br />

\include{chap2}<br />

. . .<br />

\backmatter<br />

\include{back}<br />

\end{document}<br />

where the file <strong>to</strong>c.tex contains only comm<strong>and</strong>s for the title page, table<br />

of contents, <strong>and</strong> other listings:<br />

\begin{titlepage} ... \end{titlepage}<br />

\tableofcontents \lis<strong>to</strong>ftables \lis<strong>to</strong>ffigures<br />

<strong>and</strong> back.tex those for bibliography <strong>and</strong> index:<br />

\bibliography{..}<br />

\printindex<br />

The chapters <strong>to</strong> be processed are selected by adding them <strong>to</strong> the argument<br />

of \includeonly, not by changing the \include comm<strong>and</strong>s, which must<br />

always be present <strong>to</strong> ensure that all the .aux are input every time. For<br />

example, by giving \includeonly{<strong>to</strong>c,chap3} one processes the table<br />

of contents <strong>and</strong> chapter 3.


9.1.3 Moni<strong>to</strong>r input <strong>and</strong> output<br />

9.1. Processing parts of a document 211<br />

There are times when it is desirable that L AT E X write a message <strong>to</strong> the<br />

computer moni<strong>to</strong>r during processing. This can be achieved with the<br />

comm<strong>and</strong><br />

\typeout{message}<br />

where message st<strong>and</strong>s for the text that is <strong>to</strong> appear on the moni<strong>to</strong>r. This<br />

text is printed when the L AT E X processing reaches this comm<strong>and</strong>. It is also<br />

written <strong>to</strong> the transcript file, but does not appear in the processed output.<br />

If message contains a user-defined comm<strong>and</strong>, it will be interpreted<br />

<strong>and</strong> its translation appears on the moni<strong>to</strong>r. The same thing applies <strong>to</strong><br />

L AT E X comm<strong>and</strong>s. This could have dire consequences if the comm<strong>and</strong>s,<br />

either user or L AT E X, are not really printable. To print the comm<strong>and</strong> name<br />

literally, precede it with the comm<strong>and</strong> \protect.<br />

The comm<strong>and</strong><br />

\typein[\com name]{message}<br />

also writes the message text <strong>to</strong> the moni<strong>to</strong>r, but then it waits for the<br />

user <strong>to</strong> enter a line of text from the keyboard, terminated by typing the<br />

〈return〉 key. If the optional argument \com name is missing, the line of<br />

text is inserted directly in<strong>to</strong> the processing. In this way, one could, for<br />

example, reuse the same text for a letter for several addressees, entering<br />

the name each time from the keyboard. Suppose the text contains<br />

Dear \typein{Name:}\\ ...<br />

then what appears on the moni<strong>to</strong>r is:<br />

✎<br />

Name:<br />

☞ At this point, one enters the name of the<br />

recipient. If on successive processings<br />

‘George’, ‘Fred’, <strong>and</strong> ‘Mary’ are entered, the<br />

result will be a set of identical letters dif-<br />

\@typein=<br />

fering only in their salutations as ‘Dear<br />

✍<br />

✌ George’, ‘Dear Fred’, <strong>and</strong> ‘Dear Mary’.<br />

If the \typein comm<strong>and</strong> contains the optional argument \com name,<br />

this is treated the same as<br />

\typeout{message} \newcomm<strong>and</strong>{\com name}{entered definition}<br />

In this case the definition is s<strong>to</strong>red under the comm<strong>and</strong> name \com name<br />

interactively <strong>and</strong> may be invoked <strong>and</strong> executed in the rest of the document<br />

like any other L AT E X comm<strong>and</strong>.<br />

With some experience in L AT E X methodology, it soon becomes obvious<br />

that interactive processing with the \typein comm<strong>and</strong> can be very<br />

practical. For example, if the preamble contains<br />

\typein[\files]{Which files?}<br />

\includeonly{\files}


212 Chapter 9. Document Management<br />

the following appears on the moni<strong>to</strong>r:<br />

✎<br />

Which files?<br />

☞<br />

Now L<br />

\files=<br />

✍<br />

✌<br />

ATE X waits for the user <strong>to</strong> type in the<br />

names of one or more files (separated by<br />

commas) <strong>to</strong> be processed. This avoids having<br />

<strong>to</strong> modify the main processing file with<br />

an edi<strong>to</strong>r every time.<br />

A similar procedure may be employed when a form letter is <strong>to</strong> be sent<br />

<strong>to</strong> various recipients. One can enter the name <strong>and</strong> address <strong>and</strong> even the<br />

salutation interactively. Complete forms may be processed by LAT EX in this<br />

way, with the entries being made from the keyboard.<br />

Warning: The \typein comm<strong>and</strong> may not be used as the argument of<br />

another L AT E X comm<strong>and</strong>! It may, however, be given in environments such<br />

as minipage.<br />

Exercise 9.2: Change the main file from Exercise 9.1 so that the files exer1.tex,<br />

exer2.tex, <strong>and</strong> exer3.tex may be read in with the \include comm<strong>and</strong>. Arrange<br />

that you can determine interactively which of the files is <strong>to</strong> be processed.<br />

Exercise 9.3: Generate output of the form<br />

Certificate<br />

Olympic Spring Games<br />

Walterville 1992<br />

Finger Wrestling<br />

Gold A. T. Glitter AUR 7999.9 Points<br />

Silver S. Lining ARG 7777.7 Points<br />

Bronze H. D. Tarnish CUP 7250.0 Points<br />

so that the following enquiries appear on the moni<strong>to</strong>r one after the other<br />

Message Comm<strong>and</strong>= Input<br />

Sport: \@typein = Finger Wrestling<br />

Unit: \unit = Points<br />

Gold: \@typein = A. T. Glitter<br />

Country: \@typein = AUR<br />

Value: \@typein = 7999.9<br />

Silver: \@typein = S. Lining<br />

. . . . . . = . . .<br />

<strong>and</strong> the appropriate entries are made interactively. The third column contains<br />

the answers necessary <strong>to</strong> produce the above sample output. Repeat the program<br />

with different entries. Let your imagination run wild.


9.2 In-text references<br />

9.2. In-text references 213<br />

In a longer text, one often wants <strong>to</strong> refer <strong>to</strong> other chapters, sections,<br />

tables, <strong>and</strong> figures, or <strong>to</strong> pages where some other description has been<br />

given. One also needs an index of certain keywords that occur throughout<br />

the document. In the days before electronic text processing, such crossreferences<br />

<strong>and</strong> indices meant an enormous amount of extra work for<br />

the author or secretary. Today the computer can alleviate much of this<br />

burden.<br />

In the old days, referring <strong>to</strong> earlier parts of the text by page number<br />

was tedious but feasible. Referencing future parts that had not yet been<br />

written had <strong>to</strong> be limited <strong>to</strong> section numbers since the page numbers were<br />

not yet known, or space had <strong>to</strong> be left for the page number <strong>to</strong> be entered<br />

at a later date.<br />

The production of a book is usually a progressive <strong>and</strong> constantly<br />

shifting process. The manuscript may not necessarily be written in the<br />

order in which it is <strong>to</strong> appear, <strong>and</strong> even once the initial draft version is<br />

finished, there will be major changes due <strong>to</strong> new considerations by the<br />

author or <strong>to</strong> knowledgeable advice from reviewers. Revisions, deletions,<br />

<strong>and</strong> insertions of entire sections or even chapters are commonplace, not<br />

<strong>to</strong> mention possible reordering of parts of the text.<br />

L AT E X relegates all the problems associated with such major alterations<br />

<strong>to</strong> the past. No matter what changes the author makes, the information<br />

necessary for the cross-references <strong>and</strong> keyword index is s<strong>to</strong>red for use at<br />

any point in the text.<br />

9.2.1 Cross-references<br />

As already pointed out in several places, the comm<strong>and</strong><br />

\label{marker}<br />

is used <strong>to</strong> s<strong>to</strong>re the current value of the relevant counter (section,<br />

equation, etc.) at that point in the text, which may then be referred<br />

<strong>to</strong> at other places. The value is assigned <strong>to</strong> the key marker, which may be<br />

any combination of letters, numbers, <strong>and</strong> characters, even those that are<br />

normally special symbols.<br />

The page number on which the \label comm<strong>and</strong> was issued can be<br />

printed with<br />

\pageref{marker}<br />

at any point earlier or later in the document.<br />

If the \label comm<strong>and</strong> is given after a sectioning comm<strong>and</strong>, or within<br />

an equation, eqnarray, or enumerate environment, or inside the argument<br />

of a \caption within the figure or table environments, the<br />

comm<strong>and</strong>


214 Chapter 9. Document Management<br />

\ref{marker}<br />

prints the number of that section, equation, figure, table, or enumeration<br />

that was current when marker was defined, <strong>and</strong> in the correct format.<br />

For enumerate, the same number is printed as is generated by the \item<br />

comm<strong>and</strong> where the \label appeared. Reference may also be made<br />

<strong>to</strong> theorem-like structures created by a \newtheorem comm<strong>and</strong> if the<br />

\label is given within the text of that theorem comm<strong>and</strong>. For example,<br />

a \label with marker text bo-wei was issued in the text of the Bolzano–<br />

Weierstrass theorem on page 80:<br />

\begin{theorem}[Balzano--Weierstrass]<br />

\label{bo-wei}...\end{theorem}<br />

so that the input text<br />

Theorem˜\ref{bo-wei} on page˜\pageref{bo-wei}<br />

generates the output ‘Theorem 1 on page 80’. Similarly, the input text<br />

for Table˜\ref{budget04} on page˜\pageref{budget04},<br />

see also Section˜\ref{sec:figref}<br />

produces ‘for Table 7.1 on page 174, see also Section 7.6’, since that<br />

section contains the marker \label{sec:figref}.<br />

Note that the counter whose value is s<strong>to</strong>red by the \label comm<strong>and</strong><br />

depends on the context in which the comm<strong>and</strong> is given. This is normally<br />

fairly self-evident. Within regular text, it will be the counter <strong>and</strong> its value<br />

for the last issued sectioning comm<strong>and</strong>, which might not be immediately<br />

visible. Therefore, when reference <strong>to</strong> a section number is desired, it is<br />

best <strong>to</strong> place the \label comm<strong>and</strong> immediately after the appropriate<br />

sectioning comm<strong>and</strong>, or even within its argument, as part of the title text.<br />

This is in fact the recommended method. Put the \label comm<strong>and</strong> within<br />

the body of the text only when you want <strong>to</strong> refer <strong>to</strong> the page number at<br />

that point.<br />

A list of all label markers, their translations, <strong>and</strong> page numbers may<br />

be produced by processing the file lablst.tex, provided with the L AT E X<br />

installation.<br />

9.2.2 How cross-referencing works<br />

It is useful <strong>to</strong> know how the cross-referencing information is managed. What the<br />

! \label comm<strong>and</strong> actually does is <strong>to</strong> write the key name <strong>to</strong>gether with the current<br />

value of the appropriate counter(s) <strong>and</strong> the current page number <strong>to</strong> an auxiliary<br />

file with the root name of the document file plus the extension.aux. The \ref <strong>and</strong><br />

\pageref comm<strong>and</strong>s obtain their information from this.aux file, which is read<br />

in at the beginning of the next processing by the \begin{document} comm<strong>and</strong>.<br />

The same situation as for the table of contents (Section 3.4.2) also applies here:<br />

on the first run, the.aux file does not exist so that no cross-reference information


9.2. In-text references 215<br />

can be output; instead the information is gathered <strong>and</strong> written <strong>to</strong> a new.aux file<br />

at the end of the run. A warning message is printed at the end if the auxiliary<br />

information has changed <strong>and</strong> a new run is necessary.<br />

If selective processing is being done with \includeonly <strong>and</strong> a set of \include<br />

comm<strong>and</strong>s, then an.aux file exists for each included files, as well as for the main<br />

source file. These.aux files are read in on every processing run, whether or not<br />

the corresponding .tex file is input. In this way, counter <strong>and</strong> cross-referencing<br />

information for the entire document is maintained even when only parts of it are<br />

processed.<br />

9.2.3 Referencing parts of other documents<br />

It is possible <strong>to</strong> refer <strong>to</strong> the marker keys in another LAT Package:<br />

EX document by<br />

xr means of David Carlisle’s xr package, which is part of the <strong>to</strong>ols collection<br />

(Section B.5.4). With<br />

\externaldocument{filename}<br />

all the keys in the specified file become available in the current document,<br />

<strong>to</strong> be printed with \ref{key} as usual. Difficulties arise if there<br />

are duplicate key names in any of the external or current files. To circumvent<br />

this problem, an optional argument can be given, for example<br />

as \externaldocument[x-]{filename}, in which case all the markers in<br />

the external file will be prefixed with x-. Thus the external key intro is<br />

referred <strong>to</strong> with \ref{x-intro}.<br />

9.2.4 Smart referencing: the varioref package<br />

Package: When the object being referenced is so close that you know it will be<br />

varioref on the same or adjacent page, you very likely will want <strong>to</strong> alter the text<br />

accordingly. However, it might later switch from ‘same’ <strong>to</strong> ‘adjacent’ after<br />

another revision <strong>and</strong> you will have <strong>to</strong> change that text once more. The<br />

<strong>to</strong>ols package varioref by Frank Mittelbach does this for you. It defines<br />

a comm<strong>and</strong> \vref{key} which is almost the same as ‘\ref{key} on page<br />

\pageref{key}.’ However, if \label{key} is on the current, previous,<br />

or next page, it prints appropriate text. Thus depending on the relative<br />

locations, Fig. \vref{f1} au<strong>to</strong>matically produces one of<br />

Fig. 5 when \label on same page,<br />

Fig. 5 on the preceding page on previous page,<br />

Fig. 5 on the next page on following page,<br />

Fig. 5 on the facing page on opposite page with twoside option,<br />

Fig. 5 on page 24 when two or more pages away.<br />

The comm<strong>and</strong> \vpageref prints only the page part of the text, or ‘on<br />

this page’ if \label{key} is on the current page. It may also take one or<br />

two optional arguments: the texts for the current page <strong>and</strong> non-current<br />

pages. For example, the example \vpageref[above]{f1} prints one of


216 Chapter 9. Document Management<br />

the example above when \label on same page,<br />

the example on the previous page on following page,<br />

the example on page 24 when two of more pages away,<br />

while the \vpageref[above example][example]{f1} outputs one of:<br />

the above example when \label on same page,<br />

the example on the next page on the following page,<br />

the example on page 24 when two of more pages away.<br />

A range of numbers <strong>and</strong> pages can be produced with the comm<strong>and</strong><br />

\vrefrange, which takes two m<strong>and</strong>a<strong>to</strong>ry arguments, both label keys. It<br />

prints text like ‘5 <strong>to</strong> 7 on pages 212–214’, or ‘5 <strong>to</strong> 7 on the next page’, <strong>and</strong><br />

so on. It takes one optional argument, the text <strong>to</strong> print when both labels<br />

are on the current page.<br />

The page part of \vrefrange only is printed with \vpagerefrange,<br />

which also takes two m<strong>and</strong>a<strong>to</strong>ry (label key) arguments <strong>and</strong> one optional<br />

(text) one. If both labels are on the same page, it behaves like \vpageref;<br />

the optional argument is printed if both are on the current page.<br />

Since English text is au<strong>to</strong>matically printed by the above comm<strong>and</strong>s,<br />

they would not be very useful for documents, say, in Italian. The varioref<br />

package therefore accepts all the language options recognized by the<br />

babel system (Chapter 11) <strong>to</strong> reprogram the texts. With the option<br />

italian, one will get texts like in questa pagina for ‘on this page’ <strong>and</strong><br />

nella pagina precedente for ‘on the preceding page’, <strong>and</strong> so on.<br />

All the texts are s<strong>to</strong>red in special comm<strong>and</strong>s which can be redefined<br />

by the user:<br />

\reftextbefore previous but non-facing page<br />

\reftextfacebefore previous but facing page<br />

\reftextafter next but non-facing page<br />

\reftextfaceafter next but facing page<br />

\reftextfaraway{key} more than one page away<br />

\reftextpagerange{key1}{key2} page range of 2 labels<br />

\reftextlabelrange{key1}{key2} range of 2 different labels.<br />

The last three must be redefined with 1 or 2 arguments, as<br />

\renewcomm<strong>and</strong>{\reftextfaraway}[1]{on page \pageref{#1}}<br />

\renewcomm<strong>and</strong>{\reftextpagerange}[2]{on pages \pageref{#1}%<br />

--\pageref{#2}}<br />

\renewcomm<strong>and</strong>{\reftextlabelrange}[2]{\ref{#1} <strong>to</strong> \ref{#2}}<br />

There is also \vreftextvario{text1}{text2} <strong>to</strong> provide altering texts<br />

for the above comm<strong>and</strong>s, so that the same text is not printed every time.<br />

9.3 Bibliographies<br />

Academic publications normally include a list of references, or bibliography,<br />

containing the names of other works that are cited within the text


9.3. Bibliographies 217<br />

by means of a running number. This is the system supported by st<strong>and</strong>ard<br />

L AT E X, described in the next section. The alternative citation method,<br />

with author name <strong>and</strong> year of publication, can be achieved with various<br />

extension packages, as described in Section 9.3.4).<br />

Often the bibliography has not been finalized before the main text is<br />

started. Especially for numerical bibliographies, it would be a great nuisance<br />

<strong>to</strong> have <strong>to</strong> go through the whole text <strong>and</strong> change all the numbering<br />

every time something was added <strong>to</strong> the bibliography. Therefore L AT E X is<br />

programmed not only <strong>to</strong> format the bibliography but also <strong>to</strong> keep track<br />

of its alterations <strong>and</strong> additions in order <strong>to</strong> modify the references in the<br />

text au<strong>to</strong>matically.<br />

The bibliography is generated most conveniently <strong>and</strong> efficiently from<br />

a general database with the help of the BIBT E X program that should be part<br />

of the L AT E X installation. How <strong>to</strong> prepare such databases is explained in<br />

Chapter 14. The advantages of a database is that its entries can be reused<br />

again <strong>and</strong> again for all future documents, while the formatting style in<br />

each bibliography listing can vary according <strong>to</strong> the requirements of each<br />

document. One can, however, write it by h<strong>and</strong> without BIBT E X.<br />

9.3.1 Bibliography by h<strong>and</strong><br />

The actual bibliography, whether created by BIBT E X or by h<strong>and</strong>, is placed<br />

inside the environment<br />

\begin{thebibliography}{sample label}<br />

entries<br />

\end{thebibliography}<br />

The individual entries in the bibliography each begin with the comm<strong>and</strong><br />

\bibitem[label]{key} entry text<br />

Without the optional argument label, \bibitem produces a running number<br />

in square brackets as the label for the reference in the text. With<br />

label, one can give whatever indica<strong>to</strong>r one wishes, such as an abbreviation<br />

of the author’s name, or an arbitrary reference number. The m<strong>and</strong>a<strong>to</strong>ry<br />

argument key is a reference key, much like that for the cross-referencing<br />

\label comm<strong>and</strong> (page 213), which is used <strong>to</strong> make the actual citation<br />

in the main text. The key name can be made up of any combination of<br />

letters, numbers, <strong>and</strong> symbols except commas.<br />

The bibliography information itself is contained in entry text, such as<br />

‘author, title, publisher, year, edition, page numbers’, possibly in various<br />

typefaces. The output text will be indented after the first line by a width<br />

equal <strong>to</strong> that of the sample label, so this should be as large as the longest<br />

label in the bibliography. For the st<strong>and</strong>ard application with running<br />

numbers, sample label should be a dummy number with as many digits


218 Chapter 9. Document Management<br />

as the largest label (for example 99 if there are more than 10 but less than<br />

100 entries).<br />

For bibliographies with author–year citations (Section 9.3.4) the entries<br />

in the thebibliography are the same, except that the optional label must<br />

be present, taking a special form that will transfer the author <strong>and</strong> year<br />

texts <strong>to</strong> the citation comm<strong>and</strong>s.<br />

A sample (numerical) thebibliography environment could look as<br />

follows:<br />

\begin{thebibliography}{99}<br />

\bibitem{lamport} Leslie Lamport. \textsl{\<strong>LaTeX</strong>\ -- A Document<br />

Preparation System}, 2nd edition. Addison-Wesley,<br />

Reading, MA, 1994<br />

. . . . . . . . .<br />

\bibitem{knuth} Donald E. Knuth. \textsl{Computers <strong>and</strong><br />

Typesetting Vol.\ A--E}. Addison-Wesley,<br />

Reading, MA, 1986<br />

\bibitem[6a]{knuth:a} Vol A: \textsl{The {\TeX}book}, 1986<br />

. . . . . . . . .<br />

\bibitem[6e]{knuth:e} Vol E: \textsl{Computer Modern<br />

Typefaces}, 1986<br />

\end{thebibliography}<br />

Here lamport, knuth, <strong>and</strong> knuth:a have been chosen as keys. The<br />

sample label is given as 99 since a two-digit number produces sufficient<br />

indentation for the st<strong>and</strong>ard form of \bibitem. The entry with the key<br />

knuth is the sixth in the list <strong>and</strong> thus it au<strong>to</strong>matically receives the label<br />

[6]; in order for its sub-entries knuth:a . . . knuth:e <strong>to</strong> be printed as [6a]<br />

. . . [6e], it is necessary <strong>to</strong> set their optional label arguments <strong>to</strong> 6a . . . 6e.<br />

(Yes, this does violate the au<strong>to</strong>matic labeling system.)<br />

The bibliography is normally printed near the end of the document<br />

by placing the thebibliography environment at the desired location.<br />

For document classes book <strong>and</strong> report, the word Bibliography appears<br />

as an unnumbered chapter title at the beginning, whereas for article<br />

the word References is written as an unnumbered section heading. The<br />

above sample bibliography appears as:<br />

[1] Leslie Lamport. L AT E X – A Document Preparation System, 2nd edition.<br />

Addison-Wesley Co., Inc., Reading, MA, 1994<br />

. . . . . . . . .<br />

[6] Donald E. Knuth. Computers <strong>and</strong> Typesetting Vol. A–E. Addison-Wesley Co.,<br />

Inc., Reading, MA, 1986<br />

[6a] Vol A: The T E Xbook, 1986<br />

. . . . . . . . .<br />

[6e] Vol E: Computer Modern Typefaces, 1986<br />

Exercise 9.4: Produce a bibliography with the thebibliography environment,<br />

with a label consisting of the first three letters of the author’s name followed


9.3. Bibliographies 219<br />

by the last digits of the year of publication. If the same author has more than<br />

one work in a given year, add a running letter <strong>to</strong> distinguish them, for example<br />

knu86c, knu86d. With such labels, it is appropriate <strong>to</strong> make the reference keys<br />

the same as the labels. The indentation depth should be 1.5 cm.<br />

Note: The indentation depth is determined by the argument sample label in the<br />

thebibliography environment. This is usually a dummy text with the right<br />

width. This width can be given precisely with \hspace{width}.<br />

Exercise 9.5: Copy the thebibliography environment from the above exercise<br />

<strong>to</strong> the end of your st<strong>and</strong>ard exercise file (but ahead of the \end{document}<br />

comm<strong>and</strong>). Refer <strong>to</strong> the entries in the bibliography by inserting \cite comm<strong>and</strong>s<br />

in<strong>to</strong> your text. Make sure that the key in the \cite comm<strong>and</strong> is written exactly<br />

as in the \bibitem comm<strong>and</strong> in the thebibliography environment.<br />

9.3.2 Bibliography with BIBT E X<br />

Bibliographic databases <strong>and</strong> the BIBT E X program are fully described in<br />

Chapter 14. Here we just review the essential aspects for the L AT E X source<br />

file.<br />

• All the information for the literature references is placed in one or<br />

more databases. Each entry is given an identifying key (the key in<br />

the \bibitem argument) which is the h<strong>and</strong>le <strong>to</strong> refer <strong>to</strong> it.<br />

• In the source text, citations <strong>to</strong> the references are made with various<br />

comm<strong>and</strong>s like \cite, \citet, \citep, taking the key as argument.<br />

• The bibliography style must be specified somewhere in the document<br />

with \bibliographystyle{bib style}; the bib style determines how<br />

the bibliography is <strong>to</strong> be formatted; the basic style is plain for<br />

numerical citations, or plainnat with the natbib package.<br />

• Give the comm<strong>and</strong> \bibliography{database} where the bibliography<br />

is <strong>to</strong> appear; database is a list of all databases <strong>to</strong> be searched.<br />

• Process the source file with L AT E X; run BIBT E X <strong>and</strong> then L AT E X twice.<br />

BIBT E X writes a bibliography following the formatting specifications of<br />

bib style in<strong>to</strong> a thebibliography environment, s<strong>to</strong>ring it in a file with<br />

extension.bbl; this file is input by the \bibliography comm<strong>and</strong>.<br />

9.3.3 Numerical citations<br />

St<strong>and</strong>ard L AT E X can only h<strong>and</strong>le numerical bibliographies <strong>and</strong> citations. In<br />

this case, the citation in the text is made with the comm<strong>and</strong><br />

\cite[extra]{key}


220 Chapter 9. Document Management<br />

where key is the reference key that appears in the \bibitem comm<strong>and</strong>.<br />

With the sample bibliography on page 218, the source text<br />

For additional information about \<strong>LaTeX</strong>\ <strong>and</strong> \TeX\ see<br />

\cite{lamport} <strong>and</strong> \cite{knuth,knuth:a}.<br />

yields: For additional information about L AT E X <strong>and</strong> T E X see [1] <strong>and</strong> [6, 6a].<br />

If the optional argument extra is included in the \cite comm<strong>and</strong>, this<br />

text is added after the label(s) but still inside the square brackets.<br />

The creation of a bibliographic database is described in<br />

\cite[Appendix B]{lamport}, while the program \BibTeX\<br />

itself is explained in \cite[pages 74, 75]{lamport}.<br />

The creation of a bibliographic database is described in [1, Appendix B],<br />

while the program BIBT E X itself is explained in [1, pages 74, 75].<br />

9.3.4 Author–year bibliographies with natbib<br />

An alternative bibliographic citation style, used in this book <strong>and</strong> in many<br />

scientific journals, makes reference <strong>to</strong> other published works by citing<br />

the author’s name <strong>and</strong> year of publication. In this case, the entries in the<br />

bibliographic listing are not numbered. The citation itself may be either<br />

parenthetical [Jones et al., 1999] or textual, as shown by Jones et al. [1999].<br />

There may be some variations within this style: for example, in this book<br />

parentheses are used in place of square brackets <strong>and</strong> the name is left in<br />

normal type. None of this is supported by st<strong>and</strong>ard LAT EX, but rather by<br />

additional packages.<br />

There are a number of packages developed <strong>to</strong> deal with this situation,<br />

each requiring a different syntax for the optional label argument in the<br />

\bibitem comm<strong>and</strong> in order <strong>to</strong> transfer the author <strong>and</strong> year information<br />

<strong>to</strong> the citation comm<strong>and</strong>s. And each has its own bibliography style (.bst)<br />

file <strong>to</strong> allow BIBTEX <strong>to</strong> accomplish this.<br />

Package: The natbib package by Patrick W. Daly is the most universal of these,<br />

natbib being compatible with the \bibitem syntaxes, <strong>and</strong> thus with the.bst files,<br />

of other author–year packages such as apalike, chicago, <strong>and</strong> harvard,<br />

<strong>to</strong> name just a few. Furthermore, natbib can even produce numerical<br />

or superscript citations as well, <strong>and</strong> will also function with the st<strong>and</strong>ard<br />

(numerical) bibliography styles <strong>and</strong> \bibitem syntax, albeit only with<br />

numerical citations.<br />

Furthermore, natbib is integrated with the hyperref package (Section<br />

10.2.4) <strong>to</strong> make citations in<strong>to</strong> au<strong>to</strong>matic links <strong>to</strong> the bibliographic<br />

entry.<br />

The author–year \bibitem<br />

The required natbib form of the ‘optional’ label argument <strong>to</strong> \bibitem<br />

within the thebibliography environment is


\bibitem [short(year)long] {key} . . .<br />

9.3. Bibliographies 221<br />

where short is the short author list (e.g. Jones et al.) <strong>and</strong> long is an<br />

optional full author list. A sample bibliography might be:<br />

\begin{thebibliography}{99}<br />

\bibitem[James et al.(2001)James, Jones, <strong>and</strong> Smith]{JAM01}<br />

P. R. James, F. J. Jones, <strong>and</strong> R. T. Smith, ... 2001.<br />

\bibitem[Jones et al.(1999)Jones, Baker, <strong>and</strong> Toms]{JON99}<br />

F. J. Jones, H. P. Baker, <strong>and</strong> W. V. Toms, ... 1999.<br />

\bibitem[Jones et al.(2000a)Jones, Toms, <strong>and</strong> Baker]{JON00}<br />

F. J. Jones, W. V. Toms, <strong>and</strong> H. P. Baker, ... 2000a.<br />

\bibitem[Jones et al.(2000b)Jones, Toms, <strong>and</strong> Baker]{JON00b}<br />

F. J. Jones, W. V. Toms, <strong>and</strong> H. P. Baker, ... 2000b<br />

\end{thebibliography}<br />

Such bibliographies will be au<strong>to</strong>matically produced by BIBT E X when a<br />

bibliography style is invoked with the \bibliographystyle comm<strong>and</strong><br />

that is compatible with natbib. Three such .bst files are provided with<br />

natbib, as substitutes for 3 of the 4 basic BIBT E X styles: plainnat,<br />

unsrtnat, <strong>and</strong> abbrvnat (Section 14.1). However, many others also exist<br />

as contributions for specific publishers <strong>and</strong> journals.<br />

Author–year citations<br />

There is a flexible citation syntax permitting parenthetical (\citep) <strong>and</strong><br />

textual (\citet) citations, with the abbreviated or full author list, with<br />

optional notes both before <strong>and</strong> after the citations. For example,<br />

\citet{JON99} ⇒ Jones et al., (1999)<br />

\citet[pg.˜22]{JON99} ⇒ Jones et al., (1999, pg. 22)<br />

\citep{JON99} ⇒ (Jones et al., 1999)<br />

\citep[pg.˜22]{JON99} ⇒ (Jones et al., 1999, pg. 22)<br />

\citep[e.g.][]{JON99} ⇒ (e.g. Jones et al., 1999)<br />

\citep[e.g.][pg.˜22]{JON99} ⇒ (e.g. Jones et al., 1999, pg. 22)<br />

\citet*{JON99} ⇒ Jones, Baker, <strong>and</strong> Toms (1999)<br />

\citep*{JON00} ⇒ (Jones, Toms, <strong>and</strong> Baker, 2000)<br />

The citation punctuation (type of brackets, points between multiple citations,<br />

dates, <strong>and</strong> so on) can be selected by options when loaded, specified<br />

by declarations, or programmed <strong>to</strong> be associated with the bibliography<br />

style. See below.<br />

Multiple citations are available as usual, with compression of repeated<br />

authors:<br />

\citet{JON99,JAM01} ⇒ Jones et al. (1999); James et al. (2001)<br />

\citep{JON99,JAM01} ⇒ (Jones et al., 1999; James et al., 2001)<br />

\citep{JON99,JON00} ⇒ (Jones et al., 1999, 2000a)<br />

\citep{JON00,JON00b} ⇒ (Jones et al., 2000a,b)


222 Chapter 9. Document Management<br />

In numerical citation mode, the comm<strong>and</strong> \citep behaves like the<br />

st<strong>and</strong>ard \cite comm<strong>and</strong>, printing the reference’s number in brackets,<br />

while \citet gives the authors’ names followed by the reference’s number.<br />

This is textual citation in numerical mode, allowing the author <strong>to</strong> use the<br />

same syntax for both citation modes.<br />

\citet{JON99} ⇒ Jones et al. [21]<br />

\citet[pg.˜22]{JON99} ⇒ Jones et al. [21, pg. 22]<br />

\citep{JON99} ⇒ [21]<br />

\citep[pg.˜22]{JON99} ⇒ [21, pg. 22]<br />

\citep[e.g.][]{JON99} ⇒ [e.g. 21]<br />

\citep[e.g.][pg.˜22]{JON99} ⇒ [e.g. 21, pg. 22]<br />

\citep{JON00,JON00b} ⇒ [21, 32]<br />

The comm<strong>and</strong>s \citeauthor{key} <strong>and</strong> \citeyear{key} print just<br />

the author names <strong>and</strong> year, respectively; a starred version \citeauthor<br />

prints the full author list.<br />

There also exist capitalized variants of these citation comm<strong>and</strong>s,<br />

\Citet, etc., for use at the beginning of a sentence, when the first author<br />

name begins with something like ‘von’.<br />

\citet{delaM89} has shown ... ⇒ de la Mar has shown . . .<br />

\Citet{delaM89} has shown ... ⇒ De la Mar has shown . . .<br />

Package options<br />

Many aspects of formatting the citations can be controlled by options<br />

specified when loading natbib with the \usepackage comm<strong>and</strong>:<br />

round citations in round parentheses (default);<br />

square citations in square brackets;<br />

curly citations in curly braces;<br />

angle citations in angle brackets;<br />

colon <strong>to</strong> separate multiple citations with semicolons (default);<br />

comma <strong>to</strong> use commas as separa<strong>to</strong>rs;<br />

authoryear<br />

for author–year citations (default);<br />

numbers<br />

for numerical citations;<br />

super for superscripted numerical citations;


9.3. Bibliographies 223<br />

sectionbib<br />

puts the bibliography in a section instead a chapter; for use with<br />

the chapterbib package (Section 9.3.5);<br />

sort orders multiple citations in<strong>to</strong> the sequence in which they appear<br />

in the list of references;<br />

sort&compress<br />

as sort but in addition multiple numerical citations are compressed<br />

if possible (as 3–6, 15);<br />

longnamesfirst<br />

makes the first citation of any reference the equivalent of the<br />

starred variant (full author list) <strong>and</strong> subsequent citations normal<br />

(abbreviated list).<br />

Note: natbib defaults <strong>to</strong> author–year citations, but if any single \bibitem<br />

comm<strong>and</strong> does not conform <strong>to</strong> any of the recognized author–year syntaxes,<br />

it will switch au<strong>to</strong>matically <strong>to</strong> numerical citations.<br />

Further cus<strong>to</strong>mizations<br />

There are several formatting comm<strong>and</strong>s in natbib that may be (re)defined<br />

by the author <strong>to</strong> achieve special effects in the bibliography, such as font<br />

or spacing between entries. In st<strong>and</strong>ard L AT E X, these are all fixed.<br />

\bibsection<br />

can be redefined <strong>to</strong> the desired sectioning comm<strong>and</strong> for introducing<br />

the list of references. This is normally \section* or<br />

\chapter*.<br />

\bibpreamble<br />

is printed after the bibliography heading but before the actual<br />

list of references; is normally undefined, but can be defined <strong>to</strong><br />

insert any desired leading text.<br />

\bibfont<br />

can be a font declaration, e.g. \small <strong>to</strong> apply <strong>to</strong> the whole list<br />

of references; is normally undefined.<br />

\citenumfont<br />

can be a font declaration or comm<strong>and</strong> like \itshape or \textit<br />

for formatting numerical citations; normally undefined.<br />

\bibnumfmt<br />

is a comm<strong>and</strong> with an argument <strong>to</strong> format the numbers in the<br />

list of references; the default definition is [#1].


224 Chapter 9. Document Management<br />

\bibhang<br />

is the indentation after the first line of each reference; change<br />

this with the \setlength comm<strong>and</strong>.<br />

\bibsep<br />

is the vertical spacing between references; change this with the<br />

\setlength comm<strong>and</strong>.<br />

There are many other cus<strong>to</strong>mization possibilities <strong>and</strong> specialized features<br />

<strong>to</strong> natbib which can be found in the supplied documentation (process<br />

natbib.dtx if it not already provided as a.dvi or.pdf file) or in the<br />

short summary natnotes.tex.<br />

9.3.5 Multiple bibliographies<br />

Package:<br />

chapterbib<br />

In st<strong>and</strong>ard L AT E X, with or without BIBT E X, there can only be one bibliogra-<br />

phy per document. However, it is not uncommon for a book <strong>to</strong> consist of<br />

independent chapters, each with its own bibliography <strong>and</strong> local citations.<br />

The chapterbib package by Donald Arseneau solves this problem. It<br />

requires that the document be broken up in<strong>to</strong> individual source files that<br />

are read in<strong>to</strong> the main file with the \include comm<strong>and</strong> of Section 9.1.2.<br />

Each such file must contain its own thebibliography environment, or its<br />

own \bibliographystyle <strong>and</strong> \bibliography comm<strong>and</strong>s if BIBT E X is <strong>to</strong><br />

be used. The citation comm<strong>and</strong>s will work locally within each file. Even<br />

if the same reference appears in several bibliographies, with a different<br />

number each time, the citations will refer <strong>to</strong> the one in the local file.<br />

One must process BIBT E X individually on each of the separate files,<br />

creating a series of.bbl files. Then the document is reprocessed with L AT E X,<br />

at least twice; the.bbl files are read in by the individual \bibliography<br />

comm<strong>and</strong>s.<br />

If you cannot make use of the \include comm<strong>and</strong>s because you do<br />

not want each file <strong>to</strong> begin on a new page, you can still localize the<br />

bibliographies <strong>and</strong> their citations with the cbunit environment. This<br />

does not work with BIBT E X, however. In that case, you must still put the<br />

bibliographic units in<strong>to</strong> separate files, <strong>and</strong> then read them in with the<br />

\cbinput{file} comm<strong>and</strong>. Set the package option draft when loading<br />

chapterbib, process with L AT E X, process each file with BIBT E X, remove the<br />

draft option, process with L AT E X at least twice.<br />

With classes book <strong>and</strong> report, the bibliography is placed in an unnumbered<br />

chapter; this is undesirable if each chapter is <strong>to</strong> have its own<br />

bibliography. In this case, add the package option sectionbib <strong>to</strong> change<br />

the bibliography <strong>to</strong> an unnumbered section instead.<br />

The chapterbib package is compatible with natbib except for the<br />

sectionbib option. The two packages clash on their redefinitions of bibliography.<br />

In this case, add the option <strong>to</strong> natbib instead of <strong>to</strong> chapterbib.


9.4 Keyword index<br />

9.4. Keyword index 225<br />

L AT E X itself does not produce a keyword index au<strong>to</strong>matically as it does a<br />

table of contents, but it can prepare input data for the MakeIndex program<br />

(Section 9.4.3) that does generate such an index, in a form that L AT E X can<br />

use on a later run.<br />

9.4.1 The index environment<br />

A keyword index is formatted in the environment<br />

\begin{theindex} index entries \end{theindex}<br />

which switches <strong>to</strong> a two-column page format with a running head INDEX.<br />

The first page of the index carries the heading Index in the same size as<br />

a chapter heading for the book <strong>and</strong> report document classes, <strong>and</strong> as a<br />

section heading for the article class. (More precisely, the actual word<br />

printed is contained in the comm<strong>and</strong> \indexname which may be redefined<br />

for other languages.) The individual entries are made with comm<strong>and</strong>s<br />

\item \subitem \subsubitem <strong>and</strong> \indexspace<br />

followed by the keywords <strong>and</strong> their page numbers. For example,<br />

comm<strong>and</strong>s, 18<br />

arguments, 19, 101<br />

multiple, 103, 104<br />

replacement symbol, 20<br />

as environments, 42<br />

used as arguments for sectioning<br />

comm<strong>and</strong>s, 41, 42<br />

displayed text, 21–32<br />

\item comm<strong>and</strong>s, 18<br />

\subitem arguments, 19, 101<br />

\subsubitem multiple, 103, 104<br />

\subsubitem replacement symbol, 20<br />

\subitem as environments, 42<br />

\subitem used as arguments for<br />

sectioning comm<strong>and</strong>s, 41, 42<br />

\indexspace<br />

\item displayed text, 21--32<br />

If the text entry is <strong>to</strong>o long for one line, it is broken <strong>and</strong> continued on<br />

the next line, indented deeper than all other lines, as in the above example<br />

‘used as argument for sectioning comm<strong>and</strong>s, 41, 42’. The comm<strong>and</strong><br />

\indexspace leaves a blank line in the index.<br />

9.4.2 Preparing the index entries<br />

The theindex environment only sets up a suitable format for the index.<br />

The entries themselves, as well as their page numbers, are generated by<br />

the MakeIndex program described in Section 9.4.3. This program requires<br />

input information from the L AT E X file in the form of unsorted keywords<br />

<strong>and</strong> page numbers. The author enters this information in the text file<br />

with the comm<strong>and</strong><br />

\index{index entry}


226 Chapter 9. Document Management<br />

where index entry is the text <strong>to</strong> be entered in<strong>to</strong> the index. It may contain<br />

any combination of letters, numbers, <strong>and</strong> symbols including even<br />

comm<strong>and</strong> characters <strong>and</strong> blanks. This means that even comm<strong>and</strong>s may<br />

be included in the index entry, such as \index{\<strong>LaTeX</strong>\ logo}. Even<br />

the one comm<strong>and</strong> that may otherwise never be used as an argument,<br />

\verb, may be included. However, if index entry does contain a comm<strong>and</strong>,<br />

\index may not be used as an argument of another comm<strong>and</strong>.<br />

Normally all the \index comm<strong>and</strong>s are ignored by L AT E X <strong>and</strong> do absolutely<br />

nothing. They are activated only when the preamble contains the<br />

comm<strong>and</strong><br />

\makeindex<br />

in which case, a file with the document’s root name plus the extension<br />

.idx is opened. Now the \index comm<strong>and</strong>s write index entry <strong>and</strong> the<br />

current page number <strong>to</strong> this file in the form<br />

\indexentry{index entry}{pagenumber}<br />

It is this .idx file that is the input <strong>to</strong> the MakeIndex program. There are<br />

special symbols that may be used in the index entry <strong>to</strong> indicate main <strong>and</strong><br />

subitems <strong>and</strong> other refinements.<br />

The MakeIndex program expects the \index entries <strong>to</strong> be of one of<br />

the three forms:<br />

\index{main entry}<br />

\index{main entry!sub entry}<br />

\index{main entry!sub entry!sub sub entry}<br />

The individual main <strong>and</strong> sub-entries may contain any combination of<br />

characters with the exceptions of !, @, <strong>and</strong> |. The exclamation point is the<br />

divider between the various entry fields. If the \index comm<strong>and</strong> contains<br />

only a main entry, this will become the text for an \item comm<strong>and</strong>. The<br />

main entries will be in alphabetical order.<br />

If the \index comm<strong>and</strong> contains a main <strong>and</strong> a sub-entry, the text<br />

sub entry will be assigned <strong>to</strong> a \subitem comm<strong>and</strong> underneath the corresponding<br />

main entry. The texts for the \subitem will also be in alphabetical<br />

order. Similarly the text of a sub sub entry will appear following<br />

a \subsubitem comm<strong>and</strong>, alphabetically ordered, below the appropriate<br />

sub entry text.<br />

The main <strong>and</strong> sub-entries may also contain special characters <strong>and</strong> even<br />

L AT E X comm<strong>and</strong>s that are <strong>to</strong> be neglected during alphabetization. This is<br />

indicated by an entry of the form lex entry@print entry, in which lex entry<br />

is used for the alphabetical ordering while print entry is the actual text<br />

<strong>to</strong> be output. For example, in the keyword index in this book, which was<br />

generated with MakeIndex, all the comm<strong>and</strong> names appear as input text<br />

<strong>and</strong> are ordered without the preceding \ character. These entries were<br />

made in the text as \index{put@\verb=\put=}.


9.4. Keyword index 227<br />

An entry may be terminated with the character sequences |( or |)<br />

<strong>to</strong> designate the beginning <strong>and</strong> end of a range of page numbers. For<br />

example,<br />

\index{table|(} on page 95<br />

\index{table|)} on page 110<br />

produces the entry ‘table’ with page numbers given as 95–110.<br />

Instead of having the page number printed after the entry, a reference<br />

may be made <strong>to</strong> another index entry. For example, with<br />

\index{space|see{blank}}<br />

\index{table|seealso{array}}<br />

the entries ‘space, see blank’ <strong>and</strong> ‘table, see also array’ are made in the<br />

index.<br />

The three characters !, @, <strong>and</strong> | therefore have special functions for<br />

the MakeIndex program. In order <strong>to</strong> print these characters literally as<br />

text without their functions, the quote character " must precede them.<br />

For example, "! represents a literal exclamation point <strong>and</strong> not the entry<br />

divider.<br />

The quote character itself is thus a fourth special symbol <strong>and</strong> must be<br />

entered literally as "". However, there is a special rule in MakeIndex syntax<br />

that says a quote character preceded by a backslash will be interpreted<br />

as part of a comm<strong>and</strong>: thus \" may be used <strong>to</strong> put a German umlaut in<br />

an entry (as in \index{Knappen, J\"org}). This special rule can lead <strong>to</strong><br />

additional problems at times: in this book the index entry \! had <strong>to</strong> be<br />

typed as "\"!.<br />

It is possible <strong>to</strong> specify varying fonts for the page number. For example,<br />

in the index of this book, page numbers are set in bold face <strong>to</strong> indicate<br />

the page where a comm<strong>and</strong> is defined or first explained. This is achieved<br />

with an entry of the form<br />

\index{blank} on page 11, <strong>and</strong><br />

\index{blank|textbf} on page 22<br />

which in the second case puts the page number for this entry as the<br />

argument of a comm<strong>and</strong> \textbf. The line in the theindex environment<br />

becomes<br />

\item blank, 11, \textbf{22}<br />

Note: The vertical bar in the \index entry is not a typing error, but<br />

must replace the backslash as the L AT E X comm<strong>and</strong> symbol under these<br />

circumstances.<br />

There is a file idx.tex in the L AT E X installation, which can improve the read-<br />

! ability of the .idx files. By processing the idx.tex file (that is, calling latex<br />

idx), the user is prompted for the name of the.idx file <strong>to</strong> list:


228 Chapter 9. Document Management<br />

******************************** After the root name of the.idx file has<br />

* Enter idx file’s first Name. * been entered from the keyboard, a two-<br />

******************************** column page format is output containing<br />

the index entry texts listed under<br />

\filename=<br />

page headings of the form Page n. No<br />

further information is obtained through such a formatted listing, but it is far<br />

easier <strong>to</strong> work with than a straightforward output of the.idx file alone.<br />

Even if the \index comm<strong>and</strong>s have no effect without the \makeindex comm<strong>and</strong><br />

in the preamble, it is a good idea <strong>to</strong> include them in the text from the initial<br />

development of the document. The \makeindex comm<strong>and</strong> can be included later<br />

when the final version of the document is ready. At this point, the MakeIndex<br />

program can be run <strong>to</strong> produce the theindex environment from the data in the<br />

.idx file just as BIBTEX produces thebibliography environments. This <strong>to</strong>ol is<br />

described in the next section.<br />

The LAT Package:<br />

EX installation also contains the package showidx, which prints<br />

showidx the index entries from the \index comm<strong>and</strong>s as marginal notes, beginning<br />

at the <strong>to</strong>p of the page on which they occur. This is useful for going through<br />

a preliminary version of the document <strong>to</strong> check that all index entries are<br />

really on the proper page or whether additional entries have <strong>to</strong> be made.<br />

If showidx is used, it is a good idea <strong>to</strong> increase the width of the marginal<br />

note box with the declaration \marginparwidth (Section 4.10.6) in the<br />

preamble. Unfortunately, the present book format is not suitable for such<br />

a demonstration.<br />

9.4.3 Running MakeIndex<br />

The tiresome drudgery of making up the theindex environment for a<br />

keyword index can be dispensed with if the program MakeIndex is available.<br />

This program was written by Pehong Chen with the support of<br />

Leslie Lamport. We will give only an abbreviated description of its use<br />

here. More details are in the documentation accompanying the program<br />

package.<br />

The program MakeIndex processes the .idx file, producing as output<br />

another file with the root name of the document <strong>and</strong> the extension.ind,<br />

containing the complete theindex environment. It is run by clicking the<br />

appropriate icon in the edi<strong>to</strong>r shell, or from a comm<strong>and</strong> line with<br />

makeindex root name.idx or simply makeindex root name<br />

A subsequent LAT Package:<br />

EX processing outputs the index at the location of<br />

makeidx the \printindex comm<strong>and</strong> which, <strong>to</strong>gether with the \see comm<strong>and</strong>, is<br />

defined in the package makeidx. Thus the production of an index in this<br />

way requires the package file makeidx <strong>to</strong> be loaded with the \usepackage<br />

comm<strong>and</strong>.<br />

The alphabetical ordering of MakeIndex normally follows the st<strong>and</strong>ard<br />

ascii code, first symbols, then digits, <strong>and</strong> finally letters, where upper case<br />

comes before lower case. Blanks are included as symbols. There are a


9.4. Keyword index 229<br />

number of options that allow these rules <strong>to</strong> be changed. How the options<br />

are invoked when the program is called depends on the computer type,<br />

but we assume here a hyphen preceding the option letter, as in<br />

makeindex -g -l root name<br />

The most important options are:<br />

-l Letter ordering: blanks are ignored when sorting;<br />

-c Compress blanks: multiple <strong>and</strong> leading blanks are removed as<br />

they are in normal L AT E X;<br />

-g German ordering: following the German rules in which symbols<br />

precede letters (lower before upper case) which precede numbers;<br />

the sequences "a, "o, "u, <strong>and</strong> "s (the codes for ä, ö, ü, <strong>and</strong> ß<br />

in the usual L AT E X adaptations for German) are treated as though<br />

they were ae, oe, ue, <strong>and</strong> ss, which is st<strong>and</strong>ard German practice;<br />

-s Style specification: allows the name of an index formatting file<br />

<strong>to</strong> be included <strong>to</strong> redefine the functioning of MakeIndex.<br />

The -s option reads in an index style file containing comm<strong>and</strong>s <strong>to</strong><br />

define both the input <strong>and</strong> output of the MakeIndex program. For example,<br />

it is possible <strong>to</strong> change the special symbols !, @, |, <strong>and</strong> " so that different<br />

characters execute their functions <strong>and</strong> they themselves revert <strong>to</strong> being<br />

pure text.<br />

The style-defining file consists of a list of pairs in the form keyword attribute.<br />

The attribute is either one character in single quotes (for example,<br />

’z’), or a character string in double quotes (for example, "a string").<br />

The most important keywords, <strong>to</strong>gether with their default definitions, are:<br />

quote ’"’ defines the quote symbol;<br />

level ’!’ defines the entry separation symbol;<br />

actual ’@’ defines the lexical switch symbol;<br />

encap ’|’ defines the dummy comm<strong>and</strong> symbol for page formatting.<br />

There are many more keywords for defining complicated output structures.<br />

These are described in the documentation that should be included<br />

with the MakeIndex program package.<br />

The file makeindex.tex contains a short manual by Leslie Lamport<br />

(but without mentioning style definitions).


230 Chapter 9. Document Management<br />

9.4.4 Glossary<br />

A ‘glossary’ is a special index of terms <strong>and</strong> phrases alphabetically ordered<br />

<strong>to</strong>gether with their explanations. To help set up a glossary, L AT E X offers<br />

the comm<strong>and</strong>s<br />

\makeglossary in the preamble <strong>and</strong><br />

\glossary{glossary entry} in the text part<br />

which function just like the comm<strong>and</strong>s for making up a keyword index.<br />

The entries are written <strong>to</strong> a file with extension .glo after the comm<strong>and</strong><br />

\makeglossary has been given in the preamble. The form of these file<br />

entries from each \glossary comm<strong>and</strong> is<br />

\glossaryentry{glossary entry}{pagenumber}<br />

The information the .glo file can be used <strong>to</strong> establish a glossary.<br />

However, there is no equivalent <strong>to</strong> the theindex environment for a glossary,<br />

but a recommended structure is the description environment<br />

(Section 4.3.3) or a special list environment (Section 4.4).


10<br />

PostScript <strong>and</strong> PDF<br />

PostScript is a printing <strong>and</strong> plotting language developed by the Adobe<br />

Systems Inc. Unlike the printing instructions for other types of printers,<br />

the PostScript code may be written <strong>to</strong> an ascii file, viewed on a computer<br />

moni<strong>to</strong>r, put online, downloaded, included in emails. It therefore<br />

represents a type of electronic paper.<br />

It is also a programming language, <strong>and</strong> thus offers enormous possibilities<br />

for including special effects that cannot easily be inserted with other<br />

output formats. Several packages exist <strong>to</strong> exploit these, packages which<br />

are then limited <strong>to</strong> PostScript output. However, the PostScript advantages<br />

are so attractive that this can be justified.<br />

Portable Document Format, PDF, is another Adobe product, a successor<br />

<strong>to</strong> PostScript, inheriting many of it properties. However, PDF includes<br />

many features <strong>to</strong> make it applicable <strong>to</strong> true electronic documents: internal<br />

<strong>and</strong> external links, bookmarks, animation, encryption, etc., features that<br />

have no correspondence in paper. It represents a revolutionary new type<br />

of information medium.<br />

PostScript has played a very important role in the development of<br />

L AT E X, setting the st<strong>and</strong>ards for graphics inclusion, <strong>and</strong> offering additional<br />

font families over the st<strong>and</strong>ard Computer Modern set. Now PDF carries<br />

on that tradition. With the pdfT E X program, PDF is actually married <strong>to</strong> T E X<br />

<strong>and</strong> thus <strong>to</strong> L AT E X.<br />

In the next sections we describe the generation of PostScript output<br />

with L AT E X, the usage of PostScript (type 1) fonts, <strong>and</strong> then the production<br />

of PDF output with all its bells <strong>and</strong> whistles.<br />

10.1 L AT E X <strong>and</strong> PostScript<br />

PostScript output is best produced with the dvips driver program written<br />

by Tomas Rokicki, available with most T E X installations. It is this very<br />

powerful <strong>and</strong> flexible program that has set the st<strong>and</strong>ard for DVI conversion<br />

programs.<br />

231


232 Chapter 10. PostScript <strong>and</strong> PDF<br />

Its two most significant features are the inclusion of graphics as encapsulated<br />

PostScript images, as described in Chapter 6, <strong>and</strong> the capability of<br />

making use of PostScript fonts in place of the Computer Modern ones (Section<br />

G.5). There are also enhanced drawing capabilities, as demonstrated<br />

in Sections 13.2.2 <strong>and</strong> 13.3.2.<br />

10.1.1 The dvips driver<br />

The dvips driver program operates on the DVI result from T E X, with or<br />

without L AT E X, <strong>to</strong> generate PostScript output, which may be written <strong>to</strong> a<br />

file or sent directly <strong>to</strong> a printer. One either clicks the appropriate icon in<br />

the edi<strong>to</strong>r shell, or issues the comm<strong>and</strong> from a comm<strong>and</strong> line prompt:<br />

dvips myfile<br />

<strong>to</strong> process myfile.dvi <strong>and</strong> generate myfile.ps. (The L AT E X source text<br />

was of course in myfile.tex.) The PostScript file may be viewed with<br />

a PostScript viewer like GhostView or sent <strong>to</strong> a PostScript printer, or<br />

included in an email.<br />

There are many options that may be included in the comm<strong>and</strong> line,<br />

appearing between dvips <strong>and</strong> the file name. For example, <strong>to</strong> output five<br />

pages only starting at the 10th, sending them <strong>to</strong> a file named p5-15.ps,<br />

give<br />

dvips -p 10 -n 5 -o p5-15 myfile<br />

You may also specify the first (-p) <strong>and</strong> last (-l) page numbers, whether<br />

only odd (-A) or even (-B) pages are <strong>to</strong> be printed, or in reverse order (-r).<br />

The page numbers with -p <strong>and</strong> -l refer <strong>to</strong> the actual page numbers in<br />

the document, or rather <strong>to</strong> its first occurrence. Hence -p 8 might start<br />

with page viii rather than page 8. Specifying -p =8 will start with the 8th<br />

page, regardless of its actual number. The list of options can be printed<br />

<strong>to</strong> the moni<strong>to</strong>r with dvips --help.<br />

One useful option is t l<strong>and</strong>scape <strong>to</strong> rotate the output in<strong>to</strong> l<strong>and</strong>scape<br />

mode, which should be done if the document has been processed with<br />

the l<strong>and</strong>scape option in \documentclass. However, dvips has another<br />

way of accomplishing this: add the driver-specific comm<strong>and</strong><br />

\special{l<strong>and</strong>scape}<br />

in the source text itself <strong>and</strong> dvips will au<strong>to</strong>matically print in l<strong>and</strong>scape<br />

mode.<br />

The output is written <strong>to</strong> a file with the same root name as the input,<br />

but with extension .ps, unless the option -o filename is given. To send<br />

the output directly <strong>to</strong> a printer, specify that printer as the output ‘file’, as<br />

-o \lpt1. Beware, if that printer is not a PostScript printer, it will simply<br />

output the PostScript code directly as text, something that normally uses<br />

a considerable amount of paper.


10.1. L AT E X <strong>and</strong> PostScript 233<br />

A full manual for dvips should be available as dvips.ps or dvips.pdf;<br />

otherwise the source file dvips.tex can be processed (with T E X, not L AT E X!).<br />

The program is configured <strong>to</strong> the local installation by means of a file<br />

config.ps that should be located in texmf\dvips\config. This sets<br />

up certain parameters for the default printer, as well as various paper<br />

formats, indicating which is <strong>to</strong> be the default (European A4 or American<br />

letter). This can be overridden with -t a4 or -t letter. Another<br />

important configuration item is a list of font mapping files (Section 10.1.3),<br />

<strong>to</strong> associate T E X font names with actual PostScript fonts <strong>and</strong> their files.<br />

Additional configuration files are usually provided, for specific printers<br />

or other font mappings, all with the name config plus a different<br />

extension. They may be invoked on the comm<strong>and</strong> line with the option<br />

-P plus extension. For example, config.cx contains lines for a generic<br />

PostScript printer with resolution of 300 dpi; with -P cx, this file is input,<br />

overriding the default values in config.ps. Another example for adding<br />

PostScript fonts is given in Section 10.1.3.<br />

Of course, the dvips driver manages not only PostScript fonts but<br />

also the st<strong>and</strong>ard T E X pixel fonts generated by the METAFONT program<br />

(Section G.3). These bitmaps are s<strong>to</strong>red in .pk files that need <strong>to</strong> be<br />

generated for the desired printer, size, <strong>and</strong> resolution. Originally, the<br />

user had <strong>to</strong> ensure that they were present before the driver program<br />

could address them. Fortunately, dvips has revolutionized this process<br />

by calling METAFONT itself if the needed.pk files are missing.<br />

However, it is the use of PostScript fonts that make dvips especially<br />

interesting. We describe in some detail how they are integrated in<strong>to</strong><br />

the T E X/L AT E X system in the next sections since almost all of this applies<br />

equally well <strong>to</strong> PDF output.<br />

10.1.2 Invoking PostScript fonts<br />

Under the New Font Selection Scheme of Appendix A, it is relatively<br />

simple <strong>to</strong> invoke the PostScript fonts, provided that the font definition<br />

.fd files are provided. These are normally <strong>to</strong> be found in the direc<strong>to</strong>ry<br />

psnfss in the st<strong>and</strong>ard installations. It also contains packages for the 35<br />

st<strong>and</strong>ard PostScript fonts, plus those for a number of other commercially<br />

available fonts. These packages are actually quite simple; for example,<br />

the times.sty file contains only four lines, which are listed on page 379.<br />

All these packages do is redefine the three font families, \rmdefault,<br />

\sfdefault, \ttdefault <strong>and</strong> the bold face default attribute \bfdefault.<br />

The packages for the 35 st<strong>and</strong>ard fonts, <strong>and</strong> the three assignments<br />

that they make, are listed in Table 10.1 on the next page. (The 35 fonts<br />

include italic <strong>and</strong> bold variants of these.)<br />

These packages are only meaningful when the resulting DVI output is<br />

<strong>to</strong> be transformed with dvips <strong>to</strong> PostScript or PDF files, or when the L AT E X<br />

source is <strong>to</strong> be processed with pdfT E X <strong>to</strong> generate PDF directly. Other


234 Chapter 10. PostScript <strong>and</strong> PDF<br />

Table 10.1: The psnfss packages <strong>and</strong> their fonts<br />

Package \rmfamily \sffamily \ttfamily<br />

times.sty Times-Roman Helvetica Courier<br />

palatino.sty Palatino Helvetica Courier<br />

newcent.sty NewCenturySchlbk AvantGarde Courier<br />

bookman.sty Bookman AvantGarde Courier<br />

avant.sty AvantGarde<br />

helvet.sty Helvetica<br />

drivers can only h<strong>and</strong>le the T E X pixel fonts described in Appendix G (also<br />

known as type 3 fonts). Some drivers, in particular the moni<strong>to</strong>r previewers<br />

xdvi <strong>and</strong> windvi, will also invoke programs <strong>to</strong> generate the bitmap .pk<br />

files from the PostScript.pfb source files.<br />

Why bother <strong>to</strong> use these packages when dvips is capable of including<br />

the pixel fonts just as well? The answer is that the st<strong>and</strong>ard PostScript<br />

fonts are well known from other applications, <strong>and</strong> there are additional<br />

commercially available fonts in PostScript format; they therefore offer a<br />

wider choice than simply the traditional Computer Modern fonts that are<br />

limited <strong>to</strong> T E X <strong>and</strong> L AT E X.<br />

Furthermore, although the pixel fonts can be included in PDF output,<br />

the results viewed on the moni<strong>to</strong>r are simply atrocious. They are slow<br />

<strong>to</strong> draw <strong>and</strong> appear very fuzzy. (They do print all right, however.) PDF<br />

should make use of PostScript fonts exclusively. In Section G.6 we explain<br />

how the st<strong>and</strong>ard Computer Modern <strong>and</strong> Extended Modern fonts are now<br />

available in PostScript encoding, especially for this need.<br />

10.1.3 Installing PostScript fonts<br />

The packages listed in the previous section invoke the PostScript fonts by means<br />

! of the NFSS system, provided they have been properly included in the installation.<br />

This means that the following files must be present:<br />

.tfm the font metric files for both the virtual <strong>and</strong> raw fonts;<br />

.fd the NFSS font definition files associating the font attributes <strong>to</strong> precise<br />

virtual font names; these <strong>and</strong> the.tfm files are the only ones read by L AT E X<br />

itself;<br />

.vf virtual font files that instruct the DVI driver how <strong>to</strong> produce the characters;<br />

usually this refers <strong>to</strong> characters in a real font with different encoding;<br />

.map mapping files that tell the dvips driver the true internal names of the real<br />

fonts, plus any re-encodings or dis<strong>to</strong>rtions that must be undertaken.


10.1. L AT E X <strong>and</strong> PostScript 235<br />

The.map files are a feature of dvips that has been taken over by pdfT E X <strong>and</strong><br />

other programs that make use of PostScript fonts. It translates the L AT E X names<br />

for the fonts in<strong>to</strong> the internal names used by PostScript itself. For example, the<br />

line<br />

ptmr8r Times-Roman "TeXBase1Encoding ReEncodeFont"


236 Chapter 10. PostScript <strong>and</strong> PDF<br />

The encoding <strong>and</strong> family indicate the font definition file that associates these<br />

attributes with real font names, in this case ot1ptm.fd. In that file, one finds<br />

this set of attributes <strong>to</strong> be assigned <strong>to</strong> font ptmbo7t; this is the Berry name for<br />

Times-BoldOblique, 7-bit-text (Tables G.2 <strong>and</strong> G.3 on pages 504 <strong>and</strong> 505).<br />

Our sample input code is \AE; according <strong>to</strong> file ot1enc.def, this corresponds<br />

<strong>to</strong> character 29 in the OT1 encoding. L AT E X thus writes instructions <strong>to</strong> the .dvi<br />

file <strong>to</strong> output the symbol in position 29 of font ptmbo7t. And with that, L AT E X is<br />

finished with its part of the operation.<br />

The next step is <strong>to</strong> process the .dvi file with the dvips driver. When this<br />

program searches for a font, it first looks in the map files, then it seeks the .vf<br />

virtual font files, <strong>and</strong> finally it tries <strong>to</strong> find it as a .pk pixel file. In our case, it<br />

discovers the virtual font ptmbo7t.vf, which tells the driver that character 29 is<br />

<strong>to</strong> be symbol 198 of font ptmbo8r. This is the same basic font but with 8-bit-raw<br />

encoding. Again dvips searches for this next font, <strong>and</strong> finds it in a mapping file,<br />

containing the line<br />

ptmbo8r Times-Bold ".167 SlantFont TeXBase1Encoding<br />

ReEncodeFont"


10.2. Portable Document Format 237<br />

Where Adobe makes its money is in the sales of programs <strong>to</strong> produce<br />

<strong>and</strong> manipulate PDF files. Of these, the main ones are:<br />

• Acrobat Distiller <strong>to</strong> convert PostScript in<strong>to</strong> PDF, <strong>and</strong><br />

• Acrobat program <strong>to</strong> modify existing PDF files.<br />

In the latter case, ‘modification’ means adding links, changing colors,<br />

including navigational aids, <strong>and</strong> inserting notes; it does not mean altering<br />

the actual textual content in any way.<br />

Today most graphical <strong>and</strong> text processing programs are capable of<br />

generating PDF output. For the L AT E X user, there are three routes that<br />

may be taken <strong>to</strong> produce PDF output. The obvious one is.tex →.dvi →<br />

.ps → .pdf using dvips <strong>to</strong> generate the PostScript <strong>and</strong> then Distiller or<br />

Ghostscript <strong>to</strong> create the PDF file.<br />

The other two methods are <strong>to</strong> employ a DVI-<strong>to</strong>-PDF driver, or the pdfT E X<br />

program <strong>to</strong> go directly <strong>to</strong> PDF, by-passing the intermediate DVI output.<br />

We describe each of these in the next sections.<br />

Used on their own, all of these methods produce a simple PDF file<br />

containing nothing more than the text itself, a sort of electronic paper.<br />

The hypertext features that make an electronic document really live can<br />

be added au<strong>to</strong>matically with the help of the hyperref package described<br />

in Section 10.2.4.<br />

10.2.2 The dvipdfm driver<br />

The driver program dvipdfm by Mark A. Wicks is the equivalent of dvips<br />

for PDF output. As its name implies, it converts DVI <strong>to</strong> PDF output. (The<br />

m suffix is <strong>to</strong> distinguish it from a previously announced dvipdf program<br />

that never came <strong>to</strong> fruition.)<br />

Graphics input can be included with the graphics or graphicx packages<br />

(Section 6.1) by specifying the option dvipdfm. The allowed graphics<br />

formats are JPEG, PNG, <strong>and</strong> PDF.<br />

The program is called from a comm<strong>and</strong> line with<br />

dvipdfm myfile<br />

<strong>to</strong> convert myfile.dvi <strong>to</strong> myfile.pdf. As for dvips, there are many<br />

options that may be included. It is best <strong>to</strong> read the provided manual in<br />

dvipdfm.pdf or dvipdfm.dvi, or produce it by processing dvipdfm.tex<br />

with T E X.<br />

The configuration is set up by means of a file named config in the<br />

dvipdfm direc<strong>to</strong>ry. This is set up similarly <strong>to</strong> the config.ps file for<br />

dvips, including the list of mapping files, although these have a different<br />

syntax <strong>to</strong> those of dvips.<br />

Hypertext features <strong>and</strong> other PDF additions can be added with the<br />

hyperref package (Section 10.2.4).


238 Chapter 10. PostScript <strong>and</strong> PDF<br />

10.2.3 The pdfT E X program<br />

The most direct method of getting PDF output is <strong>to</strong> process the L AT E X file<br />

with pdfT E X, a variation on the T E X program developed by Hàn Thê ´ Thành.<br />

The following points should be noted:<br />

• pdfT E X behaves just like the regular T E X program unless the declaration<br />

\pdfoutput=1 is issued before the first page is output; in this<br />

case, it generates PDF instead of DVI output <strong>and</strong> activates many new<br />

T E X-like comm<strong>and</strong>s for including PDF features.<br />

• Since pdfT E X combines the functionality of both the T E X program<br />

<strong>and</strong> a DVI driver, it must be able <strong>to</strong> deal with fonts in the way that a<br />

driver program would. Originally this meant that it could only h<strong>and</strong>le<br />

PostScript type 1 fonts, but now it can also cope with METAFONT<br />

bitmap fonts (type 3) as well as TrueType fonts. The bitmap fonts<br />

however look very bad when viewed, but this is a viewer problem.<br />

• When started, the program reads a configuration file pdftex.cfg<br />

which can set many parameters, as such page size, offsets, PDF<br />

compression level, <strong>and</strong> specifies the names of font mapping files.<br />

It may also set the default output <strong>to</strong> PDF, avoiding having <strong>to</strong> set<br />

\pdfoutput in the source text.<br />

• The font map files are identical <strong>to</strong> those used by dvips (page 236);<br />

they relate the T E X name for the font <strong>to</strong> various characteristics,<br />

encoding scheme, true name, <strong>and</strong> specify the file containing the<br />

character drawing instructions.<br />

• New T E X-like comm<strong>and</strong>s exist <strong>to</strong> include PDF features, like compression<br />

level, page attributes, document information, opening setup,<br />

forms, annotations, links, bookmarks, <strong>and</strong> article threads.<br />

• Graphics can be included in PNG, TIFF, or JPEG formats; PDF files<br />

may be inserted provided they contain only a single page without<br />

any fonts or bitmaps. The graphics packages (Section 6.1) support<br />

pdfT E X by means of a pdftex graphics option.<br />

To run pdfT E X with L AT E X (often referred <strong>to</strong> as pdfL AT E X), it is necessary<br />

<strong>to</strong> generate a L AT E X format (Section B.1.3) using pdfT E X instead of T E X, with<br />

the -ini option, renaming the resulting latex.fmt <strong>to</strong> pdflatex.fmt; it<br />

is then called with the comm<strong>and</strong><br />

pdftex &pdflatex<br />

Most installations contain a comm<strong>and</strong> pdflatex that translates <strong>to</strong> this<br />

combination. The edi<strong>to</strong>r shell should also have an icon that invokes this<br />

comm<strong>and</strong>.


10.2. Portable Document Format 239<br />

We do not describe the new T E X-like comm<strong>and</strong>s <strong>to</strong> add PDF features<br />

<strong>to</strong> the output, preferring <strong>to</strong> use the L AT E X-like comm<strong>and</strong>s of the hyperref<br />

package. For information on the intrinsic new pdfT E X comm<strong>and</strong>s, see The<br />

L AT E X Web Companion (Goossens <strong>and</strong> Rahtz, 1999), which also explains the<br />

hyperref package in detail. The pdfT E X manual should also be available<br />

on your system under texmf\doc\pdftex\ in various formats.<br />

So which of the above methods is <strong>to</strong> be recommended? The PostScript<br />

+ Distiller is the most inelegant, involving two intermediate steps (DVI<br />

<strong>and</strong> PS) <strong>and</strong> requires purchasing the Distiller program. Alternatively one<br />

can use the free GhostView program for the conversion <strong>to</strong> PDF, but one<br />

still has the intermediate steps. And if one selects this route, one must be<br />

certain that dvips uses the PostScript version of the Computer Modern<br />

fonts, by setting up the mapping files accordingly.<br />

The dvipdfm program is in the original spirit of T E X, that uses DVI<br />

as a universal intermediate format for all outputs. Purists might tend<br />

<strong>to</strong> respect this ideal. After all, no one ever considered rewriting T E X <strong>to</strong><br />

produce PostScript output directly. That said, one must consider that T E X<br />

was invented in the days when no one printer specification dominated<br />

the field. Today, PDF is much more than a printer format; it is the means<br />

of representing documents electronically. That alone would not justify<br />

preferring pdfT E X over a DVI-<strong>to</strong>-PDF converter, nor would the fact that<br />

it saves a processing step; the deciding argument is that pdfT E X has<br />

established itself as reliable, robust, <strong>and</strong> flexible.<br />

In the end, it is likely a question of which program one is more<br />

comfortable with, <strong>and</strong> which one has given the better results for the<br />

particular user.<br />

10.2.4 The hyperref package<br />

Package: Sebastian Rahtz has written an ambitious package hyperref <strong>to</strong> add auhyperref<br />

<strong>to</strong>matic hypertext links <strong>to</strong> LAT EX documents that are intended <strong>to</strong> become<br />

HTML (using LAT EX2HTML, Section E.1.1 or TEX4ht, Section E.1.2) or PDF<br />

files (using any of the methods described above). Not only do all internal<br />

cross-references link <strong>to</strong> their reference points, citations are also linked <strong>to</strong><br />

the list of references, table of contents <strong>to</strong> the section headings, <strong>and</strong> index<br />

listings <strong>to</strong> the original text. Additional links <strong>to</strong> external documents are<br />

possible by means of a single syntax for all types of output. And it does<br />

this with a uniform syntax even though all the conversion methods have<br />

their own syntaxes.<br />

Because this package redefines many aspects of the LAT EX kernel <strong>and</strong><br />

of many other packages, it should always be loaded as the very last one<br />

<strong>to</strong> be sure that it has the final word.<br />

It is especially for PDF output, whether by means of PostScript plus<br />

Distiller, with dvipdfm, or directly with pdfTEX, that this package is extremely<br />

useful. Figure 10.1 on the next page gives an example of such a


240 Chapter 10. PostScript <strong>and</strong> PDF<br />

Figure 10.1: Output produced by pdfT E X with the hyperref package for<br />

au<strong>to</strong>matic links, with an outline list at the left.<br />

PDF file, where it should be noted that the table of content entries are all<br />

links <strong>to</strong> their sections, as are the entries in the left-h<strong>and</strong> outline, which is<br />

also generated au<strong>to</strong>matically. The package provides L AT E X-like comm<strong>and</strong>s<br />

for the PDF features.<br />

Before we go any further, we should explain certain terms that are<br />

used below.<br />

Links are indicated as a piece of text in a different color, or surrounded by<br />

a frame, or may be an image, which when clicked cause the viewer<br />

<strong>to</strong> jump <strong>to</strong> another document or some other place in the current<br />

document.<br />

Anchors (also called targets) are the destinations for links. They are provided<br />

with an identifying name so that the link can find them. Some<br />

anchors are meant only for internal linking within the document,<br />

while others are visible from outside.<br />

Thumbnails are small images of the pages that are displayed in a thumbnail<br />

window by the viewer. They may be used <strong>to</strong> locate a certain<br />

page more quickly, especially if it has an obviously different appearance<br />

because of a figure it contains. Double clicking the page image<br />

causes the viewer <strong>to</strong> jump <strong>to</strong> that page.<br />

Bookmarks are special links <strong>to</strong> places in the document, associated with<br />

a view, usually meaning a zoom fac<strong>to</strong>r, or a specification like ‘fit


10.2. Portable Document Format 241<br />

page <strong>to</strong> width of window’. The bookmark window displays all these,<br />

<strong>and</strong> by double clicking them, one jumps <strong>to</strong> that location <strong>and</strong> view.<br />

Bookmarks are ordered within a tree, with sub-bookmarks <strong>and</strong> so<br />

on. The bookmark display may have the tree opened or closed.<br />

Outline is the usual use for bookmarks, building a table of contents, or<br />

outline, for the whole document. The word ‘outline’ is used here,<br />

but the PDF viewers refer <strong>to</strong> ‘bookmarks’. The latter if really far<br />

more general.<br />

Options for hyperref<br />

There are a large number of parameters that may be configured for the<br />

package, either as options in the \usepackage comm<strong>and</strong>, or with the<br />

\hypersetup comm<strong>and</strong>, or with a configuration file. An example of<br />

setting options with the first method is:<br />

\usepackage[pdftex,<br />

pdftitle={Graphics <strong>and</strong> Color with <strong>LaTeX</strong>},<br />

pdfauthor={Patrick W Daly},<br />

pdfsubject={Importing images <strong>and</strong> use of color in <strong>LaTeX</strong>},<br />

pdfkeywords={<strong>LaTeX</strong>, graphics, color},<br />

pdfpagemode=UseOutlines,<br />

bookmarks,bookmarksopen,<br />

pdfstartview=FitH,<br />

colorlinks,linkcolor=blue,citecolor=blue,<br />

urlcolor=red,<br />

]<br />

{hyperref}<br />

Options that take a value are given with an equals sign <strong>and</strong> the value;<br />

for multiple values, or text, the values must be placed within curly braces,<br />

as shown in the example. Options that are either true or false are<br />

simply given (<strong>to</strong> make them true) or equated <strong>to</strong> false. Options may also<br />

be given with the \hypersetup comm<strong>and</strong>, as for example:<br />

\hypersetup{colorlinks, linkcolor=blue}<br />

Values that are colors must be a name of a defined color, as explained<br />

in Section 6.2; the name must be defined before it is first used. However,<br />

some color values must be the three numbers of the rgb model. The<br />

colors of link borders may only be given as rgb. The hyperref package<br />

au<strong>to</strong>matically loads the color package if colorlinks is given.<br />

One option must specify the driver name for which the output is<br />

intended; in the above example this is pdftex, but other possibilities are:<br />

dvipdf dvipdfm dvips dvipsone dviwindo hypertex<br />

latex2html pdftex tex4ht textures vtex


242 Chapter 10. PostScript <strong>and</strong> PDF<br />

The option hypertex is not for any particular driver, but rather for any<br />

that conforms <strong>to</strong> the HyperT E X guidelines, such as dvips. There is also a<br />

draft option that turns off all hypertext features.<br />

The next four options in the example (pdftitle–pdfkeywords) are<br />

entries for the PDF document information s<strong>to</strong>red in the file <strong>and</strong> displayed<br />

only when the viewer shows the document summary. The complete set of<br />

such options is:<br />

pdfauthor pdfcrea<strong>to</strong>r pdfkeywords<br />

pdfproducer pdfsubject pdftitle<br />

The st<strong>and</strong>ard paper size options of Section 3.1.1 are all recognized<br />

<strong>and</strong> one of them must be given, either as an option <strong>to</strong> hyperref or as a<br />

global option in the \documentclass comm<strong>and</strong>. This is necessary <strong>to</strong> set<br />

up the size of the PDF page. Reminder, these are:<br />

a4paper a5paper b5paper<br />

executivepaper legalpaper letterpaper<br />

Here is a list of all of the remaining options, with default value in<br />

brackets.<br />

4 (false) use Acrobat 4 features;<br />

anchorcolor<br />

(black) set color of anchors (targets of internal links);<br />

backref<br />

(false) adds links in the bibliography back <strong>to</strong> the citation; with<br />

pagebackref, a list of pages is added <strong>to</strong> the bibliography, each<br />

being a link back <strong>to</strong> the citation;<br />

baseurl<br />

determines the prefix for URLs given with \href;<br />

bookmarks<br />

(true) make bookmarks out of sectioning comm<strong>and</strong>s;<br />

bookmarksnumbered<br />

(false) include section numbers in bookmark text;<br />

bookmarksopen<br />

(false) start document with bookmarks tree opened;<br />

bookmarksopenlevel<br />

(max) the level <strong>to</strong> which bookmarks are opened;<br />

bookmarkstype<br />

(<strong>to</strong>c) specifies which ‘contents’ file used for bookmarks;<br />

breaklinks<br />

(false) allows link text <strong>to</strong> break over lines;


10.2. Portable Document Format 243<br />

citebordercolor<br />

(0 1 0) the color of the border around citations;<br />

citecolor<br />

(green) color of citation links when colorlinks given;<br />

colorlinks<br />

(false, but true for tex4ht <strong>and</strong> dviwindo) link <strong>and</strong> anchor<br />

texts are <strong>to</strong> be colored, according <strong>to</strong> color specifications for the<br />

various types of links; without this, link text is surrounded by a<br />

frame;<br />

debug (false) output diagnostic messages;<br />

draft (false) turn off all hyperlinking;<br />

extension<br />

(dvi) default extension of linked files using the xr package (Section<br />

9.2.3); the package tries <strong>to</strong> guess whether the file specified<br />

by \externaldocument should be.dvi or.pdf; with PDF output,<br />

the viewer will open that external file <strong>and</strong> switch <strong>to</strong> it;<br />

filebordercolor<br />

(0 .5 .5) color of the border around file links;<br />

filecolor<br />

(cyan) color of file links when colorlinks given;<br />

frenchlinks<br />

(false) use small caps instead of color for links;<br />

hyperfigures<br />

(false) make figures in<strong>to</strong> hyperlinks;<br />

hyperindex<br />

(true) make index entries in<strong>to</strong> links back <strong>to</strong> referenced text;<br />

hypertexnames<br />

(true) use guessable (obvious) names for links;<br />

implicit<br />

(true) redefine L AT E X internal comm<strong>and</strong>s;<br />

linkbordercolor<br />

(1 0 0) color of the border around links;<br />

linkcolor<br />

(red) color of link text when colorlinks given;<br />

link<strong>to</strong>cpage<br />

(false) the page numbers in the table of contents (or list of<br />

figures/tables) are the links, rather than the text itself;


244 Chapter 10. PostScript <strong>and</strong> PDF<br />

menubordercolor<br />

(1 0 0) color of the border around Acrobat menu links;<br />

menucolor<br />

(red) color for Acrobat menu links when colorlinks given;<br />

naturalnames<br />

(false) use L AT E X-computed names for links;<br />

nesting<br />

(false) links are allowed <strong>to</strong> be nested, although none of the<br />

existing drivers support this;<br />

pageanchor<br />

(true) an anchor (target) is placed au<strong>to</strong>matically on every page,<br />

something that is necessary of the table of contents is <strong>to</strong> act as<br />

links;<br />

pagebackref<br />

(false) adds <strong>to</strong> each entry in the bibliography a list of page<br />

numbers linked <strong>to</strong> their citations;<br />

pagebordercolor<br />

(1 1 0) color of the border around page links;<br />

pagecolor<br />

(red) color of page links when colorlinks given;<br />

pdfborder<br />

(0 0 1, but 0 0 0 with colorlinks) width of the border around<br />

links in PDF files; the first two numbers are always zero, the third<br />

is the line thickness in points;<br />

pdfcenterwindow<br />

(false) positions the document window in the center of the<br />

computer moni<strong>to</strong>r when the PDF file is opened;<br />

pdffitwindow<br />

(false) resizes the document window <strong>to</strong> fit the first page when<br />

the PDF file is opened;<br />

pdfhighlight<br />

(/I) determines how the Acrobat menu but<strong>to</strong>ns behave when<br />

clicked; /I for inverse, /N for none, /O for outline, /P inset<br />

highlighting;<br />

pdfmenubar<br />

(true) makes the menu bar in the PDF viewer visible;<br />

pdfnewwindow<br />

(false) a new window is opened when the PDF viewer switches<br />

<strong>to</strong> another file;


10.2. Portable Document Format 245<br />

pdfpagelayout<br />

(SinglePage) determines the page layout for the PDF viewer;<br />

other values are OneColumn (all pages in a continuous column),<br />

TwoColumnLeft (two columns, with odd numbers on the left),<br />

TwoColumnRight (two columns, with odd numbers on the right);<br />

pdfpagemode<br />

(None) determines initial display in the PDF viewer; other values<br />

are UseThumbs (show thumbnails), UseOutline (show bookmarks),<br />

FullScreen (no <strong>to</strong>ol or menu bars, window is full screen);<br />

pdfpagescrop<br />

a set of four numbers determining the crop box when the the<br />

PDF file is opened, similar <strong>to</strong> a bounding box;<br />

pdfpagetransition<br />

(R) determines how the pages are changed; possible values are<br />

Split (like opening a curtain), Blinds (like Venetian blinds), Box<br />

(a rectangle opens from the center), Wipe (vertical line moves<br />

across page), Dissolve (old page dissolves in<strong>to</strong> new), Glitter<br />

(variation on dissolve), R (replace); additional parameters can be<br />

added where appropriate: /Dm (with Split <strong>and</strong> Blinds) followed<br />

by /H (horizontal) or /V (vertical), /Di (with Wipe <strong>and</strong> Glitter)<br />

followed by 90, 180, 270 for the direction of motion, /M (with<br />

Split <strong>and</strong> Box) followed by /I (inwards), /O (outwards); see<br />

page 344 for a simplified interface <strong>to</strong> this feature;<br />

pdfstartpage<br />

(1) the first page number <strong>to</strong> be displayed when the PDF file is<br />

opened;<br />

pdfstartview<br />

(Fit) determines the initial view when the PDF file is opened;<br />

takes values of Fit (fit page <strong>to</strong> window), FitH (fit <strong>to</strong> width), FitV<br />

(fit <strong>to</strong> height), FitB (fit <strong>to</strong> bounding box), FitBH (fit <strong>to</strong> bounding<br />

box width), FitBV (fit <strong>to</strong> bounding box height), XYZ (no change);<br />

pdf<strong>to</strong>olbar<br />

(true) makes the <strong>to</strong>ol bar in the PDF viewer visible;<br />

pdfview<br />

(XYZ) determines the page view when a link moves <strong>to</strong> a new page;<br />

takes same values as pdfstartview;<br />

pdfwindowui<br />

(true) makes the user interface elements (bookmarks, thumbnails)<br />

in the PDF viewer available; if false, they are permanently<br />

switched off;


246 Chapter 10. PostScript <strong>and</strong> PDF<br />

plainpages<br />

(true) makes the anchors for the pages <strong>to</strong> be their Arabic form; if<br />

false, the page anchors are as the page numbers are formatted,<br />

highly recommended if the document contains both Roman <strong>and</strong><br />

Arabic page numbers;<br />

raiselinks<br />

(false) with the hypertex driver, makes the border around links<br />

the actual height of their contents, rather than the current baseline<br />

separation;<br />

runbordercolor<br />

(0 .7 .7) color of the border around ‘run’ links;<br />

unicode<br />

(false) enables Unicode encoded PDF strings;<br />

urlbordercolor<br />

(0 1 1) color of the border around URL links;<br />

urlcolor<br />

(magenta) color of URL links when colorlinks given;<br />

verbose<br />

(false) issues many extra messages.<br />

Using a configuration file<br />

Very often a user will find that he or she needs the same set of options in<br />

almost every document. Rather than issuing that set again <strong>and</strong> again, it is<br />

possible <strong>to</strong> prepare a configuration file named hyperref.cfg containing<br />

a \hypersetup comm<strong>and</strong> with all the option settings that one normally<br />

wants. One effectively resets the default values. Any settings in the L AT E X<br />

source text itself will override those defaults.<br />

The hyperref.cfg file must be located somewhere where it will always<br />

be found by the L AT E X processing. It might very well be that a file of that<br />

name already exists, <strong>and</strong> will be read in in preference <strong>to</strong> yours. To check<br />

just which location is being used, examine the transcript.log file for the<br />

full path name, <strong>and</strong> then edit that version of hyperref.cfg.<br />

Linking comm<strong>and</strong>s<br />

The main purpose of the hyperref package is <strong>to</strong> add the au<strong>to</strong>matic links<br />

between cross-referencing comm<strong>and</strong>s <strong>and</strong> tables of contents. However,<br />

it also enables access <strong>to</strong> PDF features with L AT E X-style comm<strong>and</strong>s. One<br />

of these is the ability <strong>to</strong> add manual links within the file <strong>and</strong> <strong>to</strong> other<br />

documents, locally or on the Web. The comm<strong>and</strong>s <strong>to</strong> achieve this are:


10.2. Portable Document Format 247<br />

\hyperbaseurl{url pre}<br />

sets a prefix for all external URLs specified by other comm<strong>and</strong>s,<br />

so that the common part of a set of URLs need only be given<br />

once; this is the same as the baseurl option, but can be changed<br />

within the document;<br />

\href{url}{text}<br />

makes text in<strong>to</strong> a link <strong>to</strong> the full URL given by url prefixed with<br />

the current base URL; special characters like # <strong>and</strong> & can be type<br />

in url directly;<br />

\hyperimage{url}{image url}<br />

inserts the image referenced by image url;<br />

\hyperdef{category}{name}{text}<br />

establishes text as a target (anchor) with name category.name;<br />

\hyperref{url}{category}{name}{text}<br />

makes text a link <strong>to</strong> url#category.name;<br />

an alternate syntax is \hyperref[key]{text} <strong>to</strong> make text an<br />

internal link <strong>to</strong> the location marked with \label{key};<br />

\hypertarget{name}{text}<br />

establishes text as an internal target (anchor) with the name<br />

#name;<br />

\hyperlink{name}{text}<br />

makes text a link <strong>to</strong> the internal target #name.<br />

The cross-referencing comm<strong>and</strong>s \ref{key} <strong>and</strong> \pageref{key} (Section<br />

9.2.1) au<strong>to</strong>matically create links <strong>to</strong> the corresponding \label{key}<br />

location. As pointed out above, one can also create a manual link with<br />

\hyperref[key]{text}.<br />

The hyperref package also provides starred versions \ref* <strong>and</strong><br />

\pageref* which function as the regular ones but without creating a<br />

link.<br />

Adding Acrobat but<strong>to</strong>ns<br />

An electronic document is active, as indicated by the links within it for<br />

jumping <strong>to</strong> other sections. But it is also possible <strong>to</strong> insert other types of<br />

‘actions’, in the form of but<strong>to</strong>ns which, when clicked, do something, like<br />

flipping <strong>to</strong> the next page, opening another document, or even quitting.<br />

The hyperref package can add such functionality for the Acrobat<br />

viewers, by means of the comm<strong>and</strong><br />

\Acrobatmenu{action}{text}


248 Chapter 10. PostScript <strong>and</strong> PDF<br />

Table 10.2: Actions available from the Acrobat menus (after Goossens<br />

<strong>and</strong> Rahtz, 1999, page 48)<br />

Acrobat Menu Available options for \Acrobatmenu<br />

File Open, Close, Scan, Save, SaveAs, Optimizer:SaveAsOpt,<br />

Print, PageSetup, Quit<br />

File→Import ImportImage, ImportNotes, AcroForm:ImportFDF<br />

File→Export ExportNotes, AcroForm:ExportFDF<br />

File→DocProps GeneralInfo, OpenInfo, FontsInfo, SecurityInfo,<br />

Weblink:Base, Au<strong>to</strong>Index:DocInfo<br />

Edit Undo, Cut, Copy, Paste, Clear, SelectAll, Ole:CopyFile,<br />

TouchUp:TextAttributes, TouchUp:FitTextToSelection,<br />

TouchUp:ShowLineMarkers,<br />

TouchUp:ShowCaptureSuspects, TouchUp:FindSuspect,<br />

Properties<br />

Edit→Prefs GeneralPrefs, NotePrefs, FullScreenPrefs,Weblink:Prefs,<br />

AcroSearch:Preferences(Windows)or,<br />

AcroSearch:Prefs(Mac), Cpt:Capture<br />

Edit→Search AcroSrch:Query, AcroSrch:Indexes, AcroSrch:Results,<br />

AcroSrch:Assist, AcroSrch:PrevDoc, AcroSrch:PrevHit,<br />

AcroSrch:NextHit, AcroSrch:NextDoc<br />

Edit→Fields AcroForm:Duplicate, AcroForm:TabOrder<br />

Document Cpt:CapturePages, AcroForm:Actions, CropPages,<br />

RotatePages, InsertPages, ExtractPages, ReplacePages,<br />

DeletePages, NewBookmark, SetBookmarkDest,<br />

CreateAllThumbs, DeleteAllThumbs<br />

View ActualSize, FitVisible, FitWidth, FitPage, ZoomTo,<br />

FullScreen, FirstPage, PrevPage, NextPage, LastPage,<br />

GoToPage, GoBack, GoForward, SinglePage, OneColumn,<br />

TwoColumns, ArticleThreads, PageOnly, ShowBookmarks,<br />

ShowThumbs<br />

<strong>Tools</strong> H<strong>and</strong>, ZoomIn, ZoomOut, SelectText, SelectGraphics, Note,<br />

Link, Thread, AcroForm:Tool, Acro Movie:MoviePlayer,<br />

TouchUp:TextTool, Find, FindAgain, FindNextNote,<br />

CreateNotesFile<br />

Window ShowHideToolBar, ShowHideMenuBar, ShowHideClipboard,<br />

Cascade, TileHorizontal, TileVertical, CloseAll<br />

Help HelpUser<strong>Guide</strong>, HelpTu<strong>to</strong>rial, HelpExchange, HelpScan,<br />

HelpCapture, HelpPDFWriter, HelpDistiller, HelpSearch,<br />

HelpCatalog, HelpReader,Weblink:Home<br />

Help(Windows) About


10.2. Portable Document Format 249<br />

where text becomes a but<strong>to</strong>n <strong>to</strong> execute action when clicked. Of course,<br />

text can be more than mere text, it is often a graphics that really does<br />

look like a but<strong>to</strong>n.<br />

The actions available are those provided by the Acrobat <strong>and</strong> Acrobat<br />

Reader programs. These are not documented by Adobe, but are listed in<br />

Table 10.2 on the facing page, which is taken from Goossens <strong>and</strong> Rahtz<br />

(1999), who credit Merz (1998) for having figured them out. These actions<br />

are therefore specific <strong>to</strong> these viewers only, <strong>and</strong> may change with later<br />

versions. They may all be executed by the viewers themselves, by means<br />

of pull-down menus in the menu bar, indicated in the left column of<br />

Table 10.2.<br />

The main purpose of this comm<strong>and</strong> is <strong>to</strong> set up navigational controls<br />

on each page of a document that is meant essentially for screen viewing.<br />

The regular <strong>to</strong>ol bar may be turned off, which is why the document<br />

itself must provide it. This is best put in<strong>to</strong> a footline, <strong>and</strong> that is most<br />

conveniently done with the fancyhdr package (Section 3.2.2).<br />

\documentclass[a4paper]{article}<br />

\usepackage{fancyhdr}<br />

\usepackage[pdftex,colorlinks,<br />

pdf<strong>to</strong>olbar=false,pdfmenubar=false,<br />

pdfwindowui=false,<br />

pdfpagemode=FullScreen,<br />

]{hyperref}<br />

\pagestyle{fancy}<br />

\cfoot{\navbar}<br />

\newcomm<strong>and</strong>{\navbar}{%<br />

\Acrobatmenu{FirstPage}{$\Leftarrow$}<br />

\Acrobatmenu{PrevPage}{$\leftarrow$}<br />

\Acrobatmenu{NextPage}{$\rightarrow$}<br />

\Acrobatmenu{LastPage}{$\Rightarrow$}<br />

\Acrobatmenu{Close}{$\bullet$}<br />

}<br />

The above produces a footline containing<br />

⇐ ← → ⇒ •<br />

(by default in red) as clickable but<strong>to</strong>ns <strong>to</strong> jump <strong>to</strong> the first page, <strong>to</strong> the<br />

previous page, <strong>to</strong> the next page, <strong>to</strong> the last page, respectively. And clicking<br />

the bullet • closes the document. Of course, it looks even better if icons<br />

are made up <strong>and</strong> inserted with \includegraphics.


11<br />

Multilingual LAT E X<br />

The original versions of T E X <strong>and</strong> L AT E X were set up for the English language,<br />

American variant. The built-in hyphenation patterns were for English<br />

only, <strong>and</strong> several English words such as ‘Figure’ <strong>and</strong> ‘Bibliography’ were<br />

included explicitly in certain comm<strong>and</strong>s. This in fact violates the rules<br />

of good programming which forbid doing anything explicitly. In Europe,<br />

L AT E X users quickly made cus<strong>to</strong>mizations for their particular languages.<br />

The adaptation for German, german.sty, is a set of macros from many<br />

contribu<strong>to</strong>rs collected <strong>to</strong>gether by H. Partl of the Technical University of<br />

Vienna, <strong>and</strong> has become the st<strong>and</strong>ard for the German-speaking T E X Users<br />

Group (DANTE). It contains some facilities for other languages, including<br />

French <strong>and</strong> English.<br />

The key <strong>to</strong> the german package <strong>and</strong> other language adaptations is<br />

the fact that the st<strong>and</strong>ard L AT E X document styles (<strong>and</strong> later classes for<br />

L AT E X 2ε) had been altered so that explicit English words in the output were<br />

replaced by reprogrammable comm<strong>and</strong> names. These names had become<br />

st<strong>and</strong>ardized among European users for application <strong>to</strong> all languages. The<br />

modified L AT E X version by J. Schrod from Darmstadt was known as IL AT E X,<br />

for International L AT E X. These names <strong>and</strong> their st<strong>and</strong>ard English values<br />

are <strong>to</strong> be found on page 459.<br />

As of December 1, 1991, these naming features became part of the L AT E X<br />

st<strong>and</strong>ard. They represent good programming practice, since they allow<br />

even English-speaking users <strong>to</strong> change certain titles easily, for example<br />

‘Abstract’ in<strong>to</strong> ‘Summary’ or ‘Contents’ in<strong>to</strong> ‘Table of Contents’. Naturally,<br />

they were taken over, <strong>and</strong> extended upon, by L AT E X 2ε.<br />

Another important feature for multilingual usage is the T E X \language<br />

counter which allows more than one set of hyphenation patterns <strong>to</strong> be<br />

s<strong>to</strong>red in the format with initex (Section B.1.3). Different patterns are<br />

activated by setting \language <strong>to</strong> the appropriate number. This is now<br />

st<strong>and</strong>ard for all T E X version over 3.0, which should now be universal.<br />

Individual language packages such as german maintained by Bernd<br />

Raichle <strong>and</strong> french by Bernard Gaulle have now been superseded <strong>to</strong> a<br />

large extent <strong>to</strong>day by the universal multilanguage system: babel.<br />

251


252 Chapter 11. Multilingual L AT E X<br />

11.1 The babel system<br />

The babel system has been developed by Johannes Braams at the Dutch<br />

PTT Research Labora<strong>to</strong>ries. Its main purpose is <strong>to</strong> provide a st<strong>and</strong>ard<br />

means of switching languages with a flexible method for loading the<br />

hyphenation patterns. It has been written <strong>to</strong> work with both T E X <strong>and</strong><br />

L AT E X.<br />

The three main requirements for a single language adaptation are:<br />

translation of the explicit English words, special comm<strong>and</strong>s <strong>to</strong> simplify<br />

certain features of that language, <strong>and</strong> selection of the appropriate hyphenation<br />

patterns. To these babel adds: removal of the special comm<strong>and</strong>s<br />

<strong>and</strong> testing for the current language. The language-specific files must<br />

conform <strong>to</strong> the babel selection comm<strong>and</strong> structure. The concept of ‘dialects’<br />

is also included, that is, two ‘languages’ that share a common set<br />

of hyphenation patterns. Examples are German <strong>and</strong> Austrian as well as<br />

British <strong>and</strong> US English, which only differ in the form of the dates.<br />

At present, the babel package contains definition files for the following<br />

languages (more can be added at any time):<br />

Afrikaans, Bahasa, Basque, Bre<strong>to</strong>n, Bulgarian, Catalan, Croatian,<br />

Czech, Danish, Dutch, English, Esperan<strong>to</strong>, Es<strong>to</strong>nian, Finnish, French,<br />

Galician, German, Greek, Hebrew, Hungarian, Icel<strong>and</strong>ic, Irish Gaelic,<br />

Italian, Latin, Lower Sorbian, North Sami, Norwegian, Polish, Portuguese,<br />

Romanian, Russian, Scottish Gaelic, Spanish, Slovakian,<br />

Slovenian, Swedish, Serbian, Turkish, Ukrainian, Upper Sorbian,<br />

Welsh<br />

The necessary definition files are delivered with the installation. The<br />

hyphenation patterns for the various languages must be obtained from<br />

another source, however. For most of these files, there are no special<br />

comm<strong>and</strong>s for accents or punctuation: they only redefine the naming<br />

comm<strong>and</strong>s for those words that normally print English text.<br />

The german.sty package has been a great inspiration for babel. However,<br />

because of the name conflict, it was necessary <strong>to</strong> create a new<br />

germanb.sty (<strong>and</strong> ngermanb.sty for the new German grammar rules) for<br />

babel applications, which contains the same set of special comm<strong>and</strong>s,<br />

but with a few babel additions. Similarly, the babel French file had <strong>to</strong> be<br />

named frenchb.sty <strong>to</strong> distinguish it from the existing french.sty.<br />

To exploit the babel features most fully, one should produce a L AT E X<br />

format (Section B.1.3) that incorporates it directly. To this end, the<br />

hyphen.cfg supplied with babel must be used with the language.dat<br />

file configured for the local languages <strong>and</strong> hyphenation patterns that are<br />

<strong>to</strong> be pre-loaded. Only in this way can one conveniently get the right word<br />

division for each language.<br />

Alternatively, one can use a normal L AT E X format <strong>and</strong> load babel as<br />

a regular package, as illustrated below. The switching of hyphenation


patterns will then be questionable.<br />

The babel files<br />

11.1. The babel system 253<br />

The babel installation provides the following files for its implementation:<br />

babel.def contains some of the basic macros for running babel, <strong>and</strong><br />

must be loaded by the first language file read in; the remaining<br />

macros are either already in the format itself (loaded from<br />

hyphen.cfg) or read in from switch.def; babel.def determines<br />

which is the case <strong>and</strong> reacts accordingly;<br />

switch.def contains the additional babel macros, <strong>to</strong> be read in if these<br />

macros are not already s<strong>to</strong>red in the L AT E X format;<br />

hyphen.cfg contains the same macro definitions as in switch.def, plus<br />

some more that are <strong>to</strong> be run by initex; if this file is available during<br />

the creation of the L AT E X format (Section B.1.3), these macros are<br />

built in<strong>to</strong> that format <strong>and</strong> file switch.def is not necessary at run<br />

time;<br />

babel.sty is a master package that loads the language files specified as<br />

options;<br />

language.dat contains a list of languages <strong>and</strong> the file names of their<br />

hyphenation patterns; this file is read in by hyphen.cfg during<br />

the initex run; it is the only file that may (must!) be edited for the<br />

particular installation (Section 11.2);<br />

esperant.ldf... the language definition files.<br />

esperant.sty... compatibility files that read in the.ldf files.<br />

Invoking babel<br />

The babel package is loaded with the desired languages as options:<br />

\usepackage[english,esperan<strong>to</strong>]{babel}<br />

Alternatively, the language names may be used as global options, something<br />

that is recommended if there are other packages that take the<br />

languages as options, as<br />

\documentclass[english,esperan<strong>to</strong>]{article}<br />

\usepackage{babel,varioref}<br />

In both cases, the last named language is the one that is immediately<br />

active.<br />

The recognized language names that may be used as options are:


254 Chapter 11. Multilingual L AT E X<br />

afrikaans<br />

bahasa<br />

basque<br />

bre<strong>to</strong>n<br />

bulgarian<br />

catalan<br />

croatian<br />

czech<br />

danish<br />

dutch<br />

english<br />

=USenglish<br />

=american<br />

=UKenglish<br />

=british<br />

=canadian<br />

esperan<strong>to</strong><br />

es<strong>to</strong>nian<br />

finnish<br />

french<br />

=francais<br />

=canadien<br />

=acadian<br />

galician<br />

german<br />

=germanb<br />

=ngerman<br />

=austrian<br />

=naustrian<br />

greek<br />

=polu<strong>to</strong>nikogreek<br />

hebrew<br />

magyar<br />

=hungarian<br />

icel<strong>and</strong>ic<br />

irish<br />

italian<br />

latin<br />

lowersorbian<br />

samin<br />

norsk<br />

=nynorsk<br />

polish<br />

portuges<br />

=portuguese<br />

=brazilian<br />

=brazil<br />

romanian<br />

russian<br />

scottish<br />

spanish<br />

slovak<br />

slovene<br />

swedish<br />

serbian<br />

turkish<br />

ukrainian<br />

uppersorbian<br />

welsh<br />

Those names preceded by = are synonyms for the language option<br />

above them. (The equals sign is not part of the option name.) For<br />

example, both hungarian <strong>and</strong> magyar load the file magyar.ldf.<br />

If the babel package is loaded, all it does is read in the specified language<br />

packages; they in turn read in babel.def <strong>and</strong> possibly switch.def<br />

(if its macros are not already in the format).<br />

Language switching comm<strong>and</strong>s<br />

The normal user needs <strong>to</strong> know very little about the babel internal operations.<br />

The new high-level user comm<strong>and</strong>s are:<br />

\selectlanguage{language}<br />

\begin{otherlanguage}{language} text \end{otherlanguage}<br />

\begin{otherlanguage*}{language} text \end{otherlanguage*}<br />

\foreignlanguage{language}{text}<br />

\iflanguage{language}{yes text}{no text}<br />

The \selectlanguage comm<strong>and</strong> <strong>and</strong> the otherlanguage environment<br />

are two ways <strong>to</strong> switch <strong>to</strong> another language, with all its features <strong>and</strong> translations.<br />

The \foreignlanguage comm<strong>and</strong> <strong>and</strong> the otherlanguage* environment<br />

also switch <strong>to</strong> language but without the translations or date<br />

changes; they are meant for setting short sections of text in a language<br />

different from the regular one.<br />

The \iflanguage executes yes text if language is current otherwise<br />

no text.<br />

In addition, \languagename contains the name of the currently selected<br />

language.<br />

Of course, each language definition file can also have its own special<br />

comm<strong>and</strong>s <strong>to</strong> assist typing accented <strong>and</strong> special characters. For example,


11.1. The babel system 255<br />

in German, one may type "a as a shorth<strong>and</strong> for \"a. To find out what<br />

special comm<strong>and</strong>s are available for each language, <strong>and</strong> any other special<br />

considerations, one must read the documentation for that language.<br />

Documentation should be found in the texmf\doc\tex\generic\babel<br />

direc<strong>to</strong>ry, or you can process the desired language.dtx file in the texmf\<br />

source\tex\generic\babel direc<strong>to</strong>ry. (These paths might be different<br />

on your system.)<br />

Contents of a language definition file<br />

Although one does not normally need <strong>to</strong> know anything about how the<br />

switching mechanism functions, we will outline it here for the interested<br />

user.<br />

Two additional internal babel comm<strong>and</strong>s are:<br />

\addlanguage{lang num} <strong>and</strong><br />

\adddialect{lang num 1}{lang num 2}<br />

where lang num is an internal language number for specifying the set of<br />

hyphenation patterns. The comm<strong>and</strong> \addlanguage sets its argument<br />

equal <strong>to</strong> the next available language number. The form of lang num used<br />

in babel is \l@language; for example, \l@english. This comm<strong>and</strong> is<br />

executed on those language names listed in language.dat during the<br />

initex run. The comm<strong>and</strong> \adddialect sets the first argument equal <strong>to</strong><br />

the second so that the two languages make use of the same set of hyphenation<br />

patterns. For example, in english.ldf there is the comm<strong>and</strong><br />

\adddialect{\l@american}{\l@english}.<br />

A language definition file must provide four comm<strong>and</strong>s:<br />

\captionslang <strong>to</strong> redefine the naming comm<strong>and</strong>s like \tablename<br />

(see Section D.4.1);<br />

\datelang <strong>to</strong> define \<strong>to</strong>day (see Section D.4.2);<br />

\extraslang <strong>to</strong> define any language-specific comm<strong>and</strong>s;<br />

\noextraslang <strong>to</strong> remove the language-specific comm<strong>and</strong>s.<br />

If the language lang is not one of those with pres<strong>to</strong>red hyphenation<br />

patterns in the current format file (that is, if \l@lang is undefined), it is<br />

set <strong>to</strong> be a ‘dialect’ of language number 0.<br />

Finally, the language definition file calls \selectlanguage{lang} <strong>to</strong><br />

activate that language. This is accomplished by<br />

• calling \language\l@lang <strong>to</strong> select the set of hyphenation patterns,<br />

• invoking \originalTeX in order <strong>to</strong> remove any existing languagespecific<br />

comm<strong>and</strong>s,<br />

• activating \captionslang, \datelang, <strong>and</strong> \extraslang <strong>to</strong> invoke<br />

the language-specific names, date, <strong>and</strong> comm<strong>and</strong>s,


256 Chapter 11. Multilingual L AT E X<br />

• redefining \originalTeX <strong>to</strong> be \noextraslang so that the next<br />

language switch will remove those features specific <strong>to</strong> lang.<br />

11.2 Contents of the language.dat file<br />

As has been mentioned before, with T E X version 3.0 <strong>and</strong> later it is possible<br />

<strong>to</strong> s<strong>to</strong>re more than one set of hyphenation patterns in the format file.<br />

The counter \language is used <strong>to</strong> switch between them by setting it <strong>to</strong> a<br />

different number.<br />

However, there is no st<strong>and</strong>ard <strong>to</strong> dictate which languages belong <strong>to</strong><br />

which numbers. If a package were <strong>to</strong> assume a certain ordering, it would<br />

most certainly function incorrectly at installations other than the one<br />

for which it was designed. The babel system invokes a more reliable<br />

procedure.<br />

During the production of the format by initex (Section B.1.3), the file<br />

hyphen.cfg is input, which in turn reads in language.dat, the only file<br />

<strong>to</strong> be tailored <strong>to</strong> the local installation. This file contains a list of languages<br />

<strong>to</strong> add as well as the name of the file with the hyphenation patterns <strong>and</strong><br />

the name of any additional file <strong>to</strong> be included. It also indicates names of<br />

dialects that use the same hyphenations by prefixing the name with an<br />

equals sign. For example, if language.dat contains<br />

=USenglish<br />

american ushyphen.tex<br />

english ukhyphen.tex<br />

=UKenglish<br />

=british<br />

french frhyphen.tex<br />

german dehypht.tex<br />

ngerman dehyphn.tex<br />

the hyphenation patterns s<strong>to</strong>red in files ushyphen.tex, ukhyphen.tex,<br />

frhyphen.tex, dehypht.tex, <strong>and</strong> dehyphn.tex are loaded under the<br />

language numbers 0 <strong>to</strong> 4 respectively, <strong>and</strong> \l@american, \l@english,<br />

\l@french, \@german, <strong>and</strong> \l@ngerman are defined as numbers 0 through<br />

4 for use with the \selectlanguage comm<strong>and</strong>. Languages \l@USenglish<br />

<strong>and</strong> \l@UKenglish are synonyms for the current language, in this case 0<br />

<strong>and</strong> 1, respectively. Similarly \l@british is identical <strong>to</strong> \l@UKenglish.


12<br />

Math Extensions with<br />

A M S-LAT E X<br />

The American Mathematical Society, A M S, has supported the development<br />

<strong>and</strong> usage of T E X since its first release. It in fact owns the T E X logo<br />

as a registered trademark.<br />

Shortly after T E X 82 became available, the A M S produced a macro<br />

package for generating a special format amstex, described in The Joy<br />

of T E X by Spivak (1986). The macros in this A M S-T E X complement the<br />

mathematical typesetting features of Plain T E X by adding additional ones<br />

<strong>and</strong> simplifying others.<br />

However, A M S-T E X is not a documentation preparation system like<br />

L AT E X, describing the logical layout of a document by means of markup<br />

comm<strong>and</strong>s, but rather is simply an extension <strong>to</strong> Plain T E X.<br />

The great popularity of T E X as a text formatting program is due primarily<br />

<strong>to</strong> the availability of L AT E X as a user-friendly interface <strong>to</strong> the underlying<br />

T E X machinery. Many authors therefore asked the A M S <strong>to</strong> provide L AT E X<br />

with the same mathematical features as in A M S-T E X. The A M S-L AT E X<br />

project was thus launched in 1987, with version 1.0 completed three<br />

years later by Frank Mittelbach <strong>and</strong> Rainer Schöpf, <strong>to</strong>gether with Michael<br />

Downes of the A M S. A M S-L AT E X has been fully converted <strong>to</strong> L AT E X 2ε with<br />

version 1.2 in 1996.<br />

The A M S-L AT E X collection consists of three parts: packages for extending<br />

mathematical typesetting, extra classes for articles <strong>and</strong> books<br />

published by the A M S, <strong>and</strong> supplemental fonts for additional symbols,<br />

math alphabets, <strong>and</strong> Cyrillic fonts.<br />

In the next sections, we give an overview of the math extensions available<br />

in the package amsmath; a more detailed user’s manual is delivered<br />

with the collection, in the file amsldoc.tex. How <strong>to</strong> invoke the additional<br />

fonts is described below in Section 12.4, or in the A M S-supplied manual<br />

found in the file amsfndoc.tex. The extra classes will not be described in<br />

this book; A M S authors should refer <strong>to</strong> the instructions in the document<br />

instr-l.tex provided with A M S-L AT E X.<br />

257


258 Chapter 12. Math Extensions with A M S-L AT E X<br />

12.1 Invoking A M S-L AT E X<br />

If the \documentclass statement at the beginning of the LAT Package:<br />

EX document<br />

amsmath selects one of the AMS classes amsbook, amsart, or amsproc, then most<br />

of the AMS-LAT EX features are loaded au<strong>to</strong>matically. These features may<br />

still be employed with other classes by including the main extension<br />

package amsmath by means of<br />

\usepackage[options]{amsmath}<br />

in the document’s preamble. The list of allowable options is described<br />

below in Section 12.2.8.<br />

The amsmath package defines many of the new math typesetting features<br />

itself, but it also loads a number of other packages from the A M S-<br />

L AT E X collection that contain further extensions, such as amsopn, amstext,<br />

<strong>and</strong> amsbsy. These packages could be loaded separately without amsmath<br />

if only their limited features are wanted. On the other h<strong>and</strong>, the packages<br />

amscd <strong>and</strong> amsthm are not included in amsmath <strong>and</strong> must be loaded explicitly<br />

if their features are desired. Simply add their names <strong>to</strong> the list of<br />

packages in \usepackage.<br />

The following Section 12.2 describes the new comm<strong>and</strong>s <strong>and</strong> environments<br />

made available with amsmath <strong>and</strong> its associated packages. We call<br />

these the st<strong>and</strong>ard features of A M S-L AT E X. Further extensions added by<br />

other packages are explained afterwards.<br />

The examples in this chapter employ the user-defined comm<strong>and</strong>s \mi, \me,<br />

! <strong>and</strong> \dif defined in Section 5.4.10 for printing upright i, e, <strong>and</strong> d in math mode.<br />

12.2 St<strong>and</strong>ard features of A M S-L AT E X<br />

This relatively long section presents those st<strong>and</strong>ard features of A M S-L AT E X<br />

that are activated by loading the amsmath package, or by selecting one of<br />

the A M S classes amsart, amsbook, or amsproc.<br />

12.2.1 Additional font switching comm<strong>and</strong>s<br />

St<strong>and</strong>ard LAT Package:<br />

EX provides the math alphabet comm<strong>and</strong>s \mathcal, \mathrm,<br />

amsbsy \mathbf, \mathsf, \mathit, \mathtt for changing fonts within math<br />

mode (Section 5.4.2). With AMS-LAT EX, one may also use the comm<strong>and</strong>s<br />

\boldsymbol{symbol} <strong>and</strong> \pmb{symbol}<br />

<strong>to</strong> print symbol in a bold face, provided there is an appropriate bold<br />

font for it. Whereas the comm<strong>and</strong> \mathbf sets only Latin letters,<br />

numbers, <strong>and</strong> Greek upper case letters in bold, these comm<strong>and</strong>s also<br />

affect math symbols <strong>and</strong> Greek lower case letters. Compare the result<br />

of $\mathbf{\nabla\times V\,d\sigma}$ (∇ × V dσ ) with that


Package:<br />

amstext<br />

12.2. St<strong>and</strong>ard features of A M S-L AT E X 259<br />

of $\boldsymbol{\nabla\times V\,d\sigma}$ (∇ × V dσ). With the<br />

st<strong>and</strong>ard LAT EX comm<strong>and</strong> \mathbf, only the letters V <strong>and</strong> d appear bold,<br />

while the other characters remain in normal weight. Not only that, these<br />

letters are upright, <strong>and</strong> not italic as required by international st<strong>and</strong>ards.<br />

With \boldsymbol, all symbols are bold <strong>and</strong> italic.<br />

Those symbols for which no bold face font exists will remain in normal<br />

weight with the \boldsymbol comm<strong>and</strong>. Such symbols are, for example,<br />

those that come in two sizes (Section 5.3.7) like , , , <strong>and</strong> so on. The<br />

comm<strong>and</strong> \pmb (poor man’s bold) simulates a bold face even for these<br />

symbols by printing them several times<br />

slightly<br />

<br />

displaced. The result of<br />

$\pmb{\sum\;\int\;\bigcup}$ is .<br />

These comm<strong>and</strong>s are defined in the package amsbsy, which may be<br />

loaded separately without amsmath.<br />

A short piece of normal text can be given within a formula with<br />

\text{short text}<br />

In contrast <strong>to</strong> \mbox{short text} for st<strong>and</strong>ard L AT E X, the \text comm<strong>and</strong><br />

switches font size correctly when used as superscripts <strong>and</strong> subscripts.<br />

Thus .._{\text{Word}} sets Word lower <strong>and</strong> changes <strong>to</strong> \scriptstyle<br />

font size. To achieve the same effect in st<strong>and</strong>ard L AT E X, the font size must<br />

be given explicitly, as .._{\mbox{\scriptstyle Word}}. Furthermore,<br />

the name \text is more precise than \mbox.<br />

This comm<strong>and</strong> is defined in the package amstext. Like amsbsy, it may<br />

be loaded on its own without amsmath if none of the other A M S-L AT E X<br />

features are wanted.<br />

Another comm<strong>and</strong> <strong>to</strong> insert normal text inside a displayed equation is<br />

\intertext{insert text}<br />

The insert text is inserted as a left-justified line of text between those<br />

of the formula. The alignment of the formula lines remains unaffected,<br />

something that is not guaranteed if one closes the displayed equation,<br />

inserts text <strong>and</strong> reopens the equation. For example:<br />

(x + iy)(x − iy) = x 2 − ixy + ixy − i 2 y 2<br />

On the other h<strong>and</strong><br />

= y 2 + y 2<br />

since i 2 = −1 is true.<br />

(x + iy) 2 = x 2 + 2ixy + i 2 y 2 = x 2 + 2ixy − y 2<br />

(x − iy) 2 = x 2 − 2ixy + i 2 y 2 = x 2 − 2ixy − y 2<br />

\begin{align*}<br />

(x+\mi y)(x-\mi y) & = xˆ2 - \mi xy + \mi xy - \mi ˆ2yˆ2\\<br />

& = yˆ2 + yˆ2\quad\text{since}\quad \mi ˆ2=-1<br />

\quad\text{is true.}\\


260 Chapter 12. Math Extensions with A M S-L AT E X<br />

\intertext{On the other h<strong>and</strong>}<br />

(x +\mi y)ˆ2 & = xˆ2 + 2\mi xy +\mi ˆ2yˆ2 = xˆ2 + 2\mi xy-yˆ2\\<br />

(x -\mi y)ˆ2 & = xˆ2 - 2\mi xy +\mi ˆ2yˆ2 = xˆ2 - 2\mi xy-yˆ2<br />

\end{align*}<br />

The alignment of the lines on the first equals sign is maintained through<br />

the interruption with the line of text ‘On the other h<strong>and</strong>’. The environment<br />

align (Section 12.2.6) is one of several new ones provided by A M S-L AT E X <strong>to</strong><br />

replace the st<strong>and</strong>ard L AT E X environment eqnarray. Note that \intertext<br />

may only be issued immediately after the \\ for starting a new line.<br />

12.2.2 Multiple mathematical symbols<br />

Mathematical formulas often require the same symbol <strong>to</strong> appear several<br />

times, such as multiple integral signs, or symbols <strong>and</strong> arrows <strong>to</strong> be stacked<br />

above or below a mathematical expression. Usually the distances between<br />

these symbols depends on the mathematical meaning, something that<br />

L AT E X cannot au<strong>to</strong>matically recognize. A M S-L AT E X provides a number of<br />

structures <strong>to</strong> help the user find the right spacing without tedious trial <strong>and</strong><br />

error.<br />

Multiple integrals<br />

With AMS-LAT EX, the comm<strong>and</strong>s \iint, \iiint, \iiiint, <strong>and</strong> \idotsint<br />

output multiple integrals, with upper <strong>and</strong> lower limits being added in the<br />

usual manner. In text formulas, they are printed as , , , ··· ,<br />

while in displayed formulas, they appear as<br />

<br />

f (x, y) dS \[ \iint\limits_S f(x,y)\,\dif S \]<br />

<br />

S<br />

<br />

f (x, y, z) dV<br />

V<br />

<br />

f (x, y, z, t) dG<br />

G<br />

<br />

· · ·<br />

U<br />

f (x1, . . . , xk) dU<br />

\[ \iiint\limits_V f(x,y,z)\,\dif V\]<br />

\[ \iiiint\limits_G f(x,y,z,t)<br />

\,\dif G \]<br />

\[ \idotsint\limits_U<br />

f(x_1,\ldots,x_k)\,\dif U \]<br />

whereby the comm<strong>and</strong> \limits may be left off if the option intlimits<br />

has been specified when amsmath was loaded (see Section 12.2.8).


Multiline limits<br />

12.2. St<strong>and</strong>ard features of A M S-L AT E X 261<br />

One often needs multiline limits or indices for summations, as in the<br />

examples below.<br />

<br />

∆p1p2···pn−k<br />

q1q2···qn−k<br />

k0,k1,...≥0<br />

k0+k1+···=0<br />

a0k0a1k1 · · ·<br />

A M S-L AT E X provides a comm<strong>and</strong> \substack for this purpose, with syntax<br />

\substack{1st line\\2nd line\\...\\ last line}<br />

where the comm<strong>and</strong> must immediately follow the ˆ or _ shifting comm<strong>and</strong>s,<br />

<strong>and</strong> be entirely enclosed in curly braces { }. The index for the<br />

left-h<strong>and</strong> example above was generated with<br />

\Delta_{\substack{p_1p_2\cdots p_{n-k}\\q_1q_2\cdots q_{n-k}}}<br />

The lines of text printed by \substack are centered horizontally, as<br />

is apparent in the right-h<strong>and</strong> example above. This was produced with<br />

\[ \sum_{\substack{k_0,k_1,\ldots\ge0\\ k_0+\k_1+<br />

\cdots=0}}a_{0k_0} a_{1k_1}\cdots \]<br />

On the other h<strong>and</strong>, the environment subarray offers more control over<br />

the horizontal alignment:<br />

\begin{subarray}{pos} 1st line\\2nd line\\...\\ last line<br />

\end{subarray}<br />

The argument pos may be c for centered, or l for left-justified lines.<br />

<br />

i∈Λ<br />

i


262 Chapter 12. Math Extensions with A M S-L AT E X<br />

\sideset{pre}{post}\symbol<br />

where pre <strong>and</strong> post are the superscripts <strong>and</strong> subscript comm<strong>and</strong>s <strong>to</strong> be<br />

added before <strong>and</strong> after the \symbol, respectively. They must contain<br />

raising <strong>and</strong> lowering opera<strong>to</strong>rs ˆ <strong>and</strong> _.<br />

The product symbol is given daggers above <strong>and</strong> asterisks<br />

below with \sideset{_\dagˆ*}{_\dagˆ*}\prod, as shown<br />

at the right.<br />

Additional shifting comm<strong>and</strong>s are<br />

∗∗<br />

\overset{char}{\symbol} <strong>and</strong> \underset{char}{\symbol}<br />

which place the arbitrary char above or below the \symbol in the size<br />

appropriate for superscripts <strong>and</strong> subscripts. Thus $\overset{*}{X}$<br />

produces ∗<br />

X <strong>and</strong> $\underset{*}{X}$ yields X. ∗<br />

Extended arrows<br />

The amsmath package provides a number of comm<strong>and</strong>s <strong>to</strong> produce extra<br />

long arrows for combining with mathematical expressions. The comm<strong>and</strong>s<br />

\overleftarrow{expr} \underleftarrow{expr}<br />

\overrightarrow{expr} \underrightarrow{expr}<br />

\overleftrightarrow{expr} \underleftrightarrow{expr}<br />

produce lengthened arrows pointing left <strong>and</strong> right, as well as double<br />

arrows above <strong>and</strong> below the mathematical expression expr.<br />

−−−→<br />

ABCD = AB + BC + CD<br />

−→ −→ −→<br />

←−−−<br />

ABCD = DC + CB + BA<br />

←− ←− ←−<br />

←−−−→<br />

ABCD = DCAB<br />

←−−−→<br />

\begin{eqnarray*}<br />

\overrightarrow{ABCD} & = &<br />

\underrightarrow{AB} +<br />

\underrightarrow{BC} +<br />

\underrightarrow{CD} \\<br />

\overleftarrow{ABCD} & = &<br />

\underleftarrow{DC} ...<br />

\end{eqnarray*}<br />

The lower arrows are actually <strong>to</strong>o close <strong>to</strong> the expression, as is seen on<br />

the right-h<strong>and</strong> side of the last example. This should also be the case for<br />

all the other examples with a lower arrow, except that we have added a<br />

strut <strong>to</strong> push them down somewhat:<br />

\underrightarrow{\rule[-2pt]{0pt}{2pt}AB} ... <strong>and</strong><br />

\underleftarrow{\rule[-2pt]{0pt}{2pt}DC} ...<br />

A smaller font size will be used for the arrows when they appear in<br />

exponents, indices, superscripts, <strong>and</strong> subscripts:<br />

†<br />


−−→ r dϕ = 2πr<br />

0.2π<br />

12.2. St<strong>and</strong>ard features of A M S-L AT E X 263<br />

\int_{\overrightarrow{0.2\pi}}<br />

r\,d\varphi = 2\pi r<br />

There are two more comm<strong>and</strong>s for horizontal arrows of variable length:<br />

\xleftarrow[below]{above} \xrightarrow[below]{above}<br />

which place the m<strong>and</strong>a<strong>to</strong>ry above in superscript size over the arrow, <strong>and</strong><br />

the optional below in subscript size beneath it.<br />

A n+µ−1<br />

←−−−− B n±i−1<br />

−−−→ C<br />

T<br />

\[ A \xleftarrow{n+\mu-1} B<br />

\xrightarrow[T]{n\pm i-1} C \]<br />

The package amscd (Section 12.3.2) offers further possibilities for<br />

combining arrows <strong>and</strong> text.<br />

Stacked accents<br />

Attempting <strong>to</strong> place multiple accents over a character with st<strong>and</strong>ard L AT E X,<br />

say with $\hat{\hat{A}}$, results in a misplacement: ˆ Â. The same<br />

applies <strong>to</strong> the other mathematical accents comm<strong>and</strong>s \check, \breve,<br />

\acute, \grave, \tilde, \bar, \vec, \dot, <strong>and</strong> \ddot (Section 5.3.9).<br />

The amsmath package provides a set of math accent comm<strong>and</strong>s with the<br />

same names but capitalized,<br />

\Hat \Breve \Grave \Bar \Dot<br />

\Check \Acute \Tilde \Vec \Ddot<br />

which can be safely combined with one another for the expected results:<br />

$\Hat{\Hat{A}}$, $\Breve{\Bar{B}}$ <strong>and</strong> $\Tilde{\Tilde{C}}$<br />

produce Â, ˘¯B, <strong>and</strong> ˜C.<br />

Three or four dots in a row over a symbol are often used for time<br />

derivatives of third <strong>and</strong> fourth order. They can be placed with the comm<strong>and</strong>s<br />

\dddot{sym} <strong>and</strong> \ddddot{sym}<br />

In this way ...<br />

u <strong>and</strong> ....<br />

u are produced with $\dddot{u}$ <strong>and</strong> $\ddddot{u}$.<br />

Continuation dots<br />

In st<strong>and</strong>ard L AT E X, one has the comm<strong>and</strong>s \ldots <strong>and</strong> \cdots for printing<br />

three continuation dots, either on the baseline or raised <strong>to</strong> the center of<br />

the line. A M S-L AT E X offers a number of additional possibilities. The most<br />

general of these is the \dots comm<strong>and</strong> which adjusts the vertical height<br />

according <strong>to</strong> the symbol that follows it. If this is an equals sign or binary<br />

opera<strong>to</strong>r, such as + or −, the dots are raised, as with \cdots, otherwise<br />

they are on the baseline, as with \ldots.


264 Chapter 12. Math Extensions with A M S-L AT E X<br />

$a_0+a_1+\dots+a_n$ =⇒ a0 + a1 + · · · + an<br />

$a_0,a_1,\dots,a_n$ =⇒ a0, a1, . . . , an<br />

If the continuation dots come at the end of a formula, there is no following<br />

symbol <strong>to</strong> determine the height of the dots. In this case, one must<br />

manually indicate the height by means of one of the comm<strong>and</strong>s \dotsc<br />

(comma), \dotsb (binary), \dotsm (multiplication), or \dotsi (integral).<br />

The \dotsc is <strong>to</strong> be used with commas, so $A_1,A_2,\dotsc$ produces<br />

A1, A2, . . . ; the \dotsb sets them for a binary opera<strong>to</strong>r, thus<br />

$A_1+A_2+\dotsb$ yields A1 +A2 +· · · ; the comm<strong>and</strong> \dotsm is actually<br />

identical <strong>to</strong> \dotsb, but it is logically meant <strong>to</strong> be applied <strong>to</strong> multiplication,<br />

$A_1A_2\dotsm$ makes A1A2 · · · ; finally \dotsi places the dots at<br />

the mean height of an adjacent integral sign.<br />

12.2.3 Fractions<br />

\[ \int_{A_1}\int_{A_2}\dotsi \]<br />

The T E X fraction comm<strong>and</strong>s \a<strong>to</strong>p, \choose, <strong>and</strong> others may be allowed<br />

in st<strong>and</strong>ard L AT E X, but not in A M S-L AT E X. With the amsmath package, only<br />

those fraction comm<strong>and</strong>s described here may be used.<br />

Basic fraction comm<strong>and</strong>s<br />

In addition <strong>to</strong> the regular L AT E X comm<strong>and</strong> \frac{over}{under}, A M S-<br />

L AT E X provides the comm<strong>and</strong>s \tfrac <strong>and</strong> \dfrac with the same syntax.<br />

These are effectively the same as \frac but with the font set <strong>to</strong><br />

\textstyle or \displaystyle, respectively (Section 5.5.2). We demonstrate<br />

their effects with some examples from the A M S-L AT E X user’s manual.<br />

\[ \frac{1}{k}\log_2 c(f)\qquad<br />

\tfrac{1}{k}\log_2 c(f)\qquad<br />

\sqrt{\frac{1}{k}\log_2 c(f)}\qquad<br />

\sqrt{\dfrac{1}{k}\log_2 c(f)} \]<br />

1<br />

k log 2 c(f )<br />

Binomial expressions<br />

1<br />

k log 2 c(f )<br />

<br />

1<br />

k log 2 c(f )<br />

<br />

A1<br />

<br />

A2<br />

· · ·<br />

<br />

1<br />

k log 2 c(f )<br />

A binomial expression looks something like a fraction, but is enclosed in<br />

round parentheses <strong>and</strong> is missing the horizontal rule. The basic comm<strong>and</strong><br />

in the amsmath package is<br />

\binom{over}{under}


12.2. St<strong>and</strong>ard features of A M S-L AT E X 265<br />

which functions in the same way as \frac <strong>and</strong> the other fraction comm<strong>and</strong>s.<br />

<br />

\[ \binom{n+1}{k} = \binom{n}{k} n + 1 n n<br />

= +<br />

+ \binom{n}{k-1 \]<br />

k k k − 1<br />

Similarly there are the comm<strong>and</strong>s \tbinom <strong>and</strong> \dbinom analogous <strong>to</strong><br />

\tfrac <strong>and</strong> \dfrac.<br />

User-defined fractions<br />

The amsmath package provides a powerful <strong>to</strong>ol for defining fraction-like<br />

structures:<br />

\genfrac{left brk}{right brk}{thickness}{mathsize}{over}{under}<br />

where left brk <strong>and</strong> right brk are the parenthesis characters on the left <strong>and</strong><br />

right, thickness is the thickness of the horizontal line, <strong>and</strong> {mathsize} is<br />

a number 0–3 representing the math sizes \displaystyle, \textstyle,<br />

\scriptstyle, <strong>and</strong> \scriptscriptstyle, respectively. The last two<br />

arguments, over <strong>and</strong> under, are the texts in the two parts of the fraction,<br />

the same arguments as in \frac <strong>and</strong> \binom.<br />

If the thickness is left blank, the st<strong>and</strong>ard thickness for L AT E X fractions<br />

is used. If mathsize is empty, the font size is determined au<strong>to</strong>matically<br />

by the normal rules in Section 5.5.2.<br />

Rather than repeating \genfrac with the same first four arguments<br />

time <strong>and</strong> again, one should define new fraction comm<strong>and</strong>s with it. For<br />

example, the following definitions are given in amsmath.sty:<br />

\newcomm<strong>and</strong>{\frac}[2]{\genfrac{}{}{}{}{#1}{#2}}<br />

\newcomm<strong>and</strong>{\dfrac}[2]{\genfrac{}{}{}{0}{#1}{#2}}<br />

\newcomm<strong>and</strong>{\tfrac}[2]{\genfrac{}{}{}{1}{#1}{#2}}<br />

\newcomm<strong>and</strong>{\binom}[2]{\genfrac{(}{)}{0pt}{}{#1}{#2}<br />

As a further example, consider the redefinition of the comm<strong>and</strong> \frac<br />

\renewcomm<strong>and</strong>{\frac}[3][]{\genfrac{}{}{#1}{}{#2}{#3}}<br />

in which the line thickness is now an optional first argument; without this<br />

optional argument, the comm<strong>and</strong> behaves as normal. Thus<br />

<br />

\[ \binom{n}{m} =<br />

yields n n!<br />

=<br />

\frac[2pt]{n!}{M!(n-m)!} \]<br />

m<br />

M!(n − m)!<br />

Continued fractions<br />

Continued fractions can be made in A M S-L AT E X with the comm<strong>and</strong><br />

\cfrac[pos]{over}{under}<br />

whereby the denomina<strong>to</strong>r under may contain further \cfrac comm<strong>and</strong>s.


266 Chapter 12. Math Extensions with A M S-L AT E X<br />

produces<br />

\[ a_0 + \cfrac{1}{a_1 + \cfrac{1}{a_2 +<br />

\cfrac{1}{a_3 + \cfrac{1}{a_4 +<br />

\dotsb }}}} \]<br />

1<br />

a0 +<br />

1<br />

a1 +<br />

1<br />

a2 +<br />

1<br />

a3 +<br />

a4 + · · ·<br />

If the optional argument pos is missing, the numera<strong>to</strong>r over is centered<br />

on the horizontal rule; otherwise it may take values of l or r <strong>to</strong> left or<br />

right justify the numera<strong>to</strong>r.<br />

12.2.4 Matrices<br />

St<strong>and</strong>ard L AT E X possesses the environment array for producing arrays<br />

<strong>and</strong> matrices. The amsmath package provides the additional environments<br />

pmatrix, bmatrix, Bmatrix, vmatrix, <strong>and</strong> Vmatrix, which au<strong>to</strong>matically<br />

add the enclosing braces (), [], {}, | | <strong>and</strong> around the array, <strong>and</strong> in the<br />

right size. For completeness, there is also a matrix environment with no<br />

braces.<br />

In contrast <strong>to</strong> the st<strong>and</strong>ard array environment (Section 4.8.1), these<br />

matrix environments do not require an explicit column specification as<br />

argument. By default, up <strong>to</strong> 10 centered columns may be used without<br />

any argument. (This maximum number may be changed by giving the<br />

special counter MaxMatrixCols a new value with either \setcounter<br />

or \add<strong>to</strong>counter.) Otherwise the matrix environments are used in the<br />

same way as the array environment.<br />

The following example is taken from Section 5.4.3 on page 134 <strong>and</strong> is<br />

recast here using A M S-L AT E X constructs.<br />

(1,2,...,n) <br />

p1


12.2. St<strong>and</strong>ard features of A M S-L AT E X 267<br />

\hdotsfor[2.0]{4}\\<br />

a_{q_kq_1} & a_{q_kq_2} & \dots & a_{q_kq_k}<br />

\end{vmatrix} \]<br />

Comparing this input text with that on page 134, one sees that it<br />

is simpler <strong>and</strong> easier <strong>to</strong> follow. The only new comm<strong>and</strong> used here is<br />

\hdotsfor which has the syntax<br />

\hdotsfor[stretch]{n}<br />

<strong>and</strong> which prints a continuous line of dots through n columns. The<br />

optional argument stretch is a multiplicative number <strong>to</strong> increase the dot<br />

density, being 1.0 by default.<br />

\[ \begin{matrix} a & b & c & d & e\\<br />

x & \hdotsfor{3} & z<br />

\end{matrix} \]<br />

a b c d e<br />

x . . . . . . . . . z<br />

Compare the st<strong>and</strong>ard dot spacing above with that from \hdotsfor[2.0]<br />

in the previous example.<br />

The initial letter of each of the xmatrix environments indicates the<br />

type of braces that enclose it: pmatrix for (round) parentheses, bmatrix<br />

for (square) brackets, Bmatrix for (curly) braces, vmatrix for vertical<br />

lines, <strong>and</strong> Vmatrix for double vertical lines. They appear as<br />

r s t<br />

u v w<br />

x y z<br />

⎧<br />

⎪⎨ r s<br />

⎫<br />

t ⎪⎬<br />

u<br />

⎪⎩<br />

x<br />

v<br />

y<br />

w<br />

⎪⎭<br />

z<br />

⎛<br />

r<br />

⎜<br />

⎝u<br />

s<br />

v<br />

⎞<br />

t<br />

⎟<br />

w⎠<br />

x y z<br />

<br />

<br />

r<br />

<br />

u<br />

<br />

x<br />

s<br />

v<br />

y<br />

<br />

t <br />

<br />

<br />

w<br />

<br />

z <br />

where each matrix has been produced with<br />

⎡<br />

r<br />

⎢<br />

⎣u<br />

s<br />

v<br />

⎤<br />

t<br />

⎥<br />

w⎦<br />

x y z<br />

<br />

<br />

r<br />

<br />

u<br />

<br />

x<br />

s<br />

v<br />

y<br />

<br />

t <br />

<br />

<br />

w<br />

<br />

z <br />

\[ \begin{xmatrix} r & s & t\\ u & v & w\\ x & y & z<br />

\end{xmatrix} \]<br />

where xmatrix is set <strong>to</strong> matrix, pmatrix, bmatrix, Bmatrix, vmatrix,<br />

<strong>and</strong> Vmatrix one after the other.<br />

To generate a small array within a text formula, one can apply the<br />

smallmatrix environment. In this way <br />

a b c<br />

e m r can be made with<br />

$ \bigl( \begin{smallmatrix} a & b & c\\ e & m & r<br />

\end{smallmatrix} \bigr) $<br />

12.2.5 User extensions <strong>and</strong> fine adjustments<br />

Function names<br />

St<strong>and</strong>ard LAT Package:<br />

EX recognizes a number of preprogrammed function names<br />

amsopn (Section 5.3.8) that are printed in math made by placing a backslash in


268 Chapter 12. Math Extensions with A M S-L AT E X<br />

front of that name: arccos, arcsin, arctan, arg, cos, cosh, cot, coth, csc,<br />

deg, det, dim, exp, gcd, hom, inf, ker, lg, lim, liminf, limsup, ln, log, max,<br />

min, Pr, sec, sin, sinh, sup, tan, tanh. Not only do these names appear in<br />

an upright font, as is required for function names, but the spacing with<br />

adjacent parts of the mathematical expression is adjusted au<strong>to</strong>matically.<br />

A M S-L AT E X provides some more function names, as variations on the<br />

st<strong>and</strong>ard \lim name:<br />

\varlimsup lim \varinjlim lim −→<br />

\varliminf lim \varprojlim lim<br />

←−<br />

These functions may take on limits with the raising <strong>and</strong> lowering opera<strong>to</strong>rs<br />

ˆ <strong>and</strong> _; for example \varliminf_{n\<strong>to</strong>\infty} for lim n→∞ .<br />

It is also possible <strong>to</strong> define new function names with the same font<br />

<strong>and</strong> spacing properties as the predefined ones. The comm<strong>and</strong><br />

\DeclareMathOpera<strong>to</strong>r{\cmd}{name}<br />

which may only be issued in the preamble, before \begin{document},<br />

defines a comm<strong>and</strong> \cmd that prints the function name name. For<br />

example, <strong>to</strong> define a function name \doit, give<br />

\DeclareMathOpera<strong>to</strong>r{\doit}{doit}<br />

<strong>and</strong> then $A=3\doitˆ2(B)$ yields A = 3 doit 2 (B). Note that superscripts<br />

<strong>and</strong> subscripts are printed beside the opera<strong>to</strong>r; if they are <strong>to</strong> be printed<br />

as limits, that is, above <strong>and</strong> below the opera<strong>to</strong>r in displayed math mode,<br />

use the *-form <strong>to</strong> define them. For example:<br />

\DeclareMathOpera<strong>to</strong>r*{\Lim}{lim}<br />

\[ \Lim_{n\<strong>to</strong>-\infty}ˆ{n\<strong>to</strong>+\infty}\]<br />

n→+∞<br />

lim<br />

n→−∞<br />

The name text need not be identical <strong>to</strong> the comm<strong>and</strong> name. In particular,<br />

it may contain special characters not allowed in comm<strong>and</strong> names.<br />

Modulo expressions are printed in st<strong>and</strong>ard L AT E X with \bmod <strong>and</strong><br />

\pmod comm<strong>and</strong>s, <strong>and</strong> are complemented in A M S-L AT E X by \mod <strong>and</strong><br />

\pod. The possibilities are:<br />

z ≡ x + y mod n 2<br />

z ≡ x + y (mod n 2 )<br />

z ≡ x + y mod n 2<br />

z ≡ x + y (n 2 )<br />

z \equiv x+y \bmod{nˆ2}<br />

z \equiv x+y \pmod{nˆ2}<br />

z \equiv x+y \mod{nˆ2}<br />

z \equiv x+y \pod{nˆ2}<br />

The au<strong>to</strong>matic parentheses are missing with \mod, while with \pod the<br />

name ‘mod’ is omitted. Furthermore, \pmod is redefined for text formulas<br />

<strong>to</strong> reduce the preceding space: $y\pmod{a+b}$: y (mod a + b).<br />

The \DeclareMathOpera<strong>to</strong>r comm<strong>and</strong> <strong>and</strong> additional function names<br />

are defined in the amsopn package, which may be loaded on its own without<br />

amsmath.


Fine-tuning roots<br />

12.2. St<strong>and</strong>ard features of A M S-L AT E X 269<br />

The positioning of an index <strong>to</strong> a root sign is not always ideal under<br />

st<strong>and</strong>ard L AT E X. In β√ k, for example, the β could be somewhat higher <strong>and</strong><br />

shifted slightly <strong>to</strong> the right. The A M S-L AT E X comm<strong>and</strong>s<br />

\leftroot{shift} \uproot{shift}<br />

cause such manual displacements, where shift is a number specifying<br />

the size in small, internal units. Negative numbers represent a shift in<br />

the opposite direction. Compare the above st<strong>and</strong>ard result with that of<br />

$\sqrt[\leftroot{-1}\uproot{3}\beta]{k}$: β√ k.<br />

The size of the root sign depends on its contents. If they hang below<br />

the baseline, the root sign extends lower down than for contents that have<br />

no depth. Note the differences between √ x, √ y, <strong>and</strong> √ z. Some publishers<br />

want all root signs be at the same height, as √ x + √ y + √ z. This is accomplished<br />

with the T E X comm<strong>and</strong> \smash which places its argument in a box<br />

of zero height <strong>and</strong> depth. The A M S-L AT E X version of this comm<strong>and</strong> allows<br />

an optional argument b or t <strong>to</strong> zero only the depth or height, respectively.<br />

The above example is produced with $\sqrt{\smash[b]{y}}$. The option<br />

b is taken because we want only the depth <strong>to</strong> be ignored, not the<br />

height of the letter y.<br />

Spacing adjustment<br />

With st<strong>and</strong>ard L AT E X, there are a number of comm<strong>and</strong>s <strong>to</strong> fine-tune the<br />

spacing in a math formula (Section 5.5.1). These are \, \: \; \quad <strong>and</strong><br />

\qquad for increasing amounts of positive spacing, <strong>and</strong> \! for negative<br />

spacing. With the amsmath package, the first three still exist, but may<br />

also be called with the more obvious names \thinspace, \medspace, <strong>and</strong><br />

\thickspace. There is also \negthinspace as an alias for \!.<br />

The complete set of spacing comm<strong>and</strong>s are summarized in the table<br />

below taken from the A M S-L AT E X manual.<br />

Short Comm<strong>and</strong> Short Comm<strong>and</strong><br />

form name Demo form name Demo<br />

\, \thinspace \! \negthinspace<br />

\: \medspace \negmedspace<br />

\; \thickspace \negthickspace<br />

\quad<br />

\qquad<br />

The general math spacing comm<strong>and</strong> is<br />

\mspace{mu}<br />

which inserts space in mathematical spacing units ‘mu’ (=1/18 em). For<br />

example, \mspace{-9mu} puts in negative spacing of 1/2 em.


270 Chapter 12. Math Extensions with A M S-L AT E X<br />

Vertical bars<br />

In st<strong>and</strong>ard L AT E X, the comm<strong>and</strong>s | <strong>and</strong> \| are used for single <strong>and</strong> double<br />

vertical bars, | <strong>and</strong> . However, these symbols are often used as delimiters<br />

(that is, like braces) in which case different spacing requirements are<br />

needed. In particular, a distinction must be made between the left <strong>and</strong><br />

right delimiter in expressions like |a| <strong>and</strong> v. The L AT E X comm<strong>and</strong>s are<br />

only appropriate for single appearances, like p|q or f (t, x)|t=0.<br />

The amsmath package defines the delimiter comm<strong>and</strong>s \lvert, \rvert<br />

for a single bar, <strong>and</strong> \lVert, \rVert for a double bar. They are useful for<br />

defining comm<strong>and</strong>s that set their arguments in such delimiters, as<br />

\newcomm<strong>and</strong>{\abs}[1]{\lvert#1\rvert}<br />

\newcomm<strong>and</strong>{\norm}[1]{\lVert#1\rVert}<br />

Now $\abs{a}$ produces |a|, <strong>and</strong> $\norm{v}$ v.<br />

A similar recommendation can be made for the st<strong>and</strong>ard comm<strong>and</strong>s<br />

\langle <strong>and</strong> \rangle. By defining<br />

\newcomm<strong>and</strong>{\mean}[1]{\langle#1\rangle}<br />

one gives $\mean{x}$ <strong>to</strong> generate 〈x〉, rather than $$ which produces<br />

< x >.<br />

Boxed formulas<br />

A formula may be placed in a box with the comm<strong>and</strong><br />

\boxed{formula}<br />

For example,<br />

produces<br />

\[ \boxed{\int_0ˆ\infty f(x)\,\dif x \approx<br />

\sum_{i=1}ˆn w_i \meˆ{x_i} f(x_i)} \]<br />

∞<br />

12.2.6 Multiline equations<br />

0<br />

f (x) dx ≈<br />

n<br />

wie xif (xi)<br />

Equations consisting of several lines which are horizontally aligned at set<br />

points, such as the equals sign, can be generated in st<strong>and</strong>ard L AT E X with<br />

the eqnarray <strong>and</strong> eqnarray* environments (Section 5.4.7). Many authors<br />

consider these <strong>to</strong> be far <strong>to</strong>o limited for publications with complicated<br />

multiline equations. A M S-L AT E X therefore provides a range of further<br />

alignment environments for formulas extending over a single line:<br />

align gather falign multline alignat split<br />

i=1


12.2. St<strong>and</strong>ard features of A M S-L AT E X 271<br />

With the exception of split, all exist in a st<strong>and</strong>ard <strong>and</strong> a *-form. As for<br />

eqnarray, the st<strong>and</strong>ard form adds an au<strong>to</strong>matic equation number <strong>to</strong> each<br />

line, while the *-form does not. The st<strong>and</strong>ard L AT E X equation environment<br />

for single line formulas is also available in A M S-L AT E X in a *-form. It may<br />

be used in combination with multiline environments.<br />

Common features of alignment environments<br />

All the alignment, or multiline, environments switch <strong>to</strong> math mode at the<br />

start <strong>and</strong> back <strong>to</strong> text mode at the end, except for split which must<br />

be called in math mode. A new line is forced in the formula with the<br />

\\ comm<strong>and</strong>, as usual; an optional argument \\[len] can be added <strong>to</strong><br />

increase the line spacing by len, again as usual.<br />

The au<strong>to</strong>matic numbering with the st<strong>and</strong>ard forms can be suppressed<br />

for single lines by adding \notag before the \\ line break. Alternatively,<br />

the line can be given a desired marker with \tag{mark}. For example,<br />

with \tag{$\dag$}, the marker is (†). Using the *-form instead, the<br />

marker text is printed without the parentheses.<br />

The vertical position of the equation number or marker can be adjusted<br />

with the comm<strong>and</strong><br />

\raisetag{len}<br />

which moves the marker upwards by len for that line only. A negative<br />

value moves it downwards.<br />

The multline environment<br />

The multline environment is a variant of the equation environment for<br />

single formulas that are <strong>to</strong>o long for one line. The line breaks occur where<br />

the user forces them with the \\ comm<strong>and</strong>. The first line is left justified,<br />

the last right justified, <strong>and</strong> lines in between are centered. However, if the<br />

option fleqn has been given, all the lines appear left justified.<br />

The equation number, if present, appears at the right of the last line<br />

by default or if the option reqno has been selected; if the option leqno<br />

has been chosen, the number is placed at the left of the first line. (See<br />

Section 12.2.8 for the amsmath options.)<br />

It is possible <strong>to</strong> shift individual lines fully <strong>to</strong> the left or right with<br />

the comm<strong>and</strong>s \shoveleft{formula} <strong>and</strong> \shoveright{formula}. The<br />

entire formula text for that line, except the terminating \\, is placed in<br />

their arguments.<br />

The left <strong>and</strong> right margins for the formula are set by the length parameter<br />

\multlinegap which is initially 10 pt. This may be altered by the<br />

user with the \setlength or \add<strong>to</strong>length comm<strong>and</strong>s.


272 Chapter 12. Math Extensions with A M S-L AT E X<br />

An equation with five lines could be broken <strong>to</strong> look as follows:<br />

First line — left justified<br />

Second line — horizontally centered<br />

Third line — pushed <strong>to</strong> the left<br />

Fourth line — pushed <strong>to</strong> the right<br />

Last line — right justified (12.1)<br />

\begin{multline}<br />

\framebox[.75\columnwidth]{First line --- left justified}\\<br />

\framebox[.6\columnwidth]{Second line --- horizontally<br />

centered}\\<br />

\shoveleft{\framebox[.6\columnwidth]{Third line --- pushed<br />

<strong>to</strong> the left}}\\<br />

\shoveright{\framebox[.6\columnwidth]{Fourth line --- pushed<br />

<strong>to</strong> the right}}\\<br />

\framebox[.75\columnwidth]{Last line --- right justified}<br />

\end{multline}<br />

A real equation would contain mathematical expressions <strong>and</strong> not the<br />

\framebox comm<strong>and</strong>s in the above demonstration.<br />

The split environment<br />

Like multline, the split environment is meant for a single equation<br />

that does not fit on one line. Line breaks are again forced with the \\<br />

comm<strong>and</strong>; the difference is that in each line there is an alignment marker<br />

& such that the lines are horizontally positioned <strong>to</strong> line up the markers.<br />

The split environment does not switch in<strong>to</strong> math mode, nor does it<br />

produce an equation number. It is intended <strong>to</strong> be applied within another<br />

math environment, such as equation or gather. This is why there is an<br />

equation* environment in AMS-LAT EX. The equation number, if present, is provided by the outer environment.<br />

It is applied <strong>to</strong> the entire multiline formula, which by default, or with the<br />

option centertags, is centered on the group of lines. With the option<br />

tbtags, it is placed either at the left of the last line, or at the right of the<br />

first line, depending on the further options leqno <strong>and</strong> reqno, respectively.<br />

(See Section 12.2.8.)<br />

Hc = 1<br />

2n<br />

n<br />

(−1) l (k − l) p−2<br />

l=0<br />

<br />

p<br />

l1+···+lp=l i=1<br />

ni<br />

× [(k − l) − (ki − li)] ki−li<br />

<br />

× (k − l) 2 −<br />

li<br />

<br />

p<br />

(ki − li) 2<br />

j=1<br />

(12.2)


12.2. St<strong>and</strong>ard features of A M S-L AT E X 273<br />

\begin{equation}\begin{split}<br />

H_c&=\frac{1}{2n}\sum_{l=0}ˆn (-1)ˆl (k-l)ˆ{p-2}<br />

\sum_{l_1+\dots+l_p=l} \prod_{i=1}ˆp \binom{n_i}{l_i}\\<br />

&\quad\times[(k-l) - (k_i-l_i)]ˆ{k_i-l_i}\times<br />

\Bigl[(k-l)ˆ2 - \sum_{j=1}ˆp (k_i-l_i)ˆ2\Bigr]<br />

\end{split}\end{equation}<br />

The alignment has been chosen <strong>to</strong> be just before the equals sign. The<br />

second line begins with the alignment marker & so that the equation<br />

continues below the = in the first line. A \quad has been inserted so<br />

that the × is not immediately below the equals sign. Alternatively, one<br />

could place the & after the = <strong>and</strong> dispense with \quad in the second line.<br />

However, the above is more suitable when there are continuation lines<br />

beginning with =. Note the centered equation number at the right.<br />

The gather environment<br />

The gather environment switches <strong>to</strong> math mode, centering each of its<br />

formula lines without any alignment. The formula lines are separated by<br />

\\ comm<strong>and</strong>s. Each line receives an equation number, unless the *-form<br />

has been used, or \notag has been issued in that line.<br />

1<br />

2 +<br />

4 9 n2 ∞ n2 2 3<br />

n<br />

n<br />

+ + · · · +<br />

+ · · · =<br />

(12.3)<br />

3 4<br />

n + 1<br />

n + 1<br />

n=1<br />

⎛<br />

<br />

n2 n n<br />

⎜<br />

converges since lim<br />

= lim ⎜ 1<br />

n→∞ n + 1 n→∞ ⎝<br />

1 + 1<br />

⎞n<br />

⎟<br />

⎠ =<br />

n<br />

1<br />

< 1<br />

e<br />

root condition<br />

2 + 3<br />

∞<br />

4 n + 1<br />

n + 1<br />

+ + · · · + + · · · =<br />

4 9 n2 n<br />

n=1<br />

2<br />

(12.4)<br />

∞<br />

<br />

x + 1<br />

diverges since<br />

dx = ln x −<br />

x2 1<br />

∞ = ∞ (integral condition)<br />

x<br />

c<br />

\begin{gather}<br />

\frac{1}{2} + \left(\frac{2}{3}\right)ˆ4 + \left(\frac{3}{4}<br />

\right)ˆ9 + \dots + \left(\frac{n}{n+1}\right)ˆ{nˆ2} + \dotsb<br />

= \sum_{n=1}ˆ\infty \left(\frac{n}{n+1}\right)ˆ{nˆ2} \\<br />

\text{converges since}\quad\lim_{n\<strong>to</strong>\infty}<br />

\sqrt[n]{\left(\frac{n}{n+1}\right)ˆ{nˆ2}} = \lim_{n\<strong>to</strong>\infty}<br />

\left(\frac{1}{1 + \dfrac{1}{n}}\right)ˆn = \frac{1}{\me} < 1<br />

\tag*{root condition}\\<br />

2 + \frac{3}{4} + \frac{4}{9} + \dots + \frac{n+1}{nˆ2} +<br />

\dotsb = \sum_{n=1}ˆ\infty \frac{n+1}{nˆ2}\\<br />

\text{diverges since}\quad\int_cˆ\infty \frac{x+1}{xˆ2}\,<br />

c


274 Chapter 12. Math Extensions with A M S-L AT E X<br />

\dif x = \left[ \ln x -\frac{1}{x}\right]_cˆ\infty = \infty<br />

\tag{integral condition}<br />

\end{gather}<br />

Note the use of \tag <strong>and</strong> \notag (page 271) <strong>to</strong> add text as markers <strong>to</strong> the<br />

second <strong>and</strong> fourth lines.<br />

The align environment<br />

The align environment is intended for multiple equations with horizontal<br />

alignment, usually on an equals sign or equivalent. New lines are indicated<br />

with \\ as usual. Each line is split in<strong>to</strong> aligned columns such that the first<br />

column is right justified against the & character, the second left justified;<br />

the third column is right justified against the third &, the fourth column<br />

left justified again, <strong>and</strong> so on. This is the same as an array environment<br />

with column specification {rl rl rl ...}.<br />

(x n ) ′ = nx n−1<br />

<br />

1<br />

xn ′<br />

= − n<br />

xn+1 √ n ′ 1<br />

x =<br />

n n√ xn − 1<br />

(e x ) ′ = e x<br />

(sin x) ′ = cos x<br />

(a x ) ′ = a x ln a (cos x) ′ = − sin x<br />

(ln x) ′ = 1<br />

x<br />

(loga x) ′ = 1<br />

x ln a<br />

(tan x) ′ 1<br />

=<br />

cos2 x<br />

(cot x) ′ = − 1<br />

sin 2 x<br />

\begin{align*}<br />

\left(xˆn\right)’ &= nxˆ{n-1} & \left(\meˆx\right)’ &= \meˆx &<br />

(\sin x)’ &= \cos x \\<br />

\left(\frac{1}{xˆn}\right)’ &= -\frac{n}{xˆ{n+1}} &<br />

\left(aˆx\right)’ &= aˆx\ln a & (\cos x)’ &= -\sin x\\<br />

\left(\sqrt[n]{x}\right)’ &= \frac{1}{n\sqrt[n]{xˆn -1}} &<br />

(\ln x)’ &= \frac{1}{x} & (\tan x)’<br />

&= \frac{1}{\cosˆ2 x}\\<br />

& & (\log_a x)’ &= \frac{1}{x\ln a} & (\cot x)’<br />

&= -\frac{1}{\sinˆ2 x}<br />

\end{align*}<br />

The align* environment is used here <strong>to</strong> prevent the lines from being<br />

numbered, something that is not appropriate for such a collection of<br />

formulas. The alignment within each of the three column pairs is on the<br />

equals sign. The input for the last line begins with a double && <strong>to</strong> produce<br />

an empty column pair.<br />

Occasionally a set of formulas is <strong>to</strong> be aligned on several equals signs<br />

in one line, as in the equations below for the volume V , inertial moment Iz,<br />

<strong>and</strong> mass M of an arbitrary body, in Cartesian, cylindrical, <strong>and</strong> spherical<br />

coordinates. In this case, the second <strong>and</strong> third parts are separated by a


12.2. St<strong>and</strong>ard features of A M S-L AT E X 275<br />

double && so that the left-h<strong>and</strong> sides of these column pairs are empty:<br />

the equals signs are always on an odd-numbered alignment marker.<br />

<br />

<br />

V = dv = dx dy dz = ρ dx dρ dφ<br />

V<br />

<br />

Iz = ρ 2 dv =<br />

V<br />

<br />

= r 2 sin θ dr dθ dφ (12.5)<br />

<br />

(x 2 + y 2 <br />

) dx dy dz = ρ 3 dz dρ dφ<br />

<br />

= r 4 sin 3 θ dr dθ dφ (12.6)<br />

<br />

<br />

M = δ dv = δ dx dy dz = δρ dz dρ dφ<br />

V<br />

<br />

= δr 2 sin θ dr dθ dφ (12.7)<br />

\begin{align}<br />

V &= \int\limits_V\dif v &&= \iiint\dif x\,\dif y\,\dif z<br />

&&= \iiint \rho\,\dif x\,\dif \rho\,\dif \phi \notag \\<br />

&&&&&= \iiint rˆ2 \sin\theta\,\dif r\,\dif\theta\,\dif\phi\\<br />

I_z &= \int\limits_V \rhoˆ2\,\dif v &&=\iiint(xˆ2 + yˆ2)<br />

\,\dif x\,\dif y\,\dif z<br />

&&= \iiint \rhoˆ3\,\dif z\,\dif \rho\,\dif \phi \notag \\<br />

&&&&&= \iiint rˆ4\sinˆ3\theta\,\dif r\,\dif\theta\,\dif\phi\\<br />

M &= \int\limits_V \delta\,\dif v &&= \iiint \delta<br />

\,\dif x\,\dif y\,\dif z<br />

&&= \iiint \delta\rho\,\dif z\,\dif\rho\,\dif\phi\notag \\<br />

&&&&&=\iiint\delta rˆ2\sin\theta\,\dif r\,\dif\theta\,\dif\phi<br />

\end{align}<br />

There are two variations on the align environment, falign <strong>and</strong><br />

alignat. The first has exactly the same syntax as align but it inserts<br />

so much spacing between the column pairs that the entire line is filled<br />

out. The alignat environment is just the opposite: no spacing is inserted<br />

au<strong>to</strong>matically between the column pairs. It must take the number<br />

of column pairs as a m<strong>and</strong>a<strong>to</strong>ry argument, but otherwise the syntax of<br />

the contents is the same as that for align. The example above with the<br />

volume, inertial moment, <strong>and</strong> mass of a body could just as well have been<br />

given with<br />

\begin{alignat}{3} formula text \end{alignat}<br />

(In fact, this is precisely what was done in order <strong>to</strong> fit it within the line<br />

width of this book.)<br />

If one or more columns are empty, as in this example, it is possible<br />

<strong>to</strong> control their widths precisely in the alignat environment by adding


276 Chapter 12. Math Extensions with A M S-L AT E X<br />

explicit spacing between the two & characters in one of the lines. See<br />

Section 5.5.1 for spacing in math mode.<br />

In summary, for the align environment <strong>and</strong> its variants, the first,<br />

third, fifth, etc. & characters are alignment markers, while the second,<br />

fourth, sixth, etc. are column pair separa<strong>to</strong>rs.<br />

Nested alignment environments<br />

We have already pointed out on page 272 how the split environment<br />

is <strong>to</strong> be placed inside an equation environment. The same is true for<br />

the environments aligned <strong>and</strong> gathered, which may be used as building<br />

blocks within formulas. Their contents <strong>and</strong> behavior are otherwise the<br />

same as their related environments.<br />

Both of these environments take an optional argument pos<br />

\begin{aligned}[pos] lines \end{aligned}<br />

\begin{gathered}[pos] lines \end{gathered}<br />

which takes values of t or b <strong>to</strong> determine the vertical alignment (<strong>to</strong>p or<br />

bot<strong>to</strong>m) when they appear beside other elements. When no pos is given,<br />

they are centered. In this way<br />

α = aa<br />

β = bbbbb<br />

γ = g<br />

is produced with<br />

versus δ = dd<br />

η = eeeeee<br />

ϕ = f<br />

versus<br />

s = x + y<br />

d = u − v − w<br />

p = x ◦ y<br />

\begin{equation*}<br />

\begin{aligned} \alpha&=aa\\ \beta&=bbbbb\\ \gamma&=g<br />

\end{aligned}<br />

\qquad\text{versus}\qquad<br />

\begin{aligned}[t] \delta&=dd\\ \eta&=eeeeee\\ \varphi&=f<br />

\end{aligned}<br />

\qquad\text{versus}\qquad<br />

\begin{gathered}[b] s= x+y\\ d= u - v - w\\ p = x\circ y<br />

\end{gathered}<br />

\end{equation*}<br />

The cases environment<br />

Although it is possible with st<strong>and</strong>ard LAT EX <strong>to</strong> produce structures of the<br />

form<br />

<br />

0<br />

Pr −j =<br />

r ! (−1)<br />

if r − j is odd,<br />

(r −j)/2 if r − j is even.<br />

(12.8)


12.2. St<strong>and</strong>ard features of A M S-L AT E X 277<br />

as demonstrated by a similar example in Section 5.4.1 on page 132, the<br />

A M S-L AT E X cases environment allows a simpler input:<br />

\begin{equation}<br />

P_{r-j}=\begin{cases} 0 & \text{if $r-j$ is odd,}\\<br />

r!\,(-1)ˆ{(r-j)/2} & \text{if $r-j$ is even.}<br />

\end{cases}<br />

\end{equation}<br />

There may be more than two cases in the environment, as in the<br />

example reproduced here from page 132:<br />

⎧<br />

⎪⎨ −1 : x < 0<br />

y = 0<br />

⎪⎩<br />

+1<br />

:<br />

:<br />

x = 0<br />

x > 0<br />

12.2.7 Equation numbering<br />

Numbering hierarchy<br />

\[ y = \begin{cases} -1 &:\quad x0<br />

\end{cases} \]<br />

With the st<strong>and</strong>ard L AT E X classes book <strong>and</strong> report, equations are given<br />

a double number with the chapter designation <strong>and</strong> then a sequential<br />

number starting at 1 for each new chapter. For the article class, the<br />

equations are numbered sequentially throughout the work.<br />

With the amsmath package, it is possible <strong>to</strong> alter this hierarchy. For<br />

example, if an article is <strong>to</strong> have the equations numbered within each<br />

section, with the section number, give<br />

\numberwithin{equation}{section}<br />

<strong>to</strong> redefine the equation numbers <strong>to</strong> include the section number <strong>and</strong> <strong>to</strong><br />

make the equation counter reset every time the section counter is incremented.<br />

This is as though the equation counter had been created with<br />

\newcounter{equation}[section] (Section 8.1.2), something which the<br />

user cannot normally bring about. Furthermore, \theequation is redefined<br />

<strong>to</strong> be \thesection.\arabic{equation}, something that is in the<br />

user’s power but which is not much use if the equation counter is never<br />

reset.<br />

Subnumbering equations<br />

On page 190 we give an example of how equations may be subnumbered,<br />

that is, the main equation number stays the same <strong>and</strong> a letter is appended<br />

<strong>to</strong> it, as 1.8a, 1.8b, 1.8c . . . . The amsmath package provides this feature<br />

with the subequations environment. Numbered equations appearing<br />

within<br />

\begin{subequations} . . . \end{subequations}


278 Chapter 12. Math Extensions with A M S-L AT E X<br />

will all have the same main number which is one more than that of the<br />

previous one, with sequential, lower case letters attached.<br />

Within the environment, the equation counter refers <strong>to</strong> the subnumber,<br />

that is, <strong>to</strong> the letters, while the main number is <strong>to</strong> be found in the<br />

parentequation counter. To change the format of the subnumber, say<br />

<strong>to</strong> 1.8-A, 1.8-B, . . . , give<br />

\begin{subequations}<br />

\renewcomm<strong>and</strong>{\theequation}<br />

{\theparentequation-\Alph{equation}}<br />

. . .<br />

\end{subequations}<br />

Referencing equation numbers<br />

The L AT E X cross-reference system is described in Section 9.2.1 <strong>and</strong> works<br />

exactly the same way with A M S-L AT E X: when \label{marker} is issued in<br />

a mathematical formula that receives an au<strong>to</strong>matic equation number, that<br />

number can be printed anywhere in the text with \ref{marker}, where<br />

marker is arbitrary text <strong>to</strong> identify that equation.<br />

The amsmath package adds a comm<strong>and</strong> \eqref{marker} <strong>to</strong> print the<br />

equation number in parentheses, as it appears beside the math formula.<br />

For example, the cases equation on page 276 is referred <strong>to</strong> as equation 12.8<br />

with \ref, or as equation (12.8) with \eqref.<br />

If \label is given immediately after the start of a subequations environment,<br />

the corresponding \ref comm<strong>and</strong>s will print the main equation<br />

number without the extra letter. In this way one can refer <strong>to</strong> the entire<br />

group of equations. Later \label comm<strong>and</strong>s are associated with<br />

individual equation lines <strong>and</strong> reference them with the letters.<br />

Page breaks within multiline formulas<br />

Unlike the st<strong>and</strong>ard L AT E X eqnarray environment, the A M S-L AT E X multiline<br />

math environments do not normally allow any page breaks <strong>to</strong> occur within<br />

them. The idea is that the author should have more control over where<br />

such breaks may occur. To allow or force a page break within a multiline<br />

equation, one gives<br />

\displaybreak[num]<br />

just before the line breaking comm<strong>and</strong> \\. Here the optional num has<br />

the same meaning as for the st<strong>and</strong>ard \pagebreak comm<strong>and</strong> (page 33):<br />

without it, a new page is forced, but it may take values of 0–4 <strong>to</strong> allow<br />

a break with increasing degree of encouragement, whereby 4 also forces<br />

the page break.<br />

Alternatively, one can issue \allowdisplaybreaks in the document<br />

preamble <strong>to</strong> allow L AT E X <strong>to</strong> break pages au<strong>to</strong>matically within multiline


12.2. St<strong>and</strong>ard features of A M S-L AT E X 279<br />

formulas as necessary. This comm<strong>and</strong> <strong>to</strong>o takes an optional argument<br />

num with possible values between 0 <strong>and</strong> 4 which make it progressively<br />

easier for au<strong>to</strong>matic page breaks <strong>to</strong> occur.<br />

Once \allowdisplaybreaks has been given in the preamble, it is still<br />

possible <strong>to</strong> suppress page breaks within a formula by ending an equation<br />

line with \\* instead of with \\.<br />

12.2.8 Package options for amsmath<br />

The main amsmath package for A M S-L AT E X recognizes a number of options<br />

that may be given when it is loaded with<br />

\usepackage[options]{amsmath}<br />

They are listed here as pairs with opposing effects. The member of<br />

each pair that is assumed if neither is given, the default, is indicated by<br />

underlining.<br />

centertags | tbtags The equation number for a split environment<br />

(page 272) is centered vertically by default. With tbtags, it is placed<br />

either <strong>to</strong> the left of the first line or <strong>to</strong> the right of the last line,<br />

depending on the side on which numbers are <strong>to</strong> appear.<br />

sumlimits | nosumlimits In displayed formulas, initial <strong>and</strong> final limits<br />

appear below <strong>and</strong> above the sign with the sumlimits option. With<br />

nosumlimits, they are placed beside the sign, raised <strong>and</strong> lowered<br />

with the usual ˆ <strong>and</strong> _ characters.<br />

<br />

Other<br />

<br />

symbols<br />

<br />

that are<br />

<br />

affected by these options are<br />

<strong>and</strong> . On the other h<strong>and</strong>, integral signs are not<br />

influenced by them.<br />

sumlimits<br />

∞<br />

m−1<br />

1 <br />

n!<br />

= 2; n − i =<br />

2n (n − m)!<br />

n=0<br />

i=0<br />

nosumlimits<br />

∞ 1<br />

n=0 2n = 2; m−1 n!<br />

n − i =<br />

i=0 (n − m)!<br />

The input text is the same for both of the above cases.<br />

intlimits | nointlimits Integral signs normally have their limits at<br />

the side; these options allow them <strong>to</strong> be placed above <strong>and</strong> below as<br />

for summations.<br />

intlimits<br />

a<br />

0<br />

<br />

a 2 − x 2 dx =<br />

1<br />

0<br />

a 2<br />

<br />

1 − sin 2 t d sin t = a 2<br />

π/2 <br />

cos 2 t dt = πa2<br />

4<br />

0


280 Chapter 12. Math Extensions with A M S-L AT E X<br />

nointlimits<br />

a<br />

0<br />

<br />

a 2 − x 2 dx =<br />

1<br />

0<br />

a 2<br />

<br />

1 − sin 2 t d sin t = a 2<br />

π/2<br />

0<br />

cos 2 t dt = πa2<br />

4<br />

where again the input text is the same for both cases. As a reminder,<br />

the st<strong>and</strong>ard L AT E X treatment of limits on integral signs is the same<br />

as for nointlimits.<br />

namelimits | nonamelimits The function names \det, \gcd, \inf,<br />

\lim, \liminf, \limsup \max, \min, \Pr, <strong>and</strong> \sup frequently take<br />

lower limits which normally appear below the name in displayed<br />

formulas. With nonamelimits, they are placed at the lower right.<br />

namelimits<br />

<br />

lim 1 +<br />

x→∞<br />

1<br />

x = e = 2.7182 . . .<br />

x<br />

limx→∞<br />

nonamelimits<br />

<br />

1 + 1<br />

x = e = 2.7182 . . .<br />

x<br />

The above options determine the st<strong>and</strong>ard placement of limits for the<br />

entire document. It is still possible <strong>to</strong> change the behavior in any particular<br />

case with the \limits <strong>and</strong> \nolimits comm<strong>and</strong>s, as in normal L AT E X.<br />

The remaining package options select the side for equation numbers<br />

<strong>and</strong> the horizontal positioning of equations.<br />

leqno | reqno The st<strong>and</strong>ard location for equation numbers is on the<br />

right side, at the margin; with leqno, they are placed on the left side<br />

of the equation.<br />

fleqn With this option, all displayed equations are printed flush left, set<br />

off from the left margin by an amount \mathindent. Without this<br />

option, equations are centered. (This is like the fleqn class option<br />

for the st<strong>and</strong>ard classes, page 39.)<br />

12.3 Further A M S-L AT E X packages<br />

The A M S-L AT E X packages described in this section must be loaded explicitly<br />

if their features are <strong>to</strong> be exploited. Unlike the amsbsy <strong>and</strong> amstext<br />

packages, they are not loaded au<strong>to</strong>matically with amsmath. They may,<br />

however, be used on their own, independently of the main package.<br />

12.3.1 Extended theorem declarations<br />

Package: The amsthm package offers many additional possibilities for generating<br />

amsthm theorem-like declarations described for st<strong>and</strong>ard LAT EX in Section 4.5.<br />

As for st<strong>and</strong>ard LAT EX, a new theorem declaration is created with a<br />

statement like


\newtheorem{com}{Comment}<br />

12.3. Further A M S-L AT E X packages 281<br />

where the first argument is the name of the theorem type (here com) <strong>and</strong><br />

the second is the title that is printed when the theorem declaration is<br />

invoked. For example,<br />

\begin{com}<br />

Theorem declarations can have any name.<br />

\end{com}<br />

produces the declara<strong>to</strong>ry text<br />

Comment 1. Theorem declarations can have any name.<br />

In addition <strong>to</strong> the two m<strong>and</strong>a<strong>to</strong>ry arguments, the \newtheorem comm<strong>and</strong><br />

may have one of two optional ones. The complete syntax is<br />

\newtheorem{type}[num like]{title}<br />

or<br />

\newtheorem{type}{title}[in counter]<br />

where num like is the name of an existing theorem-like declaration which<br />

is <strong>to</strong> be numbered in the same sequence as type, <strong>and</strong> in counter is a<br />

counter name like chapter or section <strong>to</strong> reset the numbers of the type<br />

declarations.<br />

All this is st<strong>and</strong>ard L AT E X so far. The amsthm package adds the following<br />

features.<br />

• A \newtheorem* is provided that defines an unnumbered theorem<br />

structure.<br />

• Three predefined theorem styles are available:<br />

plain in which the title <strong>and</strong> number are in bold face <strong>and</strong> the text<br />

italic;<br />

definition with title <strong>and</strong> number in bold face <strong>and</strong> the text in<br />

normal font;<br />

remark for title <strong>and</strong> number in italic <strong>and</strong> the text normal.<br />

The desired style is activated by first issuing \theoremstyle{style};<br />

all subsequent \newtheorem statements will have this style until a<br />

new one is activated.<br />

• A \swapnumbers can be issued <strong>to</strong> cause all following new theorem<br />

types <strong>to</strong> have the numbers appear before the title, as 1 Comment.<br />

• New theorem styles may be defined by the user by means of a<br />

\newtheoremstyle comm<strong>and</strong>, or additional predefined styles may<br />

be loaded with package options. Since this is fairly specialized <strong>and</strong><br />

complex, it is best <strong>to</strong> examine the example file thmtest.tex or read<br />

the documentation in amsthm.dtx.


282 Chapter 12. Math Extensions with A M S-L AT E X<br />

• A proof environment is available for presenting short proofs. It is<br />

an unnumbered structure with the title Proof. The text is terminated<br />

au<strong>to</strong>matically with the Q.E.D. symbol . This symbol may be altered<br />

by redefining the comm<strong>and</strong> \qedsymbol; it may be printed at any<br />

time by issuing \qed.<br />

The amsthm package has much in common with Frank Mittelbach’s<br />

theorem package in the <strong>to</strong>ols collection of Section B.5.4.<br />

12.3.2 Commutative diagrams<br />

Package:<br />

amscd<br />

The extra A M S-L AT E X package amscd<br />

makes it easier <strong>to</strong> generate commutative<br />

diagrams like the one here at the right.<br />

SWΛ ⊗ T<br />

⏐<br />

<br />

j<br />

−−−→ T<br />

⏐<br />

End P<br />

(S ⊗ T )/I (Z ⊗ T )/J<br />

These diagrams are created within the CD environment using some<br />

additional arrow comm<strong>and</strong>s. These bear the rather unusual names @>>><br />

@j>> T\\<br />

@VVV @VV{\End P}V\\<br />

(S\otimes T)/I @= (Z\otimes T)/J<br />

\end{CD} \]<br />

The comm<strong>and</strong> \End <strong>to</strong> print the function name ‘End’ is not st<strong>and</strong>ard. It<br />

must be previously defined with \DeclareMathOpera<strong>to</strong>r{\End}{End}<br />

(see page 268).<br />

12.3.3 References with upref package<br />

Package: Normally the numbers printed with the \ref <strong>and</strong> \pageref comm<strong>and</strong>s<br />

upref are in the current font, whether that be bold, italic, or upright. In order<br />

<strong>to</strong> ensure that the numbers are always upright, load the extra AMS-LAT EX package upref.


12.4 The A M S fonts<br />

12.4. The A M S fonts 283<br />

The A M S makes a number of fonts available <strong>to</strong> complement the regular<br />

Computer Modern fonts provided with the st<strong>and</strong>ard T E X/L AT E X installation.<br />

They include extra math alphabets, supplemental CM bold math italic <strong>and</strong><br />

symbol fonts in smaller sizes than 10 pt, Cyrillic fonts, <strong>and</strong> additional<br />

symbol fonts.<br />

In the next sections we describe these various fonts <strong>and</strong> how <strong>to</strong> take<br />

advantage of them.<br />

12.4.1 Extra CM math fonts<br />

St<strong>and</strong>ard T E X installations of Computer Modern fonts provide bold math<br />

italic cmmib10, the bold symbols cmbsy10, <strong>and</strong> math extensions cmex10<br />

fonts only in 10 pt size, as indicated by the suffix 10 <strong>to</strong> their names. The<br />

A M S has supplemented these with versions in sizes 5–9 pt.<br />

cmmib5 cmmib6 cmmib7 cmmib8 cmmib9<br />

cmbsy5 cmbsy6 cmbsy7 cmbsy8 cmbsy9<br />

cmex7 cmex8 cmex9<br />

The small caps font cmcsc10 is also given companions cmcsc8 <strong>and</strong><br />

cmcsc9.<br />

The normal L AT E X installation au<strong>to</strong>matically assumes that these fonts<br />

are on the system <strong>and</strong> incorporates them in<strong>to</strong> the necessary NFSS font<br />

definition files. Substitutions will be made if they are missing.<br />

12.4.2 Cyrillic fonts<br />

The A M S Cyrillic fonts were originally used in reviews of books published<br />

in Russian <strong>and</strong> other Slavic languages in which the titles were <strong>to</strong> be<br />

rendered in the original language. In 1988, the Humanities <strong>and</strong> Arts<br />

Computing Center of the University of Washing<strong>to</strong>n redesigned them for<br />

general purpose Slavic studies, adding the pre-Revolutionary <strong>and</strong> accented<br />

letters. The overall appearance was also greatly enhanced (see Layout 8 on<br />

page 497).<br />

These fonts all bear the prefix wncy, followed by the style designation<br />

r (upright), b (bold), i (italic), sc (small caps), or ss (upright sans serif),<br />

<strong>and</strong> the design size in points.<br />

The best way <strong>to</strong> enable the Cyrillic fonts is simply <strong>to</strong> select font<br />

encoding OT2 under NFSS, as illustrated in Section A.2 on page 371. The<br />

.fd (font definition) files for the Cyrillic fonts have been so set up that the<br />

other font attributes fully parallel those of the Latin fonts. This means<br />

wncyr10 has all the same attributes as cmr10, except for the encoding:<br />

family cmr, shape n, series m. (Of course, if the CM fonts are not the


284 Chapter 12. Math Extensions with A M S-L AT E X<br />

current st<strong>and</strong>ard ones, it will require more than just selecting the OT2<br />

encoding <strong>to</strong> activate these Cyrillic fonts.)<br />

The layout of the Cyrillic fonts has been chosen in such a way that<br />

the input text may be entered following the regular English transliteration<br />

scheme. Thus Cyrillic S is in position 83 where Latin S is normally<br />

situated. Typing S when a Cyrillic font is active outputs the correct<br />

equivalent S. Numerals <strong>and</strong> punctuation are <strong>to</strong> be found in the st<strong>and</strong>ard<br />

locations <strong>and</strong> so may be typed in as usual. ‘Sankt-Peterburg 10?’ is<br />

thus generated by {\cyr Sankt-Peterburg 10?}.<br />

Since the Cyrillic alphabet possesses more letters than the Latin, many<br />

of them must be transliterated with multi-letter combinations. These are<br />

au<strong>to</strong>matically programmed in<strong>to</strong> the fonts using T E X’s ligature system. For<br />

example, Ch is treated as a ligature for symbol 81 Q just as fi is for fi in a<br />

Latin font. This means that multi-letter transliterations are simply typed<br />

in. The input for ‘Hruwev’ is {\cyr Khrushchev}, where Kh → H <strong>and</strong><br />

shch → w. The transliteration scheme is that for English; other languages<br />

have their own systems <strong>to</strong> reproduce the original pronunciation. For<br />

example, ‘Gorbaqv’ is Gorbatschow in German, Gorbaciov in Italian, <strong>and</strong><br />

Gorbachev in English. These other schemes do not work with these fonts.<br />

Not all letters can be produced so au<strong>to</strong>matically (for example, the in<br />

Gorbaqv) <strong>and</strong> for this reason the A M S provides a file cyracc.def containing<br />

macro definitions for accented letters <strong>and</strong> other special features,<br />

such as the hard <strong>and</strong> soft signs. When these macros are given in a Latin<br />

font, additional transliteration symbols appear.<br />

12.4.3 Euler fonts<br />

The fonts known as the Euler collection, named after the eighteenthcentury<br />

mathematician Leonhard Euler, have been collected from various<br />

sources by the AMS. They include a ‘blackboard’ font, representing a<br />

professor’s h<strong>and</strong>writing on a blackboard, a Fraktur or Gothic font, <strong>and</strong> a<br />

script font. Their main purpose in mathematics is <strong>to</strong> be a substitute for<br />

the CM calligraphic math alphabets.<br />

Package: To use the blackboard characters, one must load the package amsfonts<br />

amsfonts (which is included au<strong>to</strong>matically with the amssymb package) <strong>and</strong> then employ<br />

the math alphabet comm<strong>and</strong> \mathbb. Thus $\mathbb{A B C ..}$<br />

produces<br />

A B C D E F G H I J K L N M O P Q R S T U V W X Y Z<br />

Package: The package eucal redefines the \mathcal comm<strong>and</strong> <strong>to</strong> use the Euler<br />

eucal script characters in place of the CM calligraphic letters. If this package<br />

is loaded with the option mathscr, the comm<strong>and</strong> \mathcal is left unchanged<br />

<strong>and</strong> instead \mathscr is defined <strong>to</strong> invoke these letters. In this<br />

case, $\mathscr{A B C ..}$ produces


12.4. The A M S fonts 285<br />

A B C D E F G H I J K L N M O P Q R S T U V W X Y Z<br />

Package: Finally, the package eufrak defines the math alphabet comm<strong>and</strong><br />

eufrak \mathfrak, with which $\mathfrak{A B C ..}$ yields<br />

A B C D E F G H I J K L N M O P Q R S T U V W X Y Z<br />

This math alphabet is also enabled with the amsfonts package.<br />

12.4.4 Extra math symbols<br />

The set of symbols in the CM math symbol fonts by no means exhausts the<br />

fantasies of active mathematicians. To overcome this deficiency, the A M S<br />

has produced two fonts, msam10 <strong>and</strong> msbm10, containing only symbols,<br />

arrows, <strong>and</strong> the blackboard characters. They are also available in sizes<br />

5–9 pt. Since these fonts originated in the days when T E X could only<br />

h<strong>and</strong>le 128 characters in any font, that is exactly how many they contain.<br />

Today, they could be combined in<strong>to</strong> one font of 256 characters.<br />

Two packages permit access <strong>to</strong> this treasure trove of hieroglyphs:<br />

amsfonts enables the \mathbb math alphabet comm<strong>and</strong> for the blackboard<br />

characters, <strong>and</strong> defines those symbol names which are otherwise<br />

only provided in the latexsym package (Section 5.3.3).<br />

amssymb is the more convenient package, which loads amsfonts <strong>and</strong> then<br />

defines names for all the symbols in the two fonts.<br />

For example,<br />

\[ \circlearrowright \Cup \lessapprox \lll \varprop<strong>to</strong> \because<br />

\circeq \vDash \blacktriangle \sphericalangle \]<br />

↻ ⋒ ⋘ ∝ ∵ ≗ ⊨ ∢<br />

All the symbols <strong>and</strong> their associated names from the amssymb package<br />

are <strong>to</strong> be found in Tables H.20–H.26 on pages 599–601.


13<br />

Drawing with LAT E X<br />

The inclusion of graphical material from other programs is treated in<br />

Chapter 6. Such ‘foreign’ files do add some complications (which are<br />

greatly reduced <strong>to</strong>day with L AT E X 2ε) <strong>and</strong> can cause portability problems.<br />

What would be desirable is a means <strong>to</strong> do graphics with L AT E X itself so that<br />

the source text file is fully self-contained.<br />

St<strong>and</strong>ard L AT E X does contain the means <strong>to</strong> make somewhat primitive<br />

drawings on its own. The word ‘primitive’ should not be considered<br />

deroga<strong>to</strong>ry, for simple building blocks are the basic units for constructing<br />

very complicated, sophisticated structures. They are also useful for<br />

superimposing imported graphics or for adding embellishments <strong>to</strong> them,<br />

as demonstrated in Section 6.1.5.<br />

This chapter describes the intrinsic L AT E X drawing capabilities, <strong>and</strong> then<br />

explains some extensions that are available <strong>to</strong> enhance them.<br />

Many more possibilities exist for adding specialized diagrams, from<br />

chemistry, <strong>to</strong> music, <strong>to</strong> chess positions. These are described in detail in<br />

The L AT E X Graphics Companion by Goossens et al. (1997).<br />

13.1 The picture environment<br />

13.1.1 Picture coordinates<br />

The picture building blocks can only be put in place once a coordinate<br />

system has been established for that picture. This consists of a reference<br />

point or origin, <strong>and</strong> two mutually perpendicular coordinate axes, as well<br />

as a length unit for the coordinates. The origin is the lower left corner<br />

of the picture <strong>and</strong> the axes are its lower <strong>and</strong> left edges. These edges are<br />

referred <strong>to</strong> as the x-axis (lower) <strong>and</strong> y-axis (left).<br />

Once the unit of length (UL) has been specified, every point within the<br />

picture area can be uniquely referred <strong>to</strong> with two decimal numbers: the<br />

first is the number of length units along the x-axis, the second the number<br />

along the y-axis.<br />

287


288 Chapter 13. Drawing with L AT E X<br />

The coordinate numbers are generally positive, meaning that the point<br />

lies <strong>to</strong> the right <strong>and</strong> above the reference point. Since this point is the<br />

lower left corner of the picture, all other points should be more <strong>to</strong> the<br />

right <strong>and</strong> higher than it. However, negative values are also possible. A<br />

negative x value (a negative number for the first member of a coordinate<br />

pair) defines a point left of the origin, while a negative y value (the second<br />

member of the pair is negative) specifies a point below the reference point.<br />

y-axis<br />

✻<br />

1.4<br />

origin<br />

✠<br />

✛ UL ✲<br />

(1.8,1.4)<br />

✲ x-axis<br />

1.8<br />

(−2.2,1.8)<br />

<br />

negative coordinate values<br />

y<br />

✻<br />

<br />

(−1.8,−0.8)<br />

The unit length is selected with the comm<strong>and</strong><br />

\setlength{\unitlength}{length}<br />

<br />

✛UL✲ (3.0,2.0)<br />

<br />

<br />

(2.5,−1.0)<br />

✲ x<br />

In the left-h<strong>and</strong> example above, the unit length was set <strong>to</strong> a value of<br />

1.5 cm with the comm<strong>and</strong> \setlength{\unitlength}{1.5cm}. The<br />

point (1.8,1.4) then lies 1.8 times the unit length (= 2.7 cm) <strong>to</strong> the right,<br />

<strong>and</strong> 1.4 times (= 2.1 cm) above the origin. In the right-h<strong>and</strong> example, the<br />

unit length is set <strong>to</strong> 1 cm.<br />

The unit of length is normally set <strong>to</strong> a convenient size such as 1 cm,<br />

1 mm, or 1 in <strong>and</strong> the picture is built up accordingly. Once it has been<br />

completed, it is possible <strong>to</strong> rescale the whole thing simply by changing<br />

the value of the length unit. A picture that was originally designed with<br />

\unitlength set <strong>to</strong> 1 cm can be enlarged by a fac<strong>to</strong>r 1.2 by redefining its<br />

length unit <strong>to</strong> be 1.2 cm.<br />

13.1.2 The picture environment<br />

Pictures are constructed within the picture environment which is started<br />

with<br />

\begin{picture}(x dimen,y dimen)<br />

picture comm<strong>and</strong>s<br />

\end{picture}


13.1. The picture environment 289<br />

where (x dimen,y dimen) is a pair of numbers that specifies the size<br />

(dimensions) of the picture in the x-direction (horizontal) <strong>and</strong> y-direction<br />

(vertical). This pair of numbers is enclosed in round parentheses! The<br />

unit of length is that previously selected by \unitlength.<br />

\setlength{\unitlength}{1.5cm}<br />

\begin{picture}(4,5) ... ... ... \end{picture}<br />

produces a picture that is 4 length units wide <strong>and</strong> 5 units high. Since the<br />

length unit has been set <strong>to</strong> 1.5 cm, the actual size is 6 cm wide <strong>and</strong> 7.5 cm<br />

high.<br />

Picture comm<strong>and</strong>s are those comm<strong>and</strong>s described below that are used<br />

<strong>to</strong> produce <strong>and</strong> position the individual picture elements. These are the<br />

only comm<strong>and</strong>s that are allowed within the picture environment, other<br />

than font style <strong>and</strong> size declarations (Section 4.1) <strong>and</strong> the line thickness<br />

comm<strong>and</strong>s \thicklines <strong>and</strong> \thinlines. These last determine which<br />

of the two available line thicknesses will become current for drawing<br />

lines: one may switch back <strong>and</strong> forth as one pleases. Initially thin lines<br />

are active.<br />

The value of the parameter \unitlength must not be altered within<br />

the picture environment, for it must remain the same for the entire<br />

picture. It may, however, be changed between pictures.<br />

If the \unitlength specification <strong>to</strong>gether with the picture environment<br />

are enclosed within another environment, such as \begin{center}<br />

... \end{center}, then that value of \unitlength is valid only until<br />

the end of the environment. A picture environment without a preceding<br />

\unitlength comm<strong>and</strong> uses the st<strong>and</strong>ard value of 1 pt.<br />

13.1.3 The positioning comm<strong>and</strong>s<br />

Picture elements are generated <strong>and</strong> positioned by means of the two comm<strong>and</strong>s<br />

\put <strong>and</strong> \multiput, which have the syntaxes:<br />

\put(x,y){pic elem}<br />

\multiput(x,y)(∆x,∆y){num}{pic elem}<br />

The pic elem is one of the picture element comm<strong>and</strong>s described in the next<br />

section. The arguments (x,y) are the placement coordinates, designating<br />

the location of the picture element within the picture coordinate system,<br />

in units of \unitlength. If this is 1 cm, then (2.5,3.6) means that the<br />

element is <strong>to</strong> be positioned 2.5 cm <strong>to</strong> the right <strong>and</strong> 3.6 cm above the lower<br />

left corner of the picture.<br />

The \multiput comm<strong>and</strong> generates the same picture element num<br />

times, moving it (∆x,∆y) each time. Thus the element is drawn at<br />

(x, y), (x + ∆x, y + ∆y),<br />

(x + 2∆x, y + 2∆y), . . . up <strong>to</strong><br />

(x + [num − 1]∆x, y + [num − 1]∆y)


290 Chapter 13. Drawing with L AT E X<br />

The coordinate pair (x, y) is incremented by (∆x, ∆y) for each successive<br />

placement. The values of the incrementing pair may be positive or<br />

negative.<br />

Thus \multiput(2.5,3.6)(0.5,-0.6){5}{pic elem} produces the<br />

pic elem a <strong>to</strong>tal of five times, first at the location (2.5,3.6) <strong>and</strong> then at<br />

(3.0,3.0), (3.5,2.4), (4.0,1.8), <strong>and</strong> finally (4.5,1.2).<br />

Note that the numbers for the coordinate <strong>and</strong> increment pairs are given<br />

in round parentheses ( , ) <strong>and</strong> that the two numbers within each pair<br />

are separated by a comma. The num <strong>and</strong> pic elem entries, on the other<br />

h<strong>and</strong>, are enclosed in curly brackets { } as usual.<br />

Warning: Since the comma separates the two numbers in a coordinate<br />

pair, it may not be used in place of a decimal point. For coordinate entries,<br />

decimal numbers must be written with a period, not a comma.<br />

13.1.4 Picture element comm<strong>and</strong>s<br />

Text within pictures<br />

The simplest picture element of all is a piece of text, positioned at the<br />

desired location within the picture. This is accomplished by putting text<br />

in place of pic elem in the \put or \multiput comm<strong>and</strong>.<br />

<br />

(1.8,1.2)<br />

✒<br />

An arrow<br />

The arrow points <strong>to</strong> the location (1.8,1.2). The comm<strong>and</strong><br />

\put(1.8,1.2){An arrow} inserts the text<br />

‘An arrow’ so that its lower left corner is at the<br />

specified position.<br />

The text as picture element may also be packed in<strong>to</strong> a \parbox or a<br />

minipage environment, <strong>and</strong> the reference point for the coordinate entry<br />

in the \put comm<strong>and</strong> depends on the positioning arguments of that box:<br />

✁✁✕<br />

\parbox[b]{..}{..}<br />

Reference point is the<br />

lower left corner of the<br />

last line in the parbox.<br />

✓ ✓✓✼<br />

\parbox{32mm}{...}<br />

For a st<strong>and</strong>ard parbox,<br />

the reference point is<br />

the vertical center of the<br />

left edge.<br />

✡ ✡✡✡✣<br />

\parbox[t]{..}{..}<br />

Reference point is the<br />

lower left corner of the<br />

<strong>to</strong>p line in the parbox.<br />

Exercise 13.1: Produce a picture 100 mm wide <strong>and</strong> 50 mm high with \unitlength<br />

equal <strong>to</strong> 1 mm. Place the given texts at the following locations: (0,0) ‘The First<br />

Picture’, (90,47) ‘upper left’, (70,40) ‘somewhere upper right’, <strong>and</strong> put a parbox<br />

of width 60 mm at (25,25) containing ‘A separate exercise file with the name<br />

picture.tex should be created for the exercises in this Chapter.’<br />

Exercise 13.2: Repeat the picture processing with a value of 1.5 mm for<br />

\unitlength, <strong>and</strong> with positioning arguments t <strong>and</strong> b for the parbox.


Picture boxes—rectangles<br />

13.1. The picture environment 291<br />

The box comm<strong>and</strong>s \framebox, \makebox, <strong>and</strong> \savebox (Section 4.7.1)<br />

are available in the picture environment but with an extended syntax. In<br />

addition, there is another box comm<strong>and</strong> \dashbox:<br />

\makebox(x dimen,y dimen)[pos]{text}<br />

\framebox(x dimen,y dimen)[pos]{text}<br />

\dashbox{dash len}(x dimen,y dimen)[pos]{text}<br />

The dimensional pair (x dimen, y dimen) defines the width <strong>and</strong> height<br />

of the rectangular box in units of \unitlength. The positioning argument<br />

pos determines how the text is located within the box. It may take on<br />

values:<br />

[t] <strong>to</strong>p The input text appears—centered horizontally—below the upper<br />

edge of the box.<br />

[b] bot<strong>to</strong>m The input text appears—centered horizontally—above the<br />

lower edge of the box.<br />

[l] left The input text begins—centered vertically—at the left edge of<br />

the box.<br />

[r] right The input text ends—centered vertically—at the right edge of<br />

the box.<br />

[s] stretch The input text is stretched horizontally <strong>to</strong> fill up the box,<br />

<strong>and</strong> centered vertically.<br />

Without the optional argument pos, the input text is centered vertically<br />

<strong>and</strong> horizontally within the box.<br />

These positional values may be combined two at a time:<br />

[tl] <strong>to</strong>p left The text appears at the upper left.<br />

[tr] <strong>to</strong>p right The text appears at the upper right.<br />

[bl] bot<strong>to</strong>m left The text appears at the lower left.<br />

[br] bot<strong>to</strong>m right The text appears at the lower right.<br />

The order of the values is unimportant: tl has the same effect as lt.<br />

These box comm<strong>and</strong>s are <strong>to</strong> be used as pic elem in the placement<br />

comm<strong>and</strong>s \put <strong>and</strong> \multiput. The box is so placed that its lower left<br />

corner is at the position given by the coordinate pair in the placement<br />

comm<strong>and</strong>.<br />

\put(1.5,1.2){\framebox(2.5,1.2){center}}


292 Chapter 13. Drawing with L AT E X<br />

<br />

(1.5,1.2)<br />

✒<br />

center<br />

✛ 2.5 UL ✲ ❄<br />

✻<br />

1.2 UL<br />

The arrow indicates the point (1.5,1.2) which<br />

is the position of the lower left corner of<br />

the rectangle with width 2.5 units <strong>and</strong> height<br />

1.2 units. The text ‘center’ is centered both<br />

horizontally <strong>and</strong> vertically. UL = 0.8 cm.<br />

The effect of the text positioning argument is made clear with the<br />

following examples (UL = 1 cm):<br />

❅■<br />

❅<br />

<strong>to</strong>p center<br />

(3.0,3.2)<br />

❅ ❅❘<br />

center right<br />

bot. left<br />

❅■<br />

(0.0,1.95) ❅ (3.0,1.95)<br />

(2.0,0.3)<br />

❅ center stretch<br />

❅❘<br />

\put(0.0,1.95){\framebox(2,1.0)<br />

[t]{<strong>to</strong>p center}}<br />

\put(3.0,1.95){\framebox(2,0.8)<br />

[lb]{bot. left}}<br />

\put(3.0,3.2){\framebox(2,0.6)<br />

[r]{center right}}<br />

\put(2.0,0.3){\framebox(2,0.6)<br />

[s]{stretch\hfill center}}<br />

The picture element \makebox is exactly the same as the \framebox<br />

comm<strong>and</strong> but without the rectangular frame. It is most often employed<br />

with the dimensional pair (0,0) in order <strong>to</strong> place text at a desired location.<br />

(See Section 4.7.1 for the effect of zero width boxes on the enclosed text.)<br />

(2.0,2.8) ✲flush<br />

left<br />

\put(3,1.6){\makebox(0,0){center center}}<br />

\put(2,0.5){\makebox(0,0)[tr]{<strong>to</strong>p right}}<br />

(3.0,1.6) \put(4,1.0){\makebox(0,0)[b]{bot center}}<br />

center ❄center<br />

\put(2,2.8){\makebox(0,0)[l]{flush left}}<br />

(2.0,0.5)<br />

❅❘<br />

<strong>to</strong>p right<br />

bot center The combination [lb] positions the text in exactly<br />

✻ the same way as simply typing the text in as pic elem<br />

(4.0,1.0)<br />

without a box, as shown on page 290.<br />

The picture element \dashbox also produces a framed box, but with<br />

a dashed line around it. The argument dash len specifies the dash length.<br />

✟ ✟✯<br />

(1.0,0.75)<br />

\put(1.0,0.75){\dashbox{0.2}(4,1){dashed frame}}<br />

dashed frame<br />

A dashed frame looks best when both the height<br />

<strong>and</strong> width are a multiple of the dash length.<br />

Even in the above picture box comm<strong>and</strong>s, the entered text may be put<br />

in<strong>to</strong> a vertical box (\parbox or minipage). Since vertical boxes themselves<br />

possess an optional positioning argument b or t, which must not conflict<br />

with that of the picture box, the following rule must be observed:<br />

If a picture box comm<strong>and</strong> contains the positioning argument<br />

b or t, then the same value must be applied <strong>to</strong> the enclosed<br />

vertical box. If the picture box comm<strong>and</strong> has no positioning<br />

argument or only r or l, then the vertical box must be used in<br />

the st<strong>and</strong>ard (no argument) form.


13.1. The picture environment 293<br />

The positioning argument of a picture box has the same effect on the<br />

enclosed vertical box as it does on a line of text, in that the whole box is<br />

treated as a single unit.<br />

Exercise 13.3: Reproduce the organization table below with the boxes <strong>and</strong><br />

included text but without the horizontal <strong>and</strong> vertical lines <strong>and</strong> arrows. These<br />

will be part of the next exercise.<br />

Hint: first draw the boxes on a piece of squared paper so that the edges of the<br />

boxes lie on the printed rules. Select the unit of length <strong>to</strong> be the rule spacing<br />

of the paper. Take as the origin the lower left corner of an imaginary frame<br />

surrounding the entire diagram.<br />

Scientific<br />

Advisors<br />

✻<br />

Direc<strong>to</strong>rate<br />

Managing Direc<strong>to</strong>r<br />

Trustees<br />

Science Administration Technical Head<br />

Project planning <strong>and</strong><br />

managing<br />

Projects Services S<strong>to</strong>res Phys. Plant Workshops Labs<br />

Development<br />

Analysis<br />

Theory<br />

Straight lines<br />

✛<br />

✛<br />

Library<br />

Computer<br />

facilities<br />

✛ ✲ ✛ ✲<br />

Orders<br />

Receiving<br />

Cus<strong>to</strong>ms<br />

Personnel<br />

Bookkeeping<br />

including<br />

general<br />

services<br />

✛ ✲<br />

Staff planning<br />

Drafting<br />

Project<br />

hardware<br />

construction<br />

Project<br />

working<br />

groups<br />

In the picture environment, L AT E X can draw straight lines of any length,<br />

horizontally <strong>and</strong> vertically as well as at a limited number of angles. The<br />

syntax for this picture element reads<br />

\line(∆x,∆y){length}<br />

For horizontal <strong>and</strong> vertical lines, length specifies how long the line is <strong>to</strong> be<br />

in length units. For lines at an angle, it has a somewhat more complicated<br />

meaning, as is explained below. The line begins at that spot given by the<br />

placement coordinates in the \put or \multiput comm<strong>and</strong>.<br />

<br />

✠<br />

(0,0)<br />

(7.5,0)<br />

❅<br />

❅❘<br />

\thicklines<br />

\put(0,0){\line(1,0){6}}<br />

\put(0,0){\line(0,1){1}}<br />

\put(6,0){\line(0,1){0.5}}<br />

The angle at which the line is drawn is given by the slope pair (∆x,∆y).<br />

The slope pair (1,0), in which ∆x = 1 <strong>and</strong> ∆y = 0, produces a horizontal<br />

line, while the pair (0,1) leads <strong>to</strong> a vertical line. This is illustrated in the<br />

above example.<br />

In general (∆x,∆y) has the following meaning:


294 Chapter 13. Drawing with L AT E X<br />

y<br />

✟<br />

✻<br />

✻<br />

∆y<br />

✟✟✟✟✟✟<br />

✟ ❄<br />

A ✟✟✟✟✟✟✟<br />

✛ ∆x ✲<br />

✲<br />

x<br />

Beginning at a point A on the line <strong>and</strong> moving<br />

a distance ∆x in the x direction (horizontally),<br />

∆y is the distance one must move in<br />

the y direction (vertically) in order <strong>to</strong> rejoin<br />

the line.<br />

By specifying a slope pair (∆x,∆y), a line is<br />

drawn at just that angle <strong>to</strong> fulfill the above<br />

conditions.<br />

As mentioned already, the number of different slopes available is<br />

limited. This is because ∆x <strong>and</strong> ∆y may only take on values according <strong>to</strong><br />

certain rules:<br />

1. The number must be a whole integer (negative or positive).<br />

2. Only the values 0, 1, . . . , 6 are allowed.<br />

3. The two numbers in the pair may not contain a common divisor.<br />

Pairs such as (3.5,1.2) (rule 1) <strong>and</strong> (7,0) (rule 2) are thus forbidden.<br />

Similarly (2,2) <strong>and</strong> (3,6) are invalid pairs by rule 3, since both numbers<br />

in the first pair are divisible by 2, <strong>and</strong> those in the second by 3. The<br />

same angles are achieved with the pairs (1,1) <strong>and</strong> (1,2) respectively.<br />

In all there are 25 allowed slope pairs, including (1,0) for horizontal<br />

<strong>and</strong> (0,1) for vertical lines, as one can verify by writing down all the<br />

possibilities.<br />

In addition, the numbers in the slope pair may be positive or negative,<br />

for example, (0,-1), (-2,-5). A negative ∆x in the above diagram means<br />

motion <strong>to</strong> the left, <strong>and</strong> a negative ∆y is for motion downwards. Thus<br />

\put(2,3){\line(0,-1){2.5}} draws a line starting at point (2,3) <strong>and</strong><br />

going 2.5 length units vertically downwards.<br />

y<br />

✻<br />

❍<br />

✛<br />

∆x=2 ✲<br />

❍❍❍❍❍❍ ✻ ∆y=−1<br />

❄<br />

❍<br />

✛ len = 3.5 ✲<br />

✲x<br />

For lines at an angle, the argument length<br />

determines the projected distance along<br />

the x-axis. This is made clearer with<br />

the help of the diagram on the left.<br />

\put(1.0,2.75){\line(2,-1){3.5}}<br />

If one draws dashed lines straight down<br />

from the two end points, then that part of<br />

the x-axis between them is the projection<br />

of the line on <strong>to</strong> the x-axis.<br />

Sloping lines must have a minimum length of about 10 pt or 3.5 mm,<br />

otherwise a warning is issued <strong>and</strong> no line is drawn.<br />

Arrows<br />

The arrow picture element is made with the comm<strong>and</strong>


\vec<strong>to</strong>r(∆x,∆y){length}<br />

13.1. The picture environment 295<br />

which functions exactly the same as the \line comm<strong>and</strong> as far as the<br />

arguments <strong>and</strong> their limitations are concerned. The comm<strong>and</strong> draws a line<br />

from the placement location given in the \put or \multiput comm<strong>and</strong><br />

<strong>and</strong> places an arrow head at the end.<br />

Just as for lines, arrows <strong>to</strong>o must have a length of at least 10 pt or<br />

3.5 mm. Rules 1–3 apply <strong>to</strong> ∆x <strong>and</strong> ∆y as well, with the further restriction<br />

that the allowed numbers are limited <strong>to</strong> 0, 1, . . . , 4. This makes a <strong>to</strong>tal of<br />

13 possible angles for arrows, not counting changes in sign.<br />

<br />

✛<br />

<br />

✒◗◗ ◗◗◗◗◗◗◗<br />

Exercise 13.4: Complete the diagram in Exercise<br />

13.3 by including the missing horizontal <strong>and</strong><br />

vertical lines <strong>and</strong> arrows.<br />

Exercise 13.5: Generate the figure at the right.<br />

The corner points are (0,5), (0,10), (5,15), (10,15),<br />

(15,10), (15,5), (10,0), <strong>and</strong> (5,0) <strong>and</strong> the length unit<br />

is 0.1 inch.<br />

Circles<br />

\begin{picture}(5,2)\thicklines<br />

\put(5,0){\vec<strong>to</strong>r(-1,0){5}}<br />

\put(0,0){\vec<strong>to</strong>r(1,1){2}}<br />

\put(2,2){\vec<strong>to</strong>r(3,-2){3}}<br />

\end{picture}<br />

✁ ✁<br />

✁<br />

✁<br />

✁✁✁✁<br />

<br />

<br />

<br />

<br />

<br />

✏✏✏✏✏✏✏✏✏✏✏ ❆❆<br />

❆<br />

❆<br />

❍<br />

❅❍❍❍❍❍<br />

❆<br />

❅❆ ❅❅❆ ❆ ✂<br />

✂ ❍<br />

✂<br />

✂ ✂✂<br />

✂ ✂<br />

✂ ✂✂<br />

<br />

<br />

<br />

<br />

❇<br />

❇<br />

❇<br />

❇<br />

❅❅ ❇<br />

❅ ❇<br />

❅ ❇<br />

❅ ❇ ✟<br />

❅ ❇<br />

❅ ❇ ✁<br />

✟<br />

✟✟✟✟✟<br />

❅❇<br />

✁<br />

✁<br />

✁ ✁✁<br />

✁✁<br />

<br />

<br />

<br />

<br />

❍<br />

✟<br />

❅❅ ❍ ❅❆❆<br />

❍<br />

❅<br />

❅ ❍ ❍❆<br />

<br />

❍ ❍❅<br />

❅ ❆<br />

✟<br />

✟✟✟✟✟ ❍<br />

❅ ❍<br />

<br />

❅ ❆<br />

<br />

❅ ❆<br />

❅❆<br />

❅<br />

❆<br />

The circle picture element is produced with the comm<strong>and</strong>s<br />

\circle{diameter}<br />

\circle*{diameter}<br />

With the *-form of the comm<strong>and</strong>, a solid filled-in circle is printed rather<br />

than just an outline as for the st<strong>and</strong>ard form. Only certain sizes are<br />

available so L AT E X selects the one closest <strong>to</strong> the specified diameter entry.<br />

If the size is <strong>to</strong>o small, a warning is output <strong>to</strong> the moni<strong>to</strong>r <strong>and</strong> no circle<br />

is printed.<br />

★✥<br />

✻<br />

✉ ⑥<br />

✧✦<br />

\begin{picture}(3,1.6)<br />

\put(1,1){\circle*{0.2}}<br />

\put(1,1){\circle{1.2}}<br />

\put(1,1){\vec<strong>to</strong>r(0,1){0.6}}<br />

\put(2.5,1){\circle*{0.5}}<br />

\end{picture}<br />

The placement location in the corresponding \put comm<strong>and</strong> refers <strong>to</strong> the<br />

center of the circle.


296 Chapter 13. Drawing with L AT E X<br />

Ovals <strong>and</strong> rounded corners<br />

The term oval is used here <strong>to</strong> mean a rectangle whose corners have been<br />

replaced by quarter circles; the largest possible radius is chosen for the<br />

circles such that the sides join <strong>to</strong>gether smoothly. The comm<strong>and</strong> <strong>to</strong><br />

produce them is<br />

\oval(x dimen,y dimen)[part]<br />

The placement location in the corresponding \put comm<strong>and</strong> refers <strong>to</strong> the<br />

center of the oval.<br />

\put(3.0,0.75){\oval(4.0,1.5)}<br />

✤<br />

✛<br />

✻<br />

1.5 UL<br />

Here we have set the values x dimen = 4.0<br />

4 UL ✲<br />

✜UL<br />

<strong>and</strong> y dimen = 1.5 UL, whereby the unit<br />

length UL has been selected <strong>to</strong> be 0.8 cm.<br />

(3.0,0.75) The center of the oval is at the placement co-<br />

❄✣<br />

✢ordinates<br />

in the \put comm<strong>and</strong>, at (3.0,0.75).<br />

The optional argument part takes on values t, b, l, or r, for making<br />

half ovals.<br />

[b] <br />

(1.75,4.2)<br />

✣<br />

✛<br />

✤ 3.5 UL<br />

✻<br />

1.2 UL<br />

✢<br />

✲<br />

✜<br />

\put(1.75,4.2){\oval(3.5,1.2)[b]}<br />

\put(1.75,2.6){\oval(3.5,1.2)[t]}<br />

\put(1.75,1.0){\oval(3.5,1.2)[l]}<br />

\put(3.25,1.2){\oval(3.5,1.2)[r]}<br />

[t]<br />

(1.75,2.6)<br />

<br />

1.2 UL The width <strong>and</strong> height specifications for half<br />

✲<br />

❄<br />

✤ 3.5 UL<br />

✻<br />

(1.75,1.0) (1.2 UL) (3.25,1.0)<br />

[l]<br />

[r]<br />

✣ ❄<br />

✛ 3.5 UL<br />

ovals are always those of the entire figure<br />

✜even<br />

though only part of it is being drawn.<br />

Similarly, the placement coordinates in the<br />

corresponding \put comm<strong>and</strong> refer <strong>to</strong> the<br />

✢center<br />

of the complete oval. (Unit length<br />

here is UL = 1 cm.)<br />

The argument part may also be one of the combinations tl, tr, bl, or<br />

br <strong>to</strong> generate a quarter oval. The order of the two letters is unimportant,<br />

so that lt, rt, lb, <strong>and</strong> rb are equally valid.<br />

✛ 3 UL ✲<br />

✘\put(2.0,2.5){\oval(3.0,1.0)[tl]}<br />

(2.0,2.5) <br />

❄ [tl]<br />

1 UL<br />

<br />

(1.0,1.5)<br />

(2.5,2.5)<br />

[tr]<br />

<br />

(3.5,1.5)<br />

\put(2.5,2.5){\oval(3.0,1.0)[tr]}<br />

✻ \put(1.0,1.5){\oval(1.0,2.0)[bl]}<br />

\put(3.5,1.5){\oval(1.0,2.0)[br]}<br />

2 UL<br />

Once again the size specifications refer <strong>to</strong> the<br />

[bl]<br />

✚<br />

[br]<br />

✛<br />

1 UL<br />

entire oval <strong>and</strong> not just <strong>to</strong> the part that is drawn,<br />

✙<strong>and</strong><br />

the placement coordinates in the \put comm<strong>and</strong><br />

refer <strong>to</strong> the center of the complete oval.<br />

Quarter <strong>and</strong> half circles may also be drawn as partial ovals with equal<br />

width <strong>and</strong> height, but only up <strong>to</strong> a certain size. The following examples


13.1. The picture environment 297<br />

demonstrate that sections of circles are possible up <strong>to</strong> a size of about<br />

1.5 cm.<br />

✬ ✩<br />

★✥<br />

\put(2.0,1.0){\oval(4.0,4.0)[t]}<br />

\put(2.0,1.0){\oval(1.5,1.5)[t]}<br />

<br />

<br />

★ ✥<br />

\put(0.75,0.75){\oval(1.5,1.5)[bl]}<br />

\put(1.75,0.0){\oval(1.5,1.5)[tl]}<br />

\put(2.25,0.0){\oval(1.5,1.5)[tr]}<br />

✧ ✦ \put(3.25,0.75){\oval(1.5,1.5)[br]}<br />

Sections of ovals may be combined with other picture elements. The<br />

placement coordinates in the \put comm<strong>and</strong>, however, require some<br />

serious consideration <strong>to</strong> get them positioned properly.<br />

✛✘<br />

<br />

❄<br />

❄<br />

<br />

✡ ✲<br />

(2.75,0.5)<br />

\put(0.5,2.5){\oval(1.0,1.0)[t]}<br />

\put(0.0,2.5){\vec<strong>to</strong>r(0,-1){2.5}}<br />

\put(1.0,2.5){\vec<strong>to</strong>r(0,-1){1.5}}<br />

\put(0.5,2.5){\circle*{0.1}}<br />

\put(2.5,0.5){\line(0,1){2.5}}<br />

\put(2.75,0.5){\oval(0.5,0.5)[bl]}<br />

\put(2.75,0.25){\vec<strong>to</strong>r(1,0){1.25}}<br />

In all the above examples, the centers of the ovals have been marked<br />

with a black dot <strong>to</strong> indicate where they are. They are not normally a part<br />

of the \oval picture element.<br />

Exercise 13.6: Although the object<br />

pictured here is very offensive, it<br />

does make an excellent exercise for<br />

the picture environment.<br />

Hint: sizing <strong>and</strong> positioning can be<br />

worked out best by overlaying the<br />

illustration with transparent graph<br />

paper.<br />

Vertically stacked text<br />

✄<br />

✂<br />

UL=1 mm<br />

✤✤✜<br />

✤✜✜<br />

✉ ✉ ✉ ✉ ✉ ✉ ✉ ✉<br />

♠ ♠<br />

✣✣✢✉<br />

✉ ✉ ✉ ✉ ✉ ✉ ✉ ✉✣✢✢<br />

<br />

✂<br />

❊<br />

❊<br />

❅<br />

✂<br />

✂ ✂<br />

✞<br />

✝<br />

✎<br />

✍<br />

☛ ✟<br />

It is sometimes necessary <strong>to</strong> write text vertically in a diagram, as in<br />

the example here at the right. This is carried out with the comm<strong>and</strong><br />

\shortstack[pos]{col}<br />

The positioning argument can take on values l, r, or c. The st<strong>and</strong>ard<br />

is c for centered. The comm<strong>and</strong> is similar <strong>to</strong> a tabular environment<br />

with only one column. The text is entered as col, each row being<br />

separated from the next by \\.<br />

The \shortstack comm<strong>and</strong> is most frequently implemented for placing<br />

short lines of text inside a framed box, or for stacking single letters<br />

y –a<br />

x<br />

i<br />

s


298 Chapter 13. Drawing with L AT E X<br />

vertically. The individual rows are separated from each other with the<br />

smallest possible vertical spacing. This means that rows with letters<br />

sticking up or down (like h <strong>and</strong> y) will have larger apparent gaps between<br />

them than rows without such letters. Adding \strut <strong>to</strong> each line, as in<br />

the third example, equalizes the vertical spacing.<br />

This<br />

spacing<br />

leaves<br />

some<br />

room<br />

for<br />

help<br />

Not<br />

really<br />

the<br />

best<br />

for words<br />

at all<br />

A strut<br />

in each<br />

line<br />

✟✟✯ ✟✟✯<br />

is better<br />

✟✟✯ ✒<br />

✻<br />

(1.0,0.5) (3.0,0.5) (5.0,0.5) (8.0,0.8) (9.0,1.2)<br />

The placement coordinates of the corresponding \put comm<strong>and</strong> refer<br />

<strong>to</strong> the lower left corner of an imaginary box that contains the vertically<br />

stacked text. The first of the above texts is left justified, the second<br />

centered, <strong>and</strong> the third right justified. The last two on the right are<br />

centered. They were entered with<br />

\put(1.0,0.5){\shortstack[l]{This\\spacing\\leaves\\some\\...}}<br />

\put(3.0,0.5){\shortstack{Not\\really\\the\\best\\ ...}}<br />

\put(5.0,0.5){\shortstack[r]{A strut\strut\\in each\strut\\...}}<br />

\put(8.0,0.8){\shortstack{L\\e\\t\\t\\e\\r\\s}}<br />

\put(9.0,1.2){\shortstack{b\\e\\s\\t}}<br />

The \shortstack comm<strong>and</strong> may also be used outside of the picture<br />

environment within normal text. One possible application is for marginal<br />

notes, as in Section 4.10.5.<br />

Framed text<br />

The \framebox comm<strong>and</strong> generates a frame of a predetermined size in<br />

which text may be inserted at various positions (page 291). In text mode,<br />

there is the comm<strong>and</strong> \fbox for drawing a frame around text that fits<br />

it exactly (Section 4.7.1). This comm<strong>and</strong> is also available in the picture<br />

environment.<br />

The amount of spacing between the box frame <strong>and</strong> the enclosed text is<br />

given by the parameter \fboxsep. The placement of an \fbox by means<br />

of the \put comm<strong>and</strong> occurs in an unexpected manner, as shown below:<br />

\begin{picture}(5,2)<br />

\setlength{\fboxsep}{0.25cm}<br />

\put(0,0){\framebox(5,2){}}<br />

\put(1,1){\fbox{fitted frame}}<br />

\end{picture}<br />

✒<br />

(1,1)<br />

L etters<br />

b est<br />

fitted frame<br />

The additional frame spacing is often unwanted in a diagram, especially<br />

if the frame surrounds a picture object rather than text. In this<br />

case, the comm<strong>and</strong>


\frame{pic elem}<br />

13.1. The picture environment 299<br />

is used instead. The placement coordinate of the \put comm<strong>and</strong> then<br />

refers <strong>to</strong> the lower left corner as usual.<br />

W<br />

\put(0.0,0.5){\frame{TEXT}}<br />

TEXT<br />

O<br />

R<br />

\put(1.5,0.0){\frame{\shortstack{W\\O\\R\\D}}}<br />

D<br />

The contents of the \frame comm<strong>and</strong> can be any of the previous<br />

picture elements, <strong>and</strong> need not be merely text. However, in many cases<br />

the output comes out wrong.<br />

✛✘<br />

\put(0,0){\frame{\vec<strong>to</strong>r(1,1){1.0}}}<br />

\put(2,0){\frame{\circle{1.0}}} ✒<br />

✚✙<br />

The first example produces the correct result, while the second has<br />

failed. In such cases, one can try putting the picture object inside a<br />

\makebox of suitable size <strong>and</strong> positioning as argument for the \frame<br />

comm<strong>and</strong>. However, it would then make more sense <strong>to</strong> use the \framebox<br />

comm<strong>and</strong> itself in place of \frame{\makebox...}.<br />

Curved lines<br />

Curved lines may be drawn in the picture environment with the comm<strong>and</strong>s<br />

\qbezier[num](x1,y1)(x2,y2)(x3,y3)<br />

which draw a quadratic Bézier curve from point (x1, y1) <strong>to</strong> (x3, y3) with<br />

(x2, y2) as the extra Bézier point. The curve is actually drawn as num + 1<br />

dots. The number of points num is an optional argument; if it is omitted,<br />

its value will be calculated <strong>to</strong> produce a solid-looking line.<br />

The meaning of the extra point can<br />

be illustrated with the example at<br />

(20,20)<br />

the right. The input is<br />

\begin{picture}(40,20)<br />

\qbezier(0,0)(20,20)(40,10)<br />

\end{picture} ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣<br />

♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣<br />

(40,10)<br />

(0,0) <br />

The curve is drawn from (0,0) <strong>to</strong> (40,10) such that the tangents at the<br />

endpoints (the dotted lines) intersect at the extra Bézier point (20,20).<br />

Another way of stating this is that, as one moves from the first <strong>to</strong> the<br />

third point, one begins by heading directly <strong>to</strong>wards the second point, <strong>and</strong><br />

on arrival at the destination, one is moving directly away from that second<br />

point again. The dotted lines in the above example, which are not drawn<br />

by the \bezier functions, illustrate this.<br />

A dotted curve may be drawn by specifying the number of points num;<br />

some experimentation may be required <strong>to</strong> get just the right effect.


300 Chapter 13. Drawing with L AT E X<br />

Line thickness<br />

There is a choice of two line thicknesses for the picture elements \circle,<br />

\oval, <strong>and</strong> \vec<strong>to</strong>r, as well as for sloping lines. These may be selected<br />

with<br />

\thicklines or \thinlines<br />

Each of these declarations remains in effect until counterm<strong>and</strong>ed by a<br />

call <strong>to</strong> the other one, or until the end of the environment in which it was<br />

invoked. Initially, \thinlines is in effect.<br />

The thickness of the horizontal <strong>and</strong> vertical lines may be set with the<br />

declaration<br />

\linethickness{thickness}<br />

<strong>to</strong> any desired size. The argument thickness is a positive length specification.<br />

With \linethickness{1.5mm}, all subsequent horizontal <strong>and</strong><br />

vertical lines will have a thickness of 1.5 mm.<br />

Since frame boxes are constructed out of horizontal <strong>and</strong> vertical lines,<br />

the comm<strong>and</strong> \linethickness also affects the \framebox <strong>and</strong> \dashbox<br />

comm<strong>and</strong>s.<br />

Saving parts of pictures<br />

It is possible <strong>to</strong> s<strong>to</strong>re a combination of picture elements as a sub-picture<br />

under a certain name, <strong>and</strong> <strong>to</strong> recall the whole set as often as one wants<br />

without having <strong>to</strong> reissue the individual comm<strong>and</strong>s every time.<br />

First each sub-picture must have a name reserved for it with<br />

\newsavebox{\sub pic name}<br />

which creates a box with the name \sub pic name for s<strong>to</strong>ring the picture.<br />

Afterwards, the sub-picture is saved with<br />

\savebox{\sub pic name}(x dimen,y dimen)[pos]{sub pic}<br />

where the arguments (x dimen,y dimen) <strong>and</strong> pos have the same meaning<br />

as for \makebox on page 291.<br />

If the picture comm<strong>and</strong>s sub pic are simply a piece of text, this comm<strong>and</strong><br />

is exactly the same as the \makebox comm<strong>and</strong> except that the text<br />

is not printed but s<strong>to</strong>red under the name \sub pic name. The sub pic<br />

may be set down anywhere within the main picture as a separate picture<br />

element.<br />

\usebox{\sub pic name}<br />

\newsavebox{\sub}<br />

\savebox{\sub}(2,1)[br]{\small Sub-Pic}<br />

....<br />

\put(0.7,0.0){\frame{\usebox{\sub}}}<br />

\put(3.0,1.0){\frame{\usebox{\sub}}}<br />

1 UL<br />

✻<br />

❄<br />

✛ ✲<br />

2 UL<br />

Sub-Pic<br />

Sub-Pic


13.1. The picture environment 301<br />

This example may not seem very practical, since the \savebox <strong>and</strong><br />

\usebox comm<strong>and</strong>s could have been replaced by a \framebox <strong>to</strong>gether<br />

with \multiput <strong>to</strong> achieve the same result with even less effort. However,<br />

the main advantage of these two comm<strong>and</strong>s is not for multiple setting of<br />

text, but rather for more complex sub pic compositions.<br />

It should be pointed out that a \savebox comm<strong>and</strong> may be given<br />

outside of the picture environment, <strong>and</strong> even within the preamble. Such<br />

a sub-picture is then available in all picture environments throughout<br />

the document. However, if a \savebox is defined within an environment,<br />

it keeps its contents only until that environment comes <strong>to</strong> an end.<br />

The picture elements inside a \savebox will be sized according <strong>to</strong> the<br />

value of \unitlength in effect at the time that the box is constructed. It<br />

will not be rescaled by a later change in \unitlength.<br />

13.1.5 Making graph paper<br />

Package:<br />

graphpap<br />

The package graphpap adds a new comm<strong>and</strong> for drawing gridded paper:<br />

\graphpaper[num](x,y)(lx,ly)<br />

which places a grid with its lower left corner at (x,y), which is lx units<br />

wide <strong>and</strong> ly units high. Grid lines are drawn for every num units, with<br />

every fifth one thicker <strong>and</strong> labeled. If num is not specified, it is assumed<br />

<strong>to</strong> be 10. All arguments must be integers, not decimal fractions. For<br />

example, \graphpaper(50,50)(200,100) produces<br />

150<br />

100<br />

(50,50)<br />

❅<br />

50❅❘<br />

50 100 150 200 250<br />

UL=0.3 mm<br />

Exercise 13.7: Produce a sheet of graph paper 10 cm by 15 cm with 2 mm<br />

separation between the lines. This sheet may be used <strong>to</strong> determine the positioning<br />

of picture elements when planning a new diagram.<br />

13.1.6 Shifting a picture environment<br />

The generalized syntax of the picture environment contains a further<br />

coordinate pair as an optional argument


302 Chapter 13. Drawing with L AT E X<br />

\begin{picture}(x dimen,y dimen)(x offset,y offset)<br />

picture comm<strong>and</strong>s \end{picture}<br />

In this form, (x offset,y offset) specifies the coordinates of the lower<br />

left corner. This means that for all \put comm<strong>and</strong>s in the environment,<br />

the amounts x offset <strong>and</strong> y offset are effectively subtracted from the placement<br />

coordinates, so that the entire picture is shifted by x offset <strong>to</strong> the<br />

left <strong>and</strong> by y offset downwards.<br />

13.2 Extended pictures<br />

13.2.1 The epic package<br />

Package: With the intention of adding some higher level comm<strong>and</strong>s <strong>and</strong> creating<br />

epic a more user-friendly interface <strong>to</strong> the picture environment, Sunil Podar<br />

released his epic package, adding new features <strong>and</strong> enhancements. One<br />

idea is <strong>to</strong> be able <strong>to</strong> draw multiple objects relative <strong>to</strong> each other, with<br />

only a limited number of absolute coordinates, making reuse <strong>and</strong> shifting<br />

much easier. Another goal is <strong>to</strong> simplify the drawing of lines.<br />

This code was originally written for LAT EX 2.09, but functions just as<br />

well as a LAT EX 2ε package. Thus it is implemented with<br />

\usepackage{epic}<br />

It makes the following new comm<strong>and</strong>s available <strong>to</strong> the user:<br />

\multiputlist \matrixput \grid<br />

\dottedline \dashline \drawline<br />

\jput \picsquare \putfile<br />

as well as the environments:<br />

dottedjoin dashjoin drawjoin<br />

The \multiputlist comm<strong>and</strong> is a variation on the regular \multiput<br />

comm<strong>and</strong>; rather than placing the same element in several locations, it<br />

puts different elements at regularly spaced intervals.<br />

\multiputlist(x,y)(∆x,∆y)[pos]{Obj1, Obj2, . . . , ObjN }<br />

places the N picture elements Obj1, . . . , ObjN at (x,y), (x+∆x,y+∆y),<br />

<strong>and</strong> so on. They are actually put in<strong>to</strong> a series of \makebox(0,0)[pos]{},<br />

so that the optional pos argument specifies the location of the element<br />

relative <strong>to</strong> the plotted point (Section 13.1.4). The elements in the list are<br />

separated by commas, so they must be enclosed in {} if they themselves<br />

contain commas.<br />

The \matrixput comm<strong>and</strong> is the 2-D equivalent of \multiput, creating<br />

an array of a single picture element. Its syntax is:


13.2. Extended pictures 303<br />

\matrixput(x,y)(∆x1,∆y1){n1}(∆x2,∆y2){n2}{Obj}<br />

Thus, \matrixput(0,0)(3,5){3}(10,0){5}{\circle{1.5}} produces<br />

❝ ❝ ❝ ❝ ❝<br />

❝ ❝ ❝ ❝ ❝<br />

❝ ❝ ❝ ❝ ❝<br />

The \grid comm<strong>and</strong> is similar <strong>to</strong> the \graphpaper comm<strong>and</strong>, but it<br />

will also optionally label the axes.<br />

\grid(width,height)(∆width,∆height)[X0,Y0]<br />

draws a grid of size width×height, with grid lines at intervals ∆width<br />

<strong>and</strong> ∆height. If the optional argument is given, the grid lines are labeled<br />

starting at X0, Y0, which must be integers, incremented by ∆width <strong>and</strong><br />

∆height, which must also be integers in this case. The \grid comm<strong>and</strong><br />

must be placed inside a \put comm<strong>and</strong> <strong>to</strong> specify its lower left corner:<br />

\put(0,0){\grid...}.<br />

A set of points can be joined by a dotted line with the comm<strong>and</strong><br />

\dottedline[dot char]{dot gap}(x1,y1)(x2,y2). . . (xn,yn)<br />

where dot gap is the spacing (in \unitlength units) between the dots<br />

<strong>and</strong> dot char is the character used for the dot; if it not specified, the<br />

\picsquare (see below) is used by default, a small square. A near solid<br />

line can be achieved by making dot gap very small, but this could cause<br />

T E X <strong>to</strong> run out of memory.<br />

To join a set of points with a dashed line, one uses<br />

\dashline[stretch]{dash len}{dot gap}(x1,y1)(x2,y2). . . (xn,yn)<br />

where dash len is the length of the dashes (in \unitlength units), which<br />

are constructed as a series of dots <strong>to</strong> produce a solid looking dash. If the<br />

optional dot gap is given, then the dashes are made as a series of dots<br />

with that separation. The optional stretch is a number between −100 <strong>and</strong><br />

infinity. If it is 0 or missing, the number of dashes is chosen so that<br />

the gaps between them are the same length as the dashes; if stretch is<br />

positive, the number of dashes is increased by stretch percent; if negative,<br />

it is reduced by that amount. With various combinations of stretch <strong>and</strong><br />

dot gap, different dash patterns can be produced.<br />

To draw a solid-looking line through a set of points, one uses<br />

\drawline[stretch](x1,y1)(x2,y2). . . (xn,yn)<br />

which draws the lines as a series of line segments using the L AT E X line<br />

fonts. Since these have a limited number of angles, the result can appear<br />

fairly jagged. By increasing the optional stretch fac<strong>to</strong>r (again a percent),<br />

more segments are used <strong>and</strong> the appearance is improved; by decreasing<br />

it, the line can begin <strong>to</strong> look dashed.<br />

As an example of these three line drawing comm<strong>and</strong>s,


304 Chapter 13. Drawing with L AT E X<br />

produces<br />

\begin{picture}(100,13)<br />

\dottedline[.]{3}(0,0)(10,10)(20,0)<br />

\dashline{3}(30,0)(40,10)(50,0)<br />

\drawline(60,0)(70,10)(80,0)<br />

\end{picture}<br />

. . . . . . . . . . . ❅ ❅ ❅<br />

For each of the three line drawing comm<strong>and</strong>s, there is a corresponding<br />

environment, named dottedjoin, dashjoin, <strong>and</strong> drawjoin, each taking<br />

the same set of optional <strong>and</strong> m<strong>and</strong>a<strong>to</strong>ry arguments as the comm<strong>and</strong>s,<br />

except for the set of coordinates. Within these environments, one gives<br />

a set of \jput comm<strong>and</strong>s, which behaves exactly like the regular \put,<br />

except that all its elements are joined by the selected line type. For<br />

example,<br />

produces:<br />

\begin{picture}(100,13)<br />

\begin{dottedjoin}{2}<br />

\jput(0,0){\circle{3}}<br />

\jput(20,8){\makebox(0,0){\Large$\star$}}<br />

\jput(40,3){\makebox(0,0){\small Finish}}<br />

\end{dottedjoin}<br />

\begin{dashjoin}[20]{3}<br />

\jput(55,3){}<br />

\jput(70,10){\oval(10,5)}<br />

\jput(80,0){\circle*{2}}<br />

\end{dashjoin}<br />

\end{picture}<br />

⋆<br />

. ❤.<br />

. . . . . . . . . . . . . . . . . . .<br />

Finish<br />

. .<br />

Real life data curves are generated by other software programs. These<br />

results can be imported in<strong>to</strong> the picture environment by s<strong>to</strong>ring them<br />

in a data file, named say mycurve.put <strong>and</strong> then issuing<br />

☛<br />

✡<br />

\putfile{mycurve.put}{\picsquare}<br />

The data file contains a list of x y coordinates, one pair per line, with<br />

possible comments beginning with % as usual. The \putfile comm<strong>and</strong><br />

places its second argument at all the points listed in the data file.<br />

The default dot character for plotting all lines is the \picsquare, a<br />

black square that scales with the current line thickness. A different dot<br />

character may be used with \putfile if one wishes. It is also possible <strong>to</strong><br />

specify the dot character for \dottedline, but the default is \picsquare.<br />

✟<br />

✠<br />


13.2. Extended pictures 305<br />

The default values for the optional stretch argument in \dashline <strong>and</strong><br />

\drawline are initially 0, but may be changed at any time by redefining<br />

(with \renewcomm<strong>and</strong>) \dashlinestretch <strong>and</strong> \drawlinestretch, respectively.<br />

This makes it possible <strong>to</strong> revise a whole set of curves with one<br />

comm<strong>and</strong>, rather than manually changing each one.<br />

13.2.2 The eepic package<br />

Package: The epic comm<strong>and</strong>s are still subject <strong>to</strong> many of the limitations of the<br />

eepic picture environment: limited number of slopes for lines, limited line<br />

thicknesses, restrictions on circle sizes. This is because the picture<br />

environment uses LAT EX fonts <strong>to</strong> ‘draw’ inclined lines <strong>and</strong> circles, making<br />

the results portable <strong>to</strong> all output devices.<br />

The eepic package, by Conrad Kwok repairs these problems by employing<br />

graphic comm<strong>and</strong>s executed by the DVI driver itself. They are<br />

transmitted <strong>to</strong> the .dvi file by \special comm<strong>and</strong>s, which are driverspecific.<br />

Thus greater flexibility is achieved, but at the price of loss<br />

of portability. The package is therefore most suitable for use with the<br />

PostScript dvips driver, as well as with the previewers xdvi <strong>and</strong> windvi.<br />

It does not work with pdfTEX, unfortunately; on the other h<strong>and</strong>, it has no<br />

problems with dvipdfm.<br />

However, eepic not only recodes the features of epic, it also adds<br />

some additional functionality. If one wishes <strong>to</strong> invoke these extra features<br />

with a driver that does not recognize the graphics \specials, one can use<br />

the emulation package eepicemu instead. A comparison of the results<br />

with these two packages is shown in Figure 13.1 on the next page.<br />

In either case, one must load epic with one of eepic or eepicemu:<br />

\usepackage{epic,eepic} or \usepackage{epic,eepicemu}<br />

The following st<strong>and</strong>ard picture elements are modified by the eepic<br />

package:<br />

\line(∆x,∆y){length} (page 293) where ∆x <strong>and</strong> ∆y may take on any<br />

positive or negative integer values, <strong>and</strong> not just those between ±6.<br />

\circle{diameter} (page 295) may have any value for diameter; the<br />

same for \circle*.<br />

\oval (page 296) may have the maximum diameter of the corners set <strong>to</strong><br />

any value; this is s<strong>to</strong>red in the length \maxovaldiam which the user<br />

may change; the default value is 40 pt.<br />

Similarly, all the extra comm<strong>and</strong>s from epic package are also revised<br />

internally. The restrictions on slopes never apply directly <strong>to</strong> them, but<br />

lines of arbitrary slope are drawn with little segments at the nearest<br />

available slope, or as series of dots, requiring much computer time <strong>and</strong>


306 Chapter 13. Drawing with L AT E X<br />

¡<br />

¢<br />

¢<br />

¡<br />

<br />

£¥¤§¦¥¨©¤<br />

<br />

¡<br />

¢ ¡¤£ ¡¤£ ¡¤£ ¡¥£ ¡¤£<br />

¡ £ ¤¢ ¤¢ ¥¢ ¥¢ ¤¢ <br />

<br />

<br />

<br />

¨¨<br />

§ § ¦ ¦ ¦ ¦ ¦<br />

© ©<br />

<br />

¨<br />

¨<br />

<br />

<br />

<br />

§<br />

§<br />

§<br />

§<br />

§<br />

§<br />

§<br />

§<br />

¦<br />

¢<br />

§<br />

<br />

<br />

<br />

Figure 13.1: Comparison of results using the true eepic drawing functions<br />

(<strong>to</strong>p) <strong>and</strong> those with the emulation in eepicemu (bot<strong>to</strong>m). (This<br />

example is taken from the eepic user’s manual.)<br />

overloading the output file. With eepic, these lines are drawn more<br />

efficiently.<br />

Additional features added by eepic (<strong>and</strong> eepicemu, even if they do<br />

not work very well):<br />

\allinethickness{dimen}<br />

sets the line thickness <strong>to</strong> dimen for all picture elements, including<br />

circles, ovals, splines, not just for straight lines;<br />

\Thicklines<br />

sets thickness of straight lines <strong>to</strong> 1.5 times that of \thicklines;<br />

\path(x1,y1)(x2,y2). . . (xn,yn)<br />

is a fast version of \drawline, without the stretch option; a solid<br />

line is always drawn;<br />

\spline(x1,y1)(x2,y2). . . (xn,yn)<br />

draws a curve from the first <strong>to</strong> last point, with intermediate<br />

points as control points;<br />

\ellipse(x diam,y diam)<br />

draws an ellipse with horizontal <strong>and</strong> vertical sizes x diam, y diam<br />

respectively; there is also *-form <strong>to</strong> produce a solid ellipse;<br />

\arc{diameter}{start}{end}<br />

draws the arc of a circle with diameter (in \unitlength units)<br />

from angle start <strong>to</strong> end, in radians, clockwise from 0 pointing<br />

<strong>to</strong> the right; start must be from 0 <strong>to</strong> 2π, <strong>and</strong> end from start <strong>to</strong><br />

start+2π.<br />

¡<br />

¢


13.3 Other drawing packages<br />

13.3.1 The XY-pic package<br />

13.3. Other drawing packages 307<br />

As indicated at the beginning of this chapter, an exhaustive description of<br />

many other specialized packages, for drawing or using METAFONT fonts,<br />

can be found in The L AT E X Graphics Companion by Goossens et al. (1997).<br />

Most of these are designed for T E X in general, but will also work with L AT E X.<br />

We mention two of these here just <strong>to</strong> show the possibilities.<br />

The XY-pic package can carry out general drawing entirely with extra<br />

METAFONT fonts, making it fully portable among all output drivers. The<br />

fonts are also available in type 1 coding (Section G.6) so that the package<br />

works just as well with PDF output. It was created by Kris<strong>to</strong>ffer H. Rose<br />

<strong>and</strong> then extended by Ross Moore <strong>and</strong> others.<br />

Even an overview of XY-pic is beyond the scope of this book. We recommend<br />

the supplied User’s <strong>Guide</strong> <strong>and</strong> more extensive Reference Manual<br />

both <strong>to</strong> be found in texmf\doc\generic\xypic. The descriptions <strong>and</strong><br />

illustrations in Chapter 5 of Goossens et al. (1997) are especially helpful.<br />

To give a flavor of the syntax in XY-pic, we give the following examples:<br />

\xymatrix{<br />

U \ar@/_/[ddr]_y \ar@/ˆ/[drr]ˆx \ar@{.>}[dr]|-{(x,y)} \\<br />

& X \times_Z Y \ar[d]ˆq \ar[r]_p & X \ar[d]_r \\<br />

& Y \ar[r]ˆg & Z}<br />

\xy /r1.5pc/:,+*+{P};p<br />

@(,+(2,2)*{+}@+, +(2,-2)*{+}@+<br />

,+(2,2)*{+}@+, +(2,0)*+{C}="C"<br />

,*\qspline{},"C",**\crvs{.}<br />

,@i @)\endxy<br />

that produce the diagrams:<br />

U<br />

x<br />

(x,y)<br />

+<br />

+ C<br />

<br />

<br />

X ×Z Y <br />

y<br />

p X <br />

<br />

q<br />

r P<br />

+<br />

<br />

<br />

g <br />

Y <br />

Z<br />

The first example, with \xymatrix, organizes its contents in rows <strong>and</strong><br />

columns, not dissimilar <strong>to</strong> the tabular environment. In this case, the<br />

first row contains U in the first column, <strong>and</strong> the rest are empty; the second<br />

row has an empty first column (starts with &, the column separa<strong>to</strong>r) while<br />

the next two columns contain X \times_Z Y <strong>and</strong> X; the third row also<br />

has an empty first column, with entries Y <strong>and</strong> Z in the remaining columns.<br />

Everything else describes how these nodes are connected. For example,


308 Chapter 13. Drawing with L AT E X<br />

\ar@/_/[ddr]_y means ‘draw an arrow, curving down <strong>to</strong> the node located<br />

two down <strong>and</strong> one right, <strong>and</strong> subscript it with y.’ And so on for the other<br />

connections.<br />

The second example, with \xy. . . \endxy gives more complicated drawing<br />

instructions, placing objects at given coordinates, joining them with<br />

arrows, lines, curves. As can be seen from both of these examples, it takes<br />

some practice <strong>to</strong> learn the syntax <strong>and</strong> <strong>to</strong> exploit XY-pic fully.<br />

13.3.2 PSTricks<br />

In Chapter 10 we describe how the PostScript language plays a very important<br />

role in T E X <strong>and</strong> L AT E X by making a wide spectrum of fonts available<br />

<strong>to</strong> complement the original Computer Modern fonts. But PostScript is<br />

also a powerful plotting language. It was in order <strong>to</strong> exploit the PostScript<br />

possibilities directly that Timothy van Z<strong>and</strong>t wrote the PSTricks package<br />

for direct use within T E X, <strong>and</strong> thus within L AT E X.<br />

Actually PSTricks consists of over a dozen packages. The complete<br />

functionality may be loaded with the package pstricks, or the individual<br />

packages may loaded singly. (Since PSTricks is really a T E X utility, the L AT E X<br />

package pstricks.sty does nothing more than load the pstricks.tex<br />

file containing the actual code.) Some of these packages are:<br />

pst-3d 3-D drawing<br />

pst-blur adding blurred shadows<br />

pst-char stroking <strong>and</strong> filling character paths<br />

pst-coil coil <strong>and</strong> zigzag objects<br />

pst-eps export objects <strong>to</strong> EPS files<br />

pst-fill adds \psboxfill comm<strong>and</strong><br />

pst-gr3d drawing 3-D grids<br />

pst-grad gradient color fills<br />

pst-lens simulating effect of a lens<br />

pst-node placing <strong>and</strong> joining nodes<br />

pst-osci emulating oscilloscopes<br />

pst-plot plotting data<br />

pst-poly drawing polygrams<br />

pst-slpe improvement on pst-grad<br />

pst-text setting text along a path<br />

pst-tree tree comm<strong>and</strong>s<br />

As with XY-pic, it is beyond the scope of this book on document production<br />

with L AT E X <strong>to</strong> describe the extensive plotting features of PSTricks.<br />

We refer <strong>to</strong> Goossens et al. (1997), Chapter 4 for a description of most of<br />

these packages (some have been added since then) <strong>and</strong> otherwise <strong>to</strong> the<br />

supplied manuals <strong>and</strong> documentation <strong>to</strong> be found in texmf\generic\<br />

source\pstricks.


14<br />

Bibliographic<br />

Databases <strong>and</strong> BIBT E X<br />

In academic publications, a bibliography or list of references is st<strong>and</strong>ard<br />

procedure. In Section 9.3 we describe how a bibliography can be formatted<br />

with the thebibliography environment <strong>and</strong> how its entries are referred<br />

<strong>to</strong> within the text. Often authors find that they are constantly referring <strong>to</strong><br />

the same publications in most of their own papers. Similarly, researchers<br />

working in the same field will frequently be referring <strong>to</strong> the same set of<br />

papers. This means that many of the entries in the thebibliography<br />

environment will be repeated from one work <strong>to</strong> the next, or even among<br />

co-workers at one institute.<br />

It would be very useful if the bibliographic entries could be s<strong>to</strong>red in<br />

one database file once <strong>and</strong> for all <strong>to</strong> be available for all documents with<br />

a list of references in that field. Such a database system is possible with<br />

the BIBT E X program supplied with the L AT E X installation. The information<br />

about the various publications is s<strong>to</strong>red in one or more files with the<br />

extension .bib. For each publication there is a key that identifies it, <strong>and</strong><br />

which may be used in the text document <strong>to</strong> refer <strong>to</strong> it. Such a file is called<br />

a bibliographic database.<br />

14.1 The BIBT E X program<br />

BIBT E X is an auxiliary program <strong>to</strong> L AT E X that au<strong>to</strong>matically constructs a<br />

bibliography for a L AT E X document by searching one or more databases.<br />

To this end, the L AT E X file must contain the comm<strong>and</strong><br />

\bibliography{database1, database2, . . . }<br />

at that point in the text where the bibliography is <strong>to</strong> appear. Here the<br />

argument database1, database2, . . . is a list of root names, separated by<br />

commas, of the bibliographic database files that are <strong>to</strong> be searched. The<br />

extension.bib is not explicitly written.<br />

Reference can be made <strong>to</strong> a publication in one of the databases at any<br />

place in the text with the comm<strong>and</strong>s<br />

309


310 Chapter 14. Bibliographic Databases <strong>and</strong> BIBT E X<br />

\cite{key}<br />

\citep{key}<br />

\citet{key}<br />

as is explained in Sections 9.3.3 <strong>and</strong> 9.3.4. The key is the database identifier<br />

for that publication, which of course the user must know beforeh<strong>and</strong>.<br />

After the first L AT E X processing, the BIBT E X program must be run either by<br />

clicking the appropriate icon in the edi<strong>to</strong>r shell, or from a comm<strong>and</strong> line<br />

with bibtex plus the root name of the L AT E X file. Supposing this source<br />

file name is comets.tex, the call<br />

bibtex comets<br />

produces a new file with the name comets.bbl, containing the extracted<br />

information for those publications for which there was a \cite reference,<br />

packaged in a thebibliography environment <strong>to</strong> be input in<strong>to</strong> the<br />

document on the next L AT E X run.<br />

Occasionally the bibliography is <strong>to</strong> include publications that were not<br />

referenced in the text. These may be added with the comm<strong>and</strong><br />

\nocite{key}<br />

given anywhere within the main document. It produces no text at all<br />

but simply informs BIBT E X that this reference is also <strong>to</strong> be put in<strong>to</strong> the<br />

bibliography. With \nocite{*}, every entry in all the databases will be<br />

included, something that is useful when producing a list of all entries <strong>and</strong><br />

their keys.<br />

After running BIBT E X <strong>to</strong> make up the.bbl file, it is necessary <strong>to</strong> process<br />

L AT E X at least twice <strong>to</strong> establish both the bibliography <strong>and</strong> the in-text reference<br />

labels. The bibliography will be printed where the \bibliography<br />

comm<strong>and</strong> is issued; it in fact inputs the.bbl file.<br />

The formatting of the bibliography may be selected with the declaration<br />

\bibliographystyle{style}<br />

which may be issued anywhere in the document. Its only function is <strong>to</strong><br />

inform BIBT E X what bibliography style file (.bst) is <strong>to</strong> be loaded <strong>to</strong> determine<br />

the resulting format. Many contributed.bst files exist, designed for<br />

specific journals <strong>and</strong> publishing houses, <strong>and</strong> it is possible <strong>to</strong> create one’s<br />

own (Section 14.3). However, the supplied st<strong>and</strong>ard ones for numerical<br />

citation only are:<br />

plain The entries in the bibliography are ordered alphabetically; each<br />

is assigned a running number in square brackets as the in-text<br />

reference marker, printed where the \cite comm<strong>and</strong>s are issued.<br />

unsrt The entries are ordered according <strong>to</strong> their first references by the<br />

\cite <strong>and</strong> \nocite comm<strong>and</strong>s. The entry for the first \cite


14.2. Creating a bibliographic database 311<br />

receives the number 1, that of the next \cite with a different<br />

key the number 2, <strong>and</strong> so on. The markings <strong>and</strong> listings are<br />

otherwise the same as for plain.<br />

alpha The ordering in the bibliography is the same as for plain but the<br />

markers are an abbreviation of the author’s name plus year of<br />

publication. A reference <strong>to</strong> Smith (1987) would appear as [Smi87]<br />

instead.<br />

abbrv The ordering <strong>and</strong> marking are the same as for plain, but the<br />

bibliographic listing is shortened by abbreviating first names,<br />

months, <strong>and</strong> journal names.<br />

For author–year citations <strong>and</strong> the natbib package (Section 9.3.4),<br />

there exist the bibliographic styles plainnat, unsrtnat, <strong>and</strong> abbrvnat,<br />

producing the same bibliography format as the corresponding st<strong>and</strong>ard<br />

styles, but with natbib compatibility.<br />

14.2 Creating a bibliographic database<br />

Creating a bibliographic database might seem like more work than typing<br />

up a list of references with the thebibliography environment; the great<br />

advantage is that the entries need <strong>to</strong> be included in the database once<br />

<strong>and</strong> only once <strong>and</strong> are then available for all future publications. Even<br />

if a different bibliography style is dem<strong>and</strong>ed in later works, all the information<br />

is already on h<strong>and</strong> in the database for BIBT E X <strong>to</strong> write a new<br />

thebibliography environment in another format. In fact, we feel that<br />

even for a single document, it is simpler <strong>to</strong> make an entry in<strong>to</strong> the database<br />

than <strong>to</strong> adhere <strong>to</strong> the very precise <strong>and</strong> fiddly requirements of a literature<br />

list, especially regarding punctuation <strong>and</strong> positioning of the authors’ initials.<br />

The database entry proceeds very quickly <strong>and</strong> easily if one has a<br />

generalized template, as illustrated in Section 14.2.6.<br />

The entries in a bibliographic database are of the form<br />

}<br />

@BOOK{knuth:86a,<br />

AUTHOR = "Donald E. Knuth",<br />

TITLE = {The \TeX{}book},<br />

EDITION = "third",<br />

PUBLISHER = "Addison--Wesley",<br />

ADDRESS = {Reading, Massachusetts},<br />

YEAR = 1986<br />

The first word, prefixed with @, determines the entry type, as explained<br />

in the next section. The entry type is followed by the reference information<br />

for that entry enclosed in curly braces { }. The very first entry is the key


312 Chapter 14. Bibliographic Databases <strong>and</strong> BIBT E X<br />

for the whole reference by which it is referred <strong>to</strong> in the \cite comm<strong>and</strong>.<br />

In the above example this is knuth:86a. The key may be any combination<br />

of letters, numerals, <strong>and</strong> symbols, except commas. The actual reference<br />

information is then entered in various fields, separated from one another<br />

by commas. Each field consists of a field name, an = sign, with optional<br />

spaces on either side, <strong>and</strong> the field text. The field names shown above are<br />

AUTHOR, TITLE, PUBLISHER, ADDRESS, <strong>and</strong> YEAR. The field text must be<br />

enclosed either in curly braces or in double quotation marks. However,<br />

if the text consists solely of a number, as for YEAR above, the braces or<br />

quotation marks may be left off.<br />

For each entry type, certain fields are required, others are optional, <strong>and</strong><br />

the rest are ignored. These are listed with the descriptions of the various<br />

entry types below. If a required field is omitted, an error message will<br />

occur during the BIBT E X run. Optional fields will have their information<br />

included in the bibliography if they are present, but they need not be<br />

there. Ignored fields are useful for including extra information in the<br />

database that will not be output, such as a comment or an abstract of the<br />

paper. Ignored fields might also be ones that are used by other database<br />

programs.<br />

The general syntax for entries in the bibliographic database reads<br />

@entry type{key,<br />

field name = {field text},<br />

....<br />

field name = {field text} }<br />

The names of the entry types as well as the field names may be written<br />

in capitals or lower case letters, or in a combination of both. Thus @BOOK,<br />

@book, <strong>and</strong> @bOOk are all acceptable variations.<br />

The outermost pair of braces for the entire entry may be either curly<br />

braces { }, as illustrated, or parentheses ( ). In the latter case, the<br />

general syntax reads<br />

@entry type(key, ... ... )<br />

However, the field text may only be enclosed within curly braces {...} or<br />

double quotation marks "..." as shown in the example above.<br />

14.2.1 The entry types<br />

The following is a list of the st<strong>and</strong>ard entry types in alphabetical order,<br />

with a brief description of the types of works for which they are applicable,<br />

<strong>to</strong>gether with the required <strong>and</strong> optional fields that they take. The<br />

meanings of the fields are explained in the next section.<br />

@article Entry for an article from a journal or magazine.<br />

required fields author, title, journal, year.<br />

optional fields volume, number, pages, month, note.


14.2. Creating a bibliographic database 313<br />

@book Entry for a book with a definite publisher.<br />

required fields author or edi<strong>to</strong>r, title, publisher, year.<br />

optional fields volume or number, series, address, edition,<br />

month, note.<br />

@booklet Entry for a printed <strong>and</strong> bound work without the name of a<br />

publisher or sponsoring organization.<br />

required fields title.<br />

optional fields author, howpublished, address, month, year,<br />

note.<br />

@conference Is the same as @inproceedings below.<br />

@inbook Entry for a part (chapter, section, certain pages) of a book.<br />

required fields author or edi<strong>to</strong>r, title, chapter <strong>and</strong>/or<br />

pages, publisher, year.<br />

optional fields volume or number, series, type, address,<br />

edition, month, note.<br />

@incollection Entry for part of a book that has its own title.<br />

required fields author, title, booktitle, publisher, year.<br />

optional fields edi<strong>to</strong>r, volume or number, series, type,<br />

chapter, pages, address, edition, month,<br />

note.<br />

@inproceedings Entry for an article in conference proceedings.<br />

required fields author, title, booktitle, year.<br />

optional fields edi<strong>to</strong>r, volume or number, series, pages,<br />

address, month, organization, publisher,<br />

note.<br />

@manual Entry for technical documentation.<br />

required fields title.<br />

optional fields author, organization, address, edition,<br />

month, year, note.<br />

@mastersthesis Entry for a Master’s thesis.<br />

required fields author, title, school, year.<br />

optional fields type, address, month, note.<br />

@misc Entry for a work that does not fit under any of the others.<br />

required fields none.<br />

optional fields author, title, howpublished, month, year,<br />

note.<br />

@phdthesis Entry for a PhD thesis.<br />

required fields author, title, school, year.<br />

optional fields type, address, month, note.


314 Chapter 14. Bibliographic Databases <strong>and</strong> BIBT E X<br />

@proceedings Entry for conference proceedings.<br />

required fields title, year.<br />

optional fields edi<strong>to</strong>r, volume or number, series, address,<br />

month, organization, publisher, note.<br />

@techreport Entry for a report published by a school or other institution,<br />

usually as part of a series.<br />

required fields author, title, institution, year.<br />

optional fields type, number, address, month, note.<br />

@unpublished Entry for an unpublished work with an author <strong>and</strong> title.<br />

required fields author, title, note.<br />

optional fields month, year.<br />

Each entry type may also have the optional fields key <strong>and</strong> crossref.<br />

The former provides additional information for alphabetizing the entries,<br />

especially when the author information is missing. The author information<br />

is normally found in the author field but may also be in the edi<strong>to</strong>r<br />

or even organization fields. This key field has nothing <strong>to</strong> do with the<br />

key for identifying the entry in the \cite comm<strong>and</strong>. The crossref field<br />

gives the key for another entry in the database that shares many of the<br />

information fields, as illustrated in Section 14.2.3.<br />

14.2.2 The fields<br />

The fields that may be used within a bibliographic entry are listed below<br />

<strong>to</strong>gether with their meanings. They are always given in the form:<br />

field name = {field text} or<br />

field name = "field text"<br />

address<br />

The address of the publisher or other institution. For major<br />

publishing houses, it is sufficient <strong>to</strong> give just the city. For smaller<br />

publishers, giving the full address is recommended.<br />

annote An annotation that may be used by non-st<strong>and</strong>ard bibliography<br />

styles <strong>to</strong> produce an annotated bibliography. The st<strong>and</strong>ard BIBT E X<br />

styles ignore it.<br />

author The name(s) of the author(s) as described in Section 14.2.4.<br />

booktitle<br />

The title of a book when only part of it is being cited. See<br />

Section 14.2.4 for special considerations on capitalization.<br />

chapter<br />

A chapter or section number.


14.2. Creating a bibliographic database 315<br />

crossref<br />

The key of another entry in the database that shares many of the<br />

same field entries. See Section 14.2.3.<br />

edition<br />

The edition of a book, usually written in full <strong>and</strong> capitalized,<br />

as ‘Second’. The st<strong>and</strong>ard styles will change it <strong>to</strong> lower case as<br />

necessary.<br />

edi<strong>to</strong>r The name(s) of the edi<strong>to</strong>r(s) as described in Section 14.2.4. If<br />

there is also an author field, then this gives the edi<strong>to</strong>r of the<br />

book or collection in which the citation appears.<br />

howpublished<br />

States anything unusual about the method of publishing. Should<br />

be capitalized. Example: ‘Privately published’.<br />

institution<br />

The name of the sponsoring institution for a technical report.<br />

journal<br />

The name of a journal or magazine. Abbreviations are provided<br />

for the most common ones (see Section 14.2.5).<br />

key An addition for alphabetizing purposes when the author information<br />

is missing. This is not the same as the key for identifying<br />

the entry <strong>to</strong> a \cite comm<strong>and</strong>.<br />

month The month in which the work was published or, if unpublished,<br />

when it was written. Abbreviations exist in the form of the first<br />

three letters of the (English) names.<br />

note Any additional information that should be added. Capitalize the<br />

first letter.<br />

number The number of a journal, magazine, technical report, or work in<br />

a series. Journals are usually identified by volume <strong>and</strong> number;<br />

technical reports are issued a number by the institution; books<br />

in series sometimes have a number given <strong>to</strong> them.<br />

organization<br />

The sponsoring organization for a conference or a manual.<br />

pages A page number or a range of pages, in the form 32,41,58 or<br />

87--101 or 68+. The last form indicates page 68 <strong>and</strong> following<br />

pages. A single hyphen given for a range will be converted by<br />

the st<strong>and</strong>ard styles <strong>to</strong> the double hyphen <strong>to</strong> produce a dash, as<br />

‘87–101’.<br />

publisher<br />

The publisher’s name.


316 Chapter 14. Bibliographic Databases <strong>and</strong> BIBT E X<br />

school The name of the academic institution where a thesis was written.<br />

series The name of a series or set of books. When citing a book from<br />

a series, the title field gives the name of the book itself while<br />

the optional series specifies the title of whole set.<br />

title The title of the work, obeying the capitalization rules listed in<br />

Section 14.2.4.<br />

type The type of technical report, for example, ‘Research Note’.<br />

url The universal resource loca<strong>to</strong>r, or Internet address, for online<br />

documents; this is not st<strong>and</strong>ard but supplied by more modern<br />

bibliography styles.<br />

volume The volume number of a journal or multi-volume book.<br />

year The year in which the work was published or, if unpublished, in<br />

which it was written. It should normally consist of four numerals,<br />

such as 1993.<br />

Additional field names may be included, which BIBT E X will simply<br />

ignore. For example, <strong>to</strong> add the abstract of an article in the database,<br />

abstract = {text of an abstract}<br />

This can be of use in other applications as well as for database management.<br />

14.2.3 Cross-referencing fields<br />

If many entries in the bibliographic database share a common set of field<br />

information, such as for a number of works all appearing in the same<br />

conference proceedings, it is possible <strong>to</strong> refer <strong>to</strong> another entry containing<br />

that common set with the crossref field. For example,<br />

@INPROCEEDINGS{xyz-1,<br />

crossref = {xyz-proceedings},<br />

author = {J. S. Jones},<br />

title = {The First Results from the {Appleville Experiment}},<br />

pages = {34--38} }<br />

. . . . . . . . . . . . .<br />

@PROCEEDINGS{xyz-proceedings,<br />

edi<strong>to</strong>r = {C. H. Kelvin},<br />

title = {Proceedings of the First Conference on the<br />

{Appleville Experiment}},<br />

booktitle = {Proceedings of the First Conference on the<br />

{Appleville Experiment}}<br />

year = 1991 }


14.2. Creating a bibliographic database 317<br />

The first entry, with key xyz-1, is <strong>to</strong> obtain all its missing fields from<br />

the second entry, by means of the crossref field referring <strong>to</strong> the entry<br />

with key xyz-proceedings. The missing fields are edi<strong>to</strong>r, booktitle,<br />

<strong>and</strong> year, those that are common <strong>to</strong> all articles in the conference proceedings.<br />

Note that booktitle is an ignored field for @PROCEEDINGS but<br />

needs <strong>to</strong> be included here since it is required for @INPROCEEDINGS.<br />

If an entry is referred <strong>to</strong> by two or more other entries, then it <strong>to</strong>o will<br />

be included in the bibliography, even though its key never appeared as<br />

the argument of a \cite or \nocite comm<strong>and</strong>.<br />

In order for this system <strong>to</strong> function properly, the entry that is referred<br />

<strong>to</strong> must appear in the database(s) after all those that refer <strong>to</strong> it. It is<br />

therefore recommended <strong>to</strong> put all such referenced entries at the end of<br />

the database. Cross-references may not be nested.<br />

14.2.4 Special field formats<br />

There are some special rules for entering the texts <strong>to</strong> the fields author,<br />

edi<strong>to</strong>r, title, <strong>and</strong> booktitle. BIBT E X will process names, putting surnames<br />

first, abbreviating given names with initials, <strong>and</strong> so on, according<br />

<strong>to</strong> the instructions in the style file. Thus it is important that the program<br />

knows what is a given name <strong>and</strong> what a surname. Similarly for titles, capitalization<br />

may change depending on style <strong>and</strong>/or entry type, so BIBT E X<br />

must know what words are always capitalized.<br />

Names<br />

The names in the author <strong>and</strong> edi<strong>to</strong>r fields may be typed in either in<br />

the form {Given Names Surname} or as {Surname, Given Names}. That<br />

is, BIBT E X assumes that if there is no comma the last capitalized name is<br />

the surname, or family name; otherwise what comes before the comma is<br />

taken <strong>to</strong> be the surname. Thus the name texts "John George Harrison"<br />

<strong>and</strong> "Harrison, John George" are equivalent for Mr J. G. Harrison.<br />

However, if a person has a double surname, without a separating hyphen,<br />

the second form must be employed, or the double name must be enclosed<br />

in braces, as<br />

"San Martino, Maria" or "Maria {San Martino}"<br />

for Ms M. San Martino.<br />

Auxiliary words <strong>to</strong> a surname that are not capitalized, such as von or<br />

de, may be entered in either form:<br />

"Richard von Mannheim" or "von Mannheim, Richard"<br />

"Walter de la Maire" or "de la Maire, Walter"<br />

Anything enclosed in braces will be treated as a single item, something<br />

that is used in ambiguous cases, or when the name contains a comma or<br />

the word <strong>and</strong>. An example is


318 Chapter 14. Bibliographic Databases <strong>and</strong> BIBT E X<br />

"{Harvey <strong>and</strong> Sons, Ltd}"<br />

If the name contains a Junior or some other addition, it must be<br />

entered {Surname, Junior, Given Name}, for example as<br />

"Ford, Jr, Henry" or "Ford, III, Henry"<br />

However, if there is <strong>to</strong> be no comma, then the Jr must be treated as part<br />

of a double surname, something that is not recommended at all:<br />

"{Filmore Jr}, Charles" or "Charles {Filmore Jr}"<br />

Accents within a name formed with a backslash comm<strong>and</strong> should<br />

be enclosed in braces with the backslash as the first character after the<br />

opening brace. In this way, the alphabetization <strong>and</strong> the formation of labels<br />

with the alpha bibliography style will function properly. For example,<br />

author = "Kurt G{\"o}del",<br />

year = 1931<br />

will produce the label [Göd31] as desired. The accent text must not be<br />

enclosed any deeper than shown here.<br />

Accents should be formed with the backslash comm<strong>and</strong> for most<br />

generality. Some language modifications have shorth<strong>and</strong>s for accented<br />

letters (like "a instead of \"a for German) but these should be avoided in<br />

the database <strong>to</strong> ensure that the results will be universally unders<strong>to</strong>od.<br />

Hyphenated first names are properly abbreviated. Thus "Jean-Paul<br />

Sartre" becomes ‘J.-P. Sartre’.<br />

If an author or edi<strong>to</strong>r field is <strong>to</strong> contain more than one name, the<br />

names are separated by the word <strong>and</strong>. For example,<br />

author = "Helmut Kopka <strong>and</strong> Daly, Patrick William" or<br />

AUTHOR = {Peter C. Barnes <strong>and</strong> Tolman, Paul <strong>and</strong> Mary Smith}<br />

If the <strong>and</strong> is actually part of the name, the whole name must be enclosed<br />

in braces, as pointed out above.<br />

Do not insert any ˜ characters between names or initials; BIBT E X will<br />

do this au<strong>to</strong>matically as it deems fit.<br />

If only initials are given for the authors given names, insert a blank between<br />

them, as P. W. Daly, not P.W. Daly. The latter will be interpreted<br />

as a single given name <strong>and</strong> will be abbreviated as ‘P. Daly’<br />

If the author list is <strong>to</strong>o long <strong>to</strong> type in all the names, it may be<br />

terminated with <strong>and</strong> others. This will be converted <strong>to</strong> the form of et al.<br />

prescribed in the style file.<br />

Titles<br />

The capitalization of the title depends on the bibliography style: usually<br />

book titles are capitalized while article titles are not. The text in the fields


14.2. Creating a bibliographic database 319<br />

title <strong>and</strong> booktitle should be written in the capitalized form so that<br />

BIBT E X can change <strong>to</strong> lower case as required.<br />

The general rules for capitalizing titles in English state that the first<br />

word of the title, the first word after a colon, <strong>and</strong> all other words are<br />

capitalized except articles <strong>and</strong> unstressed prepositions <strong>and</strong> conjunctions.<br />

For example:<br />

title="The Right Way <strong>to</strong> Learn: A Short-Cut <strong>to</strong> a Successful Life"<br />

Words that are always <strong>to</strong> be capitalized, such as proper nouns, must<br />

be enclosed in braces. It is sufficient <strong>to</strong> enclose only the letter that must<br />

be capitalized. The two following examples are equivalent:<br />

14.2.5 Abbreviations<br />

title = "The {Giot<strong>to</strong>} Mission <strong>to</strong> Comet {Halley}" or<br />

TITLE = {The {G}iot<strong>to</strong> Mission <strong>to</strong> Comet {H}alley}<br />

It is always possible <strong>to</strong> use an abbreviation in the field text in place of<br />

actual text. Some abbreviations, such as the names of the months <strong>and</strong><br />

some st<strong>and</strong>ard journal names, are already available, <strong>and</strong> the user is free<br />

<strong>to</strong> define new ones for his or her personal use.<br />

The name of an abbreviation consists of any combination of letters,<br />

numbers, <strong>and</strong> symbols except<br />

" # % ’ ( ) , = { }<br />

An abbreviation is defined with the comm<strong>and</strong><br />

@string{abbrev name = {text}} or<br />

@string(abbrev name = {text})<br />

where abbrev name st<strong>and</strong>s for the name of the abbreviation <strong>and</strong> text is<br />

the replacement text. For example, if the abbreviation<br />

@string{JGR = {Journal of Geophysical Research}}<br />

has been defined, the following two field statements are identical:<br />

journal = JGR<br />

journal = {Journal of Geophysical Research}<br />

The name of the abbreviation is not enclosed in braces or double quotes,<br />

otherwise the name itself will be interpreted literally as the field text. In<br />

both the @string comm<strong>and</strong> <strong>and</strong> the name of the abbreviation, the case<br />

of the letters is unimportant. The above abbreviation could just as well<br />

be defined as<br />

@STRING{jgr = {Journal of Geophysical Research}}<br />

or @StrinG{jGr = {Journal of Geophysical Research}}


320 Chapter 14. Bibliographic Databases <strong>and</strong> BIBT E X<br />

<strong>and</strong> it may be referred <strong>to</strong> in the fields as JGR, JGr, JgR, Jgr, jGR, jGr, jgR<br />

or jgr.<br />

Abbreviations may be concatenated with the symbol # between them.<br />

Thus after giving<br />

@string{yrbk = {Institute Yearbook}}<br />

this abbreviation may be combined with other abbreviations <strong>and</strong> text, as<br />

in<br />

title = "Max-Planck˜" # yrbk # 2000<br />

<strong>to</strong> produce ‘Max-Planck Institute Yearbook 2000’.<br />

St<strong>and</strong>ard abbreviations exist for the months of the year, the names<br />

consisting of the first three letters of the name, as jan, feb, etc. These<br />

are actually included within the .bst file, <strong>and</strong> can change their definition<br />

for styles intended for other languages. However, the name of the<br />

abbreviation remains the same, the first 3 letters of the English name.<br />

Further predefined abbreviations are available (in the .bst file) for<br />

some st<strong>and</strong>ard journal names. Those produced with cus<strong>to</strong>m-bib are<br />

especially extensive. See Section 14.3.<br />

The @string comm<strong>and</strong>s may be issued anywhere in the database<br />

between two bibliographic entries, but must already be defined before<br />

they are used. Therefore, it makes most sense <strong>to</strong> insert all the abbreviation<br />

definitions at the beginning of the database file.<br />

14.2.6 Using a template<br />

Typing in the text for bibliographic entries in<strong>to</strong> a database might seem <strong>to</strong><br />

be rather complicated since there are so many things <strong>to</strong> remember, such<br />

as which fields are required <strong>and</strong> which are optional, what their formats<br />

are, <strong>and</strong> so on. One way <strong>to</strong> simplify this task is <strong>to</strong> make up templates<br />

for the most common entry types that you use. A template is basically a<br />

complete entry with all the fields left blank. It is s<strong>to</strong>red in a separate file<br />

on its own, <strong>to</strong> be inserted in<strong>to</strong> the database file whenever a new entry of<br />

that type is <strong>to</strong> be made. Then the field texts are written in.<br />

An appropriate template for the entry type @article could be<br />

@ARTICLE{,<br />

AUTHOR = {},<br />

TITLE = {},<br />

YEAR = {},<br />

JOURNAL = {},<br />

volume = {},<br />

number = {},<br />

month = {},<br />

pages = {},


}<br />

note = {}<br />

14.3. Cus<strong>to</strong>mizing bibliography styles 321<br />

in which the is a reminder that the keyword is <strong>to</strong> go here, the<br />

required fields come first <strong>and</strong> are capitalized, while the optional fields are<br />

in lower case.<br />

Finally, we mention that BIBT E X has been written by Oren Patashnik,<br />

Stanford University, in close association with Leslie Lamport. The BIBT E X<br />

installation should contain the two files btxdoc.tex <strong>and</strong> btxhak.tex for<br />

additional information about BIBT E X. In particular, btxhak.tex contains<br />

instructions for writing bibliographic style files. Process these files with<br />

L AT E X, if the resulting.dvi or.pdf files are not already there.<br />

14.3 Cus<strong>to</strong>mizing bibliography styles<br />

It seems that every journal <strong>and</strong> publishing house has its own set of rules<br />

for formatting bibliographies. The differences are really minor, such as<br />

whether <strong>to</strong> use commas or colons here, or <strong>to</strong> put volume numbers in bold<br />

or italic typeface. Nevertheless, in spite of this triviality, the rules are<br />

rigid for each house.<br />

St<strong>and</strong>ard L AT E X provides only four bibliography styles, <strong>and</strong> their differences<br />

have more <strong>to</strong> do with sorting <strong>and</strong> labeling than with such fussy<br />

details. It is possible <strong>to</strong> design one’s own .bst file, by modifying existing<br />

ones; however, this requires a knowledge of the peculiar BIBT E X<br />

programming language, something that puzzles even experienced L AT E X<br />

users. There are some 50.bst files in the BIBT E X direc<strong>to</strong>ries of the T E X file<br />

servers, <strong>and</strong> probably many more in contributed L AT E X direc<strong>to</strong>ries. Each<br />

is designed for a specific journal <strong>and</strong> there is no guarantee that it would<br />

be accepted by another one. What is a user <strong>to</strong> do if his or her publisher<br />

dem<strong>and</strong>s a certain format that just is not <strong>to</strong> be found? How can one seek<br />

a given format anyway among those offered?<br />

Some help can be found in the cus<strong>to</strong>m-bib application written by<br />

Patrick W. Daly. The heart of this package is a generic (or master) bibliography<br />

style merlin.mbs containing alternative coding for a multitude of<br />

different bibliographic features or options. It is processed with the Doc-<br />

Strip program which is capable of including alternative coding according<br />

<strong>to</strong> selected options (see Section D.7.1).<br />

Because of the large number of options offered (well over 100), a menuguided<br />

interface is provided, called makebst.tex. When processed under<br />

T E X or L AT E X, this ‘program’ first asks which .mbs file is <strong>to</strong> be read, <strong>and</strong><br />

then interactively constructs a DocStrip batch job <strong>to</strong> produce the selected<br />

bibliographic features according <strong>to</strong> menu information contained in the<br />

.mbs file itself. This means that there could be a number of .mbs files


322 Chapter 14. Bibliographic Databases <strong>and</strong> BIBT E X<br />

<strong>to</strong> choose from, each one explaining its set of options <strong>to</strong> the user via<br />

makebst.<br />

Support for other languages is provided by means of additional .mbs<br />

files, one for each language, which contain the translations for such words<br />

as volume, edi<strong>to</strong>r, edition, <strong>and</strong> so on.<br />

Some of the features provided by the supplied generic bibliographic<br />

style file are:<br />

• numerical or author–year citations; in the latter case, one may also<br />

choose which \bibitem style is <strong>to</strong> be used;<br />

• order of references: by citation order, alphabetical by all authors,<br />

alphabetic by author–year label;<br />

• format of authors’ names: first name plus surname, initials plus<br />

surname, surname plus initials, reversed initials only for first author,<br />

<strong>and</strong> more;<br />

• number of author names <strong>to</strong> include before giving et al.;<br />

• typeface <strong>to</strong> be used for the author names;<br />

• position of date, parentheses or brackets around the year;<br />

• format of volume, number, <strong>and</strong> pages for journals;<br />

• capitalization of article titles as sentence or title style;<br />

• whether <strong>to</strong> use the word <strong>and</strong> or an ampers<strong>and</strong> &;<br />

• placement of commas with the word <strong>and</strong>;<br />

• whether <strong>to</strong> abbreviate edi<strong>to</strong>r, volume, chapter, etc.;<br />

• first <strong>and</strong> last page numbers or only first;<br />

• optional addition of shorth<strong>and</strong> designations of common journal<br />

names;<br />

• <strong>and</strong> much more.<br />

Abbreviations for many journal names in physics, optics, <strong>and</strong> geophysics<br />

can be provided in those .bst files produced by cus<strong>to</strong>m-bib,<br />

which then may be used in BIBT E X databases. It is unfortunate that these<br />

are <strong>to</strong> be found in the .bst files themselves, which means that they may<br />

not be universally present. Which ones are present depends on the options<br />

chosen by the producer of the style file. The file shorthnd.tex in<br />

the cus<strong>to</strong>m-bib installation lists all the current possible abbreviations.<br />

(Actually, it is generated by running L AT E X on shorthnd.ins, which then<br />

produces the most current list from the existing .mbs files.) To check<br />

what any particular .bst file contains, open it <strong>and</strong> look for the MACRO<br />

comm<strong>and</strong>s.


15<br />

Presentation Material<br />

So far we have been assuming that the output of a L AT E X project is <strong>to</strong><br />

be printed paper or an electronic document looking like printed paper<br />

displayed on the computer moni<strong>to</strong>r.<br />

Another important type of output is presentation material, the visual<br />

support displayed in front of an audience during an oral presentation.<br />

Traditionally, this consisted of a set of slides <strong>to</strong> the projected on<strong>to</strong> a<br />

screen, but in more recent times this has been replaced by viewgraphs<br />

(or transparencies) <strong>and</strong> an overhead projec<strong>to</strong>r, giving the speaker much<br />

more interactive control over the presentation. However, the truly modern<br />

presentation is done electronically, with the entire presentation s<strong>to</strong>red in<br />

a computer directly connected <strong>to</strong> the projec<strong>to</strong>r; there are no slides <strong>to</strong> fall<br />

out of the cassette, or be inserted the wrong way around, no viewgraphs<br />

<strong>to</strong> spill out on<strong>to</strong> the floor. The only thing that can go wrong is that<br />

the computer refuses the connection, needs rebooting, or the necessary<br />

display program is missing. Such teething problems are occurring less<br />

frequently now that this form of presentation is becoming st<strong>and</strong>ard.<br />

In spite of the change in medium away from the 2 ′′ × 2 ′′ pieces of<br />

film, a computer presentation is still called a slide show, a term which<br />

<strong>to</strong>day presupposes the electronic medium. We will use the word slide<br />

more generally <strong>to</strong> mean a page of text <strong>and</strong>/or graphics for presentation,<br />

whether it is <strong>to</strong> be printed on paper <strong>and</strong> then pho<strong>to</strong>graphically rendered<br />

<strong>to</strong> film or transparency, or <strong>to</strong> be directly projected from the computer.<br />

The preparation of such a slide with L AT E X is much the same regardless<br />

of the final projection method; direct projection does offer additional<br />

features which we also address.<br />

We start this chapter with the st<strong>and</strong>ard L AT E X method for slide preparation,<br />

the slides class, <strong>and</strong> then describe the far more advanced seminar<br />

class (Section 15.2). The latter is especially suitable for interesting PDF<br />

electronic presentations. We then illustrate pdfscreen (Section 15.3), a<br />

package designed more for documents meant for electronic viewing but<br />

which can also produce slides. Finally we show in Section 15.4 how PDF<br />

presentations may be enhanced with the help of an additional program.<br />

323


324 Chapter 15. Presentation Material<br />

15.1 Slide production with SLIT E X<br />

The term SLIT E X was used in the old L AT E X 2.09 system <strong>to</strong> indicate a<br />

separate specialized version of L AT E X for producing projection material.<br />

This awkward <strong>and</strong> cumbersome device was needed then because of the<br />

way fonts were hardwired in<strong>to</strong> the formats. With L AT E X 2ε, this is no longer<br />

necessary, <strong>and</strong> the entire functionality is now found within the slides<br />

class, considerably streamlined over the obsolete version, running under<br />

regular L AT E X, or pdfL AT E X. The word SLIT E X therefore should be retired,<br />

but since is is a nifty expression, we will continue <strong>to</strong> use it <strong>to</strong> distinguish<br />

the slides class, which is considerably different from article <strong>and</strong> the<br />

other st<strong>and</strong>ard classes.<br />

15.1.1 The slides class<br />

A slide is meant <strong>to</strong> be projected before an audience <strong>and</strong> is therefore<br />

something quite different from a sheet of paper <strong>to</strong> be read held in the<br />

h<strong>and</strong>. One could of course make up the text for slides with the normal<br />

L AT E X comm<strong>and</strong>s, but there would be problems getting the font size right,<br />

arranging overlays, making sure that the text does not change pages<br />

unexpectedly, <strong>and</strong> the question of whether book-style fonts are suitable<br />

for projection. The L AT E X class slides attempts <strong>to</strong> solve these.<br />

A different set of fonts is used by this class, ones in which the lower<br />

case letters are relatively larger than in the normal fonts, <strong>and</strong> with a much<br />

bigger base size. This has the effect of limiting the amount of text that fits<br />

on one page/slide, but this is in fact very good practice for presentation<br />

material. The text really should be restricted <strong>to</strong> keywords <strong>and</strong> abbreviated<br />

sentences. A full page of normal text projected on <strong>to</strong> a screen will not be<br />

read by the audience.<br />

One is not obliged <strong>to</strong> use the built-in fonts; one may still select other<br />

(sans serif) font packages, such as helvet for Helvetica (Section 10.1.2)<br />

as one pleases. They will be used in larger sizes than usual.<br />

Slides should also make use of color. The original SLIT E X had a complicated<br />

method for producing color overlays (in black <strong>and</strong> white, <strong>to</strong> be<br />

copied in color) which now is <strong>to</strong>tally eliminated from the slides class.<br />

Instead, one simply makes use of the color package of Section 6.2.<br />

Most of the formatting comm<strong>and</strong>s of regular L AT E X may be used with<br />

slides, except for the page breaking <strong>and</strong> sectioning comm<strong>and</strong>s. The<br />

special features that are unique <strong>to</strong> this class are described in the next<br />

sections.<br />

15.1.2 The slide environments<br />

The source file for producing slides is structured much the same as that<br />

for a normal document, except that it is the slides class that is invoked


as<br />

\documentclass{slides}<br />

preamble text<br />

\begin{document}<br />

slide text<br />

\end{document}<br />

15.1. Slide production with SLIT E X 325<br />

If colors are wanted the color package of Section 6.2 must be added, for<br />

example as<br />

\usepackage[pdftex]{color}<br />

(You will have <strong>to</strong> specify your own driver as the option here, or rely on the<br />

local configuration <strong>to</strong> give it au<strong>to</strong>matically, as is usually the case.)<br />

The preamble may contain global specifications, for changing the paper<br />

size or selecting a page style, as usual. It may not contain any printable<br />

material.<br />

Any text that appears after \begin{document} but before the special<br />

slide environments described below is output <strong>to</strong> an unnumbered leading<br />

page that comes before any slides. This may serve as a cover page for the<br />

slides.<br />

There are three environments available for organizing different parts<br />

of a slide: the main slide itself, possible overlays, <strong>and</strong> additional notes <strong>to</strong><br />

the slide.<br />

Slides<br />

A slide or viewgraph is created by means of the environment<br />

\begin{slide} text <strong>and</strong> comm<strong>and</strong>s \end{slide}<br />

The contents of a slide environment may be any text that one pleases.<br />

Note that the slides class makes use of its own set of character fonts.<br />

The st<strong>and</strong>ard font in the normal size is roughly equivalent <strong>to</strong> the L AT E X sans<br />

serif font \sffamily in the size \LARGE. All the regular font comm<strong>and</strong>s<br />

<strong>and</strong> declarations of Section 4.1 are available, along with the other display<br />

<strong>and</strong> list environments of Chapter 4. However, there can be no page<br />

breaks within the environment, for the entire text is expected <strong>to</strong> fit on<br />

one page (slide or viewgraph). The successive slide environments will be<br />

numbered consecutively. If the page should overflow, a warning message<br />

is printed.<br />

Any color comm<strong>and</strong>s from the color package may be employed, if<br />

that package has been loaded.<br />

Overlays<br />

An overlay is an addition <strong>to</strong> a slide that can be laid on <strong>to</strong>p of it <strong>to</strong> fill<br />

in certain gaps. The idea is <strong>to</strong> create suspense during a presentation, by


326 Chapter 15. Presentation Material<br />

filling in some key words a few minutes later, or <strong>to</strong> be able <strong>to</strong> replace<br />

some text by alternatives.<br />

The slides class generates overlays with the overlay environment,<br />

which functions exactly the same as the slide environment, except that<br />

the numbering is done as a sub-number of the last slide. Thus the overlays<br />

following slide 6 are numbered 6-a, 6-b, <strong>and</strong> so on.<br />

\begin{overlay} text <strong>and</strong> comm<strong>and</strong>s \end{overlay}<br />

The slide environment for a viewgraph that is <strong>to</strong> have overlays must<br />

come before the overlay environments that go with it. Both the slide<br />

<strong>and</strong> overlay should contain identical texts, except that certain parts are<br />

printed in ‘invisible’ ink by means of the two declarations<br />

\invisible <strong>and</strong> \visible<br />

These two comm<strong>and</strong>s function just like font declarations. They may be<br />

set within curly braces {} <strong>to</strong> limit their scope, or used <strong>to</strong> apply <strong>to</strong> the<br />

whole environment. Normally, in the slide, a few words might be made<br />

invisible, while in the corresponding overlay, \invisible is declared<br />

at the start <strong>and</strong> only those words that were blanked out in the slide are<br />

made visible. This may be seen in the sample on page 329.<br />

Note: the \invisible comm<strong>and</strong> does not work with fonts other than<br />

the default ones, nor with pdfT E X. However, for pdfT E X, there are better<br />

methods <strong>to</strong> achieve the same results (Section 15.4.1).<br />

One application for overlays is <strong>to</strong> present alternative text. One might,<br />

for example, show a table of cost estimates, with the figures on an overlay.<br />

By exchanging this overlay for another, new numbers that can be achieved<br />

by certain procedural changes may be fitted in<strong>to</strong> the same table.<br />

Notes<br />

During a presentation, it is often necessary <strong>to</strong> refer <strong>to</strong> a list of keywords<br />

or other notes between the actual projected slides. The slides class has<br />

the note environment for producing such reminders for the speaker.<br />

\begin{note} text \end{note}<br />

Like the overlays, notes are sub-numbered with respect <strong>to</strong> the previous<br />

slide, but with numbers instead of letters. Following slide 4, notes are<br />

numbered 4-1, 4-2, <strong>and</strong> so on.<br />

15.1.3 Further features<br />

Page styles<br />

The L AT E X comm<strong>and</strong> \pagestyle{style} may also be used with the slides<br />

class. The following styles are available:


15.1. Slide production with SLIT E X 327<br />

plain All slides, overlays, <strong>and</strong> notes have their number at the lower<br />

right corner.<br />

headings<br />

The same as plain except that if the clock option is selected<br />

(see below), a time marker is printed in the lower left corner of<br />

the notes. This is the default page style.<br />

empty The sheets are printed with no page numbers.<br />

In normal L AT E X, the comm<strong>and</strong> \pagestyle is issued in the preamble<br />

<strong>and</strong> is valid for the whole document. Individual pages may be given a<br />

different style by means of the \thispagestyle comm<strong>and</strong> which remains<br />

in effect for only one page. This comm<strong>and</strong> should not be employed within<br />

one of the environments, but rather a new \pagestyle comm<strong>and</strong> may be<br />

given outside of the slide, overlay, <strong>and</strong> note environments.<br />

Timing notes<br />

The option clock can be selected with \documentclass; it activates two<br />

additional comm<strong>and</strong>s:<br />

\settime{secs}<br />

\addtime{secs}<br />

<strong>and</strong> prints the time in minutes at the bot<strong>to</strong>m of each note. In this way, the<br />

notes contain a reminder of how far advanced the presentation should be<br />

at that point. The value of the time marker is set <strong>and</strong> incremented with<br />

the above two comm<strong>and</strong>s, which take a number in seconds as argument.<br />

The initial value of the timer is 0.<br />

Selective slide processing<br />

During the construction of a slide show, one is likely <strong>to</strong> spend considerable<br />

time working on individual slides, ignoring the others for the time being.<br />

Complicated slides need <strong>to</strong> be corrected, processed, <strong>and</strong> viewed. One can<br />

speed this up by selecting only a few slides for processing, by placing the<br />

comm<strong>and</strong><br />

\onlyslides{slide list}<br />

in the preamble. The slide list st<strong>and</strong>s for a list of slide numbers in<br />

ascending order, for example, 2,5,9-12,15, specifying the slides, or<br />

range of slides, that are <strong>to</strong> be processed.<br />

Non-existent slide numbers may also appear in the slide list. If the<br />

slide file contains, say, 20 slides, the comm<strong>and</strong> \onlyslides{1,18-999}<br />

will allow only slides 1 <strong>and</strong> 18–20 <strong>to</strong> be processed. Any overlays that<br />

belong <strong>to</strong> these slides will also be output.<br />

Finally, the comm<strong>and</strong>


328 Chapter 15. Presentation Material<br />

\onlynotes{note list}<br />

in the preamble limits the notes that are output <strong>to</strong> those listed in note list.<br />

Supposing that slide 5 has three note environments associated with it,<br />

\onlynotes{5} arranges that only the note pages 5-1, 5-2, <strong>and</strong> 5-3 are<br />

printed.<br />

The \onlyslides <strong>and</strong> \onlynotes comm<strong>and</strong>s function similarly <strong>to</strong><br />

the comm<strong>and</strong> \includeonly described in Section 9.1.2. An interactive<br />

means of selecting slides <strong>and</strong> notes <strong>to</strong> process may be set up exactly as<br />

illustrated in Section 9.1.3 with the \typein comm<strong>and</strong>:<br />

\typein[\slides]{Which slides <strong>to</strong> do?}<br />

\onlyslides{\slides}<br />

During processing, the message ‘Which slides <strong>to</strong> do?’ is typed <strong>to</strong> the<br />

moni<strong>to</strong>r, <strong>and</strong> the user replies with the desired slide numbers. A similar<br />

scheme may be set up for \onlynotes.<br />

A sample slide file<br />

An example of input text with the slides class, with a leading page,<br />

overlay, <strong>and</strong> note, <strong>and</strong> using the clock option, is given here. The fourpage<br />

result is shown on the opposite page.<br />

\documentclass[a4paper,clock]{slides}<br />

\begin{document}<br />

\begin{center}\Large\bfseries<br />

Sample Viewgraphs<br />

\end{center}<br />

\begin{slide}<br />

\begin{center}\large Advantages of \texttt{slides}\end{center}<br />

\begin{itemize}<br />

\item Uses special fonts<br />

\item Forces key words instead of long text<br />

\invisible<br />

\item Supports color layers<br />

\visible<br />

\end{itemize}<br />

Color comm<strong>and</strong>s may be used {\invisible as color layers}<br />

\end{slide}<br />

\begin{overlay}<br />

\invisible<br />

\begin{center}\large Advantages of \texttt{slides}\end{center}


15.1. Slide production with SLIT E X 329<br />

The Leading Page The Slide Page<br />

Sample<br />

Viewgraphs<br />

Advantages of<br />

slides<br />

• Uses special fonts<br />

• Forces key words instead<br />

of long text<br />

<br />

Color comm<strong>and</strong>s may be<br />

used <br />

The Overlay Page The Note Page<br />

<br />

<br />

<br />

<br />

<br />

• Supports color layers<br />

<br />

as color layers<br />

Add the overlay only for<br />

L AT E X 2.09<br />

1-a 5 min<br />

1-1<br />

1


330 Chapter 15. Presentation Material<br />

\begin{itemize}<br />

\item Uses special fonts<br />

\item Forces key words instead of long text<br />

\visible<br />

\item Supports color layers<br />

\invisible<br />

\end{itemize}<br />

Color comm<strong>and</strong>s may be used {\visible as color layers}<br />

\end{overlay}<br />

\addtime{300}<br />

\begin{note}<br />

Add the overlay only for \<strong>LaTeX</strong>˜2.09<br />

\end{note}<br />

\end{document}<br />

15.2 Slide production with seminar<br />

The slides class of the previous section some basic support for the<br />

production of presentation material. To improve on this, Timothy van<br />

Z<strong>and</strong>t has written the seminar class with many additional features. This<br />

was originally meant as a ‘main style’ for L AT E X 2.09, but has been upgraded<br />

<strong>to</strong> a L AT E X 2ε class file by Sebastian Rahtz with fixes by David Carlisle <strong>and</strong><br />

Denis Girou. They only changed the interfacing so that it would work as<br />

a class file, leaving the functionality un<strong>to</strong>uched.<br />

Unfortunately, the supplied manual for seminar (sem-user.tex) has<br />

not been updated, <strong>and</strong> is still couched in the language of L AT E X 2.09; in<br />

particular it confuses packages <strong>and</strong> ‘style options’. We will try <strong>to</strong> correct<br />

this here.<br />

If seminar is being used for PDF output, as for an electronic presentation,<br />

it is vital <strong>to</strong> include Sebastian Rahtz’ hyperref package (Section<br />

10.2.4), which detects the presence of seminar <strong>and</strong> adjusts the PDF<br />

page sizes accordingly. This should be done even if no other hyperref<br />

features are utilized. There are some other refinements <strong>to</strong> make seminar<br />

function smoothly with pdfT E X, explained in Section 15.2.7.<br />

15.2.1 Overview<br />

The seminar class is loaded as usual with<br />

\documentclass[options]{seminar}<br />

Here we summarize its main features which differ from SLIT E X.


15.2. Slide production with seminar 331<br />

• The slide material is put in<strong>to</strong> the slide environment, for l<strong>and</strong>scape<br />

slides, <strong>and</strong> in slide* for portrait slides.<br />

• Regular Roman fonts are used, but this can be changed. The options<br />

semhelv <strong>and</strong> semlcmss switch <strong>to</strong> sans serif family with the<br />

PostScript Helvetica <strong>and</strong> the st<strong>and</strong>ard SLIT E X fonts, respectively.<br />

• Regular font sizes are used, with default 10 pt as usual. However,<br />

the slide text is magnified on output <strong>to</strong> make it more suitable for<br />

projection; the magnification fac<strong>to</strong>r can be set, but the default is a<br />

fac<strong>to</strong>r of 2, so the effective default font size is 20 pt.<br />

• A slide is started au<strong>to</strong>matically when the current one is full, or may<br />

be forced with the \newslide comm<strong>and</strong>; the entire slide show could<br />

therefore be contained within a single slide environment.<br />

• There is a choice of framing style for the slide text; the framing may<br />

be turned off with \slideframe{none} in the preamble.<br />

• Everything outside of the slide or slide* environments counts as<br />

note text. The notes are printed on separate pages, numbered n.1,<br />

n.2, . . . , for those following slide number n.<br />

• The options slidesonly, notes, <strong>and</strong> notesonly control whether<br />

only the slides, both slides <strong>and</strong> notes, or only the notes are printed.<br />

By default, both are printed.<br />

• With the article option (not <strong>to</strong> be confused with the class of the<br />

same name), the slide show is printed in miniature form, 2 per page,<br />

appropriate for reviewing or as a h<strong>and</strong>out. There is a notesonly*<br />

option <strong>to</strong> be used with article <strong>to</strong> indicate the missing slides.<br />

We now explain these features in more detail.<br />

15.2.2 Magnification <strong>and</strong> lengths<br />

Rather than using enlarged fonts as does SLIT E X, seminar works with<br />

‘normal’ sizes, which are then magnified at output. One can set the<br />

magnification step with \slidesmag{num} in the preamble, where num<br />

is an integer between −5 <strong>and</strong> 9. Step 0 is one-<strong>to</strong>-one, <strong>and</strong> each step<br />

indicates an additional fac<strong>to</strong>r of 1.2. The default is step 4 (fac<strong>to</strong>r 2).<br />

By default, the basic font size is 10 pt, but this may be altered with<br />

the usual options 11pt <strong>and</strong> 12pt. All these are magnified on output. The<br />

font size can be changed at any point in the document with \ptsize{pt},<br />

where pt can be one of 8, 9, 10, 11, 12, 14, or 17. If this is given within a<br />

slide environment, it applies only within that environment.


332 Chapter 15. Presentation Material<br />

The article option produces a h<strong>and</strong>out, with 2 slides per page, using a<br />

separate magnification which is set with \articlemag{num}; the default<br />

step is 0, no magnification.<br />

The output magnification applies <strong>to</strong> all sizes <strong>and</strong> lengths. This means,<br />

any lines drawn with \rule or spaces inserted with \hspace or \vspace<br />

are also magnified if they specify absolute units like pt or in. The size of<br />

the slide itself remains unchanged by the magnification, since the purpose<br />

is only <strong>to</strong> increase the size of the contents relative <strong>to</strong> the slide. To set<br />

lengths <strong>to</strong> values that remain fixed relative <strong>to</strong> the slide dimensions, use<br />

\setslidelength <strong>and</strong> \add<strong>to</strong>slidelength in place of \setlength <strong>and</strong><br />

\add<strong>to</strong>length. For example,<br />

\newlength{\fixed}<br />

\setslidelength{\fixed}{3in}<br />

\add<strong>to</strong>slidelength{\fixed}{1cm}<br />

\rule{1pt}{\fixed}<br />

draws a line of height 1 pt × magnification <strong>and</strong> of fixed length 3 in + 1 cm.<br />

For the article output, there are also the corresponding comm<strong>and</strong>s<br />

\setartlength <strong>and</strong> \add<strong>to</strong>artlength<br />

The following length comm<strong>and</strong>s are slide lengths (do not magnify) <strong>and</strong><br />

may be used wherever a length is required:<br />

\semcm 1 centimeter<br />

\semin 1 inch<br />

\textwidth width of the text area<br />

\textheight height of the text area<br />

\linewidth current width of text<br />

These are particularly useful with the \includegraphics comm<strong>and</strong> <strong>and</strong><br />

its options width= <strong>and</strong> height=.<br />

15.2.3 L<strong>and</strong>scape <strong>and</strong> portrait slides<br />

In contrast <strong>to</strong> SLIT E X, the seminar class allows l<strong>and</strong>scape <strong>and</strong> portrait<br />

slides <strong>to</strong> be mixed. However, there are several aspects that need <strong>to</strong> be<br />

considered.<br />

The slide <strong>and</strong> slide* environments determine whether the contents<br />

should be in l<strong>and</strong>scape or portrait slides, but the actual placement will<br />

only be correct when it agrees with the orientation of the entire document,<br />

as specified by the options l<strong>and</strong>scape <strong>and</strong> portrait. That means, when<br />

the l<strong>and</strong>scape option is chosen, the l<strong>and</strong>scape slides will be properly formatted,<br />

but the portrait ones not. The reverse applies with the portrait<br />

option. What one must do is <strong>to</strong> print the l<strong>and</strong>scape <strong>and</strong> portrait slides separately,<br />

each with the appropriate option, <strong>and</strong> with the \l<strong>and</strong>scapeonly<br />

or \portrai<strong>to</strong>nly comm<strong>and</strong> in the preamble.


15.2. Slide production with seminar 333<br />

When using the dvips driver, one can print the l<strong>and</strong>scape <strong>and</strong> portrait<br />

slides <strong>to</strong>gether by including the option semrot, which ensures that the<br />

portrait slides are rotated in<strong>to</strong> the l<strong>and</strong>scape orientation. The entire<br />

document (slide show) can be printed in one go. The portrait sheets<br />

are then manually rotated <strong>to</strong> the correct orientation. This would not be<br />

acceptable for a PDF electronic presentation, where one wants the two<br />

orientations <strong>to</strong> be mixed in one file, with the text always upright. Another<br />

solution for pdfT E X is given is Section 15.2.7.<br />

When printing both orientations <strong>to</strong>gether with the semrot option, the<br />

head <strong>and</strong> footlines will not normally be rotated with the text for portrait<br />

slides. This can be corrected by issuing \rotateheaderstrue. In this<br />

way, the output is the same as when one prints l<strong>and</strong>scape <strong>and</strong> portrait<br />

slides separately.<br />

Selecting l<strong>and</strong>scape orientation in itself does not force the output<br />

printer <strong>to</strong> go in<strong>to</strong> l<strong>and</strong>scape mode; it only sets the page dimensions so<br />

that the text is written along the longer side. The printer is informed<br />

about the l<strong>and</strong>scape intentions either by a switch when the file is sent <strong>to</strong><br />

it, or by an option <strong>to</strong> the DVI driver. Again, dvips can get around this, as<br />

explained on page 232. Using seminar <strong>and</strong> dvips, one should define<br />

\renewcomm<strong>and</strong>{\printl<strong>and</strong>scape}{\special{l<strong>and</strong>scape}}<br />

<strong>to</strong> allow the class <strong>to</strong> instruct the printer <strong>to</strong> go l<strong>and</strong>scape when necessary.<br />

This also avoids the warning message on processing that the output must<br />

be printed in l<strong>and</strong>scape mode.<br />

15.2.4 Slide formatting<br />

Here we describe the various ways <strong>to</strong> control the size, layout, <strong>and</strong> other<br />

formatting aspects of the slides.<br />

Slide size<br />

By default, the paper size is American letter size, 11 × 8.5 in, <strong>and</strong> the<br />

slide dimensions (slide writing area) are 8.5 × 6.3 in. By specifying the<br />

a4 option the paper size becomes 29.7 × 21 cm <strong>and</strong> the slide dimensions<br />

22.2 × 15.2 cm. (The a4paper option exists, but may cause an error.)<br />

The slide size may be altered temporarily as optional arguments <strong>to</strong><br />

the slide <strong>and</strong> slide* environments, as for example,<br />

\begin{slide}[10cm,7cm]<br />

\begin{slide*}[7cm,10cm]<br />

Both of the above produce a slide 10 cm wide <strong>and</strong> 7 cm high.


334 Chapter 15. Presentation Material<br />

Margins<br />

Normally the material within a slide is centered vertically. The declaration<br />

comm<strong>and</strong>s<br />

\centerslidefalse <strong>and</strong> \centerslidetrue<br />

turns this centering off <strong>and</strong> on, respectively. Without centering, the text<br />

is pushed <strong>to</strong> the <strong>to</strong>p of the slide.<br />

The text is left justified by default, with a ragged right margin. This<br />

can be changed with<br />

\raggedslides[len]<br />

where len is the maximum space between the end of the line <strong>and</strong> the right<br />

margin. Omitting len produces a ragged right margin, while a value of 0 pt<br />

yields right justification; giving 2 em, say, creates a semi-ragged margin.<br />

The margins between the slide area <strong>and</strong> the edge of the page are set<br />

with the comm<strong>and</strong>s<br />

\slideleftmargin \sliderightmargin<br />

\slide<strong>to</strong>pmargin \slidebot<strong>to</strong>mmargin<br />

which are all set initially <strong>to</strong> 0.6 in. Since these are comm<strong>and</strong>s, not lengths,<br />

they must be changed with \renewcomm<strong>and</strong>.<br />

Framing<br />

The slide area can be framed, the default being a rectangular box like that<br />

produced by \fbox (which is exactly what it is). The frame style can be<br />

chosen with<br />

\slideframe[cmds]{style}<br />

The possible values for style are plain (the default) or none. The optional<br />

cmds are settings <strong>to</strong> adjust the frame parameters, such as \fboxrule<br />

<strong>and</strong> \fboxsep. By including the fancybox package, one also has shadow,<br />

double, oval, <strong>and</strong> Oval as allowed values for style, with their corresponding<br />

parameters (Section 4.7.9).<br />

All frames make use of the lengths<br />

\slideframewidth <strong>and</strong> \slideframesep<br />

for the frame thickness <strong>and</strong> separation from text. These may only be<br />

altered (with \setlength) outside the \slideframe comm<strong>and</strong>; in the<br />

optional cmds, one must alter \fboxrule <strong>and</strong> \fboxsep directly.<br />

It is possible <strong>to</strong> define one’s own frame style with<br />

\newslideframe{new style}[cmds]{\box cmd{#1}}


15.2. Slide production with seminar 335<br />

where new style is the name of the new style (for use with \slideframe),<br />

cmds are box parameter settings, <strong>and</strong> \box cmd is a box comm<strong>and</strong>, like<br />

\fbox or \shadowbox.<br />

There is a semcolor option for seminar, but this is not based on<br />

the L AT E X color package, but depends on PostScript <strong>and</strong> the dvips driver.<br />

With the color package, one can make use of the \color <strong>and</strong> \textcolor<br />

comm<strong>and</strong>s for setting text in color, as well as \colorbox <strong>and</strong> \fcolorbox<br />

for colored boxes <strong>and</strong> \pagecolor <strong>to</strong> color the whole page (page 167).<br />

Two examples for defining color frame styles are<br />

\newslideframe{gplain}{\fcolorbox{green}{white}{#1}}<br />

\newslideframe{rshadow}[\color{red}]%<br />

{\shadowbox{\color{black}#1\color{red}}}<br />

The first makes use of the color frame box comm<strong>and</strong> \fcolorbox, while<br />

the second shows a trick <strong>to</strong> combine color comm<strong>and</strong>s with \shadowbox,<br />

which normally prints a black shadow box. The two \color{red} comm<strong>and</strong>s<br />

ensure all sides of the box are in red, while the \color{black}#1<br />

puts the box’s contents in black.<br />

Page styles<br />

Page styles determine how the running head <strong>and</strong> footlines appear on each<br />

page, just as in normal text. The regular L AT E X page style of Section 3.2<br />

(plain, empty, myheadings, <strong>and</strong> headings) are all available, <strong>and</strong> the<br />

default is plain, with the page/slide number centered in the footline. A<br />

different page style may be selected with \pagestyle{style} at any time,<br />

or with \thispagestyle{style} for just the current page.<br />

There is also an additional page style align that puts + marks at the<br />

four corners.<br />

You can define your own page styles with<br />

\newpagestyle{style}{headline}{footline}<br />

\renewpagestyle{style}{headline}{footline}<br />

which is preferable <strong>to</strong> using the styles in the fancyhdr package of Section<br />

3.2.2 since that cannot h<strong>and</strong>le the magnified lengths correctly. For<br />

example, <strong>to</strong> define a page style with a centered text in the head, <strong>and</strong> a<br />

footline with a text at the left <strong>and</strong> the slide number at the right, give<br />

\newpagestyle{mystyle}%<br />

{\hfill Report\hfill}%<br />

{March 20, 2004\hfill\thepage}<br />

Note here that \thepage prints the number for the current page, whereas<br />

\theslide <strong>and</strong> \thenote refer <strong>to</strong> the latest slide <strong>and</strong> note numbers<br />

respectively; \thepage is always set <strong>to</strong> whichever of them is being printed.


336 Chapter 15. Presentation Material<br />

Font comm<strong>and</strong>s can be included in the new definitions, but one should<br />

be aware that the comm<strong>and</strong>s \slideheadfont <strong>and</strong> \slidefootfont are<br />

always inserted in<strong>to</strong> the head <strong>and</strong> footlines. These are defined <strong>to</strong> be<br />

\scriptsize, but may be redefined by the user.<br />

It is possible <strong>to</strong> select different page styles for the slides <strong>and</strong> notes.<br />

The \pagestyle comm<strong>and</strong> sets the style for both (as well as for the<br />

article output) while \slidepagestyle applies only <strong>to</strong> slides.<br />

Page breaking<br />

Unlike SLIT E X where each slide environment generates a single slide (<strong>and</strong><br />

warnings if it is <strong>to</strong>o big), the seminar package allows the text <strong>to</strong> break<br />

naturally in<strong>to</strong> multiple slides just as normal text does in<strong>to</strong> pages. A new<br />

slide may be forced with \newslide.<br />

You can add some extra <strong>to</strong>lerance for the page breaking by specifying<br />

\extraslideheight{len}<br />

where len is the additional height allowed before a break in au<strong>to</strong>matically<br />

inserted. By setting this <strong>to</strong> be large, au<strong>to</strong>matic page breaks never occur,<br />

<strong>and</strong> the user has full control, either with \newslide or by ending the<br />

environment. Setting it <strong>to</strong> 0 pt causes pages <strong>to</strong> be broken as for regular<br />

text. The default is 10 pt.<br />

15.2.5 Selective output<br />

One can select <strong>to</strong> output just the slides, or just the notes, or both, by<br />

adding one of the options slidesonly, notesonly, or notes <strong>to</strong> the<br />

\documentclass comm<strong>and</strong>. There is also a notesonly* option <strong>to</strong> print<br />

the notes alone in article output but with indica<strong>to</strong>rs for the slides.<br />

A problem arises if slidesonly has been selected. Any global specifications<br />

issued after \begin{document} <strong>and</strong> outside of a slide environment<br />

will be ignored. One might want <strong>to</strong> redefine parameters in this way;<br />

including them inside the slide environment makes the changes local <strong>to</strong><br />

that one environment. To avoid this, such global comm<strong>and</strong>s should be<br />

placed inside a allversions* environment. (If you actually want <strong>to</strong> include<br />

text <strong>and</strong> not just non-printing specifications, use the allversions<br />

environment instead.)<br />

Just as for SLIT E X, one can output selected slides or notes. This is useful<br />

during development of the slide show, when one may spend much time<br />

designing a complicated slide <strong>and</strong> is constantly processing it <strong>to</strong> see the<br />

results; this can become tediously slow if the other, completed, slides are<br />

also complicated or include large graphics files. As for SLIT E X (page 327),<br />

the \onlyslides{list} comm<strong>and</strong> in the preamble ensures that only those<br />

slides whose numbers are included in list are processed. However, there<br />

is also a \notslides{list} comm<strong>and</strong> <strong>to</strong> exclude those slides in list.


15.2. Slide production with seminar 337<br />

The list a set of numbers in any order, separated by commas, or a<br />

range with a hyphen. It is even possible <strong>to</strong> include \ref comm<strong>and</strong>s<br />

for slides containing the corresponding \label, something that is very<br />

useful during development when the slide numbers are yet finalized. For<br />

example,<br />

\onlyslides{4,2,\ref{sum},10-999}<br />

outputs slides 2, 4, the slide containing \label{sum}, <strong>and</strong> all from 10 <strong>to</strong><br />

999. Non-existent numbers are ignored, so 10-999 really means ‘10 <strong>to</strong><br />

the end’, unless there really are so many slides in this show.<br />

15.2.6 Additional features<br />

Counters<br />

The seminar class provides all the st<strong>and</strong>ard L AT E X counters (Section 8.1)<br />

as well as slide <strong>and</strong> note counters, the values of which are printed with<br />

\theslide <strong>and</strong> \thenote. The page number is printed with \thepage,<br />

which is set <strong>to</strong> whichever of the others is current, or <strong>to</strong> the true page<br />

number for article output.<br />

The footnote counter is the only one that is reset <strong>to</strong> 1 for each new<br />

slide. If you want other counters <strong>to</strong> be reset <strong>to</strong>o, say equation, specify<br />

this with<br />

\slidereset{list} or \add<strong>to</strong>slidereset{list}<br />

where list is a comma-separated list of counters. The first comm<strong>and</strong><br />

overwrites the existing list of counters, the second adds <strong>to</strong> it.<br />

The note environment<br />

As an alternative <strong>to</strong> note pages being generated by all text outside of the<br />

slide environment, one can issue \noxcomment in the preamble, or select<br />

option noxcomment in \documentclass, <strong>and</strong> then place all the notes in<br />

\begin{note} . . . \end{note} environments.<br />

Overlays<br />

Overlays for slides can be produced by including the options semlayer<br />

<strong>and</strong> semcolor. These make use of PostScript coding <strong>and</strong> therefore only<br />

work with the dvips driver or equivalent.<br />

The \overlay{n} indicates that the following text is <strong>to</strong> appear on<br />

overlay n; it remains in effect until the current scope is ended, at the end<br />

of the environment or {..} group, or when another \overlay comm<strong>and</strong><br />

is issued.


338 Chapter 15. Presentation Material<br />

Overlays are not so useful for a PDF electronic presentation. Instead,<br />

one creates the same effect by building the page successively. A method<br />

of doing this is explained in Section 15.4.1.<br />

Adding a background image<br />

Slide shows are made more effective with the use of color, <strong>and</strong> with a<br />

background pattern or picture. A background color can be added with<br />

the \pagecolor comm<strong>and</strong> from the color package.<br />

However, even more effective is a background image. If this is a<br />

graphics file named mybg.png, one can insert it as a background <strong>to</strong> all<br />

slides with the following trick. This does require the fancybox package<br />

for the \fancyput comm<strong>and</strong>.<br />

\newlength\bgwidth<br />

\newlength\bgheight<br />

\ifportrait<br />

\setslidelength{\bgwidth}{\paperwidth}<br />

\setslidelength{\bgheight}{\paperheight}<br />

\else<br />

\setslidelength{\bgwidth}{\paperheight}<br />

\setslidelength{\bgheight}{\paperwidth}<br />

\fi<br />

\ifarticle\else<br />

\fancyput(-1\semin,1\semin){\raisebox{-\bgheight}<br />

{\includegraphics[<strong>to</strong>talheight=\bgheight,<br />

width=\bgwidth]{mybg.png}}}<br />

\fi<br />

What this does is first <strong>to</strong> define <strong>and</strong> set two new lengths, \bgwidth<br />

<strong>and</strong> \bgheight, <strong>to</strong> be the non-magnified size of the full page, for the<br />

current orientation. The \fancyput comm<strong>and</strong> places its contents on each<br />

page, relative <strong>to</strong> a point 1 in from the upper left corner; with the above<br />

coordinates, it is shifted exactly <strong>to</strong> the upper left corner. The graphics<br />

is inserted here, shifted down by the page height, <strong>and</strong> exp<strong>and</strong>ed/shrunk<br />

<strong>to</strong> fit the page exactly. One must design the graphics correctly so that<br />

any dis<strong>to</strong>rtion is minimal. The \ifarticle construction prevents the<br />

background image from being included with article output.<br />

This should work with any type of output, PostScript or PDF or other.<br />

Of course, the type of graphics file must conform <strong>to</strong> those allowed by the<br />

DVI driver. For PostScript, it must be an.eps file, not.png.<br />

See also page 345 for an alternative means of adding background<br />

images.


Local configuration<br />

15.2. Slide production with seminar 339<br />

The seminar class reads in the file seminar.con if it exists. This gives<br />

the user the chance <strong>to</strong> write all the specifications <strong>and</strong> new definitions that<br />

he or she always employs <strong>to</strong> this file, <strong>to</strong> have them au<strong>to</strong>matically included<br />

in every seminar source file.<br />

15.2.7 Using pdfT E X with seminar<br />

Although the seminar class originated in the pre-L AT E X 2ε days, <strong>and</strong> many<br />

of its extra features are coded for PostScript <strong>and</strong> the dvips driver without<br />

the modern graphics <strong>and</strong> color packages, there is no problem using it<br />

with <strong>to</strong>day’s L AT E X <strong>and</strong> those packages. This is particularly true for PDF<br />

output.<br />

However, with pdfT E X itself, there are some extra length parameters<br />

\pdfpagewidth <strong>and</strong> \pdfpageheight which need <strong>to</strong> be properly set <strong>to</strong><br />

get the output right. This is most simply guaranteed by including the<br />

hyperref package (Section 10.2.4) even if no other of its features is<br />

needed.<br />

Another difficulty arises if l<strong>and</strong>scape <strong>and</strong> portrait slides are mixed.<br />

If the goal is only <strong>to</strong> print <strong>to</strong> paper or transparencies, then the two<br />

orientations may be processed <strong>and</strong> output separately, as explained above.<br />

However, for an electronic presentation, this would be most inconvenient.<br />

Certainly the ability <strong>to</strong> mix the two orientations is highly desirable.<br />

The following code makes this possible. It revises the slide* environment<br />

<strong>to</strong> interchange the PDF page dimensions, so that a true portrait<br />

page is produced. (This is not possible with printed output where a single<br />

print job must have a fixed orientation.)<br />

\@ifundefined{pdfoutput}{\endinput}{%<br />

\ifcase\pdfoutput \endinput \fi}<br />

\newcomm<strong>and</strong>*{\pdf@revpage}{%<br />

\@tempdima=\pdfpagewidth<br />

\pdfpagewidth=\pdfpageheight<br />

\pdfpageheight=\@tempdima<br />

\@tempdima=\paperwidth<br />

\paperwidth=\paperheight<br />

\paperheight=\@tempdima<br />

}<br />

\ifarticle \pdf@revpage \fi<br />

\renewcomm<strong>and</strong>{\printl<strong>and</strong>scape}{}<br />

\exp<strong>and</strong>after\let\exp<strong>and</strong>after\slide@str<br />

\csname slide*\endcsname<br />

\@namedef{slide*}{\pdf@revpage\slide@str}


340 Chapter 15. Presentation Material<br />

S<strong>to</strong>re this in a file named sempdftx.sty, which can then be loaded with<br />

\usepackage. It is programmed <strong>to</strong> do nothing if pdfT E X is not being<br />

used. Alternatively, add a line \RequirePackage{sempdftx} <strong>to</strong> the local<br />

configuration file seminar.con <strong>to</strong> load it on every seminar run.<br />

Note: This file can be copied from the enclosed CD in the direc<strong>to</strong>ry<br />

\books\Kopka_<strong>and</strong>_Daly\, where a version of seminar.con is also available.<br />

15.3 Electronic documents for screen viewing<br />

Package:<br />

pdfscreen<br />

Strictly speaking, this section is not about presentation material that is<br />

<strong>to</strong> be projected before an audience, but rather about documents that are<br />

deliberately intended <strong>to</strong> be read from a computer moni<strong>to</strong>r. These have<br />

other requirements from printable documents: the page shape should be<br />

more like a moni<strong>to</strong>r (that is, l<strong>and</strong>scape instead of portrait) <strong>and</strong> navigation<br />

aids should be included especially if the viewer’s regular <strong>to</strong>ol bars have<br />

been switched off. And of course, internal links should be present, as<br />

well as links <strong>to</strong> external web sites <strong>and</strong> documents.<br />

The pdfscreen package by C. V. Radhakrishnan is an effort <strong>to</strong> fulfill<br />

these requirements. But it is more flexible than that, for it also allows<br />

the entire document <strong>to</strong> be output in traditional print format. And it even<br />

contains a slide environment for making projection material, so it does<br />

indeed belong <strong>to</strong> this chapter.<br />

The supplied manual can be found in texmf\doc\latex\pdfscreen,<br />

in print <strong>and</strong> screen versions. The source file manual.tex can serve as a<br />

good example of how <strong>to</strong> use the package. Figure 15.2 on the opposite page<br />

demonstrates what a title page can look like, complete with navigation<br />

panel which appears on every page.<br />

Parameters for pdfscreen<br />

This package should be loaded with the article class <strong>and</strong> with the<br />

hyperref package. In fact, it should be considered <strong>to</strong> be an extension <strong>to</strong><br />

hyperref. And it should be loaded last, right after hyperref.<br />

The options that may be invoked with the \usepackage comm<strong>and</strong> are<br />

screen <strong>to</strong> generate the output in the screen version, for online reading;<br />

print <strong>to</strong> generate the print version of the output;<br />

panelleft<br />

<strong>to</strong> place the navigation panel at the left;<br />

panelright<br />

<strong>to</strong> place the navigation panel at the right;


15.3. Electronic documents for screen viewing 341<br />

Figure 15.2: Title page of a pdfscreen document<br />

nopanel<br />

<strong>to</strong> suppress the navigation panel;<br />

panel<strong>to</strong>c<br />

<strong>to</strong> include a table of contents in the navigation panel;<br />

nocfg <strong>to</strong> ignore any local configuration file;<br />

sectionbreak<br />

<strong>to</strong> insert a new page at the start of sections.<br />

In addition one can specify various color schemes for the panel <strong>and</strong><br />

its but<strong>to</strong>ns. Possible color options are bluelace, blue, gray, orange,<br />

palegreen, <strong>and</strong> chocolate. Also all the babel language options (Chapter<br />

11) are recognized, for labeling the navigation but<strong>to</strong>ns, although only<br />

15 are actually supported; the others default <strong>to</strong> English.<br />

There are additional parameters that must be set by declarations:<br />

\emblema{image}<br />

<strong>to</strong> set the name of the graphics file used for the logo in the<br />

navigation panel;


342 Chapter 15. Presentation Material<br />

\urlid{url}<br />

<strong>to</strong> set the web address (URL) of the home page but<strong>to</strong>n in the<br />

navigation panel;<br />

\screensize{height}{width}<br />

<strong>to</strong> set the dimensions of the screen; since there are no defaults,<br />

this must be given;<br />

\margins{left}{right}{<strong>to</strong>p}{bot<strong>to</strong>m}<br />

<strong>to</strong> set the margins for the document; again there are no defaults,<br />

so this must be given.<br />

The navigation panel<br />

The navigation panel appears on each page <strong>and</strong> contains the but<strong>to</strong>ns for<br />

changing pages <strong>and</strong> linking <strong>to</strong> the author’s home page. A default panel is<br />

provided, but the user may redesign it as he or she pleases, by redefining<br />

the \panel comm<strong>and</strong>. For example,<br />

\renewcomm<strong>and</strong>{\panel}{\colorbox{panelbackground}<br />

{\begin{minipage}[t][\paperheight][b]{\panelwidth}<br />

. . . . .<br />

\Acrobatmenu{FirstPage}<br />

{\addBut<strong>to</strong>n{.2in}{$\blacktriangleleft$}}<br />

. . . . .<br />

\end{minipage}}}<br />

Here the \Acrobatmenu comm<strong>and</strong> is from the hyperref package (see<br />

page 247) while \panelwidth <strong>and</strong> \addBut<strong>to</strong>n are from pdfscreen. The<br />

\panelwidth length is by default 15% of the screen width, <strong>and</strong> can be<br />

redefined. The \addBut<strong>to</strong>n{wth}{text} creates a but<strong>to</strong>n of width wth<br />

containing text. In the above example, clicking the but<strong>to</strong>n executes the<br />

viewer comm<strong>and</strong> <strong>to</strong> go <strong>to</strong> the first page.<br />

There is also a comm<strong>and</strong><br />

\imageBut<strong>to</strong>n{wth}{ht}{image}<br />

<strong>to</strong> insert the graphics file image as a but<strong>to</strong>n of width wth <strong>and</strong> height ht.<br />

A row of small navigation but<strong>to</strong>ns can be turned on at the bot<strong>to</strong>m of<br />

the page with \bot<strong>to</strong>mbut<strong>to</strong>ns <strong>and</strong> turned off with \nobot<strong>to</strong>mbut<strong>to</strong>ns.<br />

Background image<br />

A graphics file can be inserted as background for the whole page with<br />

\overlay{image}, or a uniform background color can be selected with<br />

\backgroundcolor{color}.<br />

The navigation panel has as background that color previously defined<br />

as panelbackground, which the user may alter. Otherwise, the graphics


15.4. Special effects with PDF 343<br />

file image may be inserted as the panel background with the comm<strong>and</strong><br />

\paneloverlay{image}.<br />

Making slides<br />

There is a slide environment that places its contents centered vertically<br />

within a box the full size of the text area.<br />

Local configuration<br />

Any settings that you want <strong>to</strong> use for all documents with pdfscreen may<br />

be written <strong>to</strong> a file named pdfscreen.cfg, which is read in on loading if<br />

present.<br />

Controlling print or screen output<br />

The entire file can be processed either as a document <strong>to</strong> be printed in the<br />

traditional way, or as an electronic document for reading on a moni<strong>to</strong>r.<br />

This is switched by the options print <strong>and</strong> screen when loading the<br />

package.<br />

Text <strong>and</strong> specifications that are meant exclusively for one output version<br />

must be enclosed in print or screen environments. This is especially<br />

important for the \screensize <strong>and</strong> \margins comm<strong>and</strong>s, which<br />

are inappropriate in print mode.<br />

Other packages loaded<br />

The pdfscreen package makes heavy use of several other packages, which<br />

it loads au<strong>to</strong>matically. These must then also be installed on the system:<br />

hyperref<br />

comment<br />

truncate<br />

graphicx<br />

color<br />

colortbl<br />

15.4 Special effects with PDF<br />

calc<br />

amssymb<br />

amsbsy<br />

shortvrb<br />

fancybox<br />

There are many fancy features that one expects <strong>to</strong>day from an electronic<br />

presentation: sounds <strong>and</strong> animation, text dancing in from the sides, fade<br />

overs, <strong>and</strong> possibly fireworks. A PDF file can include many of these.<br />

The pdfT E X program cannot (yet) generate these directly, but there is an<br />

auxiliary program called PPower4, written in Java by Klaus Guntermann<br />

<strong>and</strong> Christian Spannagel. This is a post-processor designed <strong>to</strong> take as<br />

input a PDF file specially prepared with pdfT E X with some extra packages,<br />

<strong>and</strong> <strong>to</strong> create a new PDF file with the additional tricks.


344 Chapter 15. Presentation Material<br />

For example, in order <strong>to</strong> build up a page containing an itemized list,<br />

such that each item should pop up one at a time, one adds a \pause<br />

comm<strong>and</strong> after each item, runs pdfT E X, <strong>and</strong> processes the output with<br />

PPower4. It splits the page up in<strong>to</strong> several pages, each one containing<br />

the text up <strong>to</strong> the next \pause. By stepping through these pages, the<br />

presenter ‘constructs’ the one slide before the eyes of the audience. In<br />

fact, PPower4 can do much more, making a very sophisticated electronic<br />

slide show from pure L AT E X input.<br />

The PPower4 program <strong>and</strong> the necessary L AT E X support packages are<br />

on the T E XLive CD, but the latest versions can be obtained from http://<br />

www-sp.iti.informatik.tu-darmstadt.de/software/ppower4/. At<br />

the time of writing, it is still under development, but is already very<br />

impressive.<br />

15.4.1 The PPower4 packages<br />

The PPower4 post-processor is run with only two parameters: the names of<br />

the input <strong>and</strong> output files. There are no additional adjustments, controls,<br />

or options at processing time. Everything of that sort has already been<br />

placed in the L AT E X source text itself with the help of supplied packages.<br />

These instructional comm<strong>and</strong>s add comments <strong>to</strong> the resulting PDF file,<br />

which may be viewed <strong>and</strong> printed as normal. It is the post-processor that<br />

reads these comments <strong>and</strong> uses them as instructions for making up the<br />

new output file.<br />

Here we describe these packages <strong>and</strong> the marker comm<strong>and</strong>s that they<br />

enable. The use of the hyperref package is presupposed, since many<br />

effects can be achieved directly with it.<br />

Page transitions<br />

Transitions from one page <strong>to</strong> another can be done in various ways <strong>to</strong> catch<br />

attention. The simplest is the plain replacement: the old page vanishes,<br />

the new one appears. Others involve effects that look like blinds opening,<br />

or like a box opening from or <strong>to</strong>wards the center, or dissolving from one<br />

<strong>to</strong> the other. These can be set with the hyperref package with the option<br />

pdfpagetransition (page 245) or set <strong>to</strong> a different effect anywhere in<br />

the document by giving<br />

\hypersetup{pdfpagetransition={pars}}<br />

where pars are the required parameters for the desired transition.<br />

Marc van Dongen has prepared a file pagetrans.tex, available with<br />

the PPower4 collection, that defines simpler comm<strong>and</strong>s <strong>to</strong> execute the<br />

above. (If this were renamed pagetrans.sty, it would be a package <strong>and</strong><br />

could be loaded with \usepackage but as is, it must be included with the<br />

\input comm<strong>and</strong>.) These comm<strong>and</strong>s are:


Package:<br />

background<br />

\Replace pages are simply replaced, the default;<br />

15.4. Special effects with PDF 345<br />

\Dissolve one page ‘dissolves’ in<strong>to</strong> the other in a mosaic fashion;<br />

\VBlinds several horizontal lines sweep vertically across the screen, like<br />

Venetian blinds;<br />

\HBlinds same as \VBlinds, but vertical lines move horizontally;<br />

\HOSplit two vertical lines sweep horizontally out from the center;<br />

\HISplit as above, but the lines move in<strong>to</strong> the center;<br />

\VOSplit two horizontal lines sweep vertically out from the center;<br />

\VISplit as above, but the lines move in<strong>to</strong> the center;<br />

\OBox a box opens out from the center;<br />

\IBox a box sweeps in<strong>to</strong> the center;<br />

\Wipe{angle} a single line sweeps across the screen in the direction given<br />

by angle, which can be 0 (left <strong>to</strong> right), 90 (bot<strong>to</strong>m <strong>to</strong> <strong>to</strong>p), 180 (right<br />

<strong>to</strong> left), 270 (<strong>to</strong>p <strong>to</strong> bot<strong>to</strong>m);<br />

\pageTransitionGlitter{angle} like \Dissolve but in a b<strong>and</strong> that<br />

moves across the screen in the direction angle, which can be 0 (left<br />

<strong>to</strong> right), 270 (bot<strong>to</strong>m <strong>to</strong> <strong>to</strong>p), 315 (upper left <strong>to</strong> lower right).<br />

We stress again, these declarations are simplifications of the hyperref<br />

comm<strong>and</strong>s, <strong>and</strong> function without PPower4 post-processing. Once given,<br />

they remain in effect for all pages until a new transition comm<strong>and</strong> is<br />

declared.<br />

Adding a background<br />

We have already seen in Section 15.2.6 how a background image may be<br />

added with the help of the fancybox package, <strong>and</strong> how a solid background<br />

color can be set with the color package.<br />

These <strong>and</strong> other effects can also be achieved with the background<br />

package supplied with PPower4. This package provides the comm<strong>and</strong>s<br />

\hpagecolor[color1]{color2} <strong>and</strong><br />

\vpagecolor[color1]{color2}<br />

that cause the background color <strong>to</strong> blend from color1 <strong>to</strong> color2 horizontally<br />

or vertically. If the optional color1 is omitted, it is the intensity<br />

of color2 that changes across the page. Both colors must be defined by<br />

the color package comm<strong>and</strong> \definecolor, or be one of the predefined<br />

colors. This effect requires post-processing with PPower4!


346 Chapter 15. Presentation Material<br />

The package can also add background images, without PPower4 postprocessing,<br />

if it is loaded with the option bgadd. This then includes the<br />

comm<strong>and</strong>s<br />

\bgadd{image} <strong>and</strong> \bgaddcenter{image}<br />

<strong>to</strong> place image at the upper left corner or centered on the page. The<br />

image is an \includegraphics comm<strong>and</strong> with appropriate scaling <strong>to</strong> fit<br />

the page. These comm<strong>and</strong>s may be issued more than once <strong>to</strong> add further<br />

elements <strong>to</strong> the background. They may all be removed with \bgclear.<br />

Note: The addition of background elements <strong>to</strong> the pages requires that<br />

the package eso-pic also be installed.<br />

Building a page successively<br />

Package: The electronic equivalent <strong>to</strong> overlays is the successive building of a page<br />

pause of text. The PPower4 pause package introduces the \pause comm<strong>and</strong><br />

that places markers in the PDF output which PPower4 then uses <strong>to</strong> break<br />

the page at that point, <strong>and</strong> <strong>to</strong> start a new page containing the previous<br />

contents plus whatever comes up <strong>to</strong> the next \pause or end of page. This<br />

works for both pdfTEX <strong>and</strong> dvipdfm.<br />

For example, we could build a numbered list with<br />

We proceed as follows:<br />

\begin{enumerate}<br />

\item We write the list source text.\pause<br />

\item We add the pause markers.\pause<br />

\item We run pdf\TeX.\pause<br />

\item We run PPower4.\pause<br />

\end{enumerate}<br />

And there we have it!<br />

The first PDF file generated will have a single page with a small colored<br />

block where each \pause comm<strong>and</strong> appears. (This may be suppressed if<br />

the package is loaded with the nomarkers option.) The resulting PDF file<br />

after post-processing will have 5 pages in place of this one, each one with<br />

an additional item. As the presenter steps through the pages, each new<br />

line appears <strong>to</strong> be added <strong>to</strong> a single page, until the full page is complete.<br />

Building with transitions<br />

Rather than having the new line simply popping up out of nowhere, one<br />

can select the type of page transition at any step by giving a modified<br />

\pause with the name of one of the transition declarations from page 344.<br />

For example \pauseHBlinds is the same as \pause plus \HBlinds except<br />

that the transitions between main pages are not affected. Note that


15.4. Special effects with PDF 347<br />

\pauseReplace is the default, causing the new text simply <strong>to</strong> appear.<br />

These remain in effect for the following \pause breaks until counterm<strong>and</strong>ed.<br />

There is a \pauseGlitter{angle} comm<strong>and</strong> as the equivalent <strong>to</strong><br />

\pageTransitionGlitter{angle}, but all others just attach the declaration<br />

name <strong>to</strong> \pause.<br />

Building with levels<br />

Even more sophistication can be added by assigning level numbers <strong>to</strong> the<br />

chunks of text between the \pause markers. In this way the page can be<br />

built up in any order, parts can be made <strong>to</strong> disappear or <strong>to</strong> be replaced,<br />

<strong>and</strong> the footline text at the bot<strong>to</strong>m of the page can be visible from the<br />

beginning.<br />

The level number corresponds <strong>to</strong> the sequence number of the views<br />

of the built-up page. Thus a chunk of text (that which comes between<br />

\pause comm<strong>and</strong>s) with level n will first appear in view n. By default, the<br />

level number starts at 1 <strong>and</strong> increases by 1 for each \pause. To ensure<br />

that the page footline is at level 1, we can write the last line of the above<br />

example as<br />

And there we have it!\pause\pauselevel{=1}<br />

The \pauselevel comm<strong>and</strong> sets the level number for the chunk in<br />

which it is located. There are several possibilities for its argument.<br />

{=n} sets the level number absolutely <strong>to</strong> n;<br />

{=+n} increases it by n; bear in mind that the preceding \pause has<br />

already incremented it by 1;<br />

{=-n} decreases it by n;<br />

{=n -d} sets level number <strong>to</strong> n <strong>and</strong> makes the change in level<br />

number with \pause <strong>to</strong> be −d; this would be done with say<br />

{=10 -1} <strong>to</strong> make the chunks numbered backwards from 10,<br />

causing the page <strong>to</strong> be built from the bot<strong>to</strong>m up;<br />

{:m} sets the maximum level <strong>to</strong> m; at higher levels, the text vanishes;<br />

with {=3 :4} the chunk is visible only at levels 3 <strong>and</strong> 4;<br />

the :m may also be set relatively as {:+m} or {:-m}.<br />

It is also possible <strong>to</strong> give multiple level specifications, as<br />

\pause\pauselevel{=2 :2, =5 :6}Text\pause<br />

<strong>to</strong> cause ‘Text’ <strong>to</strong> appear at level 2, <strong>to</strong> vanish for 3 <strong>and</strong> 4, <strong>and</strong> <strong>to</strong> reappear<br />

only for 5 <strong>and</strong> 6.<br />

The level number may not be less than 1. Zero <strong>and</strong> negative numbers<br />

are treated as 1.


348 Chapter 15. Presentation Material<br />

With some tricky playing around with level numbers <strong>and</strong> with the T E X<br />

overlap comm<strong>and</strong>s \rlap <strong>and</strong> \llap, it is possible <strong>to</strong> get text or images<br />

<strong>to</strong> be replaced. The two must be made <strong>to</strong> overlap, but at different level<br />

numbers. For example:<br />

We now \rlap{alter}change this word<br />

We now<br />

\pause\pauselevel{=1 :1}\rlap{alter}\pause<br />

change\pause\pauselevel{=1}<br />

this word<br />

The first line shows the text without the \pause markers, in which ‘alter’<br />

overlaps <strong>to</strong> the right over ‘change’. The next lines show the same text with<br />

levels inserted: ‘alter’ belongs <strong>to</strong> level 1, <strong>and</strong> disappears after 1; ‘change’<br />

belongs <strong>to</strong> 2 (au<strong>to</strong>matic increment), <strong>and</strong> the remaining text is set back <strong>to</strong><br />

level 1.<br />

Highlighting instead of building<br />

An alternative <strong>to</strong> building the page by pieces is <strong>to</strong> highlight the section of<br />

text being discussed. In this mode, the entire page is visible, but printed<br />

in a dull color, like gray, while the chunk of text at the current level is in<br />

a bright color. When switching <strong>to</strong> the next view (level), that text becomes<br />

dull, <strong>and</strong> the next chunk brightens.<br />

To get this <strong>to</strong> work, one must inform PPower4 what the normal <strong>and</strong><br />

highlight colors are <strong>to</strong> be, <strong>and</strong> one must further indicate what text should<br />

actually change. Clearly certain parts of the page are <strong>to</strong> remain as they<br />

always are, at least the head <strong>and</strong> footlines, <strong>and</strong> possible titles. This is<br />

done with<br />

\pausecolors{textclr}{dullclr}{highclr}<br />

where textclr is a dummy color that is not otherwise being used. Only text<br />

indicated in this color will participate in the highlighting. For example<br />

\pausecolors{cyan}{gray}{red} ...<br />

This is the \textcolor{cyan}{text <strong>to</strong> be highlighted}<br />

by the ...<br />

The ‘text <strong>to</strong> be highlighted’ will normally appear in gray, but will turn<br />

red for that view corresponding <strong>to</strong> its level number. And only for that<br />

view! At the next view, it returns <strong>to</strong> gray. Note that the color cyan never<br />

appears; it is only a marker for PPower4. (Well, it does appear in the first<br />

PDF output, before post-processing.)<br />

The highlighting mode is activated with \pausehighlight which<br />

makes all text at all levels visible, but with this color switching feature.<br />

The build mode can be reactivated with \pausebuild. In build mode, the


15.4. Special effects with PDF 349<br />

color switching still takes place, but the text does not appear until the<br />

right view is reached. It will be highlighted only for this first view.<br />

One can add the word highlight <strong>to</strong> the argument of \pauselevel <strong>to</strong><br />

indicate a chunk that should always be visible even in build mode, <strong>and</strong><br />

which participates in the color switching. In highlight mode, this has no<br />

effect.<br />

Linking <strong>to</strong> first view<br />

Package: Making an internal link with the hyperref comm<strong>and</strong>s \hypertarget <strong>and</strong><br />

pp4link \hyperlink (page 247) causes the target <strong>to</strong> be on the completed built up<br />

page, on the last view. However, one probably wants <strong>to</strong> link <strong>to</strong> the first<br />

view, before the page is built up. The pp4link package can assist here. It<br />

defines the comm<strong>and</strong>s<br />

\<strong>to</strong>plink{name}{text} <strong>and</strong> \<strong>to</strong>ptarget{name}<br />

<strong>to</strong> establish text as a link <strong>to</strong> the target name.<br />

This package tries <strong>to</strong> load hyperref on its own, without any options. If<br />

you try loading hyperref afterwards, with options, you will get a message<br />

about conflicting options <strong>and</strong> the options will be ignored. Therefore, load<br />

pp4link after hyperref.


16<br />

Letters<br />

In addition <strong>to</strong> the three st<strong>and</strong>ard L AT E X document classes, there is a fourth<br />

one named letter for formatting correspondence. As provided, this<br />

class is intended for private letters without any frills such as letterheads<br />

or business reference codes. However, local modifications are possible.<br />

We first present the st<strong>and</strong>ard L AT E X letter class, <strong>and</strong> then demonstrate<br />

how a house style can be written using our own institute style as an example.<br />

As always, it is highly recommended that each of these modifications<br />

be given its own file name so that letter.cls refers only <strong>to</strong> the provided<br />

L AT E X version.<br />

16.1 The L AT E X letter class<br />

The letter document class is meant for writing letters. A single input<br />

file may contain the text for more than one letter <strong>and</strong> recipient, all from<br />

the same sender. Address labels may also be printed au<strong>to</strong>matically if<br />

one wishes. Most of the normal L AT E X comm<strong>and</strong>s function as usual within<br />

the letter class. One exception, however, is the sectioning comm<strong>and</strong>s,<br />

which will lead <strong>to</strong> the error message ! Undefined control sequence<br />

when issued. It actually makes little sense <strong>to</strong> try <strong>to</strong> divide a letter up in<strong>to</strong><br />

chapters, sections, etc. On the other h<strong>and</strong>, there are a number of special<br />

comm<strong>and</strong>s that may be applied only within this style.<br />

The input text for a letter begins as for every L AT E X document with<br />

\documentclass[options]{letter}<br />

in which all the options listed in Section 3.1 may be given for options<br />

except for twocolumn <strong>and</strong> titlepage which hardly make any sense within<br />

a letter.<br />

Every letter must contain the name <strong>and</strong> address of the sender, which<br />

are set for all the letters in one file by including the comm<strong>and</strong>s<br />

\address{sender address}<br />

\signature{sender name} or \name{sender name}<br />

351


352 Chapter 16. Letters<br />

in the preamble. The sender address normally consists of several lines,<br />

separated by \\ comm<strong>and</strong>s, as in the example<br />

\address{Max-Planck-Institut f\"ur Aeronomie\\<br />

Max-Planck-Str.\ 2\\<br />

D--37191 Katlenburg--Lindau\\Germany}<br />

The entry in the \name comm<strong>and</strong> will be used in the return address in the<br />

letterhead, if such has been programmed. The entry in the \signature<br />

comm<strong>and</strong> will be printed at the end of the letter below the space left<br />

blank for the writer’s signature. If \signature has not been specified,<br />

the \name entry is inserted here instead. This allows a more formal<br />

\name <strong>to</strong> be used for the return address <strong>and</strong> a different form, perhaps<br />

with multiple lines, for the signature, as in<br />

\name{Prof.\ M.\ Ostmann}<br />

\signature{Martin Ostmann\\Project Leader}<br />

When the above comm<strong>and</strong>s are issued in the preamble, they remain valid<br />

for all the letters in the document, except for those letters that contain<br />

new versions of these comm<strong>and</strong>s. Thus one letter might have a different<br />

\signature from the others. The scope of these entries extends only <strong>to</strong><br />

the end of the environment in which they were called (see Section 8.5.4).<br />

Two other sender entries are possible in st<strong>and</strong>ard L AT E X letter class.<br />

They are intended <strong>to</strong> be employed in local modifications for a house style.<br />

The idea is that if \address is not called, the preprogrammed company<br />

letterhead which might also contain the sender’s room <strong>and</strong>/or telephone<br />

number is generated. Thus the comm<strong>and</strong>s<br />

\location{room number} <strong>and</strong> \telephone{tel number}<br />

are provided. In the st<strong>and</strong>ard letter class, the entries room number <strong>and</strong><br />

tel number are printed at the bot<strong>to</strong>m of the first page only if \address is<br />

not issued.<br />

The preamble may also contain the \pagestyle comm<strong>and</strong> with the<br />

usual entries plain, empty, or headings. The first is the default, putting<br />

the page number centered at the bot<strong>to</strong>m of all pages after the first. The<br />

headings page style adds the recipient’s name, the date, <strong>and</strong> page number<br />

in a line at the <strong>to</strong>p of all pages after the first.<br />

After the preamble comm<strong>and</strong>s, the actual text begins as in all L AT E X<br />

files with the comm<strong>and</strong> \begin{document}. The text consists of one or<br />

more letters, each enclosed in a letter environment with the syntax:<br />

\begin{letter}{recipient} text of letter \end{letter}<br />

where recipient st<strong>and</strong>s for the name <strong>and</strong> address of the recipient, divided<br />

in<strong>to</strong> several lines separated by \\ comm<strong>and</strong>s.<br />

\begin{letter}{Mr Donald J. Burns\\<br />

Ontario Institute of Physics\\


16.1. The L AT E X letter class 353<br />

41 Adelaide St.\\<br />

London, Ontario\\Canada N4R 3X5}<br />

The text of letter normally begins with the comm<strong>and</strong> \opening <strong>and</strong><br />

ends with \closing, between which the body of the letter appears, mixed<br />

with whatever L AT E X comm<strong>and</strong>s are desired. The syntax of these two<br />

comm<strong>and</strong>s is<br />

\opening{dear}<br />

\closing{regards}<br />

where dear is the salutation, such as Dear Mr Tibs, <strong>and</strong> regards st<strong>and</strong>s<br />

for the terminating text, for example Yours sincerely,. The \opening<br />

comm<strong>and</strong> could also contain other text, for example a subject entry line,<br />

with the true salutation as part of the following body text.<br />

L AT E X places the sender’s name <strong>and</strong> address in the upper right corner<br />

of the first page with the current date set right justified below it. Then the<br />

recipient’s name <strong>and</strong> address appear at the left margin, followed by the<br />

salutation <strong>and</strong> the body of the letter. The letter ends with the terminating<br />

text <strong>and</strong> the sender’s name or signature left justified from the center of<br />

the line with sufficient vertical space between them for the h<strong>and</strong>written<br />

signature.<br />

After the \closing, a number of other comm<strong>and</strong>s may appear as part<br />

of the letter. One is \cc <strong>to</strong> produce a copy distribution list:<br />

\cc{name1 \\ name2 \\ ... }<br />

The text ‘cc:’ (or more correctly, the text defined in \ccname) is printed<br />

at the left margin, followed by an indented list of names of the copy<br />

recipients.<br />

The second additional comm<strong>and</strong> is \encl for making a list of enclosures:<br />

\encl{enclosure1 \\ enclosure2 \\ ... }<br />

The word ‘encl:’ (actually the text in \enclname) is printed at the left<br />

margin <strong>and</strong> then the list of enclosures.<br />

Finally, the comm<strong>and</strong> \ps may be used <strong>to</strong> add a postscript after the<br />

signature. The comm<strong>and</strong> itself does not generate any text, nor does it<br />

take an argument. The postscript text is everything located between the<br />

\ps <strong>and</strong> \end{letter} comm<strong>and</strong>s.<br />

Normally the letter is dated au<strong>to</strong>matically with the current date. However,<br />

if it is desired that the letter be back-dated, or that the date be<br />

otherwise fixed in the text, it may be set with<br />

\date{date text}<br />

in which case date text appears where the current date would be placed.<br />

A letter file may contain any number of letter environments, one per<br />

letter. As stated already, when \address, \name, <strong>and</strong> \signature have


354 Chapter 16. Letters<br />

A sample letter produced with the st<strong>and</strong>ard letter class.<br />

T E Xproof Ltd<br />

P. O. Box 123<br />

9876 Word<strong>to</strong>wn<br />

Textl<strong>and</strong><br />

Dear Sir;<br />

Max–Planck–Institut für Aeronomie<br />

Max–Planck-Str. 2<br />

D-37191 Katlenburg–Lindau<br />

Germany<br />

September 8, 2003<br />

We are most pleased <strong>to</strong> be able <strong>to</strong> answer your request for information about the<br />

use of L AT E X for general text processing at a scientific institute.<br />

1. After some initial trepidation on the part of the secretarial staff, which was<br />

mainly due <strong>to</strong> the first experience with a non-WYSIWYG text system, the<br />

system is now fully accepted <strong>and</strong> appreciated.<br />

2. Much <strong>to</strong> the surprise of many secretaries, they find that they are able <strong>to</strong> set<br />

the most complicated mathematical formulas in a reasonably short time<br />

without difficulties. The same applies <strong>to</strong> the production of detailed tables.<br />

3. Creating cross-references <strong>and</strong> keyword indices no longer causes horror,<br />

even when the author is well known for dem<strong>and</strong>ing constant changes.<br />

4. Finally, the high quality appearance of the output has assisted in winning<br />

acceptance for L AT E X in our house.<br />

An additional positive note is the ability <strong>to</strong> write business letters readily, making<br />

use of the letter class provided with L AT E X. In our institute, we have designed a<br />

special version <strong>to</strong> print our own letterhead, saving the need <strong>to</strong> have special letter<br />

paper printed.<br />

encl: Listing of our mpletter.cls<br />

Sample output<br />

cc: H. Kopka<br />

B. W<strong>and</strong><br />

Yours truly,<br />

Patrick W. Daly


16.1. The L AT E X letter class 355<br />

been specified in the preamble, they remain in force for all the letters in<br />

the file. It is possible <strong>to</strong> alter any one or more of these sender entries<br />

by reissuing the comm<strong>and</strong> within one of the letters, before the \opening<br />

comm<strong>and</strong>, but then this change is valid solely for that letter. If both \name<br />

<strong>and</strong> \signature have been declared, it is the latter that is printed below<br />

the signature space.<br />

The first page contains no page number. Subsequent pages have either<br />

a centered page number at the bot<strong>to</strong>m (default) or a heading line with<br />

recipient, date, <strong>and</strong> page number at the <strong>to</strong>p (page style headings).<br />

The sample letter on the facing page was generated with the following<br />

input text.<br />

\documentclass[a4paper,11pt]{letter}<br />

\name{Dr P. W. Daly}<br />

\address{Max--Planck--Institut f\"ur Aeronomie\\<br />

Max--Planck--Str.\ 2\\<br />

D-37191 Katlenburg--Lindau\\Germany}<br />

\signature{Patrick W. Daly}<br />

\date{September 8, 2003}<br />

\begin{document}<br />

\begin{letter}{\TeX proof Ltd\\P.\,O. Box 123\\<br />

9876 Word<strong>to</strong>wn\\Textl<strong>and</strong>}<br />

\opening{Dear Sir;}<br />

We are most pleased <strong>to</strong> be able <strong>to</strong> answer your request for<br />

information about the use of \<strong>LaTeX</strong>{} for general text<br />

processing at a scientific institute.<br />

\begin{enumerate}<br />

\item<br />

After some initial trepidation on the part of the secretarial<br />

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<br />

in winning acceptance for \<strong>LaTeX</strong>{} in our house.<br />

\end{enumerate}<br />

An additional positive note is the ability <strong>to</strong> write business<br />

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<br />

special paper printed.<br />

\closing{Yours truly,}<br />

\encl{Listing of our \texttt{mpletter.cls}\\Sample output}<br />

\cc{H. Kopka\\B. W<strong>and</strong>}<br />

\end{letter}<br />

\end{document}<br />

By adding the comm<strong>and</strong> \makelabels in the preamble, the user can<br />

print out address stickers after all the letters have been output. The<br />

entries for the addresses are taken from the recipients’ names <strong>and</strong> addresses<br />

in the argument <strong>to</strong> the letter environment. The st<strong>and</strong>ard LAT EX letter class is designed for a page of labels 4 1<br />

4 × 2 inches, ordered in<br />

two columns. This could be altered for other formats. An address sticker


356 Chapter 16. Letters<br />

without a corresponding letter may be printed by including an empty<br />

letter environment of the form<br />

\begin{letter}{recipient}\end{letter}<br />

16.2 A house letter style<br />

The sample letter above demonstrates the possibilities of the st<strong>and</strong>ard<br />

L AT E X letter class. The height <strong>and</strong> width of the text may easily be altered<br />

with appropriate declarations in the preamble. The use of explicit English<br />

words <strong>and</strong> date style is no problem for other languages since they are all<br />

contained in special comm<strong>and</strong>s that can be redefined.<br />

The letter class has been designed so that if the \address comm<strong>and</strong><br />

is omitted, a company letterhead will be printed instead. This presupposes<br />

that the file has been reprogrammed at the local installation for<br />

this purpose. Each employee using this house letter style will have certain<br />

personal entries <strong>to</strong> make, such as his or her room <strong>and</strong>/or telephone number.<br />

These comm<strong>and</strong>s have been provided for in the st<strong>and</strong>ard letter<br />

class.<br />

We have such a house letter style at our institute which we will illustrate<br />

here. However, it was found necessary <strong>to</strong> add some more personal entries,<br />

such as ‘Our Ref.’, ‘Your Ref.’, <strong>and</strong> email addresses. In addition, a comm<strong>and</strong><br />

<strong>to</strong> print out ‘Subject:’ has also been added.<br />

To distinguish our local house style from that of st<strong>and</strong>ard L AT E X, we have<br />

named it mpletter. It contains most of the features of letter, since it in<br />

fact reads in that class file <strong>and</strong> then makes its alterations <strong>and</strong> additions.<br />

The \address comm<strong>and</strong> is not necessary, since all letters are printed with<br />

the institute letterhead, including its address. The recipient’s name <strong>and</strong><br />

address are taken from the argument of the letter environment <strong>and</strong> are<br />

vertically centered in the space provided in the letterhead.<br />

The writer’s name <strong>and</strong> telephone extension are entered with<br />

\name{author} <strong>and</strong> \telephone{ext number}<br />

which, if given in the preamble, apply <strong>to</strong> all the letters in the file. If<br />

different letters have other authors, these comm<strong>and</strong>s must be made in<br />

the appropriate letter environment before the \opening comm<strong>and</strong>. New<br />

entry comm<strong>and</strong>s specific <strong>to</strong> mpletter are<br />

\yref{your code}<br />

\ymail{your date}<br />

\myref{our code}<br />

\subject{subj text}<br />

which produce the words<br />

Your Ref.:, Your letter of :, Our Ref.:, Subject:


16.2. A house letter style 357<br />

MAX–PLANCK–INSTITUT FÜR AERONOMIE Max–Planck–Str. 2<br />

Katlenburg–Lindau<br />

GERMANY<br />

MPI für Aeronomie, D–37191 Katlenburg–Lindau<br />

Mr George Murphy<br />

35 Waterville Rd.<br />

Center<strong>to</strong>wn, Middlesex<br />

United Kingdom<br />

Dr P. W. Daly<br />

Tel.: 05556–401–279<br />

Email:<br />

daly @ linmpi.mpg.de<br />

May 10, 2003<br />

Your Ref.: GFM/sdf Your letter from: April 28, 2003 Our Ref.: PWD/sib<br />

Subject: L AT E X information<br />

Dear George,<br />

Thank you for your inquiry about the latest version of the L AT E X installation <strong>and</strong><br />

additional packages.<br />

The entire T E X installation, with binaries <strong>and</strong> of course L AT E X, along with a large<br />

number of contributed packages, is distributed annually by the T E X Users Group,<br />

on their T E Xlive CD.<br />

I am sending you a copy of the current version of this CD, as you requested.<br />

In a separate direc<strong>to</strong>ry named bibtex you will find the special bibliography<br />

formatting package files mentioned in ‘A <strong>Guide</strong> <strong>to</strong> L AT E X’. I hope you will find<br />

these of use.<br />

Do not hesitate <strong>to</strong> get in <strong>to</strong>uch with me again if you have any further questions<br />

about the installation or running of the package.<br />

encl: 1 CD-ROM with T E Xlive contents<br />

cc: H. Kopka<br />

Telephone 05556–401– 1<br />

Telefax 05556–401– 240<br />

Telex 9 65 527 aerli<br />

Bank<br />

Kreis–Sparkasse Northeim<br />

41 104 449 (BLZ 262 500 01)<br />

Regards,<br />

Patrick W. Daly<br />

Train Station<br />

Northeim<br />

(Han.)


358 Chapter 16. Letters<br />

properly positioned under the letterhead <strong>to</strong>gether with the corresponding<br />

text argument. If any of these comm<strong>and</strong>s are missing, their text will not<br />

appear in the letter.<br />

Since ours is a German institute, there is an option german that translates<br />

all these words in<strong>to</strong> their German equivalents. The entry comm<strong>and</strong>s<br />

have the same names, however.<br />

As in the st<strong>and</strong>ard letter class, the current date is printed au<strong>to</strong>matically,<br />

but may be changed <strong>to</strong> any desired text with the comm<strong>and</strong><br />

\date{date text}<br />

if one wishes <strong>to</strong> back-date a letter or <strong>to</strong> fix the dating within the letter file<br />

itself. This is often h<strong>and</strong>y if one only keeps electronic copies of the letters<br />

for the record. Otherwise, when a hard copy is run off months later, it<br />

will appear with the new current date <strong>and</strong> not with the original one.<br />

The entry author that is given as the argument <strong>to</strong> the \name comm<strong>and</strong><br />

appears in the letterhead as the name of the sender. It will also appear<br />

below the space left for the signature, unless it is overridden by the<br />

\signature comm<strong>and</strong> that specifies an alternative form of the name for<br />

this purpose.<br />

The sample letter on the previous page has been generated with our<br />

house style, using the following input text.<br />

\documentclass[12pt]{mpletter}<br />

\name{Dr P. W. Daly} \signature{Patrick W. Daly}<br />

\myref{PWD/sib}<br />

\date{May 10, 2003}<br />

\subject{\<strong>LaTeX</strong>{} information}<br />

\telephone{279} \internet{daly}<br />

\ymail{April 28, 2003} \yref{GFM/sdf}<br />

\begin{document}<br />

\begin{letter}{%<br />

Mr George Murphy\\35 Waterville Rd.\\<br />

Center<strong>to</strong>wn, Middlesex\\United Kingdom}<br />

\opening{Dear George,}<br />

Thank you for your inquiry about the latest version<br />

of the \<strong>LaTeX</strong>{} installation <strong>and</strong> additional packages.<br />

. . . . . . . . . . . . . . . . . . . . . . . . . .<br />

Do not hesitate <strong>to</strong> get in <strong>to</strong>uch with me again if you<br />

have any further questions about the installation or<br />

running of the package.<br />

\closing{Regards,}<br />

\encl{1 CD-ROM with \TeX{}live contents}<br />

\cc{H. Kopka}<br />

\end{letter}<br />

\end{document}


16.3. A model letter cus<strong>to</strong>mization 359<br />

The first page of our institute letter appears as shown, without a page<br />

number. If the text must continue beyond one page, the next page will<br />

have the heading<br />

MAX–PLANCK–INSTITUT FÜR AERONOMIE<br />

To Mr George Murphy May 10, 1998 Page 2<br />

The recipient’s name that appears in this heading is taken from the first<br />

line of the recipient argument in the \begin{letter}. This argument<br />

is split up by the L AT E X processing so that the first line is contained in<br />

the comm<strong>and</strong> \<strong>to</strong>name, <strong>and</strong> the rest of the lines in \<strong>to</strong>address. The<br />

words ‘To’ <strong>and</strong> ‘Page’ are in the st<strong>and</strong>ard comm<strong>and</strong>s \head<strong>to</strong>name <strong>and</strong><br />

\pagename, <strong>and</strong> may be changed by an appropriate language adaptation<br />

option as shown in Section D.4.2.<br />

16.3 A model letter cus<strong>to</strong>mization<br />

Adapting the letter.cls class file <strong>to</strong> the requirements of a company<br />

style should present few difficulties <strong>to</strong> an experienced L AT E X programmer.<br />

Even a normal user may be able <strong>to</strong> make the necessary changes with the<br />

help of the example in this section.<br />

We present here the class file mpletter.cls that was used <strong>to</strong> produce<br />

the sample letter on page 357. It makes heavy use of the L AT E X programming<br />

features described in Appendix D. In order <strong>to</strong> underst<strong>and</strong> it, one<br />

should be familiar with Section D.2. It will not be necessary <strong>to</strong> make<br />

any changes <strong>to</strong> the file letter.cls itself, since all modifications are in a<br />

separate class file that inputs the original.<br />

The new class file is <strong>to</strong> be called mpletter.cls. It begins by specifying<br />

the T E X format that it requires, <strong>and</strong> by identifying itself.<br />

\NeedsTeXFormat{<strong>LaTeX</strong>2e}<br />

\ProvidesClass{mpletter}<br />

It will be necessary <strong>to</strong> execute conditionals, so we will need the ifthen<br />

package described in Section 8.3.5. We will want a flag <strong>to</strong> decide if the<br />

letter is <strong>to</strong> be in German or not, determined by an option. Create the flag<br />

<strong>and</strong> define the option german <strong>to</strong> set it.<br />

\RequirePackage{ifthen}<br />

\newboolean{@german}<br />

\setboolean{@german}{false}<br />

\DeclareOption{german}{\setboolean{@german}{true}}<br />

All other options that are valid in the st<strong>and</strong>ard letter class will also<br />

be accepted here, so simply pass them on <strong>to</strong> that class with the default<br />

option. Then process all options before loading letter itself with the<br />

a4paper option. We only have A4 paper in our institute.


360 Chapter 16. Letters<br />

\DeclareOption*{\PassOptionsToClass{\CurrentOption}{letter}}<br />

\ProcessOptions<br />

\LoadClass[a4paper]{letter}<br />

This completes the preliminaries. So far, we have read in the st<strong>and</strong>ard<br />

letter class, along with the package ifthen, <strong>and</strong> defined a new option<br />

that is not present in the original class. Otherwise, all options <strong>and</strong><br />

functions are unchanged, so far.<br />

We now define the new ‘name’ comm<strong>and</strong>s <strong>to</strong> contain language-sensitive<br />

text, such as ‘Subject’, which are not provided for in the basic class. The<br />

actual definitions will be executed by two comm<strong>and</strong>s \englishnames <strong>and</strong><br />

\germannames.<br />

\newcomm<strong>and</strong>{\englishnames}{%<br />

\newcomm<strong>and</strong>{\yrefname}{\textsl{Your Ref.}}<br />

\newcomm<strong>and</strong>{\ymailname}{\textsl{Your letter from}}<br />

\newcomm<strong>and</strong>{\myrefname}{\textsl{Our Ref.}}<br />

\newcomm<strong>and</strong>{\subjectname}{\textsl{Subject}}<br />

\newcomm<strong>and</strong>{\telephonename}{Telephone}<br />

\newcomm<strong>and</strong>{\stationname}{Train Station}<br />

\newcomm<strong>and</strong>{\germanname}{GERMANY}<br />

\newcomm<strong>and</strong>{\telcode}{[49]-5556-401}<br />

\newcomm<strong>and</strong>{\postcode}{D--37191}<br />

}<br />

\newcomm<strong>and</strong>{\germannames}{%<br />

. . . . . . . . . . . . . . . . . . . . .<br />

\newcomm<strong>and</strong>{\telcode}{(05556) 401}<br />

\newcomm<strong>and</strong>{\postcode}{37191}<br />

}<br />

\ifthenelse{\boolean{@german}}<br />

{\RequirePackage{german}\germannames}{\englishnames}<br />

The last lines test whether the flag @german has been set (by the option<br />

german), <strong>and</strong> if so, the package german is loaded, <strong>and</strong> the German names<br />

are defined, otherwise the English names. The package german already<br />

translates the st<strong>and</strong>ard names comm<strong>and</strong>s \<strong>to</strong>name, \head<strong>to</strong>name, <strong>and</strong><br />

\pagename, so they are not included in \germannames.<br />

Having settled the language problem, we now attack those comm<strong>and</strong>s<br />

for entering extra information in the header. Each of these s<strong>to</strong>res its<br />

text argument in an internal comm<strong>and</strong> for future use. First the internal<br />

s<strong>to</strong>rage comm<strong>and</strong>s must be created.<br />

\newcomm<strong>and</strong>{\@yref}{} \newcomm<strong>and</strong>{\@ymail}{}<br />

\newcomm<strong>and</strong>{\@myref}{} \newcomm<strong>and</strong>{\@subject}{}<br />

\newcomm<strong>and</strong>{\@internet}{}<br />

\newcomm<strong>and</strong>{\yref}[1]{\renewcomm<strong>and</strong>{\@yref}{\yrefname: #1}}


16.3. A model letter cus<strong>to</strong>mization 361<br />

\newcomm<strong>and</strong>{\ymail}[1]{\renewcomm<strong>and</strong>{\@ymail}{\ymailname: #1}}<br />

\newcomm<strong>and</strong>{\myref}[1]{\renewcomm<strong>and</strong>{\@myref}{\myrefname: #1}}<br />

\newcomm<strong>and</strong>{\subject}[1]{\renewcomm<strong>and</strong>{\@subject}<br />

{\subjectname: #1}}<br />

\newcomm<strong>and</strong>{\internet}[1]{\renewcomm<strong>and</strong>{\@internet}{#1}}<br />

\newcomm<strong>and</strong>{\INTERNET}{@linmpi.mpg.de}<br />

Set the dimensions of the text on the page <strong>and</strong> its margins. These<br />

numbers are appropriate for A4 paper (which does make the a4paper<br />

option superfluous).<br />

\setlength{\textheight}{215mm} \setlength{\textwidth}{160mm}<br />

\setlength{\oddsidemargin}{0pt} \setlength{\evensidemargin}{0pt}<br />

\setlength{\<strong>to</strong>pmargin}{-20pt} \setlength{\headheight}{12pt}<br />

\setlength{\headsep}{35pt}<br />

The next step is <strong>to</strong> define some fixed fonts that are needed for the<br />

letterhead. We refer <strong>to</strong> the fonts with their explicit NFSS attributes; in<br />

this case they are all Computer Modern sans serif fonts in various sizes.<br />

These fonts will not change if <strong>to</strong>tally different families are used for the<br />

body of the letter.<br />

\DeclareFixedFont{\xviisf}{OT1}{cmss}{m}{n}{17}<br />

\DeclareFixedFont{\xsf}{OT1}{cmss}{m}{n}{10}<br />

\DeclareFixedFont{\viiisf}{OT1}{cmss}{m}{n}{8}<br />

The letterhead itself is divided in<strong>to</strong> two fields, the left one containing<br />

the institute name in large letters, the right one the address in a smaller<br />

font. Below the first horizontal line, the left field displays the name <strong>and</strong><br />

address of the recipient, positioned <strong>to</strong> fit in the window of an envelope, <strong>and</strong><br />

the right one has the personal data of the letter writer, name, extension,<br />

computer address. The widths of these fields are established.<br />

\newlength{\leftfield} \setlength{\leftfield}{117mm}<br />

\newlength{\rightfield} \setlength{\rightfield}{43mm}<br />

The <strong>to</strong>tal width of these two fields equals 160 mm, which is the same as<br />

\textwidth.<br />

Next, we place the institute name <strong>and</strong> address in several saved boxes.<br />

\newsavebox{\FIRM} \newsavebox{\firmaddress}<br />

\newsavebox{\firm} \newsavebox{\firmreturn}<br />

\sbox{\FIRM}<br />

{\parbox[t]{\leftfield}<br />

{\xviisf MAX--PLANCK--INSTITUT F\"UR AERONOMIE}}<br />

\sbox{\firm}<br />

{\xsf MAX--PLANCK--INSTITUT F\"UR AERONOMIE}<br />

\sbox{\firmreturn}


362 Chapter 16. Letters<br />

{\viiisf\underline{MPI f\"ur Aeronomie,<br />

\postcode{} Katlenburg--Lindau}}<br />

\sbox{\firmaddress}<br />

{\parbox[t]{\rightfield}{\viiisf\baselineskip10pt<br />

Max--Planck--Stra{\ss}e 2\\<br />

\postcode{} Katlenburg--Lindau\\\germanname}}<br />

Using these boxes as building blocks, we put <strong>to</strong>gether the actual head <strong>and</strong><br />

foot of the letterhead page in two further save boxes.<br />

\newsavebox{\firmhead} \newsavebox{\firmfoot}<br />

\sbox{\firmhead}<br />

{\parbox{\textwidth}{\usebox{\FIRM}\raisebox{6pt}<br />

{\usebox{\firmaddress}}\\[3pt] \rule{\textwidth}{1pt}}}<br />

\sbox{\firmfoot}<br />

{\parbox{\textwidth}{\rule{\textwidth}{0.6pt}\\[5pt]<br />

\viiisf\setlength{\baselineskip}{12pt}%<br />

\begin{tabular}[t]{@{}ll}<br />

\underline{\telephonename} & \telcode-1\\<br />

\underline{Telefax} & \telcode-240\\<br />

\underline{Telex} & 9\,65\,527 aerli<br />

\end{tabular}\hfill<br />

\begin{tabular}[t]{l}<br />

\underline{Bank}\\<br />

Kreis--Sparkasse Northeim\\<br />

41\,104\,449 (BLZ 262\,500\,01)<br />

\end{tabular}\hfill<br />

\begin{tabular}[t]{l@{}}<br />

\underline{\stationname}\\<br />

Northeim\\<br />

(Han.)<br />

\end{tabular} }}<br />

The box \firmhead is fairly clear: it is a \parbox of width \textwidth<br />

containing the boxes \FIRM <strong>and</strong> \firmaddress side by side, with a line<br />

below. The foot \firmfoot is also a \parbox of the same width, but<br />

containing three columns of general institute information, set in tabular<br />

environments.<br />

It now remains <strong>to</strong> have the head <strong>and</strong> foot boxes placed on the first<br />

page. In the letter class, there is a special page style named firstpage<br />

that is always invoked for the first page of a letter. This must be redefined.<br />

\renewcomm<strong>and</strong>{\ps@firstpage}<br />

{\setlength{\headheight}{41pt}\setlength{\headsep}{25pt}%<br />

\renewcomm<strong>and</strong>{\@oddhead}{\usebox{\firmhead}}%<br />

\renewcomm<strong>and</strong>{\@oddfoot}{\raisebox{-20pt}[0pt]<br />

{\usebox{\firmfoot}}}%


16.3. A model letter cus<strong>to</strong>mization 363<br />

\renewcomm<strong>and</strong>{\@evenhead}{}\renewcomm<strong>and</strong>{\@evenfoot}{}}<br />

This page style must (re)define the comm<strong>and</strong>s \@oddhead <strong>and</strong> \@oddfoot,<br />

which are always inserted at the <strong>to</strong>p <strong>and</strong> bot<strong>to</strong>m of odd pages, <strong>to</strong> place<br />

our special \firmhead <strong>and</strong> \firmfoot. The even pages are unimportant,<br />

since the first page is always odd. It is necessary <strong>to</strong> enlarge \headheight<br />

<strong>and</strong> \headsep <strong>to</strong> allow the big boxes <strong>to</strong> fit in.<br />

Subsequent pages are set with the headings or plain page styles. We<br />

want <strong>to</strong> modify the former <strong>to</strong> include the firm address once more.<br />

\renewcomm<strong>and</strong>{\ps@headings}<br />

{\setlength{\headheight}{41pt}%<br />

\renewcomm<strong>and</strong>{\@oddhead}<br />

{\parbox{\textwidth}{\usebox{\firm}\\[5pt]<br />

\slshape \head<strong>to</strong>name{} \<strong>to</strong>name\hfill\@date\hfill<br />

\pagename{} \thepage\\<br />

\rule[3pt]{\textwidth}{1pt}}}<br />

\renewcomm<strong>and</strong>{\@oddfoot}{}<br />

\renewcomm<strong>and</strong>{\@evenhead}{\@oddhead}<br />

\renewcomm<strong>and</strong>{\@evenfoot}{\@oddfoot}}<br />

One small problem remains: the first time one of these page style<br />

comm<strong>and</strong>s is executed, the head <strong>and</strong> foot comm<strong>and</strong>s may not yet exist,<br />

causing \renewcomm<strong>and</strong> <strong>to</strong> complain. We ensure that they are there at<br />

the start by predefining them with \providecomm<strong>and</strong> (Section 8.3.1).<br />

\providecomm<strong>and</strong>{\@evenhead}{}\providecomm<strong>and</strong>{\@oddhead}{}<br />

\providecomm<strong>and</strong>{\@evenfoot}{}\providecomm<strong>and</strong>{\@oddfoot}{}<br />

Now make headings the active page style.<br />

\pagestyle{headings}<br />

There is only one last thing <strong>to</strong> do, <strong>and</strong> that is <strong>to</strong> redefine the opening<br />

comm<strong>and</strong> that prints the recipient’s address <strong>and</strong> the salutation. We add<br />

a bit more, including the personal data of the sender, as well as the<br />

reference information. The address goes in the left field, the personal<br />

data <strong>to</strong> the right. The references go in a line below the rule, followed by<br />

the subject line. These entries are tested first, <strong>and</strong> are only included if<br />

they are not blank. Several s<strong>to</strong>red entry comm<strong>and</strong>s used here are part<br />

of the st<strong>and</strong>ard letter class, such as \<strong>to</strong>name <strong>and</strong> \<strong>to</strong>address. The<br />

\@date entry is either \<strong>to</strong>day or whatever text was s<strong>to</strong>red with \date.<br />

\renewcomm<strong>and</strong>{\opening}[1]{\thispagestyle{firstpage}%<br />

\parbox[t]{\leftfield}<br />

{\usebox{\firmreturn}\\<br />

\parbox[b][3.5cm][c]{\leftfield}{\<strong>to</strong>name\\\<strong>to</strong>address}}%<br />

\parbox[t]{\rightfield}<br />

{\fromname<br />

\ifthenelse{\equal{\telephonenum}{}}<br />

{}{\\ Tel.: \telcode-\telephonenum}


364 Chapter 16. Letters<br />

\ifthenelse{\equal{\@internet}{}}<br />

{}{\\{\viiisf Email: \@internet\INTERNET}}<br />

\\[5mm] \@date}<br />

\par<br />

\rule{\textwidth}{0.6pt}<br />

\makebox[\leftfield][l]<br />

{\ifthenelse{\equal{\@yref}{}}<br />

{\@ymail}{\@yref\hfill\@ymail\hfill}}<br />

\@myref\par<br />

\ifthenelse{\equal{\@subject}{}}<br />

{}{\@subject\par}<br />

\vspace{2\parskip} #1 \par\nobreak}<br />

The result of this formatting can be seen on page 357. It should be<br />

possible <strong>to</strong> modify the coding as needed for other organizations without<br />

<strong>to</strong>o much difficulty.<br />

The field for the recipient’s name <strong>and</strong> address has been positioned so<br />

that it will appear in the address window of an envelope when properly<br />

folded. The smaller return address will also be visible through this<br />

window. The printing of extra address stickers is thus superfluous.<br />

As an exercise, the user should design a document class pletter for writing<br />

personal letters. With the tips for formatting company letters, it should not be<br />

difficult <strong>to</strong> add a letterhead of the form<br />

Sheila Joan McDonald<br />

Tel.: 234-9871<br />

31 Maple Drive<br />

Willow<strong>to</strong>wn<br />

Hint: The name has been printed with the font cmdunh10 scaled \magstep4,<br />

declared with \newfont. Such a pletter class must remain in the personal<br />

direc<strong>to</strong>ries of the user at a computer center. It would be rather embarrassing if<br />

everyone made use of the same personal letterhead.


Appendices


A<br />

The New Font Selection<br />

Scheme (NFSS)<br />

When T E X <strong>and</strong> L AT E X were invented, the fonts available for them were very<br />

limited in number. For this reason, the original L AT E X had an inflexible<br />

system of defining the fonts that were <strong>to</strong> be used, since it was not obvious<br />

that one might want <strong>to</strong> change them. The association between the highlevel<br />

font comm<strong>and</strong>s such as \large <strong>and</strong> \bf <strong>and</strong> the external font name<br />

that is ultimately selected was rigidly fixed internally.<br />

Today there are many additional fonts available, some of which should<br />

be used alongside the st<strong>and</strong>ard CM fonts, <strong>and</strong> others that should replace<br />

them al<strong>to</strong>gether. For example, the Cyrillic fonts of Section 12.4.2 should be<br />

added parallel <strong>to</strong> the Latin fonts, but <strong>to</strong> make them operate au<strong>to</strong>matically<br />

under the L AT E X size comm<strong>and</strong>s was a complex procedure. (We know:<br />

we have done it!) Similarly, installing PostScript fonts involved calling<br />

intricate interface macros.<br />

Another problem was the behavior of the font style <strong>and</strong> size comm<strong>and</strong>s.<br />

As explained in Section F.2.1, each of the font declarations \rm,<br />

\bf, \sc, \sl, \it, \sf, <strong>and</strong> \tt activates a particular font in the current<br />

size, overriding the previous declaration. One can select either a bold or<br />

an italic font, but there is no way <strong>to</strong> select a bold, italic one. Furthermore,<br />

selecting a new size au<strong>to</strong>matically switches <strong>to</strong> \rm, an upright, Roman,<br />

medium font. That is, the attributes cannot be selected independently of<br />

each other.<br />

In 1989 Frank Mittelbach <strong>and</strong> Rainer Schöpf proposed a New Font<br />

Selection Scheme (NFSS) for L AT E X <strong>and</strong> a preliminary test package was<br />

ready in early 1990. A second release (NFSS2) was published mid-1993<br />

with many substantial changes. With the official release of L AT E X 2ε in<br />

June 1994, NFSS became firmly entrenched in the new st<strong>and</strong>ard. The new<br />

font declarations <strong>and</strong> comm<strong>and</strong>s are described in Sections 4.1.3 <strong>and</strong> 4.1.4.<br />

Here we explain the usage in more detail; in Section A.3 we describe how<br />

new sets of fonts may be installed.<br />

367


368 Appendix A. The New Font Selection Scheme (NFSS)<br />

A.1 Font attributes under NFSS<br />

According <strong>to</strong> the NFSS scheme, every character set can be classified by<br />

five attributes called encoding, family, series, shape, <strong>and</strong> size, which may<br />

be selected with the comm<strong>and</strong>s<br />

\fontencoding{encode} \fontfamily{fam} \fontseries{wt wth}<br />

\fontshape{form} <strong>and</strong> \fontsize{sz}{line sp}<br />

The encode attribute was new <strong>to</strong> the second release of NFSS. It specifies<br />

the layout of the characters within the font. Possible values for it are listed<br />

in Table A.1. It is unlikely that one would want <strong>to</strong> change encoding within<br />

a document, except <strong>to</strong> activate Cyrillic fonts perhaps. This feature is more<br />

for L AT E X programmers <strong>to</strong> install new fonts on the system.<br />

Table A.1: The NFSS encoding schemes<br />

Encoding Description Sample Font Page<br />

OT1 Original text fonts from Knuth cmr10 492<br />

OT2 Univ. Washing<strong>to</strong>n Cyrillic fonts wncyr10 497<br />

T1 The Cork (DC/EC) fonts ecrm1000 500<br />

OML T E X math letter fonts cmmi10 495<br />

OMS T E X math symbol fonts cmsy10 495<br />

OMX T E X math extended fonts cmex10 496<br />

U Unknown coding — —<br />

The argument fam in \fontfamily denotes a basic set of font properties.<br />

For the Computer Modern fonts, listed in Section G.2.2, all the serif<br />

fonts belong <strong>to</strong> the family cmr. The family cmss includes all the sans<br />

serif fonts while cmtt contains the typewriter fonts. A number of special<br />

decorative fonts are the only members of their families. Table A.3 on<br />

page 370 lists the CM fonts according <strong>to</strong> the family <strong>and</strong> other attributes.<br />

Note: The font attribute family has no relationship <strong>to</strong> the primitive<br />

T E X concept of the same name. A T E X family consists of three fonts of<br />

different sizes for use in math formulas as normal characters, <strong>and</strong> first<strong>and</strong><br />

second-level indices.<br />

The argument wt wth in \fontseries designates the weight (=boldness)<br />

<strong>and</strong> width of the characters. These are specified by 1 <strong>to</strong> 4 letters as<br />

shown in Table A.2 on the opposite page.<br />

The argument for \fontseries{wt wth} consists of the letter or letters<br />

for the weight, followed by those for the width. Thus ebsc indicates<br />

weight extrabold <strong>and</strong> width semicondensed while bx means weight bold<br />

<strong>and</strong> width exp<strong>and</strong>ed. The letter m is omitted when combined with any<br />

non-normal weight or width; if both are <strong>to</strong> be normal, it is sufficient <strong>to</strong><br />

give m alone.


A.1. Font attributes under NFSS 369<br />

Table A.2: The NFSS series attributes<br />

Weight class Width class<br />

Ultralight ul Ultracondensed 50% uc<br />

Extralight el Extracondensed 62.5% ec<br />

Light l Condensed 75% c<br />

Semilight sl Semicondensed 87.5% sc<br />

Medium (normal) m Medium 100% m<br />

Semibold sb Semiexp<strong>and</strong>ed 112.5% sx<br />

Bold b Exp<strong>and</strong>ed 125% x<br />

Extrabold eb Extraexp<strong>and</strong>ed 150% ex<br />

Ultrabold ub Ultraexp<strong>and</strong>ed 200% ux<br />

In \fontshape, the argument form is one of the letter combinations<br />

n, it, sl, or sc for selecting normal (or upright), italic, slanted, or small<br />

caps.<br />

The \fontsize attribute comm<strong>and</strong> takes two arguments, the first sz<br />

being the point size of the font (without the dimension pt explicitly given)<br />

<strong>and</strong> the second line sp being the vertical spacing from one baseline <strong>to</strong> the<br />

next. The second argument becomes the new value of \baselineskip<br />

(Section 3.2.4). For example, \fontsize{12}{15} selects a font size of<br />

12 pt with interline spacing of 15 pt. (The second argument may be given<br />

a dimension, such as 15pt, but pt is assumed if no dimension is stated.)<br />

Once all five attributes have been set, the font itself is selected with<br />

the comm<strong>and</strong> \selectfont. The new feature here is that the various<br />

attributes are independent of one another. Changing one of them does<br />

not alter the others. For example, if the selection<br />

\fontfamily{cmr} \fontseries{bx} \fontshape{n} \fontsize{12}{15}<br />

has been made for an upright, bold, exp<strong>and</strong>ed, Roman font of size 12 pt<br />

<strong>and</strong> interline spacing 15 pt, then when \fontfamily{cmss} is later selected<br />

for a sans serif font, the attributes weight <strong>and</strong> width bx, form n,<br />

<strong>and</strong> size 12(15pt) remain in effect when the next \selectfont is issued.<br />

Alternatively, all attributes but the size may be specified <strong>and</strong> the font<br />

activated immediately with the comm<strong>and</strong><br />

\usefont{code}{family}{series}{shape}<br />

The table on the next page (by F. Mittelbach <strong>and</strong> R. Schöpf) lists the<br />

classification of the Computer Modern character sets according <strong>to</strong> the<br />

attributes \fontfamily, \fontseries, <strong>and</strong> \fontshape. That there are<br />

so many attribute combinations without a corresponding CM font may<br />

appear <strong>to</strong> be a weakness in the NFSS system, but it must be recalled that<br />

it is designed for the future. It may also be employed with the PostScript


370 Appendix A. The New Font Selection Scheme (NFSS)<br />

Table A.3: Attributes of the Computer Modern fonts<br />

Series Shape(s) Examples of external names<br />

Computer Modern Roman — (\fontfamily{cmr})<br />

m n, it, sl, sc, u cmr10, cmti10, cmsl10, cmcsc10,<br />

cmu10<br />

bx n, it, sl cmbx10, cmbxti10, cmbxsl10<br />

b n cmb10<br />

Computer Modern Sans Serif — (\fontfamily{cmss})<br />

m n, sl cmss10, cmssi10<br />

bx n cmssbx10<br />

sbc n cmssdc10<br />

Computer Modern Typewriter — (\fontfamily{cmtt})<br />

m n, it, sl, sc cmtt10, cmitt10, cmsltt10,<br />

cmtcsc10<br />

fonts, which are becoming ever more popular, <strong>to</strong> exploit their complete<br />

variability.<br />

Formally it is possible <strong>to</strong> set any combination of attributes; however,<br />

there may not exist any font matching all the attributes selected. If that is<br />

the case, then when \selectfont is called, L AT E X issues a warning stating<br />

which font has been activated in its place. The font size attribute of<br />

the \fontsize comm<strong>and</strong> may normally take on values of 5, 6, 7, 8, 9,<br />

10, 10.95, 12, 14.4, 17.28, 20.74, <strong>and</strong> 24.88, but other values may also<br />

be added. The second argument, the interline spacing, may take on any<br />

value since it is not something intrinsic <strong>to</strong> the font itself.<br />

With the \begin{document} comm<strong>and</strong>, L AT E X sets the five attributes <strong>to</strong><br />

certain preset default values. These are normally st<strong>and</strong>ard encoding OT1,<br />

family cmr, medium series m, normal shape n, <strong>and</strong> the base size selected.<br />

The user may change these initial values within the preamble, or they<br />

might be set differently by a special option, say when a PostScript font<br />

has been selected.<br />

A.2 Simplified font selection<br />

The attribute comm<strong>and</strong>s \fontencoding, \fontfamily, \fontseries,<br />

\fontshape, <strong>and</strong> \fontsize, <strong>to</strong>gether with the comm<strong>and</strong> \selectfont,<br />

are the basic <strong>to</strong>ols in the New Font Selection Scheme. The user need not


A.2. Simplified font selection 371<br />

employ these comm<strong>and</strong>s directly, but rather may make use of the higherlevel<br />

declarations presented in Sections 4.1.2 <strong>and</strong> 4.1.3. In fact, a font<br />

declaration like \itshape is defined as \fontshape{it}\selectfont.<br />

The high-level comm<strong>and</strong>s <strong>to</strong> select font sizes are:<br />

\tiny (5pt) \normalsize (10pt) \LARGE (17.28pt)<br />

\scriptsize (7pt) \large (12pt) \huge (20.74pt)<br />

\footnotesize (8pt) \Large (14.4pt) \Huge (24.88pt)<br />

\small (9pt)<br />

The sizes listed for the comm<strong>and</strong>s are those when 10pt (the default) has<br />

been selected as the basic size option in the \documentclass comm<strong>and</strong>;<br />

for 11pt <strong>and</strong> 12pt, they will all scale accordingly.<br />

The family declarations <strong>and</strong> their st<strong>and</strong>ard family attribute values are:<br />

\rmfamily (cmr) \sffamily (cmss) \ttfamily (cmtt)<br />

which are the three Computer Modern families, Roman, Sans Serif, <strong>and</strong><br />

Typewriter (Section G.2.2).<br />

The series declarations <strong>and</strong> their initial attribute values are:<br />

\mdseries (m) \bfseries (bx)<br />

meaning that only a medium <strong>and</strong> a bold extended series are provided as<br />

st<strong>and</strong>ard.<br />

Finally, the shape declarations <strong>and</strong> their attribute values are:<br />

\upshape (n) \itshape (it)<br />

\slshape (sl) \scshape (sc)<br />

<strong>to</strong> select upright, slanted, italic, <strong>and</strong> Small Caps.<br />

Note that there are no high-level declarations for the encoding attributes.<br />

This is because there is normally no need <strong>to</strong> change encoding<br />

within a document. An exception might be <strong>to</strong> use Cyrillic fonts (coding<br />

OT2), in which case one could define<br />

\newcomm<strong>and</strong>{\cyr}{\fontencoding{OT2}\selectfont}<br />

\newcomm<strong>and</strong>{\lat}{\fontencoding{OT1}\selectfont}<br />

<strong>to</strong> be able <strong>to</strong> switch back <strong>and</strong> forth more conveniently.<br />

The family, shape, <strong>and</strong> series attributes may be reset <strong>to</strong> their st<strong>and</strong>ard<br />

values at any time with the \normalfont comm<strong>and</strong>, which also activates<br />

that font in the current size.<br />

For each of the above font attribute declarations there is also a corresponding<br />

font comm<strong>and</strong> (Section 4.1.4) that sets its argument in that<br />

font. Thus \textit{text} is almost the same as {\itshape text}, the<br />

only difference being that the comm<strong>and</strong> also contains the italic correction<br />

au<strong>to</strong>matically. The complete list of such comm<strong>and</strong>s is:


372 Appendix A. The New Font Selection Scheme (NFSS)<br />

Family: \textrm \textsf \texttt<br />

Series: \textmd \textbf<br />

Shape: \textup \textit \textsl \textsc<br />

Other: \emph \textnormal<br />

The \emph comm<strong>and</strong> is described in Section 4.1.1; \textnormal sets its<br />

argument in \normalfont.<br />

A.3 Installing fonts with NFSS<br />

In this section, we wish <strong>to</strong> elaborate on the internal workings of NFSS,<br />

showing how a set of attributes are associated with a particular font <strong>and</strong><br />

how special symbols are assigned <strong>to</strong> their proper positions within various<br />

encoding schemes.<br />

A.3.1 Default attribute values<br />

We implied in Section A.2 that the font attribute declarations like \itshape<br />

are defined as \fontshape{it}\selectfont, whereas in fact they make<br />

use of certain default attributes. Thus the true definition of \itshape is<br />

\fontshape{\itdefault}\selectfont<br />

The default comm<strong>and</strong>s available are<br />

Family: \rmdefault \sfdefault \ttdefault<br />

Series: \mddefault \bfdefault<br />

Shape: \updefault \itdefault \sldefault \scdefault<br />

It is \itdefault that is defined <strong>to</strong> be the attribute it.<br />

It is also necessary <strong>to</strong> define the st<strong>and</strong>ard attributes chosen when<br />

the comm<strong>and</strong> \normalfont is issued. These are contained in the four<br />

defaults<br />

\encodingdefault \familydefault \seriesdefault<br />

\shapedefault<br />

All this may sound like a complicated route linking the high-level<br />

comm<strong>and</strong>s <strong>to</strong> a particular font. However, it does provide flexibility <strong>and</strong><br />

modularity. The author only needs <strong>to</strong> know that three families, two series,<br />

<strong>and</strong> four shapes are available, <strong>and</strong> does not care what they really are. A<br />

programmer defines these with the defaults at a lower level.<br />

An example of how all the st<strong>and</strong>ard fonts may be replaced by PostScript<br />

ones, by simply redefining the three family defaults, is shown on page 379.<br />

Such redefinitions are much simpler than trying <strong>to</strong> alter the font declarations<br />

themselves, including \normalfont. Those definitions are in fact<br />

much more complex than implied here, whereas the default comm<strong>and</strong>s<br />

really are as simple as indicated.


A.3.2 Defining font comm<strong>and</strong>s<br />

A.3. Installing fonts with NFSS 373<br />

There are a number of comm<strong>and</strong>s available for defining new font declarations<br />

! <strong>and</strong> comm<strong>and</strong>s. These are intended mainly for L AT E X package programmers but<br />

may be used in a normal document as well.<br />

\DeclareFixedFont{\cmd}{code}{family}{series}{shape}{size}<br />

defines \cmd <strong>to</strong> be a declaration that selects the font of the specified attributes.<br />

It is rigidly fixed in all attributes. This is equivalent <strong>to</strong> \newfont except that the<br />

font is determined by attributes <strong>and</strong> not by name.<br />

\DeclareTextFontComm<strong>and</strong>{\cmd}{font specs}<br />

defines \cmd <strong>to</strong> be a font comm<strong>and</strong> that sets its argument according <strong>to</strong> font specs.<br />

This comm<strong>and</strong> is used internally <strong>to</strong> define all the font comm<strong>and</strong>s like \textbf,<br />

which is defined with font specs as \bfseries.<br />

\DeclareOldFontComm<strong>and</strong>{\cmd}{text specs}{math specs}<br />

defines \cmd <strong>to</strong> be a font declaration that may be used in math mode in the<br />

manner of L AT E X 2.09: as a declaration, not a comm<strong>and</strong>. It is useful for defining<br />

comm<strong>and</strong>s <strong>to</strong> be compatible with the old version, but should be avoided. For<br />

example, \it is defined with<br />

\DeclareOldFontComm<strong>and</strong>{\it}{\normalfont\itshape}{\mathit}<br />

A.3.3 Mathematical alphabets<br />

The font that has been activated for text processing does not influence<br />

the characters <strong>and</strong> their fonts in math mode, since special mathematical<br />

symbol fonts are used for this purpose. If a formula is <strong>to</strong> appear in<br />

bold face, the comm<strong>and</strong> \boldmath (Section 5.4.9) must be issued, which<br />

remains in effect until it is counterm<strong>and</strong>ed by \unboldmath. Both of<br />

these declarations must be made outside of math mode.<br />

These comm<strong>and</strong>s may still be employed in the same way under NFSS.<br />

However, the internal math font selection comm<strong>and</strong> is<br />

\mathversion{vers name}<br />

in which the argument vers name currently takes on values normal <strong>and</strong><br />

bold. The declarations \unboldmath <strong>and</strong> \boldmath are defined in terms<br />

of this comm<strong>and</strong>. It is planned that special package files will become<br />

available <strong>to</strong> allow additional sets of math symbols.<br />

On the other h<strong>and</strong>, mathematical alphabet comm<strong>and</strong>s may be issued<br />

within math mode itself, <strong>to</strong> set letters as symbols in particular fonts<br />

(Section 5.4.2):<br />

\mathrm \mathcal \mathnormal \mathbf \mathsf \mathit \mathtt<br />

These are all comm<strong>and</strong>s operating on arguments rather than declarations,<br />

unlike the L AT E X 2.09 equivalents.<br />

New math font alphabets may be defined by the user. For example, <strong>to</strong><br />

define a slanted math font \mathsl, give


374 Appendix A. The New Font Selection Scheme (NFSS)<br />

\DeclareMathAlphabet{\mathsl}{OT1}{cmr}{m}{sl}<br />

which means that the new math font comm<strong>and</strong> \mathsl selects that font<br />

in family cmr with weight m <strong>and</strong> shape sl, which, with the normal font<br />

definitions, is font cmsl in the appropriate size. However, this font will<br />

be selected in all math versions, whereas it would be more suitable if a<br />

bold font were selected when \mathversion{bold} is in effect. This is<br />

accomplished by adding <strong>to</strong> the definition of \mathsl<br />

\SetMathAlphabet{\mathsl}{bold}{OT1}{cmr}{bx}{sl}<br />

which redefines \mathsl exceptionally for math version bold <strong>to</strong> be a font<br />

with weight bx. For the normal font definitions, this is cmbxsl in the<br />

current size.<br />

New math versions can be created with<br />

\DeclareMathVersion{vers name}<br />

<strong>and</strong> the fonts belonging <strong>to</strong> it are determined by issuing \Set... comm<strong>and</strong>s<br />

for each math alphabet or symbol font.<br />

A.3.4 Mathematical symbol fonts<br />

Mathematical symbols must be defined in a <strong>to</strong>tally different manner from text<br />

! characters: they bear a comm<strong>and</strong> name (like \alpha), may come from various<br />

fonts, behave differently depending on type, <strong>and</strong> can appear in different sizes.<br />

Under L AT E X 2.09, the symbol names were fixed <strong>to</strong> the Computer Modern math<br />

fonts, but NFSS offers more flexibility for additional (or replacement) symbol<br />

fonts.<br />

A symbol font name is declared with the comm<strong>and</strong><br />

\DeclareSymbolFont{sym fnt name}{code}{family}{series}{shape}<br />

which associates the name sym fnt name with the given set of attributes. This<br />

name is not a comm<strong>and</strong>, but rather an internal designation for use in defining<br />

symbols. The selected font is valid for all versions, but if a different font is <strong>to</strong> be<br />

associated with the same name under other versions,<br />

\SetSymbolFont{sym fnt name}{version}{code}{family}{series}{shape}<br />

may be used <strong>to</strong> redefine sym fnt name for that one version.<br />

The st<strong>and</strong>ard L AT E X setup declares<br />

\DeclareSymbolFont{opera<strong>to</strong>rs}{OT1}{cmr}{m}{n}<br />

\DeclareSymbolFont{letters}{OML}{cmm}{m}{it}<br />

\DeclareSymbolFont{symbols}{OMS}{cmsy}{m}{n}<br />

\DeclareSymbolFont{largesymbols}{OMX}{cmex}{m}{n}<br />

the sequence of which is important for reasons that are built deeply in<strong>to</strong> T E X<br />

itself.<br />

Once the symbol font names have been defined, they may be used <strong>to</strong> construct<br />

math alphabets <strong>and</strong> various types of symbols.


A.3. Installing fonts with NFSS 375<br />

\DeclareSymbolFontAlphabet{\math alph}{sym fnt name}<br />

defines \math alph <strong>to</strong> be a math alphabet based on the font with the internal name<br />

sym fnt name. This comm<strong>and</strong> is <strong>to</strong> be preferred over \DeclareMathAlphabet if<br />

a symbol font exists with the proper attributes for the math alphabet.<br />

The primary comm<strong>and</strong> for defining symbols is<br />

\DeclareMathSymbol{\symbol}{type}{sym fnt name}{pos}<br />

which makes \symbol print the symbol in position pos of font sym fnt name. The<br />

pos is a number, in decimal (10), octal (’12) or hexadecimal ("0A) representation.<br />

The type specifies the functionality of the symbol <strong>and</strong> is one of<br />

\mathord an ordinary symbol<br />

\mathop a large opera<strong>to</strong>r like <br />

\mathbin a binary opera<strong>to</strong>r like ×<br />

\mathrel a relational opera<strong>to</strong>r like ≥<br />

\mathopen an opening bracket like {<br />

\mathclose a closing bracket like }<br />

\mathpunct punctuation<br />

\mathalpha an alphabetic character<br />

Math alphabet comm<strong>and</strong>s operate only on the symbols of type \mathalpha;<br />

other types always produce the same symbol, for a given math version, within all<br />

math alphabets.<br />

Similarly, math accent comm<strong>and</strong>s are established with<br />

\DeclareMathAccent{\cmd}{type}{sym fnt name}{pos}<br />

where type is either \mathord or \mathalpha; in the latter case, the symbol<br />

changes with the math alphabet.<br />

Math delimiters <strong>and</strong> radicals can appear in two different sizes. They are set<br />

up with<br />

\DeclareMathDelimiter{\cmd}{type}{sym fnt1}{pos1}{sym fnt2}{pos2}<br />

\DeclareMathRadical {\cmd} {sym fnt1}{pos1}{sym fnt2}{pos2}<br />

which define \cmd <strong>to</strong> print the smaller variant from position pos1 of font sym fnt1<br />

<strong>and</strong> the larger from position pos2 of sym fnt2.<br />

The sizes have not been specified in any of the above math declarations. This<br />

is because there are normally four different sizes available, depending on the<br />

math style, as explained in Section 5.5.2. However, these sizes must somehow be<br />

specified. This is done with<br />

\DeclareMathSizes{text}{math text}{script}{sscript}<br />

where the four arguments are numbers giving a point size. When the normal<br />

text font is size text pt, \textstyle will be in math text size, \scriptstyle in<br />

script, <strong>and</strong> \scriptscriptstyle in sscript size. For example,<br />

\DeclareMathSizes{10}{10}{7}{5}<br />

All the \Declare... <strong>and</strong> \Set... comm<strong>and</strong>s may only be called in the<br />

preamble.


376 Appendix A. The New Font Selection Scheme (NFSS)<br />

A.3.5 Addressing the attribute values<br />

In some programming situations, it is necessary <strong>to</strong> make use of the current values<br />

! of the attributes without knowing what they are. These are s<strong>to</strong>red in the internal<br />

comm<strong>and</strong>s<br />

\f@encoding \f@shape \tf@size<br />

\f@family \f@size \sf@size<br />

\f@series \f@baselineskip \ssf@size<br />

The values of these comm<strong>and</strong>s should never be changed directly. However, they<br />

may be used <strong>to</strong> test if they possess a certain value. Since they all contain the<br />

character @ in their names, they may only be used in class or package files, <strong>and</strong><br />

not in the main document file.<br />

A.3.6 Defining fonts under NFSS<br />

Under NFSS, fonts are specified within a document by giving the attributes<br />

required <strong>and</strong> then calling \selectfont. How is the set of font attributes<br />

then associated with a particular external font name such as those found<br />

in Appendix G? This is done by means of font definition comm<strong>and</strong>s which<br />

are usually s<strong>to</strong>red in files with extensions.def <strong>and</strong>.fd.<br />

First the declaration<br />

\DeclareFontEncoding{code}{text set}{math set}<br />

sets up a new encoding attribute named code; whenever a text font of<br />

this encoding is selected, text set is executed in order <strong>to</strong> redefine accent<br />

comm<strong>and</strong>s or other things that are coding dependent; similarly math set<br />

is called for every math alphabet of this encoding. It is possible <strong>to</strong> define<br />

default text set <strong>and</strong> math set with<br />

\DeclareFontEncodingDefaults{text set}{math set}<br />

This allows general text <strong>and</strong> math mode settings <strong>to</strong> be declared with this<br />

comm<strong>and</strong>, while more specialized ones, which are executed afterwards,<br />

appear in \DeclareFontEncoding.<br />

If no font can be found for the specified attributes,<br />

\DeclareFontSubstitution{code}{family}{series}{shape}<br />

declares the values of the attributes that should be substituted; substitutions<br />

are made in order of shape, series, then family; the encoding is<br />

never substituted. If even this fails <strong>to</strong> find a valid font, then<br />

\DeclareErrorFont{code}{family}{series}{shape}{size}<br />

determines which font is <strong>to</strong> be used as a last resort.<br />

A new family with a specified encoding scheme is established with<br />

\DeclareFontFamily{code}{family}{option}


A.3. Installing fonts with NFSS 377<br />

where option is a set of comm<strong>and</strong>s that may be executed every time a font<br />

of this family <strong>and</strong> encoding is selected.<br />

The main font-defining declaration that associates external font names<br />

with font attributes is<br />

\DeclareFontShape{code}{family}{series}{shape}<br />

{font def }{option}<br />

where option is additional comm<strong>and</strong>s that are executed when one of these<br />

fonts is selected.<br />

The font def contains a series of size/font associations, each consisting<br />

of a size part, a function, an optional argument, <strong>and</strong> a font argument.<br />

For example,<br />

\DeclareFontShape{OT1}{cmr}{m}{n}<br />

{ gen * cmr<br />

cmr10<br />

cmr12<br />

cmr17}{}<br />

states that the medium series, normal shape members of the cmr family<br />

are <strong>to</strong> be represented by external fonts cmr5 . . . cmr12 for sizes 5–12 pt,<br />

by cmr10 scaled <strong>to</strong> 10.95 pt for sizes near 11 pt, <strong>and</strong> so on. If the specified<br />

size is not present, the nearest size within certain limits is taken instead.<br />

The size part consists of numbers in angle brackets, representing point<br />

sizes. The brackets may also contain ranges, as means all sizes<br />

up <strong>to</strong>, but excluding, 10 pt, means 10 pt <strong>to</strong> less than 14 pt, <strong>and</strong><br />

indicates 24 pt <strong>and</strong> higher. The possible functions are:<br />

(empty) loads the named font scaled <strong>to</strong> the requested point size; if an<br />

optional argument in square brackets precedes the font name, it<br />

acts as an additional scaling fac<strong>to</strong>r;<br />

[.95] cmr10 would load cmr10 scaled <strong>to</strong> 95% of 11 pt;<br />

gen * generates the font name by appending the point size <strong>to</strong> the font<br />

argument;<br />

gen * cmr loads cmr12;<br />

genb * generates the font name by appending the point size times 100<br />

<strong>to</strong> the font argument (for DC <strong>and</strong> EC fonts, page 501);<br />

genb * ecss loads ecss1440;<br />

sub * substitutes a different font whose attributes are given in the font<br />

argument as fam/ser/shp;<br />

sub * cmtt/m/n this is best used when there is no font<br />

of the required attributes; a message is output <strong>to</strong> the moni<strong>to</strong>r <strong>and</strong><br />

<strong>to</strong> the transcript file;


378 Appendix A. The New Font Selection Scheme (NFSS)<br />

subf * is like the empty function, but issues a warning that an explicit<br />

substitute font has been loaded;<br />

fixed * loads the specified font at its normal size, ignoring the size part;<br />

if an optional argument is given, it is the point size <strong>to</strong> which the font<br />

is scaled, as in<br />

fixed * [11] cmr12 which loads cmr12 at 11 pt when<br />

10 pt is requested.<br />

All the above functions may be preceded by an s <strong>to</strong> suppress messages<br />

<strong>to</strong> the moni<strong>to</strong>r. Thus silent sub * is ssub *, <strong>and</strong> silent empty is s *.<br />

As another example, consider the definition of bold, italic, typewriter,<br />

for which there is no font in the Computer Modern collection:<br />

\DeclareFontShape{OT1}{cmtt}{bx}{it}{<br />

ssub * cmtt/m/it }{}<br />

This substitutes (silently) for all sizes () the medium italic typewriter<br />

attributes. Which fonts those are is determined by a \DeclareFontShape<br />

comm<strong>and</strong> with those attributes.<br />

The font definition comm<strong>and</strong>s may be issued in a package file, or even<br />

in the document itself. However, the normal procedure is <strong>to</strong> s<strong>to</strong>re each of<br />

the \DeclareFontEncoding comm<strong>and</strong>s in a file named codeenc.def (for<br />

example, ot1enc.def for the OT1 encoding), <strong>and</strong> <strong>to</strong> place the comm<strong>and</strong>s<br />

\DeclareFontFamily <strong>and</strong> \DeclareFontShape in a file whose name<br />

consists of the encoding <strong>and</strong> family designations plus the extension.fd.<br />

For example, the shape specifications for encoding OT1 <strong>and</strong> family cmr are<br />

<strong>to</strong> be found in ot1cmr.fd. When a coding <strong>and</strong> family combination that is<br />

not already defined is selected, LAT EX tries <strong>to</strong> find the appropriate.fd file<br />

for input. It is therefore not necessary <strong>to</strong> input such files explicitly, for<br />

they are loaded au<strong>to</strong>matically as required.<br />

Package: However, it is important that the encoding be declared beforeh<strong>and</strong>. If<br />

fontenc it is not already known in the current format, \DeclareFontEncoding<br />

must be issued, either explicitly, or by loading the codeenc.def file. One<br />

way <strong>to</strong> do this is <strong>to</strong> invoke the st<strong>and</strong>ard package fontenc, as for example<br />

\usepackage[OT2,T1]{fontenc}<br />

where the desired codings are listed as options in square brackets, the<br />

last of which is made current.<br />

The normal user will never need <strong>to</strong> worry about such problems. However,<br />

L AT E X programmers will find things considerably easier for them.<br />

For example, <strong>to</strong> install PostScript fonts under NFSS is almost trivial. The<br />

common PostScript fonts are already defined as separate families in .fd<br />

files of their own; for example, ot1ptm.fd associates PostScript Times<br />

fonts <strong>to</strong> a family named ptm. A package <strong>to</strong> activate these fonts is supplied<br />

under the name times.sty containing essentially the lines


\renewcomm<strong>and</strong>{\rmdefault}{ptm}<br />

\renewcomm<strong>and</strong>{\sfdefault}{phv}<br />

\renewcomm<strong>and</strong>{\ttdefault}{pcr}<br />

\renewcomm<strong>and</strong>{\bfdefault}{b}<br />

A.3. Installing fonts with NFSS 379<br />

This makes Times ptm the default Roman family, invoked with the comm<strong>and</strong><br />

\rmfamily, Helvetica phv the default sans serif family (called by<br />

\sffamily), <strong>and</strong> Courier pcr the default typewriter family (activated by<br />

\ttfamily). The default attribute for bold face is defined <strong>to</strong> be b instead<br />

of the regular bx, since bold extended is not provided by these fonts.<br />

Another two examples of the usefulness of NFSS are the Cyrillic fonts<br />

of the University of Washing<strong>to</strong>n (Section 12.4.2) <strong>and</strong> the extended EC fonts<br />

with the Cork encoding (Section G.4.3). Both of these may be activated<br />

within a document simply by selecting another encoding, OT2 for Cyrillic,<br />

T1 for the EC fonts. (These encodings must first be declared, for example<br />

with the fontenc package as illustrated on the facing page.)<br />

A.3.7 Encoding comm<strong>and</strong>s<br />

In L AT E X, special characters <strong>and</strong> accents are addressed by means of comm<strong>and</strong>s,<br />

! such as \O <strong>to</strong> print the Sc<strong>and</strong>inavian letter Ø. The position of this character in<br />

the font tables depends on the encoding (character 31 in OT1 <strong>and</strong> 216 in T1), so<br />

that it is necessary <strong>to</strong> redefine all such symbol comm<strong>and</strong>s when the encoding is<br />

altered. This is carried out with the help of certain encoding comm<strong>and</strong>s, which<br />

normally appear in the codeenc.def file along with the \DeclareFontEncoding<br />

comm<strong>and</strong>.<br />

To define a comm<strong>and</strong> that functions differently in the various encodings,<br />

\ProvideTextComm<strong>and</strong>{\cmd}{code}[narg][opt]{def }<br />

\DeclareTextComm<strong>and</strong>{\cmd}{code}[narg][opt]{def }<br />

are available <strong>and</strong> behave just like \providecomm<strong>and</strong> <strong>and</strong> \newcomm<strong>and</strong> except<br />

\cmd has the definition def only when the encoding code is active. Thus \cmd<br />

may have different definitions for each encoding.<br />

\DeclareTextSymbol{\cmd}{code}{pos}<br />

defines \cmd <strong>to</strong> print the character in the font position pos when encoding code<br />

is active.<br />

\DeclareTextAccent{\cmd}{code}{pos}<br />

defines \cmd <strong>to</strong> be an accent comm<strong>and</strong>, using the character in font position pos<br />

as the accent symbol, when encoding code is active.<br />

\DeclareTextComposite{\cmd}{code}{letter}{pos}<br />

\DeclareTextCompositeComm<strong>and</strong>{\cmd}{code}{letter}{def }<br />

define the action of comm<strong>and</strong> \cmd followed by the single letter either <strong>to</strong> print the<br />

character in font position pos or <strong>to</strong> execute the definition def. These declarations<br />

are most useful with the T1 encoding, where many accented letters are separate


380 Appendix A. The New Font Selection Scheme (NFSS)<br />

symbols on their own (Section G.4.3). Thus \’{e} in OT1 prints an acute accent<br />

(character 19) over the letter e, while in T1, it prints the single character in<br />

position 233. This behavior is achieved with<br />

\DeclareTextAccent{\’}{OT1}{19}<br />

\DeclareTextComposite{\’}{T1}{e}{233}<br />

The comm<strong>and</strong> must already have been defined for the encoding, either with<br />

\DeclareTextAccent or with \DeclareTextComm<strong>and</strong>; in the latter case, it must<br />

be defined <strong>to</strong> take a single argument.<br />

All of the above definition comm<strong>and</strong>s create new comm<strong>and</strong>s for a specific<br />

encoding. If the defined comm<strong>and</strong>s are invoked in some other encoding, an<br />

error message is issued. Default definitions may be provided for all unspecified<br />

encodings with<br />

\DeclareTextComm<strong>and</strong>Default{\cmd}[narg][opt]{def }<br />

\ProvideTextComm<strong>and</strong>Default{\cmd}[narg][opt]{def }<br />

\DeclareTextAccentDefault{\cmd}{code}<br />

\DeclareTextSymbolDefault{\cmd}{code}<br />

where the first two create a default definition that applies <strong>to</strong> all unspecified<br />

encodings, while the second two declare which encoding is <strong>to</strong> be taken as the<br />

default.


B<br />

The LAT E X Clockwork<br />

In this appendix, we describe how the T E X program <strong>and</strong> L AT E X files are<br />

installed, how they are organized, what their roles are. Throughout this<br />

book we have given examples of contributed packages, but here we list<br />

those packages <strong>and</strong> other files that belong <strong>to</strong> the ‘kernel’, the essential<br />

installation. In Section B.6, we explain how L AT E X ticks, what happens<br />

during a processing run, <strong>and</strong> what all the various file types mean.<br />

B.1 Installing L AT E X<br />

We explain first L AT E X installations in general before looking at the particular<br />

one provided on the enclosed T E XLive CD.<br />

B.1.1 T E X implementations<br />

One must have the T E X program <strong>and</strong> its auxiliaries (METAFONT, font files)<br />

before L AT E X can be set up on <strong>to</strong>p of it. Installing T E X is a somewhat<br />

daunting experience, but thankfully it need not be done very often <strong>and</strong><br />

there are many ready-<strong>to</strong>-run implementations available for practically<br />

every computer operating system. These can be obtained from CTAN<br />

under the direc<strong>to</strong>ry systems (Figure B.4 on page 390) or from the T E X<br />

Users Group (www.tug.org).<br />

The system delivered with the T E XLive CD is that developed by Karl<br />

Berry known generically as Web2c. This name derives from the fact that it<br />

converts Donald Knuth’s original T E X source files from his Web language<br />

(no relation <strong>to</strong> the World Wide Web) in<strong>to</strong> the C programming language for<br />

subsequent compilation with a C compiler. The teT E X implementation, by<br />

Thomas Esser, applies Web2c <strong>to</strong> Unix machines, while Fabrice Popineau’s<br />

fpT E X is the Win32 (Windows 95, 98, NT, 2000, XP) version.<br />

Another excellent T E X implementation for Windows is MikT E X by Christian<br />

Schenk, available from CTAN under systems/win32/miktex/.<br />

381


382 Appendix B. The L AT E X Clockwork<br />

The implementation for DOS, emT E X by Eberhardt Mattes is still available<br />

from CTAN, but is no longer appropriate for modern PCs. We used<br />

<strong>to</strong> produce the first two editions of this book <strong>and</strong> found it superb for its<br />

time.<br />

Commercial packages for T E X also exist, offering graphics display of<br />

the output while you type: for Windows (Y&Y Inc., www.Y<strong>and</strong>Y.com/) <strong>and</strong><br />

Textures for Macin<strong>to</strong>sh (Blue Sky Research, www.bluesky.com/). A ‘whatyou-see-is-what-you-get’<br />

T E X system is Scientific Workplace, which can be<br />

purchased from MacKichan Software Research (www.tcisoft.com/).<br />

It should be stressed that the T E X <strong>and</strong> pdfT E X programs in all the<br />

above implementations are identical (for the same version number). They<br />

provide ready-<strong>to</strong>-run executable programs from the same source code,<br />

which are necessarily different for different computer types. There are<br />

also minor variations as <strong>to</strong> how the programs are run.<br />

The L AT E X files are all ascii so they are fully compatible with all systems.<br />

One uses the already installed T E X or pdfT E X program <strong>to</strong> generate the L AT E X<br />

formats (Section B.1.3). Even this task is normally done for you by the<br />

above implementations.<br />

A graphics interface <strong>to</strong> T E X <strong>and</strong> L AT E X is not absolutely essential, but<br />

<strong>to</strong>day it is almost unthinkable <strong>to</strong> do without one. This is an edi<strong>to</strong>r program<br />

for writing <strong>and</strong> managing the L AT E X source files, <strong>and</strong> calling the various<br />

programs (L AT E X, BIBT E X, MakeIndex) <strong>and</strong> invoking viewers by clicking icons.<br />

For Unix, the emacs is normally used for this; for Windows, the two edi<strong>to</strong>r<br />

programs mentioned in Section 1.6.2, Winshell <strong>and</strong> WinEdt can be highly<br />

recommended.<br />

B.1.2 The T E XLive CD<br />

The T E X Users Group, TUG issues a set of CDs each year <strong>to</strong> its members<br />

containing the latest T E X <strong>and</strong> L AT E X installations, with executable files for<br />

Win32, Linux, Macin<strong>to</strong>sh, <strong>and</strong> all known flavors of Unix. As of the 7th issue<br />

in 2002, it was necessary <strong>to</strong> split the contents over 2 CDs, separating the<br />

Unix versions from the others. Each CD is otherwise complete, missing<br />

only the executables of the other one.<br />

The T E XLive CDs are maintained by Sebastian Rahtz who has kindly<br />

agreed <strong>to</strong> allow the CD for Windows, Linux, Mackin<strong>to</strong>sh <strong>to</strong> be included with<br />

this book, as it st<strong>and</strong>s in June 2003. It thus corresponds <strong>to</strong> something<br />

between the 7th <strong>and</strong> 8th regular issues.<br />

The startup window in Figure B.1 appears when the CD is inserted in<strong>to</strong><br />

your computer. If the au<strong>to</strong>run function does not work, you can run the<br />

au<strong>to</strong>run.exe program directly from the CD.<br />

You then proceed with the installation by clicking Install on the upper<br />

bar. You then follow the instructions on the various pages that then<br />

appear, making selections as you go. One choice is whether <strong>to</strong> install<br />

<strong>to</strong> run from the CD, or <strong>to</strong> install <strong>to</strong> the hard disk. In the former case,


Figure B.1: The T E XLive welcome<br />

B.1. Installing L AT E X 383<br />

you have the entire installation available with little lost of s<strong>to</strong>rage, but<br />

will need <strong>to</strong> have the CD mounted in the player whenever you run L AT E X.<br />

Processing time will also be slower.<br />

If you elect <strong>to</strong> install only part of the system <strong>to</strong> hard disk, you may still<br />

add further packages <strong>and</strong> support programs later by clicking maintenance.<br />

Or you may run texsetup --maintenance which does the same thing<br />

bypassing the Welcome window. Running texsetup --help produces a<br />

list of all the options.<br />

You may also click Documentation→View TexLive doc <strong>to</strong> open the<br />

instruction manual for T E XLive, with details for all systems. (Or you<br />

can go directly <strong>to</strong> \texmf\doc\tldoc\english\ <strong>and</strong> select live.pdf or<br />

live.html.)<br />

Documentation for most of the packages <strong>and</strong> collections are available<br />

on the CD under \texmf\doc\..., if the author has provided a description.<br />

We often refer <strong>to</strong> such manuals throughout this book, indicating<br />

more precisely where they are <strong>to</strong> be found. By clicking Documentation→Run<br />

TeXDocTK, you may open a documentation browser (Figure B.2)<br />

<strong>to</strong> assist finding descriptions for any module.<br />

The T E XLive installation program will do all the housekeeping for you,


384 Appendix B. The L AT E X Clockwork<br />

Figure B.2: The T E XLive documentation browser<br />

placing files in the right direc<strong>to</strong>ries, setting up font mapping files, <strong>and</strong><br />

generating the formats. However, there might still be times when you<br />

want or have <strong>to</strong> do some of this yourself. This we explain in the next<br />

sections.<br />

B.1.3 Making the L AT E X format<br />

Adding or updating L AT E X on <strong>to</strong> an existing T E X installation by h<strong>and</strong> is<br />

relatively straight forward. One must obtain the source files, which<br />

on T E XLive are located at \texmf\source\latex\base\ or on CTAN<br />

at tex-archive/macros/latex/base/. At CTAN, instruction files with<br />

extension .txt are available for the various implementations, such as<br />

miktex.txt <strong>and</strong> web2ctex.txt, as well as the general instruction file<br />

install.txt.<br />

These source files are a set of packed files consisting of a large number<br />

of .dtx files, the integrated source <strong>and</strong> documentation files. These are<br />

unpacked by running initex on the batch job file unpack.ins. This<br />

generates the necessary.cls,.sty,.clo, <strong>and</strong> other files. It also constructs<br />

the fundamental file latex.ltx which is needed <strong>to</strong> produce the format<br />

file. On CTAN, the unpacked files are already provided in a parallel<br />

direc<strong>to</strong>ry unpacked.<br />

The next step should be <strong>to</strong> run initex on the latex.ltx file <strong>to</strong> produce<br />

the L AT E X format latex. However, before doing that, there are a number<br />

of configuration aspects <strong>to</strong> be considered. At several points during the<br />

processing, certain files are read in, but if a file of the same name but<br />

extension .cfg exists, it is loaded instead. It is this device that permits<br />

one <strong>to</strong> configure the final format for local conditions or desires. The<br />

possible configuration files are:<br />

texsys.cfg offers the possibility of adding some very machine-specific<br />

adjustments for older versions of T E X or for some peculiarities of<br />

the T E X installation; information is <strong>to</strong> be found in the specific .txt<br />

file, or in ltdirchk.dtx;


B.1. Installing L AT E X 385<br />

fonttext.cfg is loaded in place of fonttext.ltx if it is present; this<br />

defines the fonts that are <strong>to</strong> be available for processing text; details<br />

can be found in fontdef.dtx;<br />

fontmath.cfg is loaded in place of fontmath.ltx if it is present; this is<br />

the equivalent of fonttext.cfg for math fonts;<br />

preload.cfg is loaded in place of preload.ltx if it is present; this<br />

determines which fonts are preloaded in<strong>to</strong> the format; a number of<br />

other preload files may be extracted from preload.dtx, any one<br />

of which may be renamed <strong>to</strong>.cfg <strong>to</strong> be implemented;<br />

hyphen.cfg is loaded in place of hyphen.ltx if it is present; this specifies<br />

the hyphenation patterns <strong>and</strong> their assignments; by default,<br />

the patterns in hyphen.tex are loaded in<strong>to</strong> language 0; the babel<br />

system provides such a configuration file (Section 11.1) which must<br />

be used if babel is <strong>to</strong> be incorporated in<strong>to</strong> the format, in which case,<br />

language.dat must be tailored <strong>to</strong> local requirements.<br />

The only configuration file that you are likely <strong>to</strong> want <strong>to</strong> change is<br />

hyphen.cfg, especially if you are going <strong>to</strong> be using L AT E X for languages<br />

other than American English.<br />

Once any configuration files have been set up <strong>and</strong> located where T E X<br />

can read them, initex may be run on latex.ltx with<br />

initex latex.ltx or<br />

tex -ini latex.ltx<br />

The resulting latex.fmt must be placed where format files are read.<br />

For fpT E X as installed by T E XLive, this is in texmf-var\web2c\. Other<br />

unpacked files must be moved <strong>to</strong> texmf\tex\latex\base\; these are<br />

latexbug.tex, testpage.tex, lablst.tex, idx.tex, nfssfont.tex,<br />

small2e.tex, sample2e.tex, <strong>and</strong> docstrip.tex,<br />

<strong>and</strong> all files with extensions.cls,.clo,.sty,.fd,.def, <strong>and</strong>.cfg.<br />

Files with extension.ist are moved <strong>to</strong> texmf\makeindex\base\.<br />

To make up the L AT E X format with pdfT E X, run instead<br />

pdfinitex -fmt=pdflatex latex.ltx or<br />

pdftex -ini -fmt=pdflatex latex.ltx<br />

This processes latex.ltx base file once more, but names the resulting<br />

format file pdflatex.fmt rather than latex.fmt. This is necessary<br />

because the format files may only be used with the program that generated<br />

them, so the two must be distinguished even though they both<br />

are essentially the same thing. Move this format <strong>to</strong>o <strong>to</strong> the format file<br />

direc<strong>to</strong>ry.<br />

The actual comm<strong>and</strong>s <strong>to</strong> invoke T E X or pdfT E X with L AT E X (what we<br />

normally call ‘running L AT E X or pdfL AT E X’) are


386 Appendix B. The L AT E X Clockwork<br />

tex &latex<br />

pdftex &pdflatex<br />

meaning ‘run the T E X or pdfT E X program with the specified format file’.<br />

The system should have shortcuts named latex <strong>and</strong> pdflatex that translate<br />

<strong>to</strong> the above.<br />

The web2c system, for which fpT E X is the Win32 implementation, has<br />

a different method. It s<strong>to</strong>res all the necessary configuration information<br />

in a file named texmf.cnf located in the texmf\web2c direc<strong>to</strong>ry.<br />

This sets up environments according <strong>to</strong> the name of the program being<br />

run, <strong>and</strong> in particular, adds the format name au<strong>to</strong>matically for a T E X-like<br />

program. Thus a T E X program named latex will use the latex.fmt format<br />

file if none is specified. However, there is no real program named<br />

latex, so on Unix systems, an alias with this name is established <strong>to</strong><br />

point <strong>to</strong> the tex executable program. On Win32, the actual T E X executable<br />

code is in a dynamic link library tex.dll <strong>and</strong> very small files named<br />

tex.exe, latex.exe exist <strong>to</strong> use this one library. These .exe files are<br />

in fact identical, <strong>and</strong> are really only there <strong>to</strong> ensure that different formats<br />

are invoked au<strong>to</strong>matically when they are called. Similarly, there are<br />

pdftex.dll, pdftex.exe, <strong>and</strong> pdflatex.exe. If any additional formats<br />

are ever needed for these programs, one only needs <strong>to</strong> copy one of these<br />

.exe files <strong>to</strong> the new name.<br />

B.1.4 Updating the database<br />

T E X works with a very large number of files, for classes, packages, fonts,<br />

formats, <strong>and</strong> so on. A set of environments are used <strong>to</strong> indicate where the<br />

program should search for these files. With web2c, these are all defined<br />

in the texmf.cnf configuration file mentioned above. The user normally<br />

does not have <strong>to</strong> worry about this. However, <strong>to</strong> speed up the search,<br />

a database is prepared giving the exact location of all the files in the<br />

search paths. This database will be created <strong>and</strong> updated au<strong>to</strong>matically if<br />

installation programs are used, such as that for T E XLive.<br />

If the user should add a new package or fonts collection by h<strong>and</strong>,<br />

without going through an installation program, it will be necessary <strong>to</strong><br />

update this database. Under web2c (<strong>and</strong> fpT E X), this is carried out with<br />

the comm<strong>and</strong><br />

mktexlsr<br />

Under MikT E X, one must run<br />

configure --update-fndb<br />

or click ‘refresh now’ in the MikT E X options program.<br />

It is not necessary <strong>to</strong> update the database if existing files are being<br />

replaced. It is only the names <strong>and</strong> locations of the files that go in<strong>to</strong> the<br />

database, not their actual versions or sizes.


B.2 Obtaining the Adobe euro fonts<br />

B.3. T E X direc<strong>to</strong>ry structure 387<br />

As pointed out in Section 2.5.8, the type 1 euro currency symbol fonts<br />

from Adobe Systems Inc. that are used with the europs <strong>and</strong> eurosans<br />

packages cannot be distributed on CDs like T E XLive, nor on CTAN, since<br />

Adobe reserves the exclusive right <strong>to</strong> distribution, even though free of<br />

charge. T E XLive <strong>and</strong> CTAN do provide all other files needed, like the font<br />

metric.tfm <strong>and</strong> font definition.fd files.<br />

You can obtain the Adobe euro.pfb files from www.adobe.com/type/<br />

eurofont.html, downloading the appropriate file for your computer type.<br />

They must be unpacked (on Windows, for example, you just execute the<br />

downloaded eurofont.exe) <strong>and</strong> then rename them as follows:<br />

Windows PostScript T E X<br />

_1______.PFB EuroSans-Regular zpeurs.pfb<br />

_1I_____.PFB EuroSans-Italic zpeuris.pfb<br />

_1B_____.PFB EuroSans-Bold zpeubs.pfb<br />

_1BI____.PFB EuroSans-BoldItalic zpeubis.pfb<br />

_3______.PFB EuroSerif-Regular zpeur.pfb<br />

_3I_____.PFB EuroSerif-Italic zpeuri.pfb<br />

_3B_____.PFB EuroSerif-Bold zpeub.pfb<br />

_3BI____.PFB EuroSerif-BoldItalic zpeubi.pfb<br />

_2______.PFB EuroMono-Regular zpeurt.pfb<br />

_2I_____.PFB EuroMono-Italic zpeurit.pfb<br />

_2B_____.PFB EuroMono-Bold zpeubt.pfb<br />

_2BI____.PFB EuroMono-BoldItalic zpeubit.pfb<br />

The first column is the name as unpacked on Windows, the second the<br />

internal PostScript name, <strong>and</strong> the third, the name used by T E X. The<br />

.pfb files must be renamed <strong>to</strong> those in the third column, <strong>and</strong> placed in<br />

texmf\fonts\type1\adobe\euro (or better in texmf-local).<br />

The font map file zpeu.map must also be added <strong>to</strong> the lists of font maps<br />

for dvips, dvipdfm, <strong>and</strong> pdfT E X (Section 10.1.3). The T E XLive installation<br />

does all this for you; you only need <strong>to</strong> get <strong>and</strong> s<strong>to</strong>re the.pfb files.<br />

B.3 T E X direc<strong>to</strong>ry structure<br />

The T E X system, of which L AT E X is only one part, albeit a large one, requires<br />

a very large number of files, for fonts, formats, classes, packages, bibliographies,<br />

<strong>and</strong> much more. Section B.6 lists the types of files <strong>and</strong> their<br />

extensions, at least for what concerns L AT E X. Other flavors of T E X have<br />

their own types in addition.


388 Appendix B. The L AT E X Clockwork<br />

texmf<br />

bibtex dvipdfm fonts metafont source<br />

doc dvips makeindex pdftex tex<br />

pk source tfm type1 vf<br />

generic latex plain<br />

babel config dvips hyphen amsfonts base config<br />

base hyperref natbib psnfss <strong>to</strong>ols<br />

Figure B.3: The TDS direc<strong>to</strong>ry tree<br />

In the early days, anyone setting up a T E X installation would try <strong>to</strong><br />

create order of some sort by distributing the files in<strong>to</strong> different direc<strong>to</strong>ries<br />

(also called folders) according <strong>to</strong> their functions. However, everyone had<br />

their own ideas how <strong>to</strong> do this. Thus changing from one installation <strong>to</strong><br />

another required a <strong>to</strong>tally new road map.<br />

The T E X Users Group, TUG, commissioned a working group <strong>to</strong> prepare<br />

a recommended st<strong>and</strong>ard, which published its results in 1994. The<br />

latest version of this paper is on T E XLive at \texmf\doc\tds\ in various<br />

formats. The T E X Direc<strong>to</strong>ry Structure (TDS) described there can only be a<br />

recommendation, but it is fairly universally followed <strong>to</strong>day. The T E XLive<br />

CD certainly conforms <strong>to</strong> it.<br />

Figure B.3 offers an overview of TDS. The <strong>to</strong>p direc<strong>to</strong>ry is named texmf,<br />

<strong>to</strong> demonstrate that it holds the entire T E X <strong>and</strong> METAFONT systems.<br />

This may not be the absolute <strong>to</strong>p direc<strong>to</strong>ry on any installation. For<br />

example, if you install <strong>to</strong> a Windows hard disk, you might find it in<br />

\program files\texlive\texmf. Furthermore, there might be parallel<br />

direc<strong>to</strong>ries named texmf-var (where the system writes files it creates,<br />

like font.pk files) <strong>and</strong> texmf-local for any private packages you install<br />

yourself. The idea is <strong>to</strong> keep the main texmf tree intact, <strong>to</strong> let the T E XLive<br />

installation program manage it. These parallel trees should have the same<br />

structure, but may be incomplete.<br />

The subdirec<strong>to</strong>ries under texmf are the main classification of the<br />

subsequent files, sorted mainly by program, such as BIBT E X (Section 14.1),


B.4. The CTAN server 389<br />

dvipdfm (Section 10.2.2), dvips (Section 10.1.1), MakeIndex (Section 9.4.3),<br />

METAFONT (Section G.3), <strong>and</strong> pdfT E X (Section 10.2.3). Others are<br />

doc containing documentation of all sorts; its subdirec<strong>to</strong>ries are similarly<br />

structured <strong>to</strong> those under tex; most of the documentation files that<br />

we have referred <strong>to</strong> in this book are <strong>to</strong> be found here;<br />

fonts is subdivided according <strong>to</strong> the types of files explained in Section<br />

G.1: pk for the pixel files (these usually go in<strong>to</strong> texmf-var),<br />

tfm for the font metric files, vf for virtual font files, source for the<br />

METAFONT.mf sources, type1 for the.pfb or.pfa PostScript outline<br />

font files; the contents of each of these direc<strong>to</strong>ries are further sorted<br />

by supplier (adobe, public, . . . ), <strong>and</strong> then by font family (times,<br />

cm, . . . );<br />

source contains the delivery files for packages <strong>and</strong> collections; for L AT E X,<br />

these are the.dtx <strong>and</strong>.ins files, found under latex\base; similarly<br />

for packages, such as latex\geometry containing geometry.dtx<br />

<strong>and</strong> geometry.ins; these are not needed any more once installed;<br />

the subdirec<strong>to</strong>ries under source mirror those under tex;<br />

tex is the main direc<strong>to</strong>ry for files directly related <strong>to</strong> T E X; some of its<br />

subdirec<strong>to</strong>ries are<br />

generic for files that apply <strong>to</strong> all T E X applications, like hyphenation<br />

patterns;<br />

latex for all the L AT E X related files; this is further subdivided in<strong>to</strong><br />

direc<strong>to</strong>ries for individual packages; only a h<strong>and</strong>ful are shown in<br />

the figure; base contains the fundamental L AT E X files, the kernel;<br />

plain for Plain T E X, which is often just called T E X (Section 1.3.2).<br />

This direc<strong>to</strong>ry structure allows a user <strong>to</strong> locate documentation, source,<br />

running files for a package, collection, program, on all installations. The<br />

documentation <strong>and</strong> source files can readily be removed, or not copied<br />

at all from the CD, since they play no role during the processing. This<br />

structure makes it easy <strong>to</strong> remove such unnecessary branches of the tree.<br />

B.4 The CTAN server<br />

The easiest way <strong>to</strong> obtain the L AT E X software not available on the T E XLive<br />

CD is via one of the network servers supported by various educational<br />

institutions. They also provide the most up-<strong>to</strong>-date st<strong>and</strong>ard L AT E X installation,<br />

T E X extensions, programs for running T E X, collections of drivers for<br />

different printers, hyphenation patterns for other languages, etc. Such a<br />

server is a treasure trove for the dedicated T E X <strong>and</strong> L AT E X user.


390 Appendix B. The L AT E X Clockwork<br />

tex-archive<br />

fonts systems support macros<br />

msdos win32<br />

amsfonts cm ec latex<br />

latex2html tex4ht<br />

doc<br />

psfonts<br />

language<br />

hyphenations<br />

latex latex209<br />

required base unpacked contrib<br />

supported other<br />

amslatex babel cyrillic graphics psnfss <strong>to</strong>ols<br />

Figure B.4: Partial direc<strong>to</strong>ry tree of CTAN servers<br />

There are three main network servers for T E X <strong>and</strong> L AT E X located in the<br />

United States, Great Britain, <strong>and</strong> Germany, forming the Comprehensive T E X<br />

Archive Network, CTAN. They are not only kept up <strong>to</strong> date but also regularly<br />

exchange contributions among themselves. They are all reachable<br />

on the Internet.<br />

Country Internet address<br />

USA ftp://ctan.tug.org/tex-archive/<br />

UK ftp://ftp.tex.ac.uk/tex-archive/<br />

Germany ftp://ftp.dante.de/tex-archive/<br />

In addition, there are many full <strong>and</strong> partial mirrors of these sites. See the<br />

TUG home page, http://www.tug.org, for details.<br />

The direc<strong>to</strong>ry structure is the same for all three servers. A sketch of<br />

the main parts of the direc<strong>to</strong>ry tree is presented in Figure B.4.<br />

The latest version of the L AT E X source files may be found under the<br />

subdirec<strong>to</strong>ries base or unpacked, where in the latter the files are already<br />

unpacked <strong>and</strong> latex.ltx is ready. The L AT E X extensions <strong>and</strong> general style<br />

files that have been contributed by other users are located in the subdirec<strong>to</strong>ry<br />

contrib/supported, with each contribution in a subdirec<strong>to</strong>ry of its<br />

own. Extensions offered by the L AT E X3 Team are found in the required<br />

subdirec<strong>to</strong>ry, which include babel, graphics, <strong>to</strong>ols, <strong>and</strong> so on.


B.5 Additional st<strong>and</strong>ard files<br />

B.5. Additional st<strong>and</strong>ard files 391<br />

Throughout this book we have pointed out <strong>and</strong> explained many contributed<br />

packages that exp<strong>and</strong> L AT E X functionality. However, there are a<br />

number of service documents, additional classes, <strong>and</strong> packages that are<br />

delivered with the basic L AT E X installation, found in texmf\tex\latex\<br />

base\. We list them all here, although some have been mentioned in other<br />

sections.<br />

B.5.1 Special documents<br />

The st<strong>and</strong>ard installation includes a number of special ‘documents’, files<br />

with the.tex extension. These are:<br />

small2e.tex a short sample document;<br />

sample2e.tex a longer sample document;<br />

lablst.tex (Section 9.2.1) for printing out all the cross-reference labels,<br />

with translations <strong>and</strong> page numbers; it asks interactively the name<br />

of the document that is <strong>to</strong> be so listed;<br />

idx.tex (Section 9.4) lists all the \index entries for a document, ordered<br />

in two columns, by page; it asks interactively the name of the<br />

document that is <strong>to</strong> be so listed;<br />

testpage.tex <strong>to</strong> test the positioning of the text on a page; this is more a<br />

test of the printer driver, <strong>to</strong> make sure that the margins are correct<br />

<strong>and</strong> that the scaling comes out properly;<br />

nfssfont.tex is a document <strong>to</strong> print out a font table, sample text, <strong>and</strong><br />

various other tests; it asks for the name of the font interactively; the<br />

comm<strong>and</strong> \help prints out a list of comm<strong>and</strong>s that can be given;<br />

docstrip.tex (Section D.7.1) this is more a program than a document; it<br />

is the basic <strong>to</strong>ol for unpacking operating files from their documented<br />

source files; it not only removes comments, but also includes alternative<br />

coding depending on various options.<br />

B.5.2 Extra classes<br />

In addition <strong>to</strong> the st<strong>and</strong>ard classes that have already been discussed (book,<br />

report, article, letter) the st<strong>and</strong>ard installation also contains<br />

proc for producing camera-ready copy of conference proceedings; it is a<br />

variant of the two-column article class; it contains one extra comm<strong>and</strong>:<br />

\copyrightspace, which leaves blank space at the bot<strong>to</strong>m<br />

of the first column for typing in a copyright notice;


392 Appendix B. The L AT E X Clockwork<br />

minimal a bare-bones class for testing <strong>and</strong> debugging;<br />

slides (Section 15.1) the former SLIT E X, for producing presentation material;<br />

ltxdoc (Section D.7.2) <strong>to</strong> produce class <strong>and</strong> package documentation.<br />

B.5.3 St<strong>and</strong>ard packages<br />

The st<strong>and</strong>ard packages, some of which are described elsewhere, are:<br />

alltt (Section 4.9.1) enables the alltt environment which is much like<br />

verbatim except that \ { } behave as normal; this means that<br />

comm<strong>and</strong>s included in the text are executed <strong>and</strong> not printed literally;<br />

doc (Section D.7.2) provides many special features for documenting L AT E X<br />

packages;<br />

exscale allows the mathematical symbols that appear in different sizes<br />

<strong>to</strong> scale with the font size option given in the \documentclass<br />

comm<strong>and</strong>; normally the size of these symbols is fixed, independent<br />

of the basic size of the text;<br />

flafter (Section 7.2, page 171) ensures that floating objects (figures <strong>and</strong><br />

tables) do not appear before their position in the text;<br />

fontenc (Section A.3.6, page 378) declares font encodings by loading<br />

their.def files; the names of the encodings are listed as options;<br />

graphpap (Section 13.1.5) provides the comm<strong>and</strong> \graphpaper which<br />

produces coordinate grids in the picture environment;<br />

ifthen (Section 8.3.5) allows text or comm<strong>and</strong> definitions depending on<br />

the state of various conditionals; one may test the state of a boolean<br />

switch, the value of a counter or length, or the text definition of a<br />

comm<strong>and</strong>;<br />

inputenc (Section D.5) allows a L AT E X document file <strong>to</strong> be prepared with<br />

a system-dependent input encoding scheme for special characters;<br />

latexsym loads the 11 special L AT E X symbols in the lasy fonts (Section<br />

G.2.2), which were part of L AT E X 2.09; this file is au<strong>to</strong>matically<br />

read in in compatibility mode;<br />

makeidx (Section 9.4.3) provides the comm<strong>and</strong>s that may be used with<br />

the MakeIndex program <strong>to</strong> generate a keyword index;<br />

showidx (Section 9.4) makes the \index entries visible by printing them<br />

as marginal notes;


B.5. Additional st<strong>and</strong>ard files 393<br />

shortvrb (Section 4.9.1) provides the comm<strong>and</strong>s \MakeShortVerb <strong>and</strong><br />

\DeleteShortVerb, <strong>to</strong> designate (<strong>and</strong> remove) a certain character<br />

as the equivalent of \verb for printing literal text. The character,<br />

preceded by a backslash, is given as an argument <strong>to</strong> these comm<strong>and</strong>s.<br />

After \MakeShortVerb{\|} has been issued, |\cmd{x}| is<br />

equivalent <strong>to</strong> \verb|\cmd{x}|, producing \cmd{x};<br />

syn<strong>to</strong>nly provides the comm<strong>and</strong> \syntaxonly which, when given in the<br />

preamble, suppresses all output <strong>to</strong> the .dvi file, but continues <strong>to</strong><br />

issue errors <strong>and</strong> warnings; the job runs about four times faster than<br />

normal; this is used <strong>to</strong> check the processing when output is not<br />

immediately needed;<br />

t1enc makes the T1 font encoding (Section G.4.3) the st<strong>and</strong>ard, for use<br />

with DC or EC fonts;<br />

textcomp makes the special symbols in the text companion fonts available<br />

in text mode (Section G.4.4);<br />

tracefnt is a diagnostic <strong>to</strong>ol for checking NFSS font selections; the<br />

options given with \usepackage control its action:<br />

errorshow suppresses all warnings <strong>and</strong> information messages <strong>to</strong><br />

the moni<strong>to</strong>r, which are still sent <strong>to</strong> the transcript file; only error<br />

messages are printed <strong>to</strong> the moni<strong>to</strong>r;<br />

warningshow prints warnings <strong>and</strong> error messages on the moni<strong>to</strong>r;<br />

this behavior is much the same as when the package is not used<br />

at all;<br />

infoshow (default option) sends font selection information <strong>to</strong> the<br />

moni<strong>to</strong>r, which is normally only written <strong>to</strong> the transcript file;<br />

debugshow writes considerably more information <strong>to</strong> the transcript<br />

file about every change of font; can produce a very large transcript;<br />

pausing turns all warnings in<strong>to</strong> error messages so that processing<br />

temporarily s<strong>to</strong>ps, awaiting user response;<br />

loading shows the loading of external fonts.<br />

B.5.4 The <strong>to</strong>ols packages<br />

The members of the L AT E X3 Team, as individuals, have written a number<br />

of packages that they collectively make available; these are <strong>to</strong> be found in<br />

the texmf\tex\latex\<strong>to</strong>ols\ direc<strong>to</strong>ry. Although contributions, they<br />

are considered <strong>to</strong> be part of the st<strong>and</strong>ard installation.<br />

Many of these have been described elsewhere in this book, but we list<br />

them all here.


394 Appendix B. The L AT E X Clockwork<br />

afterpage (Section 7.1 on page 171) permits comm<strong>and</strong>s <strong>to</strong> be saved<br />

<strong>and</strong> executed at the end of the current page. This is useful<br />

for forcing stubborn floats <strong>to</strong> be output right away, with<br />

\afterpage{\clearpage}. If \clearpage were issued directly,<br />

a new page would be inserted at that point. With \afterpage, the<br />

comm<strong>and</strong> is reserved until the end of the page.<br />

array (Section 4.8.4 on page 106) is a re-implementation of the tabular<br />

<strong>and</strong> array environments with several additional features.<br />

bm permits individual math symbols <strong>to</strong> be printed in bold face with<br />

comm<strong>and</strong> \bm{\sym}. Thus $\alpha + \bm{\beta}$ produces<br />

α + β without recourse <strong>to</strong> the \boldmath comm<strong>and</strong> which would<br />

set the whole formula in bold face. There is also a comm<strong>and</strong><br />

\DeclareBoldMathComm<strong>and</strong>{\name}{\sym} that defines \name <strong>to</strong><br />

be \bm{\sym}.<br />

calc re-implements the counter <strong>and</strong> length comm<strong>and</strong>s <strong>to</strong> allow ‘normal’<br />

arithmetic with them, such as<br />

\setlength{\mylen}{3cm + \textwidth}<br />

\setcounter{page}{\value{section} * 3}<br />

\parbox{\linewidth / \real{1.6}}{...}<br />

Note that the arithmetical expressions can be used not only <strong>to</strong> set<br />

values but also as arguments <strong>to</strong> comm<strong>and</strong>s <strong>and</strong> environments.<br />

dcolumn (Section 4.8.4) requires the array package; it allows decimal<br />

point alignment in the tabular tables.<br />

delarray (Section 4.8.4) requires the array package; it permits large<br />

bracketing symbols <strong>to</strong> be put around array environments, for making<br />

matrices of various sorts.<br />

enumerate (Section 4.3.5, page 74) re-implements the enumerate environment<br />

so that an optional argument determines the numeration<br />

style.<br />

fileerr.dtx when unpacked, produces a set of small files that may<br />

be used <strong>to</strong> reply <strong>to</strong> T E X when a file is not found; this makes the<br />

responses similar <strong>to</strong> those for error messages; the files are named<br />

h.tex, e.tex, s.tex, <strong>and</strong> x.tex; thus, replying x〈return〉 loads the<br />

last one, which terminates the input.<br />

fontsmpl is a package <strong>to</strong> output a sample text, accents, <strong>and</strong> special characters<br />

for a given font; with the accompanying file fontsmpl.tex, a<br />

family such as cmr can be printed with all attributes <strong>and</strong> encodings.<br />

ftnright puts footnotes in the right-h<strong>and</strong> column in two-column mode.


B.5. Additional st<strong>and</strong>ard files 395<br />

hhline requires the array package; allows more flexibility in putting<br />

horizontal rules in tables.<br />

indentfirst (Section 3.2.4 on page 46) indents the first paragraph of<br />

sections, which normally are not indented.<br />

layout (Section 3.2.5 on page 47) defines the comm<strong>and</strong> \layout which<br />

draws a diagram of the current page format, with the values of the<br />

parameters printed.<br />

longtable (Section 4.8.4 on page 108) makes tables that extend over<br />

several pages, with breaks occurring au<strong>to</strong>matically.<br />

multicol (Section 3.2.8) introduces the environment multicols which<br />

switches <strong>to</strong> multi-column output without a page break either before<br />

or after. It is called with<br />

\begin{multicols}{num cols}[header text][pre space]<br />

Text set in num cols columns<br />

\end{multicols}<br />

The optional header text is printed in a single column across the <strong>to</strong>p<br />

of the multi-column part. A \newpage is issued only if the remaining<br />

space on the current page is less than a certain value, s<strong>to</strong>red in<br />

the length \premulticols; the optional length argument pre space<br />

overrides this value if given. Similarly the length \postmulticols<br />

determines whether a new page is inserted at the end of the multicolumn<br />

text. Column separation <strong>and</strong> possible rule are set by the<br />

st<strong>and</strong>ard L AT E X lengths \columnsep <strong>and</strong> \columnseprule as for the<br />

\twocolumn comm<strong>and</strong>. The text in the multi-column format is<br />

balanced; that is, the columns are all equally long.<br />

showkeys prints out all the cross-reference keys defined by \label <strong>and</strong><br />

\bibitem <strong>and</strong> used by \ref, \pageref, <strong>and</strong> \cite; these are marginal<br />

<strong>and</strong> interlinear notes for a draft only, <strong>to</strong> check the crossreferencing.<br />

somedefs allows only selected comm<strong>and</strong>s <strong>to</strong> be defined in a package,<br />

depending on options in \usepackage.<br />

tabularx (Section 4.8.4) defines a tabularx environment which is like<br />

tabular*, a table of desired width, except that it is the column<br />

widths that exp<strong>and</strong> <strong>and</strong> not the intercolumn spacing.<br />

theorem provides extensions <strong>to</strong> the \newtheorem comm<strong>and</strong> for more<br />

flexible ‘theorem-like’ environments; it is very similar <strong>to</strong> the A M S<br />

amsthm package (Section 12.3.1).


396 Appendix B. The L AT E X Clockwork<br />

varioref (Section 9.2.4) defines \vref <strong>and</strong> \vpageref comm<strong>and</strong>s, analogous<br />

<strong>to</strong> \ref <strong>and</strong> \pageref, which check if the referenced object is<br />

only one page away, <strong>and</strong> if so, print text like ‘on the previous page’;<br />

the actual text printed can alternate between two variants.<br />

verbatim (Section 4.9.1) is a re-implementation of the verbatim environment<br />

that prevents memory overflow for long texts; it also defines a<br />

comm<strong>and</strong> \verbatiminput <strong>to</strong> input a file <strong>and</strong> <strong>to</strong> print its contents<br />

literally, as well as a comment environment for a block comment in<br />

the input text.<br />

xr (Section 9.2.3) is a package <strong>to</strong> allow \ref <strong>to</strong> cross-reference \label<br />

comm<strong>and</strong>s from other documents.<br />

xspace (Section 8.3.1 on page 186) contains a device <strong>to</strong> fix the problem<br />

of comm<strong>and</strong> names swallowing up the blank that follows them; thus<br />

the comm<strong>and</strong> \PS defined as<br />

\newcomm<strong>and</strong>{\PS}{PostScript\xspace}<br />

may be used as \PS file without having <strong>to</strong> terminate the \PS<br />

comm<strong>and</strong> with \ or {}.<br />

B.6 The various L AT E X files<br />

A number of different files are used during the L AT E X processing: some<br />

are read in while others are created <strong>to</strong> s<strong>to</strong>re information for the next run.<br />

They all consist of two parts:<br />

root name.extension<br />

For every L AT E X document, there is a main file, whose root name is used<br />

when the program L AT E X is called. It normally possesses the extension<br />

.tex, as do any other files that it might read in with \input or \include<br />

comm<strong>and</strong>s. (If they have a different extension, it must be given explicitly.)<br />

The other files that are created during a L AT E X processing run normally<br />

have the same root name as the main file but a variety of different extensions,<br />

depending on their functions. If the main file contains \include<br />

comm<strong>and</strong>s, there will be additional files created having the same root<br />

names as the included.tex files but with the extension.aux.<br />

Some of these files are created with every L AT E X run, whereas others<br />

appear only when certain L AT E X comm<strong>and</strong>s have been issued, such<br />

as \tableofcontents or \makeindex. The .aux files as well as those<br />

produced by special L AT E X comm<strong>and</strong>s may be suppressed by including<br />

the comm<strong>and</strong> \nofiles in the preamble. This comm<strong>and</strong> is useful if a<br />

document is being constantly corrected <strong>and</strong> reprocessed, so that the information<br />

in the special files is not yet finalized <strong>and</strong> may therefore be


B.6. The various L AT E X files 397<br />

dispensed with. Files created at the T E X level of processing will always be<br />

generated.<br />

Other extensions describe files that contain formatting information,<br />

or additional instructions (coding), or databases. The root part of these<br />

file names is not associated with any document file. An example of this<br />

type is the article.cls file that defines the article class.<br />

The rest of this section contains a list of the L AT E X file extensions with<br />

a short description of the role they play in the L AT E X processing.<br />

.aux This is the auxiliary file written by L AT E X, containing information for<br />

cross-references as well as some comm<strong>and</strong>s necessary for the table<br />

of contents <strong>and</strong> other lists. There will be one .aux file created (or<br />

re-created) for the main file, in addition <strong>to</strong> one for every file read in<br />

by an \include comm<strong>and</strong>.<br />

The auxiliary.aux files may be suppressed by issuing \nofiles in<br />

the preamble.<br />

.bbl This file is not created by L AT E X, but by the program BIBT E X. It has<br />

the same root name as the main file. BIBT E X actually only reads the<br />

.aux file for its information. The.bbl file is read in<strong>to</strong> the next L AT E X<br />

processing run by the comm<strong>and</strong> \bibliography <strong>and</strong> produces the<br />

list of literature references.<br />

.bib Bibliographic databases have the extension.bib. BIBT E X reads them<br />

<strong>to</strong> extract the information it needs <strong>to</strong> generate the .bbl file. The<br />

root name describes the database <strong>and</strong> not (necessarily) any text<br />

file. The database name is included in the text by means of the<br />

\bibliography comm<strong>and</strong>.<br />

.blg This is the transcript file from a BIBT E X run. The root name is the<br />

same as that of the input file.<br />

.bst This is a bibliography style file that is used as input <strong>to</strong> BIBT E X <strong>to</strong><br />

determine the format of the bibliography. The name of the .bst<br />

file is included in the text by means of the \bibliographystyle<br />

comm<strong>and</strong>.<br />

.cfg Some classes permit local configurations for paper size or other<br />

requirements by putting specifications in<strong>to</strong> a .cfg file of the same<br />

root name as the class. The ltxdoc class (Section D.7.2) is one of<br />

these.<br />

.clo This is a class option file, containing the coding for certain options<br />

that might apply <strong>to</strong> more than one class. There is no special<br />

comm<strong>and</strong> <strong>to</strong> input them.<br />

.cls This is a class file, defining the overall format of the document. It<br />

is read in by the \documentclass comm<strong>and</strong>. A .cls file may also<br />

be input from another one with the \LoadClass comm<strong>and</strong>.


398 Appendix B. The L AT E X Clockwork<br />

.def Additional definition files of various types carry the .def extension.<br />

Examples are t1enc.def (<strong>to</strong> define the T1 encoding) <strong>and</strong><br />

latex209.def (for compatibility mode between L AT E X 2ε <strong>and</strong> 2.09).<br />

.dtx These are documented source files for the L AT E X installation. If a.dtx<br />

file is processed directly, the documentation is printed. This is an<br />

explana<strong>to</strong>ry manual <strong>and</strong>/or a detailed description of the coding. The<br />

class, package,.ltx,.fd or other file(s) are extracted by processing<br />

the.dtx file with DocStrip (Section D.7.1), usually by running L AT E X<br />

or T E X on a supplied.ins file.<br />

.dvi This is the T E X output file, containing the processed text in a format<br />

that is independent of the output printer, hence a ‘deviceindependent’<br />

file. It <strong>to</strong>o is generated by every T E X process run <strong>and</strong><br />

cannot be suppressed by \nofiles.<br />

The.dvi file must be further processed by a printer driver program<br />

that converts it in<strong>to</strong> the special comm<strong>and</strong>s for the desired output<br />

device (printer).<br />

.fd Files containing the NFSS comm<strong>and</strong>s associating external font names<br />

with font attributes (Section A.3.6) are font description files. The<br />

root names consist of the encoding <strong>and</strong> family designations, such<br />

as ot1cmr.fd. When a font of a given family is requested for the<br />

first time, the corresponding .fd file is au<strong>to</strong>matically read in, if it<br />

exists.<br />

.fdd Documented sources for .fd files have the extension .fdd, <strong>and</strong> are<br />

nothing more than a special type of.dtx file. They may be processed<br />

for the documentation, or have the.fd files extracted by DocStrip.<br />

.fmt This extension belongs <strong>to</strong> a T E X format file that has been created<br />

with the special program initex (Section B.1.3). Format files contain<br />

all the basic instructions in a compact coding for quick loading.<br />

L AT E X is nothing less than T E X run with the format latex.fmt. (Plain<br />

T E X uses the format file plain.fmt.)<br />

.glo This file is only generated when the comm<strong>and</strong> \makeglossary<br />

exists in the preamble. It has the same root name as the main<br />

file <strong>and</strong> contains only \glossaryentry comm<strong>and</strong>s that have been<br />

produced by \glossary comm<strong>and</strong>s in the input text. This file will<br />

be suppressed in spite of the presence of \makeglossary if the<br />

comm<strong>and</strong> \nofiles is issued in the preamble.<br />

.gls This file is the glossary equivalent of the.ind file. It <strong>to</strong>o is generated<br />

by the MakeIndex program, but with the .glo file as input. The<br />

input <strong>and</strong> output extensions must be explicitly given. There are no<br />

st<strong>and</strong>ard L AT E X comm<strong>and</strong>s <strong>to</strong> read in the.gls file. The doc package<br />

uses it <strong>to</strong> record a change his<strong>to</strong>ry.


B.6. The various L AT E X files 399<br />

.idx This file is only generated when the comm<strong>and</strong> \makeindex exists<br />

in the preamble. It has the same root name as the main file <strong>and</strong><br />

contains only \indexentry comm<strong>and</strong>s that have been produced by<br />

\index comm<strong>and</strong>s in the input text. This file will be suppressed in<br />

spite of the presence of \makeindex if the comm<strong>and</strong> \nofiles is<br />

issued in the preamble.<br />

.ilg This is the transcript file from a MakeIndex run. The root name is<br />

the same as that of the input file.<br />

.ind This file is generated by the MakeIndex program, with the.idx file as<br />

input. It is read in by the \printindex comm<strong>and</strong> which is defined<br />

by the makeidx package. It contains a theindex environment, built<br />

up from the entries in the input file.<br />

.ins To facilitate the DocStrip run on a.dtx file, the necessary comm<strong>and</strong>s<br />

(<strong>and</strong> options) are put in<strong>to</strong> an installation file. The extraction is<br />

then accomplished simply by processing (with T E X or L AT E X) the<br />

appropriate.ins file.<br />

.ist This is an index style file, containing style settings for MakeIndex.<br />

The root name reflects the style <strong>and</strong> has no relationship <strong>to</strong> any text<br />

file. For the doc package, the files gind.ist <strong>and</strong> gglo.ist are<br />

provided for specialized index formatting.<br />

.lof This file contains the information for the list of figures. It behaves<br />

exactly like the .<strong>to</strong>c file except that it is opened by the comm<strong>and</strong><br />

\lis<strong>to</strong>ffigures instead of by \tableofcontents.<br />

.log This is the transcript file, containing the pro<strong>to</strong>col of the T E X processing<br />

run, that is, all the messages that were sent <strong>to</strong> the moni<strong>to</strong>r<br />

during the run as well as additional information that can be of use<br />

<strong>to</strong> T E X experts when errors occur. This file is always generated, even<br />

when \nofiles has been issued.<br />

.lot This file contains the information for the list of tables. It behaves<br />

exactly like the .<strong>to</strong>c file except that it is opened by the comm<strong>and</strong><br />

\lis<strong>to</strong>ftables instead of by \tableofcontents.<br />

.ltx For L AT E X installation, certain files that are inputs <strong>to</strong> the initex program<br />

bear the extension .ltx. They form the basis for generating<br />

the format latex.fmt. The main such file is named latex.ltx.<br />

.mf METAFONT source files (Sections G.1 <strong>and</strong> G.3) contain drawing instructions<br />

for the characters in a font. The METAFONT program<br />

converts these <strong>to</strong> bitmap.pk files in a given size <strong>and</strong> resolution for<br />

DVI driver programs.


400 Appendix B. The L AT E X Clockwork<br />

.pk Packed pixel, or bitmap, files (Section G.1) contain images of the<br />

characters in a font. These are read in by the DVI drivers <strong>to</strong> print<br />

the characters either on paper or on the computer moni<strong>to</strong>r.<br />

.sty This is a package file, <strong>to</strong> be loaded with \usepackage. A package<br />

contains additional L AT E X comm<strong>and</strong>s <strong>to</strong> define new features or alter<br />

existing ones. It should not produce any printable text. It may be<br />

input by another package with the comm<strong>and</strong> \RequirePackage.<br />

.tex The file containing the user’s input text should have the extension<br />

.tex. For every L AT E X document there is at least one.tex file. If there<br />

is only one.tex file, it is also the main file that determines the root<br />

name of all the others. If there are \input or \include comm<strong>and</strong>s<br />

within the input text, there are other files belonging <strong>to</strong> the document<br />

with different root names but all with the extension.tex. The main<br />

file is the one whose name appears when the program L AT E X is called.<br />

It contains the highest level \input comm<strong>and</strong>s <strong>and</strong> is the only file<br />

that may have \include comm<strong>and</strong>s.<br />

.tfm T E X font metric files (Section G.1) contain all the font information<br />

that T E X needs <strong>to</strong> process a document: height, width, depth of<br />

each letter, ligature information, italic correction, <strong>and</strong> so on. The<br />

only thing that is missing is what the character looks like. This is<br />

provided by.pk files.<br />

.<strong>to</strong>c This file contains the information for the table of contents. The comm<strong>and</strong><br />

\tableofcontents reads in the.<strong>to</strong>c file, if it exists, <strong>and</strong> then<br />

outputs the table of contents. At the same time, a new .<strong>to</strong>c file is<br />

opened where all the contents information for the current processing<br />

run is written. This .<strong>to</strong>c file is closed by the \end{document}<br />

comm<strong>and</strong>, so that if the L AT E X run is interrupted before completion,<br />

the.<strong>to</strong>c file is lost.<br />

A.<strong>to</strong>c file is only generated if the document contains the comm<strong>and</strong><br />

\tableofcontents <strong>and</strong> if the \nofiles comm<strong>and</strong> has not been<br />

issued. It has the same root name as the main file.<br />

.vf Virtual font files (Section G.1) are read in in place of.pk files for fonts<br />

that do not really exist independently. For each character, there are<br />

instructions for the driver program, usually <strong>to</strong> take character nn<br />

from real font xx.


C<br />

Error Messages<br />

Errors are bound <strong>to</strong> be made at times during the preparation of a long<br />

L AT E X document. The mistakes can be of various kinds, from simple typing<br />

errors for comm<strong>and</strong> names <strong>to</strong> forgetting that some comm<strong>and</strong>s must be<br />

paired or giving an incorrect syntax for a complicated comm<strong>and</strong>.<br />

Errors during the L AT E X processing produce a list of messages on the<br />

moni<strong>to</strong>r, which appear <strong>to</strong>tally incomprehensible <strong>to</strong> the beginner. Even the<br />

advanced user can have difficulty figuring out a particular error message.<br />

However, these messages contain information about fundamental structures<br />

that can aid an experienced T E X programmer <strong>to</strong> see much deeper<br />

in<strong>to</strong> the heart of the problem.<br />

In addition, the error messages contain useful information even for<br />

the beginner. It is the purpose of this chapter <strong>to</strong> explain some of these<br />

messages that can be of assistance <strong>to</strong> non-programmers.<br />

Error messages are written both <strong>to</strong> the computer moni<strong>to</strong>r <strong>and</strong> <strong>to</strong> the<br />

processing transcript file, with extension .log. Examine this file if the<br />

messages on the moni<strong>to</strong>r went by <strong>to</strong>o fast.<br />

C.1 Basic structure of error messages<br />

Error messages have two sources: those from L AT E X <strong>and</strong> those from the<br />

underlying T E X program. The L AT E X messages are often followed by T E X<br />

messages since L AT E X operates at a higher level.<br />

C.1.1 T E X error messages<br />

We start with a simple error as an example.<br />

\documentclass{article}<br />

\begin{document}<br />

The last words appear in \txetbf{bold face}.<br />

\end{document}<br />

401


402 Appendix C. Error Messages<br />

Here the comm<strong>and</strong> \textbf has been mistakenly typed as \txetbf. During<br />

the processing, L AT E X assumes that the user wants <strong>to</strong> invoke a T E X<br />

comm<strong>and</strong> \txetbf. Since L AT E X does not know the T E X comm<strong>and</strong>s, it<br />

passes this text on <strong>to</strong> T E X, which then decides that there is no such comm<strong>and</strong><br />

in its reper<strong>to</strong>ire. The following error message is written <strong>to</strong> the<br />

moni<strong>to</strong>r:<br />

! Undefined control sequence.<br />

l.3 The last words appear in \txetbf<br />

{bold face}.<br />

?<br />

The program s<strong>to</strong>ps at this point <strong>and</strong> waits for a response from the user.<br />

This message can be unders<strong>to</strong>od even by beginners. It consists of an error<br />

indica<strong>to</strong>r that starts with an exclamation point !. Here the indica<strong>to</strong>r is:<br />

! Undefined control sequence, meaning that an unknown comm<strong>and</strong><br />

name (control sequence) was the cause of the error. Next comes a pair of<br />

text lines, the first of which is prefixed with l.3, meaning that the error<br />

occurred in ‘line 3’ of the input text. The error itself was encountered<br />

at the last symbol printed in this upper line. The lower line shows the<br />

continuation of the input line being processed when the error was found,<br />

here the words {bold face}. Before continuing, T E X waits for a reaction<br />

from the user, as indicated by the question mark in the last line of the<br />

message.<br />

Entering another ? <strong>and</strong> 〈return〉 as response produces the following<br />

information:<br />

Type <strong>to</strong> proceed, S <strong>to</strong> scroll future error messages,<br />

R <strong>to</strong> run without s<strong>to</strong>pping, Q <strong>to</strong> run quietly,<br />

I <strong>to</strong> insert something, E <strong>to</strong> edit your file,<br />

1 or ... or 9 <strong>to</strong> ignore next 1 <strong>to</strong> 9 <strong>to</strong>kens of input,<br />

H for help, X <strong>to</strong> quit<br />

?<br />

This is a list of the possible user responses:<br />

1. 〈return〉: simply typing the return key tells T E X <strong>to</strong> continue processing<br />

after making an attempt <strong>to</strong> h<strong>and</strong>le the error according <strong>to</strong> some<br />

preprogrammed rules. In the case of an unknown comm<strong>and</strong> name,<br />

the error treatment is <strong>to</strong> ignore it.<br />

2. S scroll mode: T E X continues the processing, writing further error<br />

messages <strong>to</strong> the moni<strong>to</strong>r as they are encountered, but without s<strong>to</strong>pping<br />

for a user response. This is as though 〈return〉 were pressed<br />

after all subsequent errors.<br />

3. R run mode: T E X continues processing as with S, but does not even<br />

s<strong>to</strong>p as it would in scroll mode if the file named in an \input or<br />

\include comm<strong>and</strong> is missing.


C.1. Basic structure of error messages 403<br />

4. Q quiet mode: the same as with R except that no further error<br />

messages are printed <strong>to</strong> the moni<strong>to</strong>r. They are, however, written <strong>to</strong><br />

the.log file.<br />

5. I insert: the mistake can be corrected by inserting the proper text.<br />

T E X puts the line of text entered from the keyboard in<strong>to</strong> the processing<br />

in place of the error <strong>and</strong> then continues. Such a correction<br />

applies only <strong>to</strong> the processing: the original text in the .tex file is<br />

unchanged <strong>and</strong> must be altered with an edi<strong>to</strong>r. Typing in I\s<strong>to</strong>p<br />

brings the program <strong>to</strong> a halt with the current page in the.dvi file.<br />

6. 1 ...: entering a number less than 100 will delete that many characters<br />

<strong>and</strong> comm<strong>and</strong>s from the subsequent text. The program then<br />

s<strong>to</strong>ps <strong>to</strong> await further response from the user.<br />

7. H help: an extended account of the problem is printed <strong>to</strong> the moni<strong>to</strong>r,<br />

which is more informative than the brief error indica<strong>to</strong>r <strong>and</strong> which<br />

may contain tips for relieving the error.<br />

8. X exit: The T E X processing is halted at this point. The current page<br />

does not appear in the.dvi file.<br />

9. E edit: The process is halted as with X <strong>and</strong> a message is printed<br />

saying on which line of which file the error occurred. For some<br />

implementations, the edi<strong>to</strong>r may actually be called au<strong>to</strong>matically,<br />

going directly <strong>to</strong> the faulty line.<br />

The above response letters may be typed in either in capitals or in lower<br />

case. The response does not take effect until after 〈return〉 is pressed.<br />

Typing H or h for help on the previous sample error message produces<br />

the text:<br />

The control sequence at the end of the <strong>to</strong>p line<br />

of your error message was never \def’ed. If you have<br />

misspelled it (e.g., ‘\hobx’), type ‘I’ <strong>and</strong> the correct<br />

spelling (e.g., ‘I\hbox’). Otherwise just continue<br />

<strong>and</strong> I’ll forget about whatever was undefined.<br />

?<br />

The error is described in more detail: the comm<strong>and</strong> name at the end<br />

of the upper line is unknown; if this is simply a typing error, enter the<br />

proper text with the I response, in this case I\textbf. Otherwise, press<br />

〈return〉 <strong>and</strong> the faulty comm<strong>and</strong> will be ignored. The line of text will<br />

be processed as though it had been The last word appears in bold<br />

face. Of course, no bold face can actually appear.<br />

The basic structure of a T E X error message is summarized as:<br />

Every error message begins with an error indica<strong>to</strong>r, marked by a ! at the<br />

beginning of the first line. The indica<strong>to</strong>r text is a brief description of the


404 Appendix C. Error Messages<br />

problem. Following are one or more lines of input text. The last symbol<br />

of the first of these lines is the one that has caused T E X <strong>to</strong> s<strong>to</strong>p <strong>and</strong> print<br />

the error message. The last line contains the text or comm<strong>and</strong>s that are<br />

the next <strong>to</strong> be processed. T E X waits for a response from the user. If<br />

that response is the typing of an H for help, a more detailed description,<br />

with possible tips, is printed <strong>to</strong> the moni<strong>to</strong>r, <strong>and</strong> T E X waits for a further<br />

response.<br />

C.1.2 L AT E X error messages<br />

As an example of a text with a L AT E X error, we take<br />

\documentclass{article}<br />

\begin{document}<br />

\begin{qoute}\slshape<br />

Text indented at both ends<br />

\end{quote}<br />

\end{document}<br />

Here the call \begin{quote} was incorrectly typed as qoute. The L AT E X<br />

processing writes the error message:<br />

! <strong>LaTeX</strong> Error: Environment qoute undefined.<br />

See the <strong>LaTeX</strong> manual or <strong>LaTeX</strong> Companion for explanation.<br />

Type H for immediate help.<br />

...<br />

l.3 \begin{qoute}<br />

\slshape<br />

?<br />

The first line of this message states that L AT E X itself discovered this error,<br />

with a brief error indica<strong>to</strong>r, in this case Environment qoute undefined.<br />

All L AT E X error messages begin with a line like this, followed by a reference<br />

<strong>to</strong> the L AT E X manuals for detailed explanation (which is also <strong>to</strong> be found<br />

in Section C.3 of this book). The third line of text is a reminder that the<br />

response H 〈return〉 will also type additional clarification.<br />

The line of three dots ... indicates that there are more lines of internal<br />

! coding that have been suppressed. Sometimes it is desirable <strong>to</strong> look deeper<br />

behind the error message, especially for practiced T E Xperts who know how <strong>to</strong><br />

interpret them. In this case, L AT E X can be made <strong>to</strong> output the missing lines of<br />

coding by setting<br />

\setcounter{errorcontextlines}{num}<br />

where num is the number of levels a macro will be decoded on an error. By<br />

default, num = −1. The knowledgeable user can set it <strong>to</strong> 99 <strong>to</strong> get more lines<br />

than he or she will ever likely <strong>to</strong> want.


C.1. Basic structure of error messages 405<br />

The next pair of lines shows just where the processing was halted<br />

when the error was detected. As for T E X messages, the current input<br />

line of text is broken at the error, with the processed part on the first<br />

line, here \begin{qoute}, <strong>and</strong> the remainder on the next line. Here this<br />

remainder is \slshape. The line indica<strong>to</strong>r l.3 (small letter L, not number<br />

one) shows on which line (3) of the input file the error was found.<br />

L AT E X now awaits a response from the user. Typing H 〈return〉 yields<br />

the additional information:<br />

Your comm<strong>and</strong> was ignored.<br />

Type I <strong>to</strong> replace it with another comm<strong>and</strong>,<br />

or <strong>to</strong> continue without it.<br />

?<br />

This means the last comm<strong>and</strong> in the upper line of the pair beginning with<br />

l.3 has not been read in<strong>to</strong> the processing. The mistake may thus be<br />

corrected for the current process run only with I\begin{quote} 〈return〉.<br />

The misspelling will still be in the text file, though, <strong>and</strong> needs <strong>to</strong> be<br />

removed by an edi<strong>to</strong>r run later.<br />

However, if the processing is continued by simply pressing 〈return〉,<br />

then \begin{qoute} is ignored, as though this text were not in the<br />

source file. This leads directly <strong>to</strong> another error when the comm<strong>and</strong><br />

\end{quote} is encountered, since now the matching \begin{quote}<br />

comm<strong>and</strong> is missing. The actual text of this second error message is:<br />

! <strong>LaTeX</strong> Error: \begin{document} ended by \end{quote}.<br />

See the <strong>LaTeX</strong> manual or <strong>LaTeX</strong> Companion for explanation.<br />

Type H for immediate help.<br />

...<br />

l.5 \end{quote}<br />

?<br />

The message again contains the st<strong>and</strong>ard L AT E X announcement, with error<br />

indica<strong>to</strong>r, in the first line, followed by a reference <strong>to</strong> the manuals, <strong>and</strong> an<br />

invitation <strong>to</strong> type H for help. The error indica<strong>to</strong>r in this case is<br />

\begin{document} ended by \end{qoute}.<br />

This arises because when L AT E X encountered \end{quote}, it checked the<br />

name of the current environment. Since \begin{quote} was missing,<br />

the matching \begin comm<strong>and</strong> is the \begin{document} statement,<br />

producing a mismatched \begin...\end pair.<br />

The last pair of lines again shows just how far the processing had<br />

occurred before the error was detected. In this case, the whole of the<br />

current line has already been taken in, so the remainder line is blank.


406 Appendix C. Error Messages<br />

The response H 〈return〉 at this point leads <strong>to</strong> the same message as<br />

for the first error. A correction with an I entry will not do any good since<br />

the missing \begin{quote} can no longer be inserted ahead of the environment<br />

text. Entering I\begin{quote} will replace the \end{quote}<br />

with \begin{quote}, but that does not solve the real problem. The best<br />

response now is <strong>to</strong> type 〈return〉 so that the comm<strong>and</strong> \end{quote} is<br />

ignored <strong>and</strong> the processing continues.<br />

Now both the faulty \begin{qoute} <strong>and</strong> correct \end{quote} comm<strong>and</strong>s<br />

are removed <strong>and</strong> the processing takes place as if the quote environment<br />

had never been in the input text at this point.<br />

If the typing error qoute had been made in the \end instead of in the<br />

\begin comm<strong>and</strong>, the error message would have been:<br />

! <strong>LaTeX</strong> Error: \begin{quote} on input line 3 ended by \end{qoute}<br />

See the <strong>LaTeX</strong> manual or <strong>LaTeX</strong> Companion for explanation.<br />

Type H for immediate help.<br />

...<br />

l.5 \end{qoute}<br />

?<br />

The previous explanations should be enough for the user <strong>to</strong> underst<strong>and</strong><br />

what is now being said. The error indica<strong>to</strong>r here is<br />

\begin{quote} on input line 3 ended by \end{qoute}<br />

<strong>and</strong> the last pair of lines indicate that the problem is in line 5 <strong>and</strong> that the<br />

troublesome comm<strong>and</strong> is \end{qoute}. The obvious thing <strong>to</strong> do now, <strong>and</strong><br />

the H message encourages this conclusion, is <strong>to</strong> make a correction with<br />

I\end{quote}. However, now a new message appears on the moni<strong>to</strong>r:<br />

! Extra \endgroup.<br />

\endgroup<br />

l.5 \end{qoute}<br />

?<br />

With the exception of the last pair beginning with l.5, this makes no<br />

sense at all. The error indica<strong>to</strong>r ! Extra \endgroup is seemingly meaningless.<br />

That this is a T E X error message <strong>and</strong> not a L AT E X one is hardly any<br />

compensation.<br />

The frustrated user is not really <strong>to</strong> blame. The response was perfectly<br />

reasonable even if it was wrong. Only experience could say that the<br />

best action at that point was <strong>to</strong> have just pressed 〈return〉. The quote<br />

environment is closed off anyway, although any special actions associated<br />

with \end{quote} would be left off.<br />

The help message at this point is


C.1. Basic structure of error messages 407<br />

Things are pretty mixed up, but I think the worst is over.<br />

This is at least encouraging, <strong>and</strong> the user should not lose heart. The best<br />

thing is <strong>to</strong> just keep on pressing 〈return〉 <strong>to</strong> get through the run.<br />

We give here two recommendations for choosing a response, one specific<br />

<strong>and</strong> one general. The specific one is:<br />

If a false environment name appears in a \begin comm<strong>and</strong>, the proper<br />

correction of the error is<br />

I\begin{right name}<br />

If the misspelling has occurred in the \end comm<strong>and</strong>, the best way<br />

<strong>to</strong> h<strong>and</strong>le this mistake is just <strong>to</strong> press 〈return〉. The environment will<br />

be closed <strong>and</strong> any local declarations or definitions will be terminated.<br />

However, if there are any comm<strong>and</strong>s <strong>to</strong> be executed or text <strong>to</strong> be printed<br />

by the \end comm<strong>and</strong>, these will be missing.<br />

The general recommendation is<br />

If the user knows how <strong>to</strong> correct the error with the help of the error<br />

message, this should be done with<br />

I correction<br />

Otherwise, one may give 〈return〉 <strong>and</strong> wait <strong>and</strong> see what happens. Even<br />

if more peculiar (T E X) error messages appear, one can keep on pressing<br />

〈return〉 until the processing is finally at an end. The following prin<strong>to</strong>ut<br />

should indicate where the mistake was.<br />

Instead of continually pressing 〈return〉, one may also enter S, R, or Q<br />

<strong>and</strong> 〈return〉 <strong>to</strong> speed up the error treatment (Section C.1.1). Here, as<br />

with the simple 〈return〉 entry, the faulty comm<strong>and</strong>s are not just ignored.<br />

T E X attempts <strong>to</strong> treat them by making assumptions about what the user<br />

wanted <strong>to</strong> do at this spot. Only when this is no longer possible will T E X<br />

ignore the comm<strong>and</strong> completely. For example, if the indica<strong>to</strong>r reads<br />

\begin{environment} ended by \end{environment}<br />

there was at least a \begin comm<strong>and</strong> with a valid environment name<br />

earlier. It could be assumed that the name of the environment in the \end<br />

comm<strong>and</strong> is wrong. L AT E X thus tries <strong>to</strong> execute this comm<strong>and</strong> using the<br />

name of the current environment.<br />

C.1.3 Error messages from T E X macros<br />

The majority of T E X comm<strong>and</strong>s <strong>and</strong> practically all the L AT E X comm<strong>and</strong>s<br />

are so-called T E X macros. These are combinations of primitive comm<strong>and</strong>s<br />

grouped <strong>to</strong>gether under a new comm<strong>and</strong> name, by which they may be


408 Appendix C. Error Messages<br />

called as a unit. T E X macros are structures similar <strong>to</strong> those that may<br />

be defined by the L AT E X comm<strong>and</strong> \newcomm<strong>and</strong>. Up <strong>to</strong> nine arguments<br />

may be passed <strong>to</strong> them, just as for L AT E X comm<strong>and</strong>s. However, the corresponding<br />

T E X comm<strong>and</strong>s for generating macros are more general than<br />

\newcomm<strong>and</strong>.<br />

In fact, of the approximately 900 Plain T E X comm<strong>and</strong>s available, only<br />

300 are primitives, or fundamental comm<strong>and</strong>s. The remaining 600 are<br />

macros. If an error occurs within a macro, the other comm<strong>and</strong>s within it<br />

may also be affected.<br />

Here is an example for clarification. The comm<strong>and</strong> \centerline is a<br />

macro defined as<br />

\def\centerline#1{\@@line{\hss#1\hss}}<br />

in which \@@line is itself a macro while \hss is a T E X primitive, a rubber<br />

length that can be infinitely stretched or shrunk. To avoid leading the<br />

user in<strong>to</strong> the murky depths of T E X comm<strong>and</strong>s, we will simply point out<br />

that the above macro definition is more or less equivalent <strong>to</strong> the L AT E X<br />

comm<strong>and</strong> sequence<br />

\newcomm<strong>and</strong>{\centerline}[1]{\makebox[\textwidth][c]{#1}}<br />

Now take the following sample input text<br />

\documentclass{article}<br />

\begin{document}<br />

\centerline{This is an \invalid comm<strong>and</strong>}<br />

\end{document}<br />

in which a \ has been placed before the word invalid, making a false<br />

comm<strong>and</strong> named \invalid. During the L AT E X processing, the following<br />

T E X error message appears:<br />

! Undefined control sequence.<br />

This is an \invalid<br />

comm<strong>and</strong><br />

l.3 \centerline{This is an \invalid comm<strong>and</strong>}<br />

?<br />

This T E X message is now a bit more underst<strong>and</strong>able. The error indica<strong>to</strong>r<br />

is the same as for the example in Section C.1.1:<br />

! Undefined control sequence.<br />

The following pair of lines claim that the error was recognized after the<br />

‘comm<strong>and</strong>’ \invalid was processed, <strong>and</strong> that the next piece of text <strong>to</strong> be<br />

read in is the word comm<strong>and</strong>. At the same time, the at the<br />

beginning of the upper line says that this text is the argument of some<br />

other comm<strong>and</strong>.<br />

The next pair of lines are familiar: the error occurred in line 3 of the<br />

input text, after the entire line, comm<strong>and</strong> <strong>and</strong> argument, had been read<br />

in for processing.


C.2 Some sample errors<br />

C.2.1 Error propagation<br />

C.2. Some sample errors 409<br />

The example with the incorrect \begin{qoute} environment showed that<br />

a simple response with the 〈return〉 key led <strong>to</strong> a second error message<br />

in spite of the fact that the \end{quote} comm<strong>and</strong> that produced it was<br />

correct. That one wrongly corrected error leads <strong>to</strong> further errors is more<br />

often the rule than the exception.<br />

Let us look at the input text<br />

\documentclass{article}<br />

\begin{document}<br />

\begin{itemie}<br />

\item This is the first point in the list<br />

\item And here comes the second<br />

\end{itemize}<br />

\end{document}<br />

The only mistake in this text is the misspelled environment name itemie<br />

in place of itemize. The L AT E X processing first produces the same error<br />

message as for the incorrect quote environment earlier:<br />

! <strong>LaTeX</strong> Error: Environment itemie undefined.<br />

See the <strong>LaTeX</strong> manual or <strong>LaTeX</strong> Companion for explanation.<br />

Type H for immediate help.<br />

...<br />

l.3 \begin{itemie}<br />

?<br />

At this point, entering 〈return〉 leads <strong>to</strong> a new error messages:<br />

! <strong>LaTeX</strong> Error: Lonely \item--perhaps a missing list environment.<br />

See the <strong>LaTeX</strong> manual or <strong>LaTeX</strong> Companion for explanation.<br />

Type H for immediate help.<br />

...<br />

l.4 \item T<br />

his is the first point in the list<br />

?<br />

What has happened here is that without the \begin comm<strong>and</strong>, the \item<br />

has been issued outside of a list environment, where it is rather meaningless.<br />

(Actually it is defined <strong>to</strong> print the above error message!) It is now<br />

<strong>to</strong>o late <strong>to</strong> try <strong>to</strong> insert the missing start of the itemize environment.<br />

Typing H 〈return〉 for help yields


410 Appendix C. Error Messages<br />

Try typing <strong>to</strong> proceed.<br />

If that doesn’t work, type X <strong>to</strong> quit.<br />

?<br />

Following this advice <strong>and</strong> pressing 〈return〉, one obtains the same error<br />

message once again, but this time on line 5, for the second \item<br />

comm<strong>and</strong>. Persevering further <strong>and</strong> pressing 〈return〉 once again, one is<br />

presented with<br />

! <strong>LaTeX</strong> Error: \begin{document} ended by \end{itemize}.<br />

See the <strong>LaTeX</strong> manual or <strong>LaTeX</strong> Companion for explanation.<br />

Type H for immediate help.<br />

...<br />

l.6 \end{itemize}<br />

?<br />

The itemize environment has now come <strong>to</strong> its end, but since it was<br />

never properly started, L AT E X complains about a mismatch of \begin<br />

<strong>and</strong> \end comm<strong>and</strong>s. Now at last, typing another 〈return〉 leads <strong>to</strong> a<br />

proper continuation of the processing. Of course the itemized text will be<br />

incorrectly formatted, but the rest of the document will not be affected.<br />

In this example, a single mistake in the input text generated three<br />

further error messages. This is by no means unusual. Some L AT E X errors<br />

can produce hundreds of such successive errors. It is even possible that<br />

the chain of errors never ceases <strong>and</strong> that the processing never advances.<br />

In this case, there is nothing else <strong>to</strong> do but <strong>to</strong> terminate the program.<br />

This should be done with the entry I\s<strong>to</strong>p after the next error message.<br />

It may be necessary <strong>to</strong> give it several times before it takes effect. If this<br />

does not work, that is, if the same message appears every time, then the<br />

response X 〈return〉 will halt the program immediately.<br />

It is better <strong>to</strong> s<strong>to</strong>p the program with I\s<strong>to</strong>p than with X, since then<br />

the output will include the last page being processed. This can be of<br />

assistance in trying <strong>to</strong> deduce what the source of the error was.<br />

The final lesson of this section is simply: even when faced with a host<br />

of error messages, don’t panic! Continue <strong>to</strong> press the 〈return〉 key <strong>to</strong><br />

advance the processing.<br />

Pressing S 〈return〉 instead will produce the same set of error messages<br />

on the moni<strong>to</strong>r but without waiting for a user response in between<br />

(Section C.1.1).<br />

C.2.2 Typical fatal errors<br />

Occasionally it may happen that a user forgets <strong>to</strong> include one of the comm<strong>and</strong>s<br />

\documentclass or \begin{document}, or the entire preamble.


C.2. Some sample errors 411<br />

The last can easily occur when a L AT E X file is <strong>to</strong> be read in with \input or<br />

\include, but is mistakenly entered directly with the L AT E X program call.<br />

If a file with the text<br />

This file has no preamble.<br />

is put directly in<strong>to</strong> the L AT E X processing, the following message appears<br />

on the moni<strong>to</strong>r:<br />

! <strong>LaTeX</strong> Error: Missing \begin{document}.<br />

See the <strong>LaTeX</strong> manual or <strong>LaTeX</strong> Companion for explanation.<br />

Type H for immediate help.<br />

...<br />

l.1 T<br />

his file has no preamble.<br />

?<br />

with the accompanying help message after typing H 〈return〉:<br />

You’re in trouble here. Try typing <strong>to</strong> proceed.<br />

If that doesn’t work, type X <strong>to</strong> quit.<br />

?<br />

One sees from the error message that L AT E X has discovered a mistake<br />

on reading the very first letter of the text. The help message is also not<br />

very encouraging. There is no point trying <strong>to</strong> continue the processing<br />

with 〈return〉. Rather one should s<strong>to</strong>p it with X or E right away, since<br />

nothing useful can be achieved here.<br />

Even when the above example file contains the environment<br />

\begin{document}<br />

This file has no preamble.<br />

\end{document}<br />

it is not possible <strong>to</strong> carry out a proper processing. The T E X error message<br />

now printed is<br />

! <strong>LaTeX</strong> Error: The font size comm<strong>and</strong> \normalsize is not defined:<br />

there is probably something wrong with the class file.<br />

See the <strong>LaTeX</strong> manual or <strong>LaTeX</strong> Companion for explanation.<br />

Type H for immediate help.<br />

...<br />

l.1 \begin{document}<br />

?


412 Appendix C. Error Messages<br />

The error indica<strong>to</strong>r is rather peculiar since the comm<strong>and</strong> \normalsize<br />

never appears in the input. Only the last two lines of this message are<br />

easily unders<strong>to</strong>od. They state that the error was recognized on line 1<br />

after \begin{document} was read in. The fact that this is the text of the<br />

first line is enough <strong>to</strong> show that no meaningful processing can take place,<br />

since the m<strong>and</strong>a<strong>to</strong>ry \documentclass comm<strong>and</strong> that must precede it is<br />

missing.<br />

Here again there is no choice but <strong>to</strong> halt the program with X or E, since<br />

a continuation of the processing would be meaningless.<br />

(The reason for the strange error indica<strong>to</strong>r is that many formatting<br />

parameters are initiated by the \begin{document} statement, including<br />

the st<strong>and</strong>ard font. It is here that \normalfont is called internally, <strong>and</strong><br />

that comm<strong>and</strong> must be defined in the class file, which is missing. Other<br />

initiating comm<strong>and</strong>s are defined in the L AT E X format itself, <strong>and</strong> so they do<br />

not cause this error.)<br />

If the name of the document class is wrongly typed, say as<br />

\documentclass{fred}<br />

the following message appears:<br />

! <strong>LaTeX</strong> Error: File ‘fred.cls’ not found.<br />

Type X <strong>to</strong> quit or <strong>to</strong> proceed,<br />

or enter new name. (Default extension: cls)<br />

Enter file name:<br />

This message should be fairly clear: the program is looking for a file with<br />

the name fred.cls but cannot find it, so would the user be so kind as <strong>to</strong><br />

enter an alternative name. If the new name has the same extension as that<br />

requested (.cls), it need not be explicitly given. In this case, the name of<br />

any st<strong>and</strong>ard L AT E X class, such as article, report, book, or letter, may<br />

be typed in, as well as that of any additional classes that you might have<br />

access <strong>to</strong>. Of course, it should be the class for which the document was<br />

written.<br />

This same error message is printed whenever a file is <strong>to</strong> be read in that<br />

cannot be found on the system. The issuing comm<strong>and</strong> may be \input,<br />

\include, or \usepackage. If the file sought really does exist, perhaps<br />

it is not located where T E X is looking for files. Usually there is a system<br />

parameter set by the installation <strong>to</strong> point T E X <strong>to</strong> its files. If your file is<br />

somewhere else, you can trying entering its full name, with direc<strong>to</strong>ry or<br />

path designations.<br />

If L AT E X is asking for a file that you know does not exist, or which is<br />

<strong>to</strong>tally unknown <strong>to</strong> you, you will want <strong>to</strong> halt the processing right away<br />

or tell L AT E X <strong>to</strong> skip the silly file. At this point, you have a problem.<br />

L AT E X insists on a valid file name. Typing X 〈return〉 only produces the


C.2. Some sample errors 413<br />

message once again, this time stating that it cannot find the file x.ext.<br />

Some installations provide a dummy file named null.tex, while one of<br />

the extension packages available (Section B.5.4) offers a set of files named<br />

after the st<strong>and</strong>ard response letters x.tex, e.tex, r.tex, h.tex, s.tex<br />

<strong>to</strong> emulate the responses <strong>to</strong> normal error messages.<br />

Emergency s<strong>to</strong>p: sometimes one reaches a situation where the program<br />

cannot be halted after an error, even with I\s<strong>to</strong>p or X. In such a case, one<br />

has <strong>to</strong> apply the operating system’s program interrupt, usually CTRL Z.<br />

C.2.3 Mathematical errors<br />

Surprisingly few errors occur as a result of incorrect application of mathematical<br />

formula comm<strong>and</strong>s themselves, even for a user with only a little<br />

experience. More often, the errors in mathematical formulas are fiddly<br />

ones such as forgetting a closing brace } or neglecting <strong>to</strong> switch back<br />

<strong>to</strong> text mode. Another type of common error is <strong>to</strong> use a symbol in text<br />

mode that may only appear in math mode. We will point out a few typical<br />

examples here.<br />

One wants <strong>to</strong> produce the text: ‘The price is $3.50 <strong>and</strong> the order<br />

number is type sample’, <strong>and</strong> types the input text:<br />

The price is $3.50 <strong>and</strong> the order number is type_sample.<br />

This text contains two errors, such that the first cancels the second one:<br />

the $ sign is the math mode switch for generating formulas within text<br />

(Section 5.1). The proper way <strong>to</strong> write a true dollar sign in text is as \$.<br />

Instead, in the sample text, the $ alone switches <strong>to</strong> math mode, setting<br />

everything that follows as a formula. However, the closing switch-back $<br />

is missing, something that T E X will first notice at the end of the current<br />

paragraph.<br />

! Missing $ inserted.<br />

<br />

$<br />

l.4<br />

?<br />

If 〈return〉 is simply pressed as a response, T E X inserts a $ at this point.<br />

For our sample text, this would be at the end of the text before the blank<br />

line. This means that the text from the first $ <strong>to</strong> the end of the paragraph<br />

will be set as a text formula:<br />

The price is 3.50<strong>and</strong>theor der number istypesample.<br />

This output should show the user right away what went wrong. Near<br />

the end of the line, there is a letter s printed as an index. This is the<br />

second error in the example. The underbar character _ is only permitted


414 Appendix C. Error Messages<br />

in math mode <strong>and</strong> should have been typed here as \_. However, after<br />

the first $ had switched (incorrectly) in<strong>to</strong> math mode, the _ sign became<br />

allowed, with the result that the following letter s was lowered.<br />

If we now correct the text by replacing the $ sign with \$, then the _<br />

symbol is no longer in math mode, producing the error message:<br />

! Missing $ inserted.<br />

<br />

$<br />

l.5 ...ice is \$3.50 <strong>and</strong> the order number is type_<br />

sample.<br />

?<br />

Pressing 〈return〉 here tells T E X <strong>to</strong> recover from the error by inserting<br />

the apparently missing $ sign at this point before the math comm<strong>and</strong><br />

_. The processing continues, <strong>and</strong> at some place before the end of the<br />

current paragraph, T E X will notice again that the closing $ is not present.<br />

The same error message is printed as in the first case. The processing<br />

goes on with another 〈return〉 response, with the result:<br />

The price is $3.50 <strong>and</strong> the order number is typesample.<br />

In all three cases, asking for more help with H would type <strong>to</strong> the moni<strong>to</strong>r:<br />

I’ve inserted a begin-math/end-math symbol since I think<br />

you left one out. Proceed, with fingers crossed.<br />

The last sentence above is just what we recommend for mathematical<br />

error messages: keep on pressing 〈return〉 or S <strong>to</strong> get through <strong>to</strong> the end<br />

of the processing, <strong>and</strong> then look at the printed output <strong>to</strong> find the mistake.<br />

C.2.4 Errors from multi-file texts<br />

If the document text is split over many files that are <strong>to</strong> be read in with<br />

\input or \include comm<strong>and</strong>s, the line number in the error message<br />

refers <strong>to</strong> the file currently being read. A response with E 〈return〉 will call<br />

the edi<strong>to</strong>r program <strong>and</strong> open that file, going <strong>to</strong> the indicated line where<br />

the error was recognized. With the other responses, the edi<strong>to</strong>r has <strong>to</strong> be<br />

called separately, with the faulty file explicitly named.<br />

It is possible <strong>to</strong> determine which file was being processed at the time<br />

of the error by examining the processing messages or the.log file. As the<br />

files are opened for reading, T E X writes an opening parenthesis ( <strong>and</strong> the<br />

name of the file <strong>to</strong> the moni<strong>to</strong>r <strong>and</strong> <strong>to</strong> the transcript.log file. When the<br />

file is closed, a closing parenthesis ) is printed. Output page numbers<br />

are similarly written <strong>to</strong> both the moni<strong>to</strong>r <strong>and</strong> transcript file in square<br />

brackets. For example, if the moni<strong>to</strong>r shows the processing messages


C.3. List of L AT E X error messages 415<br />

..(myfile.tex [1] [2] [3] (part1.tex [4] [5]) (part2.tex [6] [7]<br />

! Undefined control sequence<br />

l.999 \finish<br />

?<br />

this can be interpreted as follows: a file myfile.tex was being read, <strong>and</strong><br />

after pages 1, 2, <strong>and</strong> 3 had been output, the file part1.tex was read in with<br />

an \input or \include comm<strong>and</strong> inside the file myfile.tex. Pages 4<br />

<strong>and</strong> 5 were output <strong>and</strong> part1.tex was closed, after which another file<br />

part2.tex was opened for input. An error was discovered in line 999 of<br />

this file. If this error is corrected from the keyboard, or if the processing<br />

is otherwise continued, the moni<strong>to</strong>r messages proceed as<br />

[8] [9]) [10]<br />

! Too many }’s<br />

l.217 \em sample}<br />

The closing parenthesis after page 9 indicates that the file part2.tex has<br />

been closed. The next error is on page 10 in the main file myfile.tex,<br />

since there is no closing ) for it. The error was discovered on line 217 of<br />

this file.<br />

C.3 List of L AT E X error messages<br />

The L AT E X error messages are listed here, divided in<strong>to</strong> general, package, or<br />

font error messages. Within each group, they are ordered alphabetically<br />

according <strong>to</strong> the error indica<strong>to</strong>rs. A description of the possible causes<br />

<strong>and</strong> solutions is also given.<br />

C.3.1 General L AT E X error messages<br />

The following error messages are those not involving font selection or<br />

definition, nor any of the special features for L AT E X programming class<br />

<strong>and</strong> package files (Appendix D).<br />

! <strong>LaTeX</strong> Error: ... undefined.<br />

The argument of a \renewcomm<strong>and</strong> or \renewenvironment has not been<br />

previously defined. The corresponding \new... comm<strong>and</strong> should be<br />

used instead.<br />

! <strong>LaTeX</strong> Error: \< in mid line.<br />

The comm<strong>and</strong> \< in a tabbing environment occurred in the middle of<br />

a line. This comm<strong>and</strong> may only appear at the beginning of a line (Section<br />

4.6.3).


416 Appendix C. Error Messages<br />

! <strong>LaTeX</strong> Error: Bad \line or \vec<strong>to</strong>r argument.<br />

The first argument of a \line or \vec<strong>to</strong>r comm<strong>and</strong> specifies the angle<br />

of the line or arrow. This message states that the selected angle entries<br />

are invalid. See pages 293–294.<br />

! <strong>LaTeX</strong> Error: Bad math environment delimiter.<br />

L AT E X has encountered a math switch comm<strong>and</strong> in the wrong mode: either<br />

a \[ or \( comm<strong>and</strong> in math mode or the corresponding \] or \) in<br />

normal text mode. Either the math switches have been improperly paired<br />

or some braces {...} are incorrect.<br />

! <strong>LaTeX</strong> Error: \begin{...} on input line ... ended by \end{...}.<br />

L AT E X has encountered an \end comm<strong>and</strong> without a corresponding \begin<br />

of the same name. This may be due <strong>to</strong> a typing mistake in the name of the<br />

environment, or <strong>to</strong> the omission of a previous \end comm<strong>and</strong>. A good<br />

way <strong>to</strong> avoid this error is always <strong>to</strong> enter the \end comm<strong>and</strong> immediately<br />

after the \begin, inserting the actual environment text with the edi<strong>to</strong>r in<br />

between the two. This is especially useful for long, nested environments.<br />

It also reduces the risk of typing the environment name incorrectly in the<br />

\end comm<strong>and</strong>.<br />

! <strong>LaTeX</strong> Error: Can be used only in preamble.<br />

Many comm<strong>and</strong>s may only be called within the preamble. These include<br />

\documentclass, \usepackage, \nofiles, \includeonly, \makeindex,<br />

\makeglossary, <strong>and</strong> several others. Certain comm<strong>and</strong>s that only have<br />

meaning within class or package files, such as \ProvidesClass <strong>and</strong><br />

\ProvidesPackage (Section D.2.1), as well as many \Declare.. <strong>and</strong><br />

\Set.. comm<strong>and</strong>s are also only allowed in the preamble. If one of these<br />

comm<strong>and</strong>s is issued after \begin{document}, this message is printed.<br />

! <strong>LaTeX</strong> Error: Comm<strong>and</strong> ... invalid in math mode.<br />

A comm<strong>and</strong> has been issued in math mode that only makes sense in<br />

text mode, such as \item or \circle. The font declarations \itshape,<br />

\bfseries, <strong>and</strong> so on, also produce this error in math mode, since the<br />

math alphabet comm<strong>and</strong>s \mathit, \mathbf should be used instead.<br />

! <strong>LaTeX</strong> Error: Comm<strong>and</strong> ... already defined.<br />

The user has tried <strong>to</strong> redefine an existing structure with one<br />

of \newenvironment, \newcomm<strong>and</strong>, \newtheorem, \newsavebox,<br />

\newfont, \newlength, \newcounter, or \DeclareMathAlphabet.<br />

Either a different name must be selected or, in the case of comm<strong>and</strong>s<br />

<strong>and</strong> environments, the \renew... version must be employed. (Note that<br />

when an environment named sample is defined, the comm<strong>and</strong>s \sample<br />

<strong>and</strong> \endsample are also created.)


C.3. List of L AT E X error messages 417<br />

! <strong>LaTeX</strong> Error: Comm<strong>and</strong> ... undefined in encoding ....<br />

The specified comm<strong>and</strong> has been defined with \DeclareTextComm<strong>and</strong><br />

for a certain NFSS encoding (say OT1) but was executed while another<br />

encoding (for example T1) for which there is no definition was active.<br />

! <strong>LaTeX</strong> Error: Counter <strong>to</strong>o large.<br />

A counter that is <strong>to</strong> be printed as a letter contains a value greater than 26.<br />

! <strong>LaTeX</strong> Error: Environment ... undefined.<br />

L AT E X has encountered a \begin comm<strong>and</strong> with an unknown environment<br />

name. This is probably due <strong>to</strong> a typing mistake. It may be corrected<br />

during the processing with the response I followed by the correct name.<br />

(This does not alter the source file, where the error remains.)<br />

! <strong>LaTeX</strong> Error: File ‘...’ not found<br />

Type X <strong>to</strong> quit or <strong>to</strong> proceed,<br />

or enter new name. (Default extension: ...)<br />

Enter file name:.<br />

A file is <strong>to</strong> be loaded with one of the inputting comm<strong>and</strong>s, but it cannot<br />

be found. You may type a new file name, or quit, or proceed without it.<br />

If the file name has been given correctly, <strong>and</strong> it does exist, maybe it is<br />

not located where L AT E X looks for files. Make sure that it is in one of the<br />

right direc<strong>to</strong>ries. The user is offered a chance <strong>to</strong> type in an alternative,<br />

or correctly typed, name via the keyboard. Type in the file name, with<br />

optional extension, <strong>and</strong> press 〈return〉. L AT E X proposes a default extension<br />

that is the same as that requested. There is no default for the main part<br />

of the file name.<br />

! <strong>LaTeX</strong> Error: Float(s) lost.<br />

A figure or table environment or a \marginpar comm<strong>and</strong> was given<br />

within a vertical box (\parbox or minipage environment), or these structures<br />

were issued within a L AT E X comm<strong>and</strong> that uses vertical boxes internally,<br />

such as a footnote. This error is first recognized by L AT E X when a<br />

page is output so that the actual cause could be many lines earlier in the<br />

text. A number of tables, figures, or marginal notes may have been lost<br />

as a result, but certainly not the one that triggered the problem.<br />

! <strong>LaTeX</strong> Error: Illegal character in array arg.<br />

A tabular or array environment contains an unknown column formatting<br />

character (see Section 4.8.1) or the formatting entry in the second<br />

argument of a \multicolumn comm<strong>and</strong> is wrong.<br />

! <strong>LaTeX</strong> Error: \include cannot be nested.<br />

An attempt has been made <strong>to</strong> call \include from a file that has already


418 Appendix C. Error Messages<br />

been read in by an \include comm<strong>and</strong>. All \include comm<strong>and</strong>s must<br />

be issued in the main file (Section 9.1.2).<br />

! <strong>LaTeX</strong> Error: <strong>LaTeX</strong>2e comm<strong>and</strong> ... in <strong>LaTeX</strong> 2.09 document.<br />

This error occurs if a L AT E X 2ε comm<strong>and</strong> is used in compatibility mode<br />

(Appendix F), that is, if the document uses \documentstyle instead of<br />

\documentclass. These can be \<strong>LaTeX</strong>e, \usepackage, \ensuremath,<br />

the lrbox environment, as well as the new syntax for adding an optional<br />

argument with \newcomm<strong>and</strong> <strong>and</strong> \newenvironment.<br />

! <strong>LaTeX</strong> Error: Lonely \item--perhaps a missing list environment.<br />

An \item comm<strong>and</strong> has been given outside of a list environment (Section<br />

4.3). Either the environment name has been misspelled in the \begin<br />

comm<strong>and</strong> <strong>and</strong> not corrected by keyboard entry, or the \begin comm<strong>and</strong><br />

has been forgotten.<br />

! <strong>LaTeX</strong> Error: Missing @-exp in array arg.<br />

The column formatting argument of a tabular or array environment<br />

contains an @ symbol without the necessary following text in curly braces<br />

{ } that must go with it (Section 4.8.1 for @-expressions), or the same<br />

thing occurs in the second argument of a \multicolumn comm<strong>and</strong>.<br />

! <strong>LaTeX</strong> Error: Missing begin{document}.<br />

Either the \begin{document} comm<strong>and</strong> has been forgotten or there is<br />

printable text inside the preamble of the document. In the latter case,<br />

there could be a declaration with incorrect syntax, such as a comm<strong>and</strong><br />

argument without curly braces { } or a comm<strong>and</strong> name without the<br />

backslash \ character.<br />

! <strong>LaTeX</strong> Error: Missing p-arg in array arg.<br />

The column formatting argument of a tabular or array environment<br />

contains a p symbol without the necessary width specification that must<br />

go with it (Section 4.8.1), or the same thing occurs in the second argument<br />

of a \multicolumn comm<strong>and</strong>.<br />

! <strong>LaTeX</strong> Error: No counter ‘...’ defined.<br />

A \setcounter or \add<strong>to</strong>counter comm<strong>and</strong> was called that referred<br />

<strong>to</strong> a counter name that does not exist. Most likely the name was typed<br />

incorrectly. If this error occurs while an .aux file is being read <strong>and</strong> if<br />

the name of the counter is indeed correct, the defining \newcounter<br />

comm<strong>and</strong> was probably given outside of the preamble. Therefore it is<br />

highly recommended always <strong>to</strong> give the \newcounter comm<strong>and</strong>s inside<br />

the preamble. (If the other L AT E X counter comm<strong>and</strong>s are used with an<br />

undefined counter name, a long list of funny T E X error messages appears.)


! <strong>LaTeX</strong> Error: No \title given.<br />

C.3. List of L AT E X error messages 419<br />

The \maketitle comm<strong>and</strong> has been given before \title has been declared.<br />

! <strong>LaTeX</strong> Error: Not in outer par mode.<br />

A figure or table environment or a \marginpar comm<strong>and</strong> was given<br />

within math mode or inside a vertical box (\parbox or minipage environment).<br />

In the first case, the math switch-back comm<strong>and</strong> was probably<br />

forgotten.<br />

! <strong>LaTeX</strong> Error: Page height already <strong>to</strong>o large.<br />

The comm<strong>and</strong> \enlargethispage is trying <strong>to</strong> extend the vertical size of<br />

the page, which L AT E X already considers <strong>to</strong>o large.<br />

! <strong>LaTeX</strong> Error: \pushtabs <strong>and</strong> \poptabs don’t match.<br />

The number of \poptabs comm<strong>and</strong>s in a tabbing environment does not<br />

agree with the number of previous \pushtabs given (Section 4.6.4).<br />

! <strong>LaTeX</strong> Error: Something’s wrong--perhaps a missing \item.<br />

The most likely cause of this error is that the text in a list environment<br />

(list, itemize, enumerate, or description) does not begin with an<br />

\item comm<strong>and</strong>. It will also occur if thebibliography environment is<br />

given without the argument {sample label} (Section 9.3).<br />

! <strong>LaTeX</strong> Error: Suggested extra height (...) dangerously large.<br />

The comm<strong>and</strong> \enlargethispage is trying <strong>to</strong> extend the vertical size of<br />

the page more than L AT E X considers reasonable.<br />

! <strong>LaTeX</strong> Error: Tab overflow.<br />

The last \= comm<strong>and</strong> in a tabbing environment exceeded the maximum<br />

number of tab s<strong>to</strong>ps allowed by L AT E X.<br />

! <strong>LaTeX</strong> Error: There’s no line here <strong>to</strong> end.<br />

The comm<strong>and</strong> \newline or \\ has been issued after a \par or blank line<br />

where it makes no sense. If additional vertical space is <strong>to</strong> be inserted<br />

here, this should be done with a \vspace comm<strong>and</strong>.<br />

! <strong>LaTeX</strong> Error: This may be a <strong>LaTeX</strong> bug.<br />

This message states that L AT E X is fully confused. This could be the result<br />

of a previous error after which the user response was <strong>to</strong> press 〈return〉. In<br />

this case, the processing should be brought <strong>to</strong> a halt with I\s<strong>to</strong>p or X or E<br />

<strong>and</strong> the earlier error corrected. It is also possible, although unlikely, that<br />

there is a bug in the L AT E X program itself. If this is the first error message


420 Appendix C. Error Messages<br />

in the processing, <strong>and</strong> the text seems otherwise <strong>to</strong> be satisfac<strong>to</strong>ry, the<br />

file should be saved <strong>and</strong> submitted <strong>to</strong> the computing center for further<br />

investigation.<br />

! <strong>LaTeX</strong> Error: Too deeply nested.<br />

Too many list environments (description, itemize, enumerate, or list)<br />

have been nested inside one another. The maximum depth of such nesting<br />

is dependent on the installation but should always be at least four.<br />

! <strong>LaTeX</strong> Error: Too many columns in eqnarray environment.<br />

The eqnarray environment may only have three columns per line. You<br />

may have forgotten <strong>to</strong> start a new row with \\, or have placed an extra &<br />

in the line.<br />

! <strong>LaTeX</strong> Error: Too many unprocessed floats.<br />

This error may occur if there are <strong>to</strong>o many \marginpar comm<strong>and</strong>s on one<br />

page. However, it is more likely that L AT E X is retaining more figure <strong>and</strong><br />

table floats than it can hold. This happens if <strong>to</strong>o many such float objects<br />

have been given before they can be output (Chapter 7). In this case, the<br />

last figure or table should be added later in the text. Another cause could<br />

be that the figure or table cannot be located on a normal text page, but<br />

rather on a special float page at the end of the text or after a \clearpage<br />

or \cleardoublepage comm<strong>and</strong>. Since the output sequence of figures<br />

<strong>and</strong> tables will be the same as that with which they were input, one such<br />

float can block the entire queue. A \clearpage or \cleardoublepage<br />

comm<strong>and</strong> can free the blockage.<br />

! <strong>LaTeX</strong> Error: Undefined tab position.<br />

A \>, \+, \-, or \< comm<strong>and</strong> in a tabbing environment has tried <strong>to</strong> move<br />

<strong>to</strong> a tabula<strong>to</strong>r s<strong>to</strong>p that does not exist (Section 4.6).<br />

! <strong>LaTeX</strong> Error: \verb ended by end of line.<br />

The text of an in-line verbatim comm<strong>and</strong> \verb+...+ extends over more<br />

than one line of text. This is forbidden in order <strong>to</strong> catch a common error:<br />

the missing terminating character. Make sure that the entire text between<br />

the initial <strong>and</strong> terminating characters is all on one input line.<br />

! <strong>LaTeX</strong> Error: \verb illegal in comm<strong>and</strong> argument.<br />

The \verb comm<strong>and</strong> may not be used in the argument of any other<br />

comm<strong>and</strong>, except \index <strong>and</strong> \glossary. It may not be used within<br />

section titles or footnotes, for example.


C.3.2 L AT E X package errors<br />

C.3. List of L AT E X error messages 421<br />

The special programming comm<strong>and</strong>s for h<strong>and</strong>ling class <strong>and</strong> package files<br />

(Appendix D) have their own set of error messages. If one of these features<br />

issues a serious error, there is often little the user can do about it other<br />

than report the problem <strong>to</strong> the author of the file. On the other h<strong>and</strong>,<br />

some errors are due <strong>to</strong> the improper use of the file or of the options that<br />

it provides.<br />

Often classes <strong>and</strong> packages contain their own error or warning messages<br />

with text <strong>and</strong> meanings that are peculiar <strong>to</strong> them. These are indicated<br />

as such, along with the name of the class or package that issued<br />

them. For example, the package mypack could print the error<br />

Package mypack Error: cannot mix options ‘good’<br />

(mypack) <strong>and</strong> ‘bad’.<br />

A help message should also be available when H is typed. Obviously,<br />

such error (<strong>and</strong> warning) messages cannot be explained here, since they<br />

depend entirely on the package in question.<br />

! <strong>LaTeX</strong> Error: \LoadClass in package file.<br />

A package file has called \LoadClass, which it is not allowed <strong>to</strong> do. A<br />

class file can only be loaded from another class file.<br />

! <strong>LaTeX</strong> Error: Option clash for package ....<br />

The specified package has been requested a second time with a different<br />

set of options. A package file will only be loaded once <strong>and</strong> a second<br />

attempt will be ignored. Thus, if two \usepackage or \RequirePackage<br />

comm<strong>and</strong>s load the same package with different options, there is a conflict.<br />

Try <strong>to</strong> arrange for a consistent set. Typing H for help after this<br />

message will print out the two sets of options.<br />

! <strong>LaTeX</strong> Error: \RequirePackage or \LoadClass in Options Section.<br />

These two comm<strong>and</strong>s may not appear in the definition of a class or<br />

package option made with the \DeclareOption comm<strong>and</strong>. Instead, the<br />

option should set some flag or other indica<strong>to</strong>r that is later tested before<br />

calling the comm<strong>and</strong> in question.<br />

! <strong>LaTeX</strong> Error: This file needs format ‘...’ but this is ‘...’.<br />

The \NeedsTeXFormat comm<strong>and</strong> specifies a different format from the<br />

one being used. The format is the pres<strong>to</strong>red set of instructions that<br />

determine what type of T E X is being run. For L AT E X 2ε, the format name<br />

specified must be <strong>LaTeX</strong>2e. This file cannot be processed at all with the<br />

current format in use.


422 Appendix C. Error Messages<br />

! <strong>LaTeX</strong> Error: Two \documentclass or \documentstyle comm<strong>and</strong>s.<br />

A document may contain only one \documentclass or \documentstyle<br />

comm<strong>and</strong>. If you can only see one in the main document file, check that<br />

other files being loaded do not contain an offending second one.<br />

! <strong>LaTeX</strong> Error: Two \LoadClass comm<strong>and</strong>s.<br />

The class file contains more than one \LoadClass comm<strong>and</strong>, something<br />

that is not allowed. The class file has been improperly written.<br />

! <strong>LaTeX</strong> Error: Unknown option ‘...’ for package ‘...’.<br />

An option has been specified with \usepackage but it is not defined<br />

for that package. Check the instructions for the package or look for a<br />

misprint.<br />

! <strong>LaTeX</strong> Error: \usepackage before \documentclass.<br />

The \usepackage comm<strong>and</strong> may not appear before \documentclass. A<br />

class file must be loaded before any packages.<br />

C.3.3 L AT E X font errors<br />

The following error messages occur when defining or selecting fonts with<br />

the New Font Selection Scheme (Appendix A). Some of these messages<br />

indicate that the fonts have not been properly set up, in which case the<br />

font description files may be corrupted or contain mistakes. In either<br />

case, the system manager must see that a proper set of files are installed.<br />

! <strong>LaTeX</strong> Error: ... allowed only in math mode.<br />

A math alphabet comm<strong>and</strong> such as \mathbf has been used in text mode.<br />

Perhaps a $ has been forgotten.<br />

! <strong>LaTeX</strong> Error: Comm<strong>and</strong> ‘...’ not defined as a math alphabet.<br />

The name of a non-existent math alphabet has been specified in one of<br />

the \Set.. or \Declare.. comm<strong>and</strong>s that take a math alphabet name as<br />

argument. The math alphabet name must be declared with the comm<strong>and</strong><br />

\DeclareMathVersion before it may be used.<br />

! <strong>LaTeX</strong> Error: Comm<strong>and</strong> ... not provided in base <strong>LaTeX</strong>2e.<br />

A number of symbols that were part of the basic L AT E X 2.09, but not in T E X,<br />

are no longer au<strong>to</strong>matically included in L AT E X 2ε. Add one of the packages<br />

latexsym or amsfonts <strong>to</strong> include them.<br />

! <strong>LaTeX</strong> Error: \DeclareTextComposite used on inappropriate<br />

comm<strong>and</strong> ....<br />

\DeclareTextComposite (Section A.3.7) is used <strong>to</strong> redefine an existing


C.3. List of L AT E X error messages 423<br />

accenting comm<strong>and</strong> <strong>to</strong> print a single character for a certain encoding. If<br />

the accenting comm<strong>and</strong> does not already exist, this message is issued.<br />

! <strong>LaTeX</strong> Error: Encoding scheme ‘...’ unknown.<br />

A font declaration or selection comm<strong>and</strong> that refers <strong>to</strong> a non-existent<br />

encoding scheme has been issued. There is probably a typing error<br />

involved here.<br />

! <strong>LaTeX</strong> Error: Font family ‘...+...’ unknown.<br />

A \DeclareFontShape comm<strong>and</strong> has been issued for a font encoding<br />

<strong>and</strong> family combination that has not been previously declared by means<br />

of a \DeclareFontFamily comm<strong>and</strong> (Section A.3.6).<br />

! <strong>LaTeX</strong> Error: Font ... not found.<br />

The font with the specified attributes could not be found, nor could an<br />

adequate substitution be made. The font defined by \DeclareErrorFont<br />

is used instead.<br />

! <strong>LaTeX</strong> Error: Math alphabet identifier ... is undefined<br />

in math version ‘...’.<br />

A math alphabet (Section A.3.3) that has not been defined for the current<br />

math version has been invoked. This means that the alphabet has been<br />

created by \DeclareMathAlphabet with an empty shape attribute, but<br />

no \SetMathAlphabet declaration has been given <strong>to</strong> define it for the<br />

selected math version.<br />

! <strong>LaTeX</strong> Error: Math version ‘...’ is not defined.<br />

The name of a non-existent math version has been specified in one of the<br />

\Set... or \Declare... comm<strong>and</strong>s that take a math version name as argument.<br />

The version name must be declared with \DeclareMathVersion<br />

before it may be used.<br />

! <strong>LaTeX</strong> Error: Not a comm<strong>and</strong> name: ‘...’.<br />

The first argument of \DeclareMathAccent must be a comm<strong>and</strong> name,<br />

like \acute. Most likely the backslash \ character has been forgotten.<br />

! <strong>LaTeX</strong> Error: Symbol font ‘...’ not defined.<br />

The name of a non-existent symbol font has been specified in one of<br />

the \Set.. or \Declare.. comm<strong>and</strong>s that take a symbol font name as<br />

argument. The font name must be declared with \DeclareSymbolFont<br />

before it may be used as a symbol font.


424 Appendix C. Error Messages<br />

! <strong>LaTeX</strong> Error: The font size comm<strong>and</strong> \normalsize is not defined:<br />

there is probably something wrong with class file.<br />

It is necessary for class files <strong>to</strong> define \normalsize, the basic size of st<strong>and</strong>ard<br />

text in the document. If the class file does not do this, if it only<br />

defines \@normalsize, then it must be repaired. This message also appears<br />

if \documentclass is missing, for an empty class file is clearly a<br />

faulty one.<br />

! <strong>LaTeX</strong> Error: This NFSS system isn’t set up properly.<br />

Something is wrong with the font descriptions in the.fd files, or there is<br />

no valid font declared by \DeclareErrorFont. This is a serious problem,<br />

<strong>to</strong> be reported <strong>to</strong> the system manager.<br />

! <strong>LaTeX</strong> Error: Too many math alphabets used in version ....<br />

There is a limit of 16 math alphabets possible, a number set by T E X itself.<br />

Any additional math alphabet definitions are ignored.<br />

! <strong>LaTeX</strong> Error: Unknown symbol font ‘...’.<br />

The name of a non-existent symbol font has been used as argument <strong>to</strong><br />

the comm<strong>and</strong> \DeclareSymbolFontAlphabet. The font name must first<br />

be declared with \DeclareSymbolFont before it may be used.<br />

C.4 T E X error messages<br />

This section contains a list of some of the most common T E X error messages,<br />

ordered alphabetically according <strong>to</strong> the error indica<strong>to</strong>r, <strong>to</strong>gether<br />

with a brief description of the possible cause. Each one begins with an<br />

exclamation point only.<br />

! Counter <strong>to</strong>o large.<br />

As a T E X error, this message refers <strong>to</strong> a footnote marked either with letters<br />

or symbols in which the counter has exceeded a value of 26 or 9. It may<br />

also occur if there are <strong>to</strong>o many \thanks comm<strong>and</strong>s on a title page.<br />

! Double subscript.<br />

A mathematical formula contains two subscripts for the same variable,<br />

for example, x_2_3 or x_{2}_{3}. The proper way <strong>to</strong> produce x23 is with<br />

x_{2_3} or x_{2_{3}} (Section 5.2.2).<br />

! Double superscript.<br />

A mathematical formula contains two superscripts for the same variable,<br />

for example, xˆ2ˆ3 or xˆ{2}ˆ{3}. The proper way <strong>to</strong> produce x23 is with<br />

xˆ{2ˆ3} or xˆ{2ˆ{3}} (Section 5.2.2).


! Extra alignment tab has been changed <strong>to</strong> \cr.<br />

C.4. T E X error messages 425<br />

A line in a tabular or array environment contains more & comm<strong>and</strong>s<br />

than there are columns defined. The error is probably due <strong>to</strong> a forgotten<br />

\\ at the end of the previous line.<br />

! Extra }, or forgotten .<br />

In math mode, either an opening brace { has been left off or an extra<br />

closing brace } has been included by mistake. Another possibility is that<br />

a math mode switch comm<strong>and</strong> such as $, \[, or \( has been forgotten.<br />

! Font ... not loaded: Not enough room left.<br />

The text processing requires more character fonts <strong>to</strong> be loaded than T E X<br />

can h<strong>and</strong>le owing <strong>to</strong> memory limitations. If certain parts of the document<br />

need different fonts, you can try <strong>to</strong> split it up <strong>and</strong> <strong>to</strong> process the parts<br />

separately.<br />

! Illegal parameter number in definition of ....<br />

This error message is probably due <strong>to</strong> a \newcomm<strong>and</strong>, \newenvironment,<br />

\renewcomm<strong>and</strong>, or \renewenvironment comm<strong>and</strong> in which the substitution<br />

character # has been applied incorrectly. This character may appear<br />

within the defining text only in the form #n, where n is a number between<br />

1 <strong>and</strong> the number of arguments specified in the comm<strong>and</strong>. Otherwise<br />

the character # may only appear in the definition as \#. This error may<br />

also arise if the substitution character is applied within the last argument<br />

{end def } (Section 8.4).<br />

! Illegal unit of measure (pt inserted).<br />

If this error message comes right after another error with the message<br />

! Missing number, treated as zero.<br />

the problem lies with this previous error (see below). Otherwise, the<br />

mistake is that T E X expects a length specification at this point but has<br />

only been given a number without a length unit. This occurs most often<br />

when a length is <strong>to</strong> be set <strong>to</strong> zero <strong>and</strong> 0 has been typed in instead of 0mm or<br />

0pt. If this is the case, then responding with 〈return〉 produces the right<br />

result since for a zero value any unit specification is all right. This error<br />

may also occur if a length specification has been completely forgotten.<br />

! Misplaced alignment tab character &.<br />

The single character comm<strong>and</strong> & has been given in normal text outside of<br />

the tabular <strong>and</strong> array environments. Possibly the intention was <strong>to</strong> print<br />

&, in which case \& should be typed. This may still be achieved during<br />

the processing by responding with I\& <strong>to</strong> the error message.


426 Appendix C. Error Messages<br />

! Missing control sequence inserted.<br />

This error is most likely caused by a \newcomm<strong>and</strong>, \renewcomm<strong>and</strong>,<br />

\newlength, or \newsavebox comm<strong>and</strong> in which the backslash \ is missing<br />

from the first argument. Pressing 〈return〉 as response will complete<br />

the processing correctly since T E X assumes a backslash is missing <strong>and</strong><br />

inserts it.<br />

! Missing number, treated as zero.<br />

This error is most likely due <strong>to</strong> a L AT E X comm<strong>and</strong> that expects a number or<br />

length as argument, which is missing. It may also occur when a comm<strong>and</strong><br />

that takes an optional argument is followed by text beginning with [.<br />

Finally another cause can be a \protect comm<strong>and</strong> preceding a length or<br />

\value comm<strong>and</strong>.<br />

! Missing { inserted.<br />

! Missing } inserted.<br />

T E X is <strong>to</strong>tally confused when either of these error indica<strong>to</strong>rs is written.<br />

The line number printed will probably not be where the source of the<br />

error is <strong>to</strong> be found, which is a missing opening or closing brace. If the<br />

error is not obvious, continue the processing by pressing 〈return〉 <strong>and</strong> try<br />

<strong>to</strong> deduce where it might be from the printed output.<br />

! Missing inserted.<br />

Most likely a symbol or comm<strong>and</strong> that may only appear in math mode<br />

was used in normal text. Recall that all those comm<strong>and</strong>s described in<br />

Chapter 5 are only allowed in math mode unless otherwise stated. If<br />

an \mbox comm<strong>and</strong> is inserted within a math formula, its argument has<br />

temporarily exited from math <strong>to</strong> normal text mode. The message may<br />

also occur if a blank line appears within a math formula, signalling a new<br />

paragraph <strong>and</strong> the end of the formula without the necessary $ sign.<br />

! Not a letter.<br />

The word list in a \hyphenation comm<strong>and</strong> contains a character that is<br />

not recognized as a letter, such as an accent comm<strong>and</strong> like \’{e}. Such<br />

words can only be hyphenated by explicitly inserting the hyphenation<br />

possibilities (Sections 2.8.1 <strong>and</strong> 2.8.2).<br />

! Paragraph ended before ... was complete.<br />

The argument of a comm<strong>and</strong> contains a blank line or a \par comm<strong>and</strong>,<br />

something that is not allowed. Probably a closing brace } has been<br />

omitted.<br />

! TeX capacity exceeded, sorry [...].<br />

T E X sets up various s<strong>to</strong>rage buffers in the computer memory <strong>to</strong> carry out


C.4. T E X error messages 427<br />

the text processing. This message appears when one of these buffers is<br />

full <strong>and</strong> can no longer be used. The name of the buffer <strong>and</strong> its maximum<br />

size are printed in the square brackets of the error indica<strong>to</strong>r. With this<br />

message, the T E X processing is terminated. The source of this problem is<br />

hardly ever due <strong>to</strong> insufficient memory, no matter how much complicated<br />

text is being processed, but rather <strong>to</strong> an error in the text itself. The<br />

methods described in Section C.6 may be applied <strong>to</strong> try <strong>to</strong> detect the true<br />

error.<br />

The following descriptions of the various buffers should help <strong>to</strong> decide<br />

whether the s<strong>to</strong>rage capacity allotted <strong>to</strong> T E X really is <strong>to</strong>o small <strong>and</strong> <strong>to</strong><br />

explain what one might do <strong>to</strong> correct this.<br />

buffer size The problem here can be that the text in the argument of a sectioning,<br />

\caption, \addcontentsline, or \add<strong>to</strong>contents comm<strong>and</strong> is<br />

<strong>to</strong>o long. The message then normally appears when the \end{document}<br />

comm<strong>and</strong> is processed, but may also arise at one of \tableofcontents,<br />

\lis<strong>to</strong>ffigures, or \lis<strong>to</strong>ftables. The way <strong>to</strong> avoid this is <strong>to</strong> use the<br />

optional argument for the short form of the heading text (Sections 3.3.3<br />

<strong>and</strong> 7.4). Indeed, such a long entry in the table of contents is a nuisance<br />

anyway <strong>and</strong> should be shortened. After the correction has been made in the<br />

input text, the previous L AT E X.aux file must be deleted before reprocessing.<br />

This problem can occur on a PC if a word processing program has been<br />

used <strong>to</strong> generate the input text instead of a text edi<strong>to</strong>r. Some of these<br />

programs put an entire paragraph in<strong>to</strong> a single line even though the text<br />

on the moni<strong>to</strong>r is broken up in<strong>to</strong> lines.<br />

exception dictionary The list of hyphenation exceptions that have been entered<br />

with the \hyphenation comm<strong>and</strong>s has become <strong>to</strong>o large. Words<br />

used less frequently should be removed <strong>and</strong> their possible word divisions<br />

indicated explicitly with the \- comm<strong>and</strong>.<br />

hash size The source file contains <strong>to</strong>o many comm<strong>and</strong> definitions or uses <strong>to</strong>o<br />

many cross-reference markers. This does not mean that the input text<br />

really needs all these comm<strong>and</strong>s, for it may be that the user has developed<br />

a large collection of private comm<strong>and</strong>s that are s<strong>to</strong>red in a single file <strong>and</strong><br />

read in<strong>to</strong> every document, whether they are all applicable or not.<br />

input stack size An overflow of this buffer is probably due <strong>to</strong> a mistake in a<br />

comm<strong>and</strong> definition. For example, the comm<strong>and</strong> defined with<br />

\newcomm<strong>and</strong>{\com}{One more \com}<br />

produces One more {One more {...One more \com}...}} going on for<br />

ever, since it continually calls itself. Actually, it does not go on for ever,<br />

but only until this buffer is full.<br />

main memory size This buffer contains the text for the page currently being<br />

processed. It also overflows if a recursively defined comm<strong>and</strong> has been<br />

called. However, the more usual reasons are: (1) a large number of very<br />

complicated comm<strong>and</strong>s have been defined on one page; (2) there are <strong>to</strong>o


428 Appendix C. Error Messages<br />

many \index or \glossary comm<strong>and</strong>s on one page; (3) the page itself is<br />

<strong>to</strong>o complex <strong>to</strong> fit within the allotted buffer space.<br />

The solution <strong>to</strong> the first two situations is clear: reduce the number of<br />

comm<strong>and</strong> definitions <strong>and</strong>/or \index <strong>and</strong> \glossary comm<strong>and</strong>s on that<br />

page. In the third case, the cause might be a long tabbing, tabular,<br />

array, or picture environment, or a stuck float (figure or table) waiting<br />

for an output comm<strong>and</strong>.<br />

To find out whether the memory overflow is really due <strong>to</strong> an overly complex<br />

page, add the comm<strong>and</strong> \clearpage just before the spot where the<br />

overflow occurs. If the error message no longer appears on the next processing<br />

run, then this page was indeed <strong>to</strong>o complicated for T E X. However,<br />

if the overflow still persists, the error is probably a mistake in the input<br />

text. If necessary, it may have <strong>to</strong> be located with the method explained in<br />

Section C.6.<br />

If the page really is <strong>to</strong>o complex for the T E X processing, it must be simplified.<br />

However, first recall that the entire last paragraph is processed before that<br />

page is output, even if the page break occurs near the beginning of the<br />

paragraph. Introducing a \newpage may solve the problem <strong>and</strong> should<br />

be tried out before attempting a tedious restructuring of the text. If the<br />

error is due <strong>to</strong> a stuck figure or table, it might be alleviated by moving the<br />

float object <strong>to</strong> later in the text, or by changing the positioning argument<br />

(Section 7.1). If the whole text is not yet complete, one can try giving<br />

\clearpage for now in order <strong>to</strong> clear the blocked floats <strong>and</strong> then decide<br />

on a better ordering when the text is finalized.<br />

pool size Most likely there are <strong>to</strong>o many comm<strong>and</strong> definitions <strong>and</strong>/or labels,<br />

or their names are <strong>to</strong>o long. Try shortening the names. This error may<br />

also occur if a closing right brace } has been forgotten in the argument<br />

of a counter comm<strong>and</strong> such as \setcounter or in a \newenvironment or<br />

\newtheorem comm<strong>and</strong>.<br />

save size This buffer overflows when comm<strong>and</strong>s, environments, <strong>and</strong> the scope<br />

of declarations are nested <strong>to</strong>o deeply. For example, if the argument of a<br />

\multiput comm<strong>and</strong> contains a picture environment, which in turn possesses<br />

a \footnotesize declaration with another \multiput comm<strong>and</strong>,<br />

<strong>and</strong> so on. Such a nesting must be simplified, unless the real problem<br />

is a forgotten closing brace } that merely makes the structure appear so<br />

complex.<br />

! Text line contains an invalid character.<br />

The input text contains a strange symbol that T E X does not recognize.<br />

This could be a problem with the edi<strong>to</strong>r itself, that it is inserting extra<br />

characters. If an examination of the source file does not reveal the strange<br />

symbol, consult the computing center for help.<br />

! Undefined control sequence.<br />

Every T E X user encounters this error message at some point. It is usually


C.5. Warnings 429<br />

the result of an incorrectly typed comm<strong>and</strong> name. It may be amended<br />

during the processing by responding with I <strong>and</strong> the proper name of the<br />

comm<strong>and</strong>, plus 〈return〉. This does not alter the source file, which must<br />

be corrected separately after the L AT E X run. If the comm<strong>and</strong> name has<br />

been entered correctly in a L AT E X comm<strong>and</strong>, it may be that it was issued<br />

in an improper environment where it is not allowed (that is, not defined<br />

there).<br />

! Use of ... doesn’t match its definition.<br />

If ‘...’ is the name of a L AT E X comm<strong>and</strong>, it is likely that one of the<br />

picture comm<strong>and</strong>s from Sections 13.1.3 <strong>and</strong> 13.1.4 has been called with<br />

the wrong syntax for its arguments. If the name is \@array, there is a<br />

faulty @-expression (Section 4.8.1) in a tabular or array environment.<br />

Possibly a fragile comm<strong>and</strong> was given in the @-expression without the<br />

\protect comm<strong>and</strong> preceding it.<br />

! You can’t use ‘macro parameter #’ in ... mode.<br />

The special symbol # has been used in normal text. Probably there should<br />

have been a \# in order <strong>to</strong> print # itself. This can be corrected during the<br />

processing with the response I\# <strong>and</strong> 〈return〉.<br />

C.5 Warnings<br />

T E X <strong>and</strong> L AT E X errors both bring the processing run <strong>to</strong> a temporary s<strong>to</strong>p <strong>and</strong><br />

wait for a reaction from the user, or they may halt the program completely.<br />

Warnings, on the other h<strong>and</strong>, merely inform the user that the processed<br />

output may contain some faults that he or she might want <strong>to</strong> correct.<br />

Warnings appear on the moni<strong>to</strong>r along with the page number where they<br />

occur, without the program coming <strong>to</strong> a s<strong>to</strong>p. They are also written <strong>to</strong><br />

the .log file where they may be examined after the L AT E X processing <strong>and</strong><br />

possible printing. Warnings may be issued either by L AT E X or by T E X itself.<br />

C.5.1 General L AT E X warnings<br />

L AT E X warnings are indicated by the words ‘<strong>LaTeX</strong> Warning:’ at their start,<br />

followed by the warning message itself.<br />

<strong>LaTeX</strong> Warning: Citation ‘...’ on page ... undefined on<br />

input line ....<br />

The key in a \cite or other citation comm<strong>and</strong> has not yet been defined<br />

with a corresponding \bibitem comm<strong>and</strong> (Section 9.3). If this message<br />

does not disappear on the next run, then the bibliography is missing


430 Appendix C. Error Messages<br />

that defining \bibitem entry, either because BIBT E X has not been run, or<br />

because that reference is not in any of the specified databases.<br />

<strong>LaTeX</strong> Warning: Comm<strong>and</strong> ... has changed.<br />

Check if current package is valid.<br />

The \CheckComm<strong>and</strong> statement is used <strong>to</strong> test if a given comm<strong>and</strong> has a<br />

certain definition. This warning is issued if the test fails. This is used <strong>to</strong><br />

be sure that a given package is doing what the programmer thinks it is<br />

doing.<br />

<strong>LaTeX</strong> Warning: Float <strong>to</strong>o large for page by ..pt on input line...<br />

A float (figure or table environment) is <strong>to</strong>o big <strong>to</strong> fit on the page. It will<br />

be printed anyway, but will extend beyond the normal page margins.<br />

<strong>LaTeX</strong> Warning: ‘h’ float specifier changed <strong>to</strong> ‘ht’.<br />

The float placement specifier ‘h’ for ‘here’ (Section 7.1) does not really<br />

mean exactly at the location of the float environment. It will be placed<br />

‘here’ only if there is enough room remaining on the page for it, otherwise<br />

it appears at the <strong>to</strong>p of the next available page. This message is a reminder<br />

of this fact.<br />

<strong>LaTeX</strong> Warning: inputting ‘...’ instead of obsolete ‘...’.<br />

Some packages written for L AT E X 2.09 explicitly input certain files, such<br />

as article.sty, that have a new equivalent with a different name (in<br />

this case article.cls). Dummy files with the old names that issue this<br />

message <strong>and</strong> input the right file are provided.<br />

<strong>LaTeX</strong> Warning: Label ‘...’ multiply defined.<br />

Two \label or \bibitem comm<strong>and</strong>s have defined keys with the same<br />

name (Sections 9.2.1 <strong>and</strong> 9.3). Even after the correction has been made,<br />

this message will be printed once more <strong>to</strong> the moni<strong>to</strong>r since the information<br />

that led <strong>to</strong> it is <strong>to</strong> be found in the .aux file from the last processing<br />

run. On the run after that, it should be gone.<br />

<strong>LaTeX</strong> Warning: Label(s) may have changed.<br />

Rerun <strong>to</strong> get cross-references right.<br />

The printed outputs from the \ref, \pageref, <strong>and</strong> \cite comm<strong>and</strong>s may<br />

be incorrect since their values have been altered during the processing.<br />

L AT E X must be run once more so that the right values are used.<br />

<strong>LaTeX</strong> Warning: Marginpar on page ... moved.<br />

A marginal note on the given page has been shifted downwards <strong>to</strong> prevent<br />

it from being <strong>to</strong>o close <strong>to</strong> another one. This means that it will not be beside<br />

the line of text where the \marginpar comm<strong>and</strong> was actually given.


<strong>LaTeX</strong> Warning: No \author given.<br />

C.5. Warnings 431<br />

The \maketitle comm<strong>and</strong> has been issued without a previous \author<br />

comm<strong>and</strong>. Unlike a missing \title comm<strong>and</strong>, this is not an error, but<br />

merely peculiar. The warning is printed just in case you did mean <strong>to</strong><br />

specify an author.<br />

<strong>LaTeX</strong> Warning: Optional argument of \twocolumn <strong>to</strong>o tall on page.<br />

The \twocolumn comm<strong>and</strong> (Section 3.2.7) starts a new page <strong>and</strong> switches<br />

<strong>to</strong> two-column formatting. The text in the optional argument is printed<br />

in one wide column above the double column text. If that text is <strong>to</strong>o large<br />

<strong>to</strong> fit on<strong>to</strong> one page, this warning is printed.<br />

<strong>LaTeX</strong> Warning: \oval, \circle, or \line size unavailable on<br />

input line ....<br />

The size specified for an \oval, \circle, or slanted \line comm<strong>and</strong> in<br />

a picture environment is <strong>to</strong>o small for L AT E X <strong>to</strong> print.<br />

<strong>LaTeX</strong> Warning: Reference ‘...’ on page ... undefined on<br />

input line ....<br />

The marker name in a \ref or \pageref comm<strong>and</strong> has not been defined<br />

by a \label comm<strong>and</strong> in the previous processing run (Section 9.2.1).<br />

If this message does not disappear on the next run, the corresponding<br />

\label comm<strong>and</strong> is missing.<br />

<strong>LaTeX</strong> Warning: Text page ... contains only floats.<br />

This message points out that the float style parameters (Section 7.3) have<br />

excluded any regular text from appearing on the specified page. This is<br />

not necessarily bad, but you might want <strong>to</strong> check that page visually.<br />

<strong>LaTeX</strong> Warning: There were multiply-defined labels.<br />

This message is printed at the end of the L AT E X run if there were any<br />

\label or \bibitem comm<strong>and</strong>s that used the same marker name more<br />

than once. A warning is also printed near the beginning of the run for<br />

each repeated marker name.<br />

<strong>LaTeX</strong> Warning: There were undefined references.<br />

This message is printed at the end of the L AT E X run if there were any \ref<br />

or \pageref comm<strong>and</strong>s whose markers had not been defined during a<br />

previous run. A warning is also printed earlier for each undefined marker<br />

used. If it does not disappear on the next run, then the corresponding<br />

\label is missing, maybe due <strong>to</strong> a typing error in the marker text.


432 Appendix C. Error Messages<br />

C.5.2 L AT E X package warnings<br />

The class <strong>and</strong> package warnings are those that check the names <strong>and</strong><br />

versions of the loaded files against those requested, or the use of options,<br />

or whether the filecontents environment has written some text <strong>to</strong> a<br />

file. The comm<strong>and</strong>s involved are described in Section D.2.9.<br />

Classes <strong>and</strong> packages can also issue their own warnings which are<br />

peculiar <strong>to</strong> them. These cannot be listed here, since they depend entirely<br />

on the class or package itself.<br />

<strong>LaTeX</strong> Warning: File ‘...’ already exists on the system.<br />

Not generating it from this source.<br />

The filecontents environment is not extracting text from the main file<br />

because it has discovered a file of the same name already on the system.<br />

<strong>LaTeX</strong> Warning: Unused global option(s):.<br />

Options specified in the \documentclass statement are global, meaning<br />

they can apply <strong>to</strong> the class <strong>and</strong>/or <strong>to</strong> any following packages. However,<br />

if no class or package recognizes any of these options, this warning is<br />

printed, followed by a list of the unused options.<br />

<strong>LaTeX</strong> Warning: Writing file ‘...’.<br />

The filecontents environment (Section D.2.9) is extracting text out of<br />

the main file <strong>and</strong> writing it <strong>to</strong> a file of the given name.<br />

<strong>LaTeX</strong> Warning: You have requested class/package ‘...’,<br />

but the class/package provides ‘...’.<br />

The name of the class or package as given by its internal identifying<br />

comm<strong>and</strong> \ProvidesClass or \ProvidesPackage does not agree with<br />

the file that was read in with \usepackage or \RequirePackage.<br />

<strong>LaTeX</strong> Warning: You have requested, on input line ..., version<br />

‘...’ of class/package ...,<br />

but only version ‘...’ is available.<br />

The date of a class or package file, as given by its internal identifying<br />

comm<strong>and</strong> \ProvidesClass or \ProvidesPackage, is earlier than that<br />

asked for by the \usepackage or \RequirePackage comm<strong>and</strong>. The class<br />

or package may not have all the features that the inputting file expects.<br />

<strong>LaTeX</strong> Warning: You have requested release ‘...’ of <strong>LaTeX</strong>,<br />

but only release ‘...’ is available.<br />

The date of your L AT E X version is earlier than that specified for some input<br />

file in a \NeedsTeXFormat comm<strong>and</strong> (Section D.2.1). Your L AT E X may not<br />

provide all the features needed by that file.


C.5.3 L AT E X font warnings<br />

C.5. Warnings 433<br />

Font warnings are those involving the NFSS comm<strong>and</strong>s (Appendix A). They<br />

are indicated by the text: <strong>LaTeX</strong> Font Warning: plus the warning text.<br />

<strong>LaTeX</strong> Font Warning: Comm<strong>and</strong> ... invalid in math mode.<br />

A comm<strong>and</strong> that should only appear in text mode has been given in math<br />

mode. The comm<strong>and</strong> is simply ignored. The comm<strong>and</strong>s \mathversion,<br />

\boldmath, \unboldmath, <strong>and</strong> \em lead <strong>to</strong> this message. There are other<br />

comm<strong>and</strong>s that produce an error message with the same text.<br />

<strong>LaTeX</strong> Font Warning: Comm<strong>and</strong> \tracingfonts not provided.<br />

(Font) Use the ‘tracefnt’ package.<br />

(Font) Comm<strong>and</strong> found: on input line ....<br />

The font tracing diagnostic <strong>to</strong>ol \tracingfonts may only be used if the<br />

tracefnt package (page 393) has been loaded. Otherwise, this comm<strong>and</strong><br />

is ignored.<br />

<strong>LaTeX</strong> Font Warning: Encoding ‘...’ has changed <strong>to</strong> ‘...’ for<br />

(Font) symbol font ‘...’ in the math version ‘...’.<br />

To make use of the specified symbol font in the given math version, it was<br />

necessary <strong>to</strong> change the font encoding temporarily.<br />

<strong>LaTeX</strong> Font Warning: Font shape ‘...’in size not available<br />

(Font) size substituted.<br />

No font has been defined for the size <strong>and</strong> shape requested, so a substitute<br />

size is used instead.<br />

<strong>LaTeX</strong> Font Warning: Font shape ‘...’ undefined<br />

(Font) using ‘...’ instead.<br />

The shape attribute that has been requested is unknown, or has not been<br />

defined, so a substitute shape will be used instead.<br />

C.5.4 T E X warnings<br />

A T E X warning is recognized by the fact that it is not an error message<br />

(not prefixed with !) <strong>and</strong> that the processing is not halted. The most<br />

common T E X warnings are:<br />

Overfull \hbox ....<br />

T E X could not break this line in a reasonable way so part of it will extend<br />

in<strong>to</strong> the right margin. The rest of the information in the message can be<br />

of assistance.


434 Appendix C. Error Messages<br />

!<br />

For example, with the complete warning message<br />

Overfull \hbox (17.2122pt <strong>to</strong>o wide) in paragraph at lines 4--6<br />

[]\OT1/cmr/m/n/10 If T[]X can-not find an ap-pro-pri-ate<br />

spot <strong>to</strong> di-vide a word at the end of the line, as right<br />

here aaaaaaaaaaaaaaaaaaaaaaaaaa<br />

one knows that the line is about 17.2 pt (6 mm) <strong>to</strong>o long <strong>and</strong> extends this amount<br />

in<strong>to</strong> the right-h<strong>and</strong> margin. The line is part of the paragraph in lines 4 <strong>to</strong> 6. The<br />

font used is designated by its attributes \OT1\cmr/m/n/10. The text of the problem<br />

line is If ... ... right here aaaaaaaaaaaaaaaaaaaaaaaaaa. Possible<br />

word divisions are shown with hyphens, such as di-vide. The last word<br />

cannot be divided, which is the cause of the problem.<br />

A way around this is <strong>to</strong> include some suggested hyphenations with the \comm<strong>and</strong>,<br />

such as aaaaaaaaa\-aaaaaaaaaaaaaa. Similarly, a \linebreak comm<strong>and</strong><br />

before the problem word, or setting the whole paragraph in a sloppypar<br />

environment, will get rid of this warning message.<br />

If a badly broken line extends only a tiny bit in<strong>to</strong> the right margin, say<br />

1 pt or less, in most cases this will hardly be noticed <strong>and</strong> may be left as<br />

it is. A sample output should be printed just <strong>to</strong> verify the appearance.<br />

Overfull \vbox ....<br />

This warning occurs very rarely. T E X could not break the page properly<br />

so that the text extends beyond the bot<strong>to</strong>m of the page. More often T E X<br />

sets less text on a page than <strong>to</strong>o much. Thus this warning arises only<br />

when the page contains a very large vertical box, higher than the value of<br />

\textheight, such as a long table.<br />

Underfull \hbox ....<br />

This is the opposite of the Overfull \hbox warning. It appears when<br />

T E X has filled a line right <strong>and</strong> left justified, but with so much interword<br />

spacing that it considers the appearance <strong>to</strong> be undesirable. This is often<br />

the result of a sloppypar environment, a \sloppy declaration, or a<br />

\linebreak comm<strong>and</strong>. It may also come about after an inappropriate<br />

application of a \\ or \newline comm<strong>and</strong>, such as two \\ comm<strong>and</strong>s<br />

one after the other. The additional information in the warning message<br />

contains the text of the badly formatted line plus an evaluation of the<br />

‘badness’ of the word spacing.<br />

If in the example of the Overfull \hbox a \linebreak is included in the<br />

! text at the spot ..., as right\linebreak here, then the warning becomes<br />

Underfull \hbox (badness 5504) in paragraph at lines 4--6<br />

[]\OT1/cmr/m/n/10 If T[]X can-not find an ap-pro-pri-ate<br />

spot <strong>to</strong> di-vide a word at the end of the line, as right<br />

which states that the paragraph in lines 4 <strong>to</strong> 6 contains an output line in which<br />

the interword spacing may be unacceptably wide. The text of this line reads If<br />

... ..., as right <strong>and</strong> is set in the font \OT1/cmr/m/n/10. The evaluation


C.6. Search for subtle errors 435<br />

badness 5504 is T E X’s estimate of how unacceptable the spacing is: the smaller<br />

this number the better.<br />

Underfull \vbox ....<br />

The page has been broken with head <strong>and</strong> foot justified, but T E X judges<br />

the amount of inter-paragraph spacing <strong>to</strong> be possibly unacceptable. The<br />

badness number here corresponds <strong>to</strong> the quantity with the same name<br />

from the Underfull \hbox warning.<br />

C.6 Search for subtle errors<br />

At some point or another you will encounter an error message for which<br />

you cannot identify any cause, try as you may. For such devious errors,<br />

we recommend the following search strategy:<br />

1. Copy the file twice in<strong>to</strong> a previous <strong>and</strong> a working copy (in addition<br />

<strong>to</strong> the original, which remains un<strong>to</strong>uched during this search).<br />

2. In the working copy, find the outermost environment where the error<br />

occurred <strong>and</strong> remove one or more inner environments. If there are<br />

no inner environments, shorten the remaining text. Process the file<br />

with L AT E X once more.<br />

3. If the error still occurs, copy the shortened working copy <strong>to</strong> the<br />

previous copy <strong>and</strong> repeat step 2. If the outer environment in step<br />

2 is \begin{document} ... \end{document}, the shortening may<br />

be carried out by simply inserting \end{document} at some earlier<br />

point.<br />

4. If the error is no longer in the shortened working copy, copy the<br />

previous copy back <strong>to</strong> the working copy. The error is still present in<br />

this version. Remove less of the text than last time <strong>and</strong> repeat steps<br />

2 <strong>to</strong> 4.<br />

5. If the error is found <strong>to</strong> be in the next innermost environment, repeat<br />

the procedure for this environment with steps 2 <strong>to</strong> 4.<br />

With this strategy, the error may be localized <strong>to</strong> one comm<strong>and</strong> or <strong>to</strong> the<br />

innermost environment with only a small remaining structure. If the<br />

error still cannot be identified in spite of its being precisely localized,<br />

seek help from a more experienced colleague or from the computing<br />

center. However, it is normally possible <strong>to</strong> recognize the mistake once the<br />

position of the error has been found.<br />

It does happen that even though the error has been corrected, the same<br />

error message appears on the next L AT E X process run. This is because of<br />

the internal transfer in information through the L AT E X auxiliary files, which


436 Appendix C. Error Messages<br />

are always one run behind on the current situation. For example, if there<br />

is a mistake in one of the sectioning comm<strong>and</strong>s, then after it has been<br />

eliminated, the faulty entry still exists in the .<strong>to</strong>c file. If the document<br />

contains the \tableofcontents comm<strong>and</strong>, L AT E X will read in that .<strong>to</strong>c<br />

file on the next run, <strong>and</strong> issue the error message once more, since a new<br />

.<strong>to</strong>c file is only created after a successful processing.<br />

In this case, the .<strong>to</strong>c file should also be edited <strong>and</strong> the error removed.<br />

If that is not possible, the file should be erased <strong>and</strong> the corrected<br />

source file processed twice with L AT E X. If the error was in \caption,<br />

\addcontentsline, or \add<strong>to</strong>contents, the same applies <strong>to</strong> the corresponding.lof<br />

or.lot file.<br />

Occasionally the .aux file itself must be erased <strong>to</strong> prevent an error in<br />

it from being repeated even after the .tex file has been repaired. Here<br />

one must be careful that the comm<strong>and</strong> \nofiles has not been given in<br />

the preamble, for then a corrected .aux file will not be generated after a<br />

further L AT E X process run.


D<br />

LAT E X Programming<br />

In this appendix, we present the special comm<strong>and</strong>s that were designed<br />

for class <strong>and</strong> package files, with several examples of useful packages. We<br />

also explain the system for integrating documentation with coding in a<br />

single file, the system used for the core L AT E X files <strong>and</strong> st<strong>and</strong>ard packages.<br />

D.1 Class <strong>and</strong> package files<br />

D.1.1 The L AT E X concept, an open system<br />

The wealth of contributed L AT E X programming was probably never anticipated<br />

by Leslie Lamport when he released L AT E X. It is now a fact of life,<br />

<strong>and</strong> indeed one of the great strengths of the system. The L AT E X Team<br />

not only accommodates such ‘foreign’ extensions, it actually supports<br />

<strong>and</strong> encourages them, as witnessed by the copious presentations of such<br />

packages in The L AT E X Companion (Goossens et al., 1994) as well as in this<br />

book.<br />

And this is the way it should be. The extensions have been written by<br />

people who needed them, who realized that L AT E X was missing something<br />

vital for them. On the other h<strong>and</strong>, <strong>to</strong> add all of them <strong>to</strong> the basic L AT E X<br />

installation would overload it with features that 90% of the users would<br />

never require. The philosophy now is that L AT E X provides a fundamental<br />

core, or kernel, which is extended first by the st<strong>and</strong>ard class files, <strong>and</strong><br />

then by the myriad of contributed packages <strong>and</strong> other classes.<br />

It is the role of the L AT E X Team <strong>to</strong> establish guidelines for programming,<br />

<strong>to</strong> ensure that packages do not clash needlessly with the kernel, or with<br />

each other, <strong>and</strong> <strong>to</strong> provide a basis of stability so that useful packages continue<br />

<strong>to</strong> operate through further updates <strong>to</strong> the kernel <strong>and</strong> the st<strong>and</strong>ard<br />

classes. These L AT E X features for class <strong>and</strong> package control, <strong>to</strong>gether with<br />

a set of programming <strong>to</strong>ols, offers an enhanced degree of reliability <strong>and</strong><br />

durability, both among packages <strong>and</strong> against future updates of the kernel.<br />

437


438 Appendix D. L AT E X Programming<br />

D.1.2 Levels of comm<strong>and</strong>s<br />

There are a number of levels of comm<strong>and</strong>s with varying degrees of security<br />

for the future:<br />

user comm<strong>and</strong>s (highest level) described in this <strong>and</strong> the other manuals,<br />

consisting of lower case letters, such as \texttt, are part of the<br />

L AT E X external definition <strong>to</strong> be supported forever;<br />

class <strong>and</strong> package comm<strong>and</strong>s with longish names of mixed upper <strong>and</strong><br />

lower cases (like \NeedsTeXFormat) are intended mainly for programmers,<br />

<strong>and</strong> are also guaranteed; most are preamble-only comm<strong>and</strong>s,<br />

but there is otherwise no real restriction <strong>to</strong> class <strong>and</strong> package<br />

files;<br />

internal L AT E X comm<strong>and</strong>s containing the character @ in their names can<br />

only be used in class <strong>and</strong> package files; they are not guaranteed<br />

forever, although many of them are indispensable for special effects;<br />

a programmer makes use of them at the risk that some day his or<br />

her package may become obsolete;<br />

low-level T E X comm<strong>and</strong>s also have names with lower case letters, <strong>and</strong> no<br />

@; they should be safe against future evolution of L AT E X, but even this<br />

is not absolutely certain; they should be avoided where possible, as<br />

explained below;<br />

internal private comm<strong>and</strong>s are those used within a contributed class or<br />

package file; it is recommended that they all be prefixed with some<br />

upper case letters representing the package name <strong>and</strong> @ in order <strong>to</strong><br />

avoid clashes with other packages; for example, \SK@cite, from the<br />

showkeys package.<br />

A question that confronts L AT E X programmers is <strong>to</strong> what extent the<br />

internal L AT E X comm<strong>and</strong>s may be used in class <strong>and</strong> package files. There is<br />

always a danger that such comm<strong>and</strong>s may vanish in later versions, since<br />

they have never been documented in the official books (Lamport, 1985,<br />

1994; Goossens et al., 1994). Like the T E X comm<strong>and</strong>s discussed in the<br />

next section, their use cannot be forbidden, but one must be aware that a<br />

certain degree of risk will accompany them.<br />

The guidelines issued by the L AT E X Team strongly recommend employing<br />

the high-level L AT E X comm<strong>and</strong>s whenever possible.<br />

• Use \newcomm<strong>and</strong> <strong>and</strong> \renewcomm<strong>and</strong> instead of \def; if one of<br />

the T E X defining comm<strong>and</strong>s must be used, because a template is<br />

required, or because it must be \gdef or \xdef, issue a dummy<br />

\newcomm<strong>and</strong> beforeh<strong>and</strong> <strong>to</strong> test for a name clash. If it is unimportant<br />

whether the comm<strong>and</strong> name already exists, issue a dummy


D.1. Class <strong>and</strong> package files 439<br />

\providecomm<strong>and</strong> followed by \renewcomm<strong>and</strong>. The ability <strong>to</strong> define<br />

comm<strong>and</strong>s with one optional argument at the high level removes<br />

one reason for wanting <strong>to</strong> reach down <strong>to</strong> the lower ones.<br />

• Use \newenvironment <strong>and</strong> \renewenvironment instead of defining<br />

\myenv <strong>and</strong> \endmyenv.<br />

• Assign values <strong>to</strong> lengths <strong>and</strong> glues (rubber lengths) with the<br />

\setlength comm<strong>and</strong>, rather than by simply equating.<br />

• Avoid the T E X box comm<strong>and</strong>s \setbox, \hbox, <strong>and</strong> \vbox; use instead<br />

\sbox, \mbox, \parbox <strong>and</strong> the like. With the extra L AT E X<br />

optional arguments, the need for the T E X equivalents is greatly diminished,<br />

<strong>and</strong> the L AT E X versions are far more transparent. Moreover,<br />

the L AT E X boxes will function properly with the color package, while<br />

the others are unpredictable.<br />

• Issue error <strong>and</strong> warning messages with \PackageError <strong>and</strong><br />

\PackageWarning rather than with \@latexerr or \@warning; the<br />

former also inform the user of the source of the message, instead<br />

of labeling them all as L AT E X messages.<br />

• There is no suggestion that one should exclusively use the<br />

\ifthenelse comm<strong>and</strong> from the ifthen package (Section 8.3.5)<br />

in place of the T E X conditionals. It seems that this package is offered<br />

<strong>to</strong> simplify employing conditionals, in a manner more consistent<br />

with L AT E X syntax. Although most of the examples in this book use<br />

it rather than the T E X versions, we never employ it ourselves in our<br />

own programming.<br />

Adhering <strong>to</strong> these <strong>and</strong> similar rules will help ensure that a package will<br />

remain fit through future extensions of the L AT E X kernel.<br />

D.1.3 T E X comm<strong>and</strong>s<br />

Why should primitive T E X comm<strong>and</strong>s be shunned? To define comm<strong>and</strong>s<br />

with \def rather than \newcomm<strong>and</strong> must be just as good, <strong>and</strong> is often<br />

unavoidable. Is there really a chance that it might be removed from a<br />

future L AT E X version? The primitives are the building blocks on which all<br />

flavors of L AT E X are constructed. Surely they must remain!<br />

This is not really the point. The primitive T E X comm<strong>and</strong>s form the<br />

bedrock of any format, <strong>and</strong> anything defined with them will always do<br />

exactly what the programmer expected. However, the equivalent L AT E X<br />

<strong>to</strong>ols could actually do more as time goes on. The \newcomm<strong>and</strong> checks<br />

for name clashes with existing comm<strong>and</strong>s, for example. It might even be<br />

possible that a debugging device that keeps track of all redefinitions could<br />

be added later; any comm<strong>and</strong>s defined with \def would be excluded from


440 Appendix D. L AT E X Programming<br />

such a scheme. Even now there is something like this <strong>to</strong> keep track of all<br />

files input with middle <strong>and</strong> high-level comm<strong>and</strong>s.<br />

Another example of how low-level programming can go astray is the<br />

case of robust comm<strong>and</strong>s. Many comm<strong>and</strong>s are intrinsically fragile,<br />

meaning that they are prematurely interpreted when used as arguments<br />

of other comm<strong>and</strong>s, but they may be made robust by prefixing them with<br />

\protect. In L AT E X 2.09, several fragile comm<strong>and</strong>s were defined <strong>to</strong> be<br />

robust by including the \protect in the definition, as for the L AT E X logo<br />

comm<strong>and</strong>:<br />

\def\<strong>LaTeX</strong>{\protect\p@<strong>LaTeX</strong>}<br />

\def\p@<strong>LaTeX</strong>{...}<br />

The true definition is in the internal \p@<strong>LaTeX</strong>, not the external \<strong>LaTeX</strong>.<br />

Since the original definition for the logo actually possessed some flaws,<br />

several packages included an improved version. Those that simply redefined<br />

\<strong>LaTeX</strong> itself made the comm<strong>and</strong> fragile; those that were cleverer<br />

only redefined \p@<strong>LaTeX</strong>, with the result that they are <strong>to</strong>tally left behind<br />

in L AT E X 2ε, where comm<strong>and</strong>s are made robust in a completely different<br />

(<strong>and</strong> much better) manner. (Incidentally, the internal definition of the<br />

L AT E X logo <strong>to</strong>day has been greatly improved.)<br />

In spite of the desirability of employing only official L AT E X comm<strong>and</strong>s,<br />

there are many occasions when either the internal L AT E X comm<strong>and</strong>s or the<br />

T E X primitives just must be used. The risk of future incompatibility must<br />

be taken in order <strong>to</strong> have a workable package now. However, one should<br />

not take this risk lightly, where a high-level equivalent is available.<br />

D.2 L AT E X programming comm<strong>and</strong>s<br />

All the comm<strong>and</strong>s described in this section are new <strong>to</strong> L AT E X 2ε. They<br />

are not essential <strong>to</strong> class <strong>and</strong> package files, but they do extend their<br />

usefulness <strong>and</strong> guarantee that they are employed properly.<br />

D.2.1 File identification<br />

Three comm<strong>and</strong>s test that the external environment in which the class or<br />

package has been inserted is correct. The first of these is<br />

\NeedsTeXFormat{format}[version]<br />

The first statement in a class or package should be the declaration of<br />

the T E X format needed. Although there are existing formats with other<br />

names, only the one named <strong>LaTeX</strong>2e actually recognizes this statement.<br />

All others will immediately issue the error message<br />

! Undefined control sequence.


l.1 \NeedsTeXFormat<br />

{<strong>LaTeX</strong>2e}<br />

D.2. L AT E X programming comm<strong>and</strong>s 441<br />

which all by itself is fairly informative.<br />

What is perhaps of more use is the optional version argument, which<br />

must contain the date of issue in the form yyyy/mm/dd. If a package<br />

makes use of features that were introduced in a certain version, its date<br />

should be given, so that if it is used with an earlier version of L AT E X 2ε, a<br />

warning is printed. For example, the comm<strong>and</strong> \DeclareRobustComm<strong>and</strong><br />

did not exist in the preliminary test release of L AT E X 2ε, but was first<br />

introduced with the official release of June 1, 1994. Thus any package<br />

containing this comm<strong>and</strong> should begin with<br />

\NeedsTeXFormat{<strong>LaTeX</strong>2e}[1994/06/01]<br />

The form of the date is important, including the zeros <strong>and</strong> slashes.<br />

This declaration is not limited <strong>to</strong> class <strong>and</strong> package files: it may also<br />

be issued at the start of the document itself <strong>to</strong> ensure that it is processed<br />

with the right L AT E X. It must, however, be given in the preamble.<br />

The next two comm<strong>and</strong>s identify the class or package file itself:<br />

\ProvidesClass{class}[version]<br />

\ProvidesPackage{package}[version]<br />

In both cases, the version consists of three parts: date, version number,<br />

<strong>and</strong> additional information. The date is in the same format as above,<br />

while the version number can be any designation without blanks, <strong>and</strong> the<br />

additional information is text with or without blanks. An example is<br />

\ProvidesPackage{shortpag}[1995/03/24 v1.4 (F. Barnes)]<br />

Only the date part is actually checked by L AT E X against the date specified in<br />

the calling \usepackage comm<strong>and</strong>. The version number <strong>and</strong> additional<br />

information are printed out if \listfiles has been requested. However,<br />

the above format is necessary for the \GetFileInfo comm<strong>and</strong> in the doc<br />

package (Section D.7.2).<br />

Both the \documentclass <strong>and</strong> \usepackage comm<strong>and</strong>s (as well as<br />

\LoadClass <strong>and</strong> \RequirePackage) may take an optional argument <strong>to</strong><br />

specify the earliest acceptable release date for the class/package. For<br />

example, with<br />

\documentclass[12pt]{article}[1995/01/01]<br />

if the article class file loaded contains<br />

\ProvidesClass{article}[1994/07/13 v1.2u<br />

St<strong>and</strong>ard <strong>LaTeX</strong> document class]<br />

a warning message is printed. The same procedure applies <strong>to</strong> the comm<strong>and</strong>s<br />

\usepackage <strong>and</strong> \ProvidesPackage.


442 Appendix D. L AT E X Programming<br />

This system of version checking allows a document <strong>to</strong> insist that<br />

suitable versions of the class <strong>and</strong> package files are loaded. It assumes,<br />

however, that all later versions are fully compatible with earlier ones.<br />

There is a further identifying comm<strong>and</strong> for general files, those <strong>to</strong> be<br />

loaded with \input.<br />

\ProvidesFile{file name}[version]<br />

There is no checking of the name or version in this case, but both pieces<br />

of information will be printed by \listfiles.<br />

D.2.2 Loading further classes <strong>and</strong> packages<br />

In the main document file, classes are read in by means of the initializing<br />

\documentclass comm<strong>and</strong>, <strong>and</strong> packages with \usepackage. Within<br />

class <strong>and</strong> package files, the comm<strong>and</strong>s<br />

\LoadClass[options]{class}[version]<br />

\RequirePackage[options]{package}[version]<br />

\LoadClassWithOptions{class}[version]<br />

\RequirePackageWithOptions{package}[version]<br />

must be used instead. The first allows one class file <strong>to</strong> load another, with<br />

selected options, if desired; the second permits class <strong>and</strong> package files <strong>to</strong><br />

load other packages. Only one \LoadClass comm<strong>and</strong> may appear within<br />

any class file; it may not be called from a package file. Neither comm<strong>and</strong><br />

may be invoked in the document file. The packages argument may be a<br />

list of several package names, separated by commas.<br />

The ...WithOptions variants load the class or package with all those<br />

options that were specified for the current one, something that is often<br />

required.<br />

How the optional version arguments interact with the corresponding<br />

\Provides.. comm<strong>and</strong> has been explained in the previous section; how<br />

the options argument is treated is described below.<br />

D.2.3 Processing options<br />

Both classes <strong>and</strong> packages may take options which are defined with<br />

\DeclareOption{option}{code}<br />

where option is the name of the option <strong>and</strong> code is the set of instructions<br />

that it is <strong>to</strong> execute. Internally, a comm<strong>and</strong> named \ds@option is created.<br />

Often the code does nothing more than set flags, or input an option<br />

file. (\RequirePackage may not be used within the option code!) Two<br />

examples from article.cls are<br />

\DeclareOption{fleqn}{\input{fleqn.clo}}<br />

\DeclareOption{twocolumn}{\setboolean{\@twocolumn}{true}}


D.2. L AT E X programming comm<strong>and</strong>s 443<br />

A default option is defined with \DeclareOption*, which takes no option<br />

name, specifying the code <strong>to</strong> be executed for all requested options that<br />

are undefined.<br />

There are two special comm<strong>and</strong>s that may be used only within the<br />

code of the default option definition:<br />

\CurrentOption contains the name of the option being processed;<br />

\OptionNotUsed declares \CurrentOption <strong>to</strong> be unprocessed.<br />

For example, <strong>to</strong> have a class file emulate L AT E X 2.09 behavior where all<br />

undefined options load a.sty file of the same name, define<br />

\DeclareOption*{\InputIfFileExists{\CurrentOption.sty}%<br />

{}{\OptionNotUsed}}<br />

which first checks if there is a.sty file of the requested name, <strong>and</strong> if not<br />

declares the option <strong>to</strong> be unused. Requested options that have not been<br />

used (processed) are listed in a warning message.<br />

The options are then processed with the comm<strong>and</strong>s<br />

\ExecuteOptions{option list}<br />

\ProcessOptions<br />

\ProcessOptions*<br />

where \ExecuteOptions calls those comm<strong>and</strong>s defined for the options<br />

in option list. This is normally done <strong>to</strong> establish certain options as being<br />

present by default. \ProcessOptions executes all the requested options<br />

in the order in which they were defined <strong>and</strong> then removes them from the<br />

list. Options are therefore executed only once by this comm<strong>and</strong>. The<br />

*-version is similar, except that the options are executed in the order<br />

requested.<br />

It is also possible <strong>to</strong> transfer options <strong>to</strong> a class or package file with<br />

\PassOptionsToClass{options}{class name}<br />

\PassOptionsToPackage{options}{package name}<br />

where options is a list of valid options recognized by the specified class<br />

or package file. These comm<strong>and</strong>s may be used within the definition of<br />

other options. The class or package named must later be loaded with<br />

\LoadClass or \RequirePackage.<br />

If the default options for class <strong>and</strong> package files have not been altered<br />

by \DeclareOption*, the st<strong>and</strong>ard procedure for h<strong>and</strong>ling options that<br />

have been requested but are undefined is<br />

• all options requested in the \documentclass statement are designated<br />

global; they are considered <strong>to</strong> apply <strong>to</strong> all subsequent packages,<br />

but not <strong>to</strong> classes loaded with \LoadClass; if they are not<br />

defined in the class, no error or warning is issued;


444 Appendix D. L AT E X Programming<br />

• all options requested with other comm<strong>and</strong>s, including \LoadClass<br />

<strong>and</strong> the \PassOptionsTo.., are local; if they are not defined in that<br />

class or package, an error is issued;<br />

• if there global options that are defined in neither the class nor any<br />

of the packages, a warning is issued;<br />

• options, global <strong>and</strong> local, are executed in the order in which they are<br />

defined in the class <strong>and</strong> packages, unless \ProcessOptions* has<br />

been called in which case they are executed in the order in which<br />

they are listed.<br />

D.2.4 Deferred processing<br />

Sometimes, <strong>to</strong> achieve certain special effects or <strong>to</strong> avoid possible conflicts<br />

with other packages, it is desirable <strong>to</strong> have some comm<strong>and</strong>s executed<br />

at the end of the package or class, or at the beginning or end of the<br />

document. This can be accomplished with<br />

\AtEndOfClass{cmds}<br />

\AtEndOfPackage{cmds}<br />

\AtBeginDocument{cmds}<br />

\AtEndDocument{cmds}<br />

The first two s<strong>to</strong>re away cmds <strong>to</strong> be carried out at the end of the class<br />

or package file. They can be used by local configuration files that are<br />

read in at the beginning, but contain modifications that should be made<br />

at the end so that they are not overwritten by the defaults. The last two<br />

declarations s<strong>to</strong>re away the cmds <strong>to</strong> be executed with \begin{document}<br />

<strong>and</strong> \end{document} respectively. All of these may be issued more than<br />

once, in which case the cmds are processed in the order in which they<br />

were issued.<br />

The cmds s<strong>to</strong>red with \AtBeginDocument are inserted in<strong>to</strong> the processing<br />

stream effectively within the preamble, but after the comm<strong>and</strong><br />

\begin{document} has done almost everything else that it does. Thus<br />

the cmds may be considered <strong>to</strong> be part of the main body but preamble-only<br />

comm<strong>and</strong>s are also allowed.<br />

D.2.5 Robust comm<strong>and</strong>s<br />

Comm<strong>and</strong>s may actually be fragile, meaning that if they are used in the<br />

arguments of other comm<strong>and</strong>s, they could be prematurely interpreted,<br />

causing unexpected problems. This happens with moving arguments,<br />

those that appear somewhere else other than where they were given: in<br />

the table of contents <strong>and</strong> in running headlines. Complex comm<strong>and</strong>s with<br />

conditionals or redefinitions are likely <strong>to</strong> be fragile.


D.2. L AT E X programming comm<strong>and</strong>s 445<br />

Many intrinsic comm<strong>and</strong>s in L AT E X 2.09 were fragile, <strong>and</strong> it was necessary<br />

<strong>to</strong> precede them with \protect when they appeared in the argument<br />

of a \section comm<strong>and</strong>, for example. In this case, the comm<strong>and</strong> name<br />

is transferred rather than its translation. Some comm<strong>and</strong>s could be made<br />

robust using the trick shown on page 440 for the \<strong>LaTeX</strong> comm<strong>and</strong> itself.<br />

In <strong>to</strong>day’s L AT E X, almost all regular comm<strong>and</strong>s are robust. However, the<br />

comm<strong>and</strong>s a user may define with \newcomm<strong>and</strong>, \renewcomm<strong>and</strong>, <strong>and</strong><br />

\providecomm<strong>and</strong> (Section 8.3) may very well be fragile. Alternatively,<br />

one can define the comm<strong>and</strong>s with<br />

\DeclareRobustComm<strong>and</strong>{\com name}[narg][opt]{def }<br />

which has the same syntax as the other defining comm<strong>and</strong>s. If the comm<strong>and</strong><br />

<strong>to</strong> be defined already exists, a message is written <strong>to</strong> the transcript<br />

file, <strong>and</strong> the old definition is overwritten.<br />

Another comm<strong>and</strong> with the same syntax simply checks the current<br />

definition of \com name:<br />

\CheckComm<strong>and</strong>{\com name}[narg][opt]{def }<br />

<strong>and</strong> issues a warning message if the actual definition is not the same<br />

as def, with the same number of arguments, <strong>and</strong> so on. This is used<br />

<strong>to</strong> ensure that the state of the system is as one expects, <strong>and</strong> that no<br />

previously loaded packages have altered some important definition.<br />

Both \DeclareRobustComm<strong>and</strong> <strong>and</strong> \CheckComm<strong>and</strong> may be called at<br />

any point in the document.<br />

D.2.6 Comm<strong>and</strong>s with ‘short’ arguments<br />

Normally, the arguments <strong>to</strong> user-defined comm<strong>and</strong>s are allowed <strong>to</strong> contain<br />

new paragraphs, with the \par comm<strong>and</strong> or with a blank line. In T E X<br />

jargon, these comm<strong>and</strong>s are said <strong>to</strong> be ‘long’. This is not the st<strong>and</strong>ard<br />

behavior for comm<strong>and</strong>s created with the T E X \def comm<strong>and</strong>, where the<br />

arguments must be short in order <strong>to</strong> act as a test for forgotten closing<br />

braces.<br />

With the version from December 1, 1994, L AT E X provides *-forms of all<br />

the defining comm<strong>and</strong>s:<br />

\newcomm<strong>and</strong>* \renewcomm<strong>and</strong>*<br />

\newenvironment* \renewenvironment*<br />

\providecomm<strong>and</strong>*<br />

\DeclareRobustComm<strong>and</strong>* \CheckComm<strong>and</strong>*<br />

which create user-defined comm<strong>and</strong>s with ‘short’ arguments in the same<br />

way as does \def.<br />

It is recommended that one should almost always take the *-version<br />

of these defining comm<strong>and</strong>s, unless there is some very good reason <strong>to</strong><br />

expect that the possible arguments may be ‘long’, that is, contain new<br />

paragraphs. Long arguments should be the exception, not the rule.


446 Appendix D. L AT E X Programming<br />

D.2.7 Issuing errors <strong>and</strong> warnings<br />

Classes <strong>and</strong> packages may be programmed <strong>to</strong> issue their own error messages<br />

<strong>and</strong> warnings. This is useful <strong>to</strong> indicate which file is responsible<br />

for the message.<br />

Error messages are generated with<br />

\ClassError{class name}{error text}{help}<br />

\PackageError{package name}{error text}{help}<br />

where error text is the message printed <strong>to</strong> the moni<strong>to</strong>r <strong>and</strong> <strong>to</strong> the transcript<br />

file, <strong>and</strong> help is additional text printed after the user responds with<br />

H. If the texts contain comm<strong>and</strong> names that are <strong>to</strong> be printed literally,<br />

they must be preceded by \protect; spaces are generated with \space,<br />

<strong>and</strong> new lines with \MessageBreak. For example,<br />

\PackageError{ghost}{%<br />

The \protect\textwidth\space is <strong>to</strong>o large\MessageBreak<br />

for the paper you have selected}<br />

{Use a smaller width.}<br />

produces the error message<br />

! Package ghost Error: The \textwidth is <strong>to</strong>o large<br />

(ghost) for the paper you have selected.<br />

See the ghost package documentation for explanation.<br />

Type H for immediate help.<br />

Typing H 〈return〉 produces<br />

Use a smaller width.<br />

after which L AT E X halts again <strong>to</strong> wait for a response as described in Section<br />

C.1.<br />

Warnings may also be issued from classes <strong>and</strong> packages in a similar<br />

way. The difference is that there is no help text, <strong>and</strong> the processing does<br />

not s<strong>to</strong>p for a response. The line number of the input file where the<br />

warning occurred may be optionally suppressed.<br />

\ClassWarning{class name}{warning text}<br />

\ClassWarningNoLine{class name}{warning text}<br />

\PackageWarning{package name}{warning text}<br />

\PackageWarningNoLine{package name}{warning text}<br />

For example, with the warning<br />

\PackageWarning{ghost}<br />

{This text is haunted}<br />

one obtains the message<br />

Package ghost Warning: This text is haunted on input line 20.


D.2. L AT E X programming comm<strong>and</strong>s 447<br />

<strong>and</strong> the processing continues. Warnings may be split in<strong>to</strong> several lines<br />

with the \MessageBreak comm<strong>and</strong>, just like error texts.<br />

Two last comm<strong>and</strong>s of this type are<br />

\ClassInfo{class name}{info text}<br />

\PackageInfo{package name}{info text}<br />

which write their texts only <strong>to</strong> the transcript file, <strong>and</strong> not <strong>to</strong> the moni<strong>to</strong>r.<br />

They are otherwise just like the corresponding NoLine warnings.<br />

D.2.8 Inputting files<br />

Files other than classes <strong>and</strong> packages may also be input, in which case it<br />

is often desirable <strong>to</strong> make sure that they exist beforeh<strong>and</strong>. Or, alternative<br />

actions might be taken depending on the existence of a certain file. These<br />

goals are met with<br />

\IfFileExists{file name}{true}{false}<br />

\InputIfFileExists{file name}{true}{false}<br />

Both these comm<strong>and</strong>s test for the presence of the specified file name in<br />

the area that L AT E X is looking for files, <strong>and</strong> execute true if it is found,<br />

otherwise false. In addition, \InputIfFileExists reads in that file after<br />

executing true.<br />

These comm<strong>and</strong>s are not restricted <strong>to</strong> the preamble, nor <strong>to</strong> class or<br />

package files. In fact, the regular \input comm<strong>and</strong> is defined in terms of<br />

them.<br />

Many special classes make use of these comm<strong>and</strong>s <strong>to</strong> read in a local<br />

configuration file. For example, the class ltxdoc contains<br />

\InputIfFileExists{ltxdoc.cfg}<br />

{\typeout{Local config file ltxdoc.cfg used}}<br />

{}<br />

just before \ProcessOptions is called. This allows one <strong>to</strong> have a local<br />

configuration that might specify<br />

\PassOptionsToClass{a4paper}{article}<br />

for a European installation, without altering the files that are processed<br />

with the ltxdoc class.<br />

D.2.9 Checking files<br />

Although not really part of programming, two L AT E X features <strong>to</strong> keep track<br />

of input files are described here. The first of these, already mentioned in<br />

Section 9.1.1, is the comm<strong>and</strong><br />

\listfiles


448 Appendix D. L AT E X Programming<br />

which may be given in the preamble, even before \documentclass. It<br />

causes a list of all input files <strong>to</strong> be printed at the end of the processing,<br />

along with their version <strong>and</strong> release data. In this way, one has a record<br />

of just which files were included, something that may be of use when<br />

deciding <strong>to</strong> send a document file <strong>to</strong> another installation for processing<br />

there. Since any non-st<strong>and</strong>ard files may also have <strong>to</strong> be included, these<br />

may be more readily identified from such a listing.<br />

For example, the simple document file<br />

\documentclass{article}<br />

\usepackage{ifthen}<br />

\listfiles<br />

\begin{document}<br />

\input{mymacros}<br />

This is \te.<br />

\end{document}<br />

produces the listing<br />

*File List*<br />

article.cls 2001/04/21 v1.4e St<strong>and</strong>ard <strong>LaTeX</strong> document class<br />

size10.clo 2001/04/21 v1.4e St<strong>and</strong>ard <strong>LaTeX</strong> file (size option)<br />

ifthen.sty 2001/05/26 v1.1c St<strong>and</strong>ard <strong>LaTeX</strong> ifthen package<br />

mymacros.tex<br />

***********<br />

In this case, the local file mymacros.tex contains no version information<br />

because it is missing a \ProvidesFile comm<strong>and</strong>.<br />

What should one do if a local file, such as mymacros.tex above, is<br />

needed for the processing of a document file that is <strong>to</strong> be sent elsewhere?<br />

One could send it along with the main file, but that requires giving the<br />

recipient more instructions on what <strong>to</strong> do. Or, its contents could simply<br />

be included in the main file, for shipping purposes. For a package file,<br />

this is not so easy, since internal comm<strong>and</strong>s containing the @ sign would<br />

cause trouble, <strong>and</strong> the options would not be h<strong>and</strong>led properly. For this<br />

purpose, we have the environment<br />

\begin{filecontents}{file name}<br />

file contents<br />

\end{filecontents}<br />

which may only appear at the very beginning of the document, before the<br />

\documentclass comm<strong>and</strong>. It tests <strong>to</strong> see if there is a file on the system<br />

with the name file name, <strong>and</strong> if not, it writes its contents literally <strong>to</strong> a file<br />

of that name. This may be a package file that is subsequently input with<br />

\usepackage. In this way, the missing non-st<strong>and</strong>ard files can be ported<br />

<strong>to</strong>gether with the main document file.<br />

If we extend the above simple example by including at the very start


\begin{filecontents}{mymacros}<br />

\newcomm<strong>and</strong>{\te}{the end}<br />

\end{filecontents}<br />

the newly written file mymacros.tex contains<br />

D.2. L AT E X programming comm<strong>and</strong>s 449<br />

%% <strong>LaTeX</strong>2e file ‘mymacros’<br />

%% generated by the ‘filecontents’ environment<br />

%% from source ‘mydoc’ on 2003/01/31.<br />

%%<br />

\newcomm<strong>and</strong>{\te}{the end}<br />

Note that the filecontents environment adds some comment lines<br />

<strong>to</strong> explain where the new file came from. If this is undesirable, the<br />

filecontents* environment may be used instead.<br />

D.2.10 Useful internal comm<strong>and</strong>s<br />

Notwithst<strong>and</strong>ing the guidelines in Section D.1.2 that recommend avoiding internal<br />

! L AT E X comm<strong>and</strong>s, there are a number that are fairly fundamental, <strong>and</strong> indeed form<br />

many of the building blocks of the L AT E X kernel <strong>and</strong> many st<strong>and</strong>ard packages. Since<br />

they are still internal comm<strong>and</strong>s, they are not guaranteed for all future updates.<br />

However, if they were <strong>to</strong> vanish, many of the interesting extension packages<br />

provided by the L AT E X Team itself would have <strong>to</strong> be drastically overhauled. We<br />

merely present them briefly here for the sake of the bolder user.<br />

\@namedef{cmd}{def }<br />

\@nameuse{cmd}<br />

define <strong>and</strong> execute a comm<strong>and</strong> named \cmd, where the backslash is not included<br />

in the comm<strong>and</strong> name. This name may contain any characters, even those<br />

normally forbidden in comm<strong>and</strong> names.<br />

\@ifundefined{cmd}{true}{false}<br />

executes true if the comm<strong>and</strong> \cmd does not exist, else false. Again, the backslash<br />

is not included in cmd, <strong>and</strong> any characters may appear in the comm<strong>and</strong> name.<br />

This test is often used <strong>to</strong> define comm<strong>and</strong>s conditionally, a task that has been<br />

taken over by \providecomm<strong>and</strong>. It may also be employed <strong>to</strong> determine whether<br />

the main class is article-like or not: \@ifundefined{chapter}{..}{..} tests<br />

for the existence of the \chapter comm<strong>and</strong>.<br />

\@ifnextcharchar{true}{false}<br />

tests if the next character is char, <strong>and</strong> if so, executes true, else false. This<br />

comm<strong>and</strong> is traditionally used <strong>to</strong> define comm<strong>and</strong>s with optional arguments,<br />

where char is [. The extended syntax of \newcomm<strong>and</strong> offers a high-level means<br />

of achieving this.<br />

\@ifstar{true}{false}


450 Appendix D. L AT E X Programming<br />

tests if the next character is a star *, <strong>and</strong> if so, executes true, else false. It is used<br />

<strong>to</strong> define *-forms of comm<strong>and</strong>s <strong>and</strong> environments, something that still cannot<br />

be done at the high level.<br />

\@for \obj := \list \do {cmds}<br />

where \list is a comm<strong>and</strong> that is defined <strong>to</strong> be a list of elements separated by<br />

commas, <strong>and</strong> \obj is successively set equal <strong>to</strong> each of these elements while the<br />

code cmds is executed once for each element. For example,<br />

\newcomm<strong>and</strong>{\set}{start,middle,end}<br />

\@for \xx:=\set \do {This is the \xx. }<br />

prints ‘This is the start. This is the middle. This is the end.’<br />

D.2.11 Useful T E X comm<strong>and</strong>s<br />

Many of the most sophisticated features of L AT E X <strong>and</strong> its packages can only be<br />

! programmed with the help of Plain T E X comm<strong>and</strong>s. These are described not only<br />

in The T E Xbook (Knuth, 1986a), but also in the excellent reference manual by<br />

Eijkhout (1992), T E X by Topic, a T E Xnician’s Reference.<br />

We do not intend this book <strong>to</strong> a manual for T E X; nevertheless, there are a few<br />

common T E X comm<strong>and</strong>s that appear in many packages, <strong>and</strong> even in the examples<br />

<strong>to</strong> follow. A brief description of what they do will aid the underst<strong>and</strong>ing of these<br />

codings. A true T E Xpert or T E Xnician can skip this section al<strong>to</strong>gether.<br />

\def\cmd#1#2..{definition}<br />

is the st<strong>and</strong>ard defining comm<strong>and</strong> in T E X. It is the equivalent of \newcomm<strong>and</strong>*<br />

except that there is no check for name clashes, <strong>and</strong> the arguments are specified<br />

differently. For example, a comm<strong>and</strong> \Exp <strong>to</strong> write scientific notation can be<br />

defined as<br />

\def\Exp#1#2{\ensuremath{#1\times10ˆ{#2}}}<br />

or as \newcomm<strong>and</strong>*{\Exp}[2]{\ensuremath{#1\times10ˆ{#2}}}<br />

In both cases, \Exp{1.1}{4} produces 1.1 × 10 4 . However, \def can go further:<br />

it can put the arguments in a template, such as<br />

\def\Exp#1(#2){\ensuremath{#1\times10ˆ{#2}}}<br />

<strong>to</strong> allow the more convenient notation \Exp1.1(4), something that cannot be<br />

produced with \newcomm<strong>and</strong>. The \def comm<strong>and</strong> is often used when a comm<strong>and</strong><br />

is <strong>to</strong> be defined without knowing (or caring) whether its name already exists, or<br />

when a template is needed.<br />

\gdef \edef \xdef<br />

are variations on \def: the first makes a global definition, valid even outside the<br />

current environment or {..} bracketing; the second is an exp<strong>and</strong>ed definition,<br />

such that any comm<strong>and</strong>s in it have their meanings <strong>and</strong> not the comm<strong>and</strong> itself<br />

inserted in the definition; the last is a combination of the other two, exp<strong>and</strong>ed<br />

<strong>and</strong> global.


\noexp<strong>and</strong> \exp<strong>and</strong>after<br />

D.3. Sample packages 451<br />

control the expansion of comm<strong>and</strong>s in definitions <strong>and</strong> execution. Any comm<strong>and</strong>s<br />

in the definition part of \edef are exp<strong>and</strong>ed (their meanings inserted) unless<br />

they have \noexp<strong>and</strong> before them. The opposite is achieved with \exp<strong>and</strong>after,<br />

which jumps over the following comm<strong>and</strong>, exp<strong>and</strong>s the next one, <strong>and</strong> then<br />

executes the one skipped. This is very deep T E Xnology, <strong>and</strong> is best illustrated by<br />

an example with the \Exp comm<strong>and</strong> defined above.<br />

\newcomm<strong>and</strong>*{\mynums}{1.1(4)} \exp<strong>and</strong>after\Exp\mynums<br />

is identical <strong>to</strong> \Exp1.1(4), whereas \Exp\mynums is not; \mynums is exp<strong>and</strong>ed<br />

<strong>to</strong> 1.1(4) before \Exp is executed.<br />

\let\cmd a = \cmd b or \let\cmd a\cmd b<br />

makes \cmd a take on the current meaning of \cmd b. This is often employed<br />

<strong>to</strong> save the current meaning of a comm<strong>and</strong> before redefining it, possibly using<br />

the older meaning <strong>to</strong>o.<br />

\relax<br />

does absolutely nothing, but it is often inserted in places where something should<br />

be but nothing is wanted.<br />

\ifcond true code \else false code \fi<br />

is the form of a T E X conditional. There are <strong>to</strong>o many variations on the condition<br />

cond <strong>to</strong> explain here, but one common application is the equivalent of the L AT E X<br />

boolean switch comm<strong>and</strong>s:<br />

\newif\ifflag = \newboolean{flag}<br />

\flagtrue = \setboolean{flag}{true}<br />

\flagfalse = \setboolean{flag}{false}<br />

\ifflag ..\else..\fi = \ifthenelse{\boolean{flag}}{..}{..}<br />

For those who are used <strong>to</strong> it, the T E X form is more compact, but does not conform<br />

<strong>to</strong> the general L AT E X style of doing things.<br />

\ifcase num text 0 \or text 1 \or . . . \fi<br />

executes one of the text num according <strong>to</strong> the value of num.<br />

\endinput<br />

terminates the current file being input. This is not really necessary, but it is<br />

considered good programming <strong>to</strong> end all files this way. The main document file<br />

does not need it since \end{document} has the same effect.<br />

D.3 Sample packages<br />

We present here some demonstration packages <strong>to</strong> illustrate the programming<br />

comm<strong>and</strong>s of the previous section. These packages are not trivial<br />

<strong>and</strong> are all useful in their own right, even though their functionality is<br />

covered by others described in this book.


452 Appendix D. L AT E X Programming<br />

D.3.1 Modifying the text page size<br />

The st<strong>and</strong>ard L AT E X classes set the text size parameters \textwidth <strong>and</strong><br />

\textheight according <strong>to</strong> the size option specified in \documentclass,<br />

such as a4paper or legalpaper. They also adjust the margins so that the<br />

text is centered both horizontally <strong>and</strong> vertically. The value of \textwidth<br />

is restricted, however, so that there are at most 60–70 characters per line,<br />

this being considered optimal by the rules of typography.<br />

Often one wants <strong>to</strong> ignore this limitation <strong>and</strong> use the paper <strong>to</strong> its<br />

maximum extent. The geometry package from Section 3.2.6 does this<br />

<strong>and</strong> much more. Here we present a simpler package for this single<br />

function.<br />

The fullpage package presented here uses the values of \paperwidth<br />

<strong>and</strong> \paperheight, which have been set according <strong>to</strong> the paper size<br />

option, <strong>to</strong> produce a margin of one inch on all sides. It even considers<br />

what the page style is so that room for head <strong>and</strong> footlines may be taken<br />

in<strong>to</strong> account. Optionally, it may set an even narrower margin of 1.5 cm.<br />

Before proceeding, it might be useful <strong>to</strong> review the page format parameters<br />

shown in the figures on pages 48 <strong>and</strong> 602.<br />

The package file begins by stating that it needs L AT E X 2ε <strong>and</strong> by identifying<br />

itself. The package information contains the date in prescribed<br />

form, the version number, <strong>and</strong> additionally the initials of the author. The<br />

ifthen package is then loaded since conditionals will be required.<br />

\NeedsTeXFormat{<strong>LaTeX</strong>2e}<br />

\ProvidesPackage{fullpage}[2002/02/15 1.1 (PWD)]<br />

\RequirePackage{ifthen}<br />

Next the options are prepared. These are <strong>to</strong> be in <strong>and</strong> cm for margins<br />

of 1 in <strong>and</strong> 1.5 cm respectively (1 cm is really <strong>to</strong>o narrow). A special length<br />

is used <strong>to</strong> s<strong>to</strong>re the margin value. This is a private, internal comm<strong>and</strong>,<br />

conforming <strong>to</strong> the convention mentioned on page 438.<br />

\newlength{\FP@margin}<br />

\DeclareOption{in}{\setlength{\FP@margin}{1in}}<br />

\DeclareOption{cm}{\setlength{\FP@margin}{1.5cm}}<br />

Furthermore, the four st<strong>and</strong>ard page styles are also <strong>to</strong> be option names.<br />

They will set two internal boolean switches <strong>and</strong> the page style.<br />

\newboolean{FP@plain}<br />

\newboolean{FP@empty}<br />

\DeclareOption{plain}{\setboolean{FP@plain}{true}<br />

\setboolean{FP@empty}{false}<br />

\pagestyle{plain}}<br />

\DeclareOption{empty}{\setboolean{FP@plain}{true}<br />

\setboolean{FP@empty}{true}<br />

\pagestyle{empty}}<br />

\DeclareOption{headings}{\setboolean{FP@plain}{false}


D.3. Sample packages 453<br />

\setboolean{FP@empty}{false}<br />

\pagestyle{headings}}<br />

\DeclareOption{myheadings}{\setboolean{FP@plain}{false}<br />

\setboolean{FP@empty}{false}<br />

\pagestyle{myheadings}}<br />

Finally, the default set of options is executed, <strong>and</strong> then the selected<br />

options are processed, in this case, in the order specified. The reason for<br />

this is that if more than one page style has been given, the last one should<br />

dominate.<br />

\ExecuteOptions{in,plain}<br />

\ProcessOptions*<br />

Now the calculation can begin. First, for plain <strong>and</strong> empty, there are no<br />

headlines, so set the relevant parameters <strong>to</strong> zero. This is when FP@plain<br />

is 〈true〉. Then set the space reserved for the footline <strong>to</strong> zero for the<br />

empty page style (FP@empty is 〈true〉). For headings <strong>and</strong> myheadings,<br />

this space is maintained since these styles normally have a plain page<br />

(with footline) on the first page.<br />

\ifthenelse{\boolean{FP@plain}}<br />

{\setlength{\headheight}{0pt}<br />

\setlength{\headsep}{0pt}}{}<br />

\ifthenelse{\boolean{FP@empty}}<br />

{\setlength{\footskip}{0pt}}{}<br />

With all the margins <strong>and</strong> headline <strong>and</strong> footline spacings set, the actual<br />

calculation can be made. Recall that the driver program leaves a 1 inch<br />

margin at the left <strong>and</strong> above, which must be subtracted from \<strong>to</strong>pmargin<br />

<strong>and</strong> \oddsidemargin.<br />

\setlength{\textwidth}{\paperwidth}<br />

\add<strong>to</strong>length{\textwidth}{-2\FP@margin}<br />

\setlength{\oddsidemargin}{\FP@margin}<br />

\add<strong>to</strong>length{\oddsidemargin}{-1in}<br />

\setlength{\evensidemargin}{\oddsidemargin}<br />

\setlength{\textheight}{\paperheight}<br />

\add<strong>to</strong>length{\textheight}{-\headheight}<br />

\add<strong>to</strong>length{\textheight}{-\headsep}<br />

\add<strong>to</strong>length{\textheight}{-\footskip}<br />

\add<strong>to</strong>length{\textheight}{-2\FP@margin}<br />

\setlength{\<strong>to</strong>pmargin}{\FP@margin}<br />

\add<strong>to</strong>length{\<strong>to</strong>pmargin}{-1in}<br />

Remember that \paperheight <strong>and</strong> \paperwidth are set <strong>to</strong> the full dimensions<br />

of the paper by the paper size option. If this is wrongly specified,<br />

of course, the final result will be incorrect.<br />

This completes the coding for the package file fullpage.sty. An<br />

example of how it might be invoked is


454 Appendix D. L AT E X Programming<br />

\documentclass[a4paper,12pt]{article}<br />

\usepackage[headings]{fullpage}<br />

. . . . . .<br />

D.3.2 Redesigning the head <strong>and</strong> footlines<br />

Something that is often dem<strong>and</strong>ed by L AT E X users is the possibility of<br />

altering the head <strong>and</strong> footlines that appear on each page. St<strong>and</strong>ard L AT E X<br />

does provide a limited number of page styles (Section 3.2) but these are<br />

not always sufficient. The most flexible of them is the myheadings page<br />

style which allows the author <strong>to</strong> determine the text of the running heads<br />

with \markright <strong>and</strong> \markboth. However, the general format, including<br />

font style <strong>and</strong> placement of the page number, is still fixed by L AT E X.<br />

The fancyhdr package by Piet van Oostrum (Section 3.2.2) solves all<br />

this very nicely for most cases. Nevertheless we present this example <strong>to</strong><br />

show how it is done internally, <strong>and</strong> <strong>to</strong> illustrate how some other special<br />

effects can be achieved.<br />

We wish <strong>to</strong> modify the headline for documentation of large projects<br />

requiring particular information in the running head. Apart from a short<br />

version of the title <strong>and</strong> the section <strong>and</strong> page numbers, they might dem<strong>and</strong><br />

the document serial number, date, <strong>and</strong> version number. It would be useful<br />

<strong>to</strong> have a generalized documentation page style that allows these entries<br />

<strong>to</strong> be specified outside of the page style definition itself.<br />

Since this coding is only feasible for the article class, we will create<br />

a new class, called dochead, that inputs article.cls <strong>and</strong> then defines<br />

a new page style. Actually this class could contain many other special<br />

features of which our new page style is only one.<br />

Again we start by declaring the T E X version that we need (release 4<br />

from December 1, 1995), <strong>and</strong> by identifying the class file.<br />

\NeedsTeXFormat{<strong>LaTeX</strong>2e}[1995/12/01]<br />

\ProvidesClass{dochead}[2002/04/27 1.5 (PWD)]<br />

This class has no options of its own, passing all specified ones on <strong>to</strong><br />

the underlying article class by means of the \LoadClassWithOptions<br />

comm<strong>and</strong>, which only became available with release 4.<br />

\LoadClassWithOptions{article}<br />

Now come the comm<strong>and</strong>s that are used <strong>to</strong> enter the four pieces of<br />

information for the headline: short title, date, serial number, <strong>and</strong> version.<br />

Each of these comm<strong>and</strong>s s<strong>to</strong>res its argument in an internal \DH@<br />

comm<strong>and</strong>, each of which is initially set <strong>to</strong> be empty. Finally, the entering<br />

comm<strong>and</strong>s are declared <strong>to</strong> be allowed only in the preamble, since it would<br />

be disastrous if they were called after the main text had started.<br />

\newcomm<strong>and</strong>*{\DocTitle}[1] {\renewcomm<strong>and</strong>*{\DH@title}{#1}}<br />

\newcomm<strong>and</strong>*{\DocDate}[1] {\renewcomm<strong>and</strong>*{\DH@date}{#1}}


D.3. Sample packages 455<br />

\newcomm<strong>and</strong>*{\DocNumber}[1]<br />

{\renewcomm<strong>and</strong>*{\DH@number}{\MakeUppercase{#1}}}<br />

\newcomm<strong>and</strong>*{\DocVersion}[1]{\renewcomm<strong>and</strong>*{\DH@version}{#1}}<br />

\newcomm<strong>and</strong>*{\DH@title}{} \newcomm<strong>and</strong>*{\DH@date}{}<br />

\newcomm<strong>and</strong>*{\DH@number}{} \newcomm<strong>and</strong>*{\DH@version}{}<br />

\@onlypreamble{\DocTitle} \@onlypreamble{\DocDate}<br />

\@onlypreamble{\DocNumber} \@onlypreamble{\DocVersion}<br />

The \@onlypreamble comm<strong>and</strong> is an internal L AT E X one.<br />

Note: The comm<strong>and</strong>s \MakeUppercase <strong>and</strong> \MakeLowercase (not used<br />

here) set the case of their arguments. The former is used here <strong>to</strong> ensure<br />

that the document number always appears in upper case letters.<br />

We now define the new page style, dochead, which means we must create<br />

a comm<strong>and</strong> \ps@dochead, <strong>to</strong> be executed by \pagestyle{dochead}.<br />

What this comm<strong>and</strong> must do is redefine the four internals \@oddhead,<br />

\@evenhead, \@oddfoot, <strong>and</strong> \@evenfoot. We make the footlines empty,<br />

<strong>and</strong> the even <strong>and</strong> odd headlines identical. That headline is <strong>to</strong> be a minipage,<br />

the full width of the page, containing a table with the relevant<br />

document information.<br />

\newcomm<strong>and</strong>*{\ps@dochead}{%<br />

\renewcomm<strong>and</strong>*{\@oddhead}{%<br />

\begin{minipage}{\textwidth}\normalfont<br />

\begin{tabular*}{\textwidth}{@{}l@{\extracolsep{\fill}}%<br />

l@{\extracolsep{0pt}:˜}l@{}}%<br />

\DH@number & Version & \DH@version \\<br />

\DH@title & Section & \thesection \\<br />

Date:˜\DH@date & Page & \thepage<br />

\end{tabular*}\vspace{0.5ex} \rule{\textwidth}{0.6pt}%<br />

\end{minipage}}<br />

\renewcomm<strong>and</strong>*{\@evenhead}{\@oddhead}<br />

\renewcomm<strong>and</strong>*{\@oddfoot}{}<br />

\renewcomm<strong>and</strong>*{\@evenfoot}{}<br />

}<br />

\pagestyle{dochead}<br />

The last line activates the new page style.<br />

It is also necessary <strong>to</strong> increase the size of \headheight <strong>and</strong> \headsep<br />

because our headline is much higher than normal. We pick a height of 3.5<br />

times a regular line.<br />

\setlength{\headheight}{3.5\baselineskip}<br />

\setlength{\headsep}{3em}<br />

We now add a further refinement. Such documentation normally wants<br />

the pages <strong>to</strong> be numbered within the sections. Therefore, we want <strong>to</strong><br />

redefine the comm<strong>and</strong> \thepage which prints the page number from<br />

the page counter (Section 8.1.4), <strong>and</strong> we need <strong>to</strong> modify the \section<br />

comm<strong>and</strong> <strong>to</strong> start a new page <strong>and</strong> <strong>to</strong> reset the page counter. This is done<br />

by s<strong>to</strong>ring the current definition of \section <strong>and</strong> then redefining it.


456 Appendix D. L AT E X Programming<br />

\let\DH@section=\section<br />

\renewcomm<strong>and</strong>*{\thepage}{\thesection-\arabic{page}}<br />

\renewcomm<strong>and</strong>*{\section}{\newpage\setcounter{page}{1}\DH@section}<br />

Notice that the new \section comm<strong>and</strong> calls the old one now s<strong>to</strong>red in<br />

our own internal comm<strong>and</strong> \DH@section.<br />

If the above is written <strong>to</strong> a file named dochead.cls, the following<br />

source text could be used <strong>to</strong> invoke it:<br />

\documentclass[12pt,a4paper]{dochead}<br />

\DocTitle{Spacecraft Cleanliness}<br />

\DocNumber{Esa--xy--123}<br />

\DocDate{2003 Feb 26}<br />

\DocVersion{4.2}<br />

\begin{document}<br />

. . . . . . . . . . . . . . . .<br />

The headline on the fourth page of Section 3 would then appear as below.<br />

ESA–XY–123 Version: 4.2<br />

Spacecraft Cleanliness Section: 3<br />

Date: 2003 Feb 26 Page : 3-4<br />

With this example as a model, it should not be difficult <strong>to</strong> create similar<br />

headlines for other applications with different entries.<br />

D.3.3 Reprogramming the sectioning comm<strong>and</strong>s<br />

Another aspect of L AT E X formatting that one might want <strong>to</strong> alter is the<br />

appearance of the sectioning titles. The fonts used, as well as their sizes<br />

<strong>and</strong> the spacing around them, are all rigidly set in the class files. We know<br />

users who feel so frustrated by the predefined sectioning that they type<br />

in their own by h<strong>and</strong>, including the numbers, something that completely<br />

violates the L AT E X concept of logical markup.<br />

In fact, all the sectioning comm<strong>and</strong>s from \section <strong>to</strong> \subparagraph<br />

are defined by means of a generalized internal section comm<strong>and</strong> with the<br />

following syntax:<br />

\@startsection{sec-name}{level}{indent}{pre-skip} {post-skip}<br />

{style}*[short title]{title}<br />

where both the * <strong>and</strong> [short title] are optional. A comm<strong>and</strong> like \section<br />

is defined <strong>to</strong> be \@startsection with all the arguments up <strong>to</strong> <strong>and</strong> including<br />

style; the remaining optional *, short title, <strong>and</strong> title are given<br />

as arguments <strong>to</strong> \section itself (Section 3.3.3). The meanings of these<br />

arguments are:


D.3. Sample packages 457<br />

sec-name: the name of the section level, for example subsubsection;<br />

this name is used <strong>to</strong> select the appropriate counter <strong>and</strong> <strong>to</strong> enter the<br />

title correctly in the table of contents <strong>and</strong> page headlines;<br />

level: is the number in the sectioning hierarchy as described on page 56,<br />

1 for \section, 2 for \subsection . . . ;<br />

indent: is the amount of indentation from the left margin;<br />

pre-skip: is a rubber length, the absolute value of which is the space inserted<br />

above the title; if this is negative, the first paragraph following<br />

the section title is not indented;<br />

post-skip: is a rubber length; if positive, it is the space inserted below<br />

the title; if negative, its absolute value is the space between the title<br />

<strong>and</strong> the subsequent run-in text;<br />

style: font declarations issued when printing the section title, such as<br />

\bfseries <strong>and</strong> \Large;<br />

*: optional; if present, the section counter is not incremented, the section<br />

is not numbered, no entry is made in the table of contents;<br />

short title: optional alternative text for the table of contents <strong>and</strong> page<br />

headline; may only be given if the * is absent;<br />

title: the text printed as the section title; if short title is missing, this text<br />

is also entered in the table of contents <strong>and</strong> page headline.<br />

The font style of the title is determined by the declarations in style;<br />

these must be declarations, like \bfseries, <strong>and</strong> not comm<strong>and</strong>s with<br />

arguments like \textbf. However, with the release from June 1, 1996,<br />

the last item in the style list may indeed be a comm<strong>and</strong> with an argument.<br />

This permits something like \bfseries\MakeUppercase <strong>to</strong> force the title<br />

<strong>to</strong> be bold face capital letters.<br />

Rubber lengths with generous stretch <strong>and</strong> shrink should be given for<br />

pre-skip <strong>and</strong> post-skip <strong>to</strong> allow L AT E X more freedom in avoiding bad page<br />

breaks.<br />

The section number is written with the comm<strong>and</strong> \@seccntformat<br />

that takes one argument, the name of the sectioning counter (sec-name<br />

above) that is <strong>to</strong> be printed. This may be redefined for special effects, as<br />

illustrated in the example below.<br />

Since both \@startsection <strong>and</strong> \@seccntformat contain @, they are<br />

internal comm<strong>and</strong>s that can only be used in a class or package file. We<br />

give here a brief package, mysects.sty, which redefines all the sectioning<br />

comm<strong>and</strong>s. The values of pre-skip <strong>and</strong> post-skip are those in the st<strong>and</strong>ard<br />

article.cls.


458 Appendix D. L AT E X Programming<br />

\NeedsTeXFormat{<strong>LaTeX</strong>2e}[1996/06/01]<br />

\ProvidesPackage{mysects}[2003/03/21 v2.1 (PWD)]<br />

The date of the fifth L AT E X release is specified because we want <strong>to</strong> use a<br />

comm<strong>and</strong> in the font styles. We start with the \section comm<strong>and</strong> which<br />

is <strong>to</strong> be centered, \Large <strong>and</strong> upper case.<br />

\renewcomm<strong>and</strong>{\section}{\@startsection {section}{1}{0pt}%<br />

{-3.5ex plus -1ex minus -.2ex}%<br />

{2.3ex plus.2ex}%<br />

{\centering\normalfont\Large\MakeUppercase}}<br />

The subsections <strong>and</strong> subsubsection titles are in small caps <strong>and</strong> bold<br />

slanted fonts respectively.<br />

\renewcomm<strong>and</strong>{\subsection}{\@startsection{subsection}{2}{20pt}%<br />

{-3.25ex plus -1ex minus -.2ex}%<br />

{1.5ex plus .2ex}%<br />

{\normalfont\large\scshape}}<br />

\renewcomm<strong>and</strong>{\subsubsection}{\@startsection{subsubsection}{3}%<br />

{10pt}%<br />

{-3.25ex plus -1ex minus -.2ex}%<br />

{1.5ex plus .2ex}%<br />

{\normalfont\normalsize\bfseries\slshape}}<br />

The paragraph <strong>and</strong> subparagraph titles are <strong>to</strong> be run-in types (negative<br />

post-skip).<br />

\renewcomm<strong>and</strong>{\paragraph}{\@startsection{paragraph}{4}{0pt}%<br />

{3.25ex plus 1ex minus.2ex}%<br />

{-1em}%<br />

{\normalfont\normalsize\underline}}<br />

\renewcomm<strong>and</strong>{\subparagraph}{\@startsection{subparagraph}{5}%<br />

{\parindent}%<br />

{3.25ex plus 1ex minus .2ex}%<br />

{-1em}%<br />

{\normalfont\normalsize\itshape}}<br />

Finally, redefine the section numbers <strong>to</strong> have a period after them.<br />

\renewcomm<strong>and</strong>{\@seccntformat}[1]{\@nameuse{the#1}.\quad}<br />

As an example of output with mysects, consider the short document:<br />

\documentclass{article}<br />

\usepackage{mysects}<br />

\setcounter{secnumdepth}{3}<br />

\begin{document}<br />

\section{His<strong>to</strong>rical Outline}<br />

\subsection{Medieval Life}<br />

\subsubsection{The Role of the Priest}<br />

\paragraph{In the Church}


The priest fulfills several functions.<br />

\subparagraph{At the Altar}<br />

Here the priest was master of ceremonies.<br />

\end{document}<br />

which produces output:<br />

1.1. Medieval Life<br />

1.1.1. The Role of the Priest<br />

D.4. Changing preprogrammed text 459<br />

1. HISTORICAL OUTLINE<br />

In the Church The priest fulfills several functions.<br />

At the Altar Here the priest was master of ceremonies.<br />

Because the counter secnumdepth was set <strong>to</strong> 3, numbering only goes <strong>to</strong><br />

the third level.<br />

D.4 Changing preprogrammed text<br />

D.4.1 Changing explicit names<br />

There are a number of titles that appear au<strong>to</strong>matically in L AT E X, such<br />

as ‘Contents’, ‘Bibliography’, ‘Chapter’. For works in languages other<br />

than English, it is necessary that they be replaced by their translations.<br />

And even in English, an author might prefer say ‘Summary’ in place<br />

of ‘Abstract’. All such explicit words are <strong>to</strong> be found in certain name<br />

comm<strong>and</strong>s that may be redefined as one pleases.<br />

These name comm<strong>and</strong>s are not defined in the basic L AT E X format itself,<br />

but rather in the various class files, as they are needed. Thus<br />

\chaptername exists only in classes book <strong>and</strong> report, but not in article.<br />

This means, if a package were <strong>to</strong> redefine the word ‘Chapter’ for all classes,<br />

it must do so with something like<br />

\providecomm<strong>and</strong>*{\chaptername}{}<br />

\renewcomm<strong>and</strong>*{\chaptername}{Chapitre}<br />

The st<strong>and</strong>ard set of name comm<strong>and</strong>s <strong>and</strong> their initial values are:<br />

(defined in book, report, <strong>and</strong> article classes)<br />

\contentsname {Contents}<br />

\listfigurename {List of Figures}<br />

\listtablename {List of Tables}<br />

\indexname {Index}<br />

\figurename {Figure}<br />

\tablename {Table}


460 Appendix D. L AT E X Programming<br />

\partname {Part}<br />

\appendixname {Appendix}<br />

(defined in book <strong>and</strong> report classes)<br />

\chaptername {Chapter}<br />

\bibname {Bibliography}<br />

(defined in article class)<br />

\abstractname {Abstract}<br />

\refname {References}<br />

(defined in letter class)<br />

\ccname {cc}<br />

\enclname {encl}<br />

\pagename {Page}<br />

\head<strong>to</strong>name {To}<br />

(defined in makeidx package)<br />

\seename {see}<br />

\alsoname {see also}<br />

(defined only in certain packages)<br />

\prefacename {Preface}<br />

\glossaryname {Glossary}<br />

\proofname {Proof}<br />

The redefinition of these name comm<strong>and</strong>s is a fundamental part of<br />

the multilingual babel system (Chapter 11). The comm<strong>and</strong>s are not redefined<br />

directly but rather by means of certain \captionslanguage such<br />

as \captionsgerman <strong>and</strong> \captionsenglish that allow for convenient<br />

switching back <strong>and</strong> forth between different languages. For example,<br />

D.4.2 The date<br />

\newcomm<strong>and</strong>*{\captionsgerman}{%<br />

\renewcomm<strong>and</strong>*{\contentsname}{Inhaltsverzeichnis}<br />

...<br />

\renewcomm<strong>and</strong>*{alsoname}{siehe auch}}<br />

The \<strong>to</strong>day comm<strong>and</strong> for the current date is another one that outputs<br />

explicit English words. Its st<strong>and</strong>ard definition conforms <strong>to</strong> the American<br />

style of giving dates, that is ‘January 15, 2004’. If one wants <strong>to</strong> redefine<br />

this, either for the British style (15th January 2004), or for another language<br />

al<strong>to</strong>gether, the best method is <strong>to</strong> follow the example of the other<br />

names comm<strong>and</strong>s: do not redefine \<strong>to</strong>day directly, but create comm<strong>and</strong>s<br />

that allow one <strong>to</strong> switch back <strong>and</strong> forth.<br />

For example, we can define \dateUSenglish <strong>and</strong> \dateenglish making<br />

use of the internal T E X counters \year, \month, \day <strong>and</strong> the T E X


\ifcase comm<strong>and</strong> (page 451).<br />

D.5. Direct typing of special letters 461<br />

\newcomm<strong>and</strong>*{\dateUSenglish}{\renewcomm<strong>and</strong>*{\<strong>to</strong>day}{%<br />

\ifcase\month \or<br />

January\or February\or March\or April\or May\or June\or<br />

July\or August\or September\or Oc<strong>to</strong>ber\or November\or<br />

December\fi \space\number\day, \number\year}}<br />

\newcomm<strong>and</strong>*{\dateenglish}{\renewcomm<strong>and</strong>*{\<strong>to</strong>day}{%<br />

\number\day \ifcase\day \or<br />

st\or nd\or rd\or th\or th\or th\or th\or th\or th\or th\or<br />

th\or th\or th\or th\or th\or th\or th\or th\or th\or th\or<br />

st\or nd\or rd\or th\or th\or th\or th\or th\or th\or th\or<br />

st\fi\space \ifcase\month \or<br />

January\or February\or March\or April\or May\or June\or<br />

July\or August\or September\or Oc<strong>to</strong>ber\or November\or<br />

December\fi \space\number\year}}<br />

Definitions for other languages can be modeled after these examples.<br />

D.5 Direct typing of special letters<br />

Package: In Section 2.5.9, we explained the inputenc package that permits direct<br />

inputenc typing of accented <strong>and</strong> special letters, provided one has an appropriate<br />

keyboard <strong>and</strong> display font. For example, on a German keyboard set<br />

up for Windows, typing the key marked ‘ß’ inserts character 223, which<br />

is displayed on the author’s moni<strong>to</strong>r as the ‘eszet’ letter for which the<br />

regular LAT EX input is \ss. The source file however, receives only the<br />

code number 223, which LAT EX would normally reject as unknown. The<br />

inputenc package with the ansinew option tells it that character 223 is<br />

<strong>to</strong> be treated as \ss. This will have the same result even if the file is<br />

displayed on a moni<strong>to</strong>r set up for a different coding.<br />

Table D.1 lists the current set of encoding options for the package.<br />

Others may be added in the future. For each of these options, there is<br />

corresponding .def file defining the extended characters with the comm<strong>and</strong>s<br />

\DeclareInputText{pos}{text} or<br />

\DeclareInputMath{pos}{math}<br />

which assign text or math coding <strong>to</strong> the character pos. For example,<br />

latin1.def contains<br />

\DeclareInputText{223}{\ss}<br />

<strong>to</strong> translate the input character code 223 <strong>to</strong> the L AT E X comm<strong>and</strong> \ss.<br />

Some T E X installations au<strong>to</strong>matically contain such conversions for their<br />

own local input coding scheme; files written under such a system without


462 Appendix D. L AT E X Programming<br />

Table D.1: Input coding schemes for inputenc package<br />

ascii 7-bit ascii encoding, characters 32–127 only<br />

latin1 ISO Latin-1 encoding (Western Europe)<br />

latin2 ISO Latin-2 encoding (Eastern Europe)<br />

latin3 ISO Latin-3 encoding (Catalan, Esperan<strong>to</strong>, Galacian, Maltese)<br />

latin4 ISO Latin-4 encoding (Sc<strong>and</strong>inavian, Greenl<strong>and</strong> Inuit, Lappish)<br />

latin5 ISO Latin-5 encoding (Turkish)<br />

latin9 ISO Latin-9 encoding (with euro symbol)<br />

decmulti DEC Multinational encoding<br />

cp850 IBM 850 code page (Western Europe)<br />

cp852 IBM 852 code page (Eastern Europe)<br />

cp437 IBM 437 code page (North America)<br />

cp437de Variant on 437, with German ß replacing Greek β in position 225<br />

cp865 IBM 865 code page (Sc<strong>and</strong>inavia)<br />

applemac Macin<strong>to</strong>sh encoding<br />

next NeXt encoding<br />

ansinew Windows ANSI encoding<br />

cp1252 Windows 1252 code page (same as ansinew)<br />

cp1250 Windows 1250 code page, for Central <strong>and</strong> Eastern Europe<br />

the inputenc package will be processed correctly on their own system,<br />

but will generate garbage on another one. Thus this package should<br />

always be added when special symbols are directly typed in, especially if<br />

there is any possibility that the file may be processed on another computer<br />

system.<br />

D.6 Alternatives for special symbols<br />

A number of symbols in the text fonts cannot be addressed explicitly, but<br />

only as ligatures, for example ¿ as ?‘. Other symbols that one might want<br />

in text are only available in math mode. L AT E X provides some \text..<br />

comm<strong>and</strong>s, listed in Table D.2 on the opposite page, <strong>to</strong> print these <strong>and</strong><br />

other characters directly.<br />

D.7 Managing code <strong>and</strong> documentation<br />

This section describes two additional advanced features for maintaining<br />

L AT E X code <strong>and</strong> its documentation. There is no need <strong>to</strong> employ these at<br />

all, for any home-written packages <strong>and</strong> classes will function just as well<br />

without them. They do add a degree of sophistication <strong>and</strong> security, by<br />

tracing the his<strong>to</strong>ry of the code’s development, <strong>and</strong> by including the current<br />

documentation within the code itself. Here ‘documentation’ means both<br />

the user’s manual <strong>and</strong> the programmer’s description of what each step of


D.7. Managing code <strong>and</strong> documentation 463<br />

Table D.2: Alternative comm<strong>and</strong>s for special symbols in text mode<br />

Comm<strong>and</strong> Symbol Replaces<br />

Ligatures<br />

\textemdash — ---<br />

\textendash – --<br />

\textexclamdown ¡ !‘<br />

\textquestiondown ¿ ?‘<br />

\textquotedblleft “ ‘‘<br />

\textquotedblright ” ’’<br />

\textquoteleft ‘ ‘<br />

\textquoteright ’ ’<br />

Math symbols<br />

\textbullet • $\bullet$<br />

\textperiodcentered · $\cdot$<br />

\textbackslash \ $\setminus$<br />

\textbar | $|$<br />

\textless < $ $>$<br />

Miscellaneous<br />

\textvisiblespace \verb*+ +<br />

\textasciicircum ˆ \verb+ˆ+<br />

\textasciitilde ˜ \verb+˜+<br />

\textsuperscript{123} 123 $ˆ{123}$<br />

Special symbols<br />

\textcompwordmark (ligature break)<br />

\textregistered ®<br />

\texttrademark <br />

\textcircled{x} x○<br />

the code is doing.<br />

The L AT E X installation files are written in this way. There are about 40<br />

such files that are processed with the DocStrip utility (next Section) <strong>to</strong><br />

extract the code from these files <strong>and</strong> merge it in<strong>to</strong> one file latex.ltx.<br />

The documentation for each contribu<strong>to</strong>ry file can be viewed alone, or a<br />

giant document can be created for the entire set. On the other h<strong>and</strong>,<br />

the st<strong>and</strong>ard class files, with much common coding, along with their<br />

option files, are all extracted from the one file classes.dtx, with a single<br />

documentation.<br />

More practically, many packages are provided as.dtx files containing<br />

the package code plus user manual <strong>and</strong> programmer’s documentation. A<br />

DocStrip batch job with extension.ins is also given, which when processed<br />

by L AT E X (or Plain T E X for that matter) extracts the actual .sty file, along<br />

with a drive.drv file. L AT E Xing the driver file generates the documentation.<br />

This is usually superfluous since the.dtx file itself is so constructed that


464 Appendix D. L AT E X Programming<br />

it behaves like a driver file. However, the .drv file can be edited by the<br />

user <strong>to</strong> select, say, just the user manual <strong>and</strong> <strong>to</strong> suppress the programmer<br />

notes.<br />

The next sections describe first the extraction program DocStrip, which<br />

can be used for many other applications as well (e.g. cus<strong>to</strong>m-bib, Section<br />

14.3), <strong>and</strong> then the integrated documentation scheme in the following<br />

section.<br />

D.7.1 The DocStrip utility<br />

Since the T E X program is a programming as well as a text formatting<br />

language, it can be exploited <strong>to</strong> provide a number of utility ‘programs’ <strong>to</strong><br />

manipulate files. Such programs are immediately portable: if you have<br />

T E X, you can run them. One example of such a program is the DocStrip<br />

utility for extracting functioning code out of one or more source files<br />

containing documentation, as comments. The program was originally<br />

written by Frank Mittelbach <strong>and</strong> further developed by Johannes Braams,<br />

Denys Duchier, Marcin Woliński, <strong>and</strong> Mark Wooding.<br />

The basic idea was <strong>to</strong> copy one file <strong>to</strong> another leaving off all the<br />

comment lines. From this simple concept came two additional features<br />

that extended the application of DocStrip: alternative lines of coding<br />

could be selectively suppressed or included depending on options chosen<br />

at processing time; <strong>and</strong> multiple files, or modules, could be input <strong>to</strong> form<br />

a single output file. This means that one source file can be the home<br />

of several different L AT E X packages, <strong>and</strong> that a single package file can be<br />

constructed out of many different components, as for the main L AT E X file<br />

latex.ltx mentioned above.<br />

Running interactively<br />

The simplest way of running DocStrip on a file is <strong>to</strong> invoke it with T E X (or<br />

L AT E X, but T E X is faster), as<br />

tex docstrip<br />

which produces the response<br />

**********************************************************<br />

* This program converts documented macro-files in<strong>to</strong> fast *<br />

* loadable files by stripping off (nearly) all comments! *<br />

**********************************************************<br />

****************************************************<br />

* First type the extension of your input file(s): *<br />

\infileext=<br />

****************************************************


D.7. Managing code <strong>and</strong> documentation 465<br />

One replies by entering the input extension (usually .dtx); then one is<br />

asked in turn for the output extension, the options wanted, <strong>and</strong> finally,<br />

for the root name of the file(s) <strong>to</strong> be processed. Execution follows.<br />

There are some limitations <strong>to</strong> this method, since the input <strong>and</strong> output<br />

files have the same root name, differing only in the extension, <strong>and</strong> initial<br />

<strong>and</strong> final comments added <strong>to</strong> the output are fixed. The more flexible<br />

means of running the utility is with a batch job.<br />

Running as a batch job<br />

A DocStrip batch job is a file containing instructions for the utility. For<br />

example, suppose the fullpage package illustrated in Section D.3.1 is<br />

put in<strong>to</strong> a documented source file called fullpage.dtx, <strong>and</strong> the actual<br />

package file fullpage.sty is <strong>to</strong> be extracted with the option package,<br />

while a documentation driver file fullpage.drv is obtained with option<br />

driver; the batch file, named fullpage.ins, could look like<br />

\input docstrip<br />

\preamble<br />

This is a stripped version of the original file.<br />

\endpreamble<br />

\postamble<br />

This is the end of the stripped file.<br />

\endpostamble<br />

\declarepreamble\predriver<br />

This is a documentation driver file.<br />

\endpreamble<br />

\declarepostamble\postdriver<br />

End of documentation driver file.<br />

\endpostamble<br />

\keepsilent<br />

\askforoverwritefalse<br />

\generate{\file{fullpage.sty}{\from{fullpage.dtx}{package}}<br />

\file{fullpage.drv}{\usepreamble\predriver<br />

\usepostamble\postdriver<br />

\from{fullpage.dtx}{driver}}<br />

}<br />

\endbatchfile<br />

The first <strong>and</strong> last lines are vital: first the file docstrip.tex is loaded,<br />

defining all the special DocStrip comm<strong>and</strong>s; then after the instructions<br />

have been executed, \endbatchfile ensures an orderly termination.


466 Appendix D. L AT E X Programming<br />

The comm<strong>and</strong>s \preamble <strong>and</strong> \postamble allow one <strong>to</strong> insert explana<strong>to</strong>ry<br />

comments at the beginning <strong>and</strong> end of the extracted file.<br />

The preamble is often a copyright notice <strong>and</strong>/or a caveat that the extracted<br />

file should never be distributed without the source. Additional<br />

labeled pre- <strong>and</strong> postambles may be declared with \declarepreamble<br />

<strong>and</strong> \declarepostamble, <strong>and</strong> activated with declarations \usepreamble<br />

<strong>and</strong> \usepostamble.<br />

The instructions \keepsilent <strong>and</strong> \askforoverwritefalse are optional.<br />

The former suppresses processing information during the run<br />

while the latter turns off the warning that an existing file may be overwritten.<br />

The main comm<strong>and</strong> is \generate which specifies the files <strong>to</strong> be created<br />

with a series of \file comm<strong>and</strong>s, each taking two arguments: the name of<br />

the new file <strong>and</strong> a list of instructions for its production. These instructions<br />

can be declarations like \keepsilent or \usepreamble, but the main one<br />

is the comm<strong>and</strong> \from. This again takes two arguments: the name of the<br />

input file <strong>and</strong> a list of the options <strong>to</strong> be applied. In the above example,<br />

each generated file has only a single input source, but multiple input files<br />

are possible with a series of \from comm<strong>and</strong>s.<br />

The created fullpage.sty file now contains<br />

%%<br />

%% This is file ‘fullpage.sty’,<br />

%% generated with the docstrip utility.<br />

%%<br />

%% The original source files were:<br />

%%<br />

%% fullpage.dtx (with options: ‘package’)<br />

%% This is a stripped version of the original file.<br />

%% Copyright (C) 1994 Patrick W. Daly<br />

\NeedsTeXFormat{<strong>LaTeX</strong>2e}<br />

. . . . . . . . . . . . . . . . . . . . . .<br />

\add<strong>to</strong>length{\<strong>to</strong>pmargin}{-1in}<br />

%% This is the end of the stripped file.<br />

%%<br />

%% End of file ‘fullpage.sty’.<br />

It is possible <strong>to</strong> have a master batch job <strong>to</strong> process individual ones, in<br />

which case the master must input them with \batchinput, <strong>and</strong> not with<br />

\input.<br />

Rules for removing lines<br />

The \generate <strong>and</strong> \file comm<strong>and</strong>s cause the input file(s) <strong>to</strong> be transferred<br />

<strong>to</strong> the output file, line by line, according <strong>to</strong> the following rules:<br />

1. any lines beginning with a single % sign are removed;


D.7. Managing code <strong>and</strong> documentation 467<br />

2. any lines beginning with double %% signs are retained;<br />

3. any line beginning with % (or %) will have the rest of its<br />

text transferred if opt is one of the selected options; otherwise it is<br />

removed;<br />

4. any line beginning with % (or %) will have the rest of its<br />

text transferred if opt is not one of the selected options; otherwise<br />

it is removed;<br />

5. all lines between % <strong>and</strong> % are retained or removed<br />

depending on whether opt is a selected option or not.<br />

Options can be combined logically, negated, <strong>and</strong> grouped:<br />

a&b (a <strong>and</strong> b);<br />

a|b (a or b);<br />

!a (not a);<br />

(a|b)&c (c <strong>and</strong> one of a or b)<br />

For more information on DocStrip, see the documentation which can<br />

be obtained by processing docstrip.dtx with L AT E X.<br />

D.7.2 Documenting L AT E X coding<br />

The documenting of software products is extremely important: it provides<br />

on the one h<strong>and</strong> a manual for the user, <strong>and</strong> on the other details about<br />

the coding for the programmer. The original L AT E X styles, as well as the<br />

basic latex.tex file, were heavily commented by Leslie Lamport, but only<br />

with straightforward normal text. It was Frank Mittelbach’s doc package<br />

that first allowed sophisticated, integrated documentation of the source<br />

codes.<br />

By integrated documentation, we mean that the descriptions <strong>and</strong> the<br />

coding are <strong>to</strong> be found merged <strong>to</strong>gether in a single source file. Thus<br />

two processes are necessary, one <strong>to</strong> extract the actual coding on its own<br />

(the DocStrip utility of Section D.7.1) <strong>and</strong> another <strong>to</strong> print the documentation<br />

(the doc package). The basic idea behind this package is that the<br />

comments are in fact regular L AT E X text, with some extra features <strong>to</strong> allow<br />

au<strong>to</strong>matic indexing <strong>and</strong> <strong>to</strong> record the program’s development. The coding<br />

itself appears in a special type of verbatim environment.<br />

The documentation is produced by running a special driver file through<br />

L AT E X. Such a driver for a source file named fullpage.dtx would be, in<br />

its simplest form,<br />

\documentclass{article}<br />

\usepackage{doc}<br />

\begin{document}<br />

\DocInput{fullpage.dtx}<br />

\end{document}


468 Appendix D. L AT E X Programming<br />

The \DocInput comm<strong>and</strong> reads in the specified file, but it first alters the<br />

function of the % character from ‘comment’ <strong>to</strong> ‘do nothing’. This means<br />

all comment lines in fullpage.dtx become real text <strong>to</strong> be processed!<br />

We describe some of the extra features that the doc package makes<br />

available for the ‘comments’ in the .dtx files, illustrated by an example,<br />

the source file fullpage.dtx for the fullpage package presented in<br />

Section D.3.1. As usual, a more complete manual can be acquired by<br />

processing doc.dtx.<br />

The description part<br />

The documentation consists of two parts: the description, which is a<br />

manual for the end user, <strong>and</strong> the coding, a detailed explanation of how<br />

the software works, including the lines of code themselves. It is possible<br />

<strong>to</strong> suppress the coding part <strong>and</strong> <strong>to</strong> print only the description by issuing<br />

\OnlyDescription<br />

in the preamble.<br />

Special comm<strong>and</strong>s for the description part are:<br />

\DescribeMacro{\macro name}<br />

\DescribeEnvironment{env name}<br />

which are placed at the start of the text that illustrates a new high-level<br />

comm<strong>and</strong> (macro) or environment. These comm<strong>and</strong>s do two things: they<br />

place the macro or environment name in a marginal note at that location<br />

(for easy reference when reading) <strong>and</strong> they insert an entry in the index.<br />

Because documentation needs <strong>to</strong> use the \verb comm<strong>and</strong> frequently<br />

for printing input text, some abbreviations are provided with<br />

\MakeShortVerb{\c} <strong>and</strong> \DeleteShortVerb{\c}<br />

which first turn the character c in<strong>to</strong> shorth<strong>and</strong> for \verbc, <strong>and</strong> then res<strong>to</strong>re<br />

its normal use. For example, after \MakeShortVerb{\|}, |\mycom|<br />

prints \mycom. (These comm<strong>and</strong>s can be made available for any document<br />

by loading the package shortvrb, which is actually extracted from the<br />

doc package.)<br />

If the comment character % has been deactivated, how can one put<br />

comments in<strong>to</strong> the documentation text? One way is <strong>to</strong> make use of the<br />

T E X conditional \iffalse <strong>to</strong> form a block, or meta comment, as<br />

% \iffalse<br />

% These lines are ignored even when the<br />

% percent character is inactive<br />

% \fi<br />

The other method is <strong>to</strong> use ˆˆA in place of %, a special doc feature.<br />

The description part is terminated with


\S<strong>to</strong>pEventually{final text}<br />

D.7. Managing code <strong>and</strong> documentation 469<br />

where final text is <strong>to</strong> appear at the very end of the article; if only the<br />

description part is printed, final text is printed immediately <strong>and</strong> the<br />

documentation is ended.<br />

The coding part<br />

The coding part should normally contain the more specialized material<br />

that is of no interest <strong>to</strong> the everyday user. The special comm<strong>and</strong>s that<br />

may be used here are<br />

\begin{macro}{\macro name} text <strong>and</strong> code \end{macro}<br />

\begin{environment}{env name} text <strong>and</strong> code \end{environment}<br />

both of which again insert a marginal note <strong>and</strong> make an entry in the index.<br />

They also organize any \changes comm<strong>and</strong>s, as explained below.<br />

The most important environment in the coding part is macrocode,<br />

which prints its contents as in verbatim, optionally with a code line<br />

number. The form of this environment is somewhat special:<br />

\begin{macrocode}<br />

lines of code<br />

\end{macrocode}<br />

The four spaces before the \end{macrocode} are obliga<strong>to</strong>ry; those before<br />

the \begin are not necessary, but it is good practice <strong>to</strong> insert them for<br />

symmetry. This environment also counts all the backslashes within it for<br />

a checksum test, <strong>and</strong> makes an index entry for every comm<strong>and</strong> name that<br />

it finds. So it is something more than a mere verbatim environment!<br />

The coding part is brought <strong>to</strong> an end with<br />

\Finale<br />

which carries out the checksum test <strong>and</strong> prints the s<strong>to</strong>red final text from<br />

\S<strong>to</strong>pEventually. There may actually be more text following it, which<br />

is only printed when both description <strong>and</strong> coding parts are output.<br />

Index of macros <strong>and</strong> record of changes<br />

The doc package makes au<strong>to</strong>matic entries in<strong>to</strong> an index by means of<br />

the two \Describexxx comm<strong>and</strong>s <strong>and</strong> the two environments presented<br />

above. As well, all comm<strong>and</strong>s that appear in the coding are indexed.<br />

However, the indexing is turned on only if one of<br />

\CodelineIndex or \PageIndex<br />

is given in the preamble. The first references the indexed comm<strong>and</strong>s <strong>to</strong><br />

the number of the code line where they appear, the second <strong>to</strong> the page


470 Appendix D. L AT E X Programming<br />

number. In the second case, the code lines are not numbered, unless the<br />

declaration \CodelineNumbered is also issued.<br />

Since not all comm<strong>and</strong>s in the coding really need <strong>to</strong> be indexed, especially<br />

those that are part of st<strong>and</strong>ard L AT E X <strong>and</strong> T E X, the comm<strong>and</strong><br />

\DoNotIndex{list of comm<strong>and</strong> names}<br />

is given, often repeatedly, near the beginning, <strong>to</strong> exempt the listed comm<strong>and</strong>s<br />

from being indexed.<br />

The au<strong>to</strong>matic indexing of all the comm<strong>and</strong>s in the code slows down<br />

the processing considerably. Once the index.idx file has been produced,<br />

future runs do not need <strong>to</strong> repeat this effort (unless there have been<br />

changes <strong>to</strong> the code). The comm<strong>and</strong><br />

\DisableCrossrefs<br />

will suppress this indexing, but it may be counterm<strong>and</strong>ed by an earlier<br />

\EnableCrossrefs which neutralizes the disabling comm<strong>and</strong>.<br />

The text of the index is generated from the .idx data file by the<br />

MakeIndex program (Section 9.4.3), which must be run with the special<br />

indexing style gind.ist as<br />

makeindex -s gind.ist filename<br />

The indexing style file gind.ist can be extracted from doc.dtx.<br />

To print the index, the comm<strong>and</strong><br />

\PrintIndex<br />

is placed where it should appear. Often this is part of the final text in<br />

\S<strong>to</strong>pEventually. An up-<strong>to</strong>-date index can only appear after MakeIndex<br />

has been run between two L AT E X processings.<br />

A record of changes <strong>to</strong> the software can be made by inserting<br />

\changes{version}{date}{text}<br />

throughout the documentation, in both the description <strong>and</strong> coding parts.<br />

To form the change his<strong>to</strong>ry list, the comm<strong>and</strong><br />

\RecordChanges<br />

must be placed in the preamble. This enables the change entries <strong>to</strong> be<br />

placed in a glossary file, which is then processed by MakeIndex as<br />

makeindex -s gglo.ist -o filename.gls filename.glo<br />

(The indexing style file gglo.ist is also extracted from doc.dtx.) The<br />

change his<strong>to</strong>ry is then printed in the documentation where<br />

\PrintChanges<br />

is located, again often as part of final text. The texts of the \changes<br />

comm<strong>and</strong>s are ordered, first by version number, then by the name of the<br />

macro or environment in which they appear.


Integrity tests<br />

D.7. Managing code <strong>and</strong> documentation 471<br />

If the source file is <strong>to</strong> be sent over electronic networks, there is a danger<br />

that it might be corrupted or truncated. Two tests are possible <strong>to</strong> check<br />

for this. By placing<br />

\CheckSum{num}<br />

near the start of the documentation (before the coding anyway), all the<br />

backslashes in the macrocode environments will be added up, <strong>and</strong> the<br />

<strong>to</strong>tal compared with the number num by the \Finale comm<strong>and</strong>. If<br />

num=0, the true <strong>to</strong>tal will be printed on the moni<strong>to</strong>r; otherwise, if the<br />

sum does not agree with num, an error is printed, with the two values.<br />

The other test checks that the character set has not been corrupted by<br />

passing through computer systems with different character codes.<br />

\CharacterTable<br />

{Upper-case \A\B\C\D\E\F\G\H. . .<br />

. . . . .<br />

. . . . . Tilde \˜}<br />

The argument must agree exactly with that expected by doc (except for<br />

inactive % signs <strong>and</strong> multiple spaces). It should be copied from the<br />

doc.sty or doc.dtx files.<br />

Obtaining the file information<br />

File information may be obtained with the comm<strong>and</strong><br />

\GetFileInfo{filename}<br />

which defines \filename, \filedate, \fileversion, <strong>and</strong> \fileinfo<br />

from the optional release information <strong>to</strong> be found in the \Providesxxx<br />

comm<strong>and</strong> identifying the specified file (Section D.2.1). The idea is that<br />

the .dtx file should contain this information once, <strong>and</strong> only once, but it<br />

needs <strong>to</strong> be known <strong>to</strong> print it in the title of the article. These \filexxx<br />

comm<strong>and</strong>s may be used for this purpose. The release information must<br />

conform <strong>to</strong> the sequence date, blank, version, blank, text.<br />

The ltxdoc class<br />

A special class called ltxdoc is provided <strong>to</strong> assist running the doc package.<br />

It invokes the article class with the doc package, <strong>and</strong> then issues<br />

comm<strong>and</strong>s<br />

\AtBeginDocument{\MakeShortVerb{\|}}<br />

\CodelineNumbered<br />

\DisableCrossrefs


472 Appendix D. L AT E X Programming<br />

<strong>and</strong> defines a number of other useful comm<strong>and</strong>s for aiding the documentation.<br />

See the description by processing ltxdoc.dtx. It also provides for<br />

local configuration: if ltxdoc.cfg exists, it is read in. This can pass paper<br />

size or other formatting options <strong>to</strong> article, issue \OnlyDescription<br />

by means of \AtBeginDocument, <strong>and</strong> so on.<br />

A sample.dtx file<br />

To illustrate these features, we show part of the source file fullpage.dtx.<br />

The initial lines ensure that all the files that can be extracted from it (the<br />

package .sty <strong>and</strong> the documentation driver .drv) receive their proper<br />

identifying comm<strong>and</strong>s. The date <strong>and</strong> version information appears only<br />

once, but is transferred <strong>to</strong> both extracted files.<br />

% \iffalse (This is a meta-comment)<br />

%% Copyright (C) 1994 Patrick W. Daly<br />

\NeedsTeXFormat{<strong>LaTeX</strong>2e}<br />

%<br />

\ProvidesFile {fullpage.dtx}<br />

%<br />

%\ProvidesPackage{fullpage}<br />

%\ProvidesFile{fullpage.drv}<br />

% \fi<br />

%\ProvidesFile{fullpage}<br />

[2002/02/15 1.1 (PWD)]<br />

It is the last \ProvidesFile{fullpage} that enables the proper functioning<br />

of \GetFileInfo; the first one is only a dummy <strong>to</strong> absorb the<br />

information line when the.dtx file is read directly.<br />

Next, the driver part is given. This is what L AT E X sees when it processes<br />

the file directly.<br />

%\iffalse<br />

%<br />

\documentclass[a4paper,11pt]{article}<br />

\usepackage{doc}<br />

\EnableCrossrefs<br />

\RecordChanges<br />

\CodelineIndex<br />

\begin{document}<br />

\DocInput{fullpage.dtx}<br />

\end{document}<br />

%<br />

%\fi<br />

Now the checksum <strong>and</strong> list of comm<strong>and</strong>s that are not <strong>to</strong> be indexed<br />

are given, followed by the start of the article.<br />

% \CheckSum{73}<br />

% \DoNotIndex{\add<strong>to</strong>length,\boolean,\ExecuteOptions,\ifthenelse}


D.7. Managing code <strong>and</strong> documentation 473<br />

% \DoNotIndex{\newboolean,\newlength,\ProcessOptions}<br />

% \DoNotIndex{\RequirePackage,\setboolean,\setlength}<br />

% \changes{1.0}{1994 Feb 15}{Initial version}<br />

% \changes{1.1}{2002 Feb 15}{Next revision}<br />

% \GetFileInfo{fullpage}<br />

% \title{\bfseries A Package <strong>to</strong> Set Margins <strong>to</strong> Full Page}<br />

% \author{Patrick W. Daly}<br />

% \date{This paper describes package \texttt{\filename}\\<br />

% version \fileversion, from \filedate}<br />

% \maketitle<br />

% \MakeShortVerb{\|}<br />

%<br />

% \section{Purpose}<br />

% To set a uniform margin of one inch or 1.5˜cm on all four<br />

% . . . . . .<br />

We advance <strong>to</strong> the end of the description <strong>and</strong> start of the coding part.<br />

% \S<strong>to</strong>pEventually{\PrintIndex\PrintChanges}<br />

%<br />

% \section{The Coding}<br />

% The first thing is <strong>to</strong> read in the \texttt{ifthen} package,<br />

% if it is not already there.<br />

% \begin{macrocode}<br />

%<br />

\RequirePackage{ifthen}<br />

% \end{macrocode}<br />

%<br />

% \begin{macro}{\DeclareOption}<br />

% \begin{macro}{\FP@margin}<br />

% Define the options with help of the length |\FP@margin|. The<br />

% options |in| <strong>and</strong> |cm| select the actual margin size.<br />

% \begin{macrocode}<br />

\newlength{\FP@margin}<br />

\DeclareOption{in}{\setlength{\FP@margin}{1in}}<br />

\DeclareOption{cm}{\setlength{\FP@margin}{1.5cm}}<br />

% \end{macrocode}<br />

% \end{macro}<br />

The end of the file finishes the coding <strong>and</strong> calls \Finale.<br />

. . . . . . .<br />

\setlength{\<strong>to</strong>pmargin}{\FP@margin}<br />

\add<strong>to</strong>length{\<strong>to</strong>pmargin}{-1in}<br />

%<br />

% \end{macrocode}<br />

% \end{macro}\end{macro}<br />

% \Finale


E<br />

LAT E X <strong>and</strong> World Wide<br />

Web<br />

Today it is no longer sufficient <strong>to</strong> produce professional-looking printed<br />

output on paper; one has <strong>to</strong> be able <strong>to</strong> get it online as well, that is, make<br />

it available in electronic form of some kind. To some extent, PostScript<br />

output fulfills this requirement in that it may be considered electronic<br />

paper. However, as we point out in Section 15.3, true electronic documents<br />

are something quite different.<br />

The Internet used <strong>to</strong> be a nice, quiet neighborhood where academics<br />

could exchange simple, plain text emails or obtain known files by FTP, until<br />

it was invaded by the rowdy World Wide Web with its corporate identities,<br />

slick advertising, energetic yuppies, anarchists, <strong>and</strong> revolutionaries. In<br />

other words, it went cosmopolitan. It is here in this glittering marketplace<br />

that electronic documents have <strong>to</strong> compete for attention.<br />

An electronic document is not something that is simply sent <strong>to</strong> a<br />

printer or leisurely viewed on a moni<strong>to</strong>r: it is interactive, in that it guides<br />

the reader <strong>to</strong> other parts of itself or <strong>to</strong> other documents located anywhere<br />

else on the Web. With these links, the viewer can jump <strong>to</strong> other relevant<br />

passages with a mere mouse click. Colored illustrations are naturally<br />

part of such documents, but so are sounds <strong>and</strong> movies, as well as means<br />

of sending feedback <strong>to</strong> the author. This is a <strong>to</strong>tally new medium for<br />

information exchange, more radical than the Gutenberg revolution from<br />

h<strong>and</strong>written manuscripts <strong>to</strong> printed books.<br />

In Section 1.2 we explain the structural similarities between L AT E X <strong>and</strong><br />

the Web languages HTML <strong>and</strong> XML. Here we point out the possibilities for<br />

conversion from L AT E X <strong>to</strong> the others, <strong>and</strong> then how T E X can be used as an<br />

engine <strong>to</strong> render XML documents in L AT E X formats. Detailed descriptions of<br />

the conversion programs are <strong>to</strong> be found in the supplied documentation,<br />

<strong>and</strong> in the L AT E X Web Companion (Goossens <strong>and</strong> Rahtz, 1999). This <strong>to</strong>pic<br />

is far <strong>to</strong>o extensive <strong>to</strong> be dealt with in this book.<br />

475


476 Appendix E. L AT E X <strong>and</strong> World Wide Web<br />

E.1 Converting <strong>to</strong> HTML<br />

E.1.1 The L AT E X2HTML program<br />

The L AT E X2HTML transla<strong>to</strong>r, written by Nikos Drakos with additions by a<br />

large number of contribu<strong>to</strong>rs, is a comprehensive Perl script that converts<br />

a L AT E X source file in<strong>to</strong> HTML with the help of several other programs,<br />

notably L AT E X itself, dvips, Ghostscript, <strong>and</strong> the netpbm library of graphics<br />

utilities.<br />

When L AT E X2HTML processes a L AT E X file, it creates a new subdirec<strong>to</strong>ry<br />

with the same name as that file, <strong>to</strong> which it writes the resulting HTML<br />

output <strong>and</strong> any generated images as .gif files. The program interprets<br />

the L AT E X input text in the same way as L AT E X itself does, but instead of<br />

producing typesetting instructions in the .dvi file, it writes appropriate<br />

HTML code <strong>to</strong> an .html file. For example, \section{Introduction} is<br />

interpreted as Introduction for the output.<br />

This means that L AT E X2HTML is essentially duplicating the L AT E X processing,<br />

an enormous undertaking. Since the document classes contain<br />

varying comm<strong>and</strong>s or have common ones behaving differently, there must<br />

be Perl scripts for each one (article.perl, <strong>and</strong> so on) <strong>to</strong> program these<br />

comm<strong>and</strong>s properly. Additional packages loaded with \usepackage can<br />

also define new comm<strong>and</strong>s, or alter the functionality of existing ones;<br />

the transla<strong>to</strong>r must be informed about these by means of corresponding<br />

Perl scripts. For example, the natbib package described in Section 9.3.4<br />

defines citation comm<strong>and</strong>s \citet <strong>and</strong> \citep, which need <strong>to</strong> be made<br />

available <strong>to</strong> L AT E X2HTML in a file natbib.perl. Most of the <strong>to</strong>ols packages<br />

of Section B.5.4 are included as Perl scripts, as are many other popular<br />

contributed packages. In other words, the entire L AT E X2HTML installation<br />

must mirror the L AT E X one.<br />

This process is somewhat simplified by the fact that both formats<br />

are markup languages written in pure typewriter text. However, this<br />

similarity soon reaches its limits with the many L AT E X features not available<br />

in HTML, such as complex math, included figures, cross-referencing. In<br />

the other direction, HTML exhibits hyperlinks, both internally <strong>and</strong> <strong>to</strong><br />

external documents, something not provided by normal L AT E X.<br />

L AT E X2HTML attempts <strong>to</strong> reproduce math with the limited HTML possibilities,<br />

but failing that, formulas are h<strong>and</strong>led the same as figures <strong>and</strong><br />

other environments that cannot be directly rendered: they are converted<br />

<strong>to</strong> GIF image files along the route.tex →.dvi →.ps →.pbm →.gif, which<br />

are then included in the HTML file as in-line images.<br />

Cross-references <strong>and</strong> citations are au<strong>to</strong>matically provided with hyperlinks<br />

<strong>to</strong> their targets; the keyword index also links back <strong>to</strong> the text. Other<br />

features of HTML can be included by means of special comm<strong>and</strong>s defined<br />

in the html.sty package. For example:<br />

• explicit hyperlinks, internal <strong>and</strong> external


E.1. Converting <strong>to</strong> HTML 477<br />

• conditional text for the HTML or L AT E X versions only<br />

• raw HTML code<br />

• segmentation of the HTML output<br />

• finer image control<br />

• . . .<br />

This package thus provides the L AT E X writer with a more convenient interface<br />

for producing hypertext documents; furthermore, the same document<br />

can still be processed with L AT E X <strong>to</strong> generate the ‘paper’ version at<br />

any time. The conditional text mentioned above allows the electronic <strong>and</strong><br />

paper versions <strong>to</strong> exhibit some differences.<br />

L AT E X2HTML is available on the CTAN servers (Figure B.4 on page 390)<br />

under the support direc<strong>to</strong>ry. It can also be downloaded from the<br />

L AT E X2HTML home page http://cbl.leeds.ac.uk/nikos/tex2html/<br />

doc/latex2html/latex2html.html, where more information as well as<br />

a manual can be obtained.<br />

E.1.2 The T E X4ht program<br />

An alternative program is that by Eitan M. Gurari, called T E X4ht. It produces<br />

much the same results as L AT E X2HTML, but by a different route.<br />

Rather than trying <strong>to</strong> interpret the L AT E X input text itself, it processes<br />

instead the.dvi file <strong>to</strong> extract the HTML output. It is therefore applicable<br />

both <strong>to</strong> L AT E X <strong>and</strong> Plain T E X, as its name implies.<br />

In reality, it is not as simple as that. Since the DVI output is normally<br />

only a list of typesetting instructions, containing no logical markup information<br />

at all, it is necessary <strong>to</strong> process the L AT E X input with the matching<br />

TeX4ht.sty package that redefines all the regular L AT E X comm<strong>and</strong>s <strong>to</strong><br />

write appropriate code <strong>to</strong> the.dvi file. This is accomplished by means of<br />

the \special comm<strong>and</strong>, a basic T E X comm<strong>and</strong> for writing instructions <strong>to</strong><br />

a particular DVI driver. In this case the driver is the T E X4ht program; no<br />

other driver will be able <strong>to</strong> process this.dvi file.<br />

The T E X4ht processor writes the HTML output according <strong>to</strong> various<br />

options specified in the L AT E X input. For example, the HTML output can be<br />

segmented by chapters or sections, tables of contents may be added <strong>to</strong><br />

each segment, links are au<strong>to</strong>matically established for cross-references. As<br />

with L AT E X2HTML, manual links <strong>to</strong> external documents or internal points<br />

can be made, raw HTML coding included, explicit images included. It<br />

is also possible <strong>to</strong> turn off the HTML conversion in order <strong>to</strong> produce a<br />

normal .dvi file; conditional input for whether HTML is on or off is also<br />

available.<br />

Any symbols, tables, equations, or imported figures that cannot be<br />

directly rendered in HTML are written <strong>to</strong> a new DVI file, with extension


478 Appendix E. L AT E X <strong>and</strong> World Wide Web<br />

.idv, one item per page. Finally, a log file is written containing conversion<br />

instructions for each such object; this file is so constructed as <strong>to</strong> act as<br />

a script, or batch job, for creating GIF images. Just how this conversion<br />

is realized <strong>and</strong> how the instructions are formatted depend on the local<br />

installation <strong>and</strong> can be configured by the user. However, the usual route is<br />

something like.idv →.ps (dvips) →.ppm (Ghostscript) →.gif (pbm). An<br />

example of T E X4ht output with a GIF representation of a math equation<br />

can be seen in Figure E.1 on page 482.<br />

Since T E X4ht needs <strong>to</strong> redefine all the L AT E X markup comm<strong>and</strong>s, one<br />

could argue that it <strong>to</strong>o is duplicating L AT E X just like L AT E X2HTML. To some<br />

extent this is true, although there is a very important difference: it is only<br />

the markup, not the formatting comm<strong>and</strong>s, that needs <strong>to</strong> be massaged.<br />

Most classes <strong>and</strong> additional packages will need no extra configuring <strong>to</strong><br />

be processed by T E X4ht. A package like natbib which adds new citation<br />

comm<strong>and</strong>s \citet <strong>and</strong> \citep will <strong>to</strong>tally confuse L AT E X2HTML without<br />

the additional Perl script natbib.perl, whereas under T E X4ht these comm<strong>and</strong>s<br />

will produce the correct output text in the HTML file without any<br />

additional definitions. (However, the au<strong>to</strong>matic links between the citations<br />

<strong>and</strong> list of references will be missing, since this is a markup feature,<br />

but the printed text will be all right.)<br />

T E X4ht is available from the T E XLive CD, or from http://www.cis.<br />

ohio-state.edu/˜gurari/TeX4ht/mn.html.<br />

L AT E X2HTML <strong>and</strong> T E X4ht are only two examples of procedures for creating<br />

HTML output from L AT E X. In both cases, one should not try <strong>to</strong> convert<br />

arbitrary L AT E X files, but should view them as means of producing normal<br />

L AT E X <strong>and</strong> HTML output from a common source file. This source file must<br />

be constructed accordingly, possibly with conditional texts for the two<br />

outputs, with manual hyperlinks, formatting options for HTML, <strong>and</strong> so<br />

on.<br />

The use of GIF bitmap images for rendering items not readily available<br />

in HTML, while producing the visual features on screen, does not allow<br />

these objects <strong>to</strong> be searched for or otherwise further processed. Such<br />

images also do not participate in au<strong>to</strong>matic font size changes <strong>and</strong> other<br />

Web manipulations.<br />

E.2 The Extensible Markup Language: XML<br />

It has long been recognized that HTML has many severe limitations. Its<br />

simplicity may have been responsible for its rapid rise in popularity, but<br />

that simplicity also restricts it <strong>to</strong> the type of documents for which it was<br />

originally intended. Today the Web is offering much more than at the<br />

beginning, with databases, search engines, data verification. HTML is not<br />

programmable, so that browser suppliers have found it necessary <strong>to</strong> add<br />

additional features of their own, which only function with their browser.


E.2. The Extensible Markup Language: XML 479<br />

St<strong>and</strong>ardization is thus destroyed.<br />

What is needed is a means of adding new features <strong>to</strong> an HTML file<br />

so that the browser can be informed of what they mean. This would be<br />

like adding new features <strong>to</strong> a L AT E X file by means of a package. It is <strong>to</strong><br />

this end that the Web Consortium began the development in 1996 of the<br />

Extensible Markup Language, or XML.<br />

However, XML is not so much a language as a specification for defining<br />

languages in a st<strong>and</strong>ard manner. An XML interpreter must be able<br />

<strong>to</strong> determine whether an XML document conforms <strong>to</strong> the general rules<br />

(mainly that all tags are properly closed), in which case it is considered<br />

<strong>to</strong> be well-formed, <strong>and</strong> <strong>to</strong> the specific syntax of the tags that it uses (as<br />

defined in a DTD, Document Type Definition), in which case it is also valid.<br />

There remains the question of how those tags are <strong>to</strong> be rendered (how<br />

are sections formatted, what <strong>to</strong> do with cross references, how <strong>to</strong> include<br />

graphics), which is relegated <strong>to</strong> style sheets documented in the Extensible<br />

Stylesheet Language, XSL. Here we have true separation between content<br />

<strong>and</strong> format, between logical <strong>and</strong> typographical markup.<br />

If all this sounds overwhelming, it is! Furthermore, the DTDs are<br />

considered <strong>to</strong> be <strong>to</strong>o cumbersome <strong>and</strong> various alternatives have been<br />

developed, themselves conforming <strong>to</strong> XML (which the DTDs do not). This<br />

whole area is in transition, but the rewards will be high when a reliable<br />

st<strong>and</strong>ard for electronic data exchange is achieved. Data in this sense is<br />

very generic, <strong>and</strong> includes textual documents. We recommend the books<br />

by (Marchal, 2000) <strong>and</strong> (Williamson, 2001); or one can check the Web<br />

Consortium home page http://www.w3.org/.<br />

E.2.1 XML <strong>and</strong> L AT E X<br />

What does all this have <strong>to</strong> do with L AT E X? Just as the similarity between<br />

L AT E X <strong>and</strong> HTML allow relative easy conversion, so does the essential<br />

similarity with XML. The T E X4ht system has already done the real work of<br />

converting L AT E X structure in<strong>to</strong> HTML tags; it is therefore simply a matter<br />

of changing the output for each of those tags, something that is put in<strong>to</strong><br />

corresponding configuration files.<br />

Since XML itself is not a language with defined tags, how do we know<br />

what those tags are <strong>to</strong> be? Here we rely on existing DTDs for textual<br />

documents. These can be the DocBook DTD developed for software user<br />

manuals <strong>and</strong> other computer documentation, or the TEI DTD, the Text<br />

Encoding Initiative meant essentially for general text, including images<br />

<strong>and</strong> sounds.<br />

The T E X4ht collection on the T E XLive CD includes configurations for<br />

producing XML output from L AT E X for both of these DTDs. The preamble<br />

<strong>to</strong> the L AT E X source file should then include<br />

\usepackage[html]{tex4ht} for HTML output


480 Appendix E. L AT E X <strong>and</strong> World Wide Web<br />

\usepackage[xhtml,docbook]{tex4ht} for XML, DocBook output<br />

\usepackage[xhtml,tei]{tex4ht} for XML, TEI output<br />

One might ask why does the author not write an XML file directly as<br />

the source document? First, one might very well want <strong>to</strong> convert older<br />

documents recorded in L AT E X <strong>to</strong> XML. Secondly, one might find it simpler<br />

<strong>to</strong> write in L AT E X (not everyone agrees) since no one would write an XML<br />

file by h<strong>and</strong> (everyone agrees) but would rely on some application <strong>to</strong> do it<br />

behind the scenes. Certainly L AT E X source text is easier <strong>to</strong> read, even when<br />

intersperse with comm<strong>and</strong>s, than an XML file.<br />

E.2.2 MathML <strong>and</strong> L AT E X<br />

One of the strengths of T E X <strong>and</strong> thus L AT E X over other text processing<br />

systems is the ability <strong>to</strong> h<strong>and</strong>le mathematics in a way that is acceptable <strong>to</strong><br />

mathematicians. HTML has never been able <strong>to</strong> even begin <strong>to</strong> compete in<br />

this area. The only way conversion programs like L AT E X2HTML <strong>and</strong> T E X4ht<br />

can render equations like that in Figure E.1 is <strong>to</strong> convert it <strong>to</strong> an image<br />

file. This is hardly a satisfac<strong>to</strong>ry solution.<br />

The MathML project attempts <strong>to</strong> define an XML language <strong>to</strong> encode<br />

mathematics. We refer <strong>to</strong> chapter 8 of the L AT E X Web Companion (Goossens<br />

<strong>and</strong> Rahtz, 1999) for a description. T E X4ht can produce output in MathML<br />

by specifying<br />

\usepackage[xhtml,mathml]{tex4ht}<br />

Symbols that do not exists in the browser fonts will still be converted <strong>to</strong><br />

image files, but instructions are inserted <strong>to</strong> carry out the placement for<br />

fractions <strong>and</strong> superscripts <strong>and</strong> subscripts. Unfortunately, most browsers<br />

do not recognize MathML (yet). Again, once this becomes established<br />

there will be a st<strong>and</strong>ard for recording <strong>and</strong> exchanging documents with<br />

complex mathematics.<br />

E.2.3 Rendering XML with T E X/L AT E X<br />

Another role that L AT E X, or more properly the T E X program, can play in the<br />

XML world, is <strong>to</strong> translate it <strong>to</strong> a form that can be viewed or printed as a<br />

finished document. This is known as rendering.<br />

David Carlisle has written macros in a file xmltex.tex <strong>to</strong> act as an<br />

XML parser for output in T E X or L AT E X. Sebastian Rahtz has written an<br />

additional macro package PassiveT E X, <strong>to</strong> incorporate an XSL style sheet<br />

for the TEI DTD in<strong>to</strong> xmltex. With this combination, one can produce DVI<br />

or PDF output from a TEI-coded XML file.<br />

There are a number of ways of going about this. The simplest is <strong>to</strong><br />

write a ‘wrapper’ file for processing document.xml as


E.3. The techexplorer Hypermedia Browser 481<br />

\def\xmlfile{document.xml}<br />

\input xmltex.tex<br />

<strong>and</strong> then <strong>to</strong> process this with either L AT E X or pdfL AT E X. The PassiveT E X<br />

macros will be found au<strong>to</strong>matically, if they are on the system.<br />

Another means is <strong>to</strong> generate an xmltex format, as described in Section<br />

B.1.3. This would be done with<br />

initex &latex xmltex.tex or<br />

tex -ini &latex xmltex.tex<br />

<strong>to</strong> generate a format named xmltex.fmt. One can then invoke it with<br />

tex &xmltex document.xml<br />

or simply with xmltex document.xml if an alias or batch file for the<br />

comm<strong>and</strong> xmltex has been defined <strong>to</strong> equate <strong>to</strong> the real comm<strong>and</strong>.<br />

Instead of using the T E X program, one can also make use of pdfT E X<br />

instead, <strong>to</strong> generate PDF instead of DVI output.<br />

E.3 The techexplorer Hypermedia Browser<br />

A completely different approach <strong>to</strong> Web viewing of T E X <strong>and</strong> L AT E X documents<br />

is offered by the IBM techexplorer Hypermedia Browser, a plug-in<br />

for Netscape Naviga<strong>to</strong>r <strong>and</strong> Microsoft Internet Explorer under Windows.<br />

When properly installed, it is launched au<strong>to</strong>matically within the parent<br />

browser window when one opens a file with one of the extensions .tex,<br />

.bbl,.ltx,.latex, or.tcx.<br />

The techexplorer interprets the T E X <strong>and</strong> L AT E X comm<strong>and</strong>s directly<br />

<strong>and</strong> displays the results on the moni<strong>to</strong>r. The original page height <strong>and</strong><br />

line width are ignored, the paragraphs being fitted <strong>to</strong> the size of the window<br />

as is normal for any browser. Fonts, tables, environments, but most<br />

importantly mathematics are reproduced very well. Figure E.1 on the<br />

next page demonstrates a single formula represented by both T E X4ht <strong>and</strong><br />

techexplorer. Even user comm<strong>and</strong>s defined with \def <strong>and</strong> \newcomm<strong>and</strong><br />

are recognized, provided they occur within the same file. However, no<br />

external packages may be loaded, nor are the class files accepted. (Both<br />

\usepackage <strong>and</strong> \documentclass are simply ignored.)<br />

Hypertext features can be included with additional T E X-like comm<strong>and</strong>s<br />

that establish internal <strong>and</strong> external links, pop-up menus, multiple-file<br />

documents (segmentation) with au<strong>to</strong>matic links between them, <strong>and</strong> inclusion<br />

of images. In other words, a techexplorer document can have<br />

the full range of hypertext features of HTML. Here one must make the<br />

same comment as for L AT E X2HTML <strong>and</strong> T E X4ht: it is not primarily intended<br />

for viewing arbitrary L AT E X documents, but rather for preparing hypertext<br />

Web pages by means of T E X or L AT E X. The only problem here is that most


482 Appendix E. L AT E X <strong>and</strong> World Wide Web<br />

Figure E.1: Example of a math formula represented by T E X4ht (as a GIF<br />

image of the original L AT E X output) <strong>and</strong> by techexplorer rendering.<br />

Internet users will probably not have techexplorer installed, so that<br />

they will only be presented with the input text, <strong>and</strong> not its rendering.<br />

One additional application of techexplorer which is not available<br />

<strong>to</strong> the other programs is <strong>to</strong> embed T E X comm<strong>and</strong>s, especially mathematics,<br />

inside a regular HTML file. If the comm<strong>and</strong>s are s<strong>to</strong>red in a file<br />

formula.tex, they could be embedded with<br />

<br />

or they can be entered directly as<br />

<br />

The result, shown in the lower part of Figure E.1, is a very acceptable<br />

display of the math formula in the middle of an HTML file. (This file was<br />

generated by T E X4ht from a L AT E X file, with the above techexplorer text<br />

included as raw HTML code.)<br />

The techexplorer is obtainable from http://www.software.ibm.<br />

com/enetwork/techexplorer. It comes in a free introduc<strong>to</strong>ry version,<br />

as well as in a professional version for a nominal charge.


F<br />

Obsolete LAT E X<br />

Since 1994, L AT E X 2ε has replaced L AT E X 2.09 as the official version. Although<br />

the newer version is backward compatible with the previous one,<br />

this is only <strong>to</strong> allow older source files written for L AT E X 2.09 <strong>to</strong> be processed<br />

under L AT E X 2ε; it is not intended that newer files should make use of the<br />

obsolete syntax.<br />

Human nature being conservative as it is, many authors continued <strong>to</strong><br />

use the comm<strong>and</strong>s they were familiar with, even <strong>to</strong>day. The purpose of<br />

this chapter is <strong>to</strong> explain those comm<strong>and</strong>s for users who may come across<br />

such legacy documents, <strong>and</strong> <strong>to</strong> indicate <strong>to</strong> traditional L AT E X users which<br />

comm<strong>and</strong>s they should no longer be employing. It is not meant <strong>to</strong> be a<br />

guide for using L AT E X 2.09!<br />

At first sight, the differences seem very slight indeed. In fact, the<br />

real changes are mainly internal, allowing packages <strong>to</strong> be h<strong>and</strong>led more<br />

systematically <strong>and</strong> fonts <strong>to</strong> be dealt with in a more flexible manner. The<br />

advantages of L AT E X 2ε for class <strong>and</strong> package writers are considerable, as<br />

explained in Appendix D. Regular users benefit indirectly by being able<br />

<strong>to</strong> employ these extensions, <strong>and</strong> by being able <strong>to</strong> activate fonts other than<br />

the original Computer Modern families.<br />

F.1 The 2.09 preamble<br />

As for L AT E X 2ε, the document preamble in L AT E X 2.09 contains overall<br />

specifications for the entire document, including general layout.<br />

F.1.1 Style instead of class<br />

L AT E X 2.09 works with style rather than class files, so the first comm<strong>and</strong> in<br />

the source file is<br />

\documentstyle[options]{style}<br />

483


484 Appendix F. Obsolete L AT E X<br />

rather than \documentclass. Possible values for style are article,<br />

report, book, or any other main style files that might exist locally. These<br />

styles may have various options associated with them, like 11pt, twoside,<br />

<strong>and</strong> so on, which can be listed in the set of options. Not all the options<br />

available with the L AT E X 2ε class files are recognized by the style files.<br />

The options list has an additional function in L AT E X 2.09: for any option<br />

in the list that is not recognized by the style file, a file with that name <strong>and</strong><br />

extension.sty is loaded, if it exists. The original idea of this mechanism<br />

was <strong>to</strong> allow certain options applicable <strong>to</strong> all styles <strong>to</strong> have the common<br />

coding s<strong>to</strong>red in an extra file, rather than repeating it within each main<br />

style file. It was this that later led <strong>to</strong> the concept of packages.<br />

There is no \usepackage comm<strong>and</strong> in L AT E X 2.09; packages can only<br />

be loaded with the options list, <strong>and</strong> no options may be specified for the<br />

packages.<br />

To start a document with the article style <strong>and</strong> 12pt option, with the<br />

parskip <strong>and</strong> makeidx packages, one gives<br />

\documentstyle[12pt,parskip,makeidx]{article}<br />

F.1.2 Compatibility mode<br />

L AT E X 2ε is designed <strong>to</strong> be able <strong>to</strong> process older L AT E X documents with<br />

exactly the same output as with L AT E X 2.09. To do this, it recognizes the<br />

\documentstyle comm<strong>and</strong> which switches it in<strong>to</strong> compatibility mode,<br />

changing the functionality of many L AT E X 2ε features. For example, the<br />

\usepackage comm<strong>and</strong> becomes inoperable, issuing an error message.<br />

With a true L AT E X 2.09 installation, the above \documentstyle example<br />

would load the files article.sty, parskip.sty, <strong>and</strong> makeidx.sty.<br />

Under L AT E X 2ε, in compatibility mode, it first tries <strong>to</strong> load the main style<br />

as a class file with the extension .cls, in this case article.cls, but if<br />

that fails, it then looks for the extension.sty. This is <strong>to</strong> h<strong>and</strong>le local main<br />

style files that have no class file equivalent. The packages parskip.sty<br />

<strong>and</strong> makeidx.sty are loaded as well. However, they <strong>to</strong>o may recognize<br />

the compatibility mode <strong>and</strong> behave differently as they would with regular<br />

L AT E X 2ε.<br />

F.2 Font selection<br />

The other major difference between the two versions is font selection.<br />

The New Font Selection Scheme (NFSS) <strong>and</strong> font attributes described in<br />

Section 4.1.3 are missing in L AT E X 2.09, as are the font comm<strong>and</strong>s \textbf,<br />

\texttt, <strong>and</strong> so on, <strong>and</strong> the font attribute declarations such as \bfseries<br />

<strong>and</strong> \ttfamily. (They are still available even in L AT E X 2ε compatibility<br />

mode.)


F.2.1 Old font declarations<br />

F.3. Obsolete means obsolete 485<br />

In L AT E X 2.09, only the two-letter font declarations that originally came<br />

from Plain T E X are possible.<br />

\rm Roman \it Italic \sc Small Caps<br />

\bf Bold face \sl Slanted \sf Sans Serif<br />

\tt Typewriter<br />

These are all declarations, changing the font until another font declaration<br />

is given, or until the current environment is ended. They are normally<br />

used as {\bf bold face} <strong>to</strong> yield bold face.<br />

The emphasizing declaration \em also belongs <strong>to</strong> this group, but it has<br />

been taken over as part of L AT E X 2ε proper.<br />

These old declarations have a different behavior from that of their<br />

NFSS counterparts: they rigidly select a particular font instead of altering<br />

only one attribute, but retaining the current size. Compare:<br />

{\sl slanted {\bf bold}} ⇒ slanted bold<br />

{\slshape slanted {\bfseries bold}} ⇒ slanted bold<br />

It is not possible <strong>to</strong> obtain slanted or italic bold face with L AT E X 2.09 even<br />

though such fonts are available.<br />

These two-letter declarations are also retained in the st<strong>and</strong>ard L AT E X 2ε<br />

classes, <strong>and</strong> not just in compatibility mode. Note carefully that wording:<br />

they are not part of L AT E X 2ε itself, but are only included as part of the<br />

st<strong>and</strong>ard class files. This means other class files might not provide them,<br />

or that they might even be removed in some later version (although this<br />

is most unlikely). Therefore, their use is not <strong>to</strong> be encouraged at all.<br />

F.2.2 Font size declarations<br />

In L AT E X 2.09, the font size declarations also reset all the other font attributes<br />

(Section 4.1.3) <strong>to</strong> their defaults, that is, Roman, upright, medium<br />

weight. By contrast, in L AT E X 2ε, these attributes remain unchanged. Compare<br />

the results of {\sl slanted {\Large larger}}:<br />

L AT E X 2.09: slanted larger<br />

L AT E X 2ε: slanted larger<br />

In L AT E X 2ε compatibility mode, the size declarations behave as they do in<br />

L AT E X 2.09.<br />

F.3 Obsolete means obsolete<br />

Many features have been added <strong>to</strong> L AT E X 2ε, <strong>and</strong> a number of comm<strong>and</strong>s<br />

have been given extended syntax, in the form of additional optional arguments.<br />

We have no intention of indicating them anymore in this book as


486 Appendix F. Obsolete L AT E X<br />

this is a manual for the newer version only. (Previous editions did make<br />

a distinction.)<br />

Apart from the restrictions pointed out in the above sections, all of<br />

the L AT E X 2ε features will work in compatibility mode. Nevertheless, we<br />

stress once more, compatibility mode is only intended for the processing<br />

of older source files. Every effort has been undertaken <strong>to</strong> ensure that the<br />

results are identical <strong>to</strong> those of a processing with the true L AT E X 2.09 itself.<br />

Compatibility mode (\documentstyle in place of \documentclass)<br />

issues a very strong warning:<br />

Entering <strong>LaTeX</strong> 2.09 COMPATIBILITY MODE<br />

*************************************************************<br />

!!WARNING!! !!WARNING!! !!WARNING!! !!WARNING!!<br />

This mode attempts <strong>to</strong> provide an emulation of the <strong>LaTeX</strong> 2.09<br />

author environment so that OLD documents can be successfully<br />

processed. It should NOT be used for NEW documents!<br />

New documents should use St<strong>and</strong>ard <strong>LaTeX</strong> conventions <strong>and</strong> start<br />

with the \documentclass comm<strong>and</strong>.<br />

Compatibility mode is UNLIKELY TO WORK with <strong>LaTeX</strong> 2.09 style<br />

files that change any internal macros, especially not with<br />

those that change the FONT SELECTION or OUTPUT ROUTINES.<br />

Therefore such style files MUST BE UPDATED <strong>to</strong> use<br />

Current St<strong>and</strong>ard <strong>LaTeX</strong>: <strong>LaTeX</strong>2e.<br />

If you suspect that you may be using such a style file, which<br />

is probably very, very old by now, then you should attempt <strong>to</strong><br />

get it updated by sending a copy of this error message <strong>to</strong> the<br />

author of that file.<br />

*************************************************************<br />

Take this message seriously, <strong>and</strong> stick <strong>to</strong> \documentclass.


G<br />

T E X Fonts<br />

Computers work exclusively with numbers, or more precisely, only with<br />

bits which may be interpreted as numbers. They do not know the difference<br />

between the letter A <strong>and</strong> an apple, or that either even exists. For text<br />

processing, all symbols, both input <strong>and</strong> output, need <strong>to</strong> be represented<br />

as numbers somehow. The association between number <strong>and</strong> symbol is<br />

called the encoding or layout. The latter term derives from the common<br />

method of illustrating the encoding in the form of a table.<br />

Encoding tables are by no means st<strong>and</strong>ard. The st<strong>and</strong>ard ascii scheme<br />

is just one of several, <strong>and</strong> it is limited <strong>to</strong> 7 bits, or 128 characters. There<br />

are 8-bit (256 characters) versions as well, in fact, a large number exist,<br />

tailored <strong>to</strong> different computer systems <strong>and</strong> languages. The question of<br />

coding the input for L AT E X documents with more than 7 bits are addressed<br />

in Sections 2.5.9 <strong>and</strong> D.5.<br />

In this appendix, we look at how the underlying T E X program deals<br />

with output fonts, their nomenclature, <strong>and</strong> their encoding tables.<br />

G.1 Font metrics <strong>and</strong> bitmaps<br />

When T E X decides <strong>to</strong> output character nn in a particular font, all it needs<br />

<strong>to</strong> know is how much room <strong>to</strong> leave for it. T E X does not care what the<br />

character looks like, for that is the task of the DVI driver afterwards.<br />

Information about the characters in each font are s<strong>to</strong>red in various<br />

files, all bearing the root name of the font but with different extensions.<br />

This information is divided in<strong>to</strong> files that contain only the sizes of each<br />

symbol, <strong>and</strong> those with the actual drawing or image data.<br />

.tfm T E X font metric files are the only font files read in by T E X itself.<br />

They contain the sizes of the characters, such as width, height, <strong>and</strong><br />

depth. For slanted fonts, they also possess the ‘italic correction’<br />

for each letter. Furthermore, they specify for which letter combinations<br />

a different spacing is required, such as AV instead of AV,<br />

487


488 Appendix G. T E X Fonts<br />

or for which a ligature is available. Finally, the .tfm files provide<br />

information about the slope of the characters (zero for an unslanted<br />

font), the st<strong>and</strong>ard word spacing <strong>and</strong> its stretch <strong>and</strong> shrinkage, the<br />

width of the em <strong>and</strong> quad spacings, <strong>and</strong> the spacings at the end<br />

of a sentence. Mathematical <strong>and</strong> symbol fonts require even more<br />

information which is also included in their.tfm files.<br />

.pk Compressed pixel files contain bitmaps (images) of the symbols in<br />

each font, in one size <strong>and</strong> one resolution. The DVI driver program<br />

uses these <strong>to</strong> send the output <strong>to</strong> a printer or previewer. These files<br />

are normally generated au<strong>to</strong>matically by the METAFONT program<br />

(Section G.3) as needed.<br />

Since these files might exist several times for a given font, in difference<br />

sizes or resolutions, many installations distinguish them<br />

by adding the resolution <strong>to</strong> the extension, as cmr10.300pk or<br />

cmr10.600pk for 300 <strong>and</strong> 600 dpi versions, respectively. On systems<br />

that cannot support extensions with more than three characters,<br />

both files are named cmr10.pk but are s<strong>to</strong>red in direc<strong>to</strong>ries<br />

dpi300 <strong>and</strong> dpi600.<br />

Font magnification is achieved by selecting an appropriate resolution.<br />

If cmr10 is <strong>to</strong> be printed on a 300 dpi printer at double its<br />

normal size, the 600 dpi version is used instead.<br />

.mf METAFONT source files contain the drawing instructions for each<br />

of the fonts. These are not read by the DVI driver but rather by the<br />

METAFONT program which converts them in<strong>to</strong> .pk bitmap files at<br />

the required size <strong>and</strong> resolution.<br />

.vf Virtual font files are an alternative <strong>to</strong> .pk files. Instead of having<br />

bitmaps for each character, they contain instructions that refer <strong>to</strong><br />

characters in different, real fonts, or that tell the driver <strong>to</strong> draw a<br />

black box <strong>and</strong> issue a warning message (that the character does not<br />

exist, for example).<br />

Virtual fonts are normally associated with PostScript fonts <strong>and</strong> are<br />

therefore described in Section G.5. However, there is no reason for<br />

them not <strong>to</strong> be used with bitmap fonts as well.<br />

G.2 Computer Modern fonts<br />

When Donald E. Knuth invented the T E X program, he also provided it with<br />

an extensive set of character fonts, which he named Computer Modern,<br />

rather than relying on the fonts available on any given printer. At that<br />

time, the printer fonts were not so good, <strong>and</strong> certainly were not uniform.


G.2. Computer Modern fonts 489<br />

With the supplied fonts, T E X could produce identical, high-quality results<br />

on all printers.<br />

L AT E X, of course, has inherited these fonts, so that they have almost<br />

become a trademark for documents produced by T E X or L AT E X. This is not<br />

really necessary, for L AT E X need not be married <strong>to</strong> any particular set of<br />

fonts, especially with the New Font Selection Scheme (Appendix A) which<br />

simplifies font installation enormously. The main fonts used in this book,<br />

for example, are Lucida Bright, Lucida Sans, <strong>and</strong> Lucida Sans Typewriter,<br />

designed by Bigelow & Holmes <strong>and</strong> distributed by Y&Y Inc.<br />

G.2.1 Font families<br />

Typography is the study <strong>and</strong> classification of typefaces, something that<br />

goes back <strong>to</strong> Gutenberg’s invention of movable type (not of the printing<br />

press, which was invented by the Chinese) five <strong>and</strong> a half centuries ago.<br />

Since that time, many families of fonts have been created, bearing classical<br />

names like Baskerville, Garamond, Univers, etc. Each member of such a<br />

family has the same overall design, or basic look, but vary by being slanted,<br />

italic, bold, or thin; <strong>and</strong> of course, they come in different sizes.<br />

Font families are classified according <strong>to</strong> certain criteria that often<br />

determine <strong>to</strong> what use they will be put.<br />

Serif fonts: are those that have little horizontal lines, or serifs, at their<br />

edges, <strong>to</strong> guide the eye better. Experience has shown these <strong>to</strong> be<br />

best for general reading, <strong>and</strong> so they are regularly used for the main<br />

body of text. The NFSS terminology refers <strong>to</strong> these as Roman fonts.<br />

Sans serif fonts: are those that are lacking any serifs. Such fonts with<br />

their starker appearance are often employed for titling or headlining.<br />

Compare sans serif with regular text.<br />

Fixed fonts: are those with a uniform letter width, something that has<br />

evolved from the typewriter <strong>and</strong> has been carried over <strong>to</strong> computer<br />

listings. Classically, such fonts have no business in book printing,<br />

where proportional fonts (the letter i is narrower than m) have always<br />

dominated.<br />

Decorative fonts: are ones that st<strong>and</strong> out because of some unusual characteristic.<br />

They are intended <strong>to</strong> catch attention <strong>and</strong> <strong>to</strong> attract the<br />

eye. Such families are not complete, with a full range of shapes <strong>and</strong><br />

widths, <strong>and</strong> are employed mostly by advertising.<br />

Mathematical fonts: are collections of special symbols needed for mathematical<br />

works. Their further classification cannot be compared <strong>to</strong><br />

that of text fonts at all.


490 Appendix G. T E X Fonts<br />

A book designer must decide what kinds of typeface families are<br />

needed. He or she might decide on a Roman (serifed) font for the main<br />

body, a sans serif one for headlines, <strong>and</strong> then, if it is a book containing<br />

computer code, select a fixed font for setting those parts. Finally, symbol<br />

fonts will be needed if the work contains mathematical sections.<br />

The Computer Modern set of fonts provides all these classes of families.<br />

However, since they were produced before the NFSS attribute system<br />

of classification was established, the CM font nomenclature does not conform<br />

perfectly with this scheme. The NFSS system frees the user from<br />

having <strong>to</strong> think about the CM font names, for specifying the attributes is<br />

sufficient. Of course, the NFSS installation must provide the font definition<br />

.fd files which translate any set of attributes in<strong>to</strong> a real font name,<br />

or in<strong>to</strong> some acceptable substitute.<br />

G.2.2 Classification of CM fonts<br />

All the T E X font names begin with the letters cm, which st<strong>and</strong>s for ‘Computer<br />

Modern’, followed by one <strong>to</strong> four letters describing the style of font,<br />

<strong>and</strong> finally one or two digits specifying the design size in points. This is<br />

the root name of the font which must be given in the \newfont comm<strong>and</strong><br />

(Section 4.1.5) if it is <strong>to</strong> be activated directly.<br />

The CM fonts can be classified as text, math, decorative, or other<br />

special symbol fonts, as described in the rest of this section. Each type of<br />

font has an encoding scheme shown in the accompanying layout tables.<br />

Text fonts<br />

The Computer Modern fonts appropriate for straightforward text can be<br />

classified in<strong>to</strong> the three families Roman, sans serif, <strong>and</strong> typewriter. Within<br />

each of these families there are upright, slanted, italic, small caps, <strong>and</strong><br />

bold variants.<br />

Table G.1 presents the names of these fonts <strong>to</strong>gether with the NFSS<br />

family/series/shape assignments from Appendix A. They all have the<br />

same coding (OT1). The * in each name is the design size specification<br />

which takes on values of 5, 6, 7, 8, 9, 10, 12, 17. Only cmr* is available<br />

in all these sizes, while some are only <strong>to</strong> be found in size 10. (This table<br />

contains much the same information as in Table A.3 on page 370 but in a<br />

different form.)<br />

One sees several apparent inconsistencies in these font names, such<br />

as cmti* for the italic upright font. Why is this not cmri*? The answer<br />

is that this is a text italic font, as opposed <strong>to</strong> the math italic font cmmi*<br />

described below. These inconsistences have arisen because the CM fonts<br />

were not created with the NFSS classification system in mind, since that<br />

was established a decade later.


G.2. Computer Modern fonts 491<br />

Table G.1: Computer Modern text fonts<br />

Roman Sans serif Typewriter<br />

Family= cmr cmss cmtt<br />

Style Series/shape<br />

Upright m/n cmr* cmss* cmtt*<br />

” slanted m/sl cmsl* cmssi* cmsltt*<br />

” italic m/it cmti* — cmitt*<br />

” small caps m/sc cmcsc* — cmtcsc*<br />

Bold b/m cmb* — —<br />

Bold extended bx/m cmbx* cmssbx* —<br />

” ” slanted bx/sl cmbxsl* — —<br />

” ” italic bx/it cmbxti* — —<br />

Further inconsistencies exist in the encoding schemes for the CM text<br />

fonts. They are all nominally OT1, but there are slight deviations among<br />

them. The proper OT1 encoding is displayed in Layout 1 on the next page<br />

for font cmr10. The text italic fonts are identical <strong>to</strong> the upright ones,<br />

except that the dollar sign in position 36 is replaced by the pound sign<br />

(Layout 3 for cmti10). The slanted fonts, on the other h<strong>and</strong>, are exactly<br />

the same as the upright ones. Other deviations are <strong>to</strong> be found in the<br />

small caps (Layout 2) <strong>and</strong> all the typewriter fonts (Layout 4).<br />

Math fonts<br />

The Computer Modern fonts provide three types of mathematical fonts,<br />

each with its own encoding scheme.<br />

The mathematical italic fonts cmmi* contain Latin <strong>and</strong> Greek letters,<br />

in upper <strong>and</strong> lower case, plus a number of extra symbols. Since variable<br />

names in formulas are set in italics, these are basically italic fonts. The<br />

encoding scheme is designated OML, for old math letters, <strong>and</strong> is displayed<br />

in Layout 5. It is available in design sizes 5–12 pt in normal weight, but<br />

only in 10 pt size in bold face, cmmib10. These fonts are used for the<br />

letters math alphabet of Section A.3.4.<br />

Symbol fonts cmsy* provide the rest of the math symbols for formulas,<br />

except for those that appear in variable sizes. The encoding scheme is<br />

named OMS for old math symbols <strong>and</strong> is shown in Layout 6. It comes in<br />

sizes 5–10 pt in normal weight, <strong>and</strong> in 10 pt size in bold face, cmbsy10.<br />

The symbols math alphabet uses these fonts.<br />

Variable sized symbols are <strong>to</strong> be found in the font cmex10, with encoding<br />

OMX, for old math extension. Layout 7 illustrates this set. There is no<br />

bold version of this font. It belongs <strong>to</strong> the largesymbols math alphabet<br />

of Section A.3.4.


492 Appendix G. T E X Fonts<br />

0 1 2 3 4 5 6 7<br />

’00x Γ 0 ∆ 1 Θ 2 Λ 3 Ξ 4 Π 5 Σ 6 Υ 7<br />

’01x Φ 8 Ψ 9 Ω 10 ff 11 fi 12 fl 13 ffi 14 ffl 15<br />

’02x ı 16 j 17 ` 18 ´ 19 ˇ 20 ˘ 21 ¯ 22 ˚ 23<br />

’03x ¸ 24 ß 25 æ 26 œ 27 ø 28 Æ 29 Œ 30 Ø 31<br />

’04x ̷ 32 ! 33 ” 34 # 35 $ 36 % 37 & 38 ’ 39<br />

’05x ( 40 ) 41 * 42 + 43 , 44 - 45 . 46 / 47<br />

’06x 0 48 1 49 2 50 3 51 4 52 5 53 6 54 7 55<br />

’07x 8 56 9 57 : 58 ; 59 ¡ 60 = 61 ¿ 62 ? 63<br />

’10x @ 64 A 65 B 66 C 67 D 68 E 69 F 70 G 71<br />

’11x H 72 I 73 J 74 K 75 L 76 M 77 N 78 O 79<br />

’12x P 80 Q 81 R 82 S 83 T 84 U 85 V 86 W 87<br />

’13x X 88 Y 89 Z 90 [ 91 “ 92 ] 93 ˆ 94 ˙ 95<br />

’14x ‘ 96 a 97 b 98 c 99 d 100 e 101 f 102 g 103<br />

’15x h 104 i 105 j 106 k 107 l 108 m 109 n 110 o 111<br />

’16x p 112 q 113 r 114 s 115 t 116 u 117 v 118 w 119<br />

’17x x 120 y 121 z 122 – 123 —124 ˝ 125 ˜ 126 ¨ 127<br />

Font Layout 1: The character font cmr10. This is the st<strong>and</strong>ard character<br />

assignment for the OT1 encoding scheme.<br />

0 1 2 3 4 5 6 7<br />

’00x Γ 0 ∆ 1 Θ 2 Λ 3 Ξ 4 Π 5 Σ 6 Υ 7<br />

’01x Φ 8 Ψ 9 Ω 10 ↑ 11 ↓ 12 ' 13 ¡ 14 ¿ 15<br />

’02x ı 16 j 17 ` 18 ´ 19 ˇ 20 ˘ 21 ¯ 22 ˚ 23<br />

’03x ¸ 24 ß 25 æ 26 œ 27 ø 28 Æ 29 Œ 30 Ø 31<br />

’04x ̷ 32 ! 33 ” 34 # 35 $ 36 % 37 & 38 ’ 39<br />

’05x ( 40 ) 41 * 42 + 43 , 44 - 45 . 46 / 47<br />

’06x 0 48 1 49 2 50 3 51 4 52 5 53 6 54 7 55<br />

’07x 8 56 9 57 : 58 ; 59 < 60 = 61 > 62 ? 63<br />

’10x @ 64 A 65 B 66 C 67 D 68 E 69 F 70 G 71<br />

’11x H 72 I 73 J 74 K 75 L 76 M 77 N 78 O 79<br />

’12x P 80 Q 81 R 82 S 83 T 84 U 85 V 86 W 87<br />

’13x X 88 Y 89 Z 90 [ 91 “ 92 ] 93 ˆ 94 ˙ 95<br />

’14x ‘ 96 a 97 b 98 c 99 d 100 e 101 f 102 g 103<br />

’15x h 104 i 105 j 106 k 107 l 108 m 109 n 110 o 111<br />

’16x p 112 q 113 r 114 s 115 t 116 u 117 v 118 w 119<br />

’17x x 120 y 121 z 122 – 123 —124 ˝ 125 ˜ 126 ¨ 127<br />

Font Layout 2: The character font cmcsc10. The differences from Layout<br />

1 are symbols 11–15, 25, 60, <strong>and</strong> 62. The ligatures that normally<br />

appear in 11–15 have been replaced by some extra symbols.


G.2. Computer Modern fonts 493<br />

0 1 2 3 4 5 6 7<br />

’00x Γ 0 ∆ 1 Θ 2 Λ 3 Ξ 4 Π 5 Σ 6 Υ 7<br />

’01x Φ 8 Ψ 9 Ω 10 ff 11 fi 12 fl 13 ffi 14 ffl 15<br />

’02x ı 16 j 17 ` 18 ´ 19 ˇ 20 ˘ 21 ¯ 22 ˚ 23<br />

’03x ¸ 24 ß 25 æ 26 œ 27 ø 28 Æ 29 Œ 30 Ø 31<br />

’04x ̷ 32 ! 33 ” 34 # 35 £ 36 % 37 & 38 ’ 39<br />

’05x ( 40 ) 41 * 42 + 43 , 44 - 45 . 46 / 47<br />

’06x 0 48 1 49 2 50 3 51 4 52 5 53 6 54 7 55<br />

’07x 8 56 9 57 : 58 ; 59 ¡ 60 = 61 ¿ 62 ? 63<br />

’10x @ 64 A 65 B 66 C 67 D 68 E 69 F 70 G 71<br />

’11x H 72 I 73 J 74 K 75 L 76 M 77 N 78 O 79<br />

’12x P 80 Q 81 R 82 S 83 T 84 U 85 V 86 W 87<br />

’13x X 88 Y 89 Z 90 [ 91 “ 92 ] 93 ˆ 94 ˙ 95<br />

’14x ‘ 96 a 97 b 98 c 99 d 100 e 101 f 102 g 103<br />

’15x h 104 i 105 j 106 k 107 l 108 m 109 n 110 o 111<br />

’16x p 112 q 113 r 114 s 115 t 116 u 117 v 118 w 119<br />

’17x x 120 y 121 z 122 – 123 —124 ˝ 125 ˜ 126 ¨ 127<br />

Font Layout 3: The character font cmti10. The only difference from<br />

Layout 1 is symbol 36 (£ instead of $). All other text italic fonts<br />

have this same pattern.<br />

0 1 2 3 4 5 6 7<br />

’00x Γ 0 ∆ 1 Θ 2 Λ 3 Ξ 4 Π 5 Σ 6 Υ 7<br />

’01x Φ 8 Ψ 9 Ω 10 ↑ 11 ↓ 12 ' 13 ¡ 14 ¿ 15<br />

’02x ı 16 j 17 ` 18 ´ 19 ˇ 20 ˘ 21 ¯ 22 ˚ 23<br />

’03x ¸ 24 ß 25 æ 26 œ 27 ø 28 Æ 29 Œ 30 Ø 31<br />

’04x 32 ! 33 " 34 # 35 $ 36 % 37 & 38 ’ 39<br />

’05x ( 40 ) 41 * 42 + 43 , 44 - 45 . 46 / 47<br />

’06x 0 48 1 49 2 50 3 51 4 52 5 53 6 54 7 55<br />

’07x 8 56 9 57 : 58 ; 59 < 60 = 61 > 62 ? 63<br />

’10x @ 64 A 65 B 66 C 67 D 68 E 69 F 70 G 71<br />

’11x H 72 I 73 J 74 K 75 L 76 M 77 N 78 O 79<br />

’12x P 80 Q 81 R 82 S 83 T 84 U 85 V 86 W 87<br />

’13x X 88 Y 89 Z 90 [ 91 \ 92 ] 93 ^ 94 _ 95<br />

’14x ‘ 96 a 97 b 98 c 99 d 100 e 101 f 102 g 103<br />

’15x h 104 i 105 j 106 k 107 l 108 m 109 n 110 o 111<br />

’16x p 112 q 113 r 114 s 115 t 116 u 117 v 118 w 119<br />

’17x x 120 y 121 z 122 { 123 | 124 } 125 ~ 126 ¨ 127<br />

Font Layout 4: The character font cmtt10. All tt fonts are set up with<br />

the same pattern. The differences from Layout 1 lie in symbols 11–<br />

15, 60, 62, 92, 123, 124, <strong>and</strong> 125. Furthermore, the italic typewriter<br />

fonts also have £ in place of $.


494 Appendix G. T E X Fonts<br />

Package:<br />

latexsym<br />

amsfonts<br />

The term old in these encoding names refers <strong>to</strong> the original encoding<br />

as introduced by Donald Knuth, in the same way that the text encoding<br />

OT1 indicated the old, or original, text encoding with 128 characters per<br />

font. The new encoding schemes contain 256 characters. For text, the<br />

encoding is named T1 (Section G.4.3); such extended math fonts do not<br />

yet exist.<br />

The extra A M S fonts in Section 12.4.1 add additional bold face sizes<br />

for cmmib* <strong>and</strong> cmbsy* as well as some more sizes for cmex*.<br />

Decorative fonts<br />

Three families of decorative or special fonts are available in a single design<br />

size <strong>and</strong> limited attributes. They all exhibit OT1 encoding.<br />

cmfr Funny Roman family, consists of two fonts, cmff10 leaning <strong>to</strong> the left<br />

<strong>and</strong> cmfi10 which leans <strong>to</strong> the right. Both are series m with shapes n<br />

<strong>and</strong> it respectively.<br />

cmfib Fibonacci family, contains one font cmfib8 derived from the Fibonacci<br />

series of numbers. It has series m <strong>and</strong> shape n.<br />

cmdunh Dunhill family, with one font cmdunh10 with series m <strong>and</strong> shape<br />

n. This font is demonstrated in the sample letterhead on page 364.<br />

Logo fonts<br />

The fonts logo8, logo9, logo10, logosl10, <strong>and</strong> logobf10 contain only<br />

the nine letters A, E, F, M, N, O, P, S, <strong>and</strong> T, for generating the logos<br />

METAFONT METAFONT METAFONT<br />

METAPOST METAPOST METAPOST<br />

The L AT E X lasy fonts<br />

As an extension of the cmsy* fonts for mathematical symbols, L AT E X pro-<br />

vides some additional symbols with the font lasy* in design sizes 5–10 pt.<br />

It contains the 15 symbols: ✭ ✮ ✯ ✰ ✁ ✂ ✄ ☎ ✵ ✶ ✷ ✸ ❀ ❁ ❂.<br />

These symbols are not defined unless one of the packages latexsym<br />

or amsfonts has been loaded.<br />

Fonts for making pictures<br />

The special picture elements for use in the L AT E X picture environment are<br />

s<strong>to</strong>red in fonts named line10, lcircle10, linew10, <strong>and</strong> lcirclew10.<br />

The first two are used for lines, ovals, <strong>and</strong> circles when \thinlines is<br />

in effect. The sloping lines <strong>and</strong> arrow heads are <strong>to</strong> be found in line10


G.2. Computer Modern fonts 495<br />

0 1 2 3 4 5 6 7<br />

’00x Γ 0 ∆ 1 Θ 2 Λ 3 Ξ 4 Π 5 Σ 6 Υ 7<br />

’01x Φ 8 Ψ 9 Ω 10 α 11 β 12 γ 13 δ 14 ɛ 15<br />

’02x ζ 16 η 17 θ 18 ι 19 κ 20 λ 21 µ 22 ν 23<br />

’03x ξ 24 π 25 ρ 26 σ 27 τ 28 υ 29 φ 30 χ 31<br />

’04x ψ 32 ω 33 ε 34 ϑ 35 ϖ 36 ϱ 37 ς 38 ϕ 39<br />

’05x ↼ 40 ↽ 41 ⇀ 42 ⇁ 43 ↩ 44 ↪ 45 ⊲ 46 ⊳ 47<br />

’06x 0 48 1 49 2 50 3 51 4 52 5 53 6 54 7 55<br />

’07x 8 56 9 57 . 58 , 59 < 60 / 61 > 62 ⋆ 63<br />

’10x ∂ 64 A 65 B 66 C 67 D 68 E 69 F 70 G 71<br />

’11x H 72 I 73 J 74 K 75 L 76 M 77 N 78 O 79<br />

’12x P 80 Q 81 R 82 S 83 T 84 U 85 V 86 W 87<br />

’13x X 88 Y 89 Z 90 ♭ 91 ♮ 92 ♯ 93 ⌣ 94 ⌢ 95<br />

’14x ℓ 96 a 97 b 98 c 99 d 100 e 101 f 102 g 103<br />

’15x h 104 i 105 j 106 k 107 l 108 m109 n 110 o 111<br />

’16x p 112 q 113 r 114 s 115 t 116 u 117 v 118 w 119<br />

’17x x 120 y 121 z 122 ı 123 j 124 ℘ 125 126 127<br />

Font Layout 5: The font cmmi10. This corresponds <strong>to</strong> the OML encoding<br />

scheme, as does cmmib10. It contains lower case Greek letters in<br />

positions 11–39 <strong>and</strong> math symbols in 40–47, 60–64, <strong>and</strong> 123–127.<br />

0 1 2 3 4 5 6 7<br />

’00x − 0 · 1 × 2 ∗ 3 ÷ 4 ⋄ 5 ± 6 ∓ 7<br />

’01x ⊕ 8 ⊖ 9 ⊗ 10 ⊘ 11 ⊙ 12 ○ 13 ◦ 14 • 15<br />

’02x ≍ 16 ≡ 17 ⊆ 18 ⊇ 19 ≤ 20 ≥ 21 22 23<br />

’03x ∼ 24 ≈ 25 ⊂ 26 ⊃ 27 ≪ 28 ≫ 29 ≺ 30 ≻ 31<br />

’04x ← 32 → 33 ↑ 34 ↓ 35 ↔ 36 ↗ 37 ↘ 38 39<br />

’05x ⇐ 40 ⇒ 41 ⇑ 42 ⇓ 43 ⇔ 44 ↖ 45 ↙ 46 ∝ 47<br />

’06x ′ 48 ∞ 49 ∈ 50 ∋ 51 △ 52 ▽ 53 54 ↦ 55<br />

’07x ∀ 56 ∃ 57 ¬ 58 ∅ 59 ℜ 60 ℑ 61 ⊤ 62 ⊥ 63<br />

’10x ℵ 64 A 65 B 66 C 67 D 68 E 69 F 70 G 71<br />

’11x H 72 I 73 J 74 K 75 L 76 M 77 N 78 O 79<br />

’12x P 80 Q 81 R 82 S 83 T 84 U 85 V 86 W 87<br />

’13x X 88 Y 89 Z 90 ∪ 91 ∩ 92 ⊎ 93 ∧ 94 ∨ 95<br />

’14x ⊢ 96 ⊣ 97 ⌊ 98 ⌋ 99 ⌈ 100 ⌉ 101 { 102 } 103<br />

’15x 〈 104 〉 105 | 106 107 ↕ 108 ⇕ 109 \ 110 ≀ 111<br />

’16x √ 112 ∐ 113 ∇114 ∫ 115 ⊔ 116 ⊓ 117 ⊑ 118 ⊒ 119<br />

’17x § 120 † 121 ‡ 122 123 ♣ 124 ♦ 125 ♥ 126 ♠ 127<br />

Font Layout 6: The font cmsy10. The cmsy fonts, adhering <strong>to</strong> the OMS<br />

encoding scheme, contain many math symbols as well as the calligraphic<br />

letters A . . . Z in positions 65–90. The bold face version<br />

cmbsy10 is set up on the same pattern.


496 Appendix G. T E X Fonts<br />

0 1 2 3 4 5 6 7<br />

’00x 0 1 2 3 4 5 6 7<br />

’01x 8 9 10 11 12 13 14 15<br />

’02x 16 17 18 19 20 21 22 23<br />

’03x 24 25 26 27 28 29 30 31<br />

’04x 32 33 34 35 36 37 38 39<br />

’05x 40 41 42 43 44 45 46 47<br />

’06x ⎛ 48 ⎞ 49 ⎡ 50 ⎤ 51 ⎣ 52 ⎦ 53 ⎢ 54 ⎥ 55<br />

’07x ⎧ 56 ⎫ 57 ⎩ 58 ⎭ 59 ⎨ 60 ⎬ 61 ⎪ 62 ⏐ 63<br />

’10x ⎝ 64 ⎠ 65 ⎜ 66 ⎟ 67 68 69 70 71<br />

’11x 72 73 74 75 76 77 78 79<br />

’12x 80 81 82 83 84 85 86 87<br />

’13x 88 89 90 91 92 93 94 95<br />

’14x 96 97 98 99 100 101 102 103<br />

’15x 104 105 106 107 108 109 110 111<br />

’16x 112 113 114 115 116 117 118 119<br />

’17x 120 121 122 123 124 125 126 127<br />

Font Layout 7: The font cmex10, containing the mathematical symbols<br />

that appear in varying sizes. This is the OMX encoding scheme.


G.3. The METAFONT program 497<br />

0 1 2 3 4 5 6 7<br />

’00x Nj 0 Lj 1 2 З 3 4 5 6 7<br />

’01x nj 8 lj 9 10 з 11 12 13 14 15<br />

’02x 16 Ж 17 18 19 20 21 22 23<br />

’03x 24 ж 25 26 27 28 29 30 31<br />

’04x ¨ 32 ! 33 ” 34 35 36 % 37 ´ 38 ’ 39<br />

’05x ( 40 ) 41 * 42 43 , 44 - 45 . 46 / 47<br />

’06x 0 48 1 49 2 50 3 51 4 52 5 53 6 54 7 55<br />

’07x 8 56 9 57 : 58 ; 59 « 60 ı 61 » 62 ? 63<br />

’10x ˘ 64 A 65 B 66 C 67 D 68 E 69 F 70 G 71<br />

’11x H 72 I 73 J 74 K 75 L 76 M 77 N 78 O 79<br />

’12x P 80 Q 81 R 82 S 83 T 84 U 85 V 86 W 87<br />

’13x X 88 Y 89 Z 90 [ 91 “ 92 ] 93 Ь 94 Ъ 95<br />

’14x ‘ 96 a 97 b 98 c 99 d 100 e 101 f 102 g 103<br />

’15x h 104 i 105 j 106 k 107 l 108 m 109 n 110 o 111<br />

’16x p 112 q 113 r 114 s 115 t 116 u 117 v 118 w 119<br />

’17x x 120 y 121 z 122 – 123 —124 125 ь 126 ъ 127<br />

Font Layout 8: The character font wncyr10, one of the Cyrillic fonts from<br />

the University of Washing<strong>to</strong>n. Its coding scheme is designated OT2.<br />

while the circles <strong>and</strong> oval segments (Section 13.1.4) are in lcircle10.<br />

The second pair of fonts with the added w contain thicker lines, for use<br />

with \thicklines.<br />

G.2.3 A M S Cyrillic fonts<br />

The Cyrillic fonts that are part of the amsfonts collection are described in<br />

Section 12.4.2. They conform <strong>to</strong> the font encoding scheme OT2, displayed<br />

in Layout 8. They are available as upright (wncyr*), bold (wncyb*), small<br />

caps (wncysc*), <strong>and</strong> upright sans serif (wncyss*) fonts. As for the CM<br />

fonts, * represents the design size in points.<br />

The NFSS system assigns these fonts <strong>to</strong> families cmr <strong>and</strong> cmss; that is,<br />

they are treated as members of the Computer Modern set. This is not as<br />

absurd as it sounds since they are intended <strong>to</strong> be used with the CM fonts.<br />

G.3 The METAFONT program<br />

METAFONT is a program for designing <strong>and</strong> developing character fonts,<br />

written by Donald E. Knuth as a companion <strong>to</strong> his T E X program (Knuth,<br />

1986c, 1986d, 1986e). It is this program that made the uniform high<br />

quality typographic output possible for T E X at a time when most printers<br />

had their own built-in fonts of varying st<strong>and</strong>ards.


498 Appendix G. T E X Fonts<br />

The printer driver programs have the task of converting the DVI output<br />

from T E X in<strong>to</strong> instruction code for a particular printer. To do this, they<br />

need <strong>to</strong> know how <strong>to</strong> print each of the symbols used in the document.<br />

These symbols are represented as a set of black <strong>and</strong> white dots (pixels)<br />

that is adjusted <strong>to</strong> the output resolution. Clearly <strong>to</strong> produce the letter A<br />

in a given size at 600 dpi (dots per inch) requires many more dots than at<br />

150 dpi (16 times). This information is contained in the corresponding<br />

.pk files, in compressed format.<br />

However, designing fonts as a set of dots, <strong>and</strong> that for any number of<br />

resolutions, <strong>and</strong> taking in<strong>to</strong> account idiosyncrasies of individual printers,<br />

is an impossible task. Rather, the fonts are defined with.mf files, containing<br />

instructions on how <strong>to</strong> draw the symbols with a pen of a given shape.<br />

This is the most general definition, describing the ideal form. METAFONT<br />

then translates this ideal in<strong>to</strong> the practical realization, the pixels, for any<br />

specified resolution. Aspects of the various printers, such as relative pixel<br />

size <strong>and</strong> shape, may also be included, so that the resulting patterns are<br />

both resolution <strong>and</strong> printer dependent. The font metric.tfm files are also<br />

produced in this process.<br />

Today it is hardly necessary for most users <strong>to</strong> know anything more<br />

about METAFONT other than that it exists. The drivers <strong>and</strong> previewers<br />

are now so constructed that when they notice that the required .pk file<br />

is missing, they invoke METAFONT themselves <strong>to</strong> generate it. In this way<br />

the collection of pixel files grows as needed <strong>and</strong> includes only those that<br />

are actually used. (Originally huge sets of pixel files had <strong>to</strong> be supplied<br />

<strong>to</strong> cover every remote possibility.)<br />

Another reason for the decline in the awareness of METAFONT is<br />

the increasing use of the type 1 fonts for PostScript <strong>and</strong> PDF output<br />

(Chapter 10).<br />

Donald Knuth has announced that he wishes <strong>to</strong> withdraw from any<br />

further development of either of these programs, being prepared merely <strong>to</strong><br />

correct any definite errors they may contain. To emphasize this decision,<br />

he will from now on give version numbers <strong>to</strong> T E X that converge <strong>to</strong> π<br />

(3.14159. . . ) <strong>and</strong> <strong>to</strong> METAFONT that approach the value of e (2.71828. . . ).<br />

At present, T E X is at version 3.14159 <strong>and</strong> METAFONT at 2.718. As a<br />

consequence of this decision, any further major developments <strong>to</strong> these<br />

two programs, such as undertaken by user groups, will be under new<br />

names, since Knuth has kept the copyright <strong>to</strong> the existing names.<br />

G.4 Extended Computer fonts<br />

The Computer Modern fonts were developed in the early days of T E X when<br />

it could only h<strong>and</strong>le 128 characters per font. The modern T E X program<br />

can deal with 256 characters in each font, requiring a new set of st<strong>and</strong>ard<br />

fonts <strong>to</strong> exploit this feature.


G.4. Extended Computer fonts 499<br />

G.4.1 Limitations <strong>and</strong> deficiencies of the CM fonts<br />

Most of the diacritical marks (accents) used in European languages written<br />

with the Latin alphabet are contained in, or may be generated by, T E X’s<br />

Computer Modern (CM) fonts. A basic set of naked accents is available<br />

for combination with other letters, such as the acute accent ´ with the<br />

letter e <strong>to</strong> make é. Other combinations may be constructed for diacritical<br />

marks that are not predefined in T E X or L AT E X.<br />

Fashioning diacritical characters as a combination of letters <strong>and</strong> special<br />

symbols has one great disadvantage for the T E X processing: words containing<br />

such characters cannot take part in the au<strong>to</strong>matic word division<br />

since the hyphenation patterns include only pure letters. The accented<br />

letters, such as those in German <strong>and</strong> French <strong>and</strong> most other languages,<br />

must be treated as single characters in the hyphenation patterns, <strong>and</strong><br />

must appear as single letters in the character set.<br />

In addition <strong>to</strong> diacritical characters, a number of special letters are<br />

employed in some European languages, such as ß, Æ, æ, Œ, œ, Ø, <strong>and</strong><br />

ø, which are provided in st<strong>and</strong>ard T E X with the CM fonts (Section 2.5.6).<br />

However, other special letters, such as Ŋ, ŋ, Þ, þ, <strong>and</strong> ð, are missing<br />

completely <strong>and</strong> cannot be easily constructed from existing ones.<br />

G.4.2 The Cork proposal<br />

At the 1990 International T E X Conference in Cork, Irel<strong>and</strong>, an extension of<br />

the Latin alphabet <strong>and</strong> its assignments within the 256 character positions<br />

was proposed <strong>and</strong> accepted. This extension includes the majority of<br />

special <strong>and</strong> diacritical letters as single characters for many languages<br />

written with the Latin alphabet. Hyphenation patterns for such languages<br />

may include the special <strong>and</strong> diacritical letters as single letters for optimal<br />

word division by T E X <strong>and</strong> L AT E X.<br />

Character fonts conforming <strong>to</strong> the Cork scheme are <strong>to</strong> bear the identifying<br />

letters ec in their names for ‘Extended Computer’ in place of the<br />

cm for ‘Computer Modern’.<br />

G.4.3 The realization of EC fonts<br />

The Cork proposal for extending the T E X fonts <strong>to</strong> 256 characters was first<br />

implemented by Norbert Schwarz, who produced an initial set of META-<br />

FONT source files. He also selected the designation dc <strong>to</strong> emphasize that<br />

this was a preliminary realization of the EC fonts. Some work was still<br />

needed <strong>to</strong> fine-tune the design of several symbols.<br />

After issuing versions 1.2 <strong>and</strong> 1.3 of the DC fonts in 1995 <strong>and</strong> 1996,<br />

Jörg Knappen released the first set of true EC fonts in January, 1997. Font<br />

Layout 9 presents his font ecrm1000, the extended version of cmr10. The<br />

EC fonts are now considered <strong>to</strong> be stable in that neither their encoding


500 Appendix G. T E X Fonts<br />

0 1 2 3 4 5 6 7<br />

’00x ` 0 ´ 1 ˆ 2 ˜ 3 ¨ 4 ˝ 5 ˚ 6 ˇ 7<br />

’01x ˘ 8 ¯ 9 ˙ 10 ¸ 11 ˛ 12 ‚ 13 ‹ 14 › 15<br />

’02x “ 16 ” 17 „ 18 « 19 » 20 – 21 — 22 23<br />

’03x ‰ 24 ı 25 j 26 ff 27 fi 28 fl 29 ffi 30 ffl 31<br />

’04x 32 ! 33 " 34 # 35 $ 36 % 37 & 38 ’ 39<br />

’05x ( 40 ) 41 * 42 + 43 , 44 - 45 . 46 / 47<br />

’06x 0 48 1 49 2 50 3 51 4 52 5 53 6 54 7 55<br />

’07x 8 56 9 57 : 58 ; 59 < 60 = 61 > 62 ? 63<br />

’10x @ 64 A 65 B 66 C 67 D 68 E 69 F 70 G 71<br />

’11x H 72 I 73 J 74 K 75 L 76 M 77 N 78 O 79<br />

’12x P 80 Q 81 R 82 S 83 T 84 U 85 V 86 W 87<br />

’13x X 88 Y 89 Z 90 [ 91 \ 92 ] 93 ^ 94 _ 95<br />

’14x ‘ 96 a 97 b 98 c 99 d 100 e 101 f 102 g 103<br />

’15x h 104 i 105 j 106 k 107 l 108 m 109 n 110 o 111<br />

’16x p 112 q 113 r 114 s 115 t 116 u 117 v 118 w 119<br />

’17x x 120 y 121 z 122 { 123 | 124 } 125 ~ 126 ­ 127<br />

’20x Ă 128 Ą129 Ć130 Č 131 Ď 132 Ě 133 Ę 134 Ğ 135<br />

’21x Ĺ 136 Ľ 137 Ł 138 Ń 139 Ň 140 Ŋ 141 Ő 142 Ŕ 143<br />

’22x Ř 144 Ś 145 Š 146 Ş 147 Ť 148 Ţ 149 Ű 150 Ů 151<br />

’23x Ÿ 152 Ź 153 Ž 154 Ż 155 IJ156 İ 157 đ 158 § 159<br />

’24x ă 160 ą 161 ć 162 č 163 ď 164 ě 165 ę 166 ğ 167<br />

’25x ĺ 168 ľ 169 ł 170 ń 171 ň 172 ŋ 173 ő 174 ŕ 175<br />

’26x ř 176 ś 177 š 178 ş 179 ť 180 ţ 181 ű 182 ů 183<br />

’27x ÿ 184 ź 185 ž 186 ż 187 ij 188 ¡ 189 ¿ 190 £ 191<br />

’30x À 192 Á193 Â194 Ã 195 Ä 196 Å 197 Æ 198 Ç 199<br />

’31x È 200 É 201 Ê 202 Ë 203 Ì 204 Í 205 Î 206 Ï 207<br />

’32x Ð 208 Ñ209 Ò210 Ó211 Ô 212 Õ 213 Ö 214 Œ215<br />

’33x Ø 216 Ù217 Ú218 Û 219 Ü 220 Ý 221 Þ 222 ß223<br />

’34x à 224 á 225 â 226 ã 227 ä 228 å 229 æ 230 ç 231<br />

’35x è 232 é 233 ê 234 ë 235 ì 236 í 237 î 238 ï 239<br />

’36x ð 240 ñ 241 ò 242 ó 243 ô 244 õ 245 ö 246 œ 247<br />

’37x ø 248 ù 249 ú 250 û 251 ü 252 ý 253 þ 254 ß 255<br />

Font Layout 9: The extended font ecrm1000 with T1 encoding.


G.4. Extended Computer fonts 501<br />

nor their metrics (the .tfm files) will be changed in future. Thus their<br />

behavior as far as T E X <strong>and</strong> L AT E X are concerned is finalized. The actual<br />

printed characters might be modified slightly in later updates.<br />

The EC font names are of the form ecxxnnnn, where xx represents two<br />

letters specifying the font characteristics, <strong>and</strong> nnnn the design size in<br />

hundredths of points. Thus ecrm1000 is the upright Roman font in size<br />

10 points.<br />

The METAFONT source files are available for the following extended<br />

fonts (without the size specification):<br />

ecrm<br />

ecbx<br />

ecbl<br />

ecrb<br />

ecrb<br />

ecti<br />

ecui<br />

ecbi<br />

eccc<br />

ecxc<br />

ecsc<br />

ecoc<br />

ecci<br />

ectt<br />

ecit<br />

ecvt<br />

ecvi<br />

ecvi<br />

ectc<br />

ecst<br />

ecss<br />

ecsi<br />

ecsx<br />

ecso<br />

ecdh<br />

Comparing these with the root names of the CM fonts from Table G.1 on<br />

page 491, one may easily recognize the correspondence. For example,<br />

ecbx* is the extended bold font corresponding <strong>to</strong> the CM font cmbx*.<br />

It is intended that the EC fonts should exist in most design sizes.<br />

The present distribution contains almost all the fonts in sizes from 5 <strong>to</strong><br />

35.83 pt, that is, with size specifications:<br />

0500 0600 0700 0800 0900 1000 1095<br />

1200 1440 1728 2074 2488 2986 3583<br />

In contrast <strong>to</strong> the CM text fonts which exhibit differences in the symbol<br />

assignments among them, as illustrated in Layouts 1–4, the EC fonts all<br />

have exactly the same encoding scheme, as presented in Layout 9.<br />

The EC fonts are now part of the st<strong>and</strong>ard L AT E X installations.<br />

A parallel set of fonts called text companion, or TC, fonts is also provided.<br />

These contain special symbols for text that are normally found in<br />

the CM math fonts, if at all, such as currency symbols <strong>and</strong> degree signs.<br />

These fonts are still somewhat experimental so that the symbol assignments<br />

are not yet stable. The current contents are shown in Layout 10.<br />

G.4.4 Invoking the EC <strong>and</strong> TC fonts<br />

The EC fonts correspond <strong>to</strong> the NFSS encoding scheme T1 (Section A.1).<br />

The simplest way <strong>to</strong> activate them is <strong>to</strong> place<br />

\usepackage[T1]{fontenc}<br />

in the preamble of the document. All this really does is <strong>to</strong> make T1<br />

the st<strong>and</strong>ard encoding by redefining \encodingdefault <strong>to</strong> be T1, <strong>and</strong><br />

it loads the file t1enc.def which redefines the accent <strong>and</strong> special letter<br />

comm<strong>and</strong>s by means of the encoding comm<strong>and</strong>s of Section A.3.7.


502 Appendix G. T E X Fonts<br />

0 1 2 3 4 5 6 7<br />

’00x ` 0 ´ 1 2 3 ¨ 4 ˝ 5 6 ˇ 7<br />

’01x 8 ¯ 9 10 ¸ 11 ˛ 12 ‚ 13 14 15<br />

’02x 16 17 „ 18 19 20 21 — 22 ‌ 23<br />

’03x ← 24 → 25 26 27 28 29 30 ‌ 31<br />

’04x ␢ 32 33 34 35 $ 36 37 38 ' 39<br />

’05x 40 41 ∗ 42 43 , 44 45 . 46 ⁄ 47<br />

’06x 0 48 1 49 2 50 3 51 4 52 5 53 6 54 7 55<br />

’07x 8 56 9 57 58 59 〈 60 − 61 〉 62 63<br />

’10x 64 65 66 67 68 69 70 71<br />

’11x 72 73 74 75 76 ℧ 77 78 ○ 79<br />

’12x 80 81 82 83 84 85 86 Ω 87<br />

’13x 88 89 90 〚 91 92 〛 93 ↑ 94 ↓ 95<br />

’14x ` 96 97 98 99 100 101 102 103<br />

’15x 104 105 106 107 108 109 ♪ 110 111<br />

’16x 112 113 114 115 116 117 118 119<br />

’17x 120 121 122 123 124 125 126 127<br />

’20x ˘ 128 ˇ 129 ˝ 130 ̏ 131 † 132 ‡ 133 ‖ 134 ‰135<br />

’21x • 136 ℃ 137 $ 138 ¢ 139 ƒ 140 ₡ 141 ₩ 142 ₦ 143<br />

’22x 144 145 ₤ 146 147 ‽ 148 149 ₫ 150 151<br />

’23x ‱152 153 ฿154 № 155 156 ℮ 157 ◦ 158 ℠ 159<br />

’24x ⁅ 160 ⁆ 161 ¢ 162 £ 163 ¤ 164 ¥ 165 ¦ 166 § 167<br />

’25x ¨ 168 ©169 ª 170 171 ¬ 172 ℗173 ®174 ¯ 175<br />

’26x ° 176 ± 177 ² 178 ³ 179 ´ 180 µ 181 182 · 183<br />

’27x ※ 184 ¹ 185 º 186 √ 187 ¼ 188 ½ 189 ¾ 190 € 191<br />

’30x 192 193 194 195 196 197 198 199<br />

’31x 200 201 202 203 204 205 206 207<br />

’32x 208 209 210 211 212 213 × 214 215<br />

’33x 216 217 218 219 220 221 222 223<br />

’34x 224 225 226 227 228 229 230 231<br />

’35x 232 233 234 235 236 237 238 239<br />

’36x 240 241 242 243 244 245 ÷ 246 247<br />

’37x 248 249 250 251 252 253 254 255<br />

Font Layout 10: The text companion font tcrm1000 with the TS1 encoding<br />

scheme.


G.5. PostScript fonts 503<br />

Package: To obtain access <strong>to</strong> the symbols in the TC fonts, one can load the<br />

textcomp textcomp package, which not only redefines several existing symbol comm<strong>and</strong>s,<br />

it also adds many new ones. For example, \copyright, which is<br />

normally defined <strong>to</strong> be \textcircle{c}, is changed <strong>to</strong> print character<br />

169 from an appropriate TC font. Character 191 is the symbol for the European<br />

currency unit, the euro, printed with \texteuro; however, better<br />

ways of producing it are presented in Section 2.5.8.<br />

G.4.5 Special character comm<strong>and</strong>s<br />

Inspecting Font Layout 9, one notices that the EC fonts contain not only<br />

many single characters that are formed out of two CM symbols (like Ä =<br />

A + ¨) but also several characters that have no correspondence in the CM<br />

font layout at all. The first type is accommodated by internally redefining<br />

the action of accent <strong>and</strong> special character comm<strong>and</strong>s. The second set<br />

requires new comm<strong>and</strong>s that are recognized only when the T1 encoding<br />

is active. These are<br />

the ogonek accent \k{o}: o˛<br />

special letters \DH = Ð \DJ = Ð \NG = Ŋ \TH = Þ<br />

\dh = ð \dj = đ \ng = ŋ \th = þ<br />

special symbols \guillemotleft = « \guillemotright = »<br />

\guilsinglleft = ‹ \guilsinglright = ›<br />

\quotedblbase = „ \quotesinglbase = ‚<br />

\textquotedbl = "<br />

When issued in OT1 encoding, these comm<strong>and</strong>s print an error message.<br />

Note: The \guillemotleft <strong>and</strong> \guillemotright are not misprints<br />

even though the proper word for the French quotations marks is guillemet.<br />

The PostScript fonts contain these erroneous names for these symbols<br />

<strong>and</strong> this mistake has propagated <strong>to</strong> such an extent that it can never be<br />

removed from all the software that includes it. A guillemot is in fact an<br />

Arctic bird, not a French quotation mark.<br />

G.5 PostScript fonts<br />

PostScript fonts, also known as outline or type 1 fonts, are treated exactly<br />

the same way as the METAFONT fonts as far as L AT E X is concerned: during<br />

the processing, a.tfm file is read in for each font specifying the character<br />

sizes <strong>and</strong> other properties. This is all that L AT E X needs <strong>to</strong> know, for it is<br />

the task of the driver program <strong>to</strong> print the actual character that fills the<br />

reserved space.<br />

The driver makes use of the virtual font mechanism, which means that<br />

what L AT E X sees are actually artificial fonts that do not really exist on their


504 Appendix G. T E X Fonts<br />

own. There are.tfm files for these fonts, so the L AT E X processing proceeds<br />

as normal. What the driver then does is <strong>to</strong> read a .vf file instead of the<br />

pixel.pk files. The instructions in the virtual font file tell the driver how<br />

<strong>to</strong> create each character: they may be drawn, taken from other fonts,<br />

or dis<strong>to</strong>rted. This is how PostScript slanted <strong>and</strong> small caps fonts are<br />

emulated, for such fonts do not exist in the ‘raw’ form. See Section 10.1.4<br />

for example of how this works.<br />

Even the font layout can be redesigned with virtual fonts. The raw<br />

PostScript fonts have an encoding scheme that conforms <strong>to</strong> neither OT1<br />

nor T1, but which is used as a pool of symbols for constructing virtual<br />

fonts that do conform <strong>to</strong> these schemes. In particular, the Computer<br />

Modern fonts contain upper case Greek letters in the first 11 slots (Layout 1<br />

on page 492) which are <strong>to</strong> be found in the PostScript symbol font only.<br />

The virtual font ptmr7t conforms <strong>to</strong> this by taking its characters from<br />

both the raw Times-Roman <strong>and</strong> Symbol fonts.<br />

G.5.1 Naming scheme for PostScript fonts<br />

In order <strong>to</strong> be compatible with all possible operating systems, it is necessary<br />

<strong>to</strong> reduce the names of the PostScript font files <strong>to</strong> a maximum of<br />

eight characters. This makes for an extremely abbreviated <strong>and</strong> cryptic<br />

nomenclature.<br />

The most commonly used scheme is that of Karl Berry. Here, the first<br />

letter of the name specifies the supplier of the font, for example p for<br />

Adobe (st<strong>and</strong>s for PostScript), or h for Bigelow & Holmes, who designed<br />

the Lucida fonts used in this book, or m for Monotype, or l for Linotype,<br />

<strong>and</strong> so on.<br />

Table G.2: Root names of the 35 st<strong>and</strong>ard PostScript fonts<br />

pagd AvantGarde-Demi phvrrn Helvetica-Narrow<br />

pagdo AvantGarde-DemiOblique phvron Helvetica-Narrow-Oblique<br />

pagk AvantGarde-Book pncb NewCenturySchlbk-Bold<br />

pagko AvantGarde-BookOblique pncbi NewCenturySchlbk-BoldItalic<br />

pbkd Bookman-Demi pncr NewCenturySchlbk-Roman<br />

pbkdi Bookman-DemiItalic pncri NewCenturySchlbk-Italic<br />

pbkl Bookman-Light pplb Palatino-Bold<br />

pbkli Bookman-LightItalic pplbi Palatino-BoldItalic<br />

pcrb Courier-Bold pplr Palatino-Roman<br />

pcrbo Courier-BoldOblique pplri Palatino-Italic<br />

pcrr Courier psyr Symbol<br />

pcrro Courier-Oblique ptmb Times-Bold<br />

phvb Helvetica-Bold ptmbi Times-BoldItalic<br />

phvbo Helvetica-BoldOblique ptmr Times-Roman<br />

phvbrn Helvetica-Narrow-Bold ptmri Times-Italic<br />

phvbon Helvetica-Narrow-BoldOblique pzcmi ZapfChancery-MediumItalic<br />

phvr Helvetica pzdr ZapfDingbats<br />

phvro Helvetica-Oblique


G.6. Computer Modern as PostScript fonts 505<br />

Table G.3: A selection of the encoding suffixes in the Berry nomenclature<br />

Suffix Encoding NFSS designation Page<br />

7t 7-bit T E X text encoding OT1 492<br />

7m T E X math italics encoding OML 495<br />

7v T E X math extension encoding OMX 496<br />

7y T E X math symbols encoding OMS 495<br />

8t 8-bit Cork encoding T1 500<br />

8a Adobe st<strong>and</strong>ard encoding<br />

8r TeXBase1Encoding<br />

A two-letter typeface code follows the supplier letter, such as tm for<br />

Times-Roman. Next come various letters <strong>to</strong> specify weight, for example<br />

r for regular (upright Roman) or b for bold, <strong>and</strong> variant, like i for italic,<br />

o for oblique (slanted). Next come a number plus letter <strong>to</strong> indicate the<br />

encoding scheme, followed by possible width code letters. The Berry<br />

names for the 35 st<strong>and</strong>ard PostScript fonts that should be loaded in every<br />

printer are listed in Table G.2 on the facing page, without the encoding<br />

suffixes.<br />

The most important encoding suffixes for our purposes are listed in<br />

Table G.3. The 7-bit encodings have already been explained in Section G.2.2<br />

<strong>and</strong> shown in Layouts 1, 5–7, while the 8t or T1 scheme is <strong>to</strong> be found in<br />

Layout 9 in Section G.4.3.<br />

The other 8-bit schemes listed in Table G.3 are the raw encoding, 8r,<br />

<strong>and</strong> the Adobe st<strong>and</strong>ard encoding, 8a, which is the default for most type 1<br />

fonts if no re-encoding is specified. This scheme plays absolutely no role<br />

in the NFSS installation for PostScript fonts.<br />

Virtual fonts ptmr7t <strong>and</strong> ptmr8t are both constructed from the same<br />

raw font ptmr8r, differing only in the character assignments. There are<br />

also raw fonts that are modifications of the basic fonts. For example,<br />

ptmro8t is an oblique Times-Roman virtual font, based on ptmro8r, the<br />

raw version. However, there is no such font in the reper<strong>to</strong>ire of Table G.2.<br />

This pseudo font is generated by applying a PostScript slanting operation<br />

<strong>to</strong> Times-Roman, as demonstrated in Section 10.1.4.<br />

G.6 Computer Modern as PostScript fonts<br />

The traditional pixel fonts produced by METAFONT have served us well<br />

in the days when the emphasis was on printed paper output. Even<br />

for PostScript output, the pixel fonts are acceptable for online viewing.<br />

However, they become very tedious when included in PDF output for


506 Appendix G. T E X Fonts<br />

viewing: they appear very fuzzy <strong>and</strong> require a long time <strong>to</strong> draw. For<br />

this reason, PDF output, whether produced with pdfT E X, dvipdfm, or<br />

converted from PostScript, should use type 1 fonts exclusively. To this<br />

end, the Computer Modern fonts themselves have been converted <strong>to</strong> type 1<br />

fonts.<br />

The first such undertaking was carried out by Basil Malyshev whose<br />

set of font files are known as bakoma. However, the set that is more<br />

often used <strong>to</strong>day is the result of a joint project of Y&Y Inc. <strong>and</strong> Blue<br />

Sky Research. Originally part of their commercial T E X installations, these<br />

fonts are now available free of charge. They are included on the T E XLive<br />

CD under texmf\fonts\type1\bluesky\ in several subdirec<strong>to</strong>ries as<br />

.pfb files. They bear the same names <strong>and</strong> have the same font metrics<br />

as the corresponding pixel fonts (Appendix G) <strong>and</strong> therefore do not need<br />

any additional .tfm files. However, one must also get the mapping file<br />

bsr.map from texmf\dvips\bluesky\ <strong>and</strong> add it <strong>to</strong> the list of mapping<br />

files in config.ps.<br />

The Bluesky fonts are incomplete in that certain less often used<br />

fonts are missing in some sizes. One can either include the map file<br />

bsr-interpolated.map, which substitutes the missing sizes with the<br />

nearest approximation, or employ the bakoma fonts that fill the gaps,<br />

with the map file bakomaextra.map. The T E XLive CD does not include the<br />

complete bakoma set, but only those fonts that are missing in the Bluesky<br />

ensemble.<br />

Together Bluesky <strong>and</strong> bakoma provide PostScript-encoded versions for<br />

all the Computer Modern fonts described in Section G.2, for text, math,<br />

symbols, decoration, pictures, along with the additional A M S fonts for<br />

additional symbols <strong>and</strong> Cyrillic. However, these are only for the OT1<br />

encoding with 128 characters per font.<br />

A more recent effort <strong>to</strong> apply PostScript <strong>to</strong> the Extended Computer (EC)<br />

fonts with the T1 encoding has been successfully completed by Vladimir<br />

Volovich with his cm-super collection. Each of the basic.pfb files contains<br />

from 468 <strong>to</strong> 585 characters, which by means of encoding vec<strong>to</strong>rs <strong>and</strong><br />

mapping files can be used <strong>to</strong> emulate all the fonts in Section G.4, including<br />

the text companion fonts with TS1 encoding, <strong>and</strong> many other additional<br />

encoding schemes. They were generated from the original METAFONT.mf<br />

source files <strong>and</strong> should therefore produce exactly the same results as the<br />

corresponding pixel fonts.<br />

To use them, one must install the cm-super package from the T E XLive<br />

CD, which copies the .pfb files from \texmf\fonts\type1\cm-super\<br />

<strong>and</strong> the mapping <strong>and</strong> encoding files from \texmf\dvips\cm-super\.<br />

The metric.tfm files are the same as those for the pixel files <strong>and</strong> so need<br />

not be provided extra.


H<br />

Comm<strong>and</strong> Summary<br />

This appendix contains a brief description of all the L AT E X comm<strong>and</strong>s,<br />

in alphabetical (ascii) order, neglecting the leading backslash \\, along<br />

with some T E X comm<strong>and</strong>s that have been explained in this book. In the<br />

following section, the comm<strong>and</strong>s are presented in their logical grouping<br />

in a number of tables <strong>and</strong> figures.<br />

H.1 Brief description of the L AT E X comm<strong>and</strong>s<br />

For each comm<strong>and</strong> in the following summary, the section <strong>and</strong> page number<br />

is given where it is introduced <strong>and</strong> described in detail. The numbers are<br />

shown in the form: ‘(Section) – Page’: for example (2.5.1) – 13 means<br />

‘Section 2.5.1, page 13’. If these numbers are missing, then the comm<strong>and</strong><br />

has not been presented in the book but is only mentioned here.<br />

The following notations may be added <strong>to</strong> the comm<strong>and</strong>s:<br />

[m] those permitted in math mode only;<br />

[a] those belonging <strong>to</strong> A M S-L AT E X;<br />

[p] those allowed only in the preamble.<br />

\ . . . . . . . . . . . . . . . . . . . . . . . (2.1), (2.7.1) – 19, 29<br />

Normal space between words after a comm<strong>and</strong> without arguments<br />

or after a period that is not the end of a sentence.<br />

! . . . . . . . . . . . . . . . . . . . . . . . . . . . (9.4.2) – 226<br />

Field separation character within the \index comm<strong>and</strong>. For example:<br />

with \index{comm<strong>and</strong>!fragile} one produces an index sub-entry<br />

‘fragile’ under the main entry ‘comm<strong>and</strong>’.<br />

!‘ produces ¡ . . . . . . . . . . . . . . . . . . . . . . (2.5.6) – 24<br />

\! [m] . . . . . . . . . . . . . . . . . . . . . . . . . (5.5.1) – 145<br />

In math mode, a negative space of −1/6 quad: xx\!x = xxx.<br />

507


508 Appendix H. Comm<strong>and</strong> Summary<br />

" . . . . . . . . . . . . . . . . (2.5.2), (9.4.2), (14.2) – 23, 227, 311<br />

1. In normal text, this produces the double closing quote ”.<br />

2. Literal sign for MakeIndex, in order <strong>to</strong> print one of the special<br />

characters !, @, |, or ". Example: \index{"!} <strong>to</strong> enter character<br />

! without it being interpreted as a separation character.<br />

3. Delimiter for a text field in BIBT E X. Example:<br />

AUTHOR = "Donald E. Knuth".<br />

\" . . . . . . . . . . . . . . . . . . . . . . . . . . . . (2.5.7) – 24<br />

Produces an umlaut accent: \"{a} = ä.<br />

# . . . . . . . . . . . . . . . . . . . . . . (8.3.2), (8.4.2) – 187, 198<br />

Argument replacement character in a user-defined comm<strong>and</strong> or environment.<br />

## . . . . . . . . . . . . . . . . . . . . . . . . . . (8.5.6) – 204<br />

Replacement character for an internal argument within a nested userdefined<br />

comm<strong>and</strong> or environment.<br />

\# . . . . . . . . . . . . . . . . . . . . . . . . . . . . (2.5.4) – 23<br />

Comm<strong>and</strong> <strong>to</strong> produce a hash symbol: \# = #.<br />

. . . . . . . . . . . . . . . . . . . . . . . . . . . . (5.1) – 119<br />

Toggle character for switching between text <strong>and</strong> in-line math modes.<br />

On the first appearance (text <strong>to</strong> math) it behaves the same as \(<br />

or \begin{math}, while the second call (math <strong>to</strong> text) is as \) or<br />

\end{math}.<br />

\$ . . . . . . . . . . . . . . . . . . . . . . . . . . . (2.5.4) – 23<br />

Comm<strong>and</strong> <strong>to</strong> produce a dollar sign: \$ = $.<br />

% . . . . . . . . . . . . . . . . . . . . . . . . . . . . (4.11) – 118<br />

Comment character. The rest of the line of text following % is ignored<br />

by the T E X processing.<br />

\% . . . . . . . . . . . . . . . . . . . . . . . . . . . . (2.5.4) – 23<br />

Comm<strong>and</strong> <strong>to</strong> produce a percent sign: \% = %.<br />

& . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (4.8.1) – 97<br />

Indicates a new column in array <strong>and</strong> tabular environments.<br />

\& . . . . . . . . . . . . . . . . . . . . . . . . . . . . (2.5.4) – 23<br />

Comm<strong>and</strong> <strong>to</strong> produce an ampers<strong>and</strong> symbol: \& = &.<br />

\’ . . . . . . . . . . . . . . . . . . . . . . (2.5.7), (4.6.4) – 24, 83<br />

1. Comm<strong>and</strong> <strong>to</strong> produce an acute accent: \’a = á.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 509<br />

2. Within the tabbing environment, a comm<strong>and</strong> <strong>to</strong> jump <strong>to</strong> the<br />

end of the current column.<br />

( ) . . . . . . . . . . . . . . . . . . . . (13.1.2), (14.2) – 289, 312<br />

For a picture comm<strong>and</strong> in picture environment, specifies a coordinate<br />

pair. In BIBT E X, an alternative form for the outermost grouping<br />

of the entry type.<br />

\( . . . . . . . . . . . . . . . . . . . . . . . . . . . . (5.1) – 119<br />

Switches from text <strong>to</strong> in-line math mode <strong>to</strong> produce formulas within<br />

a line of text. It functions the same as \begin{math} <strong>and</strong> as a $ sign<br />

in text mode.<br />

\) . . . . . . . . . . . . . . . . . . . . . . . . . . . . (5.1) – 119<br />

Switches back from in-line math mode <strong>to</strong> text mode. It functions the<br />

same as \end{math} <strong>and</strong> as a $ sign in math mode.<br />

\+ . . . . . . . . . . . . . . . . . . . . . . . . . . . . (4.6.3) – 82<br />

Within the tabbing environment, increments the left margin by one<br />

tab s<strong>to</strong>p (moves it <strong>to</strong> the right).<br />

\, . . . . . . . . . . . . . . . . . . . . . . (2.7.1), (5.5.1) – 29, 145<br />

Small space, the size of 1/6 quad, for use in text <strong>and</strong> math mode:<br />

xx\,x = xx x.<br />

- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (2.5.3) – 23<br />

As -, produces the hyphen - for compound words <strong>and</strong> word division,<br />

as --, the en dash –, <strong>and</strong> as ---, the em dash —.<br />

\- . . . . . . . . . . . . . . . . . . . . . . (2.8.1), (4.6.3) – 35, 82<br />

1. Denotes possible word division. If a word contains at least one<br />

\- the normal word division rules are suspended for that word<br />

<strong>and</strong> division may occur only at those locations.<br />

2. Within the tabbing environment, decrements the left margin<br />

by one tap s<strong>to</strong>p (moves it <strong>to</strong> the left).<br />

\. . . . . . . . . . . . . . . . . . . . . . . . . . . . . (2.5.7) – 24<br />

Comm<strong>and</strong> <strong>to</strong> produce a dot accent: \.o = ˙o.<br />

\/ . . . . . . . . . . . . . . . . . . . . . . . . . . . (2.5.10) – 26<br />

Comm<strong>and</strong> <strong>to</strong> break up ligatures: shelf\/ful = shelfful.<br />

\: [m] . . . . . . . . . . . . . . . . . . . . . . . . . (5.5.1) – 145<br />

In math mode, a medium space, the size of 2/9 quad: xx\:x = xx x.<br />

\; [m] . . . . . . . . . . . . . . . . . . . . . . . . . (5.5.1) – 145<br />

In math mode, a large space, the size of 5/18 quad: xx\;x = xx x.


510 Appendix H. Comm<strong>and</strong> Summary<br />

\< . . . . . . . . . . . . . . . . . . . . . . . . . . . . (4.6.3) – 82<br />

Within the tabbing environment, moves <strong>to</strong> the left by one tab s<strong>to</strong>p.<br />

\= . . . . . . . . . . . . . . . . . . . . . . (2.5.7), (4.6.1) – 24, 81<br />

1. Comm<strong>and</strong> <strong>to</strong> produce a macron accent: \=o = ō.<br />

2. Within the tabbing environment, sets a tab s<strong>to</strong>p at the current<br />

position within the line.<br />

\> . . . . . . . . . . . . . . . . . . . . . . . . . . . . (4.6.1) – 81<br />

Within the tabbing environment, moves right <strong>to</strong> the next tab s<strong>to</strong>p.<br />

?‘ produces ¿ . . . . . . . . . . . . . . . . . . . . . . (2.5.6) – 24<br />

@ . . . . . . . . . . . . . . . . . . . . . . (9.4.2), (14.2) – 226, 311<br />

1. In MakeIndex, separates an entry in an \index comm<strong>and</strong> in<strong>to</strong><br />

a lexical (for alphabetization) <strong>and</strong> printing part. Example:<br />

\index{sum@$\sum$} means that the entry appears in the index<br />

at the location of the word ‘sum’ but what is printed is the<br />

summation sign .<br />

2. In BIBT E X, denotes the entry type. Example: @BOOK indicates that<br />

the following literature entries correspond <strong>to</strong> those of a book.<br />

\@ . . . . . . . . . . . . . . . . . . . . . . . . . . . . (2.7.1) – 29<br />

Extra space at the end of a sentence ending with a capital letter.<br />

[ ] . . . . . . . . . . . . . . . . . . . . . . . . . . . (2.1) – 18<br />

After comm<strong>and</strong>s or environment calls, specifies an optional argument.<br />

\[ . . . . . . . . . . . . . . . . . . . . . . . . . . . . (5.1) – 120<br />

Switches from text mode <strong>to</strong> displayed math mode for putting<br />

a formula on a line by itself. Has the same effect as<br />

\begin{displaymath} or $$ in text mode.<br />

\\[space] . . . . . . . . . . . . . . . . . . . . . . . . (2.7.2) – 31<br />

Ends the current line (without right justifying it). The optional argument<br />

[space] inserts additional vertical spacing of length space<br />

before the next line.<br />

\\*[space] . . . . . . . . . . . . . . . . . . . . . . . . (2.7.2) – 31<br />

The same as \\ but prevents a page break from occurring between<br />

the current <strong>and</strong> next line.<br />

\] . . . . . . . . . . . . . . . . . . . . . . . . . . . . (5.1) – 120<br />

Switches back from displayed math mode <strong>to</strong> text mode. Has the<br />

same effect as \end{displaymath} or $$ in math mode.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 511<br />

ˆ [m] . . . . . . . . . . . . . . . . . . . . . . . . . . (5.2.2) – 121<br />

Exponents <strong>and</strong> superscripts in equations: xˆ2 = x 2 , xˆ{-2n} =<br />

x −2n .<br />

\ˆ . . . . . . . . . . . . . . . . . . . . . . . . . . . . (2.5.7) – 24<br />

Comm<strong>and</strong> <strong>to</strong> produce a circumflex accent: \ˆo = ô.<br />

_ [m] . . . . . . . . . . . . . . . . . . . . . . . . . . (5.2.2) – 121<br />

Subscripts in equations: a_n = an, a_{i,j,k} = ai,j,k.<br />

\_ . . . . . . . . . . . . . . . . . . . . . . . . . . . . (2.5.4) – 23<br />

Comm<strong>and</strong> <strong>to</strong> produce the underbar sign: t\_v = t v.<br />

\‘ . . . . . . . . . . . . . . . . . . . . . . (2.5.7), (4.6.4) – 24, 83<br />

1. Comm<strong>and</strong> <strong>to</strong> produce a grave accent: \‘o = ò.<br />

2. Within the tabbing environment, pushes the following text up<br />

against the right margin of the line.<br />

{ } . . . . . . . . . . . . . . . . . (2.1), (2.2), (14.2) – 18, 20, 311<br />

1. After a comm<strong>and</strong> or environment call, specifies a m<strong>and</strong>a<strong>to</strong>ry<br />

argument.<br />

2. Grouping a section of text <strong>to</strong> create a nameless environment.<br />

3. In BIBT E X, delimiting the name of an entry type, as well as an<br />

alternative delimiter for the text field.<br />

\{ produces a left curly brace: \{ = { . . . . . . . . . . (2.5.4) – 23<br />

| [m] produces | . . . . . . . . . . . . . . (5.3.4), (5.4.1) – 126, 132<br />

| . . . . . . . . . . . . . . . . . . . . . . . . . . . . (9.4.2) – 227<br />

In MakeIndex, the comm<strong>and</strong> character within a \index comm<strong>and</strong>.<br />

1. After the comm<strong>and</strong> \newcomm<strong>and</strong>{\ii}[1]{\textit{#1}}<br />

has been defined, \index{entry|ii} produces the page number<br />

for ‘entry’ in the index in italic type.<br />

2. The cross-reference comm<strong>and</strong> \see from makeidx.sty can be<br />

invoked with \index{bison|see{buffalo}} <strong>to</strong> produce crossreferences<br />

within the index.<br />

\| [m] produces . . . . . . . . . . . . . . . . . . . (5.3.6) – 127<br />

\} produces a right curly brace: \} = } . . . . . . . . . . (2.5.4) – 23<br />

˜ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (2.7.1) – 29<br />

A normal space between words, but without the possibility that the<br />

line will be broken there. Example: Prof.˜Jones ensures that ‘Prof.’<br />

<strong>and</strong> ‘Jones’ both remain on the same line.<br />

\˜ . . . . . . . . . . . . . . . . . . . . . . . . . . . . (2.5.7) – 24<br />

Comm<strong>and</strong> <strong>to</strong> produce a tilde accent: \˜n = ñ.


512 Appendix H. Comm<strong>and</strong> Summary<br />

\a= . . . . . . . . . . . . . . . . . . . . . . . . . . . (4.6.4) – 83<br />

Produces a macron accent within tabbing environment: \a=o = ō.<br />

\a’ . . . . . . . . . . . . . . . . . . . . . . . . . . . (4.6.4) – 83<br />

Produces an acute accent within tabbing environment: \a’o = ó.<br />

\a‘ . . . . . . . . . . . . . . . . . . . . . . . . . . . (4.6.4) – 83<br />

Produces a grave accent within tabbing environment: \a‘o = ò.<br />

\AA produces ˚A . . . . . . . . . . . . . . . . . . . . . . (2.5.6) – 24<br />

\aa produces ˚a . . . . . . . . . . . . . . . . . . . . . . (2.5.6) – 24<br />

\abovedisplayskip [m] . . . . . . . . . . . . . . . . (5.5.4) – 149<br />

Vertical space between a long displayed equation <strong>and</strong> the preceding<br />

line of text. A new value may be assigned with the \setlength<br />

comm<strong>and</strong>:<br />

\setlength{\abovedisplayskip}{10pt plus2pt minus5pt}<br />

\abovedisplayshortskip [m] . . . . . . . . . . . . . (5.5.4) – 149<br />

Vertical space between a short displayed equation <strong>and</strong> the preceding<br />

line of text. A new value may be assigned with the \setlength<br />

comm<strong>and</strong> as in the above example.<br />

\abstractname . . . . . . . . . . . . . . . . . . . . (D.4.1) – 460<br />

Comm<strong>and</strong> containing the heading for the abstract. In English, this is<br />

‘Abstract’ but may be altered for adaptation <strong>to</strong> other languages.<br />

\acute{x} [m] . . . . . . . . . . . . . . . . . . . . . (5.3.9) – 129<br />

Acute accent over math variable x: \acute{a} = á<br />

\Acute{x} [m][a] . . . . . . . . . . . . . . . . . . . (12.2.2) – 263<br />

With the amsmath package, can be used like \acute, but with multiple<br />

A M S-L AT E X math accents the positioning will be correct.<br />

\addcontentsline{file}{format}{entry} . . . (3.4.3), (3.4.4) – 59, 60<br />

Manual addition of entry in<strong>to</strong> the list file.<strong>to</strong>c,.lof, or.lot, according<br />

<strong>to</strong> the value of file, <strong>to</strong> be formatted as the heading of a sectioning<br />

comm<strong>and</strong>, as given by format, for example<br />

\addcontentsline{<strong>to</strong>c}{section}{References}<br />

\address{sender} . . . . . . . . . . . . . . . . . . . (16.1) – 351<br />

In the letter document class, enters the sender’s address. Multiple<br />

lines in sender are separated by \\.<br />

\addtime{secs} . . . . . . . . . . . . . . . . . . . (15.1.3) – 327<br />

In the slides class, if the option clock has been selected, a time<br />

marker, in minutes, appears at the bot<strong>to</strong>m of the notes. This comm<strong>and</strong><br />

adds the specified number of seconds <strong>to</strong> the marker. See also<br />

\settime.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 513<br />

\add<strong>to</strong>contents{file}{entry} . . . . . . . . (3.4.3), (3.4.4) – 59, 60<br />

Manual addition of entry in<strong>to</strong> the list file.<strong>to</strong>c,.lof, or.lot, according<br />

<strong>to</strong> the value of file. Example:<br />

\add<strong>to</strong>contents{lof}{\protect\newpage}<br />

\add<strong>to</strong>counter{counter}{number} . . . . . . . . . . (8.1.3) – 182<br />

Adds number <strong>to</strong> the current value of the number s<strong>to</strong>red in counter.<br />

\add<strong>to</strong>length{length name}{length} . . . . . . . . . . (8.2) – 184<br />

Adds the quantity length <strong>to</strong> the current value of the length comm<strong>and</strong><br />

\length name.<br />

\addvspace{length} . . . . . . . . . . . . . . . . . . . (8.2) – 185<br />

Inserts vertical spacing of amount length between paragraphs at the<br />

point where the comm<strong>and</strong> is given. If other vertical spacing exists,<br />

the <strong>to</strong>tal will not exceed length.<br />

\AE produces Æ . . . . . . . . . . . . . . . . . . . . . . (2.5.6) – 24<br />

\ae produces æ . . . . . . . . . . . . . . . . . . . . . . (2.5.6) – 24<br />

\aleph [m] produces ℵ . . . . . . . . . . . . . . . . . (5.3.6) – 127<br />

\allowdisplaybreaks[num] [p][a] . . . . . . . . . . (12.2.7) – 278<br />

With the amsmath package, allows au<strong>to</strong>matic page breaks <strong>to</strong> occur<br />

within multiline math formulas. If num is present, it takes a value<br />

of 0–4 <strong>to</strong> increase the ease with which page breaks occur. Without<br />

this comm<strong>and</strong>, a manual page break can be made at the end of any<br />

formula line with \displaybreak.<br />

\Alph{counter} . . . . . . . . . . . . . . . . . . . . (8.1.4) – 183<br />

Prints the current value of counter as a capital letter.<br />

\alph{counter} . . . . . . . . . . . . . . . . . . . . (8.1.4) – 183<br />

Prints the current value of counter as a lower case letter.<br />

\alpha [m] produces α . . . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\alsoname . . . . . . . . . . . . . . . . . . . . . . . (D.4.1) – 460<br />

Comm<strong>and</strong> for use in the makeidx package. It prints the text for a<br />

comm<strong>and</strong> \seealso. In English, this is ‘see also’ but may be altered<br />

for adaptation <strong>to</strong> other languages.<br />

\amalg [m] produces ∐ . . . . . . . . . . . . . . . . . (5.3.3) – 125<br />

\<strong>and</strong> . . . . . . . . . . . . . . . . . . . . . . . . . . . (3.3.1) – 53<br />

Used <strong>to</strong> separate author names within the \author comm<strong>and</strong> for<br />

generating a title page with \maketitle.<br />

\angle [m] produces ∠ . . . . . . . . . . . . . . . . . (5.3.6) – 127<br />

\appendixname . . . . . . . . . . . . . . . . . . . . (D.4.1) – 460<br />

Comm<strong>and</strong> containing the heading for the appendix. In English, this<br />

is ‘Appendix’ but may be altered for adaptation <strong>to</strong> other languages.


514 Appendix H. Comm<strong>and</strong> Summary<br />

\approx [m] produces ≈ . . . . . . . . . . . . . . . . (5.3.4) – 126<br />

\arabic{counter} . . . . . . . . . . . . . . . . . . . (8.1.4) – 183<br />

Prints the current value of counter as an Arabic number.<br />

\arccos [m] . . . . . . . . . . . . . . . . . . . . . . (5.3.8) – 128<br />

Comm<strong>and</strong> <strong>to</strong> produce the function name ‘arccos’ in equations.<br />

\arcsin [m] . . . . . . . . . . . . . . . . . . . . . . (5.3.8) – 128<br />

Comm<strong>and</strong> <strong>to</strong> produce the function name ‘arcsin’ in equations.<br />

\arctan [m] . . . . . . . . . . . . . . . . . . . . . . (5.3.8) – 128<br />

Comm<strong>and</strong> <strong>to</strong> produce the function name ‘arctan’ in equations.<br />

\arg [m] . . . . . . . . . . . . . . . . . . . . . . . . (5.3.8) – 128<br />

Comm<strong>and</strong> <strong>to</strong> produce the function name ‘arg’ in equations.<br />

\arraycolsep . . . . . . . . . . . . . . . . . . . . . . (4.8.2) – 98<br />

Half the width of the intercolumn spacing in the array environment.<br />

Value is assigned with the L AT E X comm<strong>and</strong> \setlength:<br />

\setlength{\arraycolsep}{3mm}<br />

\arrayrulewidth . . . . . . . . . . . . . . . . . . . . (4.8.2) – 98<br />

The thickness of vertical <strong>and</strong> horizontal lines in the array <strong>and</strong><br />

tabular environments. Its value is assigned <strong>to</strong> a length with<br />

\setlength:<br />

\setlength{\arrayrulewidth}{0.5mm}<br />

\arraystretch . . . . . . . . . . . . . . . . . . . . . (4.8.2) – 98<br />

Fac<strong>to</strong>r <strong>to</strong> change the spacing between lines in a table, normal value<br />

being 1. Spacing is multiplied by this fac<strong>to</strong>r, which is set <strong>to</strong> a new<br />

value with \renewcomm<strong>and</strong>{\arraystretch}{fac<strong>to</strong>r}.<br />

\ast [m] produces ∗ . . . . . . . . . . . . . . . . . . (5.3.3) – 125<br />

\asymp [m] produces ≍ . . . . . . . . . . . . . . . . . (5.3.4) – 126<br />

\AtBeginDocument{code} [p] . . . . . . . . . . . . . . (D.2.4) – 444<br />

S<strong>to</strong>res the code <strong>to</strong> be inserted in<strong>to</strong> the processing stream when<br />

\begin{document} is executed. Comm<strong>and</strong>s that are only allowed in<br />

the preamble may be part of code. A package might include coding<br />

in this way <strong>to</strong> ensure that it is not overwritten by another package.<br />

\AtEndDocument{code} [p] . . . . . . . . . . . . . . . (D.2.4) – 444<br />

S<strong>to</strong>res the code <strong>to</strong> be inserted in<strong>to</strong> the processing stream when<br />

\end{document} is executed. A package might include coding in<br />

this way <strong>to</strong> have additional features printed au<strong>to</strong>matically at the end<br />

of the document.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 515<br />

\AtEndOfClass{code} [p] . . . . . . . . . . . . . . . (D.2.4) – 444<br />

S<strong>to</strong>res the code <strong>to</strong> be inserted in<strong>to</strong> the processing stream when the<br />

current class file has finished being read. May only be given in a class<br />

file, or in another file that is read by a class file. May be used by a<br />

local configuration file <strong>to</strong> overwrite defaults in the class file itself.<br />

\AtEndOfPackage{code} [p] . . . . . . . . . . . . . . (D.2.4) – 444<br />

S<strong>to</strong>res the code <strong>to</strong> be inserted in<strong>to</strong> the processing stream when the<br />

current package file has finished being read. May only be given in a<br />

package file, or in another file that is read by a package file. May be<br />

used by a local configuration file <strong>to</strong> overwrite defaults in the package<br />

file itself.<br />

\author{name} . . . . . . . . . . . . . . . . . . . . . (3.3.1) – 53<br />

Enters the author name(s) for a title page produced by the<br />

\maketitle comm<strong>and</strong>.<br />

\b{x} . . . . . . . . . . . . . . . . . . . . . . . . . . (2.5.7) – 24<br />

Comm<strong>and</strong> <strong>to</strong> produce an underbar accent: \b{o} = ō.<br />

\backmatter . . . . . . . . . . . . . . . . . . . . . . . (3.3.5) – 57<br />

In the book class, introduces the material that comes at the end<br />

(bibliography, index) by turning off the chapter numbering of the<br />

\chapter comm<strong>and</strong>.<br />

\backslash [m] produces \ . . . . . . . . . . . . . . . (5.3.6) – 127<br />

\bar{x} [m] . . . . . . . . . . . . . . . . . . . . . . (5.3.9) – 129<br />

Macron accent over the math variable x: \bar{a} = ā.<br />

\Bar{x} [m][a] . . . . . . . . . . . . . . . . . . . . (12.2.2) – 263<br />

With the amsmath package, can be used like \bar, but with multiple<br />

A M S-L AT E X math accents the positioning will be correct.<br />

\baselineskip . . . . . . . . . . . . . . . . . . . . . (3.2.4) – 46<br />

Interline spacing within a paragraph. Every font has its own internal<br />

line spacing. A new value (a rubber length) may be assigned with<br />

\setlength:<br />

\setlength{\baselineskip}{12pt plus2pt minus1pt}<br />

\baselinestretch . . . . . . . . . . . . . . (3.2.4), (4.1.2) – 46, 63<br />

A fac<strong>to</strong>r with the normal value of 1 by which the internal length<br />

\baselineskip is multiplied <strong>to</strong> produce the actual interline spacing.<br />

May be changed with:<br />

\renewcomm<strong>and</strong>{\baselinestretch}{fac<strong>to</strong>r}<br />

The new value takes effect after the next change in font size!


516 Appendix H. Comm<strong>and</strong> Summary<br />

\begin{envrnmnt} . . . . . . . . . . . . . . . . . . . . (2.2) – 19<br />

Start of an environment with the name envrnmnt. This comm<strong>and</strong><br />

must be coupled with \end{envrnmt} <strong>to</strong> terminate the environment.<br />

The environment name in both these comm<strong>and</strong>s must be identical.<br />

\begin{abstract} . . . . . . . . . . . . . . . . . . . . (3.3.2) – 55<br />

Start of the environment abstract <strong>to</strong> produce an abstract. With<br />

document class article, font size \small <strong>and</strong> the quotation environment<br />

are selected. With report, the abstract appears on a<br />

separate page with normal font size <strong>and</strong> line width. In both cases,<br />

the heading Abstract is centered above the text.<br />

\begin{align} [a] . . . . . . . . . . . . . . . . . . (12.2.6) – 274<br />

With the amsmath package, switches <strong>to</strong> displayed math mode <strong>to</strong> produce<br />

a set of aligned equations. Line are terminated by \\ comm<strong>and</strong>s.<br />

The lines are split in<strong>to</strong> columns aligned on the first, third, fifth . . . &<br />

characters. Each line receives an equation number unless the *-form<br />

of the environment has been selected.<br />

\begin{alignat}{num} [a] . . . . . . . . . . . . . (12.2.6) – 275<br />

Is the same as the align environment except that no spacing is<br />

inserted au<strong>to</strong>matically between the column pairs. The argument num<br />

is the number of column pairs = (1 + n&)/2 where n& is the number<br />

of & signs in one row. Explicit spacing may be placed between column<br />

pairs, especially if the left part of that pair is otherwise empty.<br />

\begin{aligned}[pos] [m][a] . . . . . . . . . . . . (12.2.6) – 276<br />

With the amsmath package, is like the align environment but is<br />

used as an element within math mode. The optional argument pos<br />

determines the vertical positioning relative <strong>to</strong> neighboring elements:<br />

t or b for <strong>to</strong>p or bot<strong>to</strong>m, no argument for centering.<br />

\begin{appendix} . . . . . . . . . . . . . . . . . . . . (3.3.4) – 57<br />

Start of the environment appendix <strong>to</strong> produce an appendix. The<br />

main section counter is reset <strong>to</strong> zero <strong>and</strong> its numbering appears as<br />

capital letters.<br />

\begin{array}[pos]{col} [m] . . . . . . . . (4.8.1), (5.4.3) – 95, 134<br />

Start of the environment array <strong>to</strong> produce matrices <strong>and</strong> arrays in<br />

math mode. The column definition col contains a formatting character<br />

for each column. Thus \begin{array}{lcr} produces an array<br />

with three columns: one left justified, one centered, <strong>and</strong> one right<br />

justified. The optional parameter pos determines how the array is<br />

aligned vertically with text outside it on the same line: t with the <strong>to</strong>p<br />

line, b with the bot<strong>to</strong>m line, while the default is with the center. See<br />

also \begin{tabular}<br />

\begin{center} . . . . . . . . . . . . . . . . . . . . . (4.2.1) – 67<br />

Start of the environment center. Each line of text terminated by \\<br />

appears centered. See also \centering.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 517<br />

\begin{comm<strong>and</strong> name} . . . . . . . . . . . . . . . . . (2.2) – 20<br />

Most declaration comm<strong>and</strong>s, such as the font styles <strong>and</strong> sizes, can be<br />

used as environment names. For example, \begin{small} switches<br />

<strong>to</strong> font size \small until the countercomm<strong>and</strong> \end{small} is given.<br />

\begin{alltt} . . . . . . . . . . . . . . . . . . . . (4.9.1) – 111<br />

When the alltt package has been loaded, this environment prints<br />

out original text in typewriter typeface, maintaining line breaks, special<br />

symbols, <strong>and</strong> so on, except for \ { } which function as usual.<br />

This allows comm<strong>and</strong>s <strong>to</strong> be executed within the typewriter text.<br />

\begin{bmatrix} [m][a] . . . . . . . . . . . . . . . (12.2.4) – 266<br />

Like the matrix environment, but enclosed in square brackets [].<br />

\begin{Bmatrix} [m][a] . . . . . . . . . . . . . . . (12.2.4) – 266<br />

Like the matrix environment, but enclosed in curly braces { }.<br />

\begin{cases} [m][a] . . . . . . . . . . . . . . . . (12.2.6) – 277<br />

With the amsmath package, writes math expressions on several lines,<br />

terminated by \\, in left-justified columns, separated by &, with a<br />

curly brace enclosing all lines at the left, the whole being centered<br />

vertically.<br />

\begin{description} . . . . . . . . . . . . . . . . . . (4.3.3) – 70<br />

Start of the environment description <strong>to</strong> produce an indented list<br />

with labels. The label text is the argument label in the comm<strong>and</strong><br />

\item[label].<br />

\begin{displaymath} . . . . . . . . . . . . . . . . . . (5.1) – 120<br />

Switches from text <strong>to</strong> displayed math mode for producing a formula<br />

on a line by itself. Functions the same as \[.<br />

\begin{document} . . . . . . . . . . . . . . . . . . . . (1.5.2) – 12<br />

Start of the outermost environment of a text document. This comm<strong>and</strong><br />

terminates the preamble. It is obliga<strong>to</strong>ry for every L AT E X document,<br />

as is its counterpart \end{document} for ending the document.<br />

\begin{enumerate} . . . . . . . . . . . . . . . . . . . (4.3.2) – 70<br />

Start of the environment enumerate <strong>to</strong> produce a numbered, indented<br />

listing. The style of numbering depends on the depth of<br />

nesting; at the first level, it consists of a running Arabic number that<br />

is incremented with each call <strong>to</strong> \item.<br />

\begin{eqnarray} [m] . . . . . . . . . . . . . . . . . (5.4.7) – 138<br />

Switches from text <strong>to</strong> displayed math mode <strong>to</strong> produce a set of equations<br />

or a multiline formula in the form of a three-column table {rcl}.<br />

The individual lines of the formula are ended with the comm<strong>and</strong> \\;<br />

the fields within a line are separated by & characters. Each line is<br />

given a sequential equation number unless the comm<strong>and</strong> \nonumber<br />

appears within it.


518 Appendix H. Comm<strong>and</strong> Summary<br />

\begin{eqnarray*} [m] . . . . . . . . . . . . . . . . (5.4.7) – 138<br />

Is the same as the eqnarray environment except that no equation<br />

numbers are printed.<br />

\begin{equation} [m] . . . . . . . . . . . . . . . . . . (5.1) – 120<br />

Switches from text <strong>to</strong> displayed math mode <strong>to</strong> produce a formula on<br />

a line by itself, including an au<strong>to</strong>matic sequential equation number.<br />

\begin{falign} [a] . . . . . . . . . . . . . . . . . (12.2.6) – 275<br />

With the amsmath package, is the same as the align environment<br />

except that spacing is inserted between the column pairs <strong>to</strong> fill up<br />

the entire line.<br />

\begin{figure}[loc] . . . . . . . . . . . . . . . . . . (7.1) – 169<br />

Float environment for entering text for a figure. The optional argument<br />

loc can be any combination of the letters h, t, b, <strong>and</strong> p <strong>to</strong><br />

determine the various positioning possibilities. Default is tbp. The<br />

character ! may additionally be given <strong>to</strong> ignore all float spacing <strong>and</strong><br />

number restrictions set by the float style parameters.<br />

\begin{figure*}[loc] . . . . . . . . . . . . . . . . . . (7.1) – 169<br />

The same as the figure environment except that the figure is inserted<br />

over the width of two columns when the option twocolumn or the<br />

comm<strong>and</strong> \twocolumn has been selected. The st<strong>and</strong>ard form figure<br />

will only fill the width of one column.<br />

\begin{filecontents}{file name} [p] . . . . . . . . . (D.2.9) – 448<br />

An environment that may be given only before \documentclass, it<br />

writes its lines literally <strong>to</strong> a file of the specified name, if that file does<br />

not already exist. It also adds comment lines stating its source. In<br />

this way, non-st<strong>and</strong>ard files may be included in the main document<br />

file for shipment <strong>to</strong> other installations. If a file with the stated name<br />

already exists, it is not overwritten, but a warning message is issued.<br />

\begin{filecontents*}{file name} [p] . . . . . . . . (D.2.9) – 448<br />

Is the same as the filecontents environment, except that no comment<br />

lines are written <strong>to</strong> the file. The file will contain exactly the<br />

contents of the environment, <strong>and</strong> nothing more.<br />

\begin{flushleft} . . . . . . . . . . . . . . . . . . . (4.2.2) – 67<br />

Start of the flushleft environment in which each line of text is<br />

left justified, that is, it begins flush with the left margin but is not<br />

exp<strong>and</strong>ed <strong>to</strong> match the right edge. The equivalent declaration is<br />

\raggedright.<br />

\begin{flushright} . . . . . . . . . . . . . . . . . . (4.2.2) – 67<br />

Start of the flushright environment in which each line of text is<br />

right justified, that is, the right-h<strong>and</strong> side is flush with the right<br />

margin, but the line is not exp<strong>and</strong>ed <strong>to</strong> start exactly at the left edge.<br />

The equivalent declaration is \raggedleft.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 519<br />

\begin{gather} [a] . . . . . . . . . . . . . . . . . (12.2.6) – 273<br />

With the amsmath package, switches <strong>to</strong> displayed math mode <strong>to</strong><br />

produce several lines of equations, all centered with no alignment.<br />

Lines are terminated by \\ comm<strong>and</strong>s. Each line receives an equation<br />

number, unless the *-form of the environment has been selected.<br />

\begin{gathered}[pos] [m][a] . . . . . . . . . . . . (12.2.6) – 276<br />

With the amsmath package, is like the gather environment but is<br />

used as an element within math mode. The optional argument pos<br />

determines the vertical positioning relative <strong>to</strong> neighboring elements:<br />

t or b for <strong>to</strong>p or bot<strong>to</strong>m, no argument for centering.<br />

\begin{itemize} . . . . . . . . . . . . . . . . . . . . (4.3.1) – 69<br />

Start of the itemize environment for producing labeled, indented<br />

listings. The type of label depends on the depth of nesting; at the<br />

first level it is a • generated by each \item comm<strong>and</strong>.<br />

\begin{longtable} . . . . . . . . . . . . . . . . . . (4.8.4) – 108<br />

With the longtable package, begins a table with the same syntax as<br />

tabular but which will continue <strong>to</strong> other pages as necessary. The<br />

head <strong>and</strong> footlines on the continued pages can be specified, terminated<br />

with \endhead, \endfirsthead, \endfoot, \endlastfoot.<br />

\begin{letter}{recipient} . . . . . . . . . . . . . . (16.1) – 352<br />

Start of a letter with the document class letter. Name <strong>and</strong> address<br />

of the recipient are given within the second pair of brackets; lines of<br />

text within this argument are ended with the comm<strong>and</strong> \\.<br />

\begin{list}{st<strong>and</strong>ard label}{list decl} . . . . . . . . . (4.4) – 74<br />

Start of a generalized list environment. The label is defined by<br />

st<strong>and</strong>ard label, which is generated by each \item comm<strong>and</strong>. The<br />

desired list declarations are contained in list decl (see page 75).<br />

\begin{lrbox}{\boxname} . . . . . . . . . . . . . . . (4.7.1) – 87<br />

Functions in a way similar <strong>to</strong> the comm<strong>and</strong> \sbox, except that it is the<br />

text of the environment that is s<strong>to</strong>red in the LR box named \boxname,<br />

which has previously been created with \newsavebox{\boxname}.<br />

The contents of the box may be printed as often as desired with<br />

\usebox{\boxname}.<br />

\begin{math} . . . . . . . . . . . . . . . . . . . . . . (5.1) – 119<br />

Switches from text <strong>to</strong> in-line math mode <strong>to</strong> produce formulas within<br />

a line of text. This environment has the same effect as \( or $ in text<br />

mode.<br />

\begin{matrix} [m][a] . . . . . . . . . . . . . . . . (12.2.4) – 266<br />

With the amsmath package, is the same as the array environment<br />

except that the column specifier argument may be omitted, without


520 Appendix H. Comm<strong>and</strong> Summary<br />

which up <strong>to</strong> 10 centered columns may be entered. This maximum<br />

may be changed with the counter MaxMatrixCols. The environments<br />

pmatrix, bmatrix, Bmatrix, vmatrix, <strong>and</strong> Vmatrix function the<br />

same as matrix but are enclosed in braces (), [], {}, | | <strong>and</strong> ,<br />

respectively.<br />

\begin{minipage}[pos][height][inner pos]{width}<br />

. . . . . . . . . . . . . . . . . . . . . . . . (4.7.3), (4.7.5) – 88, 90<br />

Environment <strong>to</strong> format text within a ‘minipage’ of width width. Its vertical<br />

positioning with respect <strong>to</strong> the surrounding text is determined<br />

by the optional argument pos: t for alignment with its <strong>to</strong>p line, b<br />

with its bot<strong>to</strong>m line, <strong>and</strong> centered with no argument. The other two<br />

optional arguments are: height <strong>to</strong> give the <strong>to</strong>tal height, <strong>and</strong> inner pos<br />

<strong>to</strong> specify how the text is <strong>to</strong> be positioned inside it. Possible values<br />

are t for <strong>to</strong>p, b for bot<strong>to</strong>m, c for centered, <strong>and</strong> s <strong>to</strong> be stretched<br />

out <strong>to</strong> fill the whole vertical space. The default is the value of the<br />

external positioning pos option. The height argument may contain<br />

the parameters \height, \depth, \width, <strong>and</strong> \<strong>to</strong>talheight.<br />

\begin{multicols}{num cols}[header][pre space]<br />

. . . . . . . . . . . . . . . . . . . . . . . . (3.2.8), (B.5.4) – 51, 395<br />

This environment is provided by the multicol package in the <strong>to</strong>ols<br />

collection (Section B.5.4). It switches <strong>to</strong> printing the text in num cols<br />

columns, with header printed in one column across the <strong>to</strong>p. A new<br />

page is inserted only if the remaining space on the current page<br />

is less than \premulticols or the optional argument pre space.<br />

A new page is inserted at the end if the remaining space is less<br />

than \postmulticols. The columns on the last page are balanced.<br />

Column separation <strong>and</strong> rule are set by the lengths \columnsep <strong>and</strong><br />

\columnseprule.<br />

With the starred version multicols*, the columns of text are not<br />

balanced on the last page of the environment.<br />

\begin{multline} [a] . . . . . . . . . . . . . . . . (12.2.6) – 271<br />

With the amsmath package, switches <strong>to</strong> displayed math mode <strong>to</strong><br />

produce a single equation over several lines. Line breaks are forced<br />

by \\ comm<strong>and</strong>s. The first line is <strong>to</strong> the far left, the last <strong>to</strong> the right, all<br />

others centered. With \shoveleft{form} <strong>and</strong> \shoveright{form},<br />

single lines consisting of form may be pushed <strong>to</strong> the left or right.<br />

The single equation number appears at the right of the last line, or at<br />

the left of the first line, depending on class options reqno (default)<br />

<strong>and</strong> leqno, respectively. With the *-form of the environment, the<br />

equation number is suppressed.<br />

\begin{note} . . . . . . . . . . . . . . . . . . . . (15.1.2) – 326<br />

In slides class, the environment for producing a note for the current<br />

slide. Notes are numbered with the current slide number followed<br />

by a hyphen <strong>and</strong> running number, for example 8-1, 8-2, etc.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 521<br />

\begin{overlay} . . . . . . . . . . . . . . . . . . (15.1.2) – 325<br />

In slides class, the environment for producing an overlay for the<br />

current slide. Overlays are numbered with the current slide number<br />

followed by a lower case letter, for example 3-a, 3-b, etc. See also<br />

\begin{slide}.<br />

\begin{picture}(x dimen,y dimen) . . . . . . . . . (13.1.2) – 288<br />

Environment <strong>to</strong> generate a picture with the width x dimen <strong>and</strong> height<br />

y dimen, where the unit of length has previously been specified by<br />

the declaration \unitlength.<br />

\begin{picture}(x dimen,y dimen)(x offset,y offset) (13.1.6) – 301<br />

Most general form of the call <strong>to</strong> the picture environment. The<br />

picture is displaced <strong>to</strong> the left by x offset <strong>and</strong> downwards by y offset.<br />

\begin{pmatrix} [m][a] . . . . . . . . . . . . . . . (12.2.4) – 266<br />

Like the matrix environment, but enclosed in round parentheses ().<br />

\begin{quotation} . . . . . . . . . . . . . . . . . . . (4.2.3) – 67<br />

Start of the quotation environment in which text is indented on<br />

both sides relative <strong>to</strong> the normal page margins. Paragraphs within<br />

the environment are marked with an additional indentation of the<br />

first line.<br />

\begin{quote} . . . . . . . . . . . . . . . . . . . . . (4.2.3) – 67<br />

The same as the quotation environment except that the first line<br />

of a paragraph is not indented but instead additional line spacing<br />

comes between paragraphs.<br />

\begin{slide} . . . . . . . . . . . . . (15.1.2), (15.2.1) – 325, 331<br />

In slides <strong>and</strong> seminar classes, the main environment for producing<br />

a slide.<br />

\begin{sloppypar} . . . . . . . . . . . . . . . . . . . (2.8.3) – 36<br />

Inside this environment word spacings are allowed <strong>to</strong> stretch more<br />

generously than usual so that paragraphs are broken up in<strong>to</strong> lines<br />

with fewer word divisions. See also \sloppy. The countercomm<strong>and</strong><br />

is \fussy.<br />

\begin{split} [m][a] . . . . . . . . . . . . . . . . (12.2.6) – 272<br />

With the amsmath package, is used within a math environment such<br />

as equation <strong>to</strong> write a formula over several lines. Line breaks are<br />

forced with \\ comm<strong>and</strong>s <strong>and</strong> the lines are horizontally aligned<br />

on the & alignment marker. Any equation number is generated by<br />

the outer environment. It is either centered with the class option<br />

centertags (default) or with tbtags it appears at the right of the<br />

last line, or at the left of the first line, depending on class options<br />

reqno (default) <strong>and</strong> leqno, respectively.


522 Appendix H. Comm<strong>and</strong> Summary<br />

\begin{subarray}{pos}{1st line\\..\\last line} [m][a] (12.2.2) – 261<br />

With the amsmath package, sets multiline text for superscripts <strong>and</strong><br />

subscripts, like \substack, but the parameter pos may take on values<br />

c or l for centered or left-justified lines.<br />

\begin{subequations} [a] . . . . . . . . . . . . . . (12.2.7) – 277<br />

With the amsmath package, numbers equations within it with a fixed<br />

main number <strong>and</strong> sequence of lower case letters attached, as 7a, 7b,<br />

7c, . . . .<br />

\begin{tabbing} . . . . . . . . . . . . . . . . . . . . (4.6.1) – 81<br />

Start of the tabbing environment in which special tabbing comm<strong>and</strong>s<br />

become operational: \= sets a tab s<strong>to</strong>p, \> jumps <strong>to</strong> the next s<strong>to</strong>p,<br />

\< goes back a s<strong>to</strong>p, \\ terminates <strong>and</strong> starts a new line, \+ sets the<br />

left margin one tab s<strong>to</strong>p further, \- moves the left margin back one<br />

s<strong>to</strong>p.<br />

\begin{table}[loc] . . . . . . . . . . . . . (4.8.5), (7.1) – 109, 169<br />

Float environment for entering text for a table. The optional argument<br />

loc can be any combination of the letters h, t, b, <strong>and</strong> p <strong>to</strong> determine<br />

the various positioning possibilities. Default is tbp. The character<br />

! may additionally be given <strong>to</strong> ignore all float spacing <strong>and</strong> number<br />

restrictions set by the float style parameters.<br />

\begin{table*}[loc] . . . . . . . . . . . . . . . . . . (7.1) – 169<br />

The same as the table environment except that the table is inserted<br />

over the width of two columns when the option twocolumn or the<br />

comm<strong>and</strong> \twocolumn has been selected. The st<strong>and</strong>ard form table<br />

will only fill the width of one column.<br />

\begin{tabular}[pos]{cols} . . . . . . . . . . . . . . (4.8.1) – 95<br />

Start of the tabular environment for producing tables. The argument<br />

cols contains a formatting character for each column in the<br />

table: c for centered text, l for left, r for right justification, or p{wd}<br />

for a column of width wd in which the text may extend over several<br />

lines.<br />

When the entry @{text} appears between any two of the above column<br />

formatting characters, text is inserted in every row between those two<br />

columns. Where the character | appears, a vertical line is drawn in<br />

every row.<br />

The optional argument pos specifies how the table is <strong>to</strong> be vertically<br />

aligned with the surrounding text: with no argument, it is centered,<br />

otherwise with t the <strong>to</strong>p line, with b the bot<strong>to</strong>m line is aligned with<br />

the external baseline.<br />

The text entries of the individual columns are separated by & <strong>and</strong> the<br />

rows are terminated by \\.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 523<br />

\begin{tabular*}{width}[pos]{cols} . . . . . . . . . . (4.8.1) – 95<br />

The same as \begin{tabular} except that the <strong>to</strong>tal width of the<br />

table is given by the argument width. This may only be achieved<br />

successfully if there is rubber spacing between the columns. This<br />

may be added with @{\extracolsep\fill} somewhere within the<br />

cols format definition.<br />

\begin{thebibliography}{sample label} . . . . . . . (9.3.1) – 217<br />

Environment <strong>to</strong> generate a list of literature references. The sample<br />

label is the longest reference marker that will appear. Each entry<br />

in the bibliography starts with the comm<strong>and</strong> \bibitem which prints<br />

the marker for that entry; lines after the first are indented by an<br />

amount equal <strong>to</strong> the width of sample label.<br />

\begin{theindex} . . . . . . . . . . . . . . . . . . . (9.4.1) – 225<br />

Environment <strong>to</strong> produce a keyword index in two-column format.<br />

Entries are made with the \item, \subitem, \subsubitem, or<br />

\indexspace comm<strong>and</strong>s.<br />

\begin{theorem type}[extra title] . . . . . . . . . . . . (4.5) – 80<br />

Environment <strong>to</strong> invoke a theorem-like structure that has previously<br />

been defined by the user with the \newtheorem comm<strong>and</strong>. The name<br />

of the environment, theorem type, something like theorem or axiom,<br />

is the first argument of the \newtheorem comm<strong>and</strong>. The extra title<br />

is text that added after the name <strong>and</strong> number of the structure in ()<br />

parentheses.<br />

\begin{titlepage} . . . . . . . . . . . . . . . . . . . (3.3.1) – 52<br />

Environment <strong>to</strong> produce a title page without a page number. The<br />

user has <strong>to</strong>tal control over the composition of this page.<br />

\begin{trivlist} . . . . . . . . . . . . . . . . . . . . (4.4.5) – 79<br />

Environment <strong>to</strong> generate a trivial list without a sample label <strong>and</strong><br />

list declarations. The parameters \leftmargin, \labelwidth, <strong>and</strong><br />

\itemsep are all set <strong>to</strong> 0 pt while \listparindent = \parindent<br />

<strong>and</strong> \parsep = \parskip.<br />

\begin{verbatim} . . . . . . . . . . . . . . . . . . . . (4.9) – 110<br />

Environment <strong>to</strong> print out source text, that is, as from a typewriter.<br />

Blank lines, line breaking, <strong>and</strong> comm<strong>and</strong>s are all output literally<br />

without any interpretation or formatting.<br />

\begin{verbatim*} . . . . . . . . . . . . . . . . . . . (4.9) – 110<br />

The same as the verbatim environment except that blanks are<br />

printed as <strong>to</strong> make them visible.<br />

\begin{verse} . . . . . . . . . . . . . . . . . . . . . (4.2.4) – 68<br />

Environment for setting rhymes, poems, verses, etc. Stanzas are<br />

separated by blank lines, individual lines by the \\ comm<strong>and</strong>.


524 Appendix H. Comm<strong>and</strong> Summary<br />

\begin{vmatrix} [m][a] . . . . . . . . . . . . . . . (12.2.4) – 266<br />

Like the matrix environment, but enclosed in vertical lines | |.<br />

\begin{Vmatrix} [m][a] . . . . . . . . . . . . . . . (12.2.4) – 266<br />

Like the matrix environment, but enclosed in double vertical lines<br />

.<br />

\belowdisplayskip [m] . . . . . . . . . . . . . . . . (5.5.4) – 149<br />

Vertical spacing between a long displayed formula <strong>and</strong> the following<br />

text. A new value may be assigned with the \setlength comm<strong>and</strong>:<br />

\setlength{\belowdisplayskip}{\abovedisplayskip}<br />

sets \belowdisplayskip <strong>to</strong> the same value as \abovedisplayskip.<br />

See further examples under \abovedisplayskip.<br />

\belowdisplayshortskip [m] . . . . . . . . . . . . . (5.5.4) – 149<br />

Vertical spacing between a short displayed formula <strong>and</strong> the following<br />

text. Value is set with the \setlength comm<strong>and</strong> as in the above<br />

example.<br />

\beta [m] produces β . . . . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\bfdefault . . . . . . . . . . . . . . . . . . . . . . (A.3.1) – 372<br />

This comm<strong>and</strong> defines the series attribute that is selected with the<br />

\bfseries comm<strong>and</strong>. It may be redefined with \renewcomm<strong>and</strong>:<br />

\renewcomm<strong>and</strong>{\bfdefault}{b}<br />

\bfseries . . . . . . . . . . . . . . . . . . (4.1.3), (A.2) – 64, 371<br />

This declaration switches <strong>to</strong> a font in the current family <strong>and</strong> shape,<br />

but with the bold series attribute.<br />

\bibitem[label]{key} entry text . . . . . . (9.3.1), (9.3.4) – 217, 221<br />

Comm<strong>and</strong> <strong>to</strong> enter the text for a literature reference in the<br />

thebibliography environment. The reference word key is used<br />

in the main body of the text with citation comm<strong>and</strong>s <strong>to</strong> refer <strong>to</strong> this<br />

entry. In st<strong>and</strong>ard L AT E X, the bibliography list will be sequentially<br />

numbered, except for those entries with an optional label, in which<br />

case label replaces the number. In author–year bibliographies, the<br />

label must have a special form <strong>to</strong> transfer author <strong>and</strong> year texts <strong>to</strong><br />

the citation comm<strong>and</strong>s.<br />

\bibliography{file list} . . . . . . . . . . (9.3.2), (14.1) – 219, 309<br />

For producing a bibliography with the aid of the BIBT E X program;<br />

file list is the root name of one or more files containing the literature<br />

databases <strong>to</strong> be searched.<br />

\bibliographystyle{style} . . . . . . . . (9.3.2), (14.1) – 219, 310<br />

In conjunction with the BIBT E X program, this comm<strong>and</strong> selects the<br />

style in which the bibliography entries are <strong>to</strong> be written. Choices for<br />

style are plain, unsrt, alpha, <strong>and</strong> abbrv, or plainnat, unsrtnat,<br />

abbrvnat with natbib. Many other contributed styles also exist.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 525<br />

\bibname . . . . . . . . . . . . . . . . . . . . . . . (D.4.1) – 460<br />

Comm<strong>and</strong> containing the heading for the bibliography in book <strong>and</strong><br />

report document classes. In English, this is ‘Bibliography’ but may<br />

be altered for adaptation <strong>to</strong> other languages.<br />

\bigbr symbol [m] . . . . . . . . . . . . . . . . . . . (5.5.3) – 148<br />

A bracket symbol larger than normal, but smaller than \Big. Example:<br />

\big(.<br />

\Bigbr symbol [m] . . . . . . . . . . . . . . . . . . . (5.5.3) – 148<br />

A bracket symbol larger than \big, but smaller than \bigg. Example:<br />

\Big[.<br />

\bigcap [m] produces . . . . . . . . . . . . . . . . (5.3.7) – 128<br />

\bigcirc [m] produces ○ . . . . . . . . . . . . . . . (5.3.3) – 125<br />

\bigcup [m] produces . . . . . . . . . . . . . . . . (5.3.7) – 128<br />

\biggbr symbol [m] . . . . . . . . . . . . . . . . . . (5.5.3) – 148<br />

A bracket symbol larger than \Big, but smaller than \Bigg. Example:<br />

\bigg|.<br />

\Biggbr symbol [m] . . . . . . . . . . . . . . . . . . (5.5.3) – 148<br />

The largest bracket symbol. Example: \Bigg\langle.<br />

\bigodot [m] produces . . . . . . . . . . . . . . . (5.3.7) – 128<br />

\bigoplus [m] produces . . . . . . . . . . . . . . . (5.3.7) – 128<br />

\bigotimes [m] produces . . . . . . . . . . . . . . (5.3.7) – 128<br />

\bigtriangledown [m] produces ▽ . . . . . . . . . . . (5.3.3) – 125<br />

\bigtriangleup [m] produces △ . . . . . . . . . . . . (5.3.3) – 125<br />

\bigskip . . . . . . . . . . . . . . . . . . . . . . . . (2.7.3) – 32<br />

Inserts large vertical spacing of the amount \bigskipamount. See<br />

also \medskip <strong>and</strong> \smallskip.<br />

\bigskipamount<br />

St<strong>and</strong>ard value for the amount of vertical spacing that is inserted<br />

with the comm<strong>and</strong> \bigskip. May be changed with the \setlength<br />

comm<strong>and</strong>:<br />

\setlength{\bigskipamount}{5ex plus1.5ex minus2ex}<br />

\bigsqcup [m] produces . . . . . . . . . . . . . . . (5.3.7) – 128<br />

\biguplus [m] produces . . . . . . . . . . . . . . . (5.3.7) – 128<br />

\bigvee [m] produces . . . . . . . . . . . . . . . . (5.3.7) – 128<br />

\bigwedge [m] produces . . . . . . . . . . . . . . . (5.3.7) – 128<br />

\binom{over}{under} [m][a] . . . . . . . . . . . . . (12.2.3) – 264<br />

With the amsmath package, prints a<br />

binomial expression:<br />

n<br />

\[\binom{n}{k}\] yields .<br />

k


526 Appendix H. Comm<strong>and</strong> Summary<br />

\bmod [m] . . . . . . . . . . . . . . . . (5.3.8), (12.2.5) – 129, 268<br />

Comm<strong>and</strong> <strong>to</strong> produce the function name ‘mod’ in the form<br />

a\bmod b = a mod b<br />

\boldmath . . . . . . . . . . . . . . . . . . . . . . . (5.4.9) – 143<br />

Switches <strong>to</strong> bold face for math mode. This comm<strong>and</strong> must be given<br />

in text mode, however, before going in<strong>to</strong> math mode. To set only part<br />

of a formula in bold face, use \mbox{\boldmath$...$} <strong>to</strong> return<br />

temporarily <strong>to</strong> text mode.<br />

\boldsymbol{symbol} [m][a] . . . . . . . . . . . . . (12.2.1) – 258<br />

When one of the packages amsmath or amsbsy has been loaded, this<br />

comm<strong>and</strong> prints symbol in bold face. Unlike \mathbf, it also affects<br />

math symbols <strong>and</strong> lower case Greek letters.<br />

\bot [m] produces ⊥ . . . . . . . . . . . . . . . . . . (5.3.6) – 127<br />

\botfigrule . . . . . . . . . . . . . . . . . . . . . . . (7.3) – 173<br />

A comm<strong>and</strong> that is executed before a float at the bot<strong>to</strong>m of a page.<br />

It is normally defined <strong>to</strong> do nothing, but may be redefined <strong>to</strong> add a<br />

rule between the float <strong>and</strong> the main text. It must not add any net<br />

vertical spacing.<br />

\renewcomm<strong>and</strong>{\botfigrule}{\vspace*{-.4pt}<br />

\rule{\columnwidth}{.4pt}}<br />

\bot<strong>to</strong>mfraction . . . . . . . . . . . . . . . . . . . . (7.3) – 172<br />

Maximum fraction of a page that may be taken up by floats at the<br />

bot<strong>to</strong>m. May be set <strong>to</strong> a new value with:<br />

\renewcomm<strong>and</strong>{\bot<strong>to</strong>mfraction}{decimal frac}.<br />

bot<strong>to</strong>mnumber . . . . . . . . . . . . . . . . . . . . . . (7.3) – 171<br />

Maximum number of floats that may appear at the bot<strong>to</strong>m of a page.<br />

Set <strong>to</strong> a new number with \setcounter{bot<strong>to</strong>mnumber}{num}.<br />

\bowtie [m] produces ⋈ . . . . . . . . . . . . . . . . (5.3.4) – 126<br />

\Box [m] produces . . . . . . . . . . . . . . . . . . (5.3.3) – 125<br />

\boxed{formula} [m][a] . . . . . . . . . . . . . . . (12.2.5) – 270<br />

With the amsmath package, sets the mathematical formula in a box.<br />

\breve{x} [m] . . . . . . . . . . . . . . . . . . . . . (5.3.9) – 129<br />

Breve accent over the math variable x: \breve{a} = ă.<br />

\Breve{x} [m][a] . . . . . . . . . . . . . . . . . . . (12.2.2) – 263<br />

With the amsmath package, can be used like \breve, but with multiple<br />

A M S-L AT E X math accents the positioning will be correct.<br />

\bullet [m] produces • . . . . . . . . . . . . . . . . (5.3.3) – 125<br />

\c{x} . . . . . . . . . . . . . . . . . . . . . . . . . . (2.5.7) – 24<br />

Produces a cedilla under x: \c{C} = Ç.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 527<br />

\cap [m] produces ∩ . . . . . . . . . . . . . . . . . . (5.3.3) – 125<br />

\caption[short form]{caption text} . . . . . . . . . . . (7.4) – 173<br />

Produces a numbered title or caption with the text caption text within<br />

the float environments figure or table. The short form is the<br />

abbreviated text appearing in the list of figures or tables, which is<br />

the same as the caption text if it is omitted.<br />

\captionslanguage . . . . . . . . . . . . (D.4.1), (11.1) – 459, 255<br />

A comm<strong>and</strong> used in several language adaptations <strong>to</strong> redefine the<br />

headings of special sections such as ‘Chapter’ <strong>and</strong> ‘Contents’. It<br />

occurs in packages like german as well as in the babel system. This<br />

comm<strong>and</strong> is normally part of the definition of the \selectlanguage<br />

comm<strong>and</strong>.<br />

\cc{list} . . . . . . . . . . . . . . . . . . . . . . . . (16.1) – 353<br />

Comm<strong>and</strong> within document class letter <strong>to</strong> generate ‘cc:’, copies,<br />

followed by a list of names list at the end of the letter.<br />

\ccname . . . . . . . . . . . . . . . . . . . . . . . . (D.4.1) – 460<br />

Comm<strong>and</strong> in the letter document class containing the word <strong>to</strong> be<br />

printed by the \cc comm<strong>and</strong>. In English, this is ‘cc’ but may be<br />

altered for adaptation <strong>to</strong> other languages.<br />

\cdot [m] produces · . . . . . . . . . . . . . . . . . . (5.3.3) – 125<br />

\cdots [m] produces · · · . . . . . . . . . . . . . . . . (5.2.6) – 123<br />

\centering . . . . . . . . . . . . . . . . . . . . . . . (4.2.1) – 67<br />

Declaration <strong>to</strong> switch <strong>to</strong> centered lines of text, each input line being<br />

terminated by \\. See also \begin{center}.<br />

\centerline{text} . . . . . . . . . . . . . . . . . . . . (4.2.1) – 67<br />

An additional T E X comm<strong>and</strong> that sets text centered on a horizontal<br />

line by itself.<br />

\cfrac[pos]{over}{under} [m][a] . . . . . . . . . . (12.2.3) – 265<br />

With the amsmath package, produces a continued fraction. The optional<br />

argument pos may be l or r <strong>to</strong> have the numera<strong>to</strong>r left or right<br />

justified on the horizontal rule, otherwise it is centered.<br />

\chapter[short title]{title} . . . . . . . . . . . . . . . . (3.3.3) – 55<br />

Starts a new chapter on a new page, with an au<strong>to</strong>matic sequential<br />

chapter number <strong>and</strong> title as header. If the optional short title is given,<br />

it appears in place of title in the table of contents <strong>and</strong> in the running<br />

head at the <strong>to</strong>p of the pages.<br />

\chapter*{title} . . . . . . . . . . . . . . . . . . . . . (3.3.3) – 55<br />

Starts a new chapter on a new page, with title as header, but without a<br />

chapter number. The entry does not appear in the table of contents.


528 Appendix H. Comm<strong>and</strong> Summary<br />

\chaptername . . . . . . . . . . . . . . . . . . . . . (D.4.1) – 460<br />

Comm<strong>and</strong> containing the chapter heading. In English, this is ‘Chapter’<br />

but may be altered for adaptation <strong>to</strong> other languages.<br />

\check{x} [m] . . . . . . . . . . . . . . . . . . . . . (5.3.9) – 129<br />

Háček accent over the math variable x: \check{a} = ǎ.<br />

\Check{x} [m][a] . . . . . . . . . . . . . . . . . . . (12.2.2) – 263<br />

With the amsmath package, can be used like \check, but with multiple<br />

A M S-L AT E X math accents the positioning will be correct.<br />

\CheckComm<strong>and</strong>{\com name}[narg][opt]{def } . . . . . (D.2.5) – 445<br />

Tests that the current definition of \com name is as expected. If not,<br />

an error message is issued. This is used <strong>to</strong> ensure that important<br />

comm<strong>and</strong>s have not been altered by other packages.<br />

\chi [m] produces χ . . . . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\circ [m] produces ◦ . . . . . . . . . . . . . . . . . . (5.3.3) – 125<br />

\circle{diameter} . . . . . . . . . . . . . . . . . (13.1.4) – 295<br />

Picture element comm<strong>and</strong> <strong>to</strong> produce a circle with diameter diameter<br />

in the picture environment. To be used as an argument in a \put<br />

or \multiput comm<strong>and</strong>.<br />

\circle*{diameter} . . . . . . . . . . . . . . . . . (13.1.4) – 295<br />

Like \circle but produces a solid circle, filled in black.<br />

\cite[note]{key} . . . . . . . . . . . . . (9.3.3), (14.1) – 219, 310<br />

Literature citation using the identifier key <strong>to</strong> produce a reference<br />

label in the text. The optional note text is included with the label.<br />

\citep[pre-note][post-note]{key} . . . . . . . . . . . (9.3.4) – 221<br />

With the natbib package, inserts a parenthetical literature citation<br />

as ‘[Jones et al., 1999]’, using the identifier key. The optional note<br />

texts are included within the parentheses, before <strong>and</strong> after; if only<br />

one is present, it is a post-note. In numerical citation mode, the<br />

citation number is printed as ‘[21]’, just as with the st<strong>and</strong>ard \cite<br />

comm<strong>and</strong>. Multiple keys may be given.<br />

\citet{key} . . . . . . . . . . . . . . . . . . . . . . (9.3.4) – 221<br />

With the natbib package, inserts an in-text literature citation as<br />

‘Jones et al. [1999]’, using the identifier key. In numerical citation<br />

mode, it prints the author’s name before the citation number, as<br />

‘Jones et al. [21]’.<br />

\ClassError{class name}{error text}{help} [p] . . . . . (D.2.7) – 446<br />

Writes an error message error text <strong>to</strong> the moni<strong>to</strong>r <strong>and</strong> transcript file,<br />

labeled with the class name, <strong>and</strong> halts processing, waiting for a user<br />

response as for a L AT E X error. If H〈return〉 is typed, the help text is<br />

printed. Both error text <strong>and</strong> help may contain \MessageBreak for a<br />

new line, \space for a forced space, <strong>and</strong> \protect before comm<strong>and</strong>s<br />

that are <strong>to</strong> have their names printed literally <strong>and</strong> not interpreted.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 529<br />

\ClassInfo{class name}{info text} [p] . . . . . . . . . (D.2.7) – 447<br />

Is like \ClassWarningNoLine except that the text info text is only<br />

written <strong>to</strong> the transcript file, <strong>and</strong> not <strong>to</strong> the moni<strong>to</strong>r.<br />

\ClassWarning{class name}{warning text} [p] . . . . . (D.2.7) – 446<br />

Writes warning text <strong>to</strong> the moni<strong>to</strong>r <strong>and</strong> transcript file, labeled with<br />

the class name <strong>and</strong> the current line number of the input file. Processing<br />

continues. The warning text is formatted in the same way as<br />

that for \ClassError.<br />

\ClassWarningNoLine{class name}{warning text} [p] . . (D.2.7) – 446<br />

Is like \ClassWarning except that the current line number of the<br />

input file is not printed.<br />

\cleardoublepage . . . . . . . . . . . . . . . . . . . . (2.7.4) – 34<br />

Ends the current page <strong>and</strong> outputs all unprocessed floats on <strong>to</strong> one<br />

or more float pages. The next page will be a right-h<strong>and</strong> one, with an<br />

odd page number.<br />

\clearpage . . . . . . . . . . . . . . . . . . . . . . . (2.7.4) – 33<br />

Ends the current page <strong>and</strong> outputs all unprocessed floats on <strong>to</strong> one<br />

or more float pages.<br />

\cline{n-m} . . . . . . . . . . . . . . . . . . . . . . (4.8.1) – 97<br />

In tabular environment, produces a horizontal rule from the beginning<br />

of column n <strong>to</strong> the end of column m. Example: \cline{2-5}.<br />

\closing{regards} . . . . . . . . . . . . . . . . . . . (16.1) – 353<br />

End of the text in the letter environment; regards st<strong>and</strong>s for the<br />

desired terminating text.<br />

\clubsuit [m] produces ♣ . . . . . . . . . . . . . . . (5.3.6) – 127<br />

\color col spec . . . . . . . . . . . . . . . . . . . . . . (6.2) – 167<br />

A comm<strong>and</strong> made available with the color package. It is a declaration<br />

that switches the color in which the text is printed <strong>to</strong> that specified.<br />

It remains in effect until the end of the current environment or until<br />

counterm<strong>and</strong>ed by another \color comm<strong>and</strong>. The col spec is either<br />

the name of a color defined (or predefined) by \definecolor or<br />

of the form [model]{specs}, where the arguments have the same<br />

meaning as they do for \definecolor. Examples:<br />

\color[rgb]{0.5,0.5,0} \color{magenta}<br />

\colorbox col spec{text} . . . . . . . . . . . . . . . . . (6.2) – 167<br />

A comm<strong>and</strong> made available with the color package. The text is set<br />

in an LR box with the specified color as the background color. The<br />

col spec is the same as for \color.


530 Appendix H. Comm<strong>and</strong> Summary<br />

\columnsep . . . . . . . . . . . . . . . . . . . . . . . (3.1.1) – 40<br />

Declaration for the amount of intercolumn spacing in two-column<br />

page formatting. May be changed with the \setlength comm<strong>and</strong>:<br />

\setlength{\columnsep}{1pt}<br />

\columnseprule . . . . . . . . . . . . . . . . . . . . . (3.1.1) – 40<br />

Declaration for the thickness of the vertical rule separating the<br />

columns in two-column page formatting. Value is set with the<br />

\setlength comm<strong>and</strong>:<br />

\setlength{\columnseprule}{1pt}<br />

\cong [m] produces ≅ . . . . . . . . . . . . . . . . . (5.3.4) – 126<br />

\contentsline{sec type}{\numberline{sec num}title text}{page}<br />

Comm<strong>and</strong> that appears in the .<strong>to</strong>c file for every entry in the table<br />

of contents, which is read when the \tableofcontents comm<strong>and</strong><br />

is given. Such comm<strong>and</strong>s may be altered or added <strong>to</strong> the.<strong>to</strong>c file by<br />

means of the text edi<strong>to</strong>r. The entry sec type st<strong>and</strong>s for the sectioning<br />

level, such as section, while sec num is its number (for example,<br />

2.3) <strong>and</strong> page is the page number where the entry appears.<br />

\contentsname . . . . . . . . . . . . . . . . . . . . (D.4.1) – 459<br />

Comm<strong>and</strong> containing the heading for the table of contents. In English,<br />

this is ‘Contents’ but may be altered for adaptation <strong>to</strong> other<br />

languages.<br />

\coprod [m] produces . . . . . . . . . . . . . . . . (5.3.7) – 128<br />

\copyright produces © . . . . . . . . . . . . . . . . . (2.5.5) – 23<br />

\cos [m] . . . . . . . . . . . . . . . . . . . . . . . . (5.3.8) – 128<br />

Comm<strong>and</strong> <strong>to</strong> produce the function name ‘cos’ in formulas.<br />

\cosh [m] . . . . . . . . . . . . . . . . . . . . . . . (5.3.8) – 128<br />

Comm<strong>and</strong> <strong>to</strong> produce the function name ‘cosh’ in formulas.<br />

\cot [m] . . . . . . . . . . . . . . . . . . . . . . . . (5.3.8) – 128<br />

Comm<strong>and</strong> <strong>to</strong> produce the function name ‘cot’ in formulas.<br />

\coth [m] . . . . . . . . . . . . . . . . . . . . . . . (5.3.8) – 128<br />

Comm<strong>and</strong> <strong>to</strong> produce the function name ‘coth’ in formulas.<br />

\csc [m] . . . . . . . . . . . . . . . . . . . . . . . . (5.3.8) – 128<br />

Comm<strong>and</strong> <strong>to</strong> produce the function name ‘csc’ in formulas.<br />

\cup [m] produces ∪ . . . . . . . . . . . . . . . . . . (5.3.3) – 125<br />

\CurrentOption [p] . . . . . . . . . . . . . . . . . . (D.2.3) – 443<br />

A comm<strong>and</strong> that may only be used in the definition of options,<br />

especially for default options. It contains the name of the option<br />

being processed.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 531<br />

\d{x} . . . . . . . . . . . . . . . . . . . . . . . . . . (2.5.7) – 24<br />

Produces a ‘dot under’ accent: \d{o} = o . .<br />

\dag produces † . . . . . . . . . . . . . . . . . . . . . . (2.5.5) – 23<br />

\dagger [m] produces † . . . . . . . . . . . . . . . . (5.3.3) – 125<br />

\dashbox{dash}(x dimen,y dimen)[pos]{text} . . . (13.1.4) – 291<br />

Picture element comm<strong>and</strong> <strong>to</strong> produce a dashed frame with width<br />

x dimen <strong>and</strong> height y dimen, using a dash length of dash in the<br />

picture environment. Without the optional pos, the contents text<br />

are centered within the frame, otherwise they are positioned at the<br />

left (l), right (r), <strong>to</strong>p (t), or bot<strong>to</strong>m (b), or a combination thereof, such<br />

as lt. This comm<strong>and</strong> is used as an argument in a \put or \multiput<br />

comm<strong>and</strong>.<br />

\dashv [m] produces ⊣ . . . . . . . . . . . . . . . . . (5.3.6) – 127<br />

\date{date text} . . . . . . . . . . . . . . . (3.3.1), (16.1) – 52, 353<br />

1. The comm<strong>and</strong> \maketitle normally prints the current date on<br />

the title page. The declaration \date will replace the date with<br />

whatever text is given in date text.<br />

2. Prints the text date text instead of the au<strong>to</strong>matic current date<br />

in a letter.<br />

\datelanguage . . . . . . . . . . . . . . . . . . . . . (11.1) – 255<br />

A comm<strong>and</strong> used in several language adaptations <strong>to</strong> redefine the<br />

\<strong>to</strong>day comm<strong>and</strong> according <strong>to</strong> the requirements of language. It occurs<br />

in german package as well as in the babel system. It may also be<br />

used for ‘dialects’, such a \dateUSenglish <strong>and</strong> \dateenglish. This<br />

comm<strong>and</strong> is normally part of the definition of the \selectlanguage<br />

comm<strong>and</strong>.<br />

\dblfigrule . . . . . . . . . . . . . . . . . . . . . . . (7.3) – 173<br />

A comm<strong>and</strong> that is executed after a two-column float at the <strong>to</strong>p of a<br />

page. It is normally defined <strong>to</strong> do nothing, but may be redefined <strong>to</strong><br />

add a rule between the float <strong>and</strong> the main text. It must not add any<br />

net vertical spacing.<br />

\renewcomm<strong>and</strong>{\dblfigrule}{\vspace*{-.4pt}<br />

\rule{\textwidth}{.4pt}}<br />

\dblfloatpagefraction . . . . . . . . . . . . . . . . . (7.3) – 172<br />

For two-column page formatting, the fraction of a float page that<br />

must be filled with floats before a new page is called. A new value is<br />

assigned with<br />

\renewcomm<strong>and</strong>{\dblfloatpagefraction}{decimal frac}<br />

\dbinom{over}{under} [m][a] . . . . . . . . . . . . (12.2.3) – 264<br />

With the amsmath package, produces a binomial as \binom does, but<br />

in \displaystyle size.


532 Appendix H. Comm<strong>and</strong> Summary<br />

\dblfloatsep . . . . . . . . . . . . . . . . . . . . . . (7.3) – 172<br />

For two-column page formatting, the vertical spacing between floats<br />

that extend over both columns. A new value is set with the<br />

\setlength comm<strong>and</strong>:<br />

\setlength{\dblfloatsep}{12pt plus 2pt minus 4pt}<br />

\dbltextfloatsep . . . . . . . . . . . . . . . . . . . . (7.3) – 172<br />

For two-column page formatting, the vertical spacing between floats<br />

extending over both columns at the <strong>to</strong>p of the page <strong>and</strong> the following<br />

text. A new value is set with the \setlength comm<strong>and</strong>.<br />

\dbl<strong>to</strong>pfraction . . . . . . . . . . . . . . . . . . . . (7.3) – 172<br />

For two-column page formatting, the maximum fraction of a page that<br />

may be occupied at the <strong>to</strong>p by floats extending over both columns.<br />

A new value is assigned with<br />

\renewcomm<strong>and</strong>{\dbl<strong>to</strong>pfraction}{decimal frac}.<br />

dbl<strong>to</strong>pnumber . . . . . . . . . . . . . . . . . . . . . . (7.3) – 172<br />

For two-column page formatting, the maximum number of floats that<br />

may appear at the <strong>to</strong>p of a page extending over both columns. A new<br />

value is assigned with<br />

\setcounter{dbl<strong>to</strong>pnumber}{num}.<br />

\ddag produces ‡ . . . . . . . . . . . . . . . . . . . . . (2.5.5) – 23<br />

\ddagger [m] produces ‡ . . . . . . . . . . . . . . . . (5.3.3) – 125<br />

\dddot{x} [m][a] . . . . . . . . . . . . . . . . . . . (12.2.2) – 263<br />

With the amsmath package, a triple dot accent in math formulas:<br />

\dddot{a} = ...<br />

a.<br />

\ddddot{x} [m][a] . . . . . . . . . . . . . . . . . . (12.2.2) – 263<br />

With the amsmath package, a four-dot accent in math formulas:<br />

\ddddot{a} = ....<br />

a .<br />

\ddot{x} [m] . . . . . . . . . . . . . . . . . . . . . . (5.3.9) – 129<br />

A double dot accent in mathematical formulas: \ddot{a} = ä.<br />

\Ddot{x} [m][a] . . . . . . . . . . . . . . . . . . . (12.2.2) – 263<br />

With the amsmath package, can be used like \ddot, but with multiple<br />

A M S-L AT E X math accents the positioning will be correct.<br />

\ddots [m] produces . . . . . . . . . . . . . . . . . . . (5.2.6) – 123<br />

\DeclareErrorFont{code}{fam}{ser}{shp}{sz} [p] . . (A.3.6) – 376<br />

If no valid font can be found, even after substituting the attributes<br />

as given by \DeclareFontSubstitution, the font declared with this<br />

comm<strong>and</strong> is selected as a last resort.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 533<br />

\DeclareFixedFont{\cmd}{code}{fam}{ser}{shp}{sz} [p]<br />

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . (A.3.2) – 373<br />

Defines \cmd <strong>to</strong> be a font declaration that selects a font with the<br />

fixed attributes given in the definition.<br />

\DeclareFontEncoding{code}{text set}{math set} [p] . (A.3.6) – 376<br />

Declares code <strong>to</strong> be the name of a new encoding scheme; text set is a<br />

set of comm<strong>and</strong>s that is <strong>to</strong> be executed when switching <strong>to</strong> text mode,<br />

math set a set for math mode.<br />

\DeclareFontEncodingDefaults{text set}{math set} [p] (A.3.6) – 376<br />

Declares the sets of comm<strong>and</strong>s <strong>to</strong> be executed by all encodings when<br />

switching <strong>to</strong> text <strong>and</strong> math modes; the additional comm<strong>and</strong>s specific<br />

<strong>to</strong> each encoding are executed afterwards.<br />

\DeclareFontFamily{code}{fam}{opt} [p] . . . . . . (A.3.6) – 376<br />

Declares fam <strong>to</strong> be a new font family with the encoding code; the<br />

encoding must previously have been declared. The comm<strong>and</strong>s in opt<br />

are executed every time this family is selected.<br />

\DeclareFontShape{code}{fam}{ser}{shp}{def }{opt} [p]<br />

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . (A.3.6) – 377<br />

Associates external font names with the given font attribute values;<br />

the actual definition def relates font sizes <strong>to</strong> font names, as explained<br />

on page 377. The comm<strong>and</strong>s in opt are executed every time this shape<br />

is selected.<br />

\DeclareFontSubstitution{code}{fam}{ser}{shp} [p] (A.3.6) – 376<br />

Declares the font attributes that are <strong>to</strong> be substituted in case there<br />

is no valid font corresponding <strong>to</strong> the set of attributes selected. The<br />

order of substitution is shape, series, <strong>and</strong> family; the encoding is<br />

never substituted.<br />

\DeclareGraphicsExtensions{ext list} [p] . . . . . . . (6.1.7) – 165<br />

Establishes the list of default extensions for graphics files that can be<br />

imported with the \includegraphics comm<strong>and</strong> <strong>and</strong> the graphics<br />

or graphicx packages; ext list is a comma-separated list of file extensions,<br />

such as .eps,.ps.<br />

\DeclareGraphicsRule{ext}{type}{bb}{cmd} [p] . . . (6.1.7) – 165<br />

Associates a graphics file extension ext with a graphics file type <strong>and</strong> a<br />

file extension (bb) where the bounding box information is <strong>to</strong> be read,<br />

<strong>and</strong> an operating comm<strong>and</strong> (cmd) that is <strong>to</strong> be executed on the file<br />

<strong>to</strong> make it available for importation. For example<br />

\DeclareGraphicsRule{.eps.gz}{eps}<br />

{.eps.bb}{‘gunzip -c #1}<br />

Here the comm<strong>and</strong> must be prefixed with ‘ <strong>and</strong> #1 represents the<br />

name of the file <strong>to</strong> be processed.


534 Appendix H. Comm<strong>and</strong> Summary<br />

\DeclareMathAccent{\cmd}{type}{sym fnt}{pos} [p] . (A.3.4) – 375<br />

Declares \cmd <strong>to</strong> be a math accent comm<strong>and</strong>, printed with the character<br />

in position pos of the symbol font with the internal name<br />

sym fnt. The type is either \mathord or \mathalpha; in the latter<br />

case the symbol changes with math alphabet.<br />

\DeclareMathAlphabet{\cmd}{code}{fam}{ser}{shp} [p]<br />

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . (A.3.3) – 373<br />

Defines \cmd <strong>to</strong> be a math alphabet for setting letters in math mode;<br />

the font selected in all math versions is that with the specified font attributes.<br />

If a different font is <strong>to</strong> be invoked for certain math versions,<br />

they are defined individually with \SetMathAlphabet afterwards.<br />

However, if the shape attribute is left empty, the alphabet comm<strong>and</strong><br />

is indeed created, but remains undefined in all versions, requiring an<br />

explicit \SetMathAlphabet declaration for each one.<br />

\DeclareMathDelimiter{\cmd}{type}{sym fnt1}{pos1}<br />

{sym fnt2}{pos2} [p] . . . . . . . . . . . . . . (A.3.4) – 375<br />

Declares \cmd <strong>to</strong> be a math delimiter in two sizes: the smaller<br />

variant is the character in position pos1 of the symbol font with the<br />

internal name sym fnt1, while the larger is from position pos2 of font<br />

sym fnt2.<br />

\DeclareMathOpera<strong>to</strong>r{\cmd}{name} [p][a] . . . . . (12.2.5) – 268<br />

With the amsopn or amsmath packages, defines \cmd <strong>to</strong> be a math<br />

mode comm<strong>and</strong> <strong>to</strong> print the text name as a function name in an<br />

upright font with appropriate spacing. With the *-form, the raising<br />

<strong>and</strong> lowering opera<strong>to</strong>rs ˆ <strong>and</strong> _ produce limits, above or below the<br />

name.<br />

\DeclareMathRadical{\cmd}{sym fnt1}{pos1}<br />

{sym fnt2}{pos2} [p] . . . . . . . . . . . . . . (A.3.4) – 375<br />

Declares \cmd <strong>to</strong> be a math radical symbol: the smaller variant is the<br />

character in position pos1 of the symbol font with the internal name<br />

sym fnt1, while the larger is from position pos2 of font sym fnt2.<br />

\DeclareMathSizes{text}{math text}{script}{sscript} [p] (A.3.4) – 375<br />

Sets the point sizes for the three math styles \textstyle,<br />

\scriptstyle, <strong>and</strong> \scriptscriptstyle when the text is being<br />

printed in point size text. The unit pt is not included.<br />

\DeclareMathSymbol{\symbol}{type}{sym fnt}{pos} [p] (A.3.4) – 375<br />

Declares \symbol <strong>to</strong> be a comm<strong>and</strong> that prints the character in position<br />

pos with the symbol font with the internal name sym fnt. This<br />

same symbol is printed in all math alphabets, but may be different<br />

for other math versions if the symbol font has been \Set... <strong>to</strong> have<br />

different attributes in that math version.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 535<br />

\DeclareMathVersion{ver} [p] . . . . . . . . . . . . (A.3.3) – 374<br />

Declares ver <strong>to</strong> be a new math version for math alphabets <strong>and</strong><br />

symbol fonts. Initially, the version will use those fonts defined<br />

by \Declare... comm<strong>and</strong>s, which may be redefined for this math<br />

version with appropriate \Set... comm<strong>and</strong>s.<br />

\DeclareOldFontComm<strong>and</strong>{\cmd}{text specs}{math specs} [p]<br />

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . (A.3.2) – 373<br />

Defines \cmd <strong>to</strong> be a font declaration that invokes text specs in text<br />

mode, <strong>and</strong> math specs in math mode. The new comm<strong>and</strong> behaves in<br />

math mode as a 2.09 font declaration, although math specs must be<br />

a math font comm<strong>and</strong> without its argument. It is meant <strong>to</strong> define<br />

comm<strong>and</strong>s <strong>to</strong> be compatible with L AT E X 2.09 <strong>and</strong> should generally be<br />

avoided.<br />

\DeclareOption{option}{code} [p] . . . . . . . . . . . (D.2.3) – 442<br />

In a class or package file, this comm<strong>and</strong> defines the set of comm<strong>and</strong>s<br />

(code) that is <strong>to</strong> be associated with the given option. These comm<strong>and</strong>s<br />

are executed when \ExecuteOptions or \ProcessOptions is called.<br />

After the latter, all definitions are erased, <strong>to</strong> save memory. The code<br />

is internally s<strong>to</strong>red in a comm<strong>and</strong> named \ds@option.<br />

\DeclareOption*{code} [p] . . . . . . . . . . . . . . . (D.2.3) – 442<br />

In a class or package file, this comm<strong>and</strong> defines the default set of<br />

comm<strong>and</strong>s that is associated with every undefined option. Special<br />

comm<strong>and</strong>s that may be used within code are \CurrentOption (the<br />

name of the option) <strong>and</strong> \OptionNotUsed. Example:<br />

\DeclareOption*{\InputIfFileExists<br />

{\CurrentOption.sty}{}{\OptionNotUsed}}<br />

\DeclareRobustComm<strong>and</strong>{\cmd}[narg][opt]{def } . . . (D.2.5) – 445<br />

Defines or redefines the comm<strong>and</strong> \cmd in the same way as<br />

\newcomm<strong>and</strong> except that the result is robust: it may be used in<br />

the argument of another comm<strong>and</strong> without a \protect comm<strong>and</strong><br />

before it.<br />

\DeclareRobustComm<strong>and</strong>*{\cmd}[narg][opt]{def } . . (D.2.6) – 445<br />

The same as \DeclareRobustComm<strong>and</strong> except that the arguments <strong>to</strong><br />

\cmd must be ‘short’, not containing any new paragraphs.<br />

\DeclareSymbolFont{sym fnt}{code}{fam}{ser}{shp} [p]<br />

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . (A.3.4) – 374<br />

Declares the math font with the given attributes <strong>to</strong> be a symbol font<br />

that may be addressed by other comm<strong>and</strong>s with the name sym fnt.<br />

The symbol font applies <strong>to</strong> all math versions unless redefined with a<br />

\SetSymbolFont comm<strong>and</strong>.


536 Appendix H. Comm<strong>and</strong> Summary<br />

\DeclareSymbolFontAlphabet{\cmd}{sym fnt} [p] . . (A.3.4) – 375<br />

Defines \cmd <strong>to</strong> be a math alphabet that uses the font declared with<br />

a \DeclareSymbolFont comm<strong>and</strong> <strong>to</strong> have the internal name sym fnt.<br />

This is preferred over \DeclareMathAlphabet if there is a defined<br />

symbol font with the necessary attributes for the math alphabet.<br />

\DeclareTextAccent{\cmd}{code}{pos} [p] . . . . . . (A.3.7) – 379<br />

Defines \cmd <strong>to</strong> be an accent comm<strong>and</strong> when encoding code is active;<br />

it uses the symbol in font position pos as the accent.<br />

\DeclareTextAccentDefault{\cmd}{code} [p] . . . . (A.3.7) – 380<br />

Declares the default encoding that is <strong>to</strong> be taken if the accent comm<strong>and</strong><br />

\cmd is called in an encoding for which it is not explicitly<br />

defined.<br />

\DeclareTextComm<strong>and</strong>{\cmd}{code}[narg][opt]{def } [p]<br />

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . (A.3.7) – 379<br />

Defines \cmd in the same way as \newcomm<strong>and</strong> except the definition<br />

is only valid when encoding code is active.<br />

\DeclareTextComm<strong>and</strong>Default{\cmd}[narg][opt]{def } [p]<br />

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . (A.3.7) – 380<br />

Creates a default definition for the comm<strong>and</strong> \cmd for all encodings<br />

for which it is not explicitly defined.<br />

\DeclareTextComposite{\cmd}{code}{let}{pos} [p] . (A.3.7) – 379<br />

Defines \cmd followed by the letter let <strong>to</strong> be the single character in<br />

font position pos when encoding code is active. It thus defines the<br />

action of accent comm<strong>and</strong>s in T1 encoding when the accented letter<br />

exists as a separate symbol. For example:<br />

\DeclareTextComposite{\’}{T1}{e}{233}<br />

The comm<strong>and</strong> must already have been defined for the encoding<br />

with either \DeclareTextAccent or \DeclareTextComm<strong>and</strong> (with<br />

one argument).<br />

\DeclareTextCompositeComm<strong>and</strong>{\cmd}{code}{let}{def } [p]<br />

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . (A.3.7) – 379<br />

Is the same as \DeclareTextComposite except that any definition<br />

may be assigned <strong>to</strong> the comm<strong>and</strong>/letter combination, <strong>and</strong> not just a<br />

single symbol.<br />

\DeclareTextFontComm<strong>and</strong>{\cmd}{font specs} [p] . . . (A.3.2) – 373<br />

Defines \cmd <strong>to</strong> be a text font comm<strong>and</strong> that sets its argument with<br />

the font spec specifications. Example:<br />

\DeclareTextFontComm<strong>and</strong>{\textbf}{\bfseries}<br />

\DeclareTextSymbol{\cmd}{code}{pos} [p] . . . . . . (A.3.7) – 379<br />

Defines \cmd <strong>to</strong> print the symbol in font position pos when encoding<br />

code is active.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 537<br />

\DeclareTextSymbolDefault{\cmd}{code} [p] . . . . (A.3.7) – 380<br />

Declares the default encoding that is <strong>to</strong> be taken if the symbol comm<strong>and</strong><br />

\cmd is called in an encoding for which it is not explicitly<br />

defined.<br />

\definecolor{name}{model}{specs} . . . . . . . . . . (6.2) – 167<br />

A comm<strong>and</strong> made available with the color package. It associates<br />

the name of a color (name) with the specifications specs according<br />

<strong>to</strong> a certain model. Possible values for model are rgb (red, green,<br />

blue), cmyk (cyan, magenta, yellow, black), gray, <strong>and</strong> named. In each<br />

case, specs is a comma-separated list of numbers between 0 <strong>and</strong> 1<br />

specifying the strength of the relevant component. In the case of the<br />

named model, specs is an internal name for the color that is known<br />

by the driver program. Examples:<br />

\definecolor{litegrn}{cmyk}{0.25,0,0.75.0}<br />

\definecolor{brown}{named}{RawSienna}<br />

A number of colors are predefined in all color drivers: red, green,<br />

blue, yellow, cyan, magenta, black, <strong>and</strong> white.<br />

\deg [m] . . . . . . . . . . . . . . . . . . . . . . . . (5.3.8) – 128<br />

Comm<strong>and</strong> <strong>to</strong> produce the function name ‘deg’ in formulas.<br />

\DeleteShortVerb{\c} . . . . . . . . . . . . (4.9.1, B.5.3) – 111, 393<br />

When the st<strong>and</strong>ard package shortvrb has been loaded, this comm<strong>and</strong><br />

counteracts the effects of a previous \MakeShortVerb{\c},<br />

allowing the character c <strong>to</strong> have its original meaning once more.<br />

\Delta [m] produces ∆ . . . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\delta [m] produces δ . . . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\depth . . . . . . . . . . . . . . . . . . . . . . . . . . (4.7.1) – 86<br />

A length parameter equal <strong>to</strong> the depth of a box (baseline <strong>to</strong> bot<strong>to</strong>m); it<br />

may only be used in the width specification of \makebox, \framebox,<br />

or \savebox, or in the height specification of a \parbox or minipage<br />

environment.<br />

\framebox[20\depth]{text}<br />

\det [m] . . . . . . . . . . . . . . . . . . . . . . . . (5.3.8) – 128<br />

Comm<strong>and</strong> <strong>to</strong> produce the function name ‘det’ in formulas. Can be<br />

combined with a lower limit by means of the subscript comm<strong>and</strong>.<br />

\dfrac{numera<strong>to</strong>r}{denomina<strong>to</strong>r} [m][a] . . . . . . . (12.2.3) – 264<br />

With the amsmath package, produces a fraction as \frac does, but<br />

in \displaystyle size.<br />

\DH . . . . . . . . . . . . . . . . . . . . . . . . . . (G.4.5) – 503<br />

When T1 encoding is active, prints the character Ð.


538 Appendix H. Comm<strong>and</strong> Summary<br />

\dh . . . . . . . . . . . . . . . . . . . . . . . . . . (G.4.5) – 503<br />

When T1 encoding is active, prints the character ð.<br />

\Diamond [m] produces ♦ . . . . . . . . . . . . . . . (5.3.3) – 125<br />

\diamond [m] produces ⋄ . . . . . . . . . . . . . . . . (5.3.3) – 125<br />

\diamondsuit [m] produces ♦ . . . . . . . . . . . . . (5.3.6) – 127<br />

\dim [m] . . . . . . . . . . . . . . . . . . . . . . . . (5.3.8) – 128<br />

Comm<strong>and</strong> <strong>to</strong> produce the function name ‘dim’ in formulas.<br />

\discretionary{before}{after}{without} . . . . . . . . (2.8.1) – 35<br />

Hyphenation suggestion within a word. The word may be divided<br />

such that before is at the end of one line, <strong>and</strong> after at the start of the<br />

next line. If no division occurs, without is printed.<br />

\displaybreak[num] [m][a] . . . . . . . . . . . . . (12.2.7) – 278<br />

With the amsmath package, allows a manual page break in a multiline<br />

math formula when given just before \\; if num is present, it takes<br />

on values of 0–4 with increasing encouragement for a break, where 4<br />

is the same as no value, a forced page break. Au<strong>to</strong>matic page breaks<br />

are impossible in multiline formulas unless \allowdisplaybreaks<br />

has been issued in the preamble.<br />

\displaystyle [m] . . . . . . . . . . . . . . . . . . (5.5.2) – 146<br />

Switches <strong>to</strong> font size \displaystyle as the active font within a math<br />

formula.<br />

\div [m] produces ÷ . . . . . . . . . . . . . . . . . . (5.3.3) – 125<br />

\DJ . . . . . . . . . . . . . . . . . . . . . . . . . . (G.4.5) – 503<br />

When T1 encoding is active, prints the character Ð.<br />

\dj . . . . . . . . . . . . . . . . . . . . . . . . . . (G.4.5) – 503<br />

When T1 encoding is active, prints the character đ.<br />

\documentclass[options]{class}[version] [p] . . . . . . (3.1) – 37<br />

Normally the first comm<strong>and</strong> in a L AT E X document, determining the<br />

overall characteristics. St<strong>and</strong>ard values for class are:<br />

article, report, book, letter, <strong>and</strong> slides<br />

of which only one may be selected. In addition, various options may<br />

be chosen, their names separated by commas. Possibilities are:<br />

10pt, 11pt, 12pt,<br />

letterpaper, legalpaper, executivepaper,<br />

a4paper, a5paper, b5paper, l<strong>and</strong>scape,<br />

onecolumn, twocolumn,<br />

oneside, twoside,<br />

notitlepage, titlepage,<br />

leqno, fleqn, openbib,<br />

draft, final


H.1. Brief description of the L AT E X comm<strong>and</strong>s 539<br />

These <strong>and</strong> any additional options are all global, meaning that they<br />

also apply <strong>to</strong> any packages specified with a following \usepackage<br />

comm<strong>and</strong>.<br />

The optional version is a date, given in the form yyyy/mm/dd, as for<br />

example 1994/08/01. If the date of the class file read in is earlier<br />

than this, a warning message is printed.<br />

\doublebox{text} . . . . . . . . . . . . . . . . . . . . (4.7.9) – 94<br />

With the fancybox package, is a variant of \fbox, drawing a doubled<br />

box around text; the thicknesses <strong>and</strong> separation of the lines depend<br />

on the length \fboxrule.<br />

\dot{x} [m] . . . . . . . . . . . . . . . . . . . . . . (5.3.9) – 129<br />

A dot accent in mathematical formulas: \dot{a} = ˙a.<br />

\Dot{x} [m][a] . . . . . . . . . . . . . . . . . . . . (12.2.2) – 263<br />

With the amsmath package, can be used like \dot, but with multiple<br />

A M S-L AT E X math accents the positioning will be correct.<br />

\doteq [m] produces . = . . . . . . . . . . . . . . . . . (5.3.4) – 126<br />

\dotfill . . . . . . . . . . . . . . . . . . . . . . . . (2.7.1) – 30<br />

Fills up the space in a line with a dotted leader: . . . . . . . = \dotfill.<br />

\dots produces . . . . . . . . . . . . . . . . . . . . . . (5.2.6) – 123<br />

\dots [m][a] . . . . . . . . . . . . . . . . . . . . . (12.2.2) – 264<br />

With the amsmath package, places continuation dots in math mode<br />

au<strong>to</strong>matically at a height determined by the following symbol.<br />

\dotsb [m][a] produces dots for binary opera<strong>to</strong>r: · · · . (12.2.2) – 264<br />

\dotsc [m][a] produces dots for commas: . . . . . . . . (12.2.2) – 264<br />

\dotsi [m][a] produces dots for integral signs: · · · . . (12.2.2) – 264<br />

\dotsm [m][a] produces dots for multiplication: · · · . . (12.2.2) – 264<br />

\doublerulesep . . . . . . . . . . . . . . . . . . . . . (4.8.2) – 98<br />

The distance between double rules inside the tabular <strong>and</strong> array<br />

environments. New value assigned with \setlength outside of the<br />

environment.<br />

\Downarrow [m] produces ⇓ . . . . . . . . . . . . . . (5.3.5) – 127<br />

\downarrow [m] produces ↓ . . . . . . . . . . . . . . . (5.3.5) – 127<br />

\ell [m] produces ℓ . . . . . . . . . . . . . . . . . . (5.3.6) – 127<br />

\em . . . . . . . . . . . . . . . . . . . . . . . . . . . (4.1.1) – 62<br />

This declaration switches <strong>to</strong> an emphatic font, one that has the<br />

current family <strong>and</strong> series, but with a different shape attribute. It<br />

normally <strong>to</strong>ggles between an upright <strong>and</strong> an italic shape.


540 Appendix H. Comm<strong>and</strong> Summary<br />

\emph{text} . . . . . . . . . . . . . . . . . . . . . . . (4.1.1) – 62<br />

This comm<strong>and</strong> sets its argument in an emphatic font, one that has<br />

the current family <strong>and</strong> series, but with a different shape attribute. It<br />

normally <strong>to</strong>ggles between an upright <strong>and</strong> an italic shape.<br />

\emptyset [m] produces ∅ . . . . . . . . . . . . . . . (5.3.6) – 127<br />

\encl{enclosures} . . . . . . . . . . . . . . . . . . . (16.1) – 353<br />

Comm<strong>and</strong> in the document class letter <strong>to</strong> add the word ‘encl:’ with<br />

the list enclosures at the end of a letter. For International L AT E X, the<br />

actual word printed is contained in the comm<strong>and</strong> \enclname.<br />

\enclname . . . . . . . . . . . . . . . . . . . . . . . (D.4.1) – 460<br />

Comm<strong>and</strong> in the letter document class containing the word <strong>to</strong> be<br />

printed by the \encl comm<strong>and</strong>. In English, this is ‘encl’ but may be<br />

altered for adaptation <strong>to</strong> other languages.<br />

\end{environment} . . . . . . . . . . . . . . . . . . . (2.2) – 19<br />

Comm<strong>and</strong> <strong>to</strong> terminate an environment started with a comm<strong>and</strong><br />

\begin{environment}.<br />

\endfirsthead . . . . . . . . . . . . . . . . . . . . (4.8.4) – 108<br />

Within the longtable environment of the longtable package, this<br />

comm<strong>and</strong> ends those specifications that are <strong>to</strong> be added <strong>to</strong> the <strong>to</strong>p<br />

of the table (the head) on the first page only.<br />

\endfoot . . . . . . . . . . . . . . . . . . . . . . . (4.8.4) – 108<br />

Within the longtable environment of the longtable package, this<br />

comm<strong>and</strong> ends those specifications that are <strong>to</strong> be added at the bot<strong>to</strong>m<br />

of the table (the foot) before it is continued <strong>to</strong> other pages.<br />

\endhead . . . . . . . . . . . . . . . . . . . . . . . (4.8.4) – 108<br />

Within the longtable environment of the longtable package, this<br />

comm<strong>and</strong> ends those specifications that are <strong>to</strong> be added <strong>to</strong> the <strong>to</strong>p<br />

of the table (the head) when it is continued <strong>to</strong> other pages.<br />

\endlastfoot . . . . . . . . . . . . . . . . . . . . . (4.8.4) – 108<br />

Within the longtable environment of the longtable package, this<br />

comm<strong>and</strong> ends those specifications that are <strong>to</strong> be added at the bot<strong>to</strong>m<br />

of the table (the foot) on the last page.<br />

\enlargethispage{size} . . . . . . . . . . . . . . . . . (2.7.4) – 34<br />

The \textheight parameter is temporarily increased by the length<br />

size, in order <strong>to</strong> improve a bad page break. On the following pages,<br />

\textheight will have its normal value once more.<br />

\enlargethispage* . . . . . . . . . . . . . . . . . . . (2.7.4) – 34<br />

Is the same as \enlargethispage except that any additional spacing<br />

between the lines is removed as necessary <strong>to</strong> maximize the amount<br />

of text on the page.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 541<br />

\ensuremath{math cmds} . . . . . . . . . . . . . . . (8.3.1) – 186<br />

Sets math cmds in math mode; may be called in both text <strong>and</strong> math<br />

modes. Its main use is <strong>to</strong> define new comm<strong>and</strong>s that require math<br />

mode but can be called from either mode.<br />

\epsilon [m] produces ɛ . . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\eqref{marker} [a] . . . . . . . . . . . . . . . . . (12.2.7) – 278<br />

With the amsmath package, is a variation on the \ref comm<strong>and</strong>,<br />

<strong>and</strong> prints the equation number defined with \label{marker} in<br />

parentheses, as (5.6).<br />

\equiv [m] produces ≡ . . . . . . . . . . . . . . . . . (5.3.4) – 126<br />

\eta [m] produces η . . . . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\euro . . . . . . . . . . . . . . . . . . . . . . . . . . (2.5.8) – 25<br />

With the eurosym package, prints the euro symbol e from the eurosym<br />

METAFONT fonts. With the eurosans package, it prints the<br />

symbol from the Adobe (PostScript) euro fonts. In both cases, the<br />

symbol is sans serif but changes <strong>to</strong> bold face or slanted <strong>to</strong> match the<br />

current font.<br />

\EUR . . . . . . . . . . . . . . . . . . . . . . . . . . . (2.5.8) – 25<br />

With the europs package, prints the euro symbol € from the Adobe<br />

(PostScript) euro fonts, such that it matches the font family <strong>and</strong> other<br />

attributes. \EURofc prints the invariable symbol €.<br />

\evensidemargin . . . . . . . . . . . . . . . . . . . . (3.2.5) – 48<br />

Sets the left margin for the even-numbered pages. It is effective in<br />

the document class book <strong>and</strong>, when the option twoside has been<br />

selected, in the other classes. A new value is assigned with the<br />

\setlength comm<strong>and</strong>:<br />

\setlength{\evensidemargin}{2.5cm}<br />

\ExecuteOptions{option list} [p] . . . . . . . . . . . . (D.2.3) – 443<br />

In a class or package file, this comm<strong>and</strong> executes all the option<br />

definitions in option list. This is normally invoked just prior <strong>to</strong><br />

\ProcessOptions <strong>to</strong> establish certain options as default.<br />

\exists [m] produces ∃ . . . . . . . . . . . . . . . . (5.3.6) – 127<br />

\exp [m] . . . . . . . . . . . . . . . . . . . . . . . . (5.3.8) – 128<br />

Comm<strong>and</strong> <strong>to</strong> produce the function name ‘exp’ in formulas.<br />

\extracolsep{extra width} . . . . . . . . . . . . . . . (4.8.1) – 96<br />

Tabular comm<strong>and</strong> for setting extra spacing between all the following<br />

columns in a table. This comm<strong>and</strong> is inserted as an @-expression<br />

in<strong>to</strong> the column definition field of the tabular environment:<br />

\begin{tabular}{lr@{\extracolsep{2.5mm}}lcr}


542 Appendix H. Comm<strong>and</strong> Summary<br />

\fbox{text} produces a frame around text . . . . . . . . (4.7.1) – 86<br />

\fancypage{cmds1}{cmds2} . . . . . . . . . . . . . . . (4.7.9) – 95<br />

With the fancybox package, places a framed box around the contents<br />

of all subsequent pages; cmds1 exclude the head <strong>and</strong> footlines, cmds2<br />

includes them. The arguments set box parameters like \fboxrule<br />

but must end with a box comm<strong>and</strong> like \shadowbox. Usually one set<br />

of cmds is left blank.<br />

\fboxrule . . . . . . . . . . . . . . . . . . . . . . . . (4.7.8) – 93<br />

The line thickness for the frames drawn by \fbox <strong>and</strong> \framebox<br />

comm<strong>and</strong>s. A new value is assigned with the \setlength comm<strong>and</strong>:<br />

\setlength{\fboxrule}{1pt}<br />

\fboxsep . . . . . . . . . . . . . . . . . . . . . . . . (4.7.8) – 93<br />

The distance between the frame <strong>and</strong> text in the \fbox <strong>and</strong> \framebox<br />

comm<strong>and</strong>s. A new value is assigned with the \setlength comm<strong>and</strong>:<br />

\setlength{\fboxsep}{1mm}<br />

\fcolorbox col spec1 col spec2{text} . . . . . . . . . . . (6.2) – 167<br />

A comm<strong>and</strong> made available with the color package. Like \colorbox,<br />

the text is set in an LR box with the col spec2 as the background color,<br />

but with a frame of color col spec1 around it. The col specs are either<br />

both defined names or employ the same model. Examples:<br />

\fcolorbox[rgb]{1,0,0}{0,1,0}{Text}<br />

\fcolorbox{red}{green}{Text}<br />

\figurename . . . . . . . . . . . . . . . . . . . . . . (D.4.1) – 459<br />

Comm<strong>and</strong> containing the name for a figure caption. In English, this<br />

is ‘Figure’ but may be altered for adaptation <strong>to</strong> other languages.<br />

\fill . . . . . . . . . . . . . . . . . . . . . . . . . . (2.4.2) – 22<br />

A rubber length with a natural size of zero that can stretch <strong>to</strong> any<br />

size necessary <strong>to</strong> fill up the horizontal or vertical space available.<br />

\flat [m] produces ♭ . . . . . . . . . . . . . . . . . . (5.3.6) – 127<br />

\floatpagefraction . . . . . . . . . . . . . . . . . . (7.3) – 172<br />

The fraction of a float page that must be filled with floats before a<br />

new page is called. A new value is assigned with<br />

\renewcomm<strong>and</strong>{\floatpagefraction}{decimal frac}<br />

\floatsep . . . . . . . . . . . . . . . . . . . . . . . . (7.3) – 172<br />

The vertical spacing between floats that appear at the <strong>to</strong>p or bot<strong>to</strong>m<br />

of a page. A new value is set with the \setlength comm<strong>and</strong>:<br />

\setlength{\floatsep}{12pt plus 2pt minus 4pt}<br />

\flushbot<strong>to</strong>m . . . . . . . . . . . . . . . . . . . . . . (3.2.5) – 48<br />

A declaration that puts vertical spacing between paragraphs so that<br />

the last line on every page is at the same position. St<strong>and</strong>ard for the<br />

book document class <strong>and</strong> for the twoside option.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 543<br />

\fnsymbol{counter} . . . . . . . . . . . . . . . . . . (8.1.4) – 183<br />

Prints the current value of the given counter as a ‘footnote symbol’:<br />

* † ‡ § ** †† ‡‡<br />

\fontencoding{enc} . . . . . . . . . . . . . . . . . . (A.1) – 368<br />

This comm<strong>and</strong> selects the font encoding scheme. Possible values of<br />

enc are OT1 for the st<strong>and</strong>ard <strong>and</strong> T1 for the Cork encodings. Other<br />

values are also possible.<br />

\fontfamily{fam} . . . . . . . . . . . . . . . . . . . (A.1) – 368<br />

This comm<strong>and</strong> selects the ‘family’ of fonts. Possible values of fam<br />

for st<strong>and</strong>ard L AT E X with the Computer Modern fonts are cmr, cmss,<br />

cmtt, <strong>and</strong> cmfi.<br />

\fontseries{ser} . . . . . . . . . . . . . . . . . . . . (A.1) – 368<br />

This comm<strong>and</strong> selects the ‘series’ of fonts within a ‘family’. Possible<br />

values of ser for st<strong>and</strong>ard L AT E X are m (medium) <strong>and</strong> bx (bold extended).<br />

\fontshape{form} . . . . . . . . . . . . . . . . . . . . (A.1) – 368<br />

This comm<strong>and</strong> selects the ‘shape’ of fonts. Possible values of form are<br />

n (normal), it (italic), sl (slanted), sc (small caps), <strong>and</strong> u (‘unslanted’<br />

italic).<br />

\fontsize{sz}{line sp} . . . . . . . . . . . . . . . . . (A.1) – 368<br />

This comm<strong>and</strong> selects the font size. The argument sz specifies the<br />

size of the characters in points (without the dimension pt) <strong>and</strong> line sp<br />

determines the value of the interline spacing (\baselineskip), with<br />

an explicit dimension. Example: \fontsize{12}{14pt}.<br />

\footnote[num]{footnote text} . . . . . (4.10.1), (4.10.2) – 112, 114<br />

Produces a footnote containing the text footnote tex. The optional<br />

argument num will be used as the footnote number in place of the<br />

next number in the au<strong>to</strong>matic sequence.<br />

\footnotemark[num] . . . . . . . . . . . . . . . . (4.10.3) – 114<br />

Produces a footnote marker in the current text. The optional argument<br />

num will be used as the footnote number in place of the next<br />

number in the au<strong>to</strong>matic sequence. May be used within structures<br />

where \footnote is not normally permitted, such as LR boxes, tables,<br />

math formulas.<br />

\footnoterule . . . . . . . . . . . . . . . . . . . (4.10.6) – 118<br />

This is an internal comm<strong>and</strong> <strong>to</strong> produce the horizontal rule between<br />

the regular text on a page <strong>and</strong> the footnote text at the bot<strong>to</strong>m. May<br />

be changed with, e.g.,<br />

\renewcomm<strong>and</strong>{\footnoterule}<br />

{\rule{wdth}{hght}\vspace{-hght}}


544 Appendix H. Comm<strong>and</strong> Summary<br />

\footnotesep . . . . . . . . . . . . . . . . . . . . (4.10.6) – 117<br />

The vertical spacing between two footnotes. A new value is assigned<br />

with the \setlength comm<strong>and</strong>:<br />

\setlength{\footnotesep}{6.5pt}<br />

\footnotesize . . . . . . . . . . . . . . . . . . . . . (4.1.2) – 62<br />

Switches <strong>to</strong> the font size \footnotesize, which is smaller than<br />

\small but larger than \scriptsize.<br />

\footnotetext[num]{footnote text} . . . . . . . . . (4.10.3) – 114<br />

Produces a footnote with the text footnote text but without generating<br />

a marker in the current text. The marker that is used for the<br />

footnote itself at the bot<strong>to</strong>m of the page derives from the current<br />

value of the counter footnote, which remains unchanged, or from<br />

the value of the optional argument num. This comm<strong>and</strong> may be used<br />

<strong>to</strong>gether with the \footnotemark comm<strong>and</strong> <strong>to</strong> insert footnotes in<strong>to</strong><br />

structures where they are otherwise not allowed, such as LR boxes,<br />

tables, <strong>and</strong> math formulas. The \footnotetext comm<strong>and</strong> must be<br />

given outside of that structure.<br />

\footskip . . . . . . . . . . . . . . . . . . . . . . . . (3.2.5) – 48<br />

The distance from the bot<strong>to</strong>m edge of the text body <strong>to</strong> the lower edge<br />

of the footline. A value is assigned with the \setlength comm<strong>and</strong>:<br />

\setlength{\footskip}{25pt}<br />

\forall [m] produces ∀ . . . . . . . . . . . . . . . . (5.3.6) – 127<br />

\foreignlanguage{language}{text} . . . . . . . . . . (11.1) – 254<br />

In the babel system, sets a short text in the selected language.<br />

\frac{numera<strong>to</strong>r}{denomina<strong>to</strong>r} [m] . . . . . . . . . (5.2.3) – 122<br />

Math comm<strong>and</strong> for generating fractions.<br />

\frame{text} . . . . . . . . . . . . . . . . . . . . . (13.1.4) – 298<br />

Produces a frame without any intervening spacing around text.<br />

Mainly used as a picture element in a \put or \multiput comm<strong>and</strong><br />

within the picture environment.<br />

\framebox[width][pos]{text}} . . . . . . . . . . . . . (4.7.1) – 86<br />

Produces a frame of width width around text. By default, the text is<br />

centered within the frame, but may be left or right justified by giving<br />

the optional argument pos as l or r. It may also have the value s, <strong>to</strong><br />

stretch the text <strong>to</strong> the given width.<br />

\framebox(x dimen,y dimen)[pos]{text} . . . . . . (13.1.4) – 291<br />

Picture element comm<strong>and</strong> <strong>to</strong> produce a frame of width x dimen <strong>and</strong><br />

height y dimen within the picture environment. Without the optional<br />

argument pos, the text is centered vertically <strong>and</strong> horizontally.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 545<br />

The text may be left or right justified, <strong>and</strong>/or aligned at the <strong>to</strong>p or<br />

bot<strong>to</strong>m, by setting pos <strong>to</strong> a combination of the letters l, r, t, <strong>and</strong> b,<br />

such as tr for <strong>to</strong>p, right; pos may also contain s <strong>to</strong> stretch the text<br />

<strong>to</strong> the full width. The comm<strong>and</strong> is <strong>to</strong> be used as the argument of a<br />

\put or \multiput comm<strong>and</strong>.<br />

\frenchspacing . . . . . . . . . . . . . . . . . . . . . (2.7.1) – 29<br />

After this comm<strong>and</strong> has been given, no additional horizontal spacing<br />

is inserted at the end of a sentence. The countercomm<strong>and</strong> is<br />

\nonfrenchspacing.<br />

\frontmatter . . . . . . . . . . . . . . . . . . . . . . (3.3.5) – 57<br />

In the book class, introduces the material that comes at the beginning<br />

(preface, table of contents) by turning off the chapter numbering of<br />

the \chapter comm<strong>and</strong> <strong>and</strong> switching <strong>to</strong> Roman numbers for the<br />

pagination.<br />

\frown [m] produces ⌢ . . . . . . . . . . . . . . . . . (5.3.4) – 126<br />

\fussy . . . . . . . . . . . . . . . . . . . . . . . . . . (2.8.3) – 36<br />

Countercomm<strong>and</strong> of \sloppy that allows larger interword spacings<br />

than normal. After \fussy has been given, the normal spacings apply<br />

once more.<br />

\Gamma [m] produces Γ . . . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\gamma [m] produces γ . . . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\gcd [m] . . . . . . . . . . . . . . . . . . . . . . . . (5.3.8) – 128<br />

Comm<strong>and</strong> <strong>to</strong> produce the function name ‘gcd’ in formulas. A lower<br />

limit may be given as a subscript.<br />

\ge [m] produces ≥ . . . . . . . . . . . . . . . . . . . (5.3.4) – 126<br />

\genfrac{left}{right}{thkns}{mathsz}{over}{under} [m][a]<br />

. . . . . . . . . . . . . . . . . . . . . . . . . . . . (12.2.3) – 265<br />

With the amsmath package, produces a generalized fraction with<br />

delimiters left <strong>and</strong> right, line thickness thkns, math font size mathsz<br />

0–3, <strong>and</strong> with over on <strong>to</strong>p of under. If mathsz is empty, the sizing is<br />

au<strong>to</strong>matic.<br />

\geq [m] produces ≥ . . . . . . . . . . . . . . . . . . (5.3.4) – 126<br />

\gets [m] produces ← . . . . . . . . . . . . . . . . . (5.3.5) – 127<br />

\gg [m] produces ≫ . . . . . . . . . . . . . . . . . . (5.3.4) – 126<br />

\glossary{glossary entry} . . . . . . . . . . . . . . . (9.4.4) – 230<br />

Write a \glossaryentry comm<strong>and</strong> <strong>to</strong> the.glo file if \makeglossary<br />

has been issued in the preamble; else it does nothing.<br />

\glossaryentry{glossary entry}{page number} . . . . (9.4.4) – 230<br />

The form in which the entry is written <strong>to</strong> the .glo file by the<br />

\glossary comm<strong>and</strong>.


546 Appendix H. Comm<strong>and</strong> Summary<br />

\graphpaper[num](x,y)(lx,ly) . . . . . . . . . . . (13.1.5) – 301<br />

A comm<strong>and</strong> added with the graphpap package for use in the picture<br />

environment. It plots a labeled grid system with the lower left corner<br />

at (x,y), lx wide <strong>and</strong> ly high. Grid lines are drawn every num units,<br />

with the fifth ones thicker. If num is not specified, it is assumed <strong>to</strong><br />

be 10. All arguments must be integers, not decimal fractions.<br />

\grave{x} [m] . . . . . . . . . . . . . . . . . . . . . (5.3.9) – 129<br />

A grave accent over the math variable x: \grave{a} = à.<br />

\Grave{x} [m][a] . . . . . . . . . . . . . . . . . . . (12.2.2) – 263<br />

With the amsmath package, can be used like \grave, but with multiple<br />

A M S-L AT E X math accents the positioning will be correct.<br />

\guillemotleft . . . . . . . . . . . . . . . . . . . . (G.4.5) – 503<br />

When T1 encoding is active, prints the symbol «.<br />

\guillemotright . . . . . . . . . . . . . . . . . . . (G.4.5) – 503<br />

When T1 encoding is active, prints the symbol ».<br />

\guilsinglleft . . . . . . . . . . . . . . . . . . . . (G.4.5) – 503<br />

When T1 encoding is active, prints the symbol ‹.<br />

\guilsinglright . . . . . . . . . . . . . . . . . . . (G.4.5) – 503<br />

When T1 encoding is active, prints the symbol ›.<br />

\H{x} . . . . . . . . . . . . . . . . . . . . . . . . . . (2.5.7) – 24<br />

Hungarian double acute accent: \H{o} = ő.<br />

\hat{x} [m] . . . . . . . . . . . . . . . . . . . . . . (5.3.9) – 129<br />

Circumflex over the math variable x: \hat{a} = â.<br />

\Hat{x} [m][a] . . . . . . . . . . . . . . . . . . . . (12.2.2) – 263<br />

With the amsmath package, can be used like \hat, but with multiple<br />

A M S-L AT E X math accents the positioning will be correct.<br />

\hbar [m] produces ℏ . . . . . . . . . . . . . . . . . (5.3.6) – 127<br />

\headheight . . . . . . . . . . . . . . . . . . . . . . . (3.2.5) – 48<br />

The height of the head at the <strong>to</strong>p of each page. A new value is<br />

assigned with the \setlength comm<strong>and</strong>:<br />

\setlength{\headheight}{25pt}<br />

\headsep . . . . . . . . . . . . . . . . . . . . . . . . (3.2.5) – 48<br />

Vertical spacing between the lower edge of the page head <strong>and</strong> the<br />

<strong>to</strong>p of the main text. A new value is assigned with the \setlength<br />

comm<strong>and</strong>:<br />

\setlength{\headsep}{0.25in}


H.1. Brief description of the L AT E X comm<strong>and</strong>s 547<br />

\head<strong>to</strong>name . . . . . . . . . . . . . . . . . . . . . . (D.4.1) – 460<br />

Comm<strong>and</strong> in the letter document class containing the text that<br />

precedes the recipient’s name in the headline after the first page.<br />

In English, this is ‘To’ but may be altered for adaptation <strong>to</strong> other<br />

languages.<br />

\heartsuit [m] produces ♥ . . . . . . . . . . . . . . (5.3.6) – 127<br />

\height . . . . . . . . . . . . . . . . . . . . . . . . . (4.7.1) – 86<br />

A length parameter equal <strong>to</strong> the natural height of a box (distance from<br />

the baseline <strong>to</strong> the <strong>to</strong>p); it may only be used in the width specification<br />

of \makebox, \framebox, or \savebox, or in the height specification<br />

of a \parbox or a minipage environment.<br />

\framebox[6\height]{text}<br />

\hfill . . . . . . . . . . . . . . . . . . . . . . . . . . (2.7.1) – 30<br />

A horizontal rubber spacing with a natural length of zero that can<br />

be stretched <strong>to</strong> any value. Used <strong>to</strong> fill up a horizontal line with blank<br />

spacing. This comm<strong>and</strong> is an abbreviation for \hspace{\fill}.<br />

\hline . . . . . . . . . . . . . . . . . . . . . . . . . . (4.8.1) – 97<br />

Produces a horizontal line in the array <strong>and</strong> tabular environments<br />

over the width of the entire table.<br />

\hoffset . . . . . . . . . . . . . . . . . . . . . . . . . 602, 603<br />

Horizontal offset of the output page from the printer border set by<br />

the printer driver. This printer border is normally 1 inch from the<br />

left edge of the paper. The st<strong>and</strong>ard value of \hoffset is 0 pt so<br />

that the left reference margin of the page is identical with the printer<br />

margin. A new value is assigned with the \setlength comm<strong>and</strong>:<br />

\setlength{\hoffset}{-1in}<br />

\hom [m] . . . . . . . . . . . . . . . . . . . . . . . . (5.3.8) – 128<br />

Comm<strong>and</strong> <strong>to</strong> produce the function name ‘hom’ in formulas.<br />

\hookleftarrow [m] produces ←↪ . . . . . . . . . . . . (5.3.5) – 127<br />

\hookrightarrow [m] produces ↩→ . . . . . . . . . . . (5.3.5) – 127<br />

\hrulefill . . . . . . . . . . . . . . . . . . . . . . . (2.7.1) – 30<br />

Fills up the space in a line with a rule: = \hrulefill.<br />

\hspace{width} . . . . . . . . . . . . . . . . . . . . . (2.7.1) – 29<br />

Produces horizontal spacing of length width. It is ignored if it occurs<br />

at the beginning or end of a line.<br />

\hspace*{width} . . . . . . . . . . . . . . . . . . . . (2.7.1) – 29<br />

Produces horizontal spacing of length width even at the beginning or<br />

end of a line.


548 Appendix H. Comm<strong>and</strong> Summary<br />

\huge . . . . . . . . . . . . . . . . . . . . . . . . . . (4.1.2) – 62<br />

Switches <strong>to</strong> the font size \huge, which is smaller than \Huge but<br />

larger than \LARGE.<br />

\Huge . . . . . . . . . . . . . . . . . . . . . . . . . . (4.1.2) – 62<br />

Switches <strong>to</strong> the largest font size available \Huge, which is larger than<br />

\huge.<br />

\hyperlink{name}{link} . . . . . . . . . . . . . . (10.2.4) – 247<br />

With the hyperref package, makes the contents of link <strong>to</strong> be a link <strong>to</strong><br />

the target with the name name, established with the \hypertarget<br />

comm<strong>and</strong>. The link may be text, a symbol, or a graphics loaded with<br />

\includegraphics. The link is framed with a colored box, unless<br />

the option colorlinks has been set <strong>to</strong> true, in which case the link<br />

is set in a text color determined by the option linkcolor.<br />

\hypertarget{name}{text} . . . . . . . . . . . . . (10.2.4) – 247<br />

With the hyperref package, prints the text argument as normal, but<br />

makes it a target for internal links, named name. The text may be<br />

empty.<br />

\hypersetup{key = value, . . . } . . . . . . . . . . . . (10.2.4) – 241<br />

With the hyperref package, allows parameters (key) <strong>to</strong> be assigned<br />

values (value); the parameters may also be set as options in the<br />

\usepackage loading comm<strong>and</strong>, by with \hypersetup, these values<br />

may be changed within the document. The list of possible keys <strong>and</strong><br />

values is given on pages 242–246.<br />

\hyphenation{hyphenation list} [p] . . . . . . . . . . . (2.8.2) – 35<br />

Sets up a list of hyphenation exceptions. The hyphenation list consists<br />

of a collection of words containing hyphens at the places where<br />

word division may occur: hy-phen-a-tion per-mit-ted.<br />

\i produces ı . . . . . . . . . . . . . . . . . . . . . . . (2.5.7) – 24<br />

\idotsint [m][a] produces ··· <br />

. . . . . . . . . . . (12.2.2) – 260<br />

\iff [m] produces ⇐⇒ . . . . . . . . . . . . . . . . . (5.3.5) – 127<br />

\IfFileExists{file name}{true}{false} . . . . . . . . (D.2.8) – 447<br />

Tests if the file file name can be found in the places where L AT E X looks<br />

for files; if so, the code true is executed; otherwise, false. This is like<br />

\InputIfFileExists except the file is not input.<br />

\iflanguage{language}{yes text}{no text} . . . . . . (11.1) – 254<br />

In the multilingual babel system, tests if language is the currently<br />

selected language <strong>and</strong>, if so, executes yes text, otherwise no text.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 549<br />

\[ifthen]ifthenelse{test}{then text}{else text} . . . . . (8.3.5) – 193<br />

A conditional comm<strong>and</strong> available when the st<strong>and</strong>ard package ifthen<br />

has been loaded. If the logical statement test evaluates <strong>to</strong> 〈true〉<br />

then then text is inserted, otherwise else text. The logical statement<br />

may be relational (two numbers with one of < = > between<br />

them), an even–odd test (\isodd{number}), a comparison<br />

of two texts (\equal{text1}{text2}), a comparison of two lengths<br />

(\lengthtest{length1 op length2}, op is one of < = >), or a test<br />

of a boolean switch (\boolean{switch}). Switches are created with<br />

\newboolean{switch} <strong>and</strong> set with \setboolean{switch}{value},<br />

where value is true or false. Logical statements may be combined<br />

with logical opera<strong>to</strong>rs \<strong>and</strong>, \or, <strong>and</strong> \not, <strong>and</strong> grouped with \( <strong>and</strong><br />

\).<br />

\Im [m] produces ℑ . . . . . . . . . . . . . . . . . . . (5.3.6) – 127<br />

\imath [m] produces ı . . . . . . . . . . . . . . . . . (5.3.6) – 127<br />

\in [m] produces ∈ . . . . . . . . . . . . . . . . . . . (5.3.4) – 126<br />

\include{file} . . . . . . . . . . . . . . . . . . . . . (9.1.2) – 209<br />

Inserts the contents of the file with the root name file <strong>and</strong> extension<br />

.tex in<strong>to</strong> the current text at the point where the comm<strong>and</strong> appears.<br />

A new page is always started! Together with \includeonly, this<br />

comm<strong>and</strong> allows portions of the document <strong>to</strong> be processed as though<br />

the rest of the text were present.<br />

\includegraphics[llx,lly][urx,ury]{file name} . . . . . (6.1.2) – 155<br />

A comm<strong>and</strong> made available with the graphics package that imports<br />

external graphics s<strong>to</strong>red in the file file name. The coordinates of the<br />

bounding box are given by llx, lly (lower left corner) <strong>and</strong> by urx, ury<br />

(upper right corner). It is the contents of this bounding box that<br />

are used for further manipulation: scaling, rotating. It is also the<br />

(manipulated) bounding box that is used <strong>to</strong> reserve space in the text;<br />

any graphics that extend beyond the limits of this box will also be<br />

printed, but overlapping any other material that may be beside it.<br />

The bounding box coordinates may have units attached <strong>to</strong> them; the<br />

default units are big points bp (72 per inch).<br />

If the bounding box coordinates are omitted, the information is<br />

obtained in some other manner, depending on the type of graphics<br />

file. For an encapsulated PostScript file, this information is taken<br />

from the graphics file itself.<br />

If llx <strong>and</strong> lly are not specified, they are assumed <strong>to</strong> be 0. That is, if<br />

only one set of optional coordinates are given, they refer <strong>to</strong> the upper<br />

right corner.<br />

\includegraphics*[llx,lly][urx,ury]{file name} . . . . (6.1.2) – 155<br />

The same as \includegraphics except that any graphics extending<br />

beyond the bounding box are not included: the figure is clipped.


550 Appendix H. Comm<strong>and</strong> Summary<br />

\includegraphics[key=value,. . . ]{file name} . . . . . (6.1.3) – 157<br />

With the graphicx package, this comm<strong>and</strong> has a different syntax in<br />

which the scaling, rotating, clipping are effected through key=value<br />

pairs, like width=7cm, angle=90, scale=.5.<br />

\includeonly{file list} [p] . . . . . . . . . . . . . . . (9.1.2) – 209<br />

Only those files whose names are in file list, separated by commas,<br />

will be read in by the \include comm<strong>and</strong>s. The \include comm<strong>and</strong>s<br />

for other file names are ignored. Nevertheless, all the auxiliary files<br />

are read in so that the page <strong>and</strong> section numbers will be correct, as<br />

are the cross-reference markers.<br />

\indent . . . . . . . . . . . . . . . . . . . . . . . . . (3.2.4) – 46<br />

The first line of the next paragraph is <strong>to</strong> be indented.<br />

\index{index entry} . . . . . . . . . . . . (9.4.2), (9.4.2) – 225, 226<br />

Writes a \indexentry comm<strong>and</strong> <strong>to</strong> the .idx file if the \makeindex<br />

comm<strong>and</strong> has been issued in the preamble; otherwise it does nothing.<br />

The MakeIndex program (Section 9.4.3) can process this file if the<br />

entries are in the forms<br />

\index{main entry}<br />

\index{main entry!sub entry}<br />

\index{main entry!sub entry!sub sub entry}<br />

making up a theindex environment with the entries alphabetically<br />

ordered <strong>and</strong> organized with \item, \subitem, <strong>and</strong> \subsubitem<br />

comm<strong>and</strong>s.<br />

\indexentry{index entry}{page number} . . . . . . . (9.4.2) – 226<br />

The form in which the entry is written <strong>to</strong> the.idx file by the \index<br />

comm<strong>and</strong>.<br />

\indexname . . . . . . . . . . . . . . . . . . . . . . (D.4.1) – 459<br />

Comm<strong>and</strong> containing the heading for the index. In English, this is<br />

‘Index’ but may be altered for adaptation <strong>to</strong> other languages.<br />

\indexspace . . . . . . . . . . . . . . . . . . . . . . (9.4.1) – 225<br />

Comm<strong>and</strong> within theindex environment <strong>to</strong> produce a blank line.<br />

\inf [m] . . . . . . . . . . . . . . . . . . . . . . . . (5.3.8) – 128<br />

Comm<strong>and</strong> <strong>to</strong> produce the function name ‘inf’ in formulas. A lower<br />

limit may be set as a subscript.<br />

\infty [m] produces ∞ . . . . . . . . . . . . . . . . . (5.3.6) – 127<br />

\intertext{insert text} [m][a] . . . . . . . . . . . . (12.2.1) – 259<br />

When the package amsmath is loaded, this comm<strong>and</strong> inserts text as<br />

a left-justified line between lines of an equation, without affecting<br />

their horizontal alignment.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 551<br />

\input{file} . . . . . . . . . . . . . . . . . . . . . . (9.1.1) – 207<br />

Inserts the contents of the file with the root name file <strong>and</strong> extension<br />

.tex in<strong>to</strong> the current text at the point where the comm<strong>and</strong> appears.<br />

The file that is read in may also contain further \input comm<strong>and</strong>s.<br />

\InputIfFileExists{file name}{true}{false} . . . . . (D.2.8) – 447<br />

Tests if the file file name can be found in the places where LAT EX looks for files; if so, the code true is executed <strong>and</strong> the file is input;<br />

otherwise, false is executed.<br />

\int [m] produces <br />

. . . . . . . . . . . . . . . . . . (5.2.5) – 123<br />

\iint [m][a] produces <br />

. . . . . . . . . . . . . . . (12.2.2) – 260<br />

\iiint [m][a] produces <br />

. . . . . . . . . . . . . . (12.2.2) – 260<br />

\iiiint [m][a] produces <br />

. . . . . . . . . . . . . (12.2.2) – 260<br />

\intextsep . . . . . . . . . . . . . . . . . . . . . . . (7.3) – 172<br />

The vertical spacing between floats in the middle of a page <strong>and</strong> the<br />

surrounding text. A new value is assigned with the \setlength<br />

comm<strong>and</strong>:<br />

\setlength{\intextsep}{10pt plus2pt minus3pt}<br />

\invisible . . . . . . . . . . . . . . . . . . . . . (15.1.2) – 326<br />

In slides class, a declaration that makes the following text be printed<br />

in ‘invisible ink’, that is, it takes up as much space as though it were<br />

there. It remains in effect until the end of the environment, or end of<br />

the curly braces, in which it was issued, or until \visible is given.<br />

It is used for making overlays.<br />

\iota [m] produces ι . . . . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\itdefault . . . . . . . . . . . . . . . . . . . . . . (A.3.1) – 372<br />

This comm<strong>and</strong> defines the shape attribute that is selected with the<br />

\itshape comm<strong>and</strong>. It may be redefined with \renewcomm<strong>and</strong>:<br />

\renewcomm<strong>and</strong>{\itdefault}{it}<br />

\item[label] . . . . . . . . . . . . . . . . . . (4.3), (4.4.1) – 69, 74<br />

Produces a label <strong>and</strong> the start of an item text in a list environment.<br />

Without the optional argument, the label is generated according <strong>to</strong><br />

the type of environment, for example numbers for the enumerate<br />

environment. The optional argument inserts label in place of this<br />

st<strong>and</strong>ard item label.<br />

\item . . . . . . . . . . . . . . . . . . . . . . . . . (9.4.1) – 225<br />

Produces a main entry in theindex environment.<br />

\itemindent . . . . . . . . . . . . . . . . . . . . . . . (4.4.2) – 77<br />

The amount by which the label <strong>and</strong> the text of the first line after each<br />

\item is indented in a list environment. The st<strong>and</strong>ard value is 0 pt,<br />

but a new value may be assigned with the \setlength comm<strong>and</strong>:<br />

\setlength{\itemindent}{1em}


552 Appendix H. Comm<strong>and</strong> Summary<br />

\itemsep . . . . . . . . . . . . . . . . . . . . . . . . (4.4.2) – 75<br />

The amount of vertical spacing in addition <strong>to</strong> \parsep that is inserted<br />

between the \item texts in a list environment. A new value may be<br />

assigned with the \setlength comm<strong>and</strong>:<br />

\setlength{\itemsep}{2pt plus1pt minus1pt}<br />

\itshape . . . . . . . . . . . . . . . . . . (4.1.3), (A.2) – 64, 371<br />

This declaration switches <strong>to</strong> a font in the current family <strong>and</strong> series,<br />

but with the italic shape attribute.<br />

\j produces j . . . . . . . . . . . . . . . . . . . . . . . (2.5.7) – 24<br />

\jmath [m] produces j . . . . . . . . . . . . . . . . . (5.3.6) – 127<br />

\Join [m] produces ⋈ . . . . . . . . . . . . . . . . . (5.3.6) – 127<br />

\jot . . . . . . . . . . . . . . . . . . . . . . . . . . (5.5.4) – 149<br />

The amount of vertical spacing between the formula lines of an<br />

eqnarray or eqnarray* environment. St<strong>and</strong>ard value is 3 pt. A new<br />

value may be assigned with the \setlength comm<strong>and</strong>:<br />

\setlength{\jot}{4.5pt}<br />

\k{x} . . . . . . . . . . . . . . . . . . . . . . . . . (G.4.5) – 503<br />

When T1 encoding is active, prints the ogonek accent \k{A} = Ą.<br />

\kappa [m] produces κ . . . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\ker [m] . . . . . . . . . . . . . . . . . . . . . . . . (5.3.8) – 128<br />

Comm<strong>and</strong> <strong>to</strong> produce the function name ‘ker’ in formulas.<br />

\kill . . . . . . . . . . . . . . . . . . . . . . . . . . (4.6.2) – 82<br />

Removes the preceding sample line in a tabbing environment that<br />

was given only <strong>to</strong> set the tabs <strong>and</strong> not <strong>to</strong> be printed at this point.<br />

\L produces Ł . . . . . . . . . . . . . . . . . . . . . . (2.5.6) – 24<br />

\l produces ł . . . . . . . . . . . . . . . . . . . . . . . (2.5.6) – 24<br />

\label{marker} . . . . . . . . . . . . . . . . . . . . (9.2.1) – 213<br />

Sets a marker in the text at this position with the name marker.<br />

It may be referred <strong>to</strong> either earlier or later in the document with<br />

the comm<strong>and</strong> \ref{marker} <strong>to</strong> output the counter that was then<br />

current, such as the section, equation, or figure number, or with the<br />

comm<strong>and</strong> \pageref{marker} <strong>to</strong> print the page number where the<br />

marker was set.<br />

\labelenum n . . . . . . . . . . . . . . . . . . . . . . (4.3.5) – 73<br />

A set of comm<strong>and</strong>s <strong>to</strong> produce the st<strong>and</strong>ard labels for the nesting<br />

levels of the enumerate environments, where n is one of i, ii, iii,<br />

or iv. For example,<br />

\renewcomm<strong>and</strong>{\labelenumii}{\arabic{enumii}.)}<br />

changes the st<strong>and</strong>ard labels of the second-level enumerate environment<br />

<strong>to</strong> be 1.), 2.), etc.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 553<br />

\labelitem n . . . . . . . . . . . . . . . . . . . . . . (4.3.5) – 73<br />

A set of comm<strong>and</strong>s <strong>to</strong> produce the st<strong>and</strong>ard labels for the nesting<br />

levels of the itemize environments, where n is one of i, ii, iii, or<br />

iv. For example,<br />

\renewcomm<strong>and</strong>{\labelitemi}{$\Rightarrow$}<br />

changes the st<strong>and</strong>ard labels of the outermost itemize environment<br />

<strong>to</strong> ⇒.<br />

\labelsep . . . . . . . . . . . . . . . . . . . . . . . . (4.4.2) – 77<br />

In a list environment, the distance between the label box <strong>and</strong> the<br />

list text. A new value is assigned with the \setlength comm<strong>and</strong>:<br />

\setlength{\labelsep}{5pt}<br />

\labelwidth . . . . . . . . . . . . . . . . . . . . . . . (4.4.2) – 77<br />

In a list environment, the width of the box reserved for the label. A<br />

new value is assigned with the \setlength comm<strong>and</strong>:<br />

\setlength{labelwidth}{2.2cm}<br />

\Lambda [m] produces Λ . . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\lambda [m] produces λ . . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\langle [m] produces 〈 . . . . . . . . . . . . . . . . . (5.4.1) – 132<br />

\language{num} . . . . . . . . . . . . . . . . . . . (11.1) – 255<br />

In T E X versions 3.0 <strong>and</strong> later, the set of hyphenation patterns number<br />

num is made active. The patterns must be previously loaded in<strong>to</strong><br />

the format file by an initex run in which \language{num} was given<br />

before those patterns were read in.<br />

\large . . . . . . . . . . . . . . . . . . . . . . . . . . (4.1.2) – 62<br />

Switches <strong>to</strong> the font size \large, which is smaller than \Large but<br />

larger than \normalsize.<br />

\Large . . . . . . . . . . . . . . . . . . . . . . . . . . (4.1.2) – 62<br />

Switches <strong>to</strong> the font size \Large, which is smaller than \LARGE but<br />

larger than \large.<br />

\LARGE . . . . . . . . . . . . . . . . . . . . . . . . . . (4.1.2) – 62<br />

Switches <strong>to</strong> the font size \LARGE, which is smaller than \huge but<br />

larger than \Large.<br />

\<strong>LaTeX</strong> produces L AT E X . . . . . . . . . . . . . . . . . . . (2.1) – 18<br />

\<strong>LaTeX</strong>e produces L AT E X 2ε . . . . . . . . . . . . . . . . . (2.1) – 19<br />

\lceil [m] produces ⌈ . . . . . . . . . . . . . . . . . (5.4.1) – 132<br />

\ldots produces . . . . . . . . . . . . . . . . . . . . . (5.2.6) – 123<br />

\le [m] produces ≤ . . . . . . . . . . . . . . . . . . . (5.3.4) – 126<br />

\leads<strong>to</strong> [m] produces ⇝ . . . . . . . . . . . . . . . (5.3.5) – 127


554 Appendix H. Comm<strong>and</strong> Summary<br />

\leftlbrack [m] . . . . . . . . . . . . . . . . . . . . (5.4.1) – 131<br />

Adjusts the size of the bracket symbol lbrack <strong>to</strong> fit the height of<br />

the formula between the \left ... \right pair. For example,<br />

\left[. If there is <strong>to</strong> be no matching bracket, the \left <strong>and</strong> \right<br />

comm<strong>and</strong>s must still be given <strong>to</strong> specify the part of the formula <strong>to</strong><br />

be sized, but the missing bracket is given as a period (for example,<br />

\right.).<br />

\Leftarrow [m] produces ⇐ . . . . . . . . . . . . . . (5.3.5) – 127<br />

\leftarrow [m] produces ← . . . . . . . . . . . . . . (5.3.5) – 127<br />

\leftharpoondown [m] produces ↽ . . . . . . . . . . . (5.3.5) – 127<br />

\leftharpoonup [m] produces ↼ . . . . . . . . . . . . (5.3.5) – 127<br />

\lefteqn [m] . . . . . . . . . . . . . . . . . . . . . (5.4.7) – 140<br />

A comm<strong>and</strong> inside the eqnarray environment that outputs its argument<br />

as though it had zero width, thus having no effect on the<br />

column widths. It is used mainly for the first row of a multi-row<br />

formula.<br />

\leftmargin . . . . . . . . . . . . . . . . . . . . . . . (4.4.2) – 76<br />

In a list environment, the amount by which the left edge of the text<br />

is indented relative <strong>to</strong> the surrounding text. A new value is assigned<br />

with the \setlength comm<strong>and</strong>. For nested list environments,<br />

different values for the indentation can be specified by adding i<br />

. . . vi <strong>to</strong> the declaration name, such as<br />

\setlength{\leftmarginiii}{0.5cm}<br />

See also . . . . . . . . . . . . . . . . . . . . . . (4.3.4) – 71.<br />

\Leftrightarrow [m] produces ⇔ . . . . . . . . . . . (5.3.5) – 127<br />

\leftrightarrow [m] produces ↔ . . . . . . . . . . . (5.3.5) – 127<br />

\leftroot{shift} [m][a] . . . . . . . . . . . . . . . (12.2.5) – 269<br />

With the amsmath package, used in the index <strong>to</strong> a \sqrt comm<strong>and</strong><br />

<strong>to</strong> shift it slightly <strong>to</strong> the left. The shift is a number specifying how<br />

many units <strong>to</strong> move it. Example:<br />

\sqrt[\leftroot{-1}\uproot{3}\beta]{k}<br />

\leq [m] produces ≤ . . . . . . . . . . . . . . . . . . (5.3.4) – 126<br />

\lfloor [m] produces ⌊ . . . . . . . . . . . . . . . . (5.4.1) – 132<br />

\lg [m] . . . . . . . . . . . . . . . . . . . . . . . . . (5.3.8) – 128<br />

Comm<strong>and</strong> <strong>to</strong> produce the function name ‘lg’ in formulas.<br />

\lhd [m] produces ⊳ . . . . . . . . . . . . . . . . . . (5.3.3) – 125<br />

\lim [m] . . . . . . . . . . . . . . . . . . . . . . . . (5.3.8) – 128<br />

Comm<strong>and</strong> <strong>to</strong> produce the function name ‘lim’ in formulas. A lower<br />

limit may be set as a subscript.<br />

\liminf [m] . . . . . . . . . . . . . . . . . . . . . . (5.3.8) – 128<br />

Comm<strong>and</strong> <strong>to</strong> produce the function name ‘lim inf’ in formulas. A<br />

lower limit may be set as a subscript.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 555<br />

\limits [m] . . . . . . . . . . . . . . . . (5.2.5), (5.3.7) – 123, 128<br />

Places the upper <strong>and</strong> lower limits above <strong>and</strong> below the appropriate<br />

symbols where these would normally go just after them.<br />

\limsup [m] . . . . . . . . . . . . . . . . . . . . . . (5.3.8) – 128<br />

Comm<strong>and</strong> <strong>to</strong> produce the function name ‘lim sup’ in formulas. A<br />

lower limit may be set as a subscript.<br />

\line(∆x,∆y){length} . . . . . . . . . . . . . . . (13.1.4) – 293<br />

A picture element comm<strong>and</strong> within a picture environment for drawing<br />

horizontal <strong>and</strong> vertical lines of any length as well as slanted lines<br />

at a limited number of angles. For horizontal <strong>and</strong> vertical lines, the<br />

length argument is the actual length in units of \unitlength. For<br />

slanted lines, length is the length of the projection on <strong>to</strong> the x-axis<br />

(horizontal displacement). The slope is determined by the (∆x, ∆y)<br />

arguments, which take on integral values such that −6 ≤ ∆x ≤ 6<br />

<strong>and</strong> −6 ≤ ∆y ≤ 6. This comm<strong>and</strong> is the argument of a \put or<br />

\multiput comm<strong>and</strong>.<br />

\linebreak[n] . . . . . . . . . . . . . . . . . . . . . (2.7.2) – 31<br />

A recommendation <strong>to</strong> break the line of text at this point such that<br />

it fills the horizontal space available (left <strong>and</strong> right justified). The<br />

urgency of the recommendation is given by the integral number<br />

n between 0 <strong>and</strong> 4, with the higher numbers meaning a stronger<br />

recommendation. A value of 4 is the same as the comm<strong>and</strong> without<br />

the optional argument <strong>and</strong> means an obliga<strong>to</strong>ry line break.<br />

\linethickness{thickness} . . . . . . . . . . . . . (13.1.4) – 300<br />

Sets the thickness of the horizontal <strong>and</strong> vertical lines in the picture<br />

environment. The argument thickness is a length specification with<br />

units, for example, 1.2mm.<br />

\linewidth . . . . . . . . . . . . . . . . . . . . . . . (3.2.5) – 47<br />

A length that is set <strong>to</strong> the current text line width, whether in one<br />

column of a two-column page, in a minipage or parbox. This must<br />

never be changed, but is used when that width is needed, say <strong>to</strong> set<br />

the width of an included graphics with<br />

\includegraphics[width=0.8\linewidth]{..}<br />

\listfigurename . . . . . . . . . . . . . . . . . . . (D.4.1) – 459<br />

Comm<strong>and</strong> containing the heading for the list of figures. In English,<br />

this is ‘List of Figures’ but may be altered for adaptation <strong>to</strong> other<br />

languages.<br />

\listfiles [p] . . . . . . . . . . . . . . . (9.1.1), (D.2.9) – 208, 447<br />

When given in the preamble, causes a list of all files read in during<br />

the processing <strong>to</strong> be printed <strong>to</strong> the moni<strong>to</strong>r <strong>and</strong> <strong>to</strong> the transcript file<br />

at the end of the run. The list includes version number, date, <strong>and</strong><br />

any additional information entered with one of the \Provides...<br />

comm<strong>and</strong>s.


556 Appendix H. Comm<strong>and</strong> Summary<br />

\lis<strong>to</strong>ffigures . . . . . . . . . . . . . . . . . . . . . (3.4.4) – 59<br />

Produces a list of figures with the entries from all the \caption<br />

comm<strong>and</strong>s in figure environments.<br />

\lis<strong>to</strong>ftables . . . . . . . . . . . . . . . . . . . . . (3.4.4) – 59<br />

Produces a list of tables with the entries from all the \caption<br />

comm<strong>and</strong>s in table environments.<br />

\listparindent . . . . . . . . . . . . . . . . . . . . . (4.4.2) – 77<br />

Depth of indentation for the first line of a paragraph inside a list<br />

environment. A new value may be assigned with the \setlength<br />

comm<strong>and</strong>:<br />

\setlength{\listparindent}{1em}<br />

\listtablename . . . . . . . . . . . . . . . . . . . . (D.4.1) – 459<br />

Comm<strong>and</strong> containing the heading for the list of tables. In English,<br />

this is ‘List of Tables’ but may be altered for adaptation <strong>to</strong> other<br />

languages.<br />

\ll [m] produces ≪ . . . . . . . . . . . . . . . . . . (5.3.4) – 126<br />

\ln [m] . . . . . . . . . . . . . . . . . . . . . . . . . (5.3.8) – 128<br />

Comm<strong>and</strong> <strong>to</strong> produce the function name ‘ln’ in formulas.<br />

\LoadClass[options]{class}[version] [p] . . . . . . . . (D.2.2) – 442<br />

This comm<strong>and</strong> may only be invoked within a class file <strong>to</strong> load another<br />

class file. It may only be called once within any class file. The file<br />

loaded must have the extension .cls. Any options specified in the<br />

\documentclass comm<strong>and</strong> are not passed over as global options.<br />

The optional version is a date, given in the form yyyy/mm/dd, as for<br />

example 1994/08/01. If the date of the class file is earlier than this,<br />

a warning message is printed.<br />

\LoadClassWithOptions{class}[version] [p] . . . . . . (D.2.2) – 442<br />

Like \LoadClass except all the currently specified options are au<strong>to</strong>matically<br />

passed <strong>to</strong> class.<br />

\location{number} . . . . . . . . . . . . . . . . . . (16.1) – 352<br />

In the letter document class, enters the sender’s room number. In<br />

the st<strong>and</strong>ard L AT E X letter class, number is only output if \address<br />

has not been called. It is intended <strong>to</strong> be used in company letterheads.<br />

\log [m] . . . . . . . . . . . . . . . . . . . . . . . . (5.3.8) – 128<br />

Comm<strong>and</strong> <strong>to</strong> produce the function name ‘log’ in formulas.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 557<br />

\Longleftarrow [m] produces ⇐= . . . . . . . . . . . (5.3.5) – 127<br />

\longleftarrow [m] produces ←− . . . . . . . . . . . (5.3.5) – 127<br />

\Longleftrightarrow [m] produces ⇐⇒ . . . . . . . . (5.3.5) – 127<br />

\longleftrightarrow [m] produces ←→ . . . . . . . . (5.3.5) – 127<br />

\longmaps<strong>to</strong> [m] produces ↦−→ . . . . . . . . . . . . . (5.3.5) – 127<br />

\Longrightarrow [m] produces =⇒ . . . . . . . . . . . (5.3.5) – 127<br />

\longrightarrow [m] produces −→ . . . . . . . . . . . (5.3.5) – 127<br />

\lq produces ‘, identical <strong>to</strong> the ‘ symbol.<br />

\lvert [m][a] produces | (left delimiter) . . . . . . . . (12.2.5) – 270<br />

\lVert [m][a] produces (left delimiter) . . . . . . . . (12.2.5) – 270<br />

\mainmatter . . . . . . . . . . . . . . . . . . . . . . . (3.3.5) – 57<br />

In the book class, introduces the main body of text after the front<br />

matter, by resetting the page numbering <strong>to</strong> 1 with Arabic numbers,<br />

<strong>and</strong> by reactivating the chapter numbering with the \chapter comm<strong>and</strong>.<br />

It undoes the effects of \frontmatter.<br />

\makebox[width][pos]{text} . . . . . . . . . . . . . . . (4.7.1) – 86<br />

Produces a box of width width containing text centered horizontally,<br />

unless pos is given <strong>to</strong> specify that it is <strong>to</strong> be left (l) or right (r)<br />

justified. It may also have the value s, <strong>to</strong> stretch the text <strong>to</strong> width.<br />

\makebox(x dimen,y dimen)[pos]{text} . . . . . . . (13.1.4) – 291<br />

Picture element comm<strong>and</strong> <strong>to</strong> produce a box of width x dimen <strong>and</strong><br />

height y dimen within the picture environment. Without the optional<br />

argument pos, the text is centered vertically <strong>and</strong> horizontally.<br />

The text may be left or right justified, <strong>and</strong>/or aligned at the <strong>to</strong>p or<br />

bot<strong>to</strong>m, by setting pos <strong>to</strong> a combination of the letters l, r, t, <strong>and</strong> b,<br />

such as tr for <strong>to</strong>p, right; pos may also contain s <strong>to</strong> stretch the text<br />

<strong>to</strong> the full width. The comm<strong>and</strong> is used as the argument of a \put<br />

or \multiput comm<strong>and</strong>.<br />

\makeglossary [p] . . . . . . . . . . . . . . . . . . . (9.4.4) – 230<br />

Comm<strong>and</strong> <strong>to</strong> activate the \glossary comm<strong>and</strong>s in the text.<br />

\makeindex [p] . . . . . . . . . . . . . . . . . . . . . (9.4.2) – 226<br />

Comm<strong>and</strong> <strong>to</strong> activate the \index comm<strong>and</strong>s in the text.<br />

\makelabel{text} . . . . . . . . . . . . . . . . . . . . (4.4.1) – 75<br />

An internal comm<strong>and</strong> that is called by the \item comm<strong>and</strong> <strong>to</strong> produce<br />

the actual label text within a list environment.<br />

\makelabels . . . . . . . . . . . . . . . . . . . . . . (16.1) – 355<br />

Produces address labels in the letter document class using the<br />

entries from the \begin{letter} environment.<br />

\MakeLowercase{text cmd} . . . . . . . . . . . . . . (D.3.2) – 455<br />

Converts text cmd (text <strong>and</strong> comm<strong>and</strong>s) <strong>to</strong> lower case.


558 Appendix H. Comm<strong>and</strong> Summary<br />

\MakeShortVerb{\c} . . . . . . . . . . . . . (4.9.1, B.5.3) – 111, 393<br />

When the st<strong>and</strong>ard package shortvrb has been loaded, this comm<strong>and</strong><br />

makes the character c a shorth<strong>and</strong> form for \verbc: everything<br />

that appears between two occurrences of c is printed literally,<br />

in typewriter type. With \DeleteShortVerb{\c}, the character is<br />

res<strong>to</strong>red <strong>to</strong> its normal meaning. Example: \MakeShortVerb{\|}<br />

\maketitle . . . . . . . . . . . . . . . . . . . . . . . (3.3.1) – 54<br />

Produces a title page using entries in the \author <strong>and</strong> \title comm<strong>and</strong>s,<br />

<strong>and</strong> optionally those in the \date <strong>and</strong> \thanks comm<strong>and</strong>s.<br />

\MakeUppercase{text cmd} . . . . . . . . . . . . . . (D.3.2) – 455<br />

Converts text cmd (text <strong>and</strong> comm<strong>and</strong>s) <strong>to</strong> upper case.<br />

\maps<strong>to</strong> [m] produces ↦→ . . . . . . . . . . . . . . . . (5.3.5) – 127<br />

\marginpar[left text]{right text} . . . . . . . . . . . (4.10.5) – 117<br />

Produces a marginal note at the right of the text containing right text.<br />

With two-sided formatting, the marginal note goes in<strong>to</strong> the left margin<br />

on the even pages, in which case the optional left text will be written<br />

instead. For two-column text, the marginal notes always go in<strong>to</strong> the<br />

‘outer’ margin, <strong>and</strong> again left text will be used for the left margin.<br />

\marginparpush . . . . . . . . . . . . . . . . . . . (4.10.6) – 118<br />

The minimum vertical separation between two marginal notes. A<br />

new value may be assigned with the \setlength comm<strong>and</strong>.<br />

\marginparsep . . . . . . . . . . . . . . . . . . . (4.10.6) – 118<br />

The spacing between the edge of the text <strong>and</strong> a marginal note. A new<br />

value may be assigned with the \setlength comm<strong>and</strong>.<br />

\marginparwidth . . . . . . . . . . . . . . . . . . (4.10.6) – 118<br />

The width of the box reserved for marginal notes. A new value may<br />

be assigned with the \setlength comm<strong>and</strong>.<br />

\markboth{left head}{right head} . . . . . . . . . . . . (3.2.1) – 43<br />

Sets the text entries for the left <strong>and</strong> right page headlines in twosided<br />

formatting when the page style myheadings has been selected,<br />

or when the au<strong>to</strong>matic entries of page style headings are <strong>to</strong> be<br />

changed.<br />

\markright{head} . . . . . . . . . . . . . . . . . . . . (3.2.1) – 43<br />

Sets the text entry for the page headline when the page style<br />

myheadings has been selected, or when the au<strong>to</strong>matic entry of page<br />

style headings is <strong>to</strong> be manually changed. In two-sided formatting,<br />

only the right headline is set with this comm<strong>and</strong>.<br />

\mathbf{text} [m] . . . . . . . . . . . . . (5.4.2), (A.3.3) – 133, 373<br />

This comm<strong>and</strong> sets text in a bold font (\bfseries) within math<br />

mode. Spaces are ignored as usual.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 559<br />

\mathcal{text} [m] . . . . . . . (5.3.2), (5.4.2), (A.3.3) – 125, 133, 373<br />

This comm<strong>and</strong> sets text in calligraphic letters within math mode:<br />

$\mathcal{ABC}$ = ABC.<br />

\mathindent . . . . . . . . . . . . . . . . . . . . . . . (3.1.1) – 40<br />

The indentation of displayed formulas from the left margin when the<br />

option fleqn has been selected. A new value may be assigned with<br />

the \setlength comm<strong>and</strong>:<br />

\setlength{\mathindent}{25pt}<br />

\mathit{text} [m] . . . . . . . . . . . . . (5.4.2), (A.3.3) – 133, 373<br />

This comm<strong>and</strong> sets text in a text italic font (\itshape) within math<br />

mode. It differs from \mathnormal in that the spacing between the<br />

letters is as in regular text. Compare mathit <strong>and</strong> mathnor mal.<br />

\mathnormal{text} [m] . . . . . (5.3.1), (5.4.2), (A.3.3) – 125, 133, 373<br />

This comm<strong>and</strong> sets text in the normal (italic) math font within math<br />

mode. In this font, capital Greek letters are also set in italics:<br />

$\Gamma\mathnormal{\Gamma}$ = Γ Γ .<br />

\mathring{x} [m] . . . . . . . . . . . . . . . . . . . (5.3.9) – 129<br />

A ring accent in mathematical formulas: \mathring{a} = ˚a.<br />

\mathrm{text} [m] . . . . . . . . . . . . . (5.4.2), (A.3.3) – 133, 373<br />

This comm<strong>and</strong> sets text in a Roman font (\rmfamily) within math<br />

mode. Spaces are ignored as usual.<br />

\mathsf{text} [m] . . . . . . . . . . . . . (5.4.2), (A.3.3) – 133, 373<br />

This comm<strong>and</strong> sets text in a sans serif font (\sffamily) within math<br />

mode. Spaces are ignored as usual.<br />

\mathtt{text} [m] . . . . . . . . . . . . . (5.4.2), (A.3.3) – 133, 373<br />

This comm<strong>and</strong> sets text in a typewriter font (\ttfamily) within math<br />

mode. Spaces are ignored as usual.<br />

\mathversion{ver} . . . . . . . . . . . . . . . . . . (A.3.3) – 373<br />

Selects the current math version. Possible values are bold <strong>and</strong><br />

normal; new values may be created with the \DeclareMathVersion<br />

comm<strong>and</strong>.<br />

\max [m] . . . . . . . . . . . . . . . . . . . . . . . . (5.3.8) – 128<br />

Comm<strong>and</strong> <strong>to</strong> produce the function name ‘max’ in formulas. A lower<br />

limit may be set as a subscript.<br />

\mbox{text} produces an LR box around text . . . . . . . (4.7.1) – 86<br />

\mddefault . . . . . . . . . . . . . . . . . . . . . . (A.3.1) – 372<br />

This comm<strong>and</strong> defines the series attribute that is selected with the<br />

\mdseries comm<strong>and</strong>. It may be redefined with \renewcomm<strong>and</strong>:<br />

\renewcomm<strong>and</strong>{\mddefault}{m}


560 Appendix H. Comm<strong>and</strong> Summary<br />

\mdseries . . . . . . . . . . . . . . . . . . (4.1.3), (A.2) – 64, 371<br />

This declaration switches <strong>to</strong> a font in the current family <strong>and</strong> shape,<br />

but with the medium series attribute.<br />

\medskip . . . . . . . . . . . . . . . . . . . . . . . . (2.7.3) – 32<br />

Inserts large vertical spacing of the amount \medskipamount. See<br />

also \bigskip <strong>and</strong> \smallskip.<br />

\medskipamount<br />

St<strong>and</strong>ard value for the amount of vertical spacing that is inserted<br />

with the comm<strong>and</strong> \medskip. May be changed with the \setlength<br />

comm<strong>and</strong>:<br />

\setlength{\medskipamount}{3ex plus1ex minus1ex}<br />

\medspace [m][a] . . . . . . . . . . . . . . . . . . . (12.2.5) – 269<br />

With the amsmath package, this is an alias for \:, a medium space in<br />

a math formula.<br />

\MessageBreak . . . . . . . . . . . . . . . . . . . . (D.2.7) – 446<br />

Forces a new line in the texts of error, warning, <strong>and</strong> information messages.<br />

These are the only places where it may be invoked, otherwise<br />

it does nothing.<br />

\mho [m] produces . . . . . . . . . . . . . . . . . . (5.3.6) – 127<br />

\mid [m] produces | . . . . . . . . . . . . . . . . . . (5.3.4) – 126<br />

\min [m] . . . . . . . . . . . . . . . . . . . . . . . . (5.3.8) – 128<br />

Comm<strong>and</strong> <strong>to</strong> produce the function name ‘min’ in formulas. A lower<br />

limit may be set as a subscript.<br />

\mod{arg} [m][a] . . . . . . . . . . . . . . . . . . . (12.2.5) – 268<br />

With the amsopn or amsmath packages, comm<strong>and</strong> <strong>to</strong> produce the<br />

function name ‘mod’ in formulas in the form:<br />

y\mod{a+b} = y mod a + b<br />

\models [m] produces ⊨ . . . . . . . . . . . . . . . . (5.3.4) – 126<br />

\mp [m] produces ∓ . . . . . . . . . . . . . . . . . . . (5.3.3) – 125<br />

\mspace{mu} [m][a] . . . . . . . . . . . . . . . . . (12.2.5) – 269<br />

With the amsmath package, inserts spacing in math formulas; mu is<br />

a math space in units of mu (=1/18 em): \mspace{-4mu}.<br />

\mu [m] produces µ . . . . . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\multicolumn{n}{col}{text} . . . . . . . . . . . . . . . (4.8.1) – 97<br />

Merges the next n columns in the array <strong>and</strong> tabular environments,<br />

formatting the text entry text according <strong>to</strong> the single column definition<br />

col, which may be l, c, r as well as |.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 561<br />

\multiput(x,y)(∆x,∆y){n}{pic elem} . . . . . . . (13.1.3) – 289<br />

Multiple positioning comm<strong>and</strong> in the picture environment. The<br />

object pic elem is placed n times, at (x, y), (x +∆x, y +∆y), . . . (x +<br />

(n − 1)∆x, y + (n − 1)∆y).<br />

\multlinegap [m][a] . . . . . . . . . . . . . . . . . (12.2.6) – 271<br />

A length that determines the left <strong>and</strong> right margins of formulas<br />

produced with the A M S-L AT E X multline environment; initial value is<br />

10 pt but may be reset by the user.<br />

\nabla [m] produces ∇ . . . . . . . . . . . . . . . . . (5.3.6) – 127<br />

\name{sender} . . . . . . . . . . . . . . . . . . . . . (16.2) – 356<br />

In the letter document class, enters the sender’s name.<br />

\natural [m] produces ♮ . . . . . . . . . . . . . . . . (5.3.6) – 127<br />

\nearrow [m] produces ↗ . . . . . . . . . . . . . . . . (5.3.5) – 127<br />

\NeedsTeXFormat{format}[version] [p] . . . . . . . . (D.2.1) – 440<br />

Declares the T E X format that is necessary for processing the file. This<br />

should be the first statement in the file. At the moment, the only<br />

legitimate value for format is <strong>LaTeX</strong>2e. The version, if included, must<br />

be given as a date in the form yyyy/mm/dd, specifying the earliest<br />

possible release date of the format that is consistent with all the<br />

features employed in the file. Example:<br />

\NeedsTeXFormat{<strong>LaTeX</strong>2e}[1994/06/01]<br />

\neg [m] produces ¬ . . . . . . . . . . . . . . . . . . (5.3.6) – 127<br />

\negmedspace [m][a] . . . . . . . . . . . . . . . . . (12.2.5) – 269<br />

With the amsmath package, this inserts a negative medium space in a<br />

math formula.<br />

\negthickspace [m][a] . . . . . . . . . . . . . . . . (12.2.5) – 269<br />

With the amsmath package, this inserts a negative thick space in a<br />

math formula.<br />

\negthinspace [m][a] . . . . . . . . . . . . . . . . (12.2.5) – 269<br />

With the amsmath package, this is an alias for \!, a negative thin<br />

space in a math formula.<br />

\neq [m] produces ≠ . . . . . . . . . . . . . . . . . . (5.3.4) – 127<br />

\newboolean{switch} . . . . . . . . . . . . . . . . . (8.3.5) – 194<br />

Requires the st<strong>and</strong>ard L AT E X package ifthen. Creates a<br />

new boolean switch. The value of the switch is set with<br />

\setboolean{switch}{value}, where value is true or false. Its<br />

value is tested with \boolean{switch}, which may be used as a logical<br />

statement in the test part of \ifthenelse <strong>and</strong> \whiledo.


562 Appendix H. Comm<strong>and</strong> Summary<br />

\newcomm<strong>and</strong>{com name}[narg][opt]{def } . . . . . . . (8.3) – 185<br />

Defines a user comm<strong>and</strong> with the name \com name <strong>to</strong> be def. The<br />

first optional argument narg ≤ 9 specifies how many variable arguments<br />

the comm<strong>and</strong> is <strong>to</strong> have, which appear in the def as the<br />

replacement characters #1 <strong>to</strong> #narg. If the second optional argument<br />

is present, the first argument of the new comm<strong>and</strong> is optional,<br />

<strong>and</strong> takes on the value opt if it is not explicitly given.<br />

\newcomm<strong>and</strong>*{com name}[narg][opt]{def } . . . . . . (D.2.6) – 445<br />

The same as \newcomm<strong>and</strong> except that the arguments <strong>to</strong> \com name<br />

must be ‘short’, not containing any new paragraphs.<br />

\newcounter{counter name}[in counter] . . . . . . . (8.1.2) – 182<br />

Establishes a new counter with the name counter name. The optional<br />

argument in counter is the name of an existing counter which, when<br />

incremented, resets the new counter <strong>to</strong> zero; that is, the new counter<br />

is a sub-counter of in counter.<br />

\newenvironment{env name}[narg][opt]{beg def }{end def }<br />

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (8.4) – 195<br />

Defines a user environment with the name env name which has the<br />

\begin definition beg def <strong>and</strong> the \end definition end def. The<br />

optional argument narg ≤ 9 specifies how many variable arguments<br />

the environment is <strong>to</strong> have, which appear in the beg def as the<br />

replacement characters #1 <strong>to</strong> #narg. If the second optional argument<br />

is present, the first argument of the \begin comm<strong>and</strong> is optional,<br />

<strong>and</strong> takes on the value opt if it is not explicitly given.<br />

\newenvironment*{env name}[narg][opt]{beg def }{end def }<br />

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . (D.2.6) – 445<br />

The same as \newenvironment except that the arguments <strong>to</strong><br />

\begin{env name} must be ‘short’, not containing any new paragraphs.<br />

\newfont{\font cmd}{\font name scaled size} . . . . . (4.1.5) – 66<br />

Establishes the relation between the font file name file name magnified<br />

by the scaling fac<strong>to</strong>r size <strong>and</strong> a font selection comm<strong>and</strong><br />

\font cmd. After \font cmd has been called, \baselineskip, the<br />

interline spacing, still has its previous value.<br />

\newlength{\length cmd} . . . . . . . . . . . . . . . . (8.2) – 185<br />

Creates a new length comm<strong>and</strong> with the name \length cmd <strong>and</strong><br />

initializes it <strong>to</strong> 0 pt. New values may be assigned as for all length<br />

comm<strong>and</strong>s with the \setlength comm<strong>and</strong>:<br />

\setlength{\length cmd}{length}<br />

The quantity length must have units (cm, pt, etc.) <strong>and</strong> may be a<br />

rubber length.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 563<br />

\newline . . . . . . . . . . . . . . . . . . . . . . . . (2.7.2) – 31<br />

Terminates <strong>and</strong> starts a line of text without right justifying it.<br />

\newpage . . . . . . . . . . . . . . . . . . . . . . . . (2.7.4) – 33<br />

Terminates <strong>and</strong> starts a new page, leaving the rest of the page blank.<br />

\newsavebox{\boxname} . . . . . . . . . . . . . . . . (4.7.1) – 87<br />

Creates a s<strong>to</strong>rage box with the name \boxname in which LR boxes<br />

may be saved with the \savebox comm<strong>and</strong>.<br />

\newtheorem{type}[num like]{title}<br />

\newtheorem{type}{title}[in ctr] . . . . . . . . . . . . (4.5) – 80<br />

Defines a new theorem-like environment named type which when<br />

called prints a theorem declaration with the name title in bold face,<br />

followed by an au<strong>to</strong>matic sequential number, <strong>and</strong> the actual text of<br />

the environment in italic. The optional argument num like is the<br />

name of another theorem structure which is <strong>to</strong> share the same numbering<br />

counter. The other optional argument in ctr is the name of a<br />

sectioning counter, such as chapter, which is <strong>to</strong> reset the theorem<br />

counter every time it is incremented. That is, the theorem counter is<br />

a sub-counter of in ctr. Only one of the optional arguments may be<br />

given.<br />

\NG . . . . . . . . . . . . . . . . . . . . . . . . . . (G.4.5) – 503<br />

When T1 encoding is active, prints the character Ŋ.<br />

\ng . . . . . . . . . . . . . . . . . . . . . . . . . . (G.4.5) – 503<br />

When T1 encoding is active, prints the character ŋ.<br />

\ni [m] produces ∋ . . . . . . . . . . . . . . . . . . . (5.3.4) – 126<br />

\nocite{key} . . . . . . . . . . . . . . . . . . . . . (14.1) – 310<br />

The entry in the literature database with the keyword key will be<br />

included in the bibliography without any citation (reference) in the<br />

text. With \nocite{*}, all entries in all databases will be included.<br />

\nofiles [p] . . . . . . . . . . . . . . . . . . . . . . . (B.6) – 396<br />

Issued in the preamble, this comm<strong>and</strong> suppresses the output of the<br />

auxiliary files.aux,.glo,.idx,.lof,.lot, <strong>and</strong>.<strong>to</strong>c.<br />

\noindent . . . . . . . . . . . . . . . . . . . . . . . . (3.2.4) – 46<br />

The first line of the next paragraph will not be indented.<br />

\nolimits [m] . . . . . . . . . . . . . . . . . . . . . (5.3.7) – 128<br />

Places the upper <strong>and</strong> lower limits after the appropriate symbols where<br />

these would normally go just above or below them.


564 Appendix H. Comm<strong>and</strong> Summary<br />

\nolinebreak[n] . . . . . . . . . . . . . . . . . . . . (2.7.2) – 32<br />

A recommendation not <strong>to</strong> break the line of text at this point. The<br />

urgency of the recommendation is given by the integral number<br />

n between 0 <strong>and</strong> 4, with the higher numbers meaning a stronger<br />

recommendation. A value of 4 is the same as the comm<strong>and</strong> without<br />

the optional argument <strong>and</strong> means absolutely no line break here.<br />

\nonfrenchspacing . . . . . . . . . . . . . . . . . . . (2.7.1) – 29<br />

Counterm<strong>and</strong>s \frenchspacing, switching back <strong>to</strong> the st<strong>and</strong>ard formatting<br />

in which extra word spacing is inserted at the end of a<br />

sentence.<br />

\nonumber [m] . . . . . . . . . . . . . . . . . . . . . (5.4.7) – 139<br />

The formula line in an eqnarray environment in which this comm<strong>and</strong><br />

appears will not contain an equation number.<br />

\nopagebreak[n] . . . . . . . . . . . . . . . . . . . . (2.7.4) – 33<br />

A recommendation not <strong>to</strong> break the page at this point. The urgency of<br />

the recommendation is given by the integral number n between 0 <strong>and</strong><br />

4, with the higher numbers meaning a stronger recommendation. A<br />

value of 4 is the same as the comm<strong>and</strong> without the optional argument<br />

<strong>and</strong> means absolutely no page break here.<br />

\normalcolor . . . . . . . . . . . . . . . . . . . . . . (6.2) – 167<br />

A comm<strong>and</strong> that normally does nothing. However, if the color<br />

package has been loaded, it resets the color for text <strong>to</strong> be the color<br />

that was in effect at the end of the preamble, normally black. A<br />

\color comm<strong>and</strong> in the preamble can alter this ‘st<strong>and</strong>ard’ color.<br />

This comm<strong>and</strong> is called by many internal L AT E X macros, <strong>to</strong> reset<br />

the text color when printing headlines <strong>and</strong> headings. Other packages<br />

should also use it so that they are consistent with the color package.<br />

\normalfont . . . . . . . . . . . . . . . . . (4.1.3), (A.2) – 65, 371<br />

This declaration switches <strong>to</strong> the font with the default family, shape,<br />

<strong>and</strong> series attributes.<br />

\normalmarginpar . . . . . . . . . . . . . . . . . . (4.10.5) – 117<br />

Counterm<strong>and</strong>s \reversemarginpar, switching back <strong>to</strong> the st<strong>and</strong>ard<br />

placement of marginal notes in the ‘outer’ margin.<br />

\normalsize . . . . . . . . . . . . . . . . . . . . . . . (4.1.2) – 62<br />

Switches <strong>to</strong> the font size \normalsize, the size selected by the<br />

option in the \documentclass or \documentstyle comm<strong>and</strong>s. It is<br />

smaller than \large but larger than \small.<br />

\not [m] . . . . . . . . . . . . . . . . . . . . . . . . (5.3.4) – 127<br />

Changes the following comparison symbol in<strong>to</strong> its negative counterpart:<br />

\not\cong = ≅


H.1. Brief description of the L AT E X comm<strong>and</strong>s 565<br />

\notag{mark} [m][a] . . . . . . . . . . . . . . . . . (12.2.6) – 271<br />

Within one of the A M S-L AT E X alignment environments, suppresses<br />

the au<strong>to</strong>matic equation number.<br />

\notin [m] produces ∉ . . . . . . . . . . . . . . . . . (5.3.4) – 127<br />

\nu [m] produces ν . . . . . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\numberwithin{ctr}{in ctr} [a] . . . . . . . . . . . (12.2.7) – 277<br />

With the amsmath package, redefines the counter ctr <strong>to</strong> be a subcounter<br />

of in ctr, meaning it is reset every time in ctr is incremented.<br />

The value of in ctr is printed with that of ctr. This is normally used<br />

<strong>to</strong> make equations in an article <strong>to</strong> be numbered within sections:<br />

\numberwithin{equation}{section}<br />

\nwarrow [m] produces ↖ . . . . . . . . . . . . . . . . (5.3.5) – 127<br />

\O produces Ø . . . . . . . . . . . . . . . . . . . . . . (2.5.6) – 24<br />

\o produces ø . . . . . . . . . . . . . . . . . . . . . . . (2.5.6) – 24<br />

\oddsidemargin . . . . . . . . . . . . . . . . . . . . . (3.2.5) – 48<br />

Sets the left margin for the odd-numbered pages in document class<br />

book or when the option twoside has been selected for other classes.<br />

In all other cases, it sets the left margin for all pages. A new value is<br />

assigned with the \setlength comm<strong>and</strong>:<br />

\setlength{\evensidemargin}{1.5cm}<br />

\odot [m] produces ⊙ . . . . . . . . . . . . . . . . . (5.3.3) – 125<br />

\OE produces Π. . . . . . . . . . . . . . . . . . . . . . (2.5.6) Р24<br />

\oe produces œ . . . . . . . . . . . . . . . . . . . . . . (2.5.6) – 24<br />

\oint [m] produces . . . . . . . . . . . . . . . . . . (5.3.7) – 128<br />

\Omega [m] produces Ω . . . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\omega [m] produces ω . . . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\ominus [m] produces ⊖ . . . . . . . . . . . . . . . . (5.3.3) – 125<br />

\onecolumn . . . . . . . . . . . . . . . . . . . . . . . (3.2.7) – 51<br />

Starts a new page <strong>and</strong> switches from two-column <strong>to</strong> one-column page<br />

formatting.<br />

\onlynotes{note nums} . . . . . . . . . . . . . . . (15.1.3) – 327<br />

In slides class, a comm<strong>and</strong> <strong>to</strong> be issued in the preamble <strong>to</strong> generate<br />

only those notes whose numbers appear in note nums. The comm<strong>and</strong><br />

behaves the same as \onlyslides for slides.<br />

\onlyslides{slide nums} . . . . . . . . . . . . . . (15.1.3) – 327<br />

In slides class, a comm<strong>and</strong> <strong>to</strong> be issued in the preamble <strong>to</strong> generate<br />

only those slides whose numbers appear in slide nums. The numbers<br />

are separated by commas, <strong>and</strong> may include a range with a hyphen:<br />

\onlyslides{4,10-13,23}.


566 Appendix H. Comm<strong>and</strong> Summary<br />

\opening{dear} . . . . . . . . . . . . . . . . . . . . (16.1) – 353<br />

In the letter environment of the letter class, this sets the<br />

form of the salutation at the start of the letter text; for example,<br />

\opening{Dear George,}.<br />

\oplus [m] produces ⊕ . . . . . . . . . . . . . . . . . (5.3.3) – 125<br />

\OptionNotUsed [p] . . . . . . . . . . . . . . . . . . (D.2.3) – 443<br />

A comm<strong>and</strong> that may only be used in the definition of options,<br />

especially default options. It declares the \CurrentOption <strong>to</strong> be<br />

unprocessed. This is used if the processing of a default option<br />

should fail, say because some file is missing. L AT E X is then informed<br />

that this requested option is still outst<strong>and</strong>ing.<br />

\oslash [m] produces ⊘ . . . . . . . . . . . . . . . . (5.3.3) – 125<br />

\otimes [m] produces ⊗ . . . . . . . . . . . . . . . . (5.3.3) – 125<br />

\oval(x dimen,y dimen)[part] . . . . . . . . . . . (13.1.4) – 296<br />

Picture element comm<strong>and</strong> <strong>to</strong> produce an oval with width x dimen<br />

<strong>and</strong> height y dimen in the picture environment. The optional part<br />

argument may take on values of t, b, l, <strong>and</strong> r <strong>to</strong> draw only the <strong>to</strong>p,<br />

bot<strong>to</strong>m, left, or right halves of the oval. A combination of these<br />

values may be given <strong>to</strong> draw only a quarter of the oval, such as tl<br />

or lt for the <strong>to</strong>p left part. To be used as an argument in a \put or<br />

\multiput comm<strong>and</strong>.<br />

\ovalbox{text} . . . . . . . . . . . . . . . . . . . . . (4.7.9) – 94<br />

With the fancybox package, is a variant of \fbox, drawing a framed<br />

box with round corners around text; the thickness of the lines is<br />

given by \thinlines.<br />

\Ovalbox{text} . . . . . . . . . . . . . . . . . . . . . (4.7.9) – 94<br />

With the fancybox package, is the same as \ovalbox but the thickness<br />

of the lines is given by \thicklines.<br />

\overbrace{sub form} [m] . . . . . . . . . . . . . . . (5.4.4) – 136<br />

Produces a horizontal curly brace over the math formula sub form.<br />

Any following superscript will be placed centered above the horizon-<br />

tal brace.<br />

\overbrace{a+b} =<br />

<br />

a + b<br />

\overbrace{x+y+z}ˆ{\xi\eta\zeta} =<br />

ξηζ<br />

<br />

x + y + z<br />

\overleftarrow{expr} [m][a] . . . . . . . . . . . . (12.2.2) – 262<br />

With the amsmath package, places a long leftwards pointing arrow<br />

over the mathematical expression expr.<br />

\overleftrightarrow{expr} [m][a] . . . . . . . . . (12.2.2) – 262<br />

With the amsmath package, places a long double arrow over the<br />

mathematical expression expr.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 567<br />

\overline{sub form} [m] . . . . . . . . . . . . . . . (5.4.4) – 136<br />

Produces a horizontal bar over the math formula sub form:<br />

\overline{a-b} = a − b<br />

\overrightarrow{expr} [m][a] . . . . . . . . . . . . (12.2.2) – 262<br />

With the amsmath package, places a long rightwards pointing arrow<br />

over the mathematical expression expr.<br />

\overset{char}{\symbol} [m][a] . . . . . . . . . . . (12.2.2) – 262<br />

With the amsmath package, places char over the math symbol \symbol<br />

in superscript size.<br />

\P produces . . . . . . . . . . . . . . . . . . . . . . . (2.5.5) – 23<br />

\PackageError{pkg name}{error text}{help} [p] . . . . (D.2.7) – 446<br />

Writes an error message error text <strong>to</strong> the moni<strong>to</strong>r <strong>and</strong> transcript file,<br />

labeled with the package name, <strong>and</strong> halts processing, waiting for a<br />

user response as for a L AT E X error. If H〈return〉 is typed, the help text is<br />

printed. Both error text <strong>and</strong> help may contain \MessageBreak for a<br />

new line, \space for a forced space, <strong>and</strong> \protect before comm<strong>and</strong>s<br />

that are <strong>to</strong> have their names printed literally <strong>and</strong> not interpreted.<br />

\PackageInfo{pkg name}{info text} [p] . . . . . . . . (D.2.7) – 447<br />

Is like \PackageWarningNoLine except that the text info text is only<br />

written <strong>to</strong> the transcript file, <strong>and</strong> not <strong>to</strong> the moni<strong>to</strong>r.<br />

\PackageWarning{pkg name}{warn text} [p] . . . . . . (D.2.7) – 446<br />

Writes warn text <strong>to</strong> the moni<strong>to</strong>r <strong>and</strong> transcript file, labeled with<br />

the package name <strong>and</strong> the current line number of the input file.<br />

Processing continues. The warn text is formatted in the same way as<br />

that for \PackageError.<br />

\PackageWarningNoLine{pkg name}{warn text} [p] . . (D.2.7) – 446<br />

Is like \PackageWarning except that the current line number of the<br />

input file is not printed.<br />

\pagebreak[n] . . . . . . . . . . . . . . . . . . . . . (2.7.4) – 33<br />

A recommendation <strong>to</strong> break the page at this point. The urgency of<br />

the recommendation is given by the integral number n between 0 <strong>and</strong><br />

4, with the higher numbers meaning a stronger recommendation. A<br />

value of 4 is the same as the comm<strong>and</strong> without the optional argument<br />

<strong>and</strong> means an obliga<strong>to</strong>ry page break.<br />

\pagecolor col spec . . . . . . . . . . . . . . . . . . . (6.2) – 167<br />

A comm<strong>and</strong> made available with the color package. Sets the background<br />

color starting with the current page. All following pages have<br />

the same background color until \pagecolor is called once more.<br />

The col spec is the same as for \color.


568 Appendix H. Comm<strong>and</strong> Summary<br />

\pagename . . . . . . . . . . . . . . . . . . . . . . . (D.4.1) – 460<br />

Comm<strong>and</strong> in the letter document class containing the text for page<br />

numbers after the first page. In English, this is ‘Page’ but may be<br />

altered for adaptation <strong>to</strong> other languages.<br />

\pagenumbering{style} . . . . . . . . . . . . . . . . . (3.2.3) – 45<br />

Determines the style of the page numbering <strong>and</strong> resets the page<br />

counter <strong>to</strong> 1. Possible values for style are: arabic, roman, Roman,<br />

alph, <strong>and</strong> Alph.<br />

\pageref{marker} . . . . . . . . . . . . . . . . . . . (9.2.1) – 213<br />

Prints the number of the page where marker has been set by a<br />

\label{marker} comm<strong>and</strong>.<br />

\pagestyle{style} [p] . . . . . . . . . . . . . . . . . . (3.2) – 42<br />

Determines the page style, that is, the contents of the head <strong>and</strong><br />

footlines on every page. Possible values for style are: plain, empty,<br />

headings, <strong>and</strong> myheadings.<br />

\path{direc<strong>to</strong>ry} . . . . . . . . . . . . . . . . . . . . (4.9.2) – 112<br />

With the url package, prints direc<strong>to</strong>ry literally, in typewriter font,<br />

with line breaks after non-letters, without hyphens. It functions<br />

much the same as the \url comm<strong>and</strong>, but is logically distinct since<br />

it is encoding something different.<br />

\paperheight . . . . . . . . . . . . . . . . . . . . . . (3.2.5) – 48<br />

The <strong>to</strong>tal height of the page as specified by the page size option in<br />

the \documentclass comm<strong>and</strong> line. With the default lettersize<br />

option, this is 11 in; with a4paper, it is 29.7 cm. The additional<br />

option l<strong>and</strong>scape interchanges the values of \paperwidth <strong>and</strong><br />

\paperheight.<br />

\paperwidth . . . . . . . . . . . . . . . . . . . . . . . (3.2.5) – 48<br />

The <strong>to</strong>tal width of the page as specified by the page size option in<br />

the \documentclass comm<strong>and</strong> line. With the default lettersize<br />

option, this is 8.5 in; with a4paper, it is 21 cm. The additional<br />

option l<strong>and</strong>scape interchanges the values of \paperwidth <strong>and</strong><br />

\paperheight.<br />

\par . . . . . . . . . . . . . . . . . . . . . . . . . . . (2.5.1) – 23<br />

Ends the current paragraph <strong>and</strong> begins a new one. This comm<strong>and</strong> is<br />

equivalent <strong>to</strong> a blank line.<br />

\paragraph[short title]{title} . . . . . . . . . . . . . . (3.3.3) – 55<br />

The second last comm<strong>and</strong> in the sectioning hierarchy, coming between<br />

\subsubsection <strong>and</strong> \subparagraph. It formats title with<br />

the current sub-subsection number <strong>and</strong> an au<strong>to</strong>matic sequential paragraph<br />

number. If the optional short title is given, it appears in place<br />

of title in the table of contents.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 569<br />

\paragraph*{title} . . . . . . . . . . . . . . . . . . . . (3.3.3) – 55<br />

The same as \paragraph but without a number or an entry in the<br />

table of contents.<br />

\parallel [m] produces . . . . . . . . . . . . . . . (5.3.4) – 126<br />

\parbox[pos][height][inner pos]{width}{text} (4.7.3), (4.7.5) – 88, 90<br />

Produces a vertical box of width width in which text is set in lines<br />

that are left <strong>and</strong> right justified <strong>to</strong> this width. The vertical positioning<br />

with respect <strong>to</strong> the surrounding text is determined by the optional<br />

argument pos: t for alignment with its <strong>to</strong>p line, b with its bot<strong>to</strong>m<br />

line, <strong>and</strong> centered with no argument. The two additional optional<br />

arguments: height <strong>to</strong> give the <strong>to</strong>tal height, <strong>and</strong> inner pos <strong>to</strong> specify<br />

how the text is <strong>to</strong> be positioned inside it. Possible values are t for <strong>to</strong>p,<br />

b for bot<strong>to</strong>m, c for centered, <strong>and</strong> s <strong>to</strong> be stretched out <strong>to</strong> fill the whole<br />

vertical space. The default is the value of the external positioning pos<br />

option. The height argument may contain the parameters \height,<br />

\depth, \width, <strong>and</strong> \<strong>to</strong>talheight.<br />

\parindent . . . . . . . . . . . . . . . . . . . . . . . (3.2.4) – 46<br />

The amount of indentation for the first line of a paragraph. A new<br />

value may be assigned with the \setlength comm<strong>and</strong>:<br />

\setlength{\parindent}{1.5em}<br />

\parsep . . . . . . . . . . . . . . . . . . . . . . . . . (4.4.2) – 76<br />

The vertical spacing between paragraphs within a list environment.<br />

A new value may be assigned with the \setlength comm<strong>and</strong>:<br />

\setlength{\parsep}{2pt plus1pt minus1pt}<br />

\parskip . . . . . . . . . . . . . . . . . . . . . . . . (3.2.4) – 46<br />

The vertical spacing between paragraphs. A new value may be assigned<br />

with the \setlength comm<strong>and</strong>:<br />

\setlength{\parskip}{3pt plus1pt minus2pt}<br />

\part[short title]{title} . . . . . . . . . . . . . . . . . (3.3.3) – 55<br />

The highest comm<strong>and</strong> in the sectioning hierarchy. It begins a new<br />

‘Part’ with an au<strong>to</strong>matic sequential part number <strong>and</strong> the heading<br />

title. The following sectioning numbers are not influenced by the<br />

part number. If the optional short title is given, it appears in place of<br />

title in the table of contents.<br />

\part*{title} . . . . . . . . . . . . . . . . . . . . . . . (3.3.3) – 55<br />

The same as \part but without a number or an entry in the table of<br />

contents.<br />

\partial [m] produces ∂ . . . . . . . . . . . . . . . . (5.3.6) – 127<br />

\partname . . . . . . . . . . . . . . . . . . . . . . . (D.4.1) – 460<br />

Comm<strong>and</strong> containing the part heading. In English, this is ‘Part’ but<br />

may be altered for adaptation <strong>to</strong> other languages.


570 Appendix H. Comm<strong>and</strong> Summary<br />

\par<strong>to</strong>psep . . . . . . . . . . . . . . . . . . . . . . . (4.4.2) – 75<br />

The additional vertical spacing at the beginning <strong>and</strong>/or end of a listing<br />

when a blank line precedes or follows the environment comm<strong>and</strong>s.<br />

A new value may be assigned with the \setlength comm<strong>and</strong>:<br />

\setlength{\par<strong>to</strong>psep}{2pt plus1pt minus1pt}<br />

\PassOptionsToClass{options}{class} [p] . . . . . . . (D.2.3) – 443<br />

Assigns the options in the list options <strong>to</strong> the specified class file, which<br />

is later loaded with \LoadClass. This comm<strong>and</strong> must be called from<br />

a class file, or from another file input by a class file. It may be used in<br />

the definition of options, or in a configuration file <strong>to</strong> activate options.<br />

\PassOptionsToPackage{options}{package} [p] . . . . (D.2.3) – 443<br />

Assigns the options in the list options <strong>to</strong> the specified package file,<br />

which is later loaded with \RequirePackage. This comm<strong>and</strong> may be<br />

called from a class or package file. It may be used in the definition<br />

of options, or in a configuration file <strong>to</strong> activate certain options.<br />

\perp [m] produces ⊥ . . . . . . . . . . . . . . . . . (5.3.4) – 126<br />

\Phi [m] produces Φ . . . . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\phi [m] produces φ . . . . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\Pi [m] produces Π . . . . . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\pi [m] produces π . . . . . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\pm [m] produces ± . . . . . . . . . . . . . . . . . . . (5.3.4) – 126<br />

\pmb{symbol} [m][a] . . . . . . . . . . . . . . . . . (12.2.1) – 258<br />

When one of the packages amsmath or amsbsy has been loaded, this<br />

comm<strong>and</strong> prints symbol in simulated bold face. This is done by<br />

printing it several times slightly displaced.<br />

\pmod{arg} [m] . . . . . . . . . . . . . (5.3.8), (12.2.5) – 129, 268<br />

Comm<strong>and</strong> <strong>to</strong> produce the function name ‘mod’ in formulas in the<br />

form:<br />

y\pmod{a+b} = y (mod a + b)<br />

\pod{arg} [m][a] . . . . . . . . . . . . . . . . . . . (12.2.5) – 268<br />

With the amsopn or amsmath packages, comm<strong>and</strong> <strong>to</strong> produce the<br />

function name ‘mod’ in formulas in the form:<br />

y\pod{a+b} = y (a + b)<br />

\poptabs . . . . . . . . . . . . . . . . . . . . . . . . (4.6.4) – 83<br />

Res<strong>to</strong>res the last set of tabular s<strong>to</strong>ps in the tabbing environment<br />

that has been saved with \pushtabs.<br />

\pounds produces £ . . . . . . . . . . . . . . . . . . . . (2.5.5) – 23<br />

\Pr [m] . . . . . . . . . . . . . . . . . . . . . . . . . (5.3.8) – 128<br />

Comm<strong>and</strong> <strong>to</strong> produce the function name ‘Pr’ in formulas. A lower<br />

limit may be set as a subscript.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 571<br />

\prec [m] produces ≺ . . . . . . . . . . . . . . . . . (5.3.4) – 126<br />

\preceq [m] produces . . . . . . . . . . . . . . . . (5.3.4) – 126<br />

\prime [m] produces ′ (identical <strong>to</strong> the ’ symbol) . . . . (5.3.6) – 127<br />

\printindex . . . . . . . . . . . . . . . . . . . . . . (9.4.3) – 228<br />

A comm<strong>and</strong> defined in the makeidx.sty file that generates theindex<br />

environment after the program MakeIndex has processed the.idx file.<br />

\ProcessOptions [p] . . . . . . . . . . . . . . . . . . (D.2.3) – 443<br />

In a class or package file, this comm<strong>and</strong> processes the requested<br />

options by executing the \ds@ comm<strong>and</strong>s for each one in the order<br />

in which they were defined. The \ds@ comm<strong>and</strong>s are then erased.<br />

\ProcessOptions* [p] . . . . . . . . . . . . . . . . . (D.2.3) – 443<br />

This is the same as \ProcessOptions except that the \ds@ comm<strong>and</strong>s<br />

are executed in the order in which the options were requested.<br />

\prod [m] produces . . . . . . . . . . . . . . . . . (5.3.7) – 128<br />

\prop<strong>to</strong> [m] produces ∝ . . . . . . . . . . . . . . . . (5.3.4) – 126<br />

\protect . . . . . . . . . . . . . . . . . . . . . . . (D.2.5) – 445<br />

Fragile comm<strong>and</strong>s may be used in moving arguments when they are<br />

preceded by the \protect comm<strong>and</strong>. Example:<br />

\section{The \protect\pounds{} Sign}.<br />

\providecomm<strong>and</strong>{\com name}[narg][opt]{def } . . . (8.3.1) – 187<br />

The same as \newcomm<strong>and</strong> except that if a comm<strong>and</strong> with the name<br />

\com name already exists, the new definition is ignored.<br />

\providecomm<strong>and</strong>*{\com name}[narg][opt]{def } . . . (D.2.6) – 445<br />

The same as \providecomm<strong>and</strong> except that the arguments <strong>to</strong><br />

\com name must be ‘short’, not containing any new paragraphs.<br />

\ProvidesClass{class}[version] [p] . . . . . . . . . . (D.2.1) – 441<br />

At the beginning of a class file, this statement declares the name of<br />

the class <strong>and</strong> its version, <strong>to</strong> be checked against the name <strong>and</strong> version<br />

in the \documentclass or \LoadClass comm<strong>and</strong> that input it. The<br />

version specification, if present, consists of three parts: date, version<br />

number, <strong>and</strong> additional information. Example:<br />

\ProvidesClass{thesis}[1995/01/25 v3.8 U of Saigon]<br />

\ProvidesFile{file name}[version] . . . . . . . . . . (D.2.1) – 442<br />

At the beginning of a general file, this statement declares its name<br />

<strong>and</strong> version. No checking is done when the file is read in with<br />

\input, but the information is printed out if \listfiles has been<br />

activated. This comm<strong>and</strong> is not limited <strong>to</strong> the preamble as the other<br />

\Provides.. comm<strong>and</strong>s are.


572 Appendix H. Comm<strong>and</strong> Summary<br />

\ProvidesPackage{class}[version] [p] . . . . . . . . . (D.2.1) – 441<br />

At the beginning of a package file, this statement declares the name<br />

of the package <strong>and</strong> its version, <strong>to</strong> be checked against the name <strong>and</strong><br />

version in the \usepackage or \RequirePackage comm<strong>and</strong> that<br />

input it. The version specification, if present, consists of three parts:<br />

date, version number, <strong>and</strong> additional information. Example:<br />

\ProvidesPackage{notes}[1995/02/13 1.2 G. Smith]<br />

\ProvideTextComm<strong>and</strong>{\cmd}{code}[narg][opt]{def } [p]<br />

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . (A.3.7) – 379<br />

Defines \cmd in the same way as \providecomm<strong>and</strong> except the definition<br />

is only valid when encoding code is active. If the comm<strong>and</strong><br />

\cmd is already defined for that encoding, it is not redefined.<br />

\ProvideTextComm<strong>and</strong>Default{\cmd}{code}[narg][opt]{def } [p]<br />

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . (A.3.7) – 380<br />

Is the same as \DeclareTextComm<strong>and</strong>Default except that if a default<br />

encoding definition already exists for \cmd, then no redefinition<br />

occurs <strong>and</strong> the previous definition is retained.<br />

\ps text . . . . . . . . . . . . . . . . . . . . . . . . (16.1) – 353<br />

Adds a postscript <strong>to</strong> a letter in the letter document class.<br />

\Psi [m] produces Ψ . . . . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\psi [m] produces ψ . . . . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\pushtabs . . . . . . . . . . . . . . . . . . . . . . . . (4.6.4) – 83<br />

Saves the current set of tabula<strong>to</strong>r s<strong>to</strong>ps in the tabbing environment.<br />

It may be recalled with the \poptabs comm<strong>and</strong>.<br />

\put(x,y){pic elem} . . . . . . . . . . . . . . . . . (13.1.3) – 289<br />

The positioning comm<strong>and</strong> within a picture environment. The picture<br />

element pic elem is placed with its reference point at the location<br />

(x, y).<br />

\qbezier[num](x1,y1)(x2,y2)(x3,y3) . . . . . . (13.1.4) – 299<br />

This comm<strong>and</strong> can be given within the picture environment <strong>to</strong><br />

draw a quadratic Bézier curve from point (x1,y1) <strong>to</strong> (x3,y3), using<br />

(x2,y2) as the extra Bézier point. The curve is drawn as num +<br />

1 dots if the optional argument num is given, otherwise num is<br />

calculated au<strong>to</strong>matically <strong>to</strong> produce a solid line. It is the same as<br />

\bezier except that num is optional.<br />

\quad . . . . . . . . . . . . . . . . . . . . . . . . . . (2.7.1) – 30<br />

Inserts horizontal spacing of size 1 em.<br />

\qquad . . . . . . . . . . . . . . . . . . . . . . . . . . (2.7.1) – 30<br />

Inserts horizontal spacing of size 2 em.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 573<br />

\quotedblbase . . . . . . . . . . . . . . . . . . . . (G.4.5) – 503<br />

When T1 encoding is active, prints the symbol „.<br />

\quotesinglbase . . . . . . . . . . . . . . . . . . . (G.4.5) – 503<br />

When T1 encoding is active, prints the symbol ‚.<br />

\r{x} . . . . . . . . . . . . . . . . . . . . . . . . . . (2.5.7) – 24<br />

Produces a circle accent: \r{o} = ˚o.<br />

\raggedbot<strong>to</strong>m . . . . . . . . . . . . . . . . . . . . . (3.2.5) – 48<br />

The st<strong>and</strong>ard page formatting for article, report, <strong>and</strong> letter<br />

document classes when the twoside option has not been selected.<br />

The spacing between paragraphs is fixed so that the last line will vary<br />

from page <strong>to</strong> page. The opposite comm<strong>and</strong> is \flushbot<strong>to</strong>m.<br />

\raggedleft . . . . . . . . . . . . . . . . . . . . . . . (4.2.2) – 67<br />

After this declaration, the lines of text will only be right justified <strong>and</strong><br />

the left margin will be uneven. The individual lines are terminated<br />

by \\. See also \begin{flushright}.<br />

\raggedright . . . . . . . . . . . . . . . . . . . . . . (4.2.2) – 67<br />

After this declaration, the lines of text will only be left justified <strong>and</strong><br />

the right margin will be uneven. The individual lines are terminated<br />

by \\. See also \begin{flushleft}.<br />

\raisebox{lift}[height][depth]{text} . . . . . . . . . . (4.7.2) – 87<br />

An LR box containing text is raised an amount lift above the current<br />

baseline. If lift is negative, the box is lowered. The optional arguments<br />

state that it is <strong>to</strong> be treated as though it extended by height<br />

above <strong>and</strong> by depth below the baseline regardless of its true extents.<br />

\raisetag{len} [m][a] . . . . . . . . . . . . . . . . (12.2.6) – 271<br />

Within one of the A M S-L AT E X alignment environments, raises the<br />

equation number or marker by len above its normal position.<br />

\rangle [m] produces 〉 . . . . . . . . . . . . . . . . . (5.4.1) – 132<br />

\rceil [m] produces ⌉ . . . . . . . . . . . . . . . . . (5.4.1) – 132<br />

\Re [m] produces ℜ . . . . . . . . . . . . . . . . . . (5.3.6) – 127<br />

\ref{marker} . . . . . . . . . . . . . . . . . . . . . (9.2.1) – 213<br />

Prints the number of the section, equation, figure, or table where<br />

marker has been set by a \label{marker} comm<strong>and</strong>.<br />

\reflectbox{text} . . . . . . . . . . . . . . . . . . . (6.1.2) – 156<br />

A comm<strong>and</strong> made available with the graphics package that reflects<br />

the contents text as an LR box such that left <strong>and</strong> right are reversed.


574 Appendix H. Comm<strong>and</strong> Summary<br />

\refname . . . . . . . . . . . . . . . . . . . . . . . (D.4.1) – 460<br />

Comm<strong>and</strong> containing the heading for the bibliography in article<br />

document class. In English, this is ‘References’ but may be altered<br />

for adaptation <strong>to</strong> other languages.<br />

\refstepcounter{counter} . . . . . . . . . . . . . . (8.1.3) – 182<br />

Increases the value of the number s<strong>to</strong>red in counter by one, the same<br />

as \stepcounter, but also makes the specified counter the relevant<br />

one for the \label–\ref cross-referencing comm<strong>and</strong>s.<br />

\renewcomm<strong>and</strong>{com name}[narg][opt]{def } . . . . . . (8.3) – 185<br />

The same as \newcomm<strong>and</strong> except that the comm<strong>and</strong> \com name<br />

must already exist, otherwise an error message is printed.<br />

\renewcomm<strong>and</strong>*{com name}[narg][opt]{def } . . . . (D.2.6) – 445<br />

The same as \renewcomm<strong>and</strong> except that the arguments <strong>to</strong><br />

\com name must be ‘short’, not containing any new paragraphs.<br />

\renewenvironment{env}[narg][opt]{beg}{end} . . . . (8.4) – 195<br />

The same as \newenvironment except that the environment env<br />

must already exist, otherwise an error message is printed.<br />

\renewenvironment*{env}[narg][opt]{beg}{end} . . (D.2.6) – 445<br />

The same as \renewenvironment except that the arguments <strong>to</strong><br />

\begin{env} must be ‘short’, not containing any new paragraphs.<br />

\RequirePackage[options]{packages}[version] [p] . . . (D.2.2) – 442<br />

This comm<strong>and</strong> is the equivalent of \usepackage within a class or<br />

package file. It loads one or more package files with the extension<br />

.sty. More than one package may be specified in packages, the names<br />

being separated by commas. Any options listed will be applied <strong>to</strong> all<br />

packages. Furthermore, any options listed in the \documentclass<br />

comm<strong>and</strong> will also be applied <strong>to</strong> the package files.<br />

The optional version is a date, given in the form yyyy/mm/dd, as for<br />

example 1994/08/01. If the date of the package file is earlier than<br />

this, a warning message is printed.<br />

\RequirePackageWithOptions{package}[version] [p] . (D.2.2) – 442<br />

Like \RequirePackage except all the currently specified options are<br />

au<strong>to</strong>matically passed <strong>to</strong> package.<br />

\resizebox{h length}{v length}{text} . . . . . . . . . (6.1.2) – 156<br />

A comm<strong>and</strong> made available with the graphics package that scales<br />

the contents text as an LR box such that the horizontal size becomes<br />

h length <strong>and</strong> the vertical size v length. If either size is given as !, the<br />

one scale fac<strong>to</strong>r is applied <strong>to</strong> both dimensions.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 575<br />

\resizebox*{h length}{v length}{text} . . . . . . . . . (6.1.2) – 156<br />

The same as \resizebox except that the vertical size v length refers<br />

<strong>to</strong> the <strong>to</strong>tal height plus depth of the LR box.<br />

\reversemarginpar . . . . . . . . . . . . . . . . . (4.10.5) – 117<br />

Changes the placement of marginal notes from the st<strong>and</strong>ard (right<br />

or ‘outer’ margin) <strong>to</strong> the opposite side. Can be counterm<strong>and</strong>ed with<br />

\normalmarginpar.<br />

\rfloor [m] produces ⌋ . . . . . . . . . . . . . . . . . (5.4.1) – 132<br />

\rhd [m] produces ⊲ . . . . . . . . . . . . . . . . . . (5.3.3) – 125<br />

\rho [m] produces ρ . . . . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\rightrbrack [m] . . . . . . . . . . . . . . . . . . . . (5.4.1) – 131<br />

Adjusts the size of the bracket symbol rbrack <strong>to</strong> fit the height of<br />

the formula between the \left ... \right pair. For example,<br />

\right]. If there is <strong>to</strong> be no matching bracket, the \left <strong>and</strong><br />

\right comm<strong>and</strong>s must still be given <strong>to</strong> specify the part of the<br />

formula <strong>to</strong> be sized, but the missing bracket is given as a period (for<br />

example, \left.).<br />

\Rightarrow [m] produces ⇒ . . . . . . . . . . . . . . (5.3.5) – 127<br />

\rightarrow [m] produces → . . . . . . . . . . . . . . (5.3.5) – 127<br />

\rightharpoondown [m] produces ⇁ . . . . . . . . . . (5.3.5) – 127<br />

\rightharpoonup [m] produces ⇀ . . . . . . . . . . . (5.3.5) – 127<br />

\rightleftharpoons [m] produces ⇌ . . . . . . . . . (5.3.5) – 127<br />

\rightmargin . . . . . . . . . . . . . . . . . . . . . . (4.4.2) – 76<br />

In a list environment, the amount by which the right edge of the<br />

text is indented relative <strong>to</strong> the right side of the surrounding text.<br />

St<strong>and</strong>ard value is 0 pt. A new value is assigned with the \setlength<br />

comm<strong>and</strong>:<br />

\setlength{\rightmargin}{0.5cm}<br />

\rmdefault . . . . . . . . . . . . . . . . . . . . . . (A.3.1) – 372<br />

This comm<strong>and</strong> defines the family attribute that is selected with the<br />

\rmfamily comm<strong>and</strong>. It may be redefined with \renewcomm<strong>and</strong>:<br />

\renewcomm<strong>and</strong>{\rmdefault}{ptm}<br />

\rmfamily . . . . . . . . . . . . . . . . . . (4.1.3), (A.2) – 64, 371<br />

This declaration switches <strong>to</strong> a font in the current series <strong>and</strong> shape,<br />

but with the Roman family attribute.<br />

\Roman{counter} . . . . . . . . . . . . . . . . . . . . (8.1.4) – 183<br />

Prints the current value of the counter as an upper case Roman<br />

numeral.<br />

\roman{counter} . . . . . . . . . . . . . . . . . . . . (8.1.4) – 183<br />

Prints the current value of the counter as a lower case Roman numeral.


576 Appendix H. Comm<strong>and</strong> Summary<br />

\rotatebox{angle}{text} . . . . . . . . . . . . . . . . (6.1.2) – 156<br />

A comm<strong>and</strong> made available with the graphics package that rotates<br />

the contents text as an LR box through the angle expressed in degrees.<br />

The rotation is counterclockwise about the left-h<strong>and</strong> end of<br />

the baseline of the box.<br />

\rq produces ’, identical <strong>to</strong> the ’ symbol.<br />

\rule[lift]{width}{height} . . . . . . . . . . . . . . . (4.7.6) – 91<br />

Produces a black rectangle of width width <strong>and</strong> height height, raised<br />

above the baseline by an amount lift, if this optional argument is given.<br />

A value of ‘0 pt’ for either the width or height creates an invisible<br />

horizontal or vertical strut that may be used <strong>to</strong> make spacing.<br />

\rvert [m][a] produces | (right delimiter) . . . . . . . (12.2.5) – 270<br />

\rVert [m][a] produces (right delimiter) . . . . . . . (12.2.5) – 270<br />

\S produces § . . . . . . . . . . . . . . . . . . . . . . . (2.5.5) – 23<br />

\SS produces SS, the upper case version of \ss, ß . . . . . (2.5.6) – 24<br />

\savebox{\boxname}[width][pos]{text} . . . . . . . . (4.7.1) – 87<br />

Functions the same as the \makebox comm<strong>and</strong> except that the box<br />

contents are not output but saved under the name \boxname, which<br />

has been previously defined with \newsavebox. The box may be<br />

set any place in the text as often as desired with the comm<strong>and</strong><br />

\usebox{\boxname}.<br />

\savebox{\boxname}(x dim,y dim)[pos]{sub pic} . (13.1.4) – 300<br />

In the picture environment, a sub-picture sub pic may be s<strong>to</strong>red as<br />

a box of width x dim <strong>and</strong> height y dim under the name \boxname,<br />

which has been previously defined with \newsavebox. The pos argument<br />

functions as it does for the picture \makebox. The box<br />

may be set any place in the picture environment with the comm<strong>and</strong><br />

\usebox{\boxname}.<br />

\sb produces a subscript, identical <strong>to</strong> the _ symbol.<br />

\sbox{\boxname}{text} . . . . . . . . . . . . . . . . . (4.7.1) – 87<br />

S<strong>to</strong>res text in an LR box named \boxname that has previously been<br />

created with \newsavebox{\boxname}. The contents of the box may<br />

be printed as often as desired with \usebox{\boxname}.<br />

\scalebox{h scale}[v scale]{text} . . . . . . . . . . . (6.1.2) – 156<br />

A comm<strong>and</strong> made available with the graphics package that scales<br />

the contents text as an LR box with the horizontal fac<strong>to</strong>r h scale<br />

<strong>and</strong> optionally with the (different) vertical fac<strong>to</strong>r v scale. If v scale is<br />

missing, it is the same as h scale.<br />

\scdefault . . . . . . . . . . . . . . . . . . . . . . (A.3.1) – 372<br />

This comm<strong>and</strong> defines the shape attribute that is selected with the<br />

\scshape comm<strong>and</strong>. It may be redefined with \renewcomm<strong>and</strong>:<br />

\renewcomm<strong>and</strong>{\scdefault}{sc}


H.1. Brief description of the L AT E X comm<strong>and</strong>s 577<br />

\scriptscriptstyle [m] . . . . . . . . . . . . . . . (5.5.2) – 146<br />

Switches <strong>to</strong> font size \scriptscriptstyle as the active font inside<br />

a math formula.<br />

\scriptsize . . . . . . . . . . . . . . . . . . . . . . . (4.1.2) – 62<br />

Switches <strong>to</strong> the font size \scriptsize, which is smaller than<br />

\footnotesize but larger than \tiny.<br />

\scriptstyle [m] . . . . . . . . . . . . . . . . . . . (5.5.2) – 146<br />

Switches <strong>to</strong> font size \scriptstyle as the active font inside a math<br />

formula.<br />

\scshape . . . . . . . . . . . . . . . . . . (4.1.3), (A.2) – 64, 371<br />

This declaration switches <strong>to</strong> a font in the current family <strong>and</strong> series,<br />

but with the Caps <strong>and</strong> Small Caps shape attribute.<br />

\searrow [m] produces ↘ . . . . . . . . . . . . . . . . (5.3.5) – 127<br />

\sec [m] . . . . . . . . . . . . . . . . . . . . . . . . (5.3.8) – 128<br />

Comm<strong>and</strong> <strong>to</strong> produce the function name ‘sec’ in formulas.<br />

\section[short title]{title} . . . . . . . . . . . . . . . . (3.3.3) – 55<br />

Begins a new section, formatting title with the current chapter number<br />

(book <strong>and</strong> report classes only) <strong>and</strong> an au<strong>to</strong>matic sequential section<br />

number. If the optional short title is given, it appears in place of title<br />

in the table of contents <strong>and</strong> the running head at the <strong>to</strong>p of the pages.<br />

\section*{title} . . . . . . . . . . . . . . . . . . . . . (3.3.3) – 55<br />

The same as \section but without a number or an entry in the table<br />

of contents.<br />

\see{reference} . . . . . . . . . . . . . . . . . . . . (9.4.2) – 227<br />

A comm<strong>and</strong> defined in the makeidx package for use with the MakeIndex<br />

program. It is called within an \index comm<strong>and</strong> <strong>to</strong> refer <strong>to</strong><br />

another entry in the keyword index as ‘see reference’. Given in the<br />

form:<br />

\index{entry|see{reference}}<br />

Note: the above text is correct with | in place of \ for |see.<br />

\seealso{reference} . . . . . . . . . . . . . . . . . . (9.4.2) – 227<br />

Like \see, but will print the text ‘see also reference’ in the index.<br />

More precisely, it prints the text s<strong>to</strong>red in the comm<strong>and</strong> \alsoname.<br />

Requires the makeidx package.<br />

\seename . . . . . . . . . . . . . . . . . . . . . . . (D.4.1) – 460<br />

A comm<strong>and</strong> defined in the package makeidx containing the text for<br />

the comm<strong>and</strong> \see. In English, this is ‘see’ but may be altered for<br />

adaptation <strong>to</strong> other languages.


578 Appendix H. Comm<strong>and</strong> Summary<br />

\selectfont . . . . . . . . . . . . . . . . . . . . . . . (A.1) – 369<br />

Activates the font with the current set of attributes, making it the<br />

current font in which text is set. It should normally follow an attribute<br />

selection comm<strong>and</strong>. Example:<br />

\fontshape{sl}\selectfont<br />

\selectlanguage{language} . . . . . . . . . . . . . (11.1) – 255<br />

Comm<strong>and</strong> in multi-language packages such as german <strong>and</strong> in the<br />

babel system for changing the language. The names of titles, the<br />

form of the date comm<strong>and</strong> \<strong>to</strong>day, special language-specific comm<strong>and</strong>s,<br />

<strong>and</strong> the hyphenation patterns are all changed. Example:<br />

\selectlanguage{english}<br />

\setboolean{switch}{value} . . . . . . . . . . . . . . (8.3.5) – 194<br />

Requires the st<strong>and</strong>ard L AT E X package ifthen. Sets the value of<br />

a boolean switch <strong>to</strong> 〈true〉 or 〈false〉, depending on value, which<br />

must be true or false. The switch must have been created with<br />

\newboolean{switch}. Its value is tested with \boolean{switch},<br />

which may be used as a logical statement in the test part of<br />

\ifthenelse <strong>and</strong> \whiledo.<br />

\setcounter{counter}{value} . . . . . . . . . . . . . (8.1.3) – 182<br />

Assigns the integral number value <strong>to</strong> the counter counter.<br />

\setlength{\length cmd}{length spec} . . . . . . . . . (8.2) – 184<br />

The length comm<strong>and</strong> with the name \length cmd is assigned the<br />

length value length spec, which may be a fixed or rubber length.<br />

See also . . . . . . . . . . . . . . . . . (2.4.1), (2.4.2) – 21, 21<br />

\SetMathAlphabet{\cmd}{ver}{code}{fam}{ser}{shp} [p]<br />

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . (A.3.3) – 373<br />

Defines the math alphabet that has been declared with<br />

\DeclareMathAlphabet <strong>to</strong> take the specified font attributes in the<br />

math version ver.<br />

\setminus [m] produces \ . . . . . . . . . . . . . . . (5.3.3) – 125<br />

\SetSymbolFont{sym fnt}{ver}{code}{fam}{ser}{shp} [p]<br />

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . (A.3.4) – 374<br />

Defines the symbol font that has been declared with<br />

\DeclareSymbolFont <strong>to</strong> take the specified font attributes in the<br />

math version ver.<br />

\settime{secs} . . . . . . . . . . . . . . . . . . . (15.1.3) – 327<br />

In the slides class, if the option clock has been selected, a time<br />

marker, in minutes, appears at the bot<strong>to</strong>m of the notes. This comm<strong>and</strong><br />

sets the internal timer <strong>to</strong> the specified number of seconds. See<br />

also \addtime.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 579<br />

\set<strong>to</strong>depth{\length cmd}{text} . . . . . . . . . . . . (8.2) – 184<br />

The length comm<strong>and</strong> with the name \length cmd is assigned a value<br />

equal <strong>to</strong> the depth of text below the baseline.<br />

\set<strong>to</strong>height{\length cmd}{text} . . . . . . . . . . . . (8.2) – 184<br />

The length comm<strong>and</strong> with the name \length cmd is assigned a value<br />

equal <strong>to</strong> the height of text above the baseline.<br />

\set<strong>to</strong>width{\length cmd}{text} . . . . . . . . . . . . (8.2) – 184<br />

The length comm<strong>and</strong> with the name \length cmd is assigned a value<br />

equal <strong>to</strong> the length of text as it would be set in an LR box.<br />

\sfdefault . . . . . . . . . . . . . . . . . . . . . . (A.3.1) – 372<br />

This comm<strong>and</strong> defines the family attribute that is selected with the<br />

\sffamily comm<strong>and</strong>. It may be redefined with \renewcomm<strong>and</strong>:<br />

\renewcomm<strong>and</strong>{\sfdefault}{phv}<br />

\sffamily . . . . . . . . . . . . . . . . . . (4.1.3), (A.2) – 64, 371<br />

This declaration switches <strong>to</strong> a font in the current series <strong>and</strong> shape,<br />

but with the sans serif family attribute.<br />

\shadowbox{text} . . . . . . . . . . . . . . . . . . . . (4.7.9) – 94<br />

With the fancybox package, is a variant of \fbox, drawing a shadowed<br />

box around text; the thickness of the shadow is given by the<br />

length \shadowsize.<br />

\sharp [m] produces ♯ . . . . . . . . . . . . . . . . . (5.3.6) – 127<br />

\shortstack[pos]{text} . . . . . . . . . . . . . . . (13.1.4) – 297<br />

Formats the text in<strong>to</strong> a single column, where the individual<br />

rows are terminated by \\. The optional positioning argument<br />

pos takes on values of l or r <strong>to</strong> set the text left or right justified,<br />

otherwise it is centered. Example:<br />

\shortstack{aa\\bbb\\cc\\x\\yy\\zzz}<br />

aa<br />

bbb<br />

cc<br />

x<br />

yy<br />

zzz<br />

\sideset{pre}{post}\symbol [m][a] . . . . . . . . . (12.2.2) – 262<br />

With the amsmath package, places superscripts <strong>and</strong> subscripts snugly<br />

before (pre) <strong>and</strong> after (post) the math symbol \symbol. Example:<br />

$\sideset{_\dagˆ*}{_\dagˆ*}\prod$ yields ∗∗<br />

\Sigma [m] produces Σ . . . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\sigma [m] produces σ . . . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\signature{name} . . . . . . . . . . . . . . . . . . (16.1) – 351<br />

In the letter document class, supplies the name of the writer that<br />

should go below the signature if this is different from the entry in<br />

\name.<br />

†<br />


580 Appendix H. Comm<strong>and</strong> Summary<br />

\sim [m] produces ∼ . . . . . . . . . . . . . . . . . . (5.3.4) – 126<br />

\simeq [m] produces . . . . . . . . . . . . . . . . . (5.3.4) – 126<br />

\sin [m] . . . . . . . . . . . . . . . . . . . . . . . . (5.3.8) – 128<br />

Comm<strong>and</strong> <strong>to</strong> produce the function name ‘sin’ in formulas.<br />

\sinh [m] . . . . . . . . . . . . . . . . . . . . . . . (5.3.8) – 128<br />

Comm<strong>and</strong> <strong>to</strong> produce the function name ‘sinh’ in formulas.<br />

\sldefault . . . . . . . . . . . . . . . . . . . . . . (A.3.1) – 372<br />

This comm<strong>and</strong> defines the shape attribute that is selected with the<br />

\slshape comm<strong>and</strong>. It may be redefined with \renewcomm<strong>and</strong>:<br />

\renewcomm<strong>and</strong>{\sldefault}{sl}<br />

\sloppy . . . . . . . . . . . . . . . . . . . . . . . . . (2.8.3) – 36<br />

After this comm<strong>and</strong> has been given, word spacings are allowed <strong>to</strong><br />

stretch more generously than usual so that paragraphs are broken up<br />

in<strong>to</strong> lines with fewer word divisions. It is counterm<strong>and</strong>ed by \fussy.<br />

See also \begin{sloppypar}.<br />

\slshape . . . . . . . . . . . . . . . . . . (4.1.3), (A.2) – 64, 371<br />

This declaration switches <strong>to</strong> a font in the current family <strong>and</strong> series,<br />

but with the slanted shape attribute.<br />

\small . . . . . . . . . . . . . . . . . . . . . . . . . . (4.1.2) – 62<br />

Switches <strong>to</strong> the font size \small, which is smaller than \normalsize<br />

but larger than \footnotesize.<br />

\smallskip . . . . . . . . . . . . . . . . . . . . . . . (2.7.3) – 32<br />

Inserts large vertical spacing of amount \smallskipamount. See also<br />

\medskip <strong>and</strong> \bigskip.<br />

\smallskipamount<br />

St<strong>and</strong>ard value for the amount of vertical spacing that is inserted with<br />

the comm<strong>and</strong> \smallskip. May be changed with the \setlength<br />

comm<strong>and</strong>:<br />

\setlength{\smallskipamount}{1ex plus0.5ex minus0.3ex}<br />

\smash[pos]{text} [m][a] . . . . . . . . . . . . . . . (12.2.5) – 269<br />

With the amsmath package, this T E X comm<strong>and</strong> acquires an optional<br />

argument pos that may be b or t, <strong>to</strong> effectively zero the depth or<br />

height of the text. With no pos, both height <strong>and</strong> depth are zeroed.<br />

\smile [m] produces ⌣ . . . . . . . . . . . . . . . . . (5.3.4) – 126<br />

\sp produces a superscript, identical <strong>to</strong> the ˆ symbol.<br />

\spadesuit [m] produces ♠ . . . . . . . . . . . . . . (5.3.6) – 127<br />

\sqcap [m] produces ⊓ . . . . . . . . . . . . . . . . . (5.3.3) – 125<br />

\sqcup [m] produces ⊔ . . . . . . . . . . . . . . . . . (5.3.3) – 125<br />

\sqrt[n]{arg} [m] . . . . . . . . . . . . . . . . . . . (5.2.4) – 122<br />

Basic math comm<strong>and</strong> <strong>to</strong> produce a root sign. The height <strong>and</strong> length<br />

of the sign are made <strong>to</strong> fit the contents arg. The optional argument<br />

n is the degree of the root: \sqrt[3]{2} = 3√ 2, \sqrt{2} = √ 2.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 581<br />

\sqsubset [m] produces ⊏ . . . . . . . . . . . . . . . (5.3.4) – 126<br />

\sqsubseteq [m] produces ⊑ . . . . . . . . . . . . . . (5.3.4) – 126<br />

\sqsupset [m] produces ⊐ . . . . . . . . . . . . . . . (5.3.4) – 126<br />

\sqsupseteq [m] produces ⊒ . . . . . . . . . . . . . . (5.3.4) – 126<br />

\ss produces ß . . . . . . . . . . . . . . . . . . . . . . (2.5.6) – 24<br />

\stackrel{upper}{lower} [m] . . . . . . . . . . . . . (5.4.5) – 137<br />

Places one mathematical symbol upper on <strong>to</strong>p of another lower, such<br />

that the upper one appears in a smaller typeface:<br />

\stackrel{\alpha}{\longrightarrow} = α<br />

−→<br />

\star [m] produces ⋆ . . . . . . . . . . . . . . . . . (5.3.3) – 125<br />

\stepcounter{counter} . . . . . . . . . . . . . . . . (8.1.3) – 182<br />

Increases the value of the number s<strong>to</strong>red in counter by one.<br />

\stretch{decimal num} . . . . . . . . . . . . . . . . . (8.2) – 184<br />

A rubber length with a natural value of 0 pt but with a stretchability<br />

that is decimal num times that of \fill.<br />

\subitem{sub entry} . . . . . . . . . . . . . . . . . . (9.4.1) – 225<br />

In theindex environment, a comm<strong>and</strong> <strong>to</strong> produce a second-level<br />

entry after an \item comm<strong>and</strong>.<br />

\subparagraph[short title]{title} . . . . . . . . . . . . . (3.3.3) – 55<br />

The last comm<strong>and</strong> in the sectioning hierarchy, coming after<br />

\paragraph. It formats title with the current paragraph number<br />

<strong>and</strong> an au<strong>to</strong>matic sequential sub-paragraph number. If the optional<br />

short title is given, it appears in place of title in the table of contents.<br />

\subparagraph*{title} . . . . . . . . . . . . . . . . . . (3.3.3) – 55<br />

The same as \subparagraph but without a number or an entry in<br />

the table of contents.<br />

\subsection[short title]{title} . . . . . . . . . . . . . . (3.3.3) – 55<br />

The comm<strong>and</strong> in the sectioning hierarchy that comes between the<br />

\section <strong>and</strong> \subsubsection. It formats title with the current<br />

section number <strong>and</strong> an au<strong>to</strong>matic sequential subsection number. If<br />

the optional short title is given, it appears in place of title in the table<br />

of contents.<br />

\subsection*{title} . . . . . . . . . . . . . . . . . . . (3.3.3) – 55<br />

The same as \subsection but without a number or an entry in the<br />

table of contents.<br />

\substack{1st line\\..\\last line} [m][a] . . . . . . . (12.2.2) – 261<br />

With the amsmath package, produces centered multiline indices or<br />

limits; it must immediately follow ˆ or _ <strong>and</strong> be enclosed in { }.


582 Appendix H. Comm<strong>and</strong> Summary<br />

\subsubitem{sub sub entry} . . . . . . . . . . . . . . (9.4.1) – 225<br />

In theindex environment, a comm<strong>and</strong> <strong>to</strong> produce a third-level entry<br />

under a \subitem comm<strong>and</strong>.<br />

\subsubsection[short form]{title} . . . . . . . . . . . (3.3.3) – 55<br />

The comm<strong>and</strong> in the sectioning hierarchy coming between<br />

\subsection <strong>and</strong> \paragraph. It formats title with the current subsection<br />

number <strong>and</strong> an au<strong>to</strong>matic sequential sub-subsection number.<br />

If the optional short title is given, it appears in place of title in the<br />

table of contents.<br />

\subsubsection*{title} . . . . . . . . . . . . . . . . . (3.3.3) – 55<br />

The same as \subsubsection but without a number or an entry in<br />

the table of contents.<br />

\subset [m] produces ⊂ . . . . . . . . . . . . . . . . (5.3.4) – 126<br />

\subseteq [m] produces ⊆ . . . . . . . . . . . . . . . (5.3.4) – 126<br />

\succ [m] produces ≻ . . . . . . . . . . . . . . . . . (5.3.4) – 126<br />

\succeq [m] produces . . . . . . . . . . . . . . . . (5.3.4) – 126<br />

\sum [m] produces . . . . . . . . . . . . . . . . . . (5.2.5) – 123<br />

\sup [m] . . . . . . . . . . . . . . . . . . . . . . . . (5.3.8) – 128<br />

Comm<strong>and</strong> <strong>to</strong> produce the function name ‘sup’ in formulas. A lower<br />

limit may be set as a subscript.<br />

\suppressfloats[loc] . . . . . . . . . . . . . . . . . . (7.2) – 171<br />

Any floats given between this comm<strong>and</strong> <strong>and</strong> the end of the current<br />

page will be suspended at least until the next page. If the optional loc<br />

is given as one of t or b (not both), only floats with that placement<br />

parameter are suspended.<br />

\supset [m] produces ⊃ . . . . . . . . . . . . . . . . (5.3.4) – 126<br />

\supseteq [m] produces ⊇ . . . . . . . . . . . . . . . (5.3.4) – 126<br />

\surd [m] produces √ . . . . . . . . . . . . . . . . . (5.3.6) – 127<br />

\swarrow [m] produces ↙ . . . . . . . . . . . . . . . . (5.3.5) – 127<br />

\symbol{n} . . . . . . . . . . . . . . . . . . . . . . . (4.1.6) – 66<br />

Produces the symbol in the current character font that is s<strong>to</strong>red<br />

under the internal number n.<br />

\t{xy} . . . . . . . . . . . . . . . . . . . . . . . . . . (2.5.7) – 24<br />

Produces a ‘tie-after’ accent over two letters: \t{oo} = oo.<br />

\tabbingsep . . . . . . . . . . . . . . . . . . . . . . . (4.6.4) – 83<br />

Determines the spacing between the text ltext <strong>and</strong> the current tabular<br />

s<strong>to</strong>p when ltext\’ is given in a tabbing environment. A new value<br />

may be assigned with the \setlength comm<strong>and</strong>.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 583<br />

\tabcolsep . . . . . . . . . . . . . . . . . . . . . . . (4.8.2) – 98<br />

Determines the half-column spacing in the tabular environment. A<br />

new value may be assigned with the \setlength comm<strong>and</strong>:<br />

\setlength{\tabcolsep}{3mm}<br />

\tableofcontents . . . . . . . . . . . . . . . . . . . . (3.4.2) – 58<br />

Prints the table of contents from information in the sectioning comm<strong>and</strong>s<br />

<strong>and</strong> additional entries.<br />

\tablename . . . . . . . . . . . . . . . . . . . . . . (D.4.1) – 459<br />

Comm<strong>and</strong> containing the name for a table caption. In English, this<br />

is ‘Table’ but may be altered for adaptation <strong>to</strong> other languages.<br />

\tabularnewline[len] . . . . . . . . . . . . . . . . . . (4.8.1) – 98<br />

Terminates a row in the tabular or array environments, adding<br />

vertical spacing len if it is specified. This is equivalent <strong>to</strong> \\[len]<br />

except that there is no ambiguity as <strong>to</strong> whether it is terminating a<br />

row in the table or a line of text within a column entry. If something<br />

like \raggedright is given in the last column, then this comm<strong>and</strong><br />

must be used in place of \\.<br />

\tag{mark} [m][a] . . . . . . . . . . . . . . . . . . (12.2.6) – 271<br />

Within one of the A M S-L AT E X alignment environments, prints mark<br />

in place of the equation number, in parentheses. The *-form prints<br />

it without parentheses.<br />

\tan [m] . . . . . . . . . . . . . . . . . . . . . . . . (5.3.8) – 128<br />

Comm<strong>and</strong> <strong>to</strong> produce the function name ‘tan’ in formulas.<br />

\tanh [m] . . . . . . . . . . . . . . . . . . . . . . . (5.3.8) – 128<br />

Comm<strong>and</strong> <strong>to</strong> produce the function name ‘tanh’ in formulas.<br />

\tau [m] produces τ . . . . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\tbinom{over}{under} [m][a] . . . . . . . . . . . . (12.2.3) – 264<br />

With the amsmath package, produces a binomial as \binom does, but<br />

in \textstyle size.<br />

\telephone{number} . . . . . . . . . . . . (16.1), (16.2) – 352, 356<br />

In the letter document class, enters the sender’s telephone number.<br />

In the st<strong>and</strong>ard L AT E X letter.sty, number is only output if \address<br />

has not been called. It is intended <strong>to</strong> be used in company letter styles<br />

such as mpletter.<br />

\TeX produces T E X . . . . . . . . . . . . . . . . . . . . (2.1) – 19<br />

\text{short text} [m][a] . . . . . . . . . . . . . . . (12.2.1) – 259<br />

When one of the packages amsmath or amstext has been loaded, this<br />

comm<strong>and</strong> prints short text as normal text within a math formula. If<br />

used in subscripts or superscripts, au<strong>to</strong>matic sizing takes place.


584 Appendix H. Comm<strong>and</strong> Summary<br />

\textsym name . . . . . . . . . . . . . . . . . . . . . (D.6) – 462<br />

An alternative means <strong>to</strong> produce certain special symbols that<br />

otherwise are only available in math mode or through ligature<br />

combinations:<br />

\textbullet (•); \textemdash (—); \textendash (–);<br />

\textexclamdown (¡); \textperiodcentered (·);<br />

\textquestiondown (¿); \textquotedblleft (“);<br />

\textquotedblright (”); \textquoteleft (‘); \textquoteright<br />

(’); \textvisiblespace ( )<br />

\textasciicircum (ˆ); \textasciitilde (˜); \textbackslash (\);<br />

\textbar (|); \textgreater (>); \textless (


H.1. Brief description of the L AT E X comm<strong>and</strong>s 585<br />

\textit{text} . . . . . . . . . . . . . . . . . . . . . . (4.1.4) – 65<br />

This comm<strong>and</strong> sets its argument in a font in the current family<br />

<strong>and</strong> series, but with the italic shape attribute. It is equivalent <strong>to</strong><br />

{\itshape text}.<br />

\textmd{text} . . . . . . . . . . . . . . . . . . . . . . (4.1.4) – 65<br />

This comm<strong>and</strong> sets its argument in a font in the current family <strong>and</strong><br />

shape, but with the medium series attribute. It is equivalent <strong>to</strong><br />

{\mdseries text}.<br />

\textnormal{text} . . . . . . . . . . . . . . . . . . . . (4.1.3) – 65<br />

This comm<strong>and</strong> sets its argument in the font with the default family,<br />

series, <strong>and</strong> shape attributes. It is equivalent <strong>to</strong> {\normalfont text}.<br />

\textquotedbl . . . . . . . . . . . . . . . . . . . . (G.4.5) – 503<br />

When T1 encoding is active, prints the symbol ".<br />

\textregistered produces ® . . . . . . . . . . . . . (D.6) – 462<br />

\textrm{text} . . . . . . . . . . . . . . . . . . . . . . (4.1.4) – 65<br />

Sets text in a font in the current series <strong>and</strong> shape, but with the Roman<br />

family attribute. It is equivalent <strong>to</strong> {\rmfamily text}.<br />

\textsc{text} . . . . . . . . . . . . . . . . . . . . . . (4.1.4) – 65<br />

Sets text in a font in the current family <strong>and</strong> series, but with the Caps<br />

<strong>and</strong> Small Caps shape attribute. It is equivalent <strong>to</strong> {\scshape text}.<br />

\textsf{text} . . . . . . . . . . . . . . . . . . . . . . (4.1.4) – 65<br />

Sets text in a font in the current series <strong>and</strong> shape, but with the sans<br />

serif family attribute. It is equivalent <strong>to</strong> {\sffamily text}.<br />

\textsl{text} . . . . . . . . . . . . . . . . . . . . . . (4.1.4) – 65<br />

Sets text in a font in the current family <strong>and</strong> series, but with the slanted<br />

shape attribute. It is equivalent <strong>to</strong> {\slshape text}.<br />

\textstyle [m] . . . . . . . . . . . . . . . . . . . . (5.5.2) – 146<br />

Switches <strong>to</strong> font size \textstyle inside a math formula.<br />

\textsuperscript{char} . . . . . . . . . . . . . . . . (D.6) – 462<br />

Produces a superscript in the current text, rather than math, font:<br />

\textsuperscript{12} = 12 .<br />

\texttrademark produces . . . . . . . . . . . . . . (D.6) – 462<br />

\texttt{text} . . . . . . . . . . . . . . . . . . . . . . (4.1.4) – 65<br />

Sets text in a font in the current series <strong>and</strong> shape, but with the<br />

typewriter family attribute. It is equivalent <strong>to</strong> {\ttfamily text}.<br />

\textup{text} . . . . . . . . . . . . . . . . . . . . . . (4.1.4) – 65<br />

Sets text in a font in the current family <strong>and</strong> series, but with the<br />

upright shape attribute. It is equivalent <strong>to</strong> {\upshape text}.


586 Appendix H. Comm<strong>and</strong> Summary<br />

\textwidth . . . . . . . . . . . . . . . . . . . . . . . (3.2.5) – 48<br />

The <strong>to</strong>tal width reserved for the text on a page. For two-column<br />

formatting, this is the width of both columns plus the gap between<br />

them. A new value may be assigned with the \setlength comm<strong>and</strong>.<br />

\tfrac{numera<strong>to</strong>r}{denomina<strong>to</strong>r} [m][a] . . . . . . . (12.2.3) – 264<br />

With the amsmath package, produces a fraction as \frac does, but<br />

in \textstyle size.<br />

\TH . . . . . . . . . . . . . . . . . . . . . . . . . . (G.4.5) – 503<br />

When T1 encoding is active, prints the character Þ.<br />

\th . . . . . . . . . . . . . . . . . . . . . . . . . . (G.4.5) – 503<br />

When T1 encoding is active, prints the character þ.<br />

\thanks{footnote text} . . . . . . . . . . . . . . . . . . (3.3.1) – 54<br />

Produces a footnote <strong>to</strong> an author’s name on the title page when<br />

\maketitle is called.<br />

\thecounter . . . . . . . . . . . . . . . . . . . . . . (8.1.4) – 183<br />

Internal comm<strong>and</strong>s for formatting <strong>and</strong> printing counter values, making<br />

possible use of other counters. For example, \thesubsection<br />

might be defined <strong>to</strong> be \thesection.\roman{subsection}. A new<br />

definition may be made with \renewcomm<strong>and</strong>{\thecounter}{def }.<br />

\Theta [m] produces Θ . . . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\theta [m] produces θ . . . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\thicklines . . . . . . . . . . . . . . . . . . . . . (13.1.4) – 300<br />

In the picture environment, this comm<strong>and</strong> sets all the sloping lines<br />

<strong>and</strong> arrows, circles, <strong>and</strong> ovals <strong>to</strong> be drawn with thicker than normal<br />

lines.<br />

\thickspace [m][a] . . . . . . . . . . . . . . . . . . (12.2.5) – 269<br />

With the amsmath package, this is an alias for \;, a thick space in a<br />

math formula.<br />

\thinlines . . . . . . . . . . . . . . . . . . . . . (13.1.4) – 300<br />

In the picture environment, resets the line thickness for sloping<br />

lines <strong>and</strong> arrows, circles, <strong>and</strong> ovals back <strong>to</strong> the st<strong>and</strong>ard value after<br />

\thicklines has been given.<br />

\thinspace [m][a] . . . . . . . . . . . . . . . . . . (12.2.5) – 269<br />

With the amsmath package, this is an alias for \,, a thin space in a<br />

math formula.<br />

\thisfancypage{cmds1}{cmds2} . . . . . . . . . . . . (4.7.9) – 95<br />

With the fancybox package, places a framed box around the contents<br />

of the current page only; cmds1 exclude the head <strong>and</strong> footlines, cmds2<br />

includes them. The arguments set box parameters like \fboxrule<br />

but must end with a box comm<strong>and</strong> like \shadowbox. Usually one set<br />

of cmds is left blank.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 587<br />

\thispagestyle{style} . . . . . . . . . . . . . . . . . (3.2) – 42<br />

Changes the page style for the current page only. Possible values for<br />

style are: plain, empty, headings, <strong>and</strong> myheadings.<br />

\tilde{x} [m] . . . . . . . . . . . . . . . . . . . . . (5.3.9) – 129<br />

Produces a tilde (squiggle) over the math variable x: \tilde{a} =<br />

ã.<br />

\Tilde{x} [m][a] . . . . . . . . . . . . . . . . . . . (12.2.2) – 263<br />

With the amsmath package, can be used like \tilde, but with multiple<br />

A M S-L AT E X math accents the positioning will be correct.<br />

\tiny . . . . . . . . . . . . . . . . . . . . . . . . . . (4.1.2) – 62<br />

Switches <strong>to</strong> the smallest font size available \tiny, smaller than<br />

\scriptsize.<br />

\times [m] produces × . . . . . . . . . . . . . . . . . (5.3.3) – 125<br />

\title{text} . . . . . . . . . . . . . . . . . . . . . . . (3.3.1) – 52<br />

Enters the text for the title page that is produced by \maketitle.<br />

\<strong>to</strong> [m] produces → . . . . . . . . . . . . . . . . . . (5.3.5) – 127<br />

\<strong>to</strong>day . . . . . . . . . . . . . . . . . . . (2.5.11), (D.4.2) – 27, 461<br />

Prints the current date in the American fashion. This form may be<br />

changed <strong>to</strong> British or <strong>to</strong> that of other languages by redefining the<br />

comm<strong>and</strong> with the help of the internal T E X comm<strong>and</strong>s \day, \month,<br />

<strong>and</strong> \year.<br />

\<strong>to</strong>p [m] produces ⊤ . . . . . . . . . . . . . . . . . . (5.3.6) – 127<br />

\<strong>to</strong>pfigrule . . . . . . . . . . . . . . . . . . . . . . . (7.3) – 173<br />

A comm<strong>and</strong> that is executed after a float at the <strong>to</strong>p of a page. It is<br />

normally defined <strong>to</strong> do nothing, but may be redefined <strong>to</strong> add a rule<br />

between the float <strong>and</strong> the main text. It must not add any net vertical<br />

spacing.<br />

\renewcomm<strong>and</strong>{\<strong>to</strong>pfigrule}{\vspace*{-.4pt}<br />

\rule{\columnwidth}{.4pt}}<br />

\<strong>to</strong>pfraction . . . . . . . . . . . . . . . . . . . . . . (7.3) – 172<br />

The maximum fraction of a page that may be occupied at the <strong>to</strong>p by<br />

floats at the <strong>to</strong>p of the page. A new value is assigned with<br />

\renewcomm<strong>and</strong>{\<strong>to</strong>pfraction}{decimal frac}<br />

\<strong>to</strong>pmargin . . . . . . . . . . . . . . . . . . . . . . . (3.2.5) – 48<br />

The size of the margin from the <strong>to</strong>p of the page <strong>to</strong> the page head. A<br />

new value may be assigned by the \setlength comm<strong>and</strong>:<br />

\setlength{<strong>to</strong>pmargin}{0.5in}


588 Appendix H. Comm<strong>and</strong> Summary<br />

<strong>to</strong>pnumber . . . . . . . . . . . . . . . . . . . . . . . . (7.3) – 171<br />

The maximum number of floats that may appear at the <strong>to</strong>p of a page.<br />

A new value is assigned with:<br />

\setcounter{<strong>to</strong>pnumber}{num}<br />

\<strong>to</strong>psep . . . . . . . . . . . . . . . . . . . (4.4.2), (5.5.4) – 75, 149<br />

The extra vertical spacing, in addition <strong>to</strong> \parskip, inserted at the<br />

beginning <strong>and</strong> end of a listing environment. When document class<br />

option fleqn has been chosen, it is also inserted at the beginning<br />

<strong>and</strong> end of displayed math formulas. A new value may be assigned<br />

with the \setlength comm<strong>and</strong>:<br />

\setlength{\<strong>to</strong>psep}{4pt plus2pt minus2pt}<br />

\<strong>to</strong>pskip . . . . . . . . . . . . . . . . . . . . . . . . (3.2.5) – 48<br />

The vertical distance from the <strong>to</strong>p of the page body <strong>to</strong> the baseline<br />

of the first line of text. A new value may be assigned with the<br />

\setlength comm<strong>and</strong>:<br />

\setlength{\<strong>to</strong>pskip}{12pt}<br />

\<strong>to</strong>talheight . . . . . . . . . . . . . . . . . . . . . . (4.7.1) – 86<br />

A length parameter equal <strong>to</strong> the <strong>to</strong>tal natural height of a box (height<br />

plus depth); it may only be used in the width specification of<br />

\makebox, \framebox, or \savebox, or in the height specification of<br />

a \parbox or a minipage environment.<br />

\framebox[6\<strong>to</strong>talheight]{text}<br />

<strong>to</strong>talnumber . . . . . . . . . . . . . . . . . . . . . . . (7.3) – 172<br />

The <strong>to</strong>tal number of floats that may appear on a page regardless of<br />

their positions. A new value is assigned with:<br />

\setcounter{<strong>to</strong>talnumber}{num}<br />

\triangle [m] produces △ . . . . . . . . . . . . . . . (5.3.6) – 127<br />

\triangleleft [m] produces ⊳ . . . . . . . . . . . . . (5.3.3) – 125<br />

\triangleright [m] produces ⊲ . . . . . . . . . . . . (5.3.3) – 125<br />

\ttdefault . . . . . . . . . . . . . . . . . . . . . . (A.3.1) – 372<br />

This comm<strong>and</strong> defines the family attribute that is selected with the<br />

\ttfamily comm<strong>and</strong>. It may be redefined with \renewcomm<strong>and</strong>:<br />

\renewcomm<strong>and</strong>{\ttdefault}{pcr}<br />

\ttfamily . . . . . . . . . . . . . . . . . . . (4.1.3), A.2) – 64, 371<br />

This declaration switches <strong>to</strong> a font in the current series <strong>and</strong> shape,<br />

but with the typewriter family attribute.<br />

\twocolumn[text] . . . . . . . . . . . . . . . . . . . . (3.2.7) – 51<br />

Begins a new page <strong>and</strong> switches <strong>to</strong> two-column page format. The<br />

optional text is set in one column extending over the two columns.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 589<br />

\typein[\cmd]{message} . . . . . . . . . . . . . . . (9.1.3) – 211<br />

Prints the message <strong>to</strong> the moni<strong>to</strong>r <strong>and</strong> s<strong>to</strong>ps the program, waiting for<br />

a reply from the user. The text of the response is assigned <strong>to</strong> the L AT E X<br />

comm<strong>and</strong> named \@typein, or <strong>to</strong> \cmd if the optional argument has<br />

been given. After the return key is pressed, the processing continues.<br />

The typed-in text is inserted in place of \@typein if the optional<br />

argument was not given, otherwise it may be inserted as one pleases<br />

with the \cmd comm<strong>and</strong>.<br />

\typeout{message} . . . . . . . . . . . . . . . . . . (9.1.3) – 211<br />

Prints the message <strong>to</strong> the moni<strong>to</strong>r <strong>and</strong> continues the processing. The<br />

message is also written <strong>to</strong> the.log file.<br />

\u{x} . . . . . . . . . . . . . . . . . . . . . . . . . . (2.5.7) – 24<br />

Produces a breve accent: \u{o} = ŏ.<br />

\unboldmath . . . . . . . . . . . . . . . . . . . . . . (5.4.9) – 143<br />

Counterm<strong>and</strong>s the \boldmath comm<strong>and</strong>. It must be given outside<br />

of the math mode. Afterwards, formulas are set in st<strong>and</strong>ard ‘math<br />

italics’ once more.<br />

\underbrace{sub form} [m] . . . . . . . . . . . . . . (5.4.4) – 136<br />

Produces a horizontal curly brace beneath the math formula<br />

sub form. Any following subscript will be placed centered below<br />

the horizontal brace.<br />

\underbrace{a+b}: a + b<br />

<br />

\underbrace{x+y+z}_{\xi\eta\zeta}: x + y + z<br />

<br />

ξηζ<br />

\underleftarrow{expr} [m][a] . . . . . . . . . . . . (12.2.2) – 262<br />

With the amsmath package, places a long leftwards pointing arrow<br />

beneath the mathematical expression expr.<br />

\underleftrightarrow{expr} [m][a] . . . . . . . . . (12.2.2) – 262<br />

With the amsmath package, places a long double arrow beneath the<br />

mathematical expression expr.<br />

\underline{text} . . . . . . . . . . . . . . . . . . . (5.4.4) – 136<br />

Underlines the text in both math <strong>and</strong> normal text modes:<br />

\underline{Text} = Text.<br />

\underrightarrow{expr} [m][a] . . . . . . . . . . . (12.2.2) – 262<br />

With the amsmath package, places a long rightwards pointing arrow<br />

beneath the mathematical expression expr.


590 Appendix H. Comm<strong>and</strong> Summary<br />

\underset{char}{\symbol} [m][a] . . . . . . . . . . (12.2.2) – 262<br />

With the amsmath package, places char below the math symbol<br />

\symbol in subscript size.<br />

\unitlength . . . . . . . . . . . . . . . . . . . . . (13.1.1) – 288<br />

Defines the unit of length for the following picture environments.<br />

A value is assigned with the \setlength comm<strong>and</strong>:<br />

\setlength{\unitlength}{1.2cm}<br />

\unlhd [m] produces ⊴ . . . . . . . . . . . . . . . . . (5.3.3) – 125<br />

\unrhd [m] produces ⊵ . . . . . . . . . . . . . . . . . (5.3.3) – 125<br />

\Uparrow [m] produces ⇑ . . . . . . . . . . . . . . . . (5.3.5) – 127<br />

\uparrow [m] produces ↑ . . . . . . . . . . . . . . . . (5.3.5) – 127<br />

\updefault . . . . . . . . . . . . . . . . . . . . . . (A.3.1) – 372<br />

This comm<strong>and</strong> defines the shape attribute that is selected with the<br />

\upshape comm<strong>and</strong>. It may be redefined with \renewcomm<strong>and</strong>:<br />

\renewcomm<strong>and</strong>{\updefault}{n}<br />

\Updownarrow [m] produces . . . . . . . . . . . . . (5.3.5) – 127<br />

\updownarrow [m] produces . . . . . . . . . . . . . (5.3.5) – 127<br />

\uplus [m] produces ⊎ . . . . . . . . . . . . . . . . . (5.3.3) – 125<br />

\upshape . . . . . . . . . . . . . . . . . . (4.1.3), (A.2) – 64, 371<br />

This declaration switches <strong>to</strong> a font in the current family <strong>and</strong> series,<br />

but with the upright shape attribute.<br />

\Upsilon [m] produces Υ . . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\upsilon [m] produces υ . . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\uproot{shift} [m][a] . . . . . . . . . . . . . . . . . (12.2.5) – 269<br />

With the amsmath package, used in the index <strong>to</strong> a \sqrt comm<strong>and</strong> <strong>to</strong><br />

shift it slightly upwards. The shift is a number specifying how many<br />

units <strong>to</strong> move it. Example:<br />

\sqrt[\leftroot{-1}\uproot{3}\beta]{k}<br />

\url{address} . . . . . . . . . . . . . . . . . . . . . (4.9.2) – 112<br />

With the url package, prints address literally, normally in typewriter<br />

font, with line breaks after non-letters, without hyphens. Intended<br />

for Internet <strong>and</strong> email addresses. With the hyperref package, address<br />

becomes an active link in a PDF file. The address argument<br />

may be delimited either by curly braces as usual, or by some other<br />

character, as is done with \verb. Examples:<br />

\url{w_smith@xyz.com} or \url|w_smith@xyz.com|<br />

\urlstyle{style} . . . . . . . . . . . . . . . . . . . (4.9.2) – 112<br />

With the url package, sets the typeface for subsequent \url comm<strong>and</strong>s,<br />

where style is one of tt, rm, sf, or same, for typewriter,<br />

Roman, sans serif, or unchanged font, respectively.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 591<br />

\usebox{boxname} . . . . . . . . . . . . . . . . . . . (4.7.1) – 87<br />

Inserts in<strong>to</strong> the text the contents of the box that was saved with the<br />

\sbox or \savebox comm<strong>and</strong> under the name \boxname, which has<br />

been previously created with the \newsavebox comm<strong>and</strong>.<br />

\usecounter{counter} . . . . . . . . . . . . . . . . . . (4.4.1) – 75<br />

Comm<strong>and</strong> in the list environment that specifies which counter is <strong>to</strong><br />

be employed in the st<strong>and</strong>ard labels with the \item comm<strong>and</strong>s. This<br />

counter is incremented by one with each \item call.<br />

\usefont{code}{fam}{ser}{shp} . . . . . . . . . . . . . (A.1) – 369<br />

Activates the font with the given set of attributes in the current size.<br />

Is equivalent <strong>to</strong> selecting the given font attributes <strong>and</strong> then calling<br />

\selectfont.<br />

\usepackage[options]{packages}[version] [p] . . . . . . (3.1.2) – 41<br />

Loads one or more package files containing additional L AT E X or T E X<br />

definitions. The files have the extension.sty. More than one package<br />

may be specified in packages, the names being separated by commas.<br />

Any options listed will be applied <strong>to</strong> all packages. Furthermore, any<br />

options listed in the \documentclass comm<strong>and</strong> will also be applied<br />

<strong>to</strong> the package files.<br />

The optional version is a date, given in the form yyyy/mm/dd, as for<br />

example 1994/08/01. If the date of the package file is earlier than<br />

this, a warning message is printed.<br />

Example:<br />

\usepackage{bezier,ifthen}[1994/06/01]<br />

\v{x} . . . . . . . . . . . . . . . . . . . . . . . . . . (2.5.7) – 24<br />

Produces háček accent: \v{o} = ǒ.<br />

\value{counter} . . . . . . . . . . . . . . . . . . . . (8.1.3) – 183<br />

The current value of the number s<strong>to</strong>red in counter for use with comm<strong>and</strong>s<br />

that require a number. It does not output this number. For example,<br />

\setcounter{counter1}{\value{counter2}} sets counter1<br />

<strong>to</strong> the same value as that of counter2.<br />

\varepsilon [m] produces ε . . . . . . . . . . . . . . (5.3.1) – 125<br />

\varinjlim [m][a] produces ‘lim’ in formulas<br />

−→<br />

\varliminf [m][a] produces ‘lim’ in formulas<br />

. . . . .<br />

. . . . .<br />

(12.2.5) – 268<br />

(12.2.5) – 268<br />

\varlimsup [m][a] produces ‘lim’ in formulas . . . . . (12.2.5) – 268<br />

\varphi [m] produces ϕ . . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\varpi [m] produces ϖ . . . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\varprojlim [m][a] produces ‘lim’<br />

in formulas . . . . (12.2.5) – 268<br />

←−<br />

\varrho [m] produces ϱ . . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\varsigma [m] produces ς . . . . . . . . . . . . . . . (5.3.1) – 125


592 Appendix H. Comm<strong>and</strong> Summary<br />

\vartheta [m] produces ϑ . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\vdash [m] produces ⊢ . . . . . . . . . . . . . . . . . (5.3.6) – 127<br />

\vdots [m] produces . . . . . . . . . . . . . . . . . . . . (5.2.6) – 123<br />

\vec{x} [m] . . . . . . . . . . . . . . . . . . . . . . (5.3.9) – 129<br />

A vec<strong>to</strong>r symbol over the variable x: \vec{a} = a.<br />

\Vec{x} [m][a] . . . . . . . . . . . . . . . . . . . . (12.2.2) – 263<br />

With the amsmath package, can be used like \vec, but with multiple<br />

A M S-L AT E X math accents the positioning will be correct.<br />

\vec<strong>to</strong>r(∆x,∆y){length} . . . . . . . . . . . . . . (13.1.4) – 295<br />

A picture element comm<strong>and</strong> within a picture environment for drawing<br />

horizontal <strong>and</strong> vertical arrows of any length as well as slanted<br />

arrows at a limited number of angles. For horizontal <strong>and</strong> vertical<br />

arrows, the length argument is the actual length in units of<br />

\unitlength. For slanted arrows, length is the length of the projection<br />

on <strong>to</strong> the x-axis (horizontal displacement). The slope is determined<br />

by the (∆x, ∆y) arguments, which take on integral values<br />

such that −4 ≤ ∆x ≤ 4 <strong>and</strong> −4 ≤ ∆y ≤ 4. This comm<strong>and</strong> is the<br />

argument of a \put or \multiput comm<strong>and</strong>.<br />

\vee [m] produces ∨ . . . . . . . . . . . . . . . . . . (5.3.3) – 125<br />

\verb|source text| . . . . . . . . . . . . . . . . . . . . (4.9) – 110<br />

Everything that comes between the |...| symbols is output in the<br />

typewriter font exactly as is with no interpretation of special symbols<br />

or comm<strong>and</strong>s. Any symbol other than * may be used as the switch<br />

character, illustrated here as |, as long as it does not appear in<br />

source text.<br />

\verb*|source text| . . . . . . . . . . . . . . . . . . . (4.9) – 110<br />

The same as \verb except that blanks are made visible with the<br />

symbol .<br />

\vfill . . . . . . . . . . . . . . . . . . . . . . . . . . (2.7.3) – 32<br />

A vertical rubber spacing with a natural length of zero that can be<br />

stretched <strong>to</strong> any value. Used <strong>to</strong> fill up parts of a page with blank<br />

spacing. This comm<strong>and</strong> is an abbreviation for \vspace{\fill}.<br />

\visible . . . . . . . . . . . . . . . . . . . . . . (15.1.2) – 326<br />

In slides class, a declaration that counterm<strong>and</strong>s a previous<br />

\invisible comm<strong>and</strong>, making text printed again. It remains in<br />

effect until the end of the environment, or end of the curly braces,<br />

in which it was issued, or until \invisible is given. It is used for<br />

making overlays.<br />

\vline . . . . . . . . . . . . . . . . . . . . . . . . . . (4.8.1) – 97<br />

Prints a vertical rule within the column entry of a table in the tabular<br />

environment.


H.1. Brief description of the L AT E X comm<strong>and</strong>s 593<br />

\voffset . . . . . . . . . . . . . . . . . . . . . . . . . 602, 603<br />

Vertical offset of the output page from the printer border set by the<br />

printer driver. This printer border is normally 1 inch from the <strong>to</strong>p<br />

edge of the paper. The st<strong>and</strong>ard value of \voffset is 0 pt so that the<br />

<strong>to</strong>p reference margin of the page is identical with the printer margin.<br />

A new value is assigned with the \setlength comm<strong>and</strong>:<br />

\setlength{\voffset}{-1in}<br />

\vpageref[current][non-current]{key} . . . . . . . . (9.2.4) – 215<br />

With the varioref package, this is equivalent <strong>to</strong> on page<br />

\pageref{key}, unless \label{key} is on the current or adjacent<br />

page, in which case appropriate text is au<strong>to</strong>matically substituted,<br />

e.g., ‘on the next page’. The first optional argument is inserted for<br />

the current page, the second for other pages.<br />

\vref{key} . . . . . . . . . . . . . . . . . . . . . . (9.2.4) – 215<br />

With the varioref package, this is equivalent <strong>to</strong> \ref{key} on page<br />

\pageref{key}, unless \label{key} is on the current or adjacent<br />

page, in which case appropriate text is au<strong>to</strong>matically substituted for<br />

the page specification, e.g., ‘on the next page’.<br />

\vspace{height} . . . . . . . . . . . . . . . . . . . . . (2.7.3) – 32<br />

Produces vertical spacing of length height. It is ignored if it occurs<br />

at the beginning or end of a page.<br />

\vspace*{height} . . . . . . . . . . . . . . . . . . . . (2.7.3) – 32<br />

Produces vertical spacing of length height even at the beginning or<br />

end of a page.<br />

\wedge [m] produces ∧ . . . . . . . . . . . . . . . . . (5.3.3) – 125<br />

\whiledo{test}{do text} . . . . . . . . . . . . . . . . (8.3.5) – 193<br />

A conditional comm<strong>and</strong> available when the st<strong>and</strong>ard package ifthen<br />

has been loaded. The do text is inserted repeatedly as long as<br />

the logical statement test evaluates <strong>to</strong> 〈true〉. The logical statement<br />

may be relational (two numbers with one of < = > between<br />

them), an even–odd test (\isodd{number}), a comparison<br />

of two texts (\equal{text1}{text2}), a comparison of two lengths<br />

(\lengthtest{length1 op length2}, op is one of < = >), or a test<br />

of a boolean switch (\boolean{switch}). Switches are created with<br />

\newboolean{switch} <strong>and</strong> set with \setboolean{switch}{value},<br />

where value is true or false. Logical statements may be combined<br />

with logical opera<strong>to</strong>rs \<strong>and</strong>, \or, <strong>and</strong> \not, <strong>and</strong> grouped with \( <strong>and</strong><br />

\).<br />

\widehat{xyz} [m] . . . . . . . . . . . . . . . . . . . (5.3.9) – 129<br />

Produces a wide \hat symbol over several characters:<br />

\widehat{xyz} = xyz.


594 Appendix H. Comm<strong>and</strong> Summary<br />

\widetilde{xyz} [m] . . . . . . . . . . . . . . . . . (5.3.9) – 129<br />

Produces a wide \tilde symbol over several characters:<br />

\widetilde{xyz} = xyz.<br />

\width . . . . . . . . . . . . . . . . . . . . . . . . . . (4.7.1) – 86<br />

A length parameter equal <strong>to</strong> the natural width of a box; it may<br />

only be used in the width specification of \makebox, \framebox, or<br />

\savebox, or in the height specification of a \parbox or a minipage<br />

environment.<br />

\framebox[2\width]{text}<br />

\wp [m] produces ℘ . . . . . . . . . . . . . . . . . . . (5.3.6) – 127<br />

\wr [m] produces ≀ . . . . . . . . . . . . . . . . . . . (5.3.3) – 125<br />

\Xi [m] produces Ξ . . . . . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\xi [m] produces ξ . . . . . . . . . . . . . . . . . . . (5.3.1) – 125<br />

\xleftarrow[below]{above} [m][a] . . . . . . . . . (12.2.2) – 262<br />

With the amsmath package, draws leftward pointing arrow with above<br />

printed over it in superscript size, <strong>and</strong> optionally below beneath it in<br />

subscript size.<br />

\xrightarrow[below]{above} [m][a] . . . . . . . . . (12.2.2) – 262<br />

With the amsmath package, draws rightward pointing arrow with<br />

above printed over it in superscript size, <strong>and</strong> optionally below beneath<br />

it in subscript size.<br />

\zeta [m] produces ζ . . . . . . . . . . . . . . . . . (5.3.1) – 125


H.2 Summary tables <strong>and</strong> figures<br />

H.2. Summary tables <strong>and</strong> figures 595<br />

Table H.1 Font attribute comm<strong>and</strong>s (4.1.3) – p. 64.<br />

\rmfamily \textrm{text} Roman<br />

\sffamily \textsf{text} sans serif<br />

\ttfamily \texttt{text} typewriter<br />

\upshape \textup{text} upright<br />

\itshape \textit{text} italic<br />

\slshape \textsl{text} slanted<br />

\scshape \textsc{text} Small Caps<br />

\mdseries \textmd{text} medium<br />

\bfseries \textbf{text} bold face<br />

Table H.2 Math alphabet comm<strong>and</strong>s (5.4.2) – p. 133.<br />

\mathrm{text} Roman<br />

\mathsf{text} sansserif<br />

\mathnormal{text} nor mal<br />

\mathtt{text} typewriter<br />

\mathit{text} italic<br />

\mathbf{text} boldface<br />

\mathcal{text} CAL<br />

Table H.3 Font sizes (4.1.2) – p. 62.<br />

\tiny smallest<br />

\scriptsize very small<br />

\footnotesize smaller<br />

\small small<br />

\normalsize normal<br />

\large large<br />

\Large larger<br />

\LARGE even larger<br />

\huge still larger<br />

\Huge largest<br />

Table H.4 L AT E X 2.09 font declarations (F.2.1) – p. 485.<br />

\rm Roman \it Italic \sc Small Caps<br />

\bf Bold Face \sl Slanted \sf Sans Serif<br />

\tt Typewriter \mit Γ ΠΦ \cal CAL


596 Appendix H. Comm<strong>and</strong> Summary<br />

Table H.5 Dimensions (2.4.1) – p. 21.<br />

mm millimeter bp big point (1 in = 72 bp)<br />

cm centimeter dd (1157 dd = 1238 pt)<br />

in inch (1 in = 2.54 cm) cc cicero (1 cc = 12 dd)<br />

pt point (1 in = 72.27 pt) sp (1 pt = 65536 sp)<br />

pc pica (1 pc = 12 pt)<br />

em The current width of a capital M<br />

ex The current height of the letter x<br />

Table H.6 Accents (2.5.7) – p. 24.<br />

ò =\‘{o} ó=\’{o} ô=\ˆ{o} ö=\"{o} õ=\˜{o}<br />

ō =\={o} ˙o=\.{o} ŏ=\u{o} ǒ=\v{o} ő=\H{o}<br />

oo=\t{oo} o¸=\c{o} o . =\d{o} ō=\b{o} ˚o=\r{o}<br />

Table H.7 Special letters from other languages (2.5.6) – p. 24.<br />

œ={\oe} Œ={\OE} æ={\ae} Æ={\AE} ˚a={\aa} ˚A ={\AA} ¡ =!‘<br />

ø ={\o} Ø ={\O} ł ={\l} Ł ={\L} ß={\ss} SS={\SS} ¿=?‘<br />

Table H.8 Special symbols (2.5.5) – 23.<br />

† \dag § \S © \copyright ‡ \ddag \P £ \pounds<br />

Table H.9 Comm<strong>and</strong> symbols (2.5.4) – 23.<br />

$ \$ % \% { \{ \_ & \& # \# } \}<br />

Table H.10 Greek letters (5.3.1) – p. 125.<br />

Lower case letters<br />

α \alpha θ \theta o o τ \tau<br />

β \beta ϑ \vartheta π \pi υ \upsilon<br />

γ \gamma ι \iota ϖ \varpi φ \phi<br />

δ \delta κ \kappa ρ \rho ϕ \varphi<br />

ɛ \epsilon λ \lambda ϱ \varrho χ \chi<br />

ε \varepsilon µ \mu σ \sigma ψ \psi<br />

ζ \zeta ν \nu ς \varsigma ω \omega<br />

η \eta ξ \xi<br />

Upper case letters<br />

Γ \Gamma Λ \Lambda Σ \Sigma Ψ \Psi<br />

∆ \Delta Ξ \Xi Υ \Upsilon Ω \Omega<br />

Θ \Theta Π \Pi Φ \Phi


H.2. Summary tables <strong>and</strong> figures 597<br />

Table H.11 Binary operation symbols (5.3.3) – p. 125.<br />

± \pm ∩ \cap ◦ \circ ○ \bigcirc<br />

∓ \mp ∪ \cup • \bullet \Box<br />

× \times ⊎ \uplus ⋄ \diamond ♦ \Diamond<br />

÷ \div ⊓ \sqcap ⊳ \lhd △ \bigtriangleup<br />

· \cdot ⊔ \sqcup ⊲ \rhd ▽ \bigtriangledown<br />

∗ \ast ∨ \vee ⊴ \unlhd ⊳ \triangleleft<br />

⋆ \star ∧ \wedge ⊵ \unrhd ⊲ \triangleright<br />

† \dagger ⊕ \oplus ⊘ \oslash \ \setminus<br />

‡ \ddagger ⊖ \ominus ⊙ \odot ≀ \wr<br />

∐ \amalg ⊗ \otimes<br />

Table H.12 Relational symbols (5.3.4) – p. 126.<br />

≤ \le<br />

≪ \ll<br />

\leq ≥ \ge<br />

≫ \gg<br />

\geq ≠ \neq<br />

.<br />

= \doteq<br />

∼ \sim<br />

\simeq<br />

⊂ \subset ⊃ \supset ≈ \approx ≍ \asymp<br />

⊆ \subseteq ⊇ \supseteq ≅ \cong ⌣ \smile<br />

⊏ \sqsubset ⊐ \sqsupset ≡ \equiv ⌢ \frown<br />

⊑ \sqsubseteq ⊒ \sqsupseteq ∝ \prop<strong>to</strong> ⋈ \bowtie<br />

∈ \in ∋ \ni ≺ \prec ≻ \succ<br />

⊢ \vdash ⊣ \dashv \preceq \succeq<br />

⊨ \models ⊥ \perp \parallel \| | \mid |<br />

Table H.13 Negated relational symbols (5.3.4) – p. 127.<br />

< \not< > \not> = \not=<br />

≤ \not\le ≥ \not\ge ≡ \not\equiv<br />

≺ \not\prec ≻ \not\succ ∼ \not\sim<br />

\not\preceq \not\succeq \not\simeq<br />

⊂ \not\subset ⊃ \not\supset ≈ \not\approx<br />

⊆ \not\subseteq ⊇ \not\supseteq ≅ \not\cong<br />

⊑ \not\sqsubseteq ⊒ \not\sqsupseteq ≍ \not\asymp<br />

∈ \not\in ∉ \notin<br />

Table H.14 Brackets (5.4.1) – p. 132.<br />

( ( ) ) ⌊ \lfloor ⌋ \rfloor<br />

[ [ ] ] ⌈ \lceil ⌉ \rceil<br />

{ \{ } \} 〈 \langle 〉 \rangle<br />

| | \| ↑ \uparrow ⇑ \Uparrow<br />

/ / \ \backslash ↓<br />

<br />

\downarrow<br />

\updownarrow<br />

⇓<br />

<br />

\Downarrow<br />

\Updownarrow


598 Appendix H. Comm<strong>and</strong> Summary<br />

Table H.15 Arrows (5.3.5) – p. 127.<br />

← \leftarrow \gets ←− \longleftarrow ↑ \uparrow<br />

⇐ \Leftarrow ⇐= \Longleftarrow ⇑ \Uparrow<br />

→ \rightarrow \<strong>to</strong> −→ \longrightarrow ↓ \downarrow<br />

⇒ \Rightarrow =⇒ \Longrightarrow ⇓ \Downarrow<br />

↔ \leftrightarrow ←→ \longleftrightarrow \updownarrow<br />

⇔ \Leftrightarrow ⇐⇒ \Longleftrightarrow \Updownarrow<br />

↦→ \maps<strong>to</strong> ↦−→ \longmaps<strong>to</strong> ↗ \nearrow<br />

←↪ \hookleftarrow ↩→ \hookrightarrow ↘ \searrow<br />

↼ \leftharpoonup ⇀ \rightharpoonup ↙ \swarrow<br />

↽ \leftharpoondown ⇁ \rightharpoondown ↖ \nwarrow<br />

⇌ \rightleftharpoons ⇝ \leads<strong>to</strong><br />

Table H.16 Miscellaneous symbols (5.3.6) – p. 127.<br />

ℵ \aleph ′ \prime ∀ \forall \Box<br />

ℏ \hbar ∅ \emptyset ∃ \exists ♦ \Diamond<br />

ı \imath ∇ \nabla ¬ \neg △ \triangle<br />

j \jmath √ \surd ♭ \flat ♣ \clubsuit<br />

ℓ \ell ∂ \partial ♮ \natural ♦ \diamondsuit<br />

℘ \wp ⊤ \<strong>to</strong>p ♯ \sharp ♥ \heartsuit<br />

ℜ \Re ⊥ \bot \| ♠ \spadesuit<br />

ℑ \Im ⊢ \vdash ∠ \angle ⋈ \Join<br />

\mho ⊣ \dashv \ \backslash ∞ \infty<br />

The underlined comm<strong>and</strong>s in Tables H.11, H.12, H.15, <strong>and</strong> H.16 can only be used<br />

in L AT E X 2ε if one of the packages latexsym or amsfonts has been loaded.<br />

Table H.17 Mathematical symbols in two sizes (5.3.7) – p. 128.<br />

<br />

\sum<br />

\bigcap<br />

\bigodot<br />

<br />

<br />

<br />

\int<br />

\bigcup<br />

\bigotimes<br />

<br />

<br />

<br />

\oint<br />

\bigsqcup \bigoplus<br />

<br />

\prod<br />

\bigvee<br />

\biguplus<br />

\coprod \bigwedge<br />

Table H.18 Function names (5.3.8) – p. 128.<br />

\arccos \cosh \det \inf \limsup \Pr \tan<br />

\arcsin \cot \dim \ker \ln \sec \tanh<br />

\arctan \coth \exp \lg \log \sin<br />

\arg \csc \gcd \lim \max \sinh<br />

\cos \deg \hom \liminf \min \sup


H.2. Summary tables <strong>and</strong> figures 599<br />

Table H.19 Math accents (5.3.9) – p. 129.<br />

â \hat{a} ă \breve{a} à \grave{a} ā \bar{a}<br />

ǎ \check{a} á \acute{a} ã \tilde{a} a \vec{a}<br />

˙a \dot{a} ä \ddot{a} ˚a \mathring{a}<br />

The following symbols are made available with the package amssymb.<br />

Table H.20 A M S arrows<br />

⇢ \dashrightarrow ⇠ \dashleftarrow<br />

⇔ \leftleftarrows ⇆ \leftrightarrows<br />

⇚ \Lleftarrow ↞ \twoheadleftarrow<br />

↢ \leftarrowtail ↫ \looparrowleft<br />

⇋ \leftrightharpoons ↶ \curvearrowleft<br />

↺ \circlearrowleft ↖ \Lsh<br />

⇈ \upuparrows ↿ \upharpoonleft<br />

⇃ \downharpoonleft ⊸ \multimap<br />

↭ \leftrightsquigarrow ⇒ \rightrightarrows<br />

⇄ \rightleftarrows ⇒ \rightrightarrows<br />

⇄ \rightleftarrows ↠ \twoheadrightarrow<br />

↣ \rightarrowtail ↬ \looparrowright<br />

⇌ \rightleftharpoons ↷ \curvearrowright<br />

↻ \circlearrowright ↗ \Rsh<br />

⇊ \downdownarrows ↾ \upharpoonright<br />

⇂ \downharpoonright ⇝ \rightsquigarrow<br />

Negated arrows<br />

↚ \nleftarrow ↛ \nrightarrow<br />

⇍ \nLeftarrow ⇏ \nRightarrow<br />

\nleftrightarrow \nLeftrightarrow<br />

Table H.21 A M S binary operation symbols<br />

∔ \dotplus \smallsetminus<br />

⋓ \Cap ⋒ \Cup<br />

⊼ \barwedge ⊻ \veebar<br />

⊼ \doublebarwedge ⊟ \boxminus<br />

⊠ \boxtimes ⊡ \boxdot<br />

⊞ \boxplus ⋇ \divideontimes<br />

⋉ \ltimes ⋊ \rtimes<br />

⋋ \leftthreetimes ⋌ \rightthreetimes<br />

⋏ \curlywedge ⋎ \curlyvee<br />

⊝ \circleddash ⊛ \circledast<br />

⊚ \circledcirc \centerdot<br />

⊺ \intercal


600 Appendix H. Comm<strong>and</strong> Summary<br />

Table H.22 A M S Greek <strong>and</strong> Hebrew letters<br />

F \digamma ϰ \varkappa<br />

\beth \daleth ג \gimel<br />

Table H.23 A M S delimiters<br />

\ulcorner \urcorner \llcorner \lrcorner<br />

Table H.24 A M S relational symbols<br />

≦ \leqq \leqslant<br />

⋜ \eqslantless ≲ \lesssim<br />

\lessapprox ≊ \approxeq<br />

⋖ \lessdot ⋘ \lll<br />

≶ \lessgtr ⋚ \lesseqgtr<br />

\lesseqqgtr ≑ \doteqdot<br />

≓ \risingdotseq ≒ \fallingdotseq<br />

∽ \backsim ⋍ \backsimeq<br />

\subseteqq ⋐ \Subset<br />

⊏ \sqsubset ≼ \preccurlyeq<br />

⋞ \curlyeqprec ≾ \precsim<br />

\precapprox ⊳ \vartriangleleft<br />

⊴ \trianglelefteq ⊨ \vDash<br />

⊪ \Vvdash ⌣ \smallsmile<br />

⌢ \smallfrown ≏ \bumpeq<br />

≎ \Bumpeq ≧ \geqq<br />

\geqslant ⋝ \eqslantgtr<br />

≳ \gtrsim \gtrapprox<br />

⋗ \gtrdot ⋙ \ggg<br />

≷ \gtrless ⋛ \gtreqless<br />

\gtreqqless ≖ \eqcirc<br />

≗ \circeq ≜ \triangleq<br />

∼ \thicksim ≈ \thickapprox<br />

\supseteqq ⋑ \Supset<br />

⊐ \sqsupset ≽ \succcurlyeq<br />

⋟ \curlyeqsucc ≿ \succsim<br />

≿ \succapprox ⊲ \vartriangleright<br />

⊵ \trianglerighteq ⊩ \Vdash<br />

\shortmid \shortparallel<br />

≬ \between ⋔ \pitchfork<br />

∝ \varprop<strong>to</strong> ◭ \blacktriangleleft<br />

∴ \therefore ∋ \backepsilon<br />

◮ \blacktriangleright ∵ \because


H.2. Summary tables <strong>and</strong> figures 601<br />

Table H.25 A M S negated relational symbols<br />

≮ \nless \nleq<br />

≰ \nleqslant \nleqq<br />

\lneq ≨ \lneqq<br />

\lvertneqq ⋦ \lnsim<br />

\lnapprox ⊀ \nprec<br />

\npreceq ⋨ \precnsim<br />

\precnapprox ≁ \nsim<br />

\nshortmid ∤ \nmid<br />

⊬ \nvdash \nvDash<br />

⋪ \ntriangleleft ⋬ \ntrianglelefteq<br />

⊈ \nsubseteq ⊊ \subsetneq<br />

\varsubsetneq \subsetneqq<br />

\varsubsetneqq ≯ \ngtr<br />

\ngeq ≱ \ngeqslant<br />

\ngeqq \gneq<br />

≩ \gneqq \gvertneqq<br />

⋧ \gnsim \gnapprox<br />

⊁ \nsucc \nsucceq<br />

\nsucceq \succnsim<br />

⋩ \succnapprox ≇ \ncong<br />

\nshortparallel ∦ \nparallel<br />

\nvDash \nVDash<br />

⋫ \ntriangleright ⋭ \ntrianglerighteq<br />

⊉ \nsupseteq \nsupseteqq<br />

⊋ \supsetneq \varsupsetneq<br />

\supsetneqq \varsupsetneqq<br />

Table H.26 Miscellaneous A M S symbols<br />

\hbar ℏ \hslash<br />

△ \vartriangle ▽ \triangledown<br />

\square ♦ \lozenge<br />

\circledS ∠ \angle<br />

∡ \measuredangle ∄ \nexists<br />

\mho \Finv<br />

\Game k \Bbbk<br />

\backprime \varnothing<br />

\blacktriangle \blacktriangledown<br />

\blacksquare \blacklozenge<br />

\bigstar ∢ \sphericalangle<br />

∁ \complement ∂ \eth<br />

\diagup \diagdown


602 Appendix H. Comm<strong>and</strong> Summary<br />

✲ ❄ h v ❄<br />

\voffset<br />

✻<br />

❄<br />

✻ \headheight<br />

❄<br />

\<strong>to</strong>pmargin<br />

❄ \headsep<br />

✻ \<strong>to</strong>pskip<br />

Rev.<br />

marg.<br />

note<br />

Marg.<br />

note,<br />

even<br />

pages<br />

✛ ✲<br />

❄<br />

\textheight<br />

❄<br />

✍☞ \oddsidemargin<br />

▲ \evensidemargin<br />

✲ ✛ \hoffset<br />

✻<br />

Head<br />

First line of text<br />

Body<br />

\textfraction×\textheight<br />

Min. space for text<br />

when floats are present<br />

❄<br />

\<strong>to</strong>pfraction×\textheight<br />

Max. space for floats at <strong>to</strong>p<br />

✛ ✲<br />

\textwidth<br />

Foot<br />

\marginparpush<br />

\marginparwidth<br />

\marginparsep ✲<br />

\bot<strong>to</strong>mfraction×\textheight<br />

Max. space for floats at bot<strong>to</strong>m<br />

\footskip<br />

Figure H.1 Single column page format<br />

(3.2.5), p. 48 – (4.10.6), p. 118 – (7.3), p. 172.<br />

❄<br />

✻<br />

❄<br />

✻<br />

❄<br />

Normal<br />

marg.<br />

note<br />

✻<br />

❄<br />

✛<br />

☎<br />

✲<br />

✛<br />

Marg.<br />

note,<br />

odd<br />

pages


✲ ❄ h v ❄<br />

\voffset<br />

✻<br />

❄<br />

✻ \headheight<br />

❄<br />

\<strong>to</strong>pmargin<br />

❄ \headsep<br />

✻ \<strong>to</strong>pskip<br />

Marg.<br />

note,<br />

left<br />

column<br />

✛ ✲<br />

❄First<br />

line of text<br />

H.2. Summary tables <strong>and</strong> figures 603<br />

Head<br />

Left column Right column<br />

✛ \columnwidth ✲<br />

\textheight<br />

✛ ✲<br />

\textwidth<br />

❄<br />

✍☞ \oddsidemargin<br />

▲ \evensidemargin<br />

✲ ✛ \hoffset<br />

✲ ✛ \columnseprule<br />

(line thickness)<br />

✲✛<br />

\columnsep<br />

Foot<br />

✻<br />

\dbl<strong>to</strong>pfraction×<br />

\textheight<br />

Max. space for floats<br />

extending over<br />

two columns<br />

❄<br />

\marginparpush<br />

\marginparwidth<br />

\marginparsep ✲<br />

Reserved space for floats<br />

within one column as for<br />

the single column format<br />

\footskip<br />

Figure H.2 Double column page format<br />

(3.2.5), p. 48 – (3.1.1), p. 40 – (4.10.6), p. 118 – (7.3), p. 172.<br />

❄<br />

Marg.<br />

note,<br />

right<br />

column<br />

✻<br />

❄<br />

✛<br />

☎<br />

✲<br />


604 Appendix H. Comm<strong>and</strong> Summary<br />

Remarks on the page format figures<br />

The reference margins in the L AT E X processing are shifted from the logical<br />

margins by the amounts \hoffset <strong>and</strong> \voffset. These in turn are<br />

displaced from the physical margins by h <strong>and</strong> v in the DVI driver. The<br />

default values for \hoffset <strong>and</strong> \voffset are 0 pt, so that the reference<br />

margins are equal <strong>to</strong> the logical ones. The usual values for h <strong>and</strong> v are<br />

1 inch. Thus the logical page margins on the left <strong>and</strong> at the <strong>to</strong>p are shifted<br />

1 inch from the physical edge of the paper. The user may alter this by<br />

changing the values of \hoffset <strong>and</strong> \voffset.<br />

L AT E X 2ε recognizes the parameters \paperwidth <strong>and</strong> \paperheight<br />

which contain the full dimensions of the paper, including the 1 inch<br />

margins. These are set by the paper size option <strong>to</strong> the class specification.<br />

The parameter \footheight was specified but never used in L AT E X 2.09;<br />

it has been dropped from L AT E X 2ε.<br />

Preceding text<br />

✻<br />

\<strong>to</strong>psep + \parskip [+ \par<strong>to</strong>psep]<br />

\labelsep<br />

✛ ✲<br />

❄<br />

✛ ✲<br />

Label<br />

\rightmargin<br />

✛ ✲ ✛ ✲<br />

Item 1<br />

✛<br />

\labelwidth<br />

✲ \itemindent Paragraph 1<br />

\leftmargin<br />

\listparindent ✻\parsep<br />

✛ ✲ ❄<br />

Item 1<br />

Paragraph 2<br />

Label<br />

✻\itemsep<br />

+ \parsep<br />

❄<br />

Item 2<br />

✻<br />

\<strong>to</strong>psep + \parskip [+ \par<strong>to</strong>psep]<br />

❄<br />

Following text<br />

Figure H.3 Format of the list environment (4.4.2) – p. 75.<br />

Note 1: The default values for the three parameters \itemindent,<br />

\listparindent, \rightmargin are 0 pt.<br />

Note 2: The default values in the trivlist environment are 0 pt for<br />

\itemindent, \leftmargin, \rightmargin, <strong>and</strong> \labelwidth; on<br />

the other h<strong>and</strong>, \parsep <strong>and</strong> \listparindent are assigned the<br />

respective values of \parskip <strong>and</strong> \parindent.


Bibliography<br />

Abrahams P. W., with Hargreaves K. A. <strong>and</strong> Berry K. (1990). T E X for the<br />

Impatient. Reading MA: Addison-Wesley<br />

Beccari, C. (1997). Typesetting mathematics for science <strong>and</strong> technology<br />

according <strong>to</strong> ISO 31/XI. TUGboat, 18(1), 39–48<br />

Botway L. <strong>and</strong> Biemesderfer C. (1985). L AT E X Comm<strong>and</strong> Summary. Providence<br />

RI: T E X Users Group<br />

Eijkhout V. (1992). T E X by Topic, a T E Xnician’s Reference. Harlow: Addison-<br />

Wesley<br />

Flynn P. (1995). HTML & T E X: Making them sweat. TUGboat, 16(2), 146–150<br />

Haralambous Y. <strong>and</strong> Rahtz S. (1995). L AT E X, hypertext <strong>and</strong> PDF, or the entry<br />

of T E X in<strong>to</strong> the world of hypertext. TUGboat, 16(2), 162–173<br />

Goossens M. <strong>and</strong> Saarela J. (1995). From L AT E X <strong>to</strong> HTML <strong>and</strong> back. TUGboat,<br />

16(2), 174–214<br />

Goossens M., Mittelbach F. <strong>and</strong> Samarin A. (1994). The L AT E X Companion.<br />

Reading MA: Addison-Wesley<br />

Goossens M., Rahtz S. <strong>and</strong> Mittelbach F. (1997). The L AT E X Graphics Companion.<br />

Reading MA: Addison-Wesley<br />

Goossens M. <strong>and</strong> Rahtz S. (1999). The L AT E X Web Companion. Reading MA:<br />

Addison-Wesley<br />

Knuth D. E. (1986a). The T E Xbook, Computers <strong>and</strong> Typesetting, Vol. A.<br />

Reading MA: Addison-Wesley<br />

Knuth D. E. (1986b). T E X: The Program, Computers <strong>and</strong> Typesetting, Vol. B.<br />

Reading MA: Addison-Wesley<br />

Knuth D. E. (1986c). The METAFONT book, Computers <strong>and</strong> Typesetting,<br />

Vol. C. Reading MA: Addison-Wesley<br />

Knuth D. E. (1986d). METAFONT: The Program, Computers <strong>and</strong> Typesetting,<br />

Vol. D. Reading MA: Addison-Wesley<br />

605


606 BIBLIOGRAPHY<br />

Knuth D. E. (1986e). Computer Modern Typefaces, Computers <strong>and</strong> Typesetting,<br />

Vol. E. Reading MA: Addison-Wesley<br />

Kopka H. (1994). L AT E X, B<strong>and</strong> 1, eine Einführung. Bonn: Addison-Wesley<br />

Kopka H. (1995). L AT E X, B<strong>and</strong> 2, Ergänzungen, mit einer Einführung in<br />

METAFONT. Bonn: Addison-Wesley<br />

Kopka H. (1997). L AT E X, B<strong>and</strong> 3, Erweiterungen. Bonn: Addison-Wesley<br />

Lamport L. (1985). L AT E X—A Document Preparation System. Reading MA:<br />

Addison-Wesley<br />

Lamport L. (1994). L AT E X—A Document Preparation System, 2nd edn. for<br />

L AT E X 2ε. Reading MA: Addison-Wesley<br />

Marchal, B. XML by Example. Indianapolis IN: Que-Programming<br />

Merz T. (1997). PostScript & Acrobat/PDF. Berlin: Springer-Verlag<br />

Merz T. (1998). Web Publishing with Acrobat/PDF. Berlin: Springer-Verlag<br />

Rokicki T. (1985). Packed (PK) font file format. TUGboat, 6(3), 115–20<br />

Reckdahl, K. (1996a). Using EPS graphics in L AT E X 2ε documents, part 1:<br />

The graphics <strong>and</strong> graphicx packages. TUGboat, 17(1), 43–53<br />

Reckdahl K. (1996b). Using EPS graphics in L AT E X 2ε documents, part 2:<br />

Floating figures, boxed figures, captions, <strong>and</strong> math in figures. TUGboat,<br />

17(3), 288–310<br />

Samuel A. L. (1985). First Grade T E X: A Beginner’s T E X Manual. Providence,<br />

RI: T E X Users Group<br />

Schwarz N. (1990). Introduction <strong>to</strong> T E X. Reading MA: Addison-Wesley<br />

Snow W. (1992). T E X for the Beginner. Reading MA: Addison-Wesley<br />

Sojka P., Thành H. T. <strong>and</strong> Zlatuˇska J. The joy of T E X2PDF—Acrobatics with<br />

an alternative <strong>to</strong> DVI format. TUGboat, 17(3), 244–251<br />

Spivak M. (1986). The Joy of T E X . Providence RI: American Mathematical<br />

Society<br />

Taylor P. (1996). Computer typesetting or electronic publishing? New<br />

trends in scientific publication. TUGboat, 17(4), 367–381<br />

Urban M. (1986). An Introduction <strong>to</strong> L AT E X . Providence RI: T E X Users Group<br />

Williamson, H. A. XML from A <strong>to</strong> Z. Redmond WA: Redmond Technology<br />

Press


Index<br />

For purposes of alphabetization, the backslash character \ is ignored at the start<br />

of an entry. Otherwise, the ordering is by the ascii sequence.<br />

Bold page numbers indicate the place where the comm<strong>and</strong> or concept is introduced,<br />

explained, or defined. Slanted page numbers refer <strong>to</strong> the Comm<strong>and</strong><br />

Summary, Appendix H.<br />

The keyword index is set up with main <strong>and</strong> two sub-entries. If a keyword cannot<br />

be found as a main entry, one should try <strong>to</strong> find it as a sub-entry <strong>to</strong> some more<br />

general term. Such major <strong>to</strong>pics are<br />

A M S-L AT E X, bibliographic database, bibliography, box, comm<strong>and</strong>, comm<strong>and</strong><br />

(user-defined), cross-reference, error messages, exercises, file types, float,<br />

fonts, footnote, formula, hyphenation, L AT E X, L AT E X counters, letter, line<br />

breaking, lists, package, page breaking, page formatting, page numbering,<br />

page style, picture, PostScript, programming, sectioning, seminar, slides,<br />

spacing, style parameter, symbols, tabbing, table, table examples, T E X, text.<br />

! (MakeIndex), 226, 507<br />

\!, 145, 269, 507<br />

!‘, 24, 507<br />

" (BIBT E X), 311, 508<br />

" (MakeIndex), 227, 508<br />

", 23, 508<br />

\" (¨ accent), 24, 508<br />

##, 204, 508<br />

\#, 23, 425, 508<br />

#, 17, 187, 425, 429, 508<br />

$$, 120<br />

\$, 17, 23, 27, 28, 413, 508<br />

$, 17, 120, 413, 425, 426, 508<br />

\%, 23, 27, 28, 118, 508<br />

%, 17, 22, 60, 111, 118, 508<br />

\&, 23, 508<br />

&, 17, 97, 139, 272, 274, 425, 508<br />

\’ (tabbing), 83, 508<br />

’’, 23<br />

’, 23<br />

\’ (´ accent), 24, 508<br />

( (BIBT E X), 312, 509<br />

\(, 119, 416, 425, 509<br />

(, 132, 509<br />

( (picture), 289, 509<br />

) (BIBT E X), 312, 509<br />

\), 119, 416, 509<br />

), 132, 509<br />

) (picture), 289, 509<br />

\+ (tabbing), 82, 84, 420, 509<br />

\,, 29, 123, 144, 145, 269, 509<br />

\- (tabbing), 82, 84, 420, 509<br />

\- (hyphenation), 35, 40, 427, 434,<br />

509<br />

-, 23, 509<br />

--, 23, 509<br />

---, 23, 509<br />

\. (˙ accent), 24, 509<br />

\/, 26, 509<br />

/, 132<br />

\:, 145, 269, 509<br />

\;, 145, 269, 509<br />

\< (tabbing), 82, 415, 420, 510<br />

\= (tabbing), 81, 82, 83, 419, 510<br />

607


608 INDEX<br />

\= (¯ accent), 24, 510<br />

\> (tabbing), 81, 82–4, 420, 510<br />

?‘, 24, 510<br />

@ (BIBT E X), 312–14, 510<br />

@ (MakeIndex), 226, 510<br />

\@, 29, 510<br />

@-expression, 96, 101, 110<br />

\@date, 363<br />

\@evenfoot, 362, 455<br />

\@evenhead, 362, 455<br />

\@for, 450<br />

\@ifnextchar, 449<br />

\@ifstar, 449<br />

\@ifundefined, 449<br />

\@latexerr, 439<br />

\@namedef, 449<br />

\@nameuse, 449, 458<br />

\@oddfoot, 362, 455<br />

\@oddhead, 362, 455<br />

\@onlypreamble, 455<br />

\@seccntformat, 457<br />

\@startsection, 456<br />

\@warning, 439<br />

\[, 120, 124, 416, 425, 510, 549<br />

[, 18, 132, 426, 510<br />

\\, 31, 32, 53, 67, 68, 81, 84, 97, 99,<br />

104, 271, 297, 352, 419,<br />

425, 434, 510<br />

\\*, 31, 279, 510<br />

\], 120, 124, 416, 510<br />

], 18, 132, 510<br />

\ˆ, 23<br />

ˆ, 17, 121, 123, 424, 511<br />

\ˆ (ˆ accent), 24, 511<br />

\_, 23, 414, 511<br />

_, 17, 121, 123, 413, 424, 511<br />

\‘ (tabbing), 83, 511<br />

‘, 23<br />

‘‘, 23<br />

\‘ (` accent), 24, 511<br />

{, 17, 18, 312, 425, 511<br />

\{, 23, 120, 132, 511<br />

|, 126, 132, 270, 511<br />

| (MakeIndex), 227, 511<br />

\|, 126, 127, 132, 270, 511<br />

\| (table), 96<br />

}, 17, 18, 312, 425, 426, 428, 511<br />

\}, 23, 120, 132, 511<br />

˜, 17, 22, 28, 511<br />

\˜ (˜ accent), 24, 511<br />

10pt option, 38, 61<br />

11pt option, 38, 61<br />

12pt option, 38, 61, 456<br />

8r.enc, 235, 236<br />

\ , 22, 28, 507<br />

\a’ (tabbing), 83, 512<br />

a4paper option, 38, 359, 447, 452,<br />

456<br />

a5paper option, 38<br />

\a= (tabbing), 83, 512<br />

\a‘ (tabbing), 83, 512<br />

\AA, 24, 512<br />

\aa, 24, 512<br />

abbrv bibliography style, 311<br />

abbrvnat bibliography style, 221,<br />

311<br />

\abovedisplayshortskip, 149, 512<br />

\abovedisplayskip, 149, 512<br />

Abrahams, P. W., 605<br />

abstract, 55<br />

abstract environment, 55, 516<br />

\abstractname, 460, 512<br />

accents<br />

in tabbing environment, 83<br />

in other languages, 24<br />

mathematical, 129<br />

Acrobat, 16, 236, 237, 242, 247, 249<br />

Acrobat Distiller, 237, 239<br />

\Acrobatmenu (hyperref), 247, 342<br />

\acute, 129, 263, 512<br />

\Acute (A M S), 263, 512<br />

\addBut<strong>to</strong>n (pdfscreen), 342<br />

\addcontentsline, 59, 60, 174,<br />

427, 436, 512<br />

\adddialect (babel), 255<br />

\addlanguage (babel), 255<br />

\address, 351, 352, 353, 356, 512<br />

\addtime (slides), 327, 512<br />

\add<strong>to</strong>artlength (seminar), 332<br />

\add<strong>to</strong>contents, 59, 60, 174, 427,<br />

436, 513<br />

\add<strong>to</strong>counter, 21, 110, 115, 182,<br />

183, 418, 513<br />

\add<strong>to</strong>length, 184, 200, 453, 513<br />

\add<strong>to</strong>slidelength (seminar), 332<br />

\add<strong>to</strong>slidereset (seminar), 337


\addvspace, 185, 513<br />

Adobe Systems Inc., 25, 231, 236,<br />

249, 387, 504<br />

\AE, 24, 513<br />

\ae, 24, 513<br />

Afrikaans, 252<br />

afterpage package, 171, 394<br />

\aleph, 127, 513<br />

align environment (A M S), 270,<br />

274, 516<br />

align page style (seminar), 335<br />

alignat environment (A M S), 270,<br />

275, 516<br />

aligned environment (A M S), 276,<br />

516<br />

\allinethickness (eepic), 306<br />

\allowdisplaybreaks (A M S), 278,<br />

513<br />

alltt environment, 111, 392, 517<br />

alltt package, 111, 392<br />

allversions* environment<br />

(seminar), 336<br />

\Alph, 73, 114, 183, 278, 513<br />

\alph, 73, 114, 183, 191, 192, 513<br />

alpha bibliography style, 311<br />

\alpha, 125, 513<br />

alphabetic page numbering, 45<br />

\alsoname, 460, 513<br />

\amalg, 126, 513<br />

American Mathematical Society,<br />

151, 257<br />

American spelling, 195<br />

amsart class, 258<br />

amsbook class, 258<br />

amsbsy package, 144, 192, 258–9<br />

amscd package, 258, 263, 282<br />

amsfndoc.tex, 257<br />

amsfonts package, 126, 284–5,<br />

422, 494<br />

A M S-L AT E X, 257–85<br />

\Acute, 263, 512<br />

align environment, 270, 274,<br />

516<br />

alignat environment, 270,<br />

275, 516<br />

aligned environment, 276,<br />

516<br />

\allowdisplaybreaks, 278,<br />

513<br />

INDEX 609<br />

arrows, extended, 262<br />

\Bar, 263, 515<br />

\binom, 264, 525<br />

binomials, 264<br />

Bmatrix environment, 266,<br />

517<br />

bmatrix environment, 266,<br />

517<br />

\boldsymbol, 144, 258, 526<br />

\boxed, 142, 270, 526<br />

\Breve, 263, 526<br />

cases environment, 277, 517<br />

CD environment, 282<br />

\cfrac, 265, 527<br />

\Check, 263, 528<br />

CM fonts, 283<br />

commutative diagrams, 282<br />

Cyrillic fonts, 283, 497<br />

\dbinom, 265, 531<br />

\ddddot, 263, 532<br />

\dddot, 263, 532<br />

\Ddot, 263, 532<br />

\DeclareMathOpera<strong>to</strong>r, 268,<br />

282, 534<br />

\dfrac, 264, 537<br />

\displaybreak, 278, 538<br />

\Dot, 263, 539<br />

dots, 263<br />

\dots, 263, 539<br />

\dotsb, 264, 539<br />

\dotsc, 264, 539<br />

\dotsi, 264, 539<br />

\dotsm, 264, 539<br />

\eqref, 278, 541<br />

equation* environment, 272<br />

falign environment, 270,<br />

275, 518<br />

fonts, 283–5<br />

fractions, 264<br />

continued, 265<br />

user-defined, 265<br />

function names, 267<br />

defining, 268<br />

gather environment, 270,<br />

273, 519<br />

gathered environment, 276,<br />

519<br />

\genfrac, 265, 545<br />

\Grave, 263, 546


610 INDEX<br />

\Hat, 263, 546<br />

\hdotsfor, 267<br />

\idotsint, 260, 548<br />

\iiiint, 260, 551<br />

\iiint, 260, 551<br />

\iint, 260, 551<br />

\intertext, 259, 550<br />

\leftroot, 269, 554<br />

limits<br />

multiline, 261<br />

special, 261<br />

\lVert, 270, 557<br />

\lvert, 270, 557<br />

math symbols, 285<br />

\mathbb, 284<br />

matrix, 266<br />

matrix environment, 266, 519<br />

\medspace, 269, 560<br />

\mod, 268, 560<br />

\mspace, 269, 560<br />

multiline equations, 270–7<br />

page breaks, 278<br />

multiple integrals, 260<br />

multline environment, 270,<br />

271, 520<br />

\multlinegap, 271, 561<br />

\negmedspace, 269, 561<br />

\negthickspace, 269, 561<br />

\negthinspace, 269, 561<br />

\notag, 271, 565<br />

\numberwithin, 277, 565<br />

options, 279<br />

\overleftarrow, 262, 566<br />

\overleftrightarrow, 262,<br />

566<br />

\overrightarrow, 262, 567<br />

\overset, 262, 567<br />

pmatrix environment, 266,<br />

521<br />

\pmb, 258, 570<br />

\pod, 268, 570<br />

\raisetag, 271<br />

roots, 269<br />

\rVert, 270, 576<br />

\rvert, 270, 576<br />

\shoveleft, 271<br />

\shoveright, 271<br />

\sideset, 262, 579<br />

smallmatrix environment,<br />

267<br />

\smash, 269, 580<br />

split environment, 270, 272,<br />

276, 521<br />

subarray environment, 261,<br />

522<br />

subequations environment,<br />

277, 522<br />

\substack, 261, 581<br />

\tag, 271, 573, 583<br />

\tbinom, 265, 583<br />

\text, 259, 583<br />

\tfrac, 264, 586<br />

theorems, 280<br />

\theoremstyle, 281<br />

\thickspace, 269, 586<br />

\thinspace, 269, 586<br />

\Tilde, 263, 587<br />

\underleftarrow, 262, 589<br />

\underleftrightarrow, 262,<br />

589<br />

\underrightarrow, 262, 589<br />

\underset, 262, 590<br />

upright references, 282<br />

\uproot, 269, 590<br />

\varinjlim, 268, 591<br />

\varliminf, 268, 591<br />

\varlimsup, 268, 591<br />

\varprojlim, 268, 591<br />

\Vec, 263, 592<br />

vertical bars, 270<br />

Vmatrix environment, 266,<br />

524<br />

vmatrix environment, 266,<br />

524<br />

\xleftarrow, 263, 594<br />

\xrightarrow, 263, 594<br />

amsldoc.tex, 257, 282<br />

amsmath package, 192, 258<br />

amsopn package, 258, 267–8<br />

amsproc class, 258<br />

amssymb package, 284, 285<br />

A M S-T E X, 257<br />

amstex format, 257<br />

amstext package, 258–9<br />

amsthm package, 81, 258, 280–2,<br />

395<br />

\<strong>and</strong>, 53, 513


\angle, 127, 513<br />

ANSI coding, 26, 462<br />

apalike package, 220<br />

appendix, 57<br />

appendix environment, 516<br />

\appendix, 57<br />

\appendixname, 460, 513<br />

Apple Macin<strong>to</strong>sh coding, 26, 462<br />

\approx, 126, 514<br />

Arabic page numbering, 45<br />

\arabic, 73, 75, 77, 78, 114, 183,<br />

191, 277, 514<br />

\arc (eepic), 306<br />

\arccos, 128, 514<br />

\arcsin, 128, 514<br />

\arctan, 128, 514<br />

\arg, 128, 514<br />

argument, comm<strong>and</strong>, 18<br />

array environment, 95, 107, 134,<br />

146, 147, 149, 150, 266,<br />

394, 417, 418, 425, 428,<br />

429, 516<br />

array package, 107, 394<br />

\arraycolsep, 98, 149, 514<br />

\arrayrulewidth, 98, 514<br />

arrays, 133–6<br />

\arraystretch, 98, 514<br />

arrows, 127<br />

extended (A M S), 262<br />

Arseneau, Donald, 112, 224<br />

article class, 37, 41, 55, 113, 131,<br />

173, 191, 218, 225, 277,<br />

391, 397, 454, 459, 471<br />

article.cls, 397, 430<br />

article.sty (L AT E X 2.09), 430<br />

\articlemag (seminar), 332<br />

ascii, 5, 14, 17, 228, 231, 382, 487<br />

\askforoverwritefalse (DocStrip),<br />

465<br />

\ast, 126, 514<br />

\asymp, 126, 514<br />

\AtBeginDocument, 444, 472, 514<br />

\AtEndDocument, 444, 514<br />

\AtEndOfClass, 444, 515<br />

\AtEndOfPackage, 444, 515<br />

\a<strong>to</strong>p (T E X), 137, 146, 147, 189<br />

attributes, font, 64–5, 368–72<br />

defaults, 372<br />

\author, 52, 53, 54, 69, 431, 515<br />

INDEX 611<br />

.aux file, 209, 210, 214, 396, 397,<br />

418, 427, 430, 436<br />

auxiliary file, 214<br />

avant package, 234<br />

AvantGarde, PostScript font, 234,<br />

504<br />

axioms, 80<br />

b5paper option, 38<br />

\b ( ¯ accent), 24, 515<br />

babel package, 252–6<br />

babel.def (babel), 253<br />

babel, multilingual L AT E X, 216,<br />

252–6, 385, 460<br />

background package, 345–6<br />

\backgroundcolor (pdfscreen),<br />

342<br />

\backmatter, 57, 210, 515<br />

\backslash, 127, 132, 515<br />

Bahasa, 252<br />

bakoma fonts, 506<br />

bakomaextra.map, 506<br />

\bar, 129, 263, 515<br />

\Bar (A M S), 263, 515<br />

Barroca, Leonor, 159<br />

baseline, 46, 63<br />

\baselineskip, 63, 362, 369, 515<br />

\baselinestretch, 46, 47, 63, 515<br />

Basque, 252<br />

\batchinput (DocStrip), 466<br />

.bbl file, 219, 224, 310, 397<br />

Beccari, Claudio, 605<br />

\begin, 19, 64, 416–18, 516<br />

\belowdisplayshortskip, 149, 524<br />

\belowdisplayskip, 149, 524<br />

Berry naming scheme, 504<br />

Berry, Karl, 381, 504, 605<br />

\beta, 125, 524<br />

\bf (L AT E X 2.09), 65, 367, 485<br />

\bfdefault, 233, 372, 524<br />

\bfseries, 19, 20, 64, 371, 416, 524<br />

\bgadd (background), 346<br />

\bgaddcenter (background), 346<br />

\bgclear (background), 346<br />

.bib file, 309, 397<br />

\bibitem, 217, 219–21, 322, 395,<br />

429–31, 524<br />

bibliographic database, 219, 309–21<br />

abbreviations, 320


612 INDEX<br />

creating, 311<br />

cross-referencing, 316, 317<br />

entry type, 311, 312, 314<br />

field, 312<br />

abbreviations, 319<br />

ignored, 312<br />

list of, 314, 316<br />

names, 317, 318<br />

optional, 312, 314<br />

required, 312, 314<br />

special formats, 317<br />

titles, 318, 319<br />

journal abbreviations, 322<br />

structure, 311<br />

template, 311, 320<br />

bibliography, 216<br />

abbrv, 311<br />

abbrvnat, 221, 311<br />

alpha, 311<br />

author–year style, 220–4<br />

BIBT E X, 217, 219, 224, 309–21<br />

cus<strong>to</strong>mizing, 223, 321–2<br />

entry, 217<br />

format, see style<br />

multiple, 224<br />

numerical, 219<br />

open style, 39<br />

plain, 219, 310<br />

plainnat, 219, 221, 311<br />

reference in text, 219, 310<br />

style, 219, 221, 310<br />

unsrt, 310<br />

unsrtnat, 221, 311<br />

\bibliography, 210, 219, 224, 309,<br />

310, 397, 524<br />

\bibliographystyle, 219, 221,<br />

224, 310, 397, 524<br />

\bibname, 460, 525<br />

BIBT E X, 15, 217, 219, 224, 309–21,<br />

382, 388, 397, 430<br />

writing styles for, 321<br />

Biemesderfer, C., 605<br />

\Big (T E X), 148, 525<br />

\big (T E X), 148, 525<br />

\bigcap, 128, 525<br />

\bigcirc, 126, 525<br />

\bigcup, 128, 525<br />

\Bigg (T E X), 148, 525<br />

\bigg (T E X), 148, 525<br />

\bigodot, 128, 525<br />

\bigoplus, 128, 525<br />

\bigotimes, 128, 525<br />

\bigskip, 33, 525<br />

\bigskipamount, 525<br />

\bigsqcup, 128, 525<br />

\bigtriangledown, 126, 525<br />

\bigtriangleup, 126, 525<br />

\biguplus, 128, 525<br />

\bigvee, 128, 525<br />

\bigwedge, 128, 525<br />

binary opera<strong>to</strong>r symbols, 125<br />

\binom (A M S), 264, 525<br />

binomial coefficient, 137, 264<br />

blank, 11, 22<br />

after comm<strong>and</strong>, 19, 22, 27, 186<br />

at beginning of line, 22, 29<br />

forced, 22<br />

multiple, 11, 22<br />

protected, 22, 29<br />

rubber, 30<br />

suppression of, 22<br />

blank line for new paragraph, 22<br />

.blg file, 397<br />

Blue Sky Research, 382, 506<br />

bm package, 144, 394<br />

\bm, 144, 394<br />

Bmatrix environment (A M S), 266,<br />

517<br />

bmatrix environment (A M S), 266,<br />

517<br />

\bmod, 129, 268, 526<br />

body, 47<br />

bold face in formulas, 143, 394<br />

\boldmath, 143, 144, 150, 151, 373,<br />

394, 433, 526<br />

\boldsymbol (A M S), 144, 258, 526<br />

book class, 37, 41, 55, 57, 113, 130,<br />

173, 183, 187, 191, 218,<br />

224, 225, 277, 391, 459<br />

bookman package, 234<br />

Bookman, PostScript font, 234, 504<br />

\boolean (ifthen), 194, 195, 360,<br />

451, 453<br />

\bot, 127, 526<br />

\botfigrule, 173, 526<br />

bot<strong>to</strong>m margin, 48<br />

\bot<strong>to</strong>mbut<strong>to</strong>ns (pdfscreen), 342<br />

\bot<strong>to</strong>mfraction, 172, 526


ot<strong>to</strong>mnumber, 171, 526<br />

Botway, L., 605<br />

\bowtie, 126, 526<br />

box, 85–94<br />

calling, 87<br />

framed, 86<br />

lowering, 87<br />

LR, 85, 87<br />

nested, 92<br />

paragraph, 85<br />

parbox, 88<br />

positioning<br />

horizontal, 86<br />

vertical, 88, 89, 92<br />

raising, 87<br />

rule, 85, 91<br />

saving, 87<br />

style parameters, 93<br />

T E X primitive, 85<br />

vertical, 88<br />

\Box, 126, 127, 526<br />

boxed formula, 142, 270<br />

\boxed (A M S), 142, 270, 526<br />

bp (big point), 21, 155, 158<br />

Braams, Johannes, 252, 464<br />

\brace (T E X), 192<br />

\brack (T E X), 192<br />

bracket symbol, see symbols<br />

Bre<strong>to</strong>n, 252<br />

\breve, 129, 263, 526<br />

\Breve (A M S), 263, 526<br />

British spelling, 195<br />

bsr-interpolated.map, 506<br />

bsr.map, 506<br />

.bst file, 220, 221, 310, 321, 397<br />

btxdoc.tex, 321<br />

btxhak.tex, 321<br />

Bulgarian, 252<br />

\bullet, 126, 526<br />

\c (¸ accent), 24, 526<br />

calc package, 394<br />

calligraphic letters, 125, 284<br />

\cap, 126, 527<br />

\caption, 60, 108, 169, 173, 174,<br />

177, 178, 182, 213, 427,<br />

436, 527<br />

\captionslang (non-st<strong>and</strong>ard), 255,<br />

460, 527<br />

INDEX 613<br />

Carlisle, David, 154, 159, 193, 215,<br />

330, 480<br />

cases environment (A M S), 277,<br />

517<br />

Catalan, 252, 462<br />

catalogue.html, 13<br />

\cbinput (chapterbib), 224<br />

cbunit environment (chapterbib),<br />

224<br />

\cc, 353, 527<br />

cc (cicero), 21<br />

\ccname, 353, 460, 527<br />

CD environment (A M S), 282<br />

\cdot, 126, 527<br />

\cdots, 123, 134, 137, 263, 527<br />

center environment, 67, 69, 79, 98,<br />

176, 289, 516<br />

centered text, 67<br />

centering <strong>and</strong> indenting, 67–9<br />

\centering, 67, 69, 79, 178, 458,<br />

527<br />

\centerline (T E X), 67, 176, 408, 527<br />

\centerslidefalse (seminar), 334<br />

\centerslidetrue (seminar), 334<br />

centertags option, 272, 279<br />

.cfg file, 253, 384, 385, 397, 472<br />

\cfoot (fancyhdr), 44<br />

\cfrac (A M S), 265, 527<br />

\changes (doc), 470<br />

chapter counter, 57, 181, 183<br />

chapter opening page, 39<br />

\chapter, 44, 55, 58, 449, 527<br />

\chapter*, 55, 527<br />

chapterbib package, 224<br />

\chaptername, 460, 528<br />

character spacing, see spacing<br />

character specification, 66<br />

decimal, 66<br />

hexadecimal, 66<br />

octal, 66<br />

\CharacterTable (doc), 471<br />

\chead (fancyhdr), 44<br />

\check, 129, 263, 528<br />

\Check (A M S), 263, 528<br />

\CheckComm<strong>and</strong>, 430, 445, 528<br />

\CheckComm<strong>and</strong>*, 445<br />

\CheckSum (doc), 471<br />

chemical formulas, 143<br />

Chen, Pehong, 228


614 INDEX<br />

\chi, 125, 528<br />

chicago package, 220<br />

Chinese, 6<br />

\choose (T E X), 137, 146, 147, 189,<br />

192<br />

\circ, 126, 528<br />

\circle, 416<br />

\circle (eepic), 305<br />

\circle (picture), 295, 299, 300,<br />

431, 528<br />

\circle* (eepic), 305<br />

\circle* (picture), 295, 528<br />

\cite, 219, 310, 312, 314, 395, 429,<br />

430, 528<br />

\citeauthor (natbib), 222<br />

\citep (natbib), 219, 221, 310, 528<br />

\Citet (natbib), 222<br />

\citet (natbib), 219, 221, 310, 528<br />

\citeyear (natbib), 222<br />

\ClassError, 446, 528<br />

classes.dtx, 463<br />

\ClassInfo, 447, 529<br />

\ClassWarning, 446, 529<br />

\ClassWarningNoLine, 446, 529<br />

Clausen, Joern, 25<br />

\cleardoublepage, 34, 171, 420,<br />

529<br />

\clearpage, 34, 84, 171, 209, 420,<br />

428, 529<br />

forbidden, 84<br />

\cline, 97, 102, 106, 529<br />

.clo file, 384, 385, 397<br />

\closing, 353, 529<br />

.cls file, 384, 385, 398, 484<br />

\clubsuit, 127, 529<br />

cm (centimeter), 21<br />

cm-super fonts, 506<br />

\CodelineIndex (doc), 469<br />

\CodelineNumbered (doc), 470<br />

Codepages, IBM, 26, 462<br />

color package, 153, 166, 324, 325,<br />

335, 338, 345, 439<br />

\color (color), 167, 335, 529<br />

color.cfg, 166<br />

\colorbox (color), 167, 335, 529<br />

colors, 166–8<br />

column breaking, 34<br />

column separation<br />

two-column pages, 40<br />

column separation symbol, 97, 139<br />

\columnsep, 40, 51, 52, 395, 530<br />

\columnseprule, 40, 52, 395, 530<br />

\columnwidth, 51, 173<br />

comm<strong>and</strong><br />

*-form, 18<br />

distinguishing from text, 11<br />

followed by blank, 19, 186<br />

invisible, 201<br />

levels, 438<br />

multi-character, 17<br />

name, 17<br />

single character, 17<br />

syntax, 18<br />

two-character, 17<br />

comm<strong>and</strong> characters, printing of,<br />

23<br />

comm<strong>and</strong>, user-defined, 185–92<br />

examples<br />

T E X as L AT E X, 189<br />

equation numbering, 190<br />

footnotes, 190<br />

framing text, 189<br />

followed by blank, 186<br />

for math <strong>and</strong> text, 186<br />

general comments, 200<br />

nested, 204<br />

order of, 203<br />

scope of, 202<br />

global, 202<br />

local, 202<br />

s<strong>to</strong>ring, 200<br />

unwanted spacing, 201<br />

with arguments, 187, 188<br />

calling, 188<br />

with optional argument, 189<br />

without arguments, 185, 187<br />

calling, 186<br />

comment, 118<br />

character, 118<br />

comment environment (verbatim),<br />

111, 118, 396<br />

commenting out, 118<br />

compatibility mode, 392, 398, 418,<br />

484<br />

Comprehensive T E X Archive<br />

Network, see CTAN<br />

compressed graphics files, 166


Computer Modern fonts, 8, 64, 283,<br />

369, 488–97, 499<br />

PostScript version, 235, 505<br />

conditional text, 193<br />

config.cms, 235<br />

config.ps, 233, 235<br />

configuration file, local<br />

color, 166<br />

graphics, 164<br />

hyperref, 246<br />

hyphen, 253, 385<br />

L AT E X installation, 384<br />

ltxdoc, 397, 447, 472<br />

pdfscreen, 343<br />

seminar, 339, 340<br />

configuring L AT E X, 384<br />

\cong, 126, 530<br />

constant, see formula<br />

\contentsline, 530<br />

\contentsname, 459, 530<br />

continued fraction, 146, 149, 265<br />

continuing dots, 123, 263<br />

\coprod, 128, 530<br />

copyright sign, 23, 503<br />

\copyright, 23, 503, 530<br />

\copyrightspace, 391<br />

\cornersize (fancybox), 94<br />

\cos, 128, 530<br />

\cosh, 128, 530<br />

\cot, 128, 530<br />

\coth, 128, 530<br />

counter value, 183<br />

multiple printing, 183<br />

printing, 183<br />

counter, L AT E X, see L AT E X counter<br />

counter, user-defined, 182<br />

au<strong>to</strong>. reset, 182<br />

changing, 182<br />

creation, 182<br />

incrementing, 182<br />

setting, 182<br />

Courier, PostScript font, 234, 379,<br />

504<br />

Croatian, 252<br />

cross-reference, 213–16<br />

external document, 215<br />

<strong>to</strong> bibliography, 219<br />

<strong>to</strong> counters, 182, 213<br />

INDEX 615<br />

<strong>to</strong> equations, 131, 139, 213,<br />

278<br />

<strong>to</strong> figures, 177, 213<br />

<strong>to</strong> lists, 213<br />

<strong>to</strong> pages, 213<br />

<strong>to</strong> sections, 56, 213<br />

<strong>to</strong> tables, 177, 213<br />

<strong>to</strong> text, 213<br />

<strong>to</strong> theorems, 213<br />

variable, 215<br />

\csc, 128, 530<br />

CTAN, 381, 389<br />

\cup, 126, 530<br />

\CurrentOption, 359, 443, 530<br />

cyracc.def, 284<br />

Cyrillic fonts, 6, 283, 379, 497<br />

transliteration, 284<br />

Czech, 252<br />

\d ( . accent), 24, 531<br />

\dag, 23, 531<br />

dagger, 23<br />

\dagger, 126, 531<br />

Dahlgren, Mats, 178<br />

Daly, Patrick W., 220, 321<br />

Danish, 252<br />

DANTE, German-speaking T E X<br />

Users, 251<br />

dash, 23<br />

as hyphen, 23<br />

as minus sign, 23<br />

\dashbox (picture), 291, 292, 300,<br />

531<br />

dashjoin environment (epic), 302,<br />

304<br />

\dashline (epic), 302, 303<br />

\dashlinestretch (epic), 305<br />

\dashv, 126, 127, 531<br />

database, see bibliographic<br />

database<br />

\date, 52, 54, 69, 353, 358, 363, 531<br />

\datelang (non-st<strong>and</strong>ard), 255, 461,<br />

531<br />

.dat file, 253<br />

\day (T E X), 27, 460<br />

\dbinom (A M S), 265, 531<br />

\dblfigrule, 173, 531<br />

\dblfloatpagefraction, 172, 531<br />

\dblfloatsep, 172, 532


616 INDEX<br />

\dbltextfloatsep, 172, 532<br />

\dbl<strong>to</strong>pfraction, 172, 532<br />

dbl<strong>to</strong>pnumber, 172, 532<br />

DC fonts, see EC fonts<br />

dcolumn package, 107, 394<br />

dd (didôt), 21<br />

\ddag, 23, 532<br />

\ddagger, 126, 532<br />

\ddddot (A M S), 263, 532<br />

\dddot (A M S), 263, 532<br />

\ddot, 129, 263, 532<br />

\Ddot (A M S), 263, 532<br />

\ddots, 123, 532<br />

de Boer, Ingo H., 15<br />

DEC Multinational coding, 462<br />

declaration, 20<br />

local, 20<br />

scope of, 20<br />

\DeclareBoldMathComm<strong>and</strong> (bm),<br />

394<br />

\DeclareErrorFont, 376, 423, 424,<br />

532<br />

\DeclareFixedFont, 66, 361, 373,<br />

533<br />

\DeclareFontEncoding, 376, 378,<br />

379, 533<br />

\DeclareFontEncodingDefaults,<br />

376, 533<br />

\DeclareFontFamily, 376, 378,<br />

423, 533<br />

\DeclareFontShape, 377, 378, 423,<br />

533<br />

\DeclareFontSubstitution, 376,<br />

533<br />

\DeclareGraphicsExtensions<br />

(graphics), 165, 533<br />

\DeclareGraphicsRule<br />

(graphics), 165, 533<br />

\DeclareInputMath (inputenc),<br />

461<br />

\DeclareInputText (inputenc),<br />

461<br />

\DeclareMathAccent, 375, 423, 534<br />

\DeclareMathAlphabet, 191, 374,<br />

375, 416, 423, 534<br />

\DeclareMathDelimiter, 375, 534<br />

\DeclareMathOpera<strong>to</strong>r (A M S),<br />

268, 282, 534<br />

\DeclareMathRadical, 375, 534<br />

\DeclareMathSizes, 375, 534<br />

\DeclareMathSymbol, 375, 534<br />

\DeclareMathVersion, 374, 422,<br />

423, 535<br />

\DeclareOldFontComm<strong>and</strong>, 373, 535<br />

\DeclareOption, 359, 421, 442, 535<br />

\DeclareOption*, 359, 443, 535<br />

\declarepostamble (DocStrip), 465<br />

\declarepreamble (DocStrip), 465<br />

\DeclareRobustComm<strong>and</strong>, 445, 535<br />

\DeclareRobustComm<strong>and</strong>*, 445, 535<br />

\DeclareSymbolFont, 374, 423,<br />

424, 535<br />

\DeclareSymbolFontAlphabet,<br />

375, 424, 536<br />

\DeclareTextAccent, 379, 536<br />

\DeclareTextAccentDefault, 380,<br />

536<br />

\DeclareTextComm<strong>and</strong>, 379, 417,<br />

536<br />

\DeclareTextComm<strong>and</strong>Default,<br />

380, 536<br />

\DeclareTextComposite, 379, 422,<br />

536<br />

\DeclareTextCompositeComm<strong>and</strong>,<br />

379, 536<br />

\DeclareTextFontComm<strong>and</strong>, 373,<br />

536<br />

\DeclareTextSymbol, 379, 536<br />

\DeclareTextSymbolDefault, 380,<br />

537<br />

\def (T E X), 439, 445, 450<br />

.def file, 153, 253, 376, 378, 379,<br />

385, 392, 398<br />

\definecolor (color), 167, 345,<br />

537<br />

\deg, 128, 537<br />

dehyphn.tex, 256<br />

dehypht.tex, 256<br />

delarray package, 108, 394<br />

\DeleteShortVerb (shortvrb),<br />

111, 393, 468, 537<br />

\Delta, 125, 537<br />

\delta, 125, 537<br />

\depth, 86, 90, 537<br />

\DescribeEnvironment (doc), 468<br />

\DescribeMacro (doc), 468<br />

description environment, 69, 70,<br />

74, 79, 230, 419, 420, 517


design size, 501<br />

\det, 128, 129, 280, 537<br />

determinant, 133–6<br />

\dfrac (A M S), 264, 537<br />

\DH, 503, 537<br />

\dh, 503, 538<br />

diacritical marks, see accents<br />

\Diamond, 126, 127, 538<br />

\diamond, 126, 538<br />

\diamondsuit, 127, 538<br />

\dim, 128, 538<br />

\DisableCrossrefs (doc), 470<br />

\discretionary, 35, 538<br />

\displaybreak (A M S), 278, 538<br />

displayed formula, 119<br />

displayed text<br />

centered, 67<br />

indented, 67<br />

left or right justified, 67<br />

nested, 68<br />

displaymath environment, 120,<br />

517<br />

\displaystyle, 142, 146, 150, 264,<br />

538<br />

\div, 126, 538<br />

\DJ, 503, 538<br />

\dj, 503, 538<br />

doc package, 392, 399, 441, 467–73<br />

doc.dtx, 468<br />

DocBook DTD, 479<br />

\DocInput, 467<br />

DocStrip, 321, 398, 464–7<br />

docstrip.dtx, 467<br />

docstrip.tex, 385, 391, 465<br />

document class, 37<br />

options, 120<br />

document environment, 12, 517<br />

Document Type Definition, 479<br />

document, major subdivisions,<br />

52–7<br />

documentation<br />

browser, 383<br />

integrated, 463, 467<br />

with doc, 467–73<br />

documentation of packages, 13<br />

\documentclass, 12, 37, 41, 398,<br />

416, 422, 443, 538<br />

\documentstyle (L AT E X 2.09), 418,<br />

422, 483<br />

INDEX 617<br />

dollar sign, 23, 27<br />

\DoNotIndex (doc), 470<br />

\dot, 129, 263, 539<br />

\Dot (A M S), 263, 539<br />

\doteq, 126, 539<br />

\dotfill, 30, 84, 86, 135, 539<br />

\dots, 124, 539<br />

\dots (A M S), 263, 539<br />

\dotsb (A M S), 264, 539<br />

\dotsc (A M S), 264, 539<br />

\dotsi (A M S), 264, 539<br />

\dotsm (A M S), 264, 539<br />

dottedjoin environment (epic),<br />

302, 304<br />

\dottedline (epic), 302, 303<br />

double dagger, 23<br />

\doublebox (fancybox), 94, 539<br />

\doublerulesep, 98, 539<br />

\Downarrow, 127, 132, 539<br />

\downarrow, 127, 132, 539<br />

Downes, Michael, 257<br />

draft option, 39<br />

Drakos, Nikos, 476<br />

drawjoin environment (epic), 302,<br />

304<br />

\drawline (epic), 161, 302, 303<br />

\drawlinestretch (epic), 305<br />

driver, printer, 15, 153, 389, 391,<br />

398, 453, 488, 497<br />

.drv file, 463, 464<br />

DTD, 479<br />

DocBook, 479<br />

TEI, 479, 480<br />

.dtx file, 13, 384, 389, 398, 463, 465<br />

Duchier, Denys, 464<br />

Dutch, 252<br />

.dvi file, 14, 27, 153, 161, 236, 305,<br />

393, 403, 477<br />

dvipdf, graphics option, 154<br />

dvipdfm, PDF driver, 162, 237, 305,<br />

346, 387, 389<br />

dvipdfm, graphics option, 154, 237<br />

dvips, graphics option, 154<br />

dvips, printer driver, 15, 162, 167,<br />

168, 231, 236, 305, 332,<br />

333, 335, 337, 387, 389,<br />

476<br />

dvipsone, graphics option, 154<br />

dviwin, graphics option, 154


618 INDEX<br />

e.tex, 394, 413<br />

EC fonts, 393, 499–503<br />

calling, 501<br />

character assignments, 500<br />

special character comm<strong>and</strong>s,<br />

503<br />

with NFSS, 379<br />

\edef (T E X), 450<br />

eepic package, 305–6<br />

eepicemu package, 305<br />

Eijkhout, Vic<strong>to</strong>r, 450, 605<br />

electron volt, symbol, 30, 192<br />

electronic documents, 340, 475<br />

electronic projection, 323<br />

electronic publishing, 236<br />

\ell, 127, 539<br />

\ellipse (eepic), 306<br />

ellipsis, 123<br />

\else (T E X), 451<br />

em dash, 23<br />

\em, 20, 62, 65, 433, 485, 539<br />

em, 21<br />

emacs, 382<br />

email addresses, 112<br />

\emblema (pdfscreen), 341<br />

\emph, 62, 65, 372, 540<br />

empty page style, 42, 327, 335, 352,<br />

452<br />

\emptyset, 127, 540<br />

emT E X for DOS, 382<br />

emtex, graphics option, 154<br />

en dash, 23<br />

\EnableCrossrefs (doc), 470<br />

encapsulated PostScript, see<br />

PostScript<br />

\encl, 353, 540<br />

\enclname, 353, 460, 540<br />

encoding, see font<br />

encoding comm<strong>and</strong>s in NFSS, 379<br />

encoding scheme<br />

OML, 491, 495<br />

OMS, 491, 495<br />

OMX, 491, 496<br />

OT1, 490, 492, 506<br />

OT2, 283, 497<br />

T1, 500, 501, 503, 506<br />

TS1, 502, 506<br />

encoding, font attribute, 368<br />

\encodingdefault, 372, 501<br />

end of line, as a blank, 22<br />

\end, 19, 64, 416, 540<br />

\endbatchfile (DocStrip), 465<br />

\end{document}, 12, 517<br />

\endfirsthead (longtable), 108,<br />

540<br />

\endfoot (longtable), 108, 540<br />

\endhead (longtable), 108, 540<br />

\endinput (T E X), 451<br />

\endlastfoot (longtable), 108,<br />

540<br />

\endpostamble (DocStrip), 465<br />

\endpreamble (DocStrip), 465<br />

English, 252<br />

english.ldf, 255<br />

\enlargethispage, 34, 419, 540<br />

\enlargethispage*, 34, 540<br />

\ensuremath, 186, 187, 188, 418,<br />

450, 541<br />

enumerate environment, 69, 70,<br />

71, 72, 74, 79, 213, 394,<br />

419, 420, 517<br />

enumerate package, 74, 394<br />

enumn counter, 73, 181<br />

environment, 19, 516<br />

comm<strong>and</strong> name as, 20, 517<br />

global, 20<br />

math, 119<br />

nameless, 20, 62, 63<br />

environment environment (doc),<br />

469<br />

environment, user-defined, 195–200<br />

general comments, 200<br />

scope of, 202<br />

global, 202<br />

local, 202<br />

s<strong>to</strong>ring, 200<br />

with arguments, 198, 199<br />

calling, 198<br />

with optional argument, 199<br />

without arguments, 196, 197<br />

calling, 196<br />

epic package, 302–5<br />

.eps file, 155<br />

epsf package, 159<br />

\epsf (epsfig), 159<br />

epsfig package, 159<br />

\epsfig (epsfig), 159<br />

\epsfxsize (epsfig), 159


\epsfysize (epsfig), 159<br />

\epsilon, 125, 541<br />

eqnarray environment, 120, 138,<br />

142, 213, 270, 420, 517<br />

eqnarray* environment, 120, 138,<br />

142, 270, 518<br />

\eqref (A M S), 278, 541<br />

\equal (ifthen), 194, 363<br />

equation, see formula<br />

equation counter, 181, 277<br />

equation environment, 120, 124,<br />

213, 271, 276, 518<br />

equation number, 120, 271<br />

changing hierarchy, 277<br />

right or left, 39, 120, 131, 271<br />

subnumbered, 277<br />

user-defined, 191<br />

vertically centered, 142, 272<br />

equation* environment (A M S),<br />

272<br />

equations, set of, 133–6<br />

\equiv, 126, 541<br />

error messages<br />

basic structure for T E X, 403<br />

continue program, 402<br />

emergency s<strong>to</strong>p, 413<br />

error indica<strong>to</strong>r, 402<br />

error line, 402, 405<br />

from L AT E X, 404–7<br />

from T E X, 401–4<br />

from T E X macros, 407<br />

going <strong>to</strong> deeper levels, 404<br />

list<br />

hard-<strong>to</strong>-find errors, 435<br />

L AT E X font errors, 422–4<br />

L AT E X font warnings, 433<br />

L AT E X general errors, 415–20<br />

L AT E X general warnings,<br />

429–31<br />

L AT E X package errors, 421–2<br />

L AT E X package warnings, 432<br />

T E X, 424–9<br />

T E X warnings, 433–5<br />

mathematical, 413, 414<br />

multi-file, 414<br />

propagation, 409–10<br />

s<strong>to</strong>p program<br />

with I\s<strong>to</strong>p, 403, 410<br />

with edi<strong>to</strong>r, 403<br />

INDEX 619<br />

with X, 403, 410<br />

unknown file name, 412, 417<br />

user response<br />

call edi<strong>to</strong>r, 403<br />

continue program, 402<br />

correction, 403<br />

deletion, 403<br />

help, 403<br />

recommendation, 407<br />

errorcontextlines counter, 404<br />

eso-pic package, 346<br />

Esperan<strong>to</strong>, 252, 462<br />

Esser, Thomas, 381<br />

Es<strong>to</strong>nian, 252<br />

\eta, 125, 541<br />

eucal package, 284–5<br />

eufrak package, 285<br />

\EUR (europs), 25, 541<br />

euro symbol, 24–5, 387, 462, 503<br />

PostScript fonts, 25, 387<br />

\euro (eurosym), 25, 28, 541<br />

\EURofc (europs), 25, 541<br />

eurofont.exe, 387<br />

European Commission, 25<br />

European paper sizes, 12<br />

europs package, 25, 387<br />

eurosans package, 25, 387<br />

eurosym package, 25, 28<br />

\evensidemargin, 48, 49, 361, 453,<br />

541<br />

ex, 21<br />

\ExecuteOptions, 165, 443, 453,<br />

541<br />

executivepaper option, 38<br />

exercises<br />

Chapter 2, 27, 28<br />

Chapter 3, 40, 45, 47–9, 54, 57,<br />

58, 60<br />

Chapter 4, 68, 69, 72, 74, 78,<br />

84, 93, 103, 105, 110, 111,<br />

116, 118<br />

Chapter 5, 121, 124, 129, 130,<br />

132, 135–7, 141, 149, 150<br />

Chapter 6, 157, 159, 168<br />

Chapter 8, 183, 187, 192, 200<br />

Chapter 9, 208, 212, 218, 219<br />

Chapter 13, 290, 293, 295,<br />

297, 301<br />

\exists, 127, 541


620 INDEX<br />

\exp, 128, 541<br />

\exp<strong>and</strong>after (T E X), 451<br />

explicit names, changing, 459<br />

exponents, 121<br />

exscale package, 392<br />

Extended Computer fonts, see EC<br />

fonts<br />

\externaldocument (xr), 215, 243<br />

\extracolsep, 96, 110, 455, 541<br />

\extrarowheight (array), 107<br />

\extraslang (non-st<strong>and</strong>ard), 255<br />

\extraslideheight (seminar), 336<br />

\f@baselineskip, 376<br />

\f@encoding, 376<br />

\f@family, 376<br />

\f@series, 376<br />

\f@shape, 376<br />

\f@size, 376<br />

Fairbairns, Robin, 47<br />

falign environment (A M S), 270,<br />

275, 518<br />

family, font attribute, 64, 368<br />

\familydefault, 372<br />

fancy page style, 43<br />

fancybox package, 94–5, 334, 338,<br />

345<br />

\fancyfoot (fancyhdr), 44<br />

fancyhdr package, 43–5, 249, 335,<br />

454<br />

\fancyhead (fancyhdr), 44<br />

\fancyhf (fancyhdr), 44<br />

\fancypage (fancybox), 95, 542<br />

\fancypagestyle (fancyhdr), 45<br />

\fancyput (fancybox), 338<br />

\fbox, 86, 92–4, 115, 142, 334, 542<br />

\fbox (picture), 298<br />

\fboxrule, 93, 94, 164, 334, 542<br />

\fboxsep, 93, 94, 164, 298, 334, 542<br />

\fcolorbox (color), 167, 335, 542<br />

.fdd file, 398<br />

.fd file, 233, 234, 283, 376, 378,<br />

385, 398, 424, 490<br />

\fi (T E X), 451<br />

figure, see float<br />

figure counter, 181<br />

figure caption, see float, caption<br />

figure environment, 60, 108, 169,<br />

173, 182, 213, 417, 419,<br />

430, 518<br />

figure* environment, 169, 518<br />

\figurename, 459, 542<br />

figures, list of, 59<br />

file<br />

including, 448<br />

inputting safely, 447<br />

listing, 447<br />

transcript, 14, 50, 208, 211,<br />

399, 401, 447<br />

file transfer pro<strong>to</strong>col, see FTP<br />

file types<br />

.aux, 209, 210, 214, 396, 397,<br />

418, 427, 430, 436<br />

.bbl, 219, 224, 310, 397<br />

.bib, 309, 397<br />

.blg, 397<br />

.bst, 220, 221, 310, 321, 397<br />

.cfg, 253, 384, 385, 397, 472<br />

.clo, 384, 385, 397<br />

.cls, 384, 385, 398, 484<br />

.dat, 253<br />

.def, 153, 253, 376, 378, 379,<br />

385, 392, 398<br />

.drv, 463, 464<br />

.dtx, 13, 384, 389, 398, 463,<br />

465<br />

.dvi, 14, 27, 153, 161, 236,<br />

305, 393, 403, 477<br />

.eps, 155<br />

.fdd, 398<br />

.fd, 233, 234, 283, 376, 378,<br />

385, 398, 424, 490<br />

.fmt, 398<br />

.gif, 476<br />

.glo, 230, 398, 470<br />

.gls, 399, 470<br />

.gz, 166<br />

.html, 476<br />

.idv, 478<br />

.idx, 226–8, 399, 470<br />

.ilg, 399<br />

.ind, 228, 399<br />

.ins, 389, 399, 463<br />

.ist, 385, 399, 470<br />

.jpeg, 162<br />

.jpg, 162<br />

.ldf, 253<br />

.lof, 59, 179, 399, 436


.log, 14, 246, 399, 401, 403,<br />

414, 429<br />

.lot, 59, 399, 436<br />

.map, 234<br />

.mbs, 321, 322<br />

.mf, 389, 400, 488, 498, 506<br />

.pbm, 476<br />

.pdf, 162, 237<br />

.pfa, 389<br />

.pfb, 234, 389, 506<br />

.pk, 233, 234, 236, 388, 400,<br />

488, 498, 504<br />

.png, 162<br />

.ppm, 478<br />

.ps, 232, 236<br />

.sty, 9, 12, 41, 384, 385, 463,<br />

484<br />

.tcx, 481<br />

.tex, 14, 17, 208, 209, 391,<br />

396, 400, 403, 436<br />

.tfm, 234, 400, 487, 498, 503,<br />

506<br />

.tiff, 162<br />

.tif, 162<br />

.<strong>to</strong>c, 59, 400, 436<br />

.txt, 384<br />

.vf, 234, 236, 400, 488, 504<br />

.zip, 166<br />

\file (DocStrip), 465<br />

filecontents environment, 432,<br />

448, 518<br />

filecontents* environment, 449,<br />

518<br />

\filedate (doc), 471<br />

fileerr.dtx, 394<br />

\fileinfo (doc), 471<br />

\filename (doc), 471<br />

\fileversion (doc), 471<br />

\fill, 22, 30, 32, 96, 110, 184, 455,<br />

542<br />

filler, with dots, rules, spacing, 30<br />

final option, 39<br />

\Finale (doc), 469, 473<br />

Finnish, 252<br />

\firsthline (array), 107<br />

firstpage page style, 362<br />

fixed length, 21<br />

flafter package, 171, 392<br />

\flat, 127, 542<br />

INDEX 621<br />

fleqn option, 39, 120, 124, 149,<br />

271, 280<br />

float, 110, 169–77<br />

caption, 173<br />

width, 174<br />

causing buffer overflow, 428<br />

double columns, 169<br />

examples, 109, 174–7<br />

figure title, 173<br />

head <strong>and</strong> foot text, 109<br />

numbering, 173<br />

placement, 109, 169–71<br />

style parameter, 171<br />

table title, 173<br />

float package, 179–80<br />

floatfig package, see floatflt<br />

floatflt package, 178–9<br />

floatingfigure environment, 178<br />

floatingtable environment, 179<br />

\floatname (float), 179<br />

\floatpagefraction, 172, 542<br />

\floatplacement (float), 180<br />

\floatsep, 172, 542<br />

\floatstyle (float), 180<br />

\flushbot<strong>to</strong>m, 48, 542<br />

flushleft environment, 67, 79,<br />

518<br />

flushright environment, 67, 79,<br />

518<br />

\flushright, 117<br />

Flynn, Peter, 605<br />

.fmt file, 398<br />

\fnsymbol, 114, 183, 190, 543<br />

font<br />

slides class, 324<br />

amsfonts, 283–5<br />

attribute, 64–5, 368–72<br />

defaults, 372<br />

encoding, 368<br />

family, 64, 368<br />

internals, 376<br />

series, 64, 368<br />

shape, 64, 368<br />

size, 64, 369<br />

bitmaps, 488<br />

character assignment<br />

cmcsc10 (small caps), 492<br />

cmex10 (var. symbols), 496<br />

cmmi10 (math text), 495


622 INDEX<br />

cmr10 (st<strong>and</strong>ard), 492<br />

cmsy10 (math symbols), 495<br />

cmti10 (text italic), 493<br />

cmtt10 (typewriter), 493<br />

EC fonts, 500<br />

TC fonts, 502<br />

wncyr10 (Cyrillic), 497<br />

classification, 489<br />

comm<strong>and</strong>s, 65, 370<br />

Computer Modern, 8, 64, 283,<br />

369, 488–97, 499<br />

Cyrillic, 283, 379, 497<br />

decorative, 494<br />

design size, 501<br />

EC, 393, 499–503<br />

calling, 501<br />

with NFSS, 379<br />

encoding, 487<br />

euro, PostScript, 25, 387<br />

eurosym, 25<br />

extended, 498–503<br />

Extended Computer, see EC<br />

families, 489<br />

file names, 490<br />

L AT E X, 65, 494<br />

L AT E X 2.09 comm<strong>and</strong>s, 485<br />

line spacing for additional, 562<br />

loading, 66<br />

logos, 494<br />

magnification, 66<br />

math, 491<br />

symbols, 374<br />

math alphabets, 133, 258, 373<br />

NFSS, 367–72, 376–9<br />

pixel, 8<br />

PostScript, 233–6, 378, 503–5<br />

st<strong>and</strong>ard, 65, 367<br />

st<strong>and</strong>ard line spacing, 63<br />

TC, 24, 393, 501<br />

text, 490<br />

TrueType, 238<br />

type 1, 8, 25, 231, 238, 387,<br />

498, 503<br />

type 3, 8, 234, 238<br />

virtual, 488, 503<br />

font definition files, 236, 376, 398<br />

font environment, 64<br />

font size, 62<br />

changing, 62, 367<br />

class option, 37<br />

declarations, 63<br />

in formulas, 146<br />

st<strong>and</strong>ard line spacing, 63<br />

font size comm<strong>and</strong>s (L AT E X 2.09),<br />

485<br />

font style comm<strong>and</strong>s (L AT E X 2.09),<br />

485<br />

fontenc package, 378–9, 392, 501<br />

\fontencoding, 368, 370, 543<br />

\fontfamily, 368, 369, 370, 543<br />

fontmath.cfg, 385<br />

fontmath.ltx, 385<br />

\fontseries, 368, 369, 370, 543<br />

\fontshape, 368, 369, 370, 372, 543<br />

\fontsize, 368, 369, 370, 543<br />

fontsmpl package, 394<br />

fonttext.cfg, 385<br />

fonttext.ltx, 385<br />

foot, 42, 44, 47, 50, 85, 249, 335,<br />

347, 362, 435, 453<br />

cus<strong>to</strong>mizing, 43, 454<br />

\footheight (L AT E X 2.09), 604<br />

footnote, 112–16<br />

change markers, 114<br />

forbidden mode, 114<br />

in minipages, 113, 115<br />

in tables, 116<br />

marker without text, 114<br />

non-st<strong>and</strong>ard, 113<br />

st<strong>and</strong>ard, 113<br />

forbidden, 113<br />

st<strong>and</strong>ard marker, 113<br />

style parameter, 117<br />

text external <strong>to</strong> forbidden<br />

mode, 114<br />

footnote counter, 113, 181, 190<br />

\footnote, 112, 113, 114, 116, 543<br />

\footnotemark, 114, 115, 543<br />

\footnoterule, 118, 543<br />

\footnotesep, 117, 544<br />

\footnotesize, 63, 371, 428, 544<br />

\footnotetext, 110, 114, 115, 544<br />

\footrulewidth (fancyhdr), 44<br />

\footskip, 48, 50, 453, 544<br />

\forall, 127, 544<br />

\foreignlanguage (babel), 254,<br />

544<br />

format file, 6, 384, 398, 440


formula, 119<br />

arrays, 133–6, 266<br />

blanks within, 120<br />

bold face in, 143, 258, 394<br />

chemical, 143<br />

constants, 120<br />

continued fraction, 146, 149,<br />

265<br />

continuing dots, 123, 263<br />

displayed, 119<br />

centered, 39, 120, 280<br />

flush left, 39, 120, 280<br />

indented, 40<br />

ellipsis, 123<br />

exponent, 121<br />

extra T E X comm<strong>and</strong>s, 137<br />

fine-tuning, 145–8<br />

bracket sizing, 148<br />

font size, 146–7<br />

horizontal spacing, 145, 269<br />

font size in, 146<br />

detailed, 147<br />

simplified, 146<br />

fraction, 122<br />

framed, 142<br />

function names, 128, 267<br />

Greek letters, 125<br />

horizontal spacing, 145, 269<br />

in text, 119<br />

index, 121<br />

integral, 123<br />

limits<br />

for 2 sizes, 128<br />

multiline, 261<br />

positioning, 123, 128<br />

with functions, 129<br />

lowering in, 121<br />

math style parameters, 148<br />

matrix, 133–6, 266<br />

multiline, 120, 138–41<br />

bracket sizing, 140, 148<br />

breaking, 138<br />

centered, 138<br />

column separation, 138<br />

left part, 140<br />

numbered, 139<br />

page breaks, 278<br />

with A M S, 270–7<br />

numbered, 120<br />

INDEX 623<br />

overbrace, 136<br />

overlining, 136<br />

raising in, 121<br />

root, 122, 269<br />

side-by-side, 142<br />

subnumbered, 277<br />

summation, 123<br />

symbols in, see symbols<br />

text within, 133, 259<br />

underbrace, 136<br />

underlining, 136<br />

variables, 120<br />

fpT E X for Windows, 381, 385<br />

\frac, 122, 146, 189, 264, 544<br />

fractions, 122<br />

with A M S, 264<br />

fragile comm<strong>and</strong>s, 440, 444<br />

\frame, 299, 300, 544<br />

\framebox, 86, 90, 93, 94, 106, 189,<br />

272, 300, 544<br />

\framebox (picture), 291, 292, 298,<br />

544<br />

framed formulas, see boxed<br />

formula<br />

framed table, 100<br />

framed text, 86<br />

French, 252<br />

french package, 251<br />

\frenchspacing, 29, 545<br />

frhyphen.tex, 256<br />

\from (DocStrip), 465<br />

\fromname, 363<br />

\frontmatter, 57, 210, 545<br />

\frown, 126, 545<br />

ftnright package, 394<br />

FTP, 475<br />

fullpage package, 452, 465<br />

function names, 128<br />

defining, 268<br />

with A M S, 267<br />

\fussy, 36, 545<br />

Galician, 252, 462<br />

\Gamma, 125, 545<br />

\gamma, 125, 545<br />

gather environment (A M S), 270,<br />

273, 519<br />

gathered environment (A M S),<br />

276, 519


624 INDEX<br />

Gaulle, Bernard, 251<br />

\gcd, 128, 129, 280, 545<br />

\gdef (T E X), 450<br />

\ge, 126, 545<br />

\generate (DocStrip), 465<br />

\genfrac (A M S), 265, 545<br />

geometry package, 49–51, 452<br />

\geq, 126, 545<br />

German, 252<br />

spelling reform, 35<br />

german package, 251, 252, 360<br />

\GetFileInfo (doc), 441, 471, 472<br />

\gets, 127, 545<br />

\gg, 126, 545<br />

gglo.ist, 399, 470<br />

Ghostscript, 236, 476<br />

GhostView, 164, 232, 239<br />

GIF images, 476, 478<br />

.gif file, 476<br />

gind.ist, 399, 470<br />

Girou, Denis, 330<br />

.glo file, 230, 398, 470<br />

glossary, 230<br />

\glossary, 230, 398, 420, 428, 545<br />

\glossaryentry, 230, 398, 545<br />

\glossaryname, 460<br />

.gls file, 399, 470<br />

Goossens, M., 605<br />

graphics<br />

importing files, 154<br />

rotation, 156<br />

scaling, 156<br />

graphics package, 153, 155–7<br />

graphics.cfg, 164<br />

\graphicspath (graphics), 165<br />

graphicx package, 157–9<br />

graphpap package, 301, 392<br />

\graphpaper, 392<br />

\graphpaper (graphpap), 301, 546<br />

\grave, 129, 263, 546<br />

\Grave (A M S), 263, 546<br />

Greek, 252<br />

Greek letters, 125<br />

grfguide.tex, 154<br />

\grid (epic), 302, 303<br />

\guillemotleft, 503, 546<br />

\guillemotright, 503, 546<br />

\guilsinglleft, 503, 546<br />

\guilsinglright, 503, 546<br />

Guntermann, Klaus, 343<br />

Gurari, Eitan M., 477<br />

.gz file, 166<br />

gzip program, 166<br />

h.tex, 394, 413<br />

\H (˝ accent), 24, 546<br />

Haralambous, Y., 605<br />

Hargreaves, K. A., 605<br />

harvard package, 220<br />

\hat, 129, 546<br />

\Hat (A M S), 263, 546<br />

\hbar, 127, 546<br />

\hbox (T E X), 439<br />

\hdotsfor (A M S), 267<br />

head, 42, 44, 47, 50, 85, 335, 362,<br />

435, 453<br />

cus<strong>to</strong>mizing, 43, 454<br />

right page, 43<br />

\headheight, 48, 50, 361, 363, 453,<br />

455, 546<br />

heading, 43<br />

left page, 43<br />

setting values, 47<br />

headings page style, 42, 44, 55, 58,<br />

327, 335, 352, 363, 452<br />

\headrulewidth (fancyhdr), 44<br />

\headsep, 48, 50, 361, 363, 453,<br />

455, 546<br />

\head<strong>to</strong>name, 359, 360, 363, 460,<br />

547<br />

\heartsuit, 127, 547<br />

Hebrew, 252<br />

\height, 86, 90, 547<br />

helvet package, 234<br />

Helvetica, PostScript font, 234, 324,<br />

379, 504<br />

here package, 178<br />

\hfill, 30, 32, 77, 84, 88, 89, 117,<br />

142, 149, 176, 362, 547<br />

hhline package, 395<br />

\hline, 97, 100, 102, 103, 106, 547<br />

\hoffset (T E X), 547, 604<br />

\hom, 128, 547<br />

\hookleftarrow, 127, 547<br />

\hookrightarrow, 127, 547<br />

\hpagecolor (background), 345<br />

\href (hyperref), 247<br />

\hrulefill, 30, 84, 91, 547


\hspace, 29, 30, 82, 96, 105, 106,<br />

110, 332, 547<br />

\hspace*, 29, 82, 547<br />

\hss (T E X), 408<br />

HTML, 3–5, 9, 476–8<br />

html package, 476<br />

.html file, 476<br />

\Huge, 63, 371, 548<br />

\huge, 63, 371, 548<br />

Hungarian, 252<br />

\hyperbaseurl (hyperref), 247<br />

\hyperdef (hyperref), 247<br />

\hyperimage (hyperref), 247<br />

\hyperlink (hyperref), 161, 247,<br />

349, 548<br />

hyperref package, 112, 161, 220,<br />

239–49, 330, 339, 340,<br />

344<br />

\hyperref (hyperref), 247<br />

hyperref.cfg, 246<br />

\hypersetup (hyperref), 241, 246,<br />

344, 548<br />

\hypertarget (hyperref), 247, 349,<br />

548<br />

hyphen, 23<br />

hyphen.cfg, 252, 256, 385<br />

babel, 253<br />

hyphen.ltx, 385<br />

hyphen.tex, 385<br />

hyphenation, 34, 427<br />

exception list, 35<br />

in other languages, 499<br />

manual, 35<br />

multilingual, 36, 251, 256<br />

other languages, 389<br />

overfull \hbox, 434<br />

turning off, 36<br />

with accents, 426<br />

\hyphenation, 36, 426, 427, 548<br />

\i, 24, 548<br />

Icel<strong>and</strong>ic, 252<br />

\idotsint (A M S), 260, 548<br />

.idv file, 478<br />

idx.tex, 227, 385, 391<br />

.idx file, 226–8, 399, 470<br />

\if (T E X), 451<br />

\ifcase (T E X), 451, 461<br />

\iff, 127, 548<br />

INDEX 625<br />

\iffalse (T E X), 468<br />

\IfFileExists, 447, 548<br />

\iflanguage (babel), 254, 548<br />

ifthen package, 193–5, 359, 392,<br />

439, 452<br />

\ifthenelse (ifthen), 193, 195,<br />

360, 363, 439, 451, 453<br />

\iiiint (A M S), 260, 551<br />

\iiint (A M S), 260, 551<br />

\iint (A M S), 260, 551<br />

.ilg file, 399<br />

\Im, 127, 549<br />

\imageBut<strong>to</strong>n (pdfscreen), 342<br />

\imath, 127, 129, 549<br />

importing graphics files, 154–66<br />

compressed, 166<br />

configuring, 164<br />

problems, 161<br />

\in, 126, 549<br />

in (inch), 21<br />

\include, 182, 209, 210, 212, 215,<br />

224, 396, 397, 402, 411,<br />

412, 414, 415, 417, 549<br />

\includegraphics, 156, 159–61,<br />

163, 164, 169, 249, 332,<br />

346<br />

\includegraphics (graphics),<br />

155, 549<br />

\includegraphics (graphicx),<br />

157, 550<br />

\includegraphics* (graphics),<br />

156, 549<br />

\includegraphics* (graphicx),<br />

159<br />

\includeonly, 209, 210, 211, 215,<br />

328, 416, 550<br />

including one file in another, 448<br />

\indent, 46, 550<br />

indentfirst package, 46, 395<br />

index of keywords, 225–8<br />

\index, 225, 226, 228, 391, 392,<br />

399, 420, 428, 550<br />

\indexentry, 226, 399, 550<br />

\indexname, 225, 459, 550<br />

\indexspace, 225, 550<br />

.ind file, 228, 399<br />

indices, 121<br />

\inf, 128, 129, 280, 550<br />

\infty, 127, 550


626 INDEX<br />

initex, 6, 251, 253, 256, 384, 398<br />

input coding, 26, 461<br />

\input, 192, 201, 207, 208, 209,<br />

396, 402, 411, 412, 414,<br />

415, 442, 447, 551<br />

nested, 208<br />

inputenc package, 26, 392, 461–2<br />

\InputIfFileExists, 447, 551<br />

.ins file, 389, 399, 463<br />

install.txt, 384<br />

instr-l.tex, 257<br />

\int, 123, 128, 551<br />

integral sign, 123<br />

Internet, 9, 316, 390, 475, 590<br />

giving addresses, 112<br />

\intertext (A M S), 259, 550<br />

\intextsep, 172, 551<br />

intlimits option, 260, 279<br />

Inuit, 462<br />

invisible comm<strong>and</strong>s, 201<br />

\invisible (slides), 326, 551<br />

\iota, 125, 551<br />

Irish Gaelic, 252<br />

ISO math st<strong>and</strong>ards, 144<br />

ISO-Latin codings, 462<br />

\isodd (ifthen), 193<br />

.ist file, 385, 399, 470<br />

\it (L AT E X 2.09), 367, 373, 485<br />

Italian, 252<br />

italic correction, 62, 65, 487<br />

\itdefault, 372, 551<br />

\item, 69, 70, 73–5, 77, 78, 200, 214,<br />

225, 409, 416, 418, 419,<br />

551<br />

\item[option], 71, 72, 79, 551<br />

\itemindent, 77, 79, 551, 604<br />

itemize environment, 69, 70, 71,<br />

72, 74, 79, 419, 420, 519<br />

\itemsep, 76, 77, 552, 604<br />

\itshape, 64, 371, 372, 416, 458,<br />

552<br />

\j, 24, 552<br />

Japanese, 6<br />

\jmath, 127, 129, 552<br />

\Join, 127, 552<br />

\jot, 149, 552<br />

JPEG images, 162, 237, 238<br />

.jpeg file, 162<br />

.jpg file, 162<br />

\jput (epic), 302, 304<br />

justification, 28, 34<br />

\k (˛ accent), 503, 552<br />

\kappa, 125, 552<br />

\keepsilent (DocStrip), 465<br />

\ker, 128, 552<br />

keyboard input, 211<br />

keyboard symbols, 120<br />

\kill, 82, 552<br />

Knappen, Jörg, 499<br />

Kneser, Thomas, 178<br />

Knuth, Donald E., 6, 7, 119, 151,<br />

218, 381, 488, 494, 497,<br />

605<br />

Kopka, Helmut, 606<br />

Kwok, Conrad, 305<br />

\L, 24, 552<br />

\l, 24, 552<br />

label<br />

for bibliography, see<br />

bibliography entry<br />

for lists, see list labels<br />

\label, 56, 131, 139, 177, 182, 183,<br />

213, 247, 278, 395, 396,<br />

430, 431, 552<br />

\labelenumn, 73, 552<br />

\labelitemn, 73, 553<br />

\labelsep, 77, 200, 553, 604<br />

\labelwidth, 77, 79, 200, 553, 604<br />

lablst.tex, 214, 385, 391<br />

\Lambda, 125, 553<br />

\lambda, 125, 553<br />

Lamport, Leslie, 7, 8, 75, 193, 207,<br />

218, 228, 229, 321, 437,<br />

467, 606<br />

l<strong>and</strong>scape environment (lscape),<br />

159<br />

l<strong>and</strong>scape option, 38, 232<br />

\l<strong>and</strong>scapeonly (seminar), 332<br />

\langle, 132, 270, 553<br />

language.dat, 252, 256, 385<br />

language.dat (babel), 253<br />

\language (T E X), 36, 251, 255, 256,<br />

553<br />

\languagename (babel), 254<br />

languages


accents <strong>and</strong> special letters, 24<br />

babel, 252<br />

Lappish, 462<br />

\LARGE, 63, 325, 371, 553<br />

\Large, 63, 371, 458, 553<br />

\large, 63, 367, 371, 553<br />

\lasthline (array), 107<br />

L AT E X<br />

compatibility with 2.09, 392,<br />

398, 418, 484<br />

files, 12, 396–400<br />

fonts, 61–6<br />

installing, 381–6<br />

logo, 18<br />

sources, 389<br />

version 3, 8<br />

L AT E X counters<br />

enumn, 73, 181<br />

chapter, 57, 181, 183<br />

equation, 181, 277<br />

errorcontextlines, 404<br />

figure, 181<br />

footnote, 113, 181, 190<br />

MaxMatrixCols (A M S), 266<br />

mpfootnote, 115, 181<br />

page, 45, 181, 183, 190, 195<br />

paragraph, 57, 181<br />

part, 57, 181<br />

secnumdepth, 56, 58, 458<br />

section, 57, 181, 183, 277<br />

subparagraph, 57, 181<br />

subsection, 57, 181<br />

subsubsection, 57, 181<br />

table, 181<br />

<strong>to</strong>cdepth, 58<br />

latex format, 14, 384, 398<br />

\<strong>LaTeX</strong>, 18, 440, 553<br />

latex.fmt, 385, 398<br />

latex.ltx, 384, 390, 399, 463<br />

latex.tex, 467<br />

L AT E X 2.09, 7, 9, 46, 65, 153, 159,<br />

324, 330, 373, 374, 392,<br />

422, 430, 440, 443, 445,<br />

483–6<br />

latex209.def, 398<br />

L AT E X2HTML transla<strong>to</strong>r, 476, 480<br />

L AT E X3 Project, 3, 8<br />

latexbug.tex, 385<br />

\<strong>LaTeX</strong>e, 19, 418, 553<br />

INDEX 627<br />

L AT E X error messages, see error<br />

messages<br />

latexsym package, 126, 285, 392,<br />

422, 494<br />

Latin, 252<br />

layout package, 47, 395<br />

\lceil, 132, 553<br />

.ldf file, 253<br />

\ldots, 123, 137, 263, 553<br />

\le, 126, 553<br />

\leads<strong>to</strong>, 127, 553<br />

left margin, 48, 50<br />

two-sided, 48<br />

\left, 108, 131, 134, 137, 140, 553<br />

\Leftarrow, 127, 554<br />

\leftarrow, 127, 554<br />

\lefteqn, 140, 554<br />

\leftharpoondown, 127, 554<br />

\leftharpoonup, 127, 554<br />

\leftmargin, 76, 77, 79, 80, 554,<br />

604<br />

\leftmarginn, 80, 554<br />

\leftmark, 44<br />

\Leftrightarrow, 127, 554<br />

\leftrightarrow, 127, 554<br />

\leftroot (A M S), 269, 554<br />

legalpaper option, 38<br />

length, 21, 184<br />

0 value, 21<br />

fixed, 21<br />

rubber, see rubber lengths<br />

setting, see \setlength<br />

units of, 21<br />

zero, 21<br />

length, user-defined, 184<br />

\lengthtest (ifthen), 194<br />

\leq, 126, 554<br />

leqno option, 39, 120, 131, 271,<br />

272, 280<br />

\let (T E X), 451<br />

letter, 351–64<br />

closing, 353<br />

comm<strong>and</strong>s<br />

forbidden, 351<br />

local, 356<br />

st<strong>and</strong>ard, 351–6<br />

distribution list, 353<br />

enclosures, 353<br />

house style, 356–64


628 INDEX<br />

L AT E X st<strong>and</strong>ard, 351–6<br />

letterhead, company, 356–64<br />

postscript, 353<br />

recipient name <strong>and</strong> address,<br />

352<br />

reference entry, 356<br />

return name <strong>and</strong> address, 351<br />

salutation, 353<br />

stickers, 356<br />

subject entry, 356<br />

letter class, 37, 351, 391, 460<br />

letter environment, 352, 356, 519<br />

letter.cls, 359<br />

letterhead, 352, 356<br />

letterpaper option, 38<br />

\lfloor, 132, 554<br />

\lfoot (fancyhdr), 44<br />

\lg, 128, 554<br />

\lhd, 126, 554<br />

\lhead (fancyhdr), 44<br />

ligatures, 26, 488<br />

breaking of, 26<br />

Cyrillic, 284<br />

\lim, 128, 129, 268, 280, 554<br />

\liminf, 128, 129, 280, 554<br />

\limits, 123, 128, 260, 280, 555<br />

\limsup, 128, 129, 280, 555<br />

line breaking<br />

discouraged, 32<br />

encouraged, 31<br />

forced, 31<br />

with justification, 31<br />

suppressed, 29, 32<br />

with centered text, 67<br />

with extra space, 31<br />

with left justification, 67<br />

with right justification, 67<br />

line width, 48, 50<br />

\line (eepic), 305<br />

\line (picture), 293, 294, 295, 416,<br />

431, 555<br />

line, black, see rules<br />

\linebreak, 31, 33, 434, 555<br />

\linethickness, 300, 555<br />

\linewidth, 47, 51, 158, 161, 332,<br />

555<br />

Lingnau, Anselm, 179<br />

list environment, 74, 77–80, 230,<br />

419, 420, 519<br />

list labels, 69<br />

changing style, 72<br />

in lists, 74<br />

list markers, see list labels<br />

list of references, see bibliography<br />

\listfigurename, 459, 555<br />

\listfiles, 208, 441, 442, 447, 555<br />

listings, 69–74<br />

\lis<strong>to</strong>f (float), 179<br />

\lis<strong>to</strong>ffigures, 59, 210, 399, 427,<br />

556<br />

\lis<strong>to</strong>ftables, 59, 210, 399, 427,<br />

556<br />

\listparindent, 76, 79, 556, 604<br />

lists, 74–80<br />

format diagram, 76<br />

nested, 71, 72, 79<br />

numbered, 75<br />

st<strong>and</strong>ard label, 74<br />

style parameters, 75<br />

trivial, 79<br />

user’s environment, 78<br />

\listtablename, 459, 556<br />

literal text, printing, 110, 393<br />

live.pdf, 383<br />

\ll, 126, 556<br />

\llap (T E X), 348<br />

\ln, 128, 556<br />

\LoadClass, 359, 398, 421, 422,<br />

442, 443, 556<br />

\LoadClassWithOptions, 442, 454,<br />

556<br />

\location, 352, 556<br />

.lof file, 59, 179, 399, 436<br />

\log, 128, 556<br />

.log file, 14, 246, 399, 401, 403,<br />

414, 429<br />

\Longleftarrow, 127, 557<br />

\longleftarrow, 127, 557<br />

\Longleftrightarrow, 127, 557<br />

\longleftrightarrow, 127, 557<br />

\longmaps<strong>to</strong>, 127, 557<br />

\Longrightarrow, 117, 127, 557<br />

\longrightarrow, 127, 557<br />

longtable environment<br />

(longtable), 108, 519<br />

longtable package, 108, 395<br />

.lot file, 59, 399, 436<br />

Lower Sorbian, 252


lowering text, see text<br />

lowering, in formulas, see formula<br />

\lq (T E X), 557<br />

LR box, 85, 87<br />

lrbox environment, 87, 418, 519<br />

lscape package, 159<br />

ltxdoc class, 392, 397, 447, 471<br />

ltxdoc.cfg, 472<br />

ltxdoc.dtx, 472<br />

\lVert (A M S), 270, 557<br />

\lvert (A M S), 270, 557<br />

LyX, 15<br />

Macin<strong>to</strong>sh, see Apple<br />

macro environment (doc), 469<br />

macrocode environment (doc), 469<br />

\mainmatter, 57, 210, 557<br />

\makebox, 86, 90, 364, 557<br />

\makebox (picture), 161, 291, 292,<br />

299, 300, 557<br />

makebst.tex, 321<br />

\makeglossary, 230, 398, 416, 557<br />

makeidx package, 228, 392, 399,<br />

460<br />

MakeIndex, 15, 228–9, 382, 389,<br />

392, 399, 470, 550<br />

options, 229<br />

style file, 229<br />

\makeindex, 226, 228, 396, 399,<br />

416, 557<br />

makeindex.tex, 229<br />

\makelabel, 75, 77, 557<br />

\makelabels, 355, 557<br />

\MakeLowercase, 455, 557<br />

\MakeShortVerb (shortvrb), 111,<br />

393, 468, 558<br />

\maketitle, 52–4, 54, 69, 419, 431,<br />

558<br />

\MakeUppercase, 455, 457, 458, 558<br />

Maltese, 462<br />

Malyshev, Basil, 506<br />

.map file, 234<br />

\maps<strong>to</strong>, 127, 558<br />

Marchal, B., 606<br />

margin, 48–50<br />

margin mark, 116<br />

marginal notes, 116–18<br />

\marginpar, 116, 117, 417, 419,<br />

420, 430, 558<br />

INDEX 629<br />

\marginparpush, 118, 558<br />

\marginparsep, 50, 118, 558<br />

\marginparwidth, 50, 118, 228, 558<br />

\margins (pdfscreen), 342<br />

\markboth, 43, 454, 558<br />

\markright, 43, 58, 454, 558<br />

markup, 4–5, 11, 14, 17, 197, 207<br />

logical, 5, 7, 61, 112, 456, 479<br />

typographical, 4, 28, 479<br />

markup languages, 4<br />

math accents, 129<br />

math alphabets, 133, 258, 373<br />

math environment, 119, 519<br />

math equation, see formula<br />

math fine-tuning, 145–8<br />

bracket sizing, 148<br />

font size, 146–7<br />

horizontal spacing, 145, 269<br />

with A M S, 269<br />

math formula, see formula<br />

math mode, 119<br />

math st<strong>and</strong>ards, 144<br />

math style parameters, 148<br />

math symbols, see symbols<br />

math variable, see formula<br />

math version, 373<br />

\mathalpha, 375<br />

\mathbb (A M S), 284<br />

\mathbf, 133, 143, 258, 373, 416,<br />

422, 558<br />

\mathbin, 375<br />

\mathcal, 125, 133, 258, 284, 373,<br />

559<br />

\mathclose, 375<br />

\mathfrak, 285<br />

\mathindent, 40, 120, 124, 142,<br />

149, 280, 559<br />

\mathit, 133, 258, 373, 416, 559<br />

MathML, 480<br />

\mathnormal, 125, 133, 373, 559<br />

\mathop, 375<br />

\mathopen, 375<br />

\mathord, 375<br />

\mathpunct, 375<br />

\mathrel, 375<br />

\mathring, 129, 559<br />

\mathrm, 123, 133, 143, 144, 258,<br />

373, 559<br />

mathscr option, 284


630 INDEX<br />

\mathscr, 284<br />

\mathsf, 133, 144, 258, 373, 559<br />

\mathtt, 133, 258, 373, 559<br />

\mathversion, 373, 433, 559<br />

matrix, 133–6<br />

small in text formulas, 138<br />

with A M S, 266<br />

matrix environment (A M S), 266,<br />

519<br />

\matrixput (epic), 302, 303<br />

Mattes, Eberhardt, 382<br />

\max, 128, 129, 280, 559<br />

MaxMatrixCols counter (A M S),<br />

266<br />

\mbox, 32, 86, 87, 90, 133, 144, 150,<br />

151, 426, 439, 559<br />

.mbs file, 321, 322<br />

\mddefault, 372, 559<br />

\mdseries, 64, 371, 560<br />

\medskip, 33, 560<br />

\medskipamount, 560<br />

\medspace (A M S), 269, 560<br />

merlin.mbs, 321<br />

Merz, Thomas, 606<br />

\MessageBreak, 446, 447, 560<br />

messages, error, see error messages<br />

messages, processing, see<br />

processing messages<br />

METAFONT, 6, 8, 233, 389, 488,<br />

494, 497–9, 501<br />

.mf file, 389, 400, 488, 498, 506<br />

\mho, 127, 560<br />

\mid, 126, 560<br />

MikT E X for Windows, 381, 386<br />

miktex.txt, 384<br />

\min, 128, 129, 280, 560<br />

minimal class, 392<br />

minipage environment, 88, 89, 90,<br />

92, 93, 113, 142, 200, 212,<br />

290, 292, 417, 419, 455,<br />

520<br />

minus sign, 23<br />

minus, 22, 47, 77<br />

Mittelbach, Frank, 8, 51, 178, 215,<br />

257, 282, 367, 464, 467,<br />

605<br />

mm (millimeter), 21<br />

\mod (A M S), 268, 560<br />

mode<br />

left-<strong>to</strong>-right, 86<br />

math, 119<br />

paragraph, 88<br />

\models, 126, 560<br />

moni<strong>to</strong>r input/output, 211<br />

\month (T E X), 27, 460<br />

Moore, Ross, 307, 605<br />

\mp, 126, 560<br />

mpfootnote counter, 115, 181<br />

\mspace (A M S), 269, 560<br />

\mu, 125, 560<br />

multi-file text, 207<br />

merging, 207<br />

selective processing, 208<br />

multicol package, 51–2, 395<br />

multicols environment, 51, 395,<br />

520<br />

multicols* environment, 52<br />

\multicolumn, 97, 101–3, 106, 151,<br />

417, 418, 560<br />

multiline formula, 120, 138, 270–7<br />

multilingual L AT E X, 251–6<br />

\multiput (picture), 289, 290, 291,<br />

293, 295, 428, 561<br />

\multiputlist (epic), 302<br />

multline environment (A M S), 270,<br />

271, 520<br />

\multlinegap (A M S), 271, 561<br />

myheadings page style, 42, 45, 58,<br />

335, 452, 454<br />

\nabla, 127, 561<br />

name comm<strong>and</strong>s, 459<br />

\name, 351, 352, 353, 355, 356, 358,<br />

561<br />

nameless environment, 20, 62, 63<br />

namelimits option, 280<br />

natbib package, 219–24, 476<br />

natnotes.tex, 224<br />

\natural, 127, 561<br />

\nearrow, 127, 561<br />

\NeedsTeXFormat, 359, 421, 432,<br />

438, 440, 454, 561<br />

\neg, 127, 561<br />

negation symbols, 126<br />

\negmedspace (A M S), 269, 561<br />

\negthickspace (A M S), 269, 561<br />

\negthinspace (A M S), 269, 561<br />

\neq, 126, 561


netpbm library, 476<br />

network servers, 390<br />

New Font Selection Scheme, see<br />

NFSS, see NFSS<br />

\newboolean (ifthen), 194, 195,<br />

359, 451, 452, 561<br />

newcent package, 234<br />

NewCenturySchlbk, PostScript font,<br />

234, 504<br />

\newcolumntype (array), 107<br />

\newcomm<strong>and</strong>, 25, 185, 202, 416,<br />

418, 425, 426, 438, 449,<br />

562<br />

\newcomm<strong>and</strong>*, 445, 562<br />

\newcounter, 21, 75, 77, 182, 190,<br />

203, 416, 418, 562<br />

not with \include, 210<br />

\newenvironment, 78, 196, 202,<br />

416, 418, 425, 439, 562<br />

\newenvironment*, 445, 562<br />

\newfloat (float), 179<br />

\newfont, 66, 364, 373, 416, 562<br />

\newif (T E X), 451<br />

\newlength, 21, 185, 361, 416, 426,<br />

562<br />

\newline, 31, 32, 419, 434, 563<br />

\newpage, 33, 34, 60, 84, 108, 428,<br />

563<br />

forbidden, 84<br />

\newpagestyle (seminar), 335<br />

\newsavebox, 21, 87, 106, 199, 203,<br />

300, 361, 416, 426, 563<br />

\newslide (seminar), 331, 336<br />

\newslideframe (seminar), 334<br />

\newtheorem, 80, 81, 214, 395, 416,<br />

563<br />

\newtheorem (amsthm), 281<br />

\newtheorem* (amsthm), 281<br />

\newtheoremstyle (amsthm), 281<br />

NeXt coding, 462<br />

NFSS, 9, 64, 367–80, 398, 484, 489<br />

EC fonts, 379<br />

encoding comm<strong>and</strong>s, 379<br />

font attributes, 64–5, 368–72<br />

defaults, 372<br />

font definition, 376–9<br />

installing, 372–80<br />

nfssfont.tex, 385, 391<br />

\NG, 503, 563<br />

INDEX 631<br />

\ng, 503, 563<br />

\ni, 126, 563<br />

\nobot<strong>to</strong>mbut<strong>to</strong>ns (pdfscreen),<br />

342<br />

\nobreak, 364<br />

\nocite, 310, 563<br />

\noexp<strong>and</strong> (T E X), 451<br />

\noextraslang (non-st<strong>and</strong>ard), 255<br />

\nofiles, 396, 397–400, 416, 436,<br />

563<br />

\noindent, 46, 563<br />

nointlimits option, 279<br />

\nolimits, 128, 280, 563<br />

\nolinebreak, 32, 33, 564<br />

nonamelimits option, 280<br />

\nonfrenchspacing, 29, 564<br />

\nonumber, 139, 142, 564<br />

\nopagebreak, 33, 564<br />

\normalcolor (color), 167, 564<br />

\normalfont, 65, 167, 371, 455,<br />

458, 564<br />

\normalmarginpar, 117, 564<br />

\normalsize, 63, 371, 412, 424,<br />

458, 564<br />

North Sami, 252<br />

Norwegian, 252<br />

nosumlimits option, 279<br />

\not, 126, 564<br />

\notag (A M S), 271, 565<br />

note environment (seminar), 337<br />

note environment (slides), 326,<br />

520<br />

\notin, 126, 565<br />

notitlepage option, 39<br />

\noxcomment (seminar), 337<br />

\nu, 125, 565<br />

null.tex, 413<br />

numbering in lists, 75<br />

\numberwithin (A M S), 277, 565<br />

\nwarrow, 127, 565<br />

\O, 24, 379, 565<br />

\o, 24, 565<br />

\oddsidemargin, 48, 50, 361, 453,<br />

565<br />

\odot, 126, 565<br />

\OE, 24, 565<br />

\oe, 24, 565<br />

ogonek accent, 503


632 INDEX<br />

\oint, 128, 565<br />

\Omega, 125, 565<br />

\omega, 125, 565<br />

\ominus, 126, 565<br />

OML encoding, 491, 495<br />

OMS encoding, 491, 495<br />

OMX encoding, 491, 496<br />

one-column page formatting<br />

for single pages, 51<br />

onecolumn option, 38<br />

\onecolumn, 51, 565<br />

oneside option, 38<br />

\OnlyDescription (doc), 468, 472<br />

\onlynotes (slides), 328, 565<br />

\onlyslides (seminar), 336<br />

\onlyslides (slides), 327, 565<br />

Oostrum, Piet van, 43, 454<br />

openany option, 39<br />

openbib option, 39<br />

\opening, 353, 355, 356, 363, 566<br />

openright option, 39<br />

\oplus, 126, 566<br />

\OptionNotUsed, 443, 566<br />

options<br />

defining, 442<br />

global, 42, 443<br />

local, 42, 444<br />

processing, 443<br />

<strong>to</strong> classes, 37<br />

<strong>to</strong> packages, 41<br />

\or (T E X), 451<br />

\originalTeX (babel), 255<br />

\oslash, 126, 566<br />

OT1 encoding, 490, 492, 506<br />

ot1cmr.fd, 378, 398<br />

ot1enc.def, 236, 378<br />

ot1ptm.fd, 236<br />

OT2 encoding, 283, 497<br />

otherlanguage environment<br />

(babel), 254<br />

otherlanguage* environment<br />

(babel), 254<br />

\otimes, 126, 566<br />

outline fonts, see type 1 fonts<br />

\oval (eepic), 305<br />

\oval (picture), 296, 297, 300, 431,<br />

566<br />

\Ovalbox (fancybox), 94, 566<br />

\ovalbox (fancybox), 94, 566<br />

\overbrace, 136, 566<br />

overbraces in formulas, 136<br />

Overfull \hbox warning, 433<br />

Overfull \vbox warning, 434<br />

overlapping text, 86, 160, 348<br />

overlay environment (slides),<br />

326, 521<br />

\overlay (pdfscreen), 342<br />

\overlay (seminar), 337<br />

\overleftarrow (A M S), 262, 566<br />

\overleftrightarrow (A M S), 262,<br />

566<br />

\overline, 136, 567<br />

overlining, 136<br />

\overrightarrow (A M S), 262, 567<br />

\overset (A M S), 262, 567<br />

oztex, graphics option, 154<br />

\P, 23, 567<br />

package, 8, 9, 12, 13, 41<br />

afterpage, 171, 394<br />

alltt, 111, 392<br />

amsbsy, 144, 192, 258–9<br />

amscd, 258, 263, 282<br />

amsfonts, 126, 284–5, 422,<br />

494<br />

amsmath, 192, 258<br />

amsopn, 258, 267–8<br />

amssymb, 284, 285<br />

amstext, 258–9<br />

amsthm, 81, 258, 280–2, 395<br />

apalike, 220<br />

array, 107, 394<br />

avant, 234<br />

babel, 252–6<br />

background, 345–6<br />

bm, 144, 394<br />

bookman, 234<br />

calc, 394<br />

chapterbib, 224<br />

chicago, 220<br />

color, 153, 166, 324, 325,<br />

335, 338, 345, 439<br />

dcolumn, 107, 394<br />

delarray, 108, 394<br />

doc, 392, 399, 441, 467–73<br />

documentation, 13<br />

eepic, 305–6<br />

eepicemu, 305


enumerate, 74, 394<br />

epic, 302–5<br />

epsf, 159<br />

epsfig, 159<br />

eso-pic, 346<br />

eucal, 284–5<br />

eufrak, 285<br />

europs, 25, 387<br />

eurosans, 25, 387<br />

eurosym, 25, 28<br />

exscale, 392<br />

fancybox, 94–5, 334, 338, 345<br />

fancyhdr, 43–5, 249, 335, 454<br />

flafter, 171, 392<br />

float, 179–80<br />

floatfig, see floatflt<br />

floatflt, 178–9<br />

fontenc, 378–9, 392, 501<br />

fontsmpl, 394<br />

french, 251<br />

ftnright, 394<br />

fullpage, 452, 465<br />

geometry, 49–51, 452<br />

german, 251, 252, 360<br />

graphics, 153, 155–7<br />

graphicx, 157–9<br />

graphpap, 301, 392<br />

harvard, 220<br />

helvet, 234<br />

here, 178<br />

hhline, 395<br />

html, 476<br />

hyperref, 112, 161, 220,<br />

239–49, 330, 339, 340,<br />

344<br />

ifthen, 193–5, 359, 392, 439,<br />

452<br />

indentfirst, 46, 395<br />

inputenc, 26, 392, 461–2<br />

latexsym, 126, 285, 392, 422,<br />

494<br />

layout, 47, 395<br />

longtable, 108, 395<br />

lscape, 159<br />

makeidx, 228, 392, 399, 460<br />

multicol, 51–2, 395<br />

natbib, 219–24, 476<br />

newcent, 234<br />

palatino, 234<br />

INDEX 633<br />

parskip, 46–7<br />

pause, 346–9<br />

pdfscreen, 340–3<br />

pp4link, 349<br />

pstricks, 308<br />

rotating, 159<br />

sempdftx, 340<br />

shortvrb, 111, 393<br />

showidx, 228, 392<br />

showkeys, 395<br />

somedefs, 395<br />

st<strong>and</strong>ard, 392<br />

syn<strong>to</strong>nly, 393<br />

t1enc, 393<br />

tabularx, 107, 395<br />

TeX4ht, 477<br />

textcomp, 24–5, 393, 503<br />

theorem, 81, 282, 395<br />

times, 234<br />

tracefnt, 393, 433<br />

upref, 282<br />

url, 112<br />

varioref, 215–16, 253, 396<br />

verbatim, 111, 118, 396<br />

with options, 41<br />

xr, 215, 243, 396<br />

xspace, 186, 396<br />

\PackageError, 439, 446, 567<br />

\PackageInfo, 447, 567<br />

packages, catalogue of, 13<br />

\PackageWarning, 439, 446, 567<br />

\PackageWarningNoLine, 446, 567<br />

page breaking, 33<br />

discouraged, 33<br />

encouraged, 33<br />

forced, 33<br />

with justification, 33<br />

two columns, 34<br />

two-sided, 34<br />

with tabbing, 84<br />

with figures <strong>and</strong> tables, 34<br />

page counter, 45, 181, 183, 190,<br />

195<br />

page format, 47<br />

diagrams, 48<br />

full page, 452–4<br />

one-column, 48, 51<br />

one-sided, 38<br />

setting values, 47


634 INDEX<br />

two-column, 38, 51<br />

two-sided, 38, 50<br />

with geometry, 49–51<br />

page numbering<br />

alphabetic, 45<br />

Arabic, 45<br />

changing, 45<br />

in heading, 42<br />

Roman numerals, 20, 45<br />

setting, 45<br />

suppression of, 42<br />

page style<br />

align (seminar), 335<br />

cus<strong>to</strong>mizing, 43, 454<br />

empty, 42, 327, 335, 352, 452<br />

fancy, 43<br />

firstpage, 362<br />

headings, 42, 44, 55, 58, 327,<br />

335, 352, 363, 452<br />

myheadings, 42, 45, 58, 335,<br />

452, 454<br />

plain, 42, 45, 327, 335, 352,<br />

363, 452<br />

in letters, 352<br />

page transitions, PDF, 245, 344<br />

\pagebreak, 33, 34, 84, 178, 278,<br />

567<br />

no effect, 84<br />

\pagecolor (color), 167, 335, 338,<br />

567<br />

\PageIndex (doc), 469<br />

\pagename, 359, 360, 363, 460, 568<br />

\pagenumbering, 20, 21, 45, 58, 60,<br />

568<br />

\pageref, 56, 178, 209, 213, 214,<br />

247, 282, 395, 396, 430,<br />

431, 568<br />

\pageref* (hyperref), 247<br />

\pagestyle, 42, 58, 326, 327, 335,<br />

352, 452, 455, 568<br />

pagetrans.tex, 344<br />

pagination, see page numbering<br />

palatino package, 234<br />

Palatino, PostScript font, 234, 504<br />

\paneloverlay (pdfscreen), 343<br />

\panelwidth (pdfscreen), 342<br />

paper size, option, 38<br />

\paperheight, 48, 50, 452, 453,<br />

568, 604<br />

\paperwidth, 48, 50, 195, 452, 453,<br />

568, 604<br />

\par, 23, 364, 419, 426, 445, 568<br />

paragraph, 11<br />

box, 85, 88<br />

paragraph counter, 57, 181<br />

paragraph character, 23<br />

paragraph termination<br />

with blank line, 11<br />

with \par, 23<br />

\paragraph, 55, 568<br />

\paragraph*, 55, 569<br />

paragraphing<br />

extra line space, 11, 22, 46<br />

indentation, 11, 46<br />

after section comm<strong>and</strong>, 46<br />

setting, 20, 46<br />

suppression of, 46<br />

\parallel, 126, 569<br />

\parbox, 88, 89, 90, 92, 142, 151,<br />

174, 290, 292, 362, 417,<br />

419, 439, 569<br />

\parindent, 20, 46, 79, 569<br />

\parsep, 76, 77, 79, 569, 604<br />

parskip package, 46–7<br />

\parskip, 22, 46, 79, 184, 364, 569,<br />

604<br />

part counter, 57, 181<br />

\part, 55, 569<br />

\part*, 55, 569<br />

\partial, 127, 569<br />

Partl, H., 46, 251<br />

\partname, 460, 569<br />

\par<strong>to</strong>psep, 75, 570, 604<br />

PassiveT E X, 480<br />

\PassOptionsToClass, 359, 443,<br />

570<br />

\PassOptionsToPackage, 443, 570<br />

Patashnik, Oren, 321<br />

\path, 568<br />

\path (eepic), 306<br />

\path (url), 112<br />

pause package, 346–9<br />

\pause (pause), 346<br />

\pausebuild (pause), 348<br />

\pausecolors (pause), 348<br />

\pausehighlight (pause), 348<br />

\pauselevel (pause), 347<br />

.pbm file, 476


pc (pica), 21<br />

pctex32, graphics option, 154<br />

pctexhp, graphics option, 154<br />

pctexps, graphics option, 154<br />

pctexwin, graphics option, 154<br />

PDF, 3, 8, 9, 16, 162–3, 231, 236–9,<br />

242–6, 307, 338, 339, 480,<br />

481, 498<br />

slide show, 323, 330, 333, 338<br />

with PostScript fonts, 234, 505<br />

with PPower4, 343<br />

.pdf file, 162, 237<br />

pdfL AT E X, 238, 324<br />

pdflatex format, 238, 385<br />

pdflatex.fmt, 385<br />

\pdfoutput, 238<br />

\pdfpageheight (pdfT E X), 339<br />

\pdfpagewidth (pdfT E X), 339<br />

pdfscreen package, 340–3<br />

pdfT E X, 6, 16, 238–9, 305, 346, 385,<br />

387, 389, 481<br />

graphics inclusion, 162–3<br />

with seminar, 339<br />

pdftex, graphics option, 154, 238<br />

pdftex.cfg, 238<br />

pdftex.dll, 386<br />

Perl, 476<br />

\perp, 126, 570<br />

.pfa file, 389<br />

.pfb file, 234, 389, 506<br />

\Phi, 125, 570<br />

\phi, 125, 570<br />

\Pi, 125, 570<br />

\pi, 125, 570<br />

\picsquare (epic), 302, 304<br />

picture<br />

arrow, 294<br />

allowed slopes, 295<br />

min. length, 295<br />

box, 291–3<br />

dashed, 291, 292<br />

examples, 291, 292<br />

framed, 291<br />

parbox inside, 292<br />

positioning argument, 291<br />

unframed, 291, 292<br />

with text, 291<br />

circle, 295<br />

filled, 295<br />

INDEX 635<br />

open, 295<br />

comm<strong>and</strong>s, 289–300<br />

coordinate system, 287<br />

curves, 299<br />

elements, 289<br />

arrow, 294<br />

box, 291–3<br />

circle, 295<br />

half circle, 297<br />

line, 294<br />

oval, 296<br />

positioning, 289<br />

quarter circles, 297<br />

repeated, 289<br />

text, 290<br />

floating, see float<br />

framed text, 298<br />

half circles, 297<br />

length unit, 287, 288<br />

limited comm<strong>and</strong> set, 289<br />

line, 294<br />

allowed slopes, 293, 294<br />

min. length, 294<br />

sloping, 293<br />

vertical, 293<br />

line thickness, 289, 300<br />

multiline text, 290<br />

ref. point, 290<br />

oval, 296<br />

examples, 296, 297<br />

positioning, 287<br />

positioning comm<strong>and</strong>s, 289<br />

quarter circles, 297<br />

saving, 300<br />

shifting, 301<br />

superimposing images, 160<br />

vertical text, 297<br />

x-axis, 287<br />

y-axis, 287<br />

picture environment, 93, 160,<br />

175, 288, 289, 295, 298,<br />

302, 428, 431, 521<br />

with offset, 301<br />

pixel fonts, 8<br />

.pk file, 233, 234, 236, 388, 400,<br />

488, 498, 504<br />

plain bibliography style, 219, 310<br />

plain format, 398


636 INDEX<br />

plain page style, 42, 45, 327, 335,<br />

352, 363, 452<br />

plain.fmt, 398<br />

plainnat bibliography style, 219,<br />

221, 311<br />

Plain T E X, 7, 398, 408<br />

plus, 22, 47, 77, 78<br />

\pm, 126, 570<br />

pmatrix environment (A M S), 266,<br />

521<br />

\pmb (A M S), 258, 570<br />

\pmod, 129, 268, 570<br />

PNG images, 162, 237, 238<br />

.png file, 162<br />

\pod (A M S), 268, 570<br />

Podar, Sunil, 302<br />

poetry, 68<br />

pointers, 127<br />

Polish, 252<br />

Popineau, Fabrice, 381<br />

\poptabs, 83, 84, 419, 570<br />

Portable Document Format, see PDF<br />

\portrai<strong>to</strong>nly (seminar), 332<br />

Portuguese, 252<br />

\postamble (DocStrip), 465<br />

PostScript, 3, 15, 64, 154, 162, 163,<br />

231–6, 239, 308, 335, 337,<br />

338, 367, 370, 475, 498<br />

compressing, 166<br />

driver, 153, 154, 162, 165, 168,<br />

231<br />

encapsulated, 153, 155, 162–5,<br />

232<br />

euro fonts, 25, 387<br />

fonts, 233–6, 238, 239, 331,<br />

369, 372, 378, 389, 503–5<br />

installing, 234<br />

printer, 232, 236, 305<br />

T E X fonts, 235, 505<br />

under NFSS, 233, 378<br />

viewer, 164, 232, 305<br />

pound sign, 23, 27, 28, 570<br />

\pounds, 23, 27, 570<br />

pp4link package, 349<br />

.ppm file, 478<br />

PPower4, 343–9<br />

\Pr, 128, 129, 280, 570<br />

preamble, 12, 208<br />

\preamble (DocStrip), 465<br />

\prec, 126, 571<br />

\preceq, 126, 571<br />

\prefacename, 460<br />

preload.cfg, 385<br />

preload.ltx, 385<br />

presentation material, see slides<br />

\prime, 127, 571<br />

print environment (pdfscreen),<br />

343<br />

\PrintChanges (doc), 470<br />

printer driver, 15, 153, 389, 391,<br />

398, 453, 488, 497<br />

\PrintIndex (doc), 470<br />

\printindex, 210, 228, 399, 571<br />

\printl<strong>and</strong>scape (seminar), 333<br />

proc class, 391<br />

processing messages, 399, 414<br />

\ProcessOptions, 359, 443, 447,<br />

571<br />

\ProcessOptions*, 443, 444, 453,<br />

571<br />

\prod, 128, 137, 571<br />

programming L AT E X, 437–51<br />

deferred coding, 444<br />

durability, 440<br />

error messages, 446<br />

examples<br />

cus<strong>to</strong>m headline, 454–6<br />

cus<strong>to</strong>mized letter, 359–64<br />

full page, 452–4<br />

sectioning, 456–9<br />

file checking, 440–2<br />

guidelines, 438<br />

loading files, 442<br />

options, 442–4<br />

portability, 437<br />

robust comm<strong>and</strong>s, 444<br />

warnings, 446<br />

proof environment (amsthm), 282<br />

\proofname, 460<br />

\prop<strong>to</strong>, 126, 571<br />

\protect, 211, 426, 429, 440, 445,<br />

446, 535, 571<br />

protected space, 22, 29, 144<br />

pro<strong>to</strong>col, see transcript file<br />

\providecomm<strong>and</strong>, 187, 363, 439,<br />

449, 571<br />

\providecomm<strong>and</strong>*, 445, 571


\ProvidesClass, 359, 416, 432,<br />

441, 454, 571<br />

\ProvidesFile, 442, 448, 472, 571<br />

\ProvidesPackage, 416, 432, 441,<br />

572<br />

\ProvideTextComm<strong>and</strong>, 379, 572<br />

\ProvideTextComm<strong>and</strong>Default,<br />

380, 572<br />

\ps, 353, 572<br />

.ps file, 232, 236<br />

\psfig (epsfig), 159<br />

psfonts.map, 235<br />

\Psi, 125, 572<br />

\psi, 125, 572<br />

psnfss, PostScript support, 233<br />

PSTricks, 308<br />

pstricks package, 308<br />

pt (point), 21<br />

\ptsize (seminar), 331<br />

\pushtabs, 83, 84, 419, 572<br />

\put (picture), 161, 289, 290–9,<br />

302, 572<br />

\putfile (epic), 302, 304<br />

\qbezier, 299, 572<br />

\qed (amsthm), 282<br />

\qedsymbol (amsthm), 282<br />

\qquad, 30, 124, 269, 572<br />

\quad, 30, 124, 269, 273, 572<br />

quotation environment, 61, 67,<br />

68, 79, 521<br />

quotation marks, 23, 29<br />

French, 503<br />

quote environment, 19, 61, 67, 68,<br />

79, 197, 521<br />

\quotedblbase, 503, 573<br />

\quotesinglbase, 503, 573<br />

r.tex, 413<br />

\r (˚ accent), 24, 573<br />

Radhakrishnan, C. V., 340<br />

\raggedbot<strong>to</strong>m, 48, 573<br />

\raggedleft, 67, 573<br />

\raggedright, 67, 573<br />

\raggedslides (seminar), 334<br />

Rahtz, Sebastian, 154, 159, 239,<br />

330, 382, 480, 605<br />

Raichle, Bernd, 251<br />

INDEX 637<br />

\raisebox, 87, 88, 92, 102, 104,<br />

362, 573<br />

\raisetag (A M S), 271<br />

raising text, see text<br />

raising, in formulas, see formula<br />

\rangle, 132, 270, 573<br />

\rceil, 132, 573<br />

\Re, 127, 573<br />

Reckdahl, Keith, 606<br />

\RecordChanges (doc), 470<br />

\ref, 56, 131, 139, 177, 182, 209,<br />

214, 247, 278, 282, 395,<br />

396, 430, 431, 573<br />

\ref* (hyperref), 247<br />

reference, cross, see cross-reference<br />

references, list of, see bibliography<br />

\reflectbox (graphics), 156, 573<br />

\refname, 460, 574<br />

\refstepcounter, 182, 574<br />

\reftext. . . (varioref), 216<br />

relational symbols, 126<br />

\relax (T E X), 451<br />

\renewcomm<strong>and</strong>, 44, 185, 202, 415,<br />

425, 426, 438, 574<br />

\renewcomm<strong>and</strong>*, 445, 574<br />

\renewenvironment, 196, 203, 415,<br />

425, 439, 574<br />

\renewenvironment*, 445, 574<br />

\renewpagestyle (seminar), 335<br />

report class, 37, 41, 55, 113, 130,<br />

173, 183, 187, 191, 218,<br />

224, 225, 277, 391, 459<br />

reqno option, 271, 272, 280<br />

\RequirePackage, 400, 421, 432,<br />

442, 574<br />

\RequirePackageWithOptions,<br />

442, 574<br />

\resizebox (graphics), 156, 574<br />

\resizebox* (graphics), 575<br />

\restylefoat (float), 180<br />

\reversemarginpar, 117, 575<br />

\rfloor, 132, 575<br />

\rfoot (fancyhdr), 44<br />

\rhd, 126, 575<br />

\rhead (fancyhdr), 44<br />

\rho, 125, 575<br />

\right, 108, 131, 134, 137, 140, 575<br />

\Rightarrow, 74, 127, 575<br />

\rightarrow, 127, 575


638 INDEX<br />

\rightharpoondown, 127, 575<br />

\rightharpoonup, 127, 575<br />

\rightleftharpoons, 127, 575<br />

\rightmargin, 76, 77, 79, 575, 604<br />

\rightmark, 44<br />

\rlap (T E X), 348<br />

\rm (L AT E X 2.09), 367, 485<br />

\rmdefault, 233, 372, 379, 575<br />

\rmfamily, 64, 371, 379, 575<br />

robust comm<strong>and</strong>s, 440, 445<br />

Rokicki, Tomas, 159, 162, 231, 606<br />

Roman page numbering, 45, 58, 60<br />

\Roman, 73, 75, 114, 183, 192, 575<br />

\roman, 73, 114, 183, 575<br />

Romanian, 252<br />

roots, 122, 269<br />

Rose, Kris<strong>to</strong>ffer H., 307<br />

rotate environment (rotating),<br />

159<br />

\rotatebox (graphics), 156, 576<br />

\rotatebox (graphicx), 159<br />

\rotateheaderstrue (seminar),<br />

333<br />

rotating graphics <strong>and</strong> text, 156<br />

rotating package, 159<br />

Rowley, Chris, 8<br />

\rq (T E X), 576<br />

rubber lengths, 21, 22, 30, 32, 46,<br />

77, 85, 149, 173, 184, 457<br />

rule box, 85<br />

\rule, 18, 91, 106, 116, 173, 332,<br />

362, 364, 455, 576<br />

rules<br />

horizontal, 91<br />

vertical, 91<br />

Russian, 252, 283<br />

\rVert (A M S), 270, 576<br />

\rvert (A M S), 270, 576<br />

\S, 23, 576<br />

s.tex, 394, 413<br />

Saarela, J., 605<br />

Samarin, A., 605<br />

sample2e.tex, 385, 391<br />

Samuel, Arthur L., 606<br />

\savebox, 87, 93, 203, 576<br />

\savebox (picture), 300, 576<br />

\sb (T E X), 576<br />

\sbox, 87, 93, 106, 199, 361, 439,<br />

576<br />

\sc (L AT E X 2.09), 367, 485<br />

\scalebox (graphics), 156, 576<br />

scaling graphics <strong>and</strong> text, 156<br />

\scdefault, 372, 576<br />

Schenk, Christian, 381<br />

Schmidt, Walter, 25<br />

Schöpf, Rainer, 8, 257, 367<br />

Schrod, J., 251<br />

Schwarz, Norbert, 499, 606<br />

Scientific Workplace, 382<br />

Scottish Gaelic, 252<br />

screen environment (pdfscreen),<br />

343<br />

\screensize (pdfscreen), 342<br />

\scriptscriptstyle, 146, 375, 577<br />

\scriptsize, 63, 371, 577<br />

\scriptstyle, 146, 282, 375, 577<br />

\scshape, 64, 371, 577<br />

\searrow, 127, 577<br />

\sec, 128, 577<br />

secnumdepth counter, 56, 58, 458<br />

section counter, 57, 181, 183, 277<br />

\section, 44, 55, 58, 113, 455, 577<br />

\section*, 55, 577<br />

sectioning<br />

*-form, 55, 56<br />

hierarchy, 55<br />

numbering, 55<br />

depth of, 56<br />

secnumdepth, 57<br />

suppression of, 55<br />

title, 55<br />

short form, 58<br />

sectioning comm<strong>and</strong>s, 55<br />

redefining, 456<br />

\see, 227, 228, 577<br />

\seealso, 227, 577<br />

\seename, 460, 577<br />

\selectfont, 369, 370, 372, 376,<br />

578<br />

selective file processing, 208<br />

controlling, 210, 212<br />

\selectlanguage (babel), 254, 256,<br />

578<br />

sem-user.tex, 330<br />

\semcm (seminar), 332<br />

\semin (seminar), 332


seminar<br />

\add<strong>to</strong>artlength, 332<br />

\add<strong>to</strong>slidelength, 332<br />

\add<strong>to</strong>slidereset, 337<br />

\articlemag, 332<br />

\centerslidefalse, 334<br />

\centerslidetrue, 334<br />

\extraslideheight, 336<br />

\l<strong>and</strong>scapeonly, 332<br />

\newpagestyle, 335<br />

\newslide, 331, 336<br />

\newslideframe, 334<br />

\noxcomment, 337<br />

\onlyslides, 336<br />

\overlay, 337<br />

\portrai<strong>to</strong>nly, 332<br />

\printl<strong>and</strong>scape, 333<br />

\ptsize, 331<br />

\raggedslides, 334<br />

\renewpagestyle, 335<br />

\rotateheaderstrue, 333<br />

\semcm, 332<br />

\semin, 332<br />

\setartlength, 332<br />

\setslidelength, 332<br />

\slidebot<strong>to</strong>mmargin, 334<br />

\slidefootfont, 336<br />

\slideframe, 331, 334<br />

\slideframesep, 334<br />

\slideframewidth, 334<br />

\slideheadfont, 336<br />

\slideleftmargin, 334<br />

\slidepagestyle, 336<br />

\slidereset, 337<br />

\sliderightmargin, 334<br />

\slidesmag, 331<br />

\slide<strong>to</strong>pmargin, 334<br />

\thenote, 335, 337<br />

\theslide, 335, 337<br />

seminar class, 330–40<br />

seminar.con, 339, 340<br />

sempdftx package, 340<br />

sempdftx.sty, 340<br />

Serbian, 252<br />

series, font attribute, 64, 368<br />

\seriesdefault, 372<br />

servers, see network servers<br />

\setartlength (seminar), 332<br />

INDEX 639<br />

\setboolean (ifthen), 194, 359,<br />

451, 452, 578<br />

\setbox (T E X), 439<br />

\setcounter, 21, 182, 183, 203,<br />

418, 578<br />

\setlength, 20–2, 75, 83, 173, 184,<br />

200, 439, 578<br />

\SetMathAlphabet, 374, 423, 578<br />

\setminus, 126, 578<br />

\setslidelength (seminar), 332<br />

\SetSymbolFont, 374, 578<br />

\settime (slides), 327, 578<br />

\set<strong>to</strong>depth, 184, 579<br />

\set<strong>to</strong>height, 184, 579<br />

\set<strong>to</strong>width, 184, 189, 200, 579<br />

\sf (L AT E X 2.09), 367, 485<br />

\sf@size, 376<br />

\sfdefault, 233, 372, 379, 579<br />

\sffamily, 64, 66, 325, 371, 379,<br />

579<br />

\shadowbox (fancybox), 94, 335,<br />

579<br />

\shadowsize (fancybox), 94, 579<br />

shape, font attribute, 64, 368<br />

\shapedefault, 372<br />

\sharp, 127, 579<br />

shorthnd.tex, 322<br />

\shortstack, 297, 298, 299, 579<br />

shortvrb package, 111, 393<br />

\shoveleft (A M S), 271<br />

\shoveright (A M S), 271<br />

showidx package, 228, 392<br />

showkeys package, 395<br />

\sideset (A M S), 262, 579<br />

sideways environment (rotating),<br />

159<br />

\Sigma, 125, 579<br />

\sigma, 125, 579<br />

\signature, 351, 352, 353, 358, 579<br />

\sim, 126, 580<br />

\simeq, 126, 580<br />

Simonic, Aleks<strong>and</strong>er, 15<br />

\sin, 128, 580<br />

\sinh, 128, 580<br />

size, font attribute, 64, 369<br />

\sl (L AT E X 2.09), 367, 485<br />

\sldefault, 372, 580<br />

slide environment (seminar), 331,<br />

332, 521


640 INDEX<br />

slide environment (slides), 325,<br />

521<br />

slide* environment (seminar),<br />

331, 332<br />

\slidebot<strong>to</strong>mmargin (seminar),<br />

334<br />

\slidefootfont (seminar), 336<br />

\slideframe (seminar), 331, 334<br />

\slideframesep (seminar), 334<br />

\slideframewidth (seminar), 334<br />

\slideheadfont (seminar), 336<br />

\slideleftmargin (seminar), 334<br />

\slidepagestyle (seminar), 336<br />

\slidereset (seminar), 337<br />

\sliderightmargin (seminar), 334<br />

slides, 323–40<br />

leading page, 325<br />

notes, 326<br />

overlays, 325–6<br />

page styles, 326<br />

selective processing, 327<br />

special environments, 325–6<br />

timing notes, 327<br />

slides class, 324–30, 392<br />

\slidesmag (seminar), 331<br />

\slide<strong>to</strong>pmargin (seminar), 334<br />

SLIT E X, see slides<br />

\sloppy, 36, 88, 434, 580<br />

sloppypar environment, 36, 198,<br />

434, 521<br />

Slovakian, 252<br />

Slovenian, 252<br />

\slshape, 64, 78, 199, 363, 371, 580<br />

small environment, 110, 517<br />

\small, 19, 63, 371, 580<br />

small2e.tex, 385, 391<br />

smallmatrix environment (A M S),<br />

267<br />

\smallskip, 33, 580<br />

\smallskipamount, 580<br />

\smash (A M S), 269, 580<br />

\smile, 126, 580<br />

Snow, W., 606<br />

Sojka, Petr, 606<br />

somedefs package, 395<br />

source file, 5, 6<br />

source text, 4, 11, 14, 17<br />

\sp (T E X), 580<br />

space, see blank<br />

\space, 446<br />

spacing<br />

character, 29<br />

French spacing, 29<br />

horizontal, 29, 30<br />

line<br />

local change, 32<br />

st<strong>and</strong>ard, 63<br />

manual adjustment, 28<br />

paragraph, 11, 22, 46<br />

unwanted, 201<br />

vertical, 31–3<br />

rubber, 32<br />

word, 28<br />

after period, 29<br />

after punctuation, 28<br />

\spadesuit, 127, 580<br />

Spanish, 252<br />

Spannagel, Christian, 343<br />

special characters, 23<br />

special letters in other languages,<br />

24<br />

\special (T E X), 153, 232, 305, 477<br />

spelling, American or British, 195<br />

Spivak, Michael, 257<br />

\spline (eepic), 306<br />

split environment (A M S), 270,<br />

272, 276, 521<br />

\sqcap, 126, 580<br />

\sqcup, 126, 580<br />

\sqrt, 122, 269, 580<br />

\sqsubset, 126, 581<br />

\sqsubseteq, 126, 581<br />

\sqsupset, 126, 581<br />

\sqsupseteq, 126, 581<br />

square root sign, 122<br />

\SS, 24, 576<br />

\ss, 24, 581<br />

\ssf@size, 376<br />

\stackrel, 137, 581<br />

\star, 126, 581<br />

\stepcounter, 110, 115, 182, 581<br />

\S<strong>to</strong>pEventually (doc), 469<br />

\stretch, 184, 581<br />

strut, 92, 103, 105<br />

\strut, 298<br />

.sty file, 9, 12, 41, 384, 385, 463,<br />

484<br />

style files (L AT E X 2.09), 483


style parameter<br />

float, 171<br />

footnote, 117<br />

frame box, 93<br />

lists, 75<br />

marginal note, 118<br />

math, 148<br />

table, 98<br />

subarray environment (A M S),<br />

261, 522<br />

subequations environment<br />

(A M S), 277, 522<br />

\subitem, 225, 226, 581<br />

subparagraph counter, 57, 181<br />

\subparagraph, 55, 581<br />

\subparagraph*, 55, 581<br />

subscript, 121<br />

subsection counter, 57, 181<br />

\subsection, 44, 55, 181, 581<br />

\subsection*, 55, 581<br />

\subset, 126, 582<br />

\subseteq, 126, 582<br />

\substack (A M S), 261, 581<br />

\subsubitem, 225, 226, 582<br />

subsubsection counter, 57, 181<br />

\subsubsection, 55, 582<br />

\subsubsection*, 55, 582<br />

\succ, 126, 582<br />

\succeq, 126, 582<br />

\sum, 123, 128, 137, 582<br />

sumlimits option, 279<br />

summation sign, 123<br />

\sup, 128, 129, 280, 582<br />

superscript, 121<br />

\suppressfloats, 171, 175, 582<br />

\supset, 126, 582<br />

\supseteq, 126, 582<br />

\surd, 127, 582<br />

Su<strong>to</strong>r, Robert, 605<br />

\swapnumbers (amsthm), 281<br />

\swarrow, 127, 582<br />

Swedish, 252<br />

switch.def (babel), 253<br />

\symbol, 66, 88, 582<br />

symbols<br />

above one another, 137, 261<br />

alternative comm<strong>and</strong>s, 462<br />

arrows, 127, 262, 282<br />

binary opera<strong>to</strong>rs, 125<br />

INDEX 641<br />

brackets, 131<br />

au<strong>to</strong>matic size, 131<br />

invisible, 132<br />

manual sizing, 148<br />

multiline equations, 140,<br />

148, 276<br />

direct input, 26, 461<br />

integral, 123, 260<br />

keyboard, 120<br />

letters<br />

calligraphic, 125, 284<br />

Greek, 125<br />

limits, 128, 261<br />

miscellaneous, 127<br />

negation, 126<br />

pointers, 127<br />

relational, 126<br />

summation, 123<br />

two sizes, 128<br />

\syntaxonly (syn<strong>to</strong>nly), 393<br />

syn<strong>to</strong>nly package, 393<br />

T1 encoding, 500, 501, 503, 506<br />

t1enc package, 393<br />

t1enc.def, 398, 501<br />

\t ( accent), 24, 582<br />

tab s<strong>to</strong>p, 81<br />

tabbing, 81–5<br />

accents in, 83<br />

additional comm<strong>and</strong>s, 83<br />

backwards, 82<br />

end of line, 81<br />

left margin, 82<br />

setting, 82<br />

nesting, 84<br />

page breaking, 84<br />

sample line, 82<br />

setting s<strong>to</strong>ps, 81<br />

s<strong>to</strong>ring, 83<br />

tabbing environment, 81, 83, 84,<br />

415, 419, 420, 428, 522<br />

\tabbingsep, 83, 582<br />

\tabcolsep, 98, 106, 583<br />

table, 95–110<br />

column alignment, 101<br />

on decimals, 107<br />

construction, 95–8<br />

@-expression, 96, 101, 110<br />

column formatting, 96


642 INDEX<br />

column repetition, 96<br />

column separation, 97<br />

horizontal line, 97<br />

math arrays, 133–6<br />

merging columns, 97, 101<br />

paragraph column, 96, 104<br />

row end, 97<br />

vertical line, 96, 97<br />

vertical positioning, 95<br />

examples, see table examples<br />

extension packages, 106, 394<br />

floating, see float, 169<br />

footnotes inside, 116<br />

intercolumn spacing, 96<br />

math, 133–6<br />

multi-page, 108<br />

multipage, 108<br />

numbering, see float, caption<br />

setting width, 96, 107<br />

style parameter, 98<br />

title, see float<br />

table counter, 181<br />

table environment, 60, 108–10,<br />

169, 173, 182, 213, 417,<br />

419, 430, 522<br />

table examples, 98–106<br />

@-expression, 110<br />

changing fonts, 102<br />

column alignment, 101<br />

column format, 99<br />

empty box, 105<br />

floating, 110<br />

framed, 100<br />

horizontal line, 100, 102<br />

math arrays, 133–6<br />

merging columns, 101<br />

paragraph column, 104<br />

line breaking, 105<br />

row termination, 99<br />

setting widths, 110<br />

text between columns, 101<br />

unframed, 99<br />

vertical line, 99, 102, 106<br />

with all table features, 106<br />

table of contents, 55, 58<br />

au<strong>to</strong>matic entries, 58<br />

for figures, 59<br />

for tables, 59<br />

level of entry, 58<br />

<strong>to</strong>cdepth, 58<br />

manual entry, 59<br />

printing, 58<br />

table* environment, 169, 522<br />

\tablename, 255, 459, 583<br />

\tableofcontents, 58, 60, 210,<br />

396, 400, 427, 436, 583<br />

tables, list of, 59<br />

tabular environment, 10, 95, 99,<br />

102, 107, 116, 179, 297,<br />

362, 394, 417, 418, 425,<br />

428, 429, 522<br />

tabular* environment, 95, 107,<br />

110, 395, 455, 523<br />

\tabularnewline, 98, 105, 583<br />

tabularx environment, 107, 395<br />

tabularx package, 107, 395<br />

tabula<strong>to</strong>r, see tabbing<br />

\tag (A M S), 271, 573, 583<br />

\tan, 128, 583<br />

\tanh, 128, 583<br />

\tau, 125, 583<br />

Taylor, Philip, 606<br />

\tbinom (A M S), 265, 583<br />

tbtags option, 272, 279<br />

TC fonts, 24, 501<br />

tcidvi, graphics option, 154<br />

.tcx file, 481<br />

TDS, T E X Direc<strong>to</strong>ry Structure, 388<br />

techexplorer Hypermedia<br />

Browser, 481<br />

TEI DTD, 479, 480<br />

\telephone, 352, 356, 583<br />

testpage.tex, 385, 391<br />

teT E X for Unix, 381<br />

T E X<br />

logo, 19<br />

T E X, 6, 398<br />

implementations, 381<br />

T E X comm<strong>and</strong>s, 438<br />

adjusting bracket sizes, 148<br />

allowed, 450–1<br />

\a<strong>to</strong>p, 137, 146, 147, 189<br />

avoiding, 439<br />

\Big, 148, 525<br />

\big, 148, 525<br />

\Bigg, 148, 525<br />

\bigg, 148, 525<br />

\brace, 192


\brack, 192<br />

\centerline, 67, 176, 408, 527<br />

\choose, 137, 146, 147, 189,<br />

192<br />

\day, 27, 460<br />

\def, 439, 445, 450<br />

\edef, 450<br />

\else, 451<br />

\endinput, 451<br />

\exp<strong>and</strong>after, 451<br />

\fi, 451<br />

forbidden, 137<br />

\gdef, 450<br />

\hbox, 439<br />

\hoffset, 547, 604<br />

\hss, 408<br />

\if, 451<br />

\ifcase, 451, 461<br />

\iffalse, 468<br />

\language, 36, 251, 255, 256,<br />

553<br />

\let, 451<br />

\llap, 348<br />

\lq, 557<br />

\month, 27, 460<br />

\newif, 451<br />

\noexp<strong>and</strong>, 451<br />

\or, 451<br />

\relax, 451<br />

\rlap, 348<br />

\rq, 576<br />

\sb, 576<br />

\setbox, 439<br />

\sp, 580<br />

\special, 153, 232, 305, 477<br />

\vbox, 439<br />

\voffset, 593, 604<br />

\xdef, 450<br />

\year, 27, 460<br />

\TeX, 19, 583<br />

tex.dll, 386<br />

T E X4ht program, 477, 479, 480<br />

TeX4ht package, 477<br />

T E X error messages, see error<br />

messages<br />

.tex file, 14, 17, 208, 209, 391, 396,<br />

400, 403, 436<br />

T E XLive, 3, 13, 15, 160, 344, 381–9,<br />

478, 479, 506<br />

INDEX 643<br />

texmf.cnf, 386<br />

texsys.cfg, 384<br />

text<br />

comm<strong>and</strong>s in text, 11<br />

comments in, 118<br />

components, 11<br />

framed, 86<br />

in formulas, 133<br />

literal, printing, 110, 393<br />

lowering, 87<br />

math, 119<br />

merging, 207<br />

multiple files, 207<br />

overlapping, 86<br />

raising, 87<br />

selective processing, 208<br />

underlining, 136<br />

vertically stacked, 297<br />

width calculation, 184<br />

text companion fonts, 24, 393, 501,<br />

506<br />

text edi<strong>to</strong>r, 4, 17<br />

text formula, 119<br />

text height, 48, 50<br />

\textsymbol, 463, 584<br />

\text (A M S), 259, 583<br />

\textbf, 65, 372, 373, 584<br />

\textcircled, 463, 584<br />

\textcolor (color), 167, 335, 584<br />

textcomp package, 24–5, 393, 503<br />

\textcompwordmark, 463, 584<br />

\texteuro, 25<br />

\texteuro (textcomp), 503<br />

\textfloatsep, 172, 584<br />

\textfraction, 172, 584<br />

\textheight, 48, 50, 332, 361, 434,<br />

452, 453, 584<br />

\textit, 65, 372, 585<br />

\textmd, 65, 372, 585<br />

\textnormal, 65, 372, 585<br />

\textquotedbl, 503, 585<br />

\textregistered, 463, 585<br />

\textrm, 65, 372, 585<br />

\textsc, 65, 372, 585<br />

\textsf, 25, 65, 372, 585<br />

\textsl, 44, 65, 372, 585<br />

\textstyle, 137, 146, 264, 375, 585<br />

\textsuperscript, 463, 585<br />

\texttrademark, 463, 585


644 INDEX<br />

\texttt, 65, 88, 372, 585<br />

\textup, 65, 372, 585<br />

Textures, 382<br />

textures, graphics option, 154<br />

\textwidth, 21, 48, 50, 184, 195,<br />

332, 361, 452, 453, 455,<br />

586<br />

\tf@size, 376<br />

.tfm file, 234, 400, 487, 498, 503,<br />

506<br />

\tfrac (A M S), 264, 586<br />

\TH, 503, 586<br />

\th, 503, 586<br />

Thành, Hàn Thê ´ , 16, 238, 606<br />

\thanks, 54, 424, 586<br />

\the, 586<br />

\thecounter, 183, 586<br />

thebibliography environment,<br />

217, 220, 221, 224, 228,<br />

309, 311, 419, 523<br />

\thechapter, 187<br />

\theequation, 191, 277<br />

\thefootnote, 113, 116, 190<br />

Theiling, Henrik, 25<br />

theindex environment, 225, 228,<br />

399, 523<br />

\thenote (seminar), 335, 337<br />

theorem environment, 80, 523<br />

theorem package, 81, 282, 395<br />

theorems, 80<br />

with A M S, 280<br />

\theoremstyle (A M S), 281<br />

\thepage, 44, 183, 335, 363, 455<br />

\thesection, 183, 187, 277<br />

\theslide (seminar), 335, 337<br />

\thesubsection, 187<br />

\Theta, 125, 586<br />

\theta, 125, 586<br />

\Thicklines (eepic), 306<br />

\thicklines (picture), 94, 289,<br />

293, 300, 497, 586<br />

\thickspace (A M S), 269, 586<br />

\thinlines (picture), 94, 289, 300,<br />

494, 586<br />

\thinspace (A M S), 269, 586<br />

\thisfancypage (fancybox), 95,<br />

586<br />

\thispagestyle, 21, 43, 327, 335,<br />

363, 587<br />

thmtest.tex, 281<br />

.tif file, 162<br />

TIFF images, 162, 238<br />

.tiff file, 162<br />

\tilde, 129, 263, 587<br />

\Tilde (A M S), 263, 587<br />

times package, 234<br />

\times, 126, 587<br />

Times-Roman, PostScript font, 234,<br />

379, 504<br />

times.sty, 378<br />

\tiny, 63, 371, 587<br />

title<br />

of sections, 55<br />

of table, see float<br />

title page, 39, 52<br />

free format, 54<br />

st<strong>and</strong>ard format, 52<br />

\title, 52, 53, 54, 69, 419, 431, 587<br />

titlepage environment, 52, 54,<br />

69, 210, 523<br />

titlepage option, 39, 54, 55, 351<br />

\<strong>to</strong>, 127, 587<br />

\<strong>to</strong>address, 359, 363<br />

<strong>to</strong>cdepth counter, 58<br />

.<strong>to</strong>c file, 59, 400, 436<br />

\<strong>to</strong>day, 27, 28, 36, 255, 363, 460,<br />

587<br />

\<strong>to</strong>name, 359, 360, 363<br />

<strong>to</strong>p margin, 48, 50<br />

\<strong>to</strong>p, 127, 587<br />

\<strong>to</strong>pfigrule, 173, 587<br />

\<strong>to</strong>pfraction, 172, 587<br />

\<strong>to</strong>plink (pp4link), 349<br />

\<strong>to</strong>pmargin, 48, 50, 361, 453, 587<br />

<strong>to</strong>pnumber, 171, 588<br />

\<strong>to</strong>psep, 75, 149, 588, 604<br />

\<strong>to</strong>pskip, 48, 588<br />

\<strong>to</strong>ptarget (pp4link), 349<br />

\<strong>to</strong>talheight, 86, 90, 588<br />

<strong>to</strong>talnumber, 172, 588<br />

tracefnt package, 393, 433<br />

transcript file, 14, 50, 399, 401<br />

transliteration, Cyrillic, 284<br />

\triangle, 127, 588<br />

\triangleleft, 126, 588<br />

\triangleright, 126, 588<br />

trivial lists, 79<br />

trivlist environment, 79, 523


truetex, graphics option, 154<br />

TrueType fonts, 238<br />

TS1 encoding, 502, 506<br />

\tt (L AT E X 2.09), 65, 367, 485<br />

\ttdefault, 233, 372, 379, 588<br />

\ttfamily, 64, 371, 379, 588<br />

TUG, T E X Users Group, 3, 382, 388<br />

Turkish, 252, 462<br />

turn environment (rotating), 159<br />

\turnbox (rotating), 159<br />

two-column page formatting, 38<br />

column dividing rule, 40<br />

column separation, 40<br />

for single pages, 51<br />

two-sided page formatting, 38, 50<br />

left margin, 48<br />

twocolumn option, 34, 38, 40, 51,<br />

116, 117, 351<br />

\twocolumn, 34, 51, 395, 431, 588<br />

twoside option, 34, 38, 43, 44, 49,<br />

50, 58, 116, 117<br />

.txt file, 384<br />

typefaces, see fonts<br />

\typein, 211, 212, 328, 589<br />

\typeout, 211, 589<br />

type 1 fonts, 8, 25, 231, 238, 387,<br />

498, 503<br />

type 3 fonts, 8, 234, 238<br />

\u (˘ accent), 24, 589<br />

ukhyphen.tex, 256<br />

Ukrainian, 252<br />

Umeki, Hideo, 49<br />

\unboldmath, 143, 373, 433, 589<br />

\underbrace, 136, 589<br />

underbraces in formulas, 136<br />

Underfull \hbox warning, 434<br />

Underfull \vbox warning, 435<br />

\underleftarrow (A M S), 262, 589<br />

\underleftrightarrow (A M S),<br />

262, 589<br />

\underline, 136, 362, 458, 589<br />

underlining, 136<br />

\underrightarrow (A M S), 262, 589<br />

\underset (A M S), 262, 590<br />

\unitlength (picture), 288, 289,<br />

290, 590<br />

units of length, 21<br />

Unix, 381<br />

INDEX 645<br />

\unlhd, 126, 590<br />

unpack.ins, 384<br />

\unrhd, 126, 590<br />

unsrt bibliography style, 310<br />

unsrtnat bibliography style, 221,<br />

311<br />

\Uparrow, 127, 132, 590<br />

\uparrow, 127, 132, 590<br />

\updefault, 372, 590<br />

\Updownarrow, 127, 590<br />

\updownarrow, 127, 590<br />

\uplus, 126, 590<br />

Upper Sorbian, 252<br />

upref package, 282<br />

\uproot (A M S), 269, 590<br />

\upshape, 64, 371, 590<br />

\Upsilon, 125, 590<br />

\upsilon, 125, 590<br />

Urban, Michael, 606<br />

url package, 112<br />

\url (url), 112, 590<br />

\urldef (url), 112<br />

\urlid (pdfscreen), 342<br />

\urlstyle (url), 112, 590<br />

\usebox, 87, 93, 106, 199, 300, 362,<br />

591<br />

\usecounter, 75, 77, 78, 591<br />

\usefont, 369, 591<br />

\usepackage, 12, 24, 41, 42, 201,<br />

222, 395, 412, 416, 418,<br />

421, 422, 432, 441, 591<br />

\usepostamble (DocStrip), 465<br />

\usepreamble (DocStrip), 465<br />

ushyphen.tex, 256<br />

\v (ˇ accent), 24, 591<br />

\value, 183, 191, 193, 195, 426, 591<br />

van Dongen, Marc, 344<br />

van Z<strong>and</strong>t, Timothy, 94, 308, 330<br />

\varepsilon, 125, 591<br />

variable, math, see formula<br />

\varinjlim (A M S), 268, 591<br />

varioref package, 215–16, 253,<br />

396<br />

\varliminf (A M S), 268, 591<br />

\varlimsup (A M S), 268, 591<br />

\varphi, 125, 591<br />

\varpi, 125, 591<br />

\varprojlim (A M S), 268, 591


646 INDEX<br />

\varrho, 125, 591<br />

\varsigma, 125, 591<br />

\vartheta, 125, 591<br />

\vbox (T E X), 439<br />

\vdash, 126, 127, 592<br />

\vdots, 123, 592<br />

\vec, 129, 144, 263, 592<br />

\Vec (A M S), 263, 592<br />

\vec<strong>to</strong>r (picture), 161, 295, 299,<br />

300, 416, 592<br />

\vee, 126, 592<br />

\verb, 110, 393, 420, 592<br />

\verb*, 110, 592<br />

verbatim environment, 110, 467,<br />

523<br />

in verbatim package, 111, 396<br />

verbatim package, 111, 118, 396<br />

verbatim* environment, 110, 523<br />

\verbatiminput (verbatim), 111,<br />

396<br />

verse, 68<br />

verse environment, 61, 68, 79, 523<br />

version, math, 373<br />

.vf file, 234, 236, 400, 488, 504<br />

\vfill, 32, 592<br />

viewgraphs, see slides<br />

virtual fonts, 488, 503<br />

\visible (slides), 326, 592<br />

\vline, 97, 106, 592<br />

Vmatrix environment (A M S), 266,<br />

524<br />

vmatrix environment (A M S), 266,<br />

524<br />

\voffset (T E X), 593, 604<br />

Volovich, Vladimir, 506<br />

\vpagecolor (background), 345<br />

\vpageref (varioref), 215, 396,<br />

593<br />

\vpagerefrange (varioref), 216<br />

\vref (varioref), 215, 396, 593<br />

\vrefrange (varioref), 216<br />

\vspace, 32, 92, 332, 364, 419, 455,<br />

593<br />

\vspace*, 32, 69, 173, 593<br />

vtex, graphics option, 154<br />

Washing<strong>to</strong>n, University, 283<br />

Web Consortium, 479<br />

Web2c T E X, 381<br />

web2ctex.txt, 384<br />

\wedge, 126, 593<br />

Welsh, 252<br />

what-you-see-is-what-you-get, 4,<br />

382<br />

\whiledo (ifthen), 193, 195, 593<br />

Wicks, Mark A., 162, 237<br />

\widehat, 593<br />

\widetilde, 594<br />

\width, 86, 90, 594<br />

Williams, Graham, 13<br />

Williamson, H. A., 606<br />

Windows, 381<br />

Windows coding, 26, 462<br />

windvi previewer, 154, 234, 305<br />

WinEdt, 15, 382<br />

WinShell, 15, 382<br />

Woliński, Marcin, 464<br />

Wooding, Mark, 464<br />

word division, see hyphenation<br />

word spacing, see spacing<br />

World Wide Web, 4, 8, 9, 475–82<br />

\wp, 127, 594<br />

\wr, 126, 594<br />

x.tex, 394, 413<br />

\xdef (T E X), 450<br />

xdvi previewer, 15, 154, 234, 305<br />

\Xi, 125, 594<br />

\xi, 125, 594<br />

\xleftarrow (A M S), 263, 594<br />

XML, 3, 5, 10, 478–81<br />

xmltex format, 481<br />

xmltex.tex, 480<br />

xr package, 215, 243, 396<br />

\xrightarrow (A M S), 263, 594<br />

XSL, 5, 479<br />

xspace package, 186, 396<br />

XY-pic, 307<br />

Y&Y, 382, 489, 506<br />

\year (T E X), 27, 460<br />

\zeta, 125, 594<br />

zip program, 166<br />

.zip file, 166<br />

Zlatuˇska, Jiˇrí, 606

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!