The Listings Package Texdoc Online-Books Pdf

The Listings Package TeXdoc Online
25 Aug 2020 | 12 views | 0 downloads | 62 Pages | 726.96 KB

Share Pdf : The Listings Package Texdoc Online

Download and Preview : The Listings Package Texdoc Online

Report CopyRight/DMCA Form For : The Listings Package Texdoc Online



Transcription

Tips and tricks 54, 6 Troubleshooting 54, 7 Bugs and workarounds 55. 7 1 Listings inside arguments 55, 7 2 Listings with a background. colour and LATEX escaped for, 8 How tos 56, Transition of package maintenance The TEX world lost contact with Carsten. Heinz in late 2004 shortly after he released version 1 3b of the listings package. After many attempts to reach him had failed Hendri Adriaens took over main. tenance of the package in accordance with the LPPL s procedure for abandoned. packages He then passed the maintainership of the package to Brooks Moses. who had volunteered for the position while this procedure was going through. The result is known as listings version 1 4, This release version 1 5 is a minor maintenance release since I accepted main. tainership of the package I would like to thank Stephan Hennig who supported. the Lua language definitions He is the one who asked for the integration of a new. language and gave the impetus to me to become the maintainer of this package. News and changes Version 1 5 is the fifth bugfix release There are no changes. in this version but two extensions support of modern Fortran 2003 2008 and. Thanks There are many people I have to thank for fruitful communication. posting their ideas giving error reports adding programming languages to. lstdrvrs dtx and so on Their names are listed in section 3 4. Trademarks Trademarks appear throughout this documentation without any. trademark symbol they are the property of their respective trademark owner. There is no intention of infringement the usage is to the benefit of the trademark. User s guide, 1 Getting started, 1 1 A minimal file.
Before using the listings package you should be familiar with the LATEX typesetting. system You need not to be an expert Here is a minimal file for listings. documentclass article, usepackage listings, begin document. lstset language Pascal, Insert Pascal examples here. end document, Now type in this first example and run it through LATEX. Must I do that really Yes and no Some books about programming say this is good. What a mistake Typing takes time which is wasted if the code is clear to you And if you. need that time to understand what is going on the author of the book should reconsider the. concept of presenting the crucial things you might want to say that about this guide even. or you re simply inexperienced with programming If only the latter case applies you should. spend more time on reading good books about programming good documentations and. good source code from other people Of course you should also make your own experiments. You will learn a lot However running the example through LATEX shows whether the listings. package is installed correctly, The example doesn t work Are the two packages listings and keyval installed on your. system Consult the administration tool of your TEX distribution your system administrator. the local TEX and LATEX guides a TEX FAQ and section 4 8 in that order If you ve checked. all these sources and are still helpless you might want to write a post to a TEX newsgroup. like comp text tex, Should I read the software license before using the package Yes but read this Getting.
started section first to decide whether you are willing to use the package. 1 2 Typesetting listings, Three types of source codes are supported code snippets code segments and. listings of stand alone files Snippets are placed inside paragraphs and the others as. separate paragraphs the difference is the same as between text style and display. style formulas, No matter what kind of source you have if a listing contains national characters like e L a. or whatever you must tell the package about it Section 2 5 Special characters discusses this. Code snippets The well known LATEX command verb typesets code snippets. verbatim The new command lstinline pretty prints the code for example. var i integer is typeset by lstinline var i integer The exclamation. marks delimit the code and can be replaced by any character not in the code. lstinline var i integer gives the same result, Displayed code The lstlisting environment typesets the enclosed source. code Like most examples the following one shows verbatim LATEX code on the. right and the result on the left You might take the right hand side put it into. the minimal file and run it through LATEX, begin lstlisting. f o r i maxint to 0 do for i maxint to 0 do, begin begin.
do n o t h i n g do nothing, Write Case i n s e n s i t i v e Write Case insensitive. WritE P a s c a l keywords WritE Pascal keywords, end lstlisting. It can t be easier, That s not true The name listing is shorter Indeed But other packages already. define environments with that name To be compatible with such packages all commands. and environments of the listings package use the prefix lst. The environment provides an optional argument It tells the package to perform. special tasks for example to print only the lines 2 5. begin lstlisting firstline 2, lastline 5, for i maxint to 0 do. begin begin, do n o t h i n g do nothing, Write Case insensitive.
WritE Pascal keywords, end lstlisting, Hold on Where comes the frame from and what is it good for You can put frames. around all listings except code snippets You will learn how later The frame shows that empty. lines at the end of listings aren t printed This is line 5 in the example. Hey you can t drop my empty lines You can tell the package not to drop them The key. showlines controls these empty lines and is described in section 4 2 Warning First read. ahead on how to use keys in general, I get obscure error messages when using firstline That shouldn t happen Make a. bug report as described in section 6 Troubleshooting. Stand alone files Finally we come to lstinputlisting the command used. to pretty print stand alone files It has one optional and one file name argument. Note that you possibly need to specify the relative path to the file Here now the. result is printed below the verbatim code since both together don t fit the text. lstinputlisting lastline 4 listings sty, This is file listings sty. generated with the docstrip utility, The spacing is different in this example Yes The two previous examples have aligned. columns i e columns with identical numbers have the same horizontal position this package. makes small adjustments only The columns in the example here are not aligned This is. explained in section 2 10 keyword full flexible column format. Now you know all pretty printing commands and environments It remains. to learn the parameters which control the work of the listings package This is. however the main task Here are some of them, 1 3 Figure out the appearance.
Keywords are typeset bold comments in italic shape and spaces in strings appear. as You don t like these settings Look at this, lstset general command to set parameter s. basicstyle small print whole listing small, keywordstyle color black bfseries underbar. underlined bold black keywords, identifierstyle nothing happens. commentstyle color white white comments, stringstyle ttfamily typewriter type for strings. showstringspaces false no special string spaces, begin lstlisting.
f o r i maxint to 0 do for i maxint to 0 do, begin begin. do n o t h i n g do nothing, Write Case insensitive Write Case insensitive. WritE Pascal keywords WritE Pascal keywords, end lstlisting. You ve requested white coloured comments but I can see the comment on the left side. There are a couple of possible reasons 1 You ve printed the documentation on nonwhite. paper 2 If you are viewing this documentation as a dvi file your viewer seems to have. problems with colour specials Try to print the page on white paper 3 If a printout on. white paper shows the comment the colour specials aren t suitable for your printer or printer. driver Recreate the documentation and try it again and ensure that the color package is. well configured, The styles use two different kinds of commands ttfamily and bfseries both. take no arguments but underbar does it underlines the following argument In. general the very last command may read exactly one argument namely some. material the package typesets There s one exception The last command of. basicstyle must not read any tokens or you will get deep in trouble. basicstyle small looks fine but comments look really bad with commentstyle tiny. and empty basic style say Don t use different font sizes in a single listing. But I really want it No you don t, Warning You should be very careful with striking styles the recent example.
is rather moderate it can get horrible Always use decent highlighting Unfor. tunately it is difficult to give more recommendations since they depend on the. type of document you re creating Slides or other presentations often require more. striking styles than books for example In the end it s you who have to find the. golden mean, Listing 1 A floating example, f o r i maxint to 0 do. do n o t h i n g, Write Case i n s e n s i t i v e. WritE P a s c a l keywords, 1 4 Seduce to use, You know all pretty printing commands and some main parameters Here now. comes a small and incomplete overview of other features The table of contents. and the index also provide information, Line numbers are available for all displayed listings e g tiny numbers on the. left each second line with 5pt distance to the listing. lstset numbers left numberstyle tiny stepnumber 2 numbersep 5pt. begin lstlisting, 1 f o r i maxint to 0 do for i maxint to 0 do.
begin begin, 3 do n o t h i n g do nothing, Write Case i n s e n s i t i v e Write Case insensitive. 7 WritE P a s c a l keywords WritE Pascal keywords. end lstlisting, I can t get rid of line numbers in subsequent listings numbers none turns them off. Can I use these keys in the optional arguments Of course Note that optional arguments. modify values for one particular listing only you change the appearance step or distance of. line numbers for a single listing The previous values are restored afterwards. The environment allows you to interrupt your listings you can end a listing and. continue it later with the correct line number even if there are other listings in. between Read section 2 6 for a thorough discussion. Floating listings Displayed listings may float, begin lstlisting float caption A floating example. for i maxint to 0 do, do nothing, Write Case insensitive. WritE Pascal keywords, end lstlisting, Don t care about the parameter caption now And if you put the example into.
the minimal file and run it through LATEX please don t wonder you ll miss the. horizontal rules since they are described elsewhere. LATEX s float mechanism allows one to determine the placement of floats How can I do that. with these You can write float tp for example, Other features There are still features not mentioned so far automatic break. ing of long lines the possibility to use LATEX code in listings automated indexing. or personal language definitions One more little teaser Here you are But note. that the result is not produced by the LATEX code on the right alone The main. parameter is hidden, begin lstlisting, i f i 0 then i 1 if i 0 then i 1. i f i 0 then i 0 if i 0 then i 0, i f i6 0 then i 0 if i 0 then i 0. end lstlisting, You re not sure whether you should use listings Read the next section. 1 5 Alternatives, Why do you list alternatives Well it s always good to know the competitors.
I ve read the descriptions below and the listings package seems to incorporate all the features. Why should I use one of the other programs Firstly the descriptions give a taste and. not a complete overview secondly listings lacks some properties and ultimately you should. use the program matching your needs most precisely. This package is certainly not the final utility for typesetting source code Other. programs do their job very well if you are not satisfied with listings Some are. independent of LATEX others come as separate program plus LATEX package and. others are packages which don t pretty print the source code The second type. includes converters cross compilers and preprocessors Such programs create. LATEX files you can use in your document or stand alone ready to run LATEX files. Note that I m not dealing with any literate programming tools here which. could also be alternatives However you should have heard of the WEB system. the tool Prof Donald E Knuth developed and made use of to document and. implement TEX, a2ps started as ASCII to PostScript converter but today you can invoke the. program with pretty print hlanguagei option If your favourite programming. language is not already supported you can write your own so called style sheet. You can request line numbers borders headers multiple pages per sheet and. many more You can even print symbols like or instead of their verbose forms. If you just want program listings and not a document with some listings this is. the best choice, LGrind is a cross compiler and comes with many predefined programming lan. guages For example you can put the code on the right in your document invoke. LGrind with e option and file names and run the created file through LATEX. You should get a result similar to the left hand side. for i maxint to 0 do, do nothing, LGrind not installed end. User s guide 1 Getting started 1 1 A minimal le Before using the listings package you should be familiar with the LATEX typesetting system You need not to be an expert Here is a minimal le for listings documentclass article usepackage listings egin document lstset language Pascal Insert Pascal examples here end document Now type in this rst example and run

