minted
package, which performs syntax-highlighting using Python's pygmentize
library.verbatim
, which generates an output in monospaced font.verb
command.verb|C:Windowssystem32|
prints the text inside the delimiters |
in verbatim format. Any character, except letters and *, can be used as delimiter. For instance verb+ldots+
uses +
as delimiter.lstlisting
environment from the listings
package:[language=Python]
enables code highlighting for this particular programming language (Python), special words are in boldface font and comments are italicized. See the reference guide for a complete list of supported programming languages.lstinputlisting[language=Octave]{BitXorMatrix.m}
imports the code from the file BitXorMatrix.m, the additional parameter in between brackets enables language highlighting for the Octave programming language. If you need to import only part of the file you can specify two comma-separated parameters inside the brackets. For instance, to import the code from the line 2 to the line 12, the previous command becomesfirstline
or lastline
Ps software for mac. is omitted, it's assumed that the values are the beginning of the file, or the bottom of the file, respectively.definecolor{}{}{}
is used to define new colours in rgb format that will later be used. For more information see: using colours in LaTeXlstdefinestyle{mystyle}{.}
lstset{style=mystyle}
caption=Python example
inside the brackets, enables the caption. This caption can be later used in the list of Listings.ABAP (R/2 4.3, R/2 5.0, R/3 3.1, R/3 4.6C, R/3 6.10) | ACSL |
Ada (2005, 83, 95) | Algol (60, 68) |
Ant | Assembler (Motorola68k, x86masm) |
Awk (gnu, POSIX) | bash |
Basic (Visual) | C (ANSI, Handel, Objective, Sharp) |
C++ (ANSI, GNU, ISO, Visual) | Caml (light, Objective) |
CIL | Clean |
Cobol (1974, 1985, ibm) | Comal 80 |
command.com (WinXP) | Comsol |
csh | Delphi |
Eiffel | Elan |
erlang | Euphoria |
Fortran (77, 90, 95) | GCL |
Gnuplot | Haskell |
HTML | IDL (empty, CORBA) |
inform | Java (empty, AspectJ) |
JVMIS | ksh |
Lingo | Lisp (empty, Auto) |
Logo | make (empty, gnu) |
Mathematica (1.0, 3.0, 5.2) | Matlab |
Mercury | MetaPost |
Miranda | Mizar |
ML | Modula-2 |
MuPAD | NASTRAN |
Oberon-2 | OCL (decorative, OMG) |
Octave | Oz |
Pascal (Borland6, Standard, XSC) | Perl |
PHP | PL/I |
Plasm | PostScript |
POV | Prolog |
Promela | PSTricks |
Python | R |
Reduce | Rexx |
RSL | Ruby |
S (empty, PLUS) | SAS |
Scilab | sh |
SHELXL | Simula (67, CII, DEC, IBM) |
SPARQL | SQL |
tcl (empty, tk) | TeX (AlLaTeX, common, LaTeX, plain, primitive) |
VBScript | Verilog |
VHDL (empty, AMS) | VRML (97) |
XML | XSLT |
basicstyle=ttfamilysmall
)keywordstyle=color{red}
)prebreak=raisebox{0ex}[0ex][0ex]{ensuremath{hookleftarrow}}
)escapeinside={%*}{*)}
)