texlive[43191] Master: pythonhighlight (9feb17)
commits+karl at tug.org
commits+karl at tug.org
Sat Feb 11 00:32:50 CET 2017
Revision: 43191
http://tug.org/svn/texlive?view=revision&revision=43191
Author: karl
Date: 2017-02-11 00:32:50 +0100 (Sat, 11 Feb 2017)
Log Message:
-----------
pythonhighlight (9feb17)
Modified Paths:
--------------
trunk/Master/tlpkg/bin/tlpkg-ctan-check
trunk/Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc
Added Paths:
-----------
trunk/Master/texmf-dist/doc/latex/pythonhighlight/
trunk/Master/texmf-dist/doc/latex/pythonhighlight/LICENSE.rst
trunk/Master/texmf-dist/doc/latex/pythonhighlight/README.md
trunk/Master/texmf-dist/tex/latex/pythonhighlight/
trunk/Master/texmf-dist/tex/latex/pythonhighlight/pythonhighlight.sty
trunk/Master/tlpkg/tlpsrc/pythonhighlight.tlpsrc
Added: trunk/Master/texmf-dist/doc/latex/pythonhighlight/LICENSE.rst
===================================================================
--- trunk/Master/texmf-dist/doc/latex/pythonhighlight/LICENSE.rst (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/pythonhighlight/LICENSE.rst 2017-02-10 23:32:50 UTC (rev 43191)
@@ -0,0 +1,11 @@
+Copyright (c) 2009--2017, Olivier Verdier
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+ * Neither the name of "pythonhighlighting" nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Added: trunk/Master/texmf-dist/doc/latex/pythonhighlight/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/pythonhighlight/README.md (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/pythonhighlight/README.md 2017-02-10 23:32:50 UTC (rev 43191)
@@ -0,0 +1,33 @@
+Python highlighting in LaTeX
+============================
+
+A simple Python highlighting style to be used with LaTeX.
+
+The package is loaded by the following line:
+
+```tex
+\usepackage{pythonhighlight}
+```
+
+It is then possible to include a Python snippet directly in the code using:
+
+```tex
+\begin{python}
+def f(x):
+ return x
+\end{python}
+```
+
+It is also possible to include inline Python code in LaTeX with ``\pyth``:
+
+```tex
+The special method \pyth{__init__}...
+```
+
+Last but not least, you can load an external Python file with:
+
+```tex
+\inputpython{python_file.py}{23}{50}
+```
+
+to display the contents of the file ``python_file`` from line 23 to line 50.
Added: trunk/Master/texmf-dist/tex/latex/pythonhighlight/pythonhighlight.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/pythonhighlight/pythonhighlight.sty (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/pythonhighlight/pythonhighlight.sty 2017-02-10 23:32:50 UTC (rev 43191)
@@ -0,0 +1,139 @@
+% Copyright 2009--2017 by Olivier Verdier
+% License: see the file LICENSE.rst
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{pythonhighlight}[2017/02/09 python code highlighting; provided by Olivier Verdier <olivier.verdier at gmail.com>]
+
+
+\RequirePackage{listings}
+\RequirePackage{xcolor}
+
+\renewcommand*{\lstlistlistingname}{Code Listings}
+\renewcommand*{\lstlistingname}{Code Listing}
+\definecolor{gray}{gray}{0.5}
+\colorlet{commentcolour}{green!50!black}
+
+\colorlet{stringcolour}{red!60!black}
+\colorlet{keywordcolour}{magenta!90!black}
+\colorlet{exceptioncolour}{yellow!50!red}
+\colorlet{commandcolour}{blue!60!black}
+\colorlet{numpycolour}{blue!60!green}
+\colorlet{literatecolour}{magenta!90!black}
+\colorlet{promptcolour}{green!50!black}
+\colorlet{specmethodcolour}{violet}
+
+\newcommand*{\framemargin}{3ex}
+
+\newcommand*{\literatecolour}{\textcolor{literatecolour}}
+
+\newcommand*{\pythonprompt}{\textcolor{promptcolour}{{>}{>}{>}}}
+
+\lstdefinestyle{mypython}{
+%\lstset{
+%keepspaces=true,
+language=python,
+showtabs=true,
+tab=,
+tabsize=2,
+basicstyle=\ttfamily\footnotesize,%\setstretch{.5},
+stringstyle=\color{stringcolour},
+showstringspaces=false,
+alsoletter={1234567890},
+otherkeywords={\%, \}, \{, \&, \|},
+keywordstyle=\color{keywordcolour}\bfseries,
+emph={and,break,class,continue,def,yield,del,elif ,else,%
+except,exec,finally,for,from,global,if,import,in,%
+lambda,not,or,pass,print,raise,return,try,while,assert,with},
+emphstyle=\color{blue}\bfseries,
+emph={[2]True, False, None},
+emphstyle=[2]\color{keywordcolour},
+emph={[3]object,type,isinstance,copy,deepcopy,zip,enumerate,reversed,list,set,len,dict,tuple,xrange,append,execfile,real,imag,reduce,str,repr},
+emphstyle=[3]\color{commandcolour},
+emph={Exception,NameError,IndexError,SyntaxError,TypeError,ValueError,OverflowError,ZeroDivisionError},
+emphstyle=\color{exceptioncolour}\bfseries,
+%upquote=true,
+morecomment=[s]{"""}{"""},
+commentstyle=\color{commentcolour}\slshape,
+%emph={[4]1, 2, 3, 4, 5, 6, 7, 8, 9, 0},
+emph={[4]ode, fsolve, sqrt, exp, sin, cos,arctan, arctan2, arccos, pi, array, norm, solve, dot, arange, isscalar, max, sum, flatten, shape, reshape, find, any, all, abs, plot, linspace, legend, quad, polyval,polyfit, hstack, concatenate,vstack,column_stack,empty,zeros,ones,rand,vander,grid,pcolor,eig,eigs,eigvals,svd,qr,tan,det,logspace,roll,min,mean,cumsum,cumprod,diff,vectorize,lstsq,cla,eye,xlabel,ylabel,squeeze},
+emphstyle=[4]\color{numpycolour},
+emph={[5]__init__,__add__,__mul__,__div__,__sub__,__call__,__getitem__,__setitem__,__eq__,__ne__,__nonzero__,__rmul__,__radd__,__repr__,__str__,__get__,__truediv__,__pow__,__name__,__future__,__all__},
+emphstyle=[5]\color{specmethodcolour},
+emph={[6]assert,yield},
+emphstyle=[6]\color{keywordcolour}\bfseries,
+emph={[7]range},
+emphstyle={[7]\color{keywordcolour}\bfseries},
+% emph={[7]self},
+% emphstyle=[7]\bfseries,
+literate=*%
+{:}{{\literatecolour:}}{1}%
+{=}{{\literatecolour=}}{1}%
+{-}{{\literatecolour-}}{1}%
+{+}{{\literatecolour+}}{1}%
+{*}{{\literatecolour*}}{1}%
+{**}{{\literatecolour{**}}}2%
+{/}{{\literatecolour/}}{1}%
+{//}{{\literatecolour{//}}}2%
+{!}{{\literatecolour!}}{1}%
+%{(}{{\literatecolour(}}{1}%
+%{)}{{\literatecolour)}}{1}%
+{[}{{\literatecolour[}}{1}%
+{]}{{\literatecolour]}}{1}%
+{<}{{\literatecolour<}}{1}%
+{>}{{\literatecolour>}}{1}%
+{>>>}{\pythonprompt}{3}%
+,%
+%aboveskip=.5ex,
+frame=trbl,
+%frameround=tttt,
+%framesep=.3ex,
+rulecolor=\color{black!40},
+%framexleftmargin=\framemargin,
+%framextopmargin=.1ex,
+%framexbottommargin=.1ex,
+%framexrightmargin=\framemargin,
+%framexleftmargin=1mm, framextopmargin=1mm, frame=shadowbox, rulesepcolor=\color{blue},#1
+%frame=tb,
+backgroundcolor=\color{white},
+breakindent=.5\textwidth,frame=single,breaklines=true%
+%}
+}
+
+\newcommand*{\inputpython}[3]{\lstinputlisting[firstline=#2,lastline=#3,firstnumber=#2,frame=single,breakindent=.5\textwidth,frame=single,breaklines=true,style=mypython]{#1}}
+
+\lstnewenvironment{python}[1][]{\lstset{style=mypython}}{}
+
+\lstdefinestyle{mypythoninline}{
+style=mypython,%
+basicstyle=\ttfamily,%
+keywordstyle=\color{keywordcolour},%
+emphstyle={[7]\color{keywordcolour}},%
+emphstyle=\color{exceptioncolour},%
+literate=*%
+{:}{{\literatecolour:}}{2}%
+{=}{{\literatecolour=}}{2}%
+{-}{{\literatecolour-}}{2}%
+{+}{{\literatecolour+}}{2}%
+{*}{{\literatecolour*}}2%
+{**}{{\literatecolour{**}}}3%
+{/}{{\literatecolour/}}{2}%
+{//}{{\literatecolour{//}}}{2}%
+{!}{{\literatecolour!}}{2}%
+%{(}{{\literatecolour(}}{2}%
+%{)}{{\literatecolour)}}{2}%
+{[}{{\literatecolour[}}{2}%
+{]}{{\literatecolour]}}{2}%
+{<}{{\literatecolour<}}{2}%
+{<=}{{\literatecolour{<=}}}3%
+{>}{{\literatecolour>}}{2}%
+{>=}{{\literatecolour{>=}}}3%
+{==}{{\literatecolour{==}}}3%
+{!=}{{\literatecolour{!=}}}3%
+{+=}{{\literatecolour{+=}}}3%
+{-=}{{\literatecolour{-=}}}3%
+{*=}{{\literatecolour{*=}}}3%
+{/=}{{\literatecolour{/=}}}3%
+%% emphstyle=\color{blue},%
+}
+
+\newcommand*{\pyth}{\lstinline[style=mypythoninline]}
+
Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check 2017-02-10 23:31:31 UTC (rev 43190)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check 2017-02-10 23:32:50 UTC (rev 43191)
@@ -507,8 +507,9 @@
psu-thesis ptex-base ptex-fontmaps ptex-fonts ptex2pdf ptext ptptex
punk punk-latex punknova purifyeps pxbase
pxchfon pxcjkcat pxfonts pxgreeks pxjahyper
- pxpgfmark pxrubrica pxtatescale pxtxalfa pygmentex python pythontex
- qcircuit qcm qobitree qrcode qstest qsymbols qtree
+ pxpgfmark pxrubrica pxtatescale pxtxalfa
+ pygmentex python pythonhighlight pythontex
+ qcircuit qcm qobitree qrcode qstest qsymbols qtree
quattrocento quicktype quotchap quoting quotmark quran
r_und_s raleway ran_toks randbild randomlist randomwalk randtext
rccol rcs rcs-multi rcsinfo
Modified: trunk/Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc 2017-02-10 23:31:31 UTC (rev 43190)
+++ trunk/Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc 2017-02-10 23:32:50 UTC (rev 43191)
@@ -113,6 +113,7 @@
depend prooftrees
depend pseudocode
depend pygmentex
+depend pythonhighlight
depend rec-thy
depend revquantum
depend ribbonproofs
Added: trunk/Master/tlpkg/tlpsrc/pythonhighlight.tlpsrc
===================================================================
More information about the tex-live-commits
mailing list