Related Books

Cpt S 122 Data Structures Standard Template Library STL

Cpt S 122 Data Structures Standard Template Library STL

Implementing additional data structures such as deques priority queues sets and maps requires substantial extra work An advantage of the STL is that you can reuse the STL containers iterators and algorithms implement common data structures and manipulations project wide Advantage of STL

Photos R Schedl H Mitterbauer MEDIA LAUNCH 2015

Photos R Schedl H Mitterbauer MEDIA LAUNCH 2015

Photos R Schedl H Mitterbauer KTM SPORTMOTORCYCLE GMBH 5230 Mattighofen Austria www ktm com MEDIA LAUNCH 2015 FROM NEWCOMER TO TRENDSETTER IN JUST TEN YEARS W ith the launch of the KTM 950 ADVENTURE more than a decade ago a new era started for KTM as an international motorcycle manufacturer A formidable machine to this day this cult bike was not only the first KTM with a two cylinder

N Descrizione Caratteristiche Codice Quantit

N Descrizione Caratteristiche Codice Quantit

KTM 1190 ADVENTURE 1190 ADVENTURE R 2013 2014 1050 ADVENTURE 2015 KTM 1290 SUPER ADVENTURE 2015 2 6 ISTRUZIONI DI MONTAGGIO MOUNTING INSTRUCTIONS INSTRUCTIONS DE MONTAGE BAUANLEITUNG INSTRUCCIONES DE MONTAJE INSTRU ES DE MONTAGEM 5mm 10mm 12mm 13mm N Descrizione Caratteristiche Codice Quantit 13 Rondella Washer

