Latex Graphics Companion 2Ed (Excerpts)
Total Page:16
File Type:pdf, Size:1020Kb
i i “tlgc2” — 2007/6/15 — 15:36 — page iii — #3 i i The LATEXGraphics Companion Second Edition Michel Goossens Frank Mittelbach Sebastian Rahtz Denis Roegel Herbert Voß Upper Saddle River, NJ • Boston • Indianapolis • San Francisco New York • Toronto • Montreal • London • Munich • Paris • Madrid Capetown • Sydney • Tokyo • Singapore • Mexico City i i i i i i “tlgc2” — 2007/6/15 — 15:36 — page iv — #4 i i Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and Addison-Wesley was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals. The authors and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein. The publisher offers discounts on this book when ordered in quantity for bulk purchases and special sales. For more information, please contact: U.S. Corporate and Government Sales (800) 382-3419 [email protected] For sales outside of the United States, please contact: International Sales [email protected] Visit Addison-Wesley on the Web: www.awprofessional.com Library of Congress Cataloging-in-Publication Data The LaTeX Graphics companion / Michel Goossens ... [et al.]. -- 2nd ed. p. cm. Includes bibliographical references and index. ISBN 978-0-321-50892-8 (pbk. : alk. paper) 1. LaTeX (Computer file) 2. Computerized typesetting. 3. PostScript (Computer program language) 4. Scientific illustration--Computer programs. 5. Mathematics printing--Computer programs. 6. Technical publishing--Computer programs. I. Goossens, Michel. Z253.4.L38G663 2008 686.2’2544536–dc22 2007010278 Copyright © 2008 by Pearson Education, Inc. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form, or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior consent of the publisher. The foregoing notwithstanding, the examples contained in this book and obtainable online on CTAN are made available under the LATEX Project Public License (for information on the LPPL, see www.latex-project.org/lppl). For information on obtaining permission for use of material from this work, please submit a written request to: Pearson Education, Inc. Rights and Contracts Department 75 Arlington Street, Suite 300 Boston, MA 02116 Fax: (617) 848-7047 ISBN 10: 0-321-50892-0 ISBN 13: 978-0-321-50892-8 Text printed in the United States on recycled paper at Courier in Westford, Massachusetts. First printing, July 2007 i i i i i i “tlgc2” — 2007/6/15 — 15:36 — page v — #5 i i We dedicate this book to the hundreds of LATEX developers whose contributions are showcased in it, and we salute their enthusiasm and hard work. Wewouldalsoliketorememberwithaffection and thanks Daniel Taupin, whose MusiXTEX system is described in Chapter 9, and who passed away in 2003, a great loss to our community. i i i i i i “tlgc2” — 2007/6/15 — 15:36 — page vi — #6 i i Rhapsodie pour piano Compos´e partiellement vers 1975, termin´eenaoˆut 2002 Daniel TAUPIN ˘ 1 Allegro ( = 50) tr EEEEEEE tr EEEEEEE tr EEEEEEE tr EEEEEEE tr EEEEEEE ăă 2 ă ă ăă ăă 㡠G 2 ăă ăă ¯ ˇ ˇ ¯ ˇ ˇ ¯ ˇ ˇ 2 ˇ ˛¯ ˇ ˇ ˇ ¯ ˇ ˇ ˇ ˇ ˇ Piano ă ff ăă tr EEEEEEE ă tr EEEEEEE ă tr EEEEEEE ăă tr EEEEEEE ăă tr EEEEEEE ˇ I ăă ăă ¯ ˇ ˇ ¯ ˇ ˇ ¯ ˇ ˇ 2 2 ˇ ˛¯ ˇ ˇ ˇ ¯ ˇ ˇ ˇ ˇ ˇ 2 # ! # ! # ! # ! # ! ğğ ğğ 6 ğğˇ ˘` ğˇ tr EEEEEE tr EEEEEE tr EEEEEE ˇ ˇ ęę ęę ę ęęěě ˇ ęęěě ˇ G2 ¯ ˇ ˇ ęˇ ęę ˇ ˇ ˇ ˇ ¯ ˇ ˇ ¯ ˇ ˇ ˇ ˘ ;ˇ` ˇ ? ˇ ( ˘ ;ˇ` ă ęę ęę ęę tr EEEEEE ę tr EEEEEE ę tr EEEEEE ę » I ¯ ˇ ˇ ˇ ¯ ˇ ˇ ˇ ¯ ˇ ˇ ˇ ¯ ˘` ˇ ¯ „ 2 ¯ » ˘` ? ˇ ¯ „ # ! # ! # ! # ! - # ąą 12 ˘` ąą ˘` a tempo ˇ ˇ | tr EEEEEEE 2 ă㧧ˇ ˇ G ˇ › ęę ? ˇ ( ˘ <ˇ` ? ˇ ( ¯ 4˘` > ˇ ˛¯ ˇ ˇ ˇ ă rit. ff ¯ ‚ ˘` tr EEEEEEE ęę I `˘` ˇ ( ¯ — ˘` ˇ ( ¯ ‚ ˘` ˇ ˛ ęˇ 2 ‚ ˘` ¯ ˇ ˇ `˘` ? ˇ ¯ — ˘` ? ˇ ¯ > ¯ ! # ! # ¯ ‚ ˘` ! # ! 18 tr EEEEEE tr EEEEEE tr EEEEEE tr EEEEEE ęę tr EEEEEE ę tr EEEEEE 2 ę ęę ęę ęˇ ęę ęę G ęę ¯ ˇ ˇ ¯ ˇ ˇ ¯ ˇ ˇ ¯ ˇ ˇ ˇ ¯ ˇ ˇ ¯ ˇ ˇ ˇ ˇ ˇ ˇ ă ęę ęę ęę tr EEEEEE ę tr EEEEEE ęę tr EEEEEE ęę tr EEEEEE ˇ tr EEEEEE ˇ tr EEEEEE ˇ I ęę ¯ ˇ ˇ ¯ ˇ ˇ ¯ ˇ ˇ ¯ ˇ ˇ ¯ ˇ ˇ 2 ¯ ˇ ˇ ˇ ˇ ˇ ¯ ¯ ¯ ¯ ¯ ¯ # ! # ! # ! # ! # ! # ! ş şş 24 şşˇ ˘` ş ˇ ˘` tr EEEEEEEE ą§§ ˇ ˇ şśś ˇ ˇ G2 ăă ˇ ˇ ˇ ˇ ¯ ˇ ˇ ˇ ˘ = ˇ` ? ˇ ( ˘ = ˇ` ? ˇˇ ( ă ăă tr EEEEEEEE ă ı I ¯ ˇ ˇ ˇ ¯ ˘` ˇ ¯ ı ˘` ˇ 2 ¯ ¯ ı ˘` ? ˇ ¯ ı ˘` ? ˇ # ! # ! - # ! - ąą ˘` ąą ˘` 29 ˇ ˇ ă ˇ \ˇ | 2 ă㧧ˇ ˇ 㧧\ˇ ˇ G ˘ ˚ˇ` ˇ ? ˇ ( ˘ ˚ˇ` ˇ ? ˇ ( › > ˘ ˇ 4˘ \ˇ ¯ C 4˘` ă ˘ ˇ rit. ¯ ˘` p I — ˘` ˇ ( 2 ¯ ¯ — ˘` ˇ ( ¯ ˘` ¯ — ˘` ? ˇ ? ¯ > # ! # ¯ — ˘` ! ˇ # ! # ˘` ! Rhapsodie — 26 mars 2003 — (D. Taupin) 1 Music composed by Daniel Taupin and typeset with MusiXTEX i i i i i i “tlgc2” — 2007/6/15 — 15:36 — page 1 — #1 i i CHAPTER 1 Graphics with LATEX 1.1Graphicssystemsandtypesetting............................. 2 1.2Drawingtypes......................................... 3 1.3 TEX’sinterfaces......................................... 6 1.4Graphicslanguages......................................10 1.5Choosingapackage......................................21 The phrase “A picture paints a thousand words” seems to have entered the English lan- guage thanks to Frederick R. Barnard in Printer’s Ink, 8 December 1921, retelling a Chinese proverb.1 However, while LATEX is quite good at typesetting words in a beautiful manner, LATEX manuals usually tell you little or nothing about how to handle graphics. This book at- tempts to fill that gap by describing tools and TEXniques that let you generate, manipulate, and integrate graphics with your text. In these days of the multimedia PC, graphics appear in various places. With many prod- ucts we get ready-to-use collections of clipart graphics; in shops we can buy CD-ROMs with “the best photos” of important places; and so forth. As we shall see, all such graphics can be included in a LATEX document as long as they are available in a suitable format. Fortunately, many popular graphic formats either are directly supported or can be converted via a pro- gram that allows transformation into a supported representation. If you want to become your own graphic artist, you can use stand-alone dedicated drawing tools, such as the freely available dia (www.gnome.org/projects/dia)and xfig (www.xfig.org/userman) on Linux, or the commercial products Adobe Illustrator (www.adobe.com/illustrator)orCorel Draw (www.corel.com/coreldraw)ona Mac or PC. Spreadsheet programs, or one of the modern calculation tools like Mathematica 1Paul Martin Lester (commfaculty.fullerton.edu/lester/writings/letters.html)statesthat the literal translation of the “phony” Chinese proverb should rather be “Apicture’s meaning can express ten thou- sand words”. He, rightly, emphasizes that pictures cannot and should not replace words, but both are comple- mentary and contribute equally to the understanding of the meaning of a work. i i i i i i “tlgc2” — 2007/6/15 — 15:36 — page 2 — #2 i i 2 GRAPHICS WITH LATEX (www.wolfram.com/mathematica), Maple (www.maplesoft.com/maple), and MAT- LAB (www.mathworks.com/matlab), or their freely available GNU variant Octave (www. octave.org) and its plotting complements Octaviz (octaviz.sourceforge.net)and Octplot (octplot.sourceforge.net), can also produce graphics by using one of their many graphical output representations. With the help of a scanner or a digital camera you can produce digital photos, images of hand-drawn pictures, or other graphics that can be manipulated with their accompanying software. In all these cases it is easy to generate files that can be directly referenced in the LATEX source through the commands of the graphics package described in Chapter 2. If needed, LATEX can also offer a closer integration with the typesetting system than that possible by such programs. Such integration is necessary if you want to use the same fonts in text and graphics, or more generally if the “style” of the graphics should depend on the overall style of the document. Close integration of graphics with the surrounding text clearly requires generation of the graphic by the typesetting system itself, because otherwise any change in the document layout style requires extensive manual labor and the whole process becomes very error-prone. ∗∗∗ This chapter considers graphic objects from different angles. First. we look at the require- ments that various applications impose on graphic objects. Next, we analyze the types of drawings that appear in documents and the strategies typically employed to generate, in- tegrate, and manipulate such graphics. Then, we discuss the interfaces offered by TEXfor dealing with graphic objects. Armed with this knowledge, we end the chapter with a short survey of graphics languages built within and around TEX. This overview will help you se- lect the right tool for the job at hand. In fact, the current chapter also gives some examples of languages and approaches not covered in detail elsewhere in the book. Thus this survey should provide you with enough information to decide whether or not to follow the pointers and obtain such a package for a particular application.