summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/pythontex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-09-24 20:07:38 +0000
committerKarl Berry <karl@freefriends.org>2019-09-24 20:07:38 +0000
commitc42603e27f2d6af845d82162be47078a816fc715 (patch)
tree0058aa3c7ad67cf40203a1c66282a8d6fa897963 /Master/texmf-dist/tex/latex/pythontex
parent30e223be30ac74b2dd030ec888f906263a3f99c1 (diff)
pythontex (24sep19)
git-svn-id: svn://tug.org/texlive/trunk@52174 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/pythontex')
-rw-r--r--Master/texmf-dist/tex/latex/pythontex/pythontex.sty87
1 files changed, 59 insertions, 28 deletions
diff --git a/Master/texmf-dist/tex/latex/pythontex/pythontex.sty b/Master/texmf-dist/tex/latex/pythontex/pythontex.sty
index 1300db470fc..afcad2243e1 100644
--- a/Master/texmf-dist/tex/latex/pythontex/pythontex.sty
+++ b/Master/texmf-dist/tex/latex/pythontex/pythontex.sty
@@ -8,7 +8,7 @@
%%
%% This is a generated file.
%%
-%% Copyright (C) 2012-2016 by Geoffrey M. Poore <gpoore@gmail.com>
+%% Copyright (C) 2012-2019 by Geoffrey M. Poore <gpoore@gmail.com>
%% --------------------------------------------------------------------------
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
@@ -20,11 +20,10 @@
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{pythontex}
- [2017/07/20 v0.16 execute and typeset Python code and other languages]
-
+ [2019/09/22 v0.17 execute and typeset Python code and other languages]
\newcommand{\pytx@packagename}{PythonTeX}
-\newcommand{\pytx@packageversion}{0.16}
+\newcommand{\pytx@packageversion}{0.17}
\RequirePackage{fvextra}
\RequirePackage{etoolbox}
\RequirePackage{xstring}
@@ -847,7 +846,7 @@
}%
\xdef\pytx@type{CC:#2:#1}%
\edef\pytx@cmd{c}%
- \def\pytx@context{}%
+ \pytx@SetContext
\def\pytx@group{none}%
\let\pytx@InlineShow\@empty
\let\pytx@InlineSave\pytx@InlineSaveCode
@@ -1038,6 +1037,22 @@
}%
{\end{VerbatimOut}%
\xdef\pytx@stdfile{\pytx@type_\pytx@session_\pytx@group_\arabic{\pytx@counter}}%
+ \ifcsname pytx@nonpyconsole@\pytx@type\endcsname
+ \ifcsname pytx@code@as@console\endcsname
+ \setcounter{FancyVerbLine}{\value{\pytx@linecount}}%
+ \pytx@FVSet
+ \ifdefstring{\pytx@fvopttmp}{}{}{\expandafter\fvset\expandafter{\pytx@fvopttmp}}%
+ \pytx@ConfigPygments
+ \InputIfFileExists{\pytx@outputdir/\pytx@stdfile.stdout}%
+ {\DepyFile{p:\pytx@outputdir/\pytx@stdfile.stdout}}%
+ {\par\textbf{??~\pytx@packagename~??}\par
+ \PackageWarning{\pytx@packagename}{Non-existent console content}}%
+ \setcounter{\pytx@linecount}{\value{FancyVerbLine}}%
+ \else
+ \fi
+ \let\pytx@EnvAutoprint\relax
+ \else
+ \fi
\setcounter{FancyVerbLine}{\value{pytx@FancyVerbLineTemp}}%
\stepcounter{\pytx@counter}%
\pytx@EnvAutoprint
@@ -1047,12 +1062,16 @@
\ifstrempty{#1}{\edef\pytx@session{default}}{\StrSubstitute{#1}{:}{-}[\pytx@session]}%
\xdef\pytx@counter{pytx@\pytx@type @\pytx@session @\pytx@group}%
\pytx@CheckCounter{\pytx@counter}%
+ \edef\pytx@linecount{\pytx@counter @line}%
+ \pytx@CheckCounter{\pytx@linecount}%
\pytx@WriteCodefileInfo
\begingroup
\obeylines
\@ifnextchar[{\endgroup\pytx@BeginCodeEnv@i}{\endgroup\pytx@BeginCodeEnv@i[]}%
}%
\def\pytx@BeginCodeEnv@i[#1]{%
+ \def\pytx@fvopttmp{#1}%
+ \def\pytx@argspprint{#1}%
\setcounter{pytx@FancyVerbLineTemp}{\value{FancyVerbLine}}%
\let\FVB@VerbatimOut\pytx@FVB@VerbatimOut
\let\FVE@VerbatimOut\pytx@FVE@VerbatimOut
@@ -1069,7 +1088,7 @@
}%
\xdef\pytx@type{CC:#2:#1}%
\edef\pytx@cmd{code}%
- \def\pytx@context{}%
+ \pytx@SetContext
\def\pytx@group{none}%
\pytx@BeginCodeEnv[none]}%
{\end{VerbatimOut}%
@@ -1079,7 +1098,7 @@
\newcommand{\pytx@MakeSubFV}[1]{%
\expandafter\newenvironment{#1sub}{%
\VerbatimEnvironment
- \Depythontex{env:#1sub:om|:p}%
+ \Depythontex{env:#1sub:oo|:p}%
\xdef\pytx@type{#1}%
\edef\pytx@cmd{sub}%
\pytx@SetContext
@@ -1266,6 +1285,27 @@
\newcounter{pytx@#2@default@default}%
}
\@onlypreamble\makepythontexfamily
+\newcommand{\makepythontexfamily@con}[2][text]{%
+ \pgfkeys{/PYTX/family, name=#2con, default, pyglexer=#1, console=true}%
+ \expandafter\xdef\csname pytx@macroformatter@#2con\endcsname{\pytx@tmp@pprinter}%
+ \expandafter\gdef\csname pytx@fvsettings@#2con\endcsname{}%
+ \expandafter\xdef\csname pytx@pyglexer@#2con\endcsname{\pytx@tmp@pyglexer}%
+ \expandafter\xdef\csname pytx@pygopt@#2con\endcsname{\pytx@tmp@pygopt}%
+ \expandafter\xdef\csname pytx@console@#2con\endcsname{\pytx@tmp@console}%
+ \AtEndDocument{\immediate\write\pytx@codefile{pygfamily=#2con|%
+ \csname pytx@pyglexer@#2con\endcsname|%
+ \csname pytx@pygopt@#2con\endcsname}%
+ }%
+ \pytx@MakeCodeFV{#2con}%
+ \expandafter\global\expandafter\let\csname pytx@nonpyconsole@#2con\endcsname\relax
+ \newenvironment{#2console}%
+ {\VerbatimEnvironment
+ \def\pytx@type{#2con}%
+ \let\pytx@code@as@console\relax
+ \begin{#2concode}}%
+ {\end{#2concode}}%
+}
+
\newcommand{\setpythontexpyglexer}[2][]{%
\Depythontex{cmd:setpythontexpyglexer:om:n}%
\ifstrempty{#1}{\def\pytx@pyglexer{#2}}{%
@@ -1308,34 +1348,17 @@
}%
}
\@onlypreamble\setpythontexprettyprinter
-\makepythontexfamily[pyglexer=python]{py}
+\makepythontexfamily[pyglexer=python3]{py}
\makepythontexfamily[pyglexer=pycon, console=true]{pycon}
-\makepythontexfamily[pyglexer=python]{sympy}
+\makepythontexfamily[pyglexer=python3]{sympy}
\makepythontexfamily[pyglexer=pycon, console=true]{sympycon}
-\makepythontexfamily[pyglexer=python]{pylab}
+\makepythontexfamily[pyglexer=python3]{pylab}
\makepythontexfamily[pyglexer=pycon, console=true]{pylabcon}
\renewcommand{\do}[1]{%
\ifstrequal{#1}{ruby}{\makepythontexfamily[pyglexer=ruby]{ruby}}{}%
\ifstrequal{#1}{rb}{\makepythontexfamily[pyglexer=ruby]{rb}}{}%
\ifstrequal{#1}{julia}{\makepythontexfamily[pyglexer=julia]{julia}}{}%
- \ifstrequal{#1}{juliacon}{\pgfkeys{/PYTX/family, name=juliacon, default, pyglexer=jlcon}%
- \expandafter\xdef\csname pytx@macroformatter@juliacon\endcsname{\pytx@tmp@pprinter}%
- \expandafter\gdef\csname pytx@fvsettings@juliacon\endcsname{}%
- \expandafter\xdef\csname pytx@pyglexer@juliacon\endcsname{\pytx@tmp@pyglexer}%
- \expandafter\xdef\csname pytx@pygopt@juliacon\endcsname{\pytx@tmp@pygopt}%
- \expandafter\xdef\csname pytx@console@juliacon\endcsname{\pytx@tmp@console}%
- \AtEndDocument{\immediate\write\pytx@codefile{pygfamily=juliacon|%
- \csname pytx@pyglexer@juliacon\endcsname|%
- \csname pytx@pygopt@juliacon\endcsname}%
- }%
- \pytx@MakeCodeFV{juliacon}%
- \newenvironment{juliaconsole}%
- {\VerbatimEnvironment
- \def\pytx@type{juliacon}%
- \pytx@ConfigPygments
- \begin{juliaconcode}}%
- {\end{juliaconcode}%
- \ifbool{pytx@opt@autoprint}{}{\printpythontex{}}}}{}%
+ \ifstrequal{#1}{juliacon}{\makepythontexfamily@con[jlcon]{julia}}{}%
\ifstrequal{#1}{jl}{\makepythontexfamily[pyglexer=julia]{jl}}{}%
\ifstrequal{#1}{matlab}{\makepythontexfamily[pyglexer=matlab]{matlab}}{}%
\ifstrequal{#1}{octave}{\makepythontexfamily[pyglexer=octave]{octave}}{}%
@@ -1343,6 +1366,14 @@
\ifstrequal{#1}{sage}{\makepythontexfamily[pyglexer=sage]{sage}}{}%
\ifstrequal{#1}{rust}{\makepythontexfamily[pyglexer=rust]{rust}}{}%
\ifstrequal{#1}{rs}{\makepythontexfamily[pyglexer=rust]{rs}}{}%
+ \ifstrequal{#1}{R}{\makepythontexfamily[pyglexer=r]{R}}{}%
+ \ifstrequal{#1}{Rcon}{\makepythontexfamily@con[rconsole]{R}}{}%
+ \ifstrequal{#1}{perl}{\makepythontexfamily[pyglexer=perl]{perl}}{}%
+ \ifstrequal{#1}{pl}{\makepythontexfamily[pyglexer=perl]{pl}}{}%
+ \ifstrequal{#1}{perlsix}{\makepythontexfamily[pyglexer=perl6]{perlsix}}{}%
+ \ifstrequal{#1}{psix}{\makepythontexfamily[pyglexer=perl6]{psix}}{}%
+ \ifstrequal{#1}{javascript}{\makepythontexfamily[pyglexer=js]{javascript}}{}%
+ \ifstrequal{#1}{js}{\makepythontexfamily[pyglexer=js]{js}}{}%
}
\expandafter\docsvlist\expandafter{\pytx@families}
\newbool{pytx@listingenv}