Notes and Data Sources

Notes and Data Sources

N 1 Notes and Data Sources Chapter 1 1 visualcapitalist com video ico explosion one animated timeline 2 census gov 3 creditcards com credit card news change favorite

Groupe de travail anim par Franck Montaug Audition de

Groupe de travail anim par Franck Montaug Audition de

de r seau que l on a appel le Forum pour d autres indicateurs de richesse termes de croissance entre 2004 et 2007 pouvaient tre obtenues au d triment de la croissance venir Il est clair galement que ces performances tenaient en partie un mirage des profits reposant sur des prix dont la hausse tait due une bulle sp culative Sans doute serait ce

Addictive Behaviors Reports COnnecting REpositories

Addictive Behaviors Reports COnnecting REpositories

demographics United Nations n d The World Economic Forum World Economic Forum 2012 reported that the proportion of those aged over 60 years has increased from 8 of the world population 200 million people in 1950 to around 11 760 million in 2011 and this is projected to rapidly increase to 22 2 billion by 2050 The second phenomenon pertains to the increase in the number and

Sensibilit sp cificit courbe ROC etc

Sensibilit sp cificit courbe ROC etc

Exercice 1 Valleron 2007 p 20 Un test a une sensibilit de 0 99 une sp cificit de 0 9 La maladie touche un sujet sur 100 Quelles sont les proportions de faux n gatifs et faux positifs dans la population Calculer la VPP et la VPN Exercice 2 calculer l IC 95 de la VPN dans l exemple introductif 8 D pistage des maladies rares Si p est tr s faible la VPP

