summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/listings
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-08-30 19:33:47 +0000
committerKarl Berry <karl@freefriends.org>2013-08-30 19:33:47 +0000
commit01312ede8e1f6790ec0410527c08006e9d176fcf (patch)
tree8e6a63e2450301b8c3cf14a76bc79c15ad0a7c50 /Master/texmf-dist/source/latex/listings
parentfb7e1604fc90300b3b2fb00d79dbfe98cb929227 (diff)
listings (29aug13)
git-svn-id: svn://tug.org/texlive/trunk@31543 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/listings')
-rw-r--r--Master/texmf-dist/source/latex/listings/listings.dtx35
-rw-r--r--Master/texmf-dist/source/latex/listings/lstdrvrs.dtx127
-rw-r--r--Master/texmf-dist/source/latex/listings/lstdrvrs.ins7
3 files changed, 158 insertions, 11 deletions
diff --git a/Master/texmf-dist/source/latex/listings/listings.dtx b/Master/texmf-dist/source/latex/listings/listings.dtx
index 4efad5f3c49..b99c0b7aa3b 100644
--- a/Master/texmf-dist/source/latex/listings/listings.dtx
+++ b/Master/texmf-dist/source/latex/listings/listings.dtx
@@ -30,7 +30,7 @@
%
% The package has the LPPL maintenance status "maintained".
%
-% $Id: listings.dtx 62 2013-08-03 09:32:27Z j_hoffmann $
+% $Id: listings.dtx 84 2013-08-26 19:50:43Z j_hoffmann $
%
% The Current Maintainer is Jobst Hoffmann <j.hoffmann-(at)-fh-aachen.de>.
%
@@ -115,7 +115,7 @@
% Hoffmann became the maintainer of the \packagename{listings}
% package in 2013; see the Preface for details.}~ %
% \textless\lstemail\textgreater}
-% \date{2013/08/05\enspace\enspace Version 1.5a\ \box\abstractbox}
+% \date{2013/08/26\enspace\enspace Version 1.5b\ \box\abstractbox}
% \def\lstemail{\href{mailto:j.hoffmann@fh-aachen.de}{\texttt{j.hoffmann-(at)-fh-aachen.de}}}
% \ifhyper
% \hypersetup{pdfsubject=Package guide,pdfauthor=Jobst Hoffmann <j.hoffmann-(at)-fh-aachen.de>}
@@ -896,6 +896,33 @@
% context.
%
%
+% \subsubsection{Preferences}\label{uPreferences}
+%
+% Sometimes authors of language support provide their own configuration
+% preferences. These may come either from their personal experience or
+% from the settings in an IDE and can be defined as a \packagename{listing}
+% style. From version 1.5b of the \packagename{listings} package on these
+% styles are provided as files with the name
+% |listings-|\meta{language}|.prf|, \meta{language} is the name of the
+% supported programming language in lowercase letters.
+%
+% So if an user of the \packagename{listings} package wants to use these
+% preferences, she/he can say for example when using Python
+% \begin{quote}
+% |\input{listings-python.prf}|
+% \end{quote}
+% at the end of her/his |listings.cfg| configuration file as long as the
+% file |listings-python.prf| resides in the \TeX{} search path. Of course
+% that file can be changed according to the user's preferences.
+%
+% At the moment there are two such preferences files:
+% \begin{enumerate}
+% \item |listings-lua.prf|
+% \item |listings-python.prf|
+% \end{enumerate}
+% All contributors are invited to supply more personal preferences.
+%
+%
% \subsection{Special characters}\label{uSpecialCharacters}
%
%
@@ -5645,8 +5672,8 @@
% \paragraph{Identification}
% All files will have same date and version.
% \begin{macrocode}
-\def\filedate{2013/08/05}
-\def\fileversion{1.5a}
+\def\filedate{2013/08/26}
+\def\fileversion{1.5b}
% \end{macrocode}
% What we need and who we are.
% \begin{macrocode}
diff --git a/Master/texmf-dist/source/latex/listings/lstdrvrs.dtx b/Master/texmf-dist/source/latex/listings/lstdrvrs.dtx
index 77784847eb9..1c790c52ea8 100644
--- a/Master/texmf-dist/source/latex/listings/lstdrvrs.dtx
+++ b/Master/texmf-dist/source/latex/listings/lstdrvrs.dtx
@@ -1,6 +1,6 @@
% \iffalse
%
-% $Id: lstdrvrs.dtx 64 2013-08-03 10:00:54Z j_hoffmann $
+% $Id: lstdrvrs.dtx 85 2013-08-26 19:53:54Z j_hoffmann $
%
%<*driver>
\documentclass{ltxdoc}
@@ -32,7 +32,7 @@
%
% \title{Language, Style and Format drivers\\ for \textsf{Listings}\\ {\large by Carsten Heinz and individual authors:}}
% \author{\InputIfFileExists{lstdrvrs.tmp}{}{}}
-% \date{2013/08/05\enspace\enspace Version 1.5a\ \box\abstractbox}
+% \date{2013/08/26\enspace\enspace Version 1.5b\ \box\abstractbox}
%
% \hypersetup{pdfsubject=Language definitions,pdfauthor=Jobst Hoffmann
% <j.hoffmann-(at)-fh-aachen.de>}
@@ -99,6 +99,11 @@
\file{lstlang3.sty}{\from{lstdrvrs.dtx}{lang3}}
}
+\generate{
+ \file{listings-lua.prf}{\from{lstdrvrs.dtx}{lua-prf}}
+ \file{listings-python.prf}{\from{lstdrvrs.dtx}{python-prf}}
+}
+
\ifToplevel{
\Msg{*}
@@ -121,7 +126,7 @@
% \endgroup
% We mainly define default dialects.
% \begin{macrocode}
-\ProvidesFile{listings.cfg}[2013/08/05 1.5a listings configuration]
+\ProvidesFile{listings.cfg}[2013/08/26 1.5b listings configuration]
\def\lstlanguagefiles
{lstlang0.sty,lstlang1.sty,lstlang2.sty,lstlang3.sty}
\lstset{defaultdialect=[R/3 6.10]ABAP,
@@ -162,7 +167,9 @@
%<+lang1>\ProvidesFile{lstlang1.sty}
%<+lang2>\ProvidesFile{lstlang2.sty}
%<+lang3>\ProvidesFile{lstlang3.sty}
-%<-config> [2013/08/05 1.5a listings language file]
+%<+lua-prf>\ProvidesFile{listings-lua.prf}
+%<+python-prf>\ProvidesFile{listings-python.prf}
+%<-config> [2013/08/26 1.5b listings language file]
% \end{macrocode}
%
%
@@ -2959,6 +2966,31 @@ SUBX,SWAP,TAS,TRAP,TRAPV,TST,UNLK},%
% \end{macrocode}
% \endgroup
%
+% \begingroup
+% Stephan Hennig also supplied a definition of a style for printing Lua code:
+% \begin{macrocode}
+%<*lua-prf>
+% \end{macrocode}
+% \begin{macrocode}
+\usepackage[rgb, x11names]{xcolor}
+\lstdefinestyle{Lua}{%
+ language=[5.2]Lua,
+ basicstyle=\ttfamily,
+ columns=spaceflexible,
+ keywordstyle=\bfseries\color{Blue4},% language keywords
+ keywordstyle=[2]\bfseries\color{RoyalBlue3},% std. library identifiers
+ keywordstyle=[3]\bfseries\color{Purple3},% labels
+ stringstyle=\bfseries\color{Coral4},% strings
+ commentstyle=\itshape\color{Green4},% comments
+}
+% \end{macrocode}
+% This code is provided in the file |listings-lua.prf|, see section
+% 2.4.1 (Preferences) of the \packagename{listings} documentation.
+% \begin{macrocode}
+%</lua-prf>
+% \end{macrocode}
+% \endgroup
+%
%
% \subsection{Make}
%
@@ -5384,6 +5416,10 @@ SUBX,SWAP,TAS,TRAP,TRAPV,TST,UNLK},%
% \lstthanks{Stephen Kelly}{-}{2007/01/14} reported some problems that indicated
% that the comment definitions needed to be moved after the string definitions
% to work correctly.
+%
+% In August 2013
+% \lstthanks{Alexis~Dimitriadis}{A.Dimitriadis@uu.nl}{2013/08/15} reworked
+% the definition by supplying the builtins.
% \begingroup
% \begin{macrocode}
%<*lang1>
@@ -5391,17 +5427,48 @@ SUBX,SWAP,TAS,TRAP,TRAPV,TST,UNLK},%
% \begin{macrocode}
%%
%% Python definition (c) 1998 Michael Weber
+%% Additional definitions (2013) Alexis Dimitriadis
%%
\lst@definelanguage{Python}%
{morekeywords={access,and,break,class,continue,def,del,elif,else,%
except,exec,finally,for,from,global,if,import,in,is,lambda,not,%
or,pass,print,raise,return,try,while},%
+% \end{macrocode}
+% Python has a long list of builtin-in functions
+% (\url{http://docs.python.org/2/library/functions.html}) and it is a good
+% idea to make them visible in printed code
+% \begin{macrocode}
+ % Built-ins
+ morekeywords=[2]{abs,all,any,basestring,bin,bool,bytearray,callable,chr,
+ classmethod,cmp,compile,complex,delattr,dict,dir,divmod,enumerate,eval,
+ execfile,file,filter,float,format,frozenset,getattr,globals,hasattr,hash,
+ help,hex,id,input,int,isinstance,issubclass,iter,len,list,locals,long,map,
+ max,memoryview,min,next,object,oct,open,ord,pow,property,range,raw_input,
+ reduce,reload,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,
+ sum,super,tuple,type,unichr,unicode,vars,xrange,zip,apply,buffer,coerce,
+ intern},
sensitive=true,%
morecomment=[l]\#,%
morestring=[b]',%
morestring=[b]",%
- morecomment=[s]{'''}{'''},% used for documentation text
- morecomment=[s]{"""}{"""}% added by Philipp Matthias Hahn
+% \end{macrocode}
+% According to PEP (Python Enhancement Proposals) comment should be
+% distinguished from documentation strings, so we define
+% \begin{macrocode}
+ morestring=[s]{'''}{'''},% used for documentation text (mulitiline strings)
+ morestring=[s]{"""}{"""},% added by Philipp Matthias Hahn
+% \end{macrocode}
+% Python now supports so called \emph{raw strings} and also Unicode
+% strings. Here is the definition of these strings:
+% \begin{macrocode}
+ morestring=[s]{r'}{'},% `raw' strings
+ morestring=[s]{r"}{"},%
+ morestring=[s]{r'''}{'''},%
+ morestring=[s]{r"""}{"""},%
+ morestring=[s]{u'}{'},% unicode strings
+ morestring=[s]{u"}{"},%
+ morestring=[s]{u'''}{'''},%
+ morestring=[s]{u"""}{"""}%
}%
% \end{macrocode}
% \lsthelper{Philipp Matthias Hahn}{pmhahn@titan.lahn.de}{2002/04/18}{}
@@ -5417,6 +5484,54 @@ SUBX,SWAP,TAS,TRAP,TRAPV,TST,UNLK},%
% \endgroup
%
%
+% \begingroup
+% Alexis Dimitriadis also proposes the following configuration for printing
+% Python code which simulates colorizing the code as it's done by the IDLE
+% GUI:
+% \begin{macrocode}
+%<*python-prf>
+% \end{macrocode}
+% \begin{macrocode}
+\usepackage{xcolor}
+\usepackage{textcomp}
+
+%% Actual colors from idlelib/config-highlight.def --> corrected to ``web-safe''
+%% strings = #00aa00 / 0,170,0 (a darker green)
+%% builtins = #900090 / 144,0,144 (purple-ish)
+%% keywords = #FF7700 / 255,119,0 (quite close to plain `orange')
+%\definecolor{IDLEorange}{RGB}{255,119,0} % pretty close to real orange
+%\definecolor{IDLEpurple}{RGB}{144,0,144}
+%\definecolor{IDLEgreen}{RGB}{0,170,0}
+%\definecolor{IDLEred}{RGB}{221,0,0}
+%% Corrected to ``web-safe''
+%\definecolor{orange2}{RGB}{255,102,0}
+\definecolor{purple2}{RGB}{153,0,153} % there's actually no standard purple
+\definecolor{green2}{RGB}{0,153,0} % a darker green
+%\definecolor{red2}{RGB}{221,0,0}
+
+% Except for green and purple, the other colors are pretty good in standard
+% hue
+\lstdefinestyle{python-idle-code}{%
+ language=Python, % the language
+ basicstyle=\normalsize\ttfamily, % size of the fonts for the code
+ % Color settings to match IDLE style
+ keywordstyle=\color{orange}, % core keywords
+ keywordstyle={[2]\color{purple2}}, % built-ins
+ stringstyle=\color{green2},
+ commentstyle=\color{red},
+ upquote=true, % requires textcomp
+}
+% Unimplemented IDLE syntax: function/class names being defined should be
+% blue
+% \end{macrocode}
+% This code is provided in the file |listings-python.prf|, see section
+% 2.4.1 (Preferences) of the \packagename{listings} documentation.
+% \begin{macrocode}
+%</python-prf>
+% \end{macrocode}
+% \endgroup
+%
+%
% \subsection{Rexx}
%
% \lstthanks{Patrick~TJ~McPhee}{ptjm@interlog.com}{2003/10/24} provided this
diff --git a/Master/texmf-dist/source/latex/listings/lstdrvrs.ins b/Master/texmf-dist/source/latex/listings/lstdrvrs.ins
index 77c185a953a..993ab30b8bd 100644
--- a/Master/texmf-dist/source/latex/listings/lstdrvrs.ins
+++ b/Master/texmf-dist/source/latex/listings/lstdrvrs.ins
@@ -37,6 +37,11 @@
\file{lstlang3.sty}{\from{lstdrvrs.dtx}{lang3}}
}
+\generate{
+ \file{listings-lua.prf}{\from{lstdrvrs.dtx}{lua-prf}}
+ \file{listings-python.prf}{\from{lstdrvrs.dtx}{python-prf}}
+}
+
\ifToplevel{
\Msg{*}
\Msg{* You probably need to move all created `.sty' and `.cfg'}
@@ -47,7 +52,7 @@
}
\endbatchfile
- [2013/08/05 1.5a listings language file]
+ [2013/08/26 1.5b listings language file]
\endinput
%%
%% End of file `lstdrvrs.ins'.