您好,欢迎访问三七文档
当前位置:首页 > 行业资料 > 国内外标准规范 > A-Users-Manual-for-MetaPost
METAPOSTauser’smanualJohnD.HobbyandtheMetaPostdevelopmentteamdocumentedversion:1.100November27,2008Contents1Introduction12BasicDrawingStatements23HandlingMetaPostoutput43.1PreviewingMetaPostgraphics..43.2UsingMetaPostgraphicsinTEX,LATEX,pdfLATEX,pdfTEX,ConTEXtandtroff........43.3Filenametemplates.......64Curves74.1BézierCubicCurves.......84.2SpecifyingDirection,Tension,andCurl..............94.3SummaryofPathSyntax....125LinearEquations125.1EquationsandCoordinatePairs.135.2DealingwithUnknowns.....156Expressions166.1DataTypes............166.2Operators.............176.3Fractions,Mediation,andUnaryOperators.............197Variables207.1Tokens...............217.2VariableDeclarations.......218IntegratingTextandGraphics228.1TypesettingYourLabels.....248.2Fontmapfiles...........278.3Theinfontoperator.......288.4MeasuringText..........289AdvancedGraphics299.1BuildingCycles..........319.2DealingwithPathsParametrically329.3AffineTransformations......359.4DashedLines...........399.5Localspecials...........419.6OtherOptions..........419.7Pens................459.8ClippingandLow-LevelDraw-ingCommands..........469.9DirectingOutputtoaPictureVariable..............489.10InspectingtheComponentsofaPicture...............4810Macros5010.1Grouping.............5010.2ParameterizedMacros......5210.3SuffixandTextParameters...5310.4VardefMacros..........5810.5DefiningUnaryandBinaryMacros5911Loops6112ReadingandWritingFiles6213UtilityRoutines6313.1TEX.mp...............6313.2mproof.tex............6414Debugging65AReferenceManual67BMetaPostVersusMETAFONT851IntroductionMetaPostisaprogramminglanguagemuchlikeKnuth’sMETAFONT1[3]exceptthatitoutputsPostScriptprogramsinsteadofbitmaps.BorrowedfromMETAFONTarethebasictoolsforcreatingandmanipulatingpictures.Theseincludenumbers,coordinatepairs,cubicsplines,affinetransfor-mations,textstrings,andbooleanquantities.AdditionalfeaturesfacilitateintegratingtextandgraphicsandaccessingspecialfeaturesofPostScript2suchasclipping,shading,anddashedlines.AnotherfeatureborrowedfromMETAFONTistheabilitytosolvelinearequationsthataregivenimplicitly,thusallowingmanyprogramstobewritteninalargelydeclarativestyle.Bybuildingcomplexoperationsfromsimplerones,MetaPostachievesbothpowerandflexibility.MetaPostisparticularlywell-suitedtogeneratingfiguresfortechnicaldocumentswheresomeaspectsofapicturemaybecontrolledbymathematicalorgeometricalconstraintsthatarebestexpressedsymbolically.Inotherwords,MetaPostisnotmeanttotaketheplaceofafreehanddraw-ingtoolorevenaninteractivegraphicseditor.Itisreallyaprogramminglanguageforgeneratinggraphics,especiallyfiguresforTEX3andtroffdocuments.1METAFONTisatrademarkofAddisonWesleyPublishingcompany.2PostScriptisatrademarkofAdobeSystemsInc.3TEXisatrademarkoftheAmericanMathematicalSociety.1TouseMetaPost,youprepareaninputfilecontainingMetaPostcodeandtheninvokeMetaPost,usuallybygivingacommandoftheformmpost⟨filename⟩Thesyntaxandprogramnameitselfaresystem-dependent;sometimesitisnamedmp.MetaPostinputfilesnormallyhavenamesending“.mp”butthispartofthenamecanbeomittedwheninvokingMetaPost.Foraninputfilefoo.mpmpostfooinvokesMetaPostandproducesoutputfileswithnameslikefoo.1andfoo.2.AnyterminalI/Oissummarizedinatranscriptfilecalledfoo.log.ThisincludeserrormessagesandanyMetaPostcommandsenteredinteractively.4ThetranscriptfilestartswithabannerlinethatidentifiestheversionofMetaPostyouareusing.YoucanalsodeterminethecurrentversionfromwithinaMetaPostprogramviathempversionpredefinedconstantstring(thiswasintroducedinversion0.9).Forinstance:ifknownmpversion:messagemp=&mpversion;ifscantokens(mpversion)1:messageCMYKcolorsupportnotavailable!fifiprintsmp=1.100Thescantokenscommandisdescribedonp.17andcanbeutilizedtoconvertstringstonumbers.TheversionnumberisalsoincludedintheCreatorcommentinthePostScriptoutput.ThisdocumentintroducestheMetaPostlanguage,beginningwiththefeaturesthatareeasiesttouseandmostimportantforsimpleapplications.ReadingthemanualdoesnotrequireknowledgeofMETAFONToraccesstoTheMETAFONTbook,butbotharebeneficial.Thefirstfewsectionsdescribethelanguageasitappearstothenoviceuserwithkeyparametersattheirdefaultvalues.SomefeaturesdescribedinthesesectionsarepartofapredefinedmacropackagecalledPlain.LatersectionssummarizethecompletelanguageanddistinguishbetweenprimitivesandpreloadedmacrosfromthePlainmacropackage.SincemuchofthelanguageisidenticaltoKnuth’sMETAFONT,theappendixgivesadetailedcomparisonsothatadvanceduserscanlearnmoreaboutMetaPostbyreadingTheMETAFONTbook[3].MetaPostdocumentationiscompletedby“DrawingBoxeswithMetaPost”and“DrawingGraphswithMetaPost”—themanualsoftheboxesandgraphpackagesoriginallydevelopedbyJohnD.Hobby.TheMetaPosthomepageis@tug.orgmailinglist;youcansubscribetothislistat://foundry.supelec.fr/projects/metapost/;visitthissiteforthecurrentdevelopmentteammembers,sources,andmuchelse.Pleasereportb
本文标题:A-Users-Manual-for-MetaPost
链接地址:https://www.777doc.com/doc-1906572 .html