Im Rahmen des Projektes Benchmarking untersuchte Ans tze

Im Rahmen des Projektes Benchmarking untersuchte Ans tze

Bundesamt f ur Statistik Schweizer Statistiktage 24 26 Oktober 2011 1 D partement f d ral de l int rieur DFI Office f d ral de la statistique OFS Titre de la pr sentation Inhalt Sous titre en caract res non gras Auteur de la pr sentation Date de la pr sentation v contexte 1 Einleitung 2 Additives Modell von Cholette amp Dagum 3 Durch Software Forillon abgedeckte Spezialf

Grain Grading Procedures Agricultural Marketing Service

Grain Grading Procedures Agricultural Marketing Service

Grain Grading Procedures Foreword The effectiveness of the official U S grain inspection system depends largely on an inspector s ability to sample inspect grade and certify the various grains for which standards have been established under the United States Grain Standards Act as amended In view of this fact the Grain Inspection

GROUP DYNAMICS AND TEAM BUILDING World Federation of

GROUP DYNAMICS AND TEAM BUILDING World Federation of

Group Dynamics and Team Building Ann Marie Nazzaro Joyce Strazzabosco Introduction This monograph was developed as a companion to a workshop on group dynamics and team building presented at the WFH Global NMO Training Workshop May 16 18 2002 in Huelva Spain The workshop offered two methods of learning 1 brief talks by the facilitators that

MANUAL FOR ChE 496 New Jersey Institute of Technology

MANUAL FOR ChE 496 New Jersey Institute of Technology

MANUAL FOR ChE 496 CHEMICAL ENGINEERING LABORATORY II Robert B Barat OTTO H YORK DEPARTMENT OF CHEMICAL BIOLOGICAL AND PHARMACEUTICAL ENGINEERING NEW JERSEY INSTITUTE OF TECHNOLOGY NEWARK NEW JERSEY 07102 Spring 2011 Version 2 2 ACKNOWLEDGEMENT The author acknowledges that some material in this manual has been drawn from previous manuals used in the Chemical Engineering Laboratory