diff options
author | Karl Berry <karl@freefriends.org> | 2016-07-21 21:18:20 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-07-21 21:18:20 +0000 |
commit | 24289a6c830263430a9ff06f2dd20d6ec3482079 (patch) | |
tree | de97f9224a4eae78a947c52df01eb7d1b63c37b0 /Master/texmf-dist/doc/latex/pythontex | |
parent | 75ba721d706ce924641fd8f7715a83809b757812 (diff) |
pythontex (21jul16)
git-svn-id: svn://tug.org/texlive/trunk@41746 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/pythontex')
-rw-r--r-- | Master/texmf-dist/doc/latex/pythontex/NEWS | 349 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/pythontex/README | 24 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/pythontex/pythontex.pdf | bin | 917227 -> 951758 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/pythontex/pythontex_gallery.pdf | bin | 382442 -> 373106 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/pythontex/pythontex_gallery.tex | 6 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/pythontex/pythontex_quickstart.pdf | bin | 179367 -> 181612 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/pythontex/pythontex_quickstart.tex | 22 |
7 files changed, 228 insertions, 173 deletions
diff --git a/Master/texmf-dist/doc/latex/pythontex/NEWS b/Master/texmf-dist/doc/latex/pythontex/NEWS index c83bd81a256..58fa279d663 100644 --- a/Master/texmf-dist/doc/latex/pythontex/NEWS +++ b/Master/texmf-dist/doc/latex/pythontex/NEWS @@ -7,33 +7,79 @@ Version History =============== +v0.15 (2016/07/21) +------------------ + +New features +~~~~~~~~~~~~ + +* The ``fvextra`` package is now required. This provides line breaking with + fine-grained control over break locations, the ability to highlight + specific lines or ranges of lines, improved handling of tabs, and several + additional features. + +* Added ``sub`` commands and environments (``\pys``, ``pysub``, ...). These + commands and environments perform string interpolation on text. Fields + delimited by ``!{...}`` are replaced by the result of evaluating and then + printing their content. This works for all families of commands and + environments, not just Python. See the documentation for details about + field delimiters and escaping. + +* Added ``rust`` and ``rs`` families of commands and environments. These + provide essentially complete support for Rust, except that + ``rstex.formatter()``, ``rstex.before()``, and ``rstex.after()`` will + likely need additional refinement (#90). + +* Added the ``sage`` family of commands and environments, which provide + support for Sage (#63). + +* Added ``bash`` family of commands and environments. This provides basic + support for bash (no utilities class or equivalent). Bash works with + Windows if it is installed. + +* Improved ``console`` compatibility under Linux with Python 3 (#70). + +* Counters for default sessions are now created automatically. This prevents + counter errors under some circumstances when working with ``\includeonly``. + +* Commands like ``\py`` can now output verbatim content under LuaTeX. + +Bugfixes +~~~~~~~~ + +* Fixed a bug that could cause an endless loop when a ``code`` command or + environment printed a ``code`` command or environment of the same family + with ``autoprint=true``. + + + v0.14 (2014/07/17) ------------------ New features ~~~~~~~~~~~~ -* All commands for working with code inline are now robust, via - ``etoolbox``'s ``\newrobustcmd``. Among other things, this allows - commands like ``\py`` to work in standard captions that have not been +* All commands for working with code inline are now robust, via + ``etoolbox``'s ``\newrobustcmd``. Among other things, this allows + commands like ``\py`` to work in standard captions that have not been redefined to avoid protection issues. * Upgraded ``syncpdb`` to v0.2, which provides better list formatting. Backward-incompatible changes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -* The default working directory is now the main document directory instead - of the output directory. Using the output directory was a common source - of confusion for new users and was incompatible with plans for future - development. Old documents in which the working directory was not - specified will continue to use the output directory, but PythonTeX will - print an upgrade message; new documents will use the new setting. The - output directory may be selected as the working directory manually, or - with the shorthand +* The default working directory is now the main document directory instead + of the output directory. Using the output directory was a common source + of confusion for new users and was incompatible with plans for future + development. Old documents in which the working directory was not + specified will continue to use the output directory, but PythonTeX will + print an upgrade message; new documents will use the new setting. The + output directory may be selected as the working directory manually, or + with the shorthand "``\setpythontexworkingdir{<outputdir>}``". -* Standardized version numbering by removing the "v" prefix from the stored - version numbers in Python variables and LaTeX macros. Standardized the +* Standardized version numbering by removing the "v" prefix from the stored + version numbers in Python variables and LaTeX macros. Standardized the PythonTeX scripts by renaming ``version`` to ``__version__``. @@ -83,12 +129,12 @@ New features * Added Python version checking to all numbered scripts. -* Under Python, the type of data passed via ``\setpythontexcontext`` may - now be set using YAML-style tags (``!!str``, ``!!int``, ``!!float``). For +* Under Python, the type of data passed via ``\setpythontexcontext`` may + now be set using YAML-style tags (``!!str``, ``!!int``, ``!!float``). For example, ``{myint=!!int 123}``. * The ``fancyvrb`` options ``firstline`` and ``lastline`` now work with - the ``pygments`` environment and ``\inputpygments`` command. This required + the ``pygments`` environment and ``\inputpygments`` command. This required some additional patching of ``fancyvrb``. * The ``pytx@Verbatim`` and ``pytx@SaveVerbatim`` environments are now @@ -100,7 +146,7 @@ New features ``latexmk`` usage to documentation. * Tildes ``~`` may now be used in ``outputdir`` and ``workingdir`` to - refer to the user’s home directory, even under Windows. + refer to the user�s home directory, even under Windows. Bugfixes ~~~~~~~~ @@ -122,78 +168,78 @@ New features * Switching to GitHub's Releases for downloads. -* TeX information such as page dimensions may now be easily passed to the - programming-language side, using the new ``\setpythontexcontext`` command. - Contextual information is stored in the ``context`` attribute of the +* TeX information such as page dimensions may now be easily passed to the + programming-language side, using the new ``\setpythontexcontext`` command. + Contextual information is stored in the ``context`` attribute of the utilities class, which is a dictionary (and also has attributes in Python). -* The utilities class now has ``pt_to_in()``, ``pt_to_cm()``, and - ``pt_to_mm()`` methods for converting units of TeX points into inches, - centimeters, and millimeters. These work with integers and floats, as - well as strings that consist of numbers and optionally end in "pt". There - is also a ``pt_to_bp()`` for converting TeX points (1/72.27 inch) into big +* The utilities class now has ``pt_to_in()``, ``pt_to_cm()``, and + ``pt_to_mm()`` methods for converting units of TeX points into inches, + centimeters, and millimeters. These work with integers and floats, as + well as strings that consist of numbers and optionally end in "pt". There + is also a ``pt_to_bp()`` for converting TeX points (1/72.27 inch) into big (DTP or PostScript) points (1/72 inch). - -* Expanded Quickstart. Quickstart is now compatible with all LaTeX engines. + +* Expanded Quickstart. Quickstart is now compatible with all LaTeX engines. Quickstart now avoids ``microtype`` issues on some systems (#32). - + * Added information on citing PythonTeX (#28). -* Utilities class has a new attribute ``id``, which is a string that joins - the command family name, session name, and session restart parameters with - underscores. This may be used in creating files that need a name that - contains a unique, session-based identifier (for example, names for +* Utilities class has a new attribute ``id``, which is a string that joins + the command family name, session name, and session restart parameters with + underscores. This may be used in creating files that need a name that + contains a unique, session-based identifier (for example, names for figures that are saved automatically). Backward-incompatible changes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -* All utilities-class attributes with names of the form ``input_*`` have - been renamed with the "``input_``" removed. Among other things, this - makes it easier to access the ``context`` attribute (``pytex.context`` +* All utilities-class attributes with names of the form ``input_*`` have + been renamed with the "``input_``" removed. Among other things, this + makes it easier to access the ``context`` attribute (``pytex.context`` vs. ``pytex.input_context``). - -* ``depythontex`` now has ``-o`` and ``--output`` command-line options for - specifying the name of the output file. If an output file is not - specified, then output is written to ``stdout``. This allows + +* ``depythontex`` now has ``-o`` and ``--output`` command-line options for + specifying the name of the output file. If an output file is not + specified, then output is written to ``stdout``. This allows ``depythontex`` output to be piped to another program. - -* All scripts ``*2.py`` now have shebangs with ``env python2``, and all - scripts ``*3.py`` now have shebangs with ``env python3``. This allows the - wrapper scripts (``env python`` shebang) to be used with the default - Python installation, and the numbered scripts to be used with specific - versions. Remember that except for console content, the ``--interpreter`` - option is what determines the Python version that actually executes code. - The version of Python used to launch ``pythontex.py`` merely determines - the version that manages code execution. (``--interpreter`` support for + +* All scripts ``*2.py`` now have shebangs with ``env python2``, and all + scripts ``*3.py`` now have shebangs with ``env python3``. This allows the + wrapper scripts (``env python`` shebang) to be used with the default + Python installation, and the numbered scripts to be used with specific + versions. Remember that except for console content, the ``--interpreter`` + option is what determines the Python version that actually executes code. + The version of Python used to launch ``pythontex.py`` merely determines + the version that manages code execution. (``--interpreter`` support for console content is coming.) - -* Changed the template style used in the ``CodeEngine`` class. Replacement - fields are now surrounded by single curly braces (as in Python's format - string syntax), rather than double curly braces. Literal curly braces are - obtained by doubling braces. This allows the use of literal adjacent + +* Changed the template style used in the ``CodeEngine`` class. Replacement + fields are now surrounded by single curly braces (as in Python's format + string syntax), rather than double curly braces. Literal curly braces are + obtained by doubling braces. This allows the use of literal adjacent double braces in templates, which was not possible previously. - -* The Julia template now uses the new ``in()`` function, replacing + +* The Julia template now uses the new ``in()`` function, replacing ``contains()``. This requires Julia v0.2.0+. Bugfixes ~~~~~~~~ -* Modified test for LuaTeX, so that ``\directlua`` is not ``\let`` to - ``\relax`` if it does not exist. This was causing incompatibility with +* Modified test for LuaTeX, so that ``\directlua`` is not ``\let`` to + ``\relax`` if it does not exist. This was causing incompatibility with ``babel`` under pdfTeX and XeTeX (#33). - -* Added missing shebangs to ``depythontex*.py``. Handling of ``utilspath`` - is now more forgiving, so that ``pythontex_utils.py`` can be installed in + +* Added missing shebangs to ``depythontex*.py``. Handling of ``utilspath`` + is now more forgiving, so that ``pythontex_utils.py`` can be installed in alternate locations (#23). - -* ``depythontex`` no longer leaves a blank line where + +* ``depythontex`` no longer leaves a blank line where ``\usepackage{pythontex}`` was removed. - -* Console environments typeset with ``fancyvrb`` no longer end with an + +* Console environments typeset with ``fancyvrb`` no longer end with an unnecessary empty line. - + * Fixed bug in installer when ``kpsewhich`` was not found (#21). @@ -201,53 +247,53 @@ Bugfixes v0.12 (2013/08/26) ------------------ -* Added support for the Julia language, with the ``julia`` and ``jl`` - families of commands and environments. (Note that Pygments only added +* Added support for the Julia language, with the ``julia`` and ``jl`` + families of commands and environments. (Note that Pygments only added Julia support in version 1.6.) - -* Warnings and errors are now synchronized with the line numbers of files - brought in via ``\input``, ``\include``, etc. This is accomplished using + +* Warnings and errors are now synchronized with the line numbers of files + brought in via ``\input``, ``\include``, etc. This is accomplished using the ``currfile`` package. - -* Added package option ``gobble``. When ``gobble=auto``, all code is - dedented before being executed and/or typeset. The current - implementation is functional but basic; it will be improved and extended + +* Added package option ``gobble``. When ``gobble=auto``, all code is + dedented before being executed and/or typeset. The current + implementation is functional but basic; it will be improved and extended in the future. - -* The document root directory is now always added to ``sys.path`` (or its - equivalent), even when it is not the working directory. (The working - directory has been added to ``sys.path`` since v0.12beta.) The document - directory is added after the working directory, so that the working + +* The document root directory is now always added to ``sys.path`` (or its + equivalent), even when it is not the working directory. (The working + directory has been added to ``sys.path`` since v0.12beta.) The document + directory is added after the working directory, so that the working directory has precedence. - -* Fixed a bug in ``console`` commands and environments; ``sys.path`` now - contains the working and document directories, and the working directory - is now the output directory by default. This parallels the behavior of + +* Fixed a bug in ``console`` commands and environments; ``sys.path`` now + contains the working and document directories, and the working directory + is now the output directory by default. This parallels the behavior of non-``console`` commands and environments. - -* Added command-line option ``--interpreter`` that allows an interpreter to - be invoked via a specific command. This allows, for example, a specific + +* Added command-line option ``--interpreter`` that allows an interpreter to + be invoked via a specific command. This allows, for example, a specific version of Python to be invoked. - -* Improved synchronization of stderr in cases when an error is triggered - far after its origin (for example, an error caused by a multiline string - that is lacking a closing quote/delimiter, and thus may span several + +* Improved synchronization of stderr in cases when an error is triggered + far after its origin (for example, an error caused by a multiline string + that is lacking a closing quote/delimiter, and thus may span several chunks of user code). - -* Modified usage of the ``shlex`` module to work around its lack of Unicode + +* Modified usage of the ``shlex`` module to work around its lack of Unicode support in Python versions prior to 2.7.3. - -* Fixed a bug from v0.12beta that prevented ``\inputpygments`` from working + +* Fixed a bug from v0.12beta that prevented ``\inputpygments`` from working when ``pygments=true``. - -* Fixed a bug with counters that caused errors when content spanning + +* Fixed a bug with counters that caused errors when content spanning multiple columns was created within a ``tabular`` environment. - + * Added checking for compatible Python versions in ``pythontex.py``. -* Improved execution of ``*.bat`` and ``*.cmd`` files under Windows. The - solution from v0.12beta allowed ``*.bat`` and ``*.cmd`` to be found and - executed when the extension was not given, but did not give correct +* Improved execution of ``*.bat`` and ``*.cmd`` files under Windows. The + solution from v0.12beta allowed ``*.bat`` and ``*.cmd`` to be found and + executed when the extension was not given, but did not give correct return codes. @@ -341,8 +387,8 @@ v0.12beta (2013/06/24) new hash, triggering another document compile. * Improved the way in which the PythonTeX ``outputdir`` is added to the - graphics path. This had been done with ``\graphicspath``, but that - overwrites any graphics path previously specified by the user. Now the + graphics path. This had been done with ``\graphicspath``, but that + overwrites any graphics path previously specified by the user. Now the ``outputdir`` is appended to any pre-existing path. * Added the ``depythontex`` option ``--graphicspath``. This adds the @@ -357,7 +403,7 @@ v0.12beta (2013/06/24) * Under Windows, ``subprocess.Popen()`` is now invoked with ``shell=True`` if ``shell=False`` results in a WindowsError. This allows commands involving ``*.bat`` and ``*.cmd`` files to be - executed when the extension is not specified; otherwise, only ``*.exe`` + executed when the extension is not specified; otherwise, only ``*.exe`` can be found and run. * The path to utils is now found in ``pythontex.py`` via @@ -374,7 +420,7 @@ v0.12beta (2013/06/24) one. All macros for commands like ``\py`` are now returned within stdout, rather than in their own file. -* Fixed a bug with ``\stderrpythontex``; it was defaulting to ``verb`` +* Fixed a bug with ``\stderrpythontex``; it was defaulting to ``verb`` rather than ``verbatim`` mode. @@ -382,7 +428,7 @@ v0.11 (2013/04/21) ------------------ * As the first non-beta release, this version adds several features and introduces several changes. You should read these release notes carefully, since some changes are not backwards-compatible. Changes are based on a thorough review of all current and planned features. PythonTeX's capabilities have already grown beyond what was originally intended, and a long list of features still remains to be implemented. As a result, some changes are needed to ensure consistent syntax and naming in the future. Insofar as possible, all command names and syntax will be frozen after this release. -* Added the ``pythontex.py`` and ``depythontex.py`` wrapper scripts. When run, these detect the current version of Python and import the correct PythonTeX code. It is still possible to run ``pythontex*.py`` and ``depythontex*.py`` directly, but the new wrapper scripts should be used instead for simplicity. There is now only a single ``pythontex_utils.py``, which works with both Python 2 and Python 3. +* Added the ``pythontex.py`` and ``depythontex.py`` wrapper scripts. When run, these detect the current version of Python and import the correct PythonTeX code. It is still possible to run ``pythontex*.py`` and ``depythontex*.py`` directly, but the new wrapper scripts should be used instead for simplicity. There is now only a single ``pythontex_utils.py``, which works with both Python 2 and Python 3. * Added the ``beta`` package option. This makes the current version behave like v0.11beta, for compatibility. This option is temporary and will probably only be retained for a few releases. * Backward-incompatible changes (require the ``beta`` option to restore old behavior) @@ -432,92 +478,92 @@ v0.10beta2 (2013/01/23) v0.10beta (2013/01/09) ---------------------- -* Backward-incompatible: Redid treatment of command-line options for - ``pythontex*.py``, using Python's ``argparse`` module. Run +* Backward-incompatible: Redid treatment of command-line options for + ``pythontex*.py``, using Python's ``argparse`` module. Run ``pythontex*.py`` with option ``-h`` to see new command line options. -* Deprecated: ``\setpythontexcustomcode`` is deprecated in favor of the - ``\pythontexcustomc`` command and ``pythontexcustomcode`` - environment. These allow entry of pure code, unlike - ``\setpythontexcustomcode``. These also allow custom code to be +* Deprecated: ``\setpythontexcustomcode`` is deprecated in favor of the + ``\pythontexcustomc`` command and ``pythontexcustomcode`` + environment. These allow entry of pure code, unlike + ``\setpythontexcustomcode``. These also allow custom code to be added to the beginning or end of a session, via an optional argument. - Improved treatment of errors and warnings associated with custom + Improved treatment of errors and warnings associated with custom code. -* The summary of errors and warnings now correctly differentiates - errors and warnings produced by user code, rather than treating all - of them as errors. By default, ``pythontex*.py`` now returns an +* The summary of errors and warnings now correctly differentiates + errors and warnings produced by user code, rather than treating all + of them as errors. By default, ``pythontex*.py`` now returns an exit code of 1 if there were errors. -* The PythonTeX utilities class now allows external file dependencies - to be specified via ``pytex.add_dependencies()``, so that sessions - are automatically re-executed when external dependencies are - modified (modification is determined via either hash or mtime; this +* The PythonTeX utilities class now allows external file dependencies + to be specified via ``pytex.add_dependencies()``, so that sessions + are automatically re-executed when external dependencies are + modified (modification is determined via either hash or mtime; this is governed by the new ``hashdependencies`` option). -* The PythonTeX utilities class now allows created files to be - specified via ``pytex.add_created()``, so that created files may be - automatically cleaned up (deleted) when the code that created them +* The PythonTeX utilities class now allows created files to be + specified via ``pytex.add_created()``, so that created files may be + automatically cleaned up (deleted) when the code that created them is modified (for example, name change for a saved plot). * Added the following package options. - - ``stdout`` (or ``print``): Allows input of stdout to be disabled. + - ``stdout`` (or ``print``): Allows input of stdout to be disabled. Useful for debugging. - - ``runall``: Executes everything. Useful when code depends on + - ``runall``: Executes everything. Useful when code depends on external data. - - ``rerun``: Determines when code is re-executed. Code may be set - to always run (same as ``runall`` option), or only run when it is - modified or when it produces errors or warnings. By default, - code is always re-executed if there are errors or modifications, + - ``rerun``: Determines when code is re-executed. Code may be set + to always run (same as ``runall`` option), or only run when it is + modified or when it produces errors or warnings. By default, + code is always re-executed if there are errors or modifications, but not re-executed if there are warnings. - - ``hashdependencies``: Determines whether external dependencies - (data, external code files highlighted with Pygments, etc.) are - checked for modification via hashing or modification time. + - ``hashdependencies``: Determines whether external dependencies + (data, external code files highlighted with Pygments, etc.) are + checked for modification via hashing or modification time. Modification time is default for performance reasons. -* Added the following new command line options. The options that are - equivalent to package options are overridden by the package options +* Added the following new command line options. The options that are + equivalent to package options are overridden by the package options when present. - - ``--error-exit-code``: Determines whether an exit code of 1 is - returned if there were errors. On by default, but can be turned + - ``--error-exit-code``: Determines whether an exit code of 1 is + returned if there were errors. On by default, but can be turned off since it is undesirable when working with some editors. - ``--runall``: Equivalent to new package option. - ``--rerun``: Equivalent to new package option. - ``--hashdependencies``: Equivalent to new package option. -* Modified the ``fixlr`` option, so that it only patches commands if +* Modified the ``fixlr`` option, so that it only patches commands if they have not already been patched (avoids package conflicts). -* Added ``\setpythontexautoprint`` command for toggling autoprint +* Added ``\setpythontexautoprint`` command for toggling autoprint on/off within the body of the document. -* Installer now attempts to create symlinks under OS X and Linux with +* Installer now attempts to create symlinks under OS X and Linux with TeX Live, and under OS X with MacPorts Tex Live. -* Performed compatibility testing under lualatex and xelatex - (previously, had only tested with pdflatex). Added documentation - for using these TeX engines; at most, slightly different preambles - are needed. Modified the PythonTeX gallery to support all three +* Performed compatibility testing under lualatex and xelatex + (previously, had only tested with pdflatex). Added documentation + for using these TeX engines; at most, slightly different preambles + are needed. Modified the PythonTeX gallery to support all three engines. -* Code commands and environments may now be used in the preamble. - This, combined with the new treatment of custom code, allows +* Code commands and environments may now be used in the preamble. + This, combined with the new treatment of custom code, allows PythonTeX to be used in creating LaTeX packages. * Added documentation for using PythonTeX in LaTeX programming. -* Fixed a bug that sometimes caused incorrect line numbers with +* Fixed a bug that sometimes caused incorrect line numbers with ``stderr`` content. Improved processing of stderr. -* Fixed a bug in automatic detection of pre-existing listings +* Fixed a bug in automatic detection of pre-existing listings environment. -* Improved the detection of imports from ``__future__``. Detection +* Improved the detection of imports from ``__future__``. Detection should now be stricter, faster, and more accurate. v0.9beta3 (2012/07/17) ---------------------- -* Added Unicode support, which required the Python code to be split into +* Added Unicode support, which required the Python code to be split into one set for Python 2 and another set for Python 3. This will require any old installation to be completely removed, and a new installation created from scratch. -* Refactoring of Python code. Documents should automatically re-execute +* Refactoring of Python code. Documents should automatically re-execute all code after updating to the new version. Otherwise, you should delete the PythonTeX directory and run PythonTeX. * Improved installation script. -* Added package options: ``pyfuture``, ``stderr``, ``upquote``, - ``pyglexer``, ``pyginline``. Renamed the ``pygextfile`` option to +* Added package options: ``pyfuture``, ``stderr``, ``upquote``, + ``pyglexer``, ``pyginline``. Renamed the ``pygextfile`` option to ``fvextfile``. * Added custom code and workingdir commands. * Added the ``console`` environment and associated options. @@ -538,4 +584,3 @@ v0.9beta (2012/04/27) --------------------- * Initial public beta release. - diff --git a/Master/texmf-dist/doc/latex/pythontex/README b/Master/texmf-dist/doc/latex/pythontex/README index a25421f3908..84ae1cff63b 100644 --- a/Master/texmf-dist/doc/latex/pythontex/README +++ b/Master/texmf-dist/doc/latex/pythontex/README @@ -3,28 +3,28 @@ =================================================================== :Author: Geoffrey Poore -:Version: 0.13 (2014/07/14) +:Version: 0.15 (2016/07/21) :License: LPPL v1.3 or later (LaTeX code) and BSD 3-Clause (Python code) :Development: https://github.com/gpoore/pythontex :Requirements: Python 2.7 or 3.2+; Pygments -The PythonTeX package allows you to enter Python code within a LaTeX +The PythonTeX package allows you to enter Python code within a LaTeX document, execute the code, and access its output in the original document. -It also supports the Ruby, Julia, and Octave languages. +It also supports the Ruby, Julia, Octave, Sage, Bash, and Rust languages. PythonTeX provides fast, user-friendly access to Python from within LaTeX. -Python code is only executed when it has been modified, or when it meets +Python code is only executed when it has been modified, or when it meets user-specified criteria. Code may be divided into user-defined sessions, -which automatically run in parallel. Errors and warnings are synchronized -with the LaTeX document, so that they refer to the document's line numbers. -External dependencies can be tracked, so that code is re-executed when the -data it depends on is modified. PythonTeX also provides syntax highlighting +which automatically run in parallel. Errors and warnings are synchronized +with the LaTeX document, so that they refer to the document's line numbers. +External dependencies can be tracked, so that code is re-executed when the +data it depends on is modified. PythonTeX also provides syntax highlighting for code in LaTeX documents via the Pygments syntax highlighter. PythonTeX includes a "depythontex" utility that creates a copy of a document in which all Python code has been replaced by its output. This can be -convenient for journal submissions, sharing documents, and converting to +convenient for journal submissions, sharing documents, and converting to other formats. Consult pythontex_quickstart.pdf and pythontex_gallery.pdf to get @@ -36,10 +36,10 @@ Compiling a PythonTeX document involves three steps: 2. Run pythontex.py (all code is executed) 3. Run latex again (Python output is inputted) -See the main documentation in pythontex.pdf for detailed installation +See the main documentation in pythontex.pdf for detailed installation instructions. An installation script is provided for TeX Live and MiKTeX. -Files should be installed in the directories indicated below. In summary, -all files must be installed, and symlinks or launching wrappers should be +Files should be installed in the directories indicated below. In summary, +all files must be installed, and symlinks or launching wrappers should be created for pythontex.py and depythontex.py. * /doc/latex/pythontex/ diff --git a/Master/texmf-dist/doc/latex/pythontex/pythontex.pdf b/Master/texmf-dist/doc/latex/pythontex/pythontex.pdf Binary files differindex bd0d1788cdc..2531310f30e 100644 --- a/Master/texmf-dist/doc/latex/pythontex/pythontex.pdf +++ b/Master/texmf-dist/doc/latex/pythontex/pythontex.pdf diff --git a/Master/texmf-dist/doc/latex/pythontex/pythontex_gallery.pdf b/Master/texmf-dist/doc/latex/pythontex/pythontex_gallery.pdf Binary files differindex a5fa37a36bd..245ffd5cc08 100644 --- a/Master/texmf-dist/doc/latex/pythontex/pythontex_gallery.pdf +++ b/Master/texmf-dist/doc/latex/pythontex/pythontex_gallery.pdf diff --git a/Master/texmf-dist/doc/latex/pythontex/pythontex_gallery.tex b/Master/texmf-dist/doc/latex/pythontex/pythontex_gallery.tex index b74a3672547..ded2b17747c 100644 --- a/Master/texmf-dist/doc/latex/pythontex/pythontex_gallery.tex +++ b/Master/texmf-dist/doc/latex/pythontex/pythontex_gallery.tex @@ -69,16 +69,18 @@ Or we could access the printed content verbatim (it might contain special charac \printpythontex[verb] \end{quote} -Python interaction can also be more complex. \pyb{print(str(2**2**2) + r'\endinput')} returns \printpythontex. In this case, the printed results include \LaTeX\ code, which is correctly interpreted by \LaTeX\ to ensure that there is not an extra space after the 16. Printed output is saved to a file and brought back in via \verb|\input|, and the \verb|\endinput| command stops input immediately, before \LaTeX\ gets to the end of the line and inserts a space character there, after the 16. +Python interaction can also be more complex. \pyb{print(str(2**2**2) + r'\endinput')} returns \printpythontex. In this case, the printed result includes \LaTeX\ code, which is correctly interpreted by \LaTeX\ to ensure that there is not an extra space after the 16. Printed output is saved to a file and brought back in via \verb|\input|, and the \verb|\endinput| command stops input immediately, before \LaTeX\ gets to the end of the line and inserts a space character there, after the 16. Printing works, but as the last example demonstrates, you have to be careful about spacing if you have text immediately after the printed content. In that case, it's usually best to assemble text within a \pytex\ environment and store the text in a variable. Then you can bring in the text later, using the \pygment{latex}{\py} command. The \pygment{latex}{\py} command brings in a string representation of its argument. First we create the text. \begin{pyblock} mytext = '$1 + 1 = {0}$'.format(1 + 1) \end{pyblock} -Then we bring it in: \py{mytext}. The \pygment{latex}{\py} command can even bring in verbatim content, as long as you are using the pdfTeX or XeTeX engines. (Unfortunately, verbatim does not work with LuaTeX, due to a bug.\footnote{\url{http://tracker.luatex.org/view.php?id=733}}) +Then we bring it in: \py{mytext}. The \pygment{latex}{\py} command can even bring in verbatim content. We don't have to typeset the code we're executing. It can be hidden.\pyc{mystring=r'\textbf{This is a message from Python}'} And then we can access it later: \py{mystring}. +It is also possible to perform variable substitution or string interpolation. The earlier result could be recreated: \pys{$1 + 1 = !{1+1}$}. + \section{Pygments highlighting} diff --git a/Master/texmf-dist/doc/latex/pythontex/pythontex_quickstart.pdf b/Master/texmf-dist/doc/latex/pythontex/pythontex_quickstart.pdf Binary files differindex 6d5d82d7fd1..c47904c5bbf 100644 --- a/Master/texmf-dist/doc/latex/pythontex/pythontex_quickstart.pdf +++ b/Master/texmf-dist/doc/latex/pythontex/pythontex_quickstart.pdf diff --git a/Master/texmf-dist/doc/latex/pythontex/pythontex_quickstart.tex b/Master/texmf-dist/doc/latex/pythontex/pythontex_quickstart.tex index 01bd938aca1..fb3c8ef35ed 100644 --- a/Master/texmf-dist/doc/latex/pythontex/pythontex_quickstart.tex +++ b/Master/texmf-dist/doc/latex/pythontex/pythontex_quickstart.tex @@ -51,9 +51,9 @@ \section*{Installing} -\pytex\ requires Python 2.7 or 3.2+. +\pytex\ requires Python 2.7 or 3.2+. When using \pytex\ with LyX, be aware that LyX may try to use its own version of Python; you may need to reconfigure LyX to use other Python installations. -\pytex\ is included in TeX Live 2013. It may be installed via the package manager. +\pytex\ is included in TeX Live and MiKTeX. It may be installed via the package manager. A Python installation script is included with the package. It should be able to install the package in most situations. Depending on the configuration of your system, you may have to run the installation script with administrative priviliges. @@ -61,7 +61,7 @@ Detailed installation information is available in the main documentation, \textt \section*{Compiling} -Compiling a document that uses \pytex\ involves three steps: run \LaTeX, run \texttt{pythontex.py}, and finally run \LaTeX\ again. You may wish to create a symlink or launching wrapper for \texttt{pythontex.py}, if one was not created during installation. \pytex\ is compatible with the pdfLaTeX, XeLaTeX, and LuaLaTeX engines, so you can use \texttt{latex}, \texttt{pdflatex}, \texttt{xelatex}, or \texttt{lualatex}. There are minor engine-specific differences; see the main documentation for details. +Compiling a document that uses \pytex\ involves three steps: run \LaTeX, run \texttt{pythontex.py}, and finally run \LaTeX\ again. You may wish to create a symlink or launching wrapper for \texttt{pythontex.py}, if one was not created during installation. \pytex\ is compatible with the pdfTeX, XeTeX, and LuaTeX engines, so you can use \texttt{latex}, \texttt{pdflatex}, \texttt{xelatex}, or \texttt{lualatex}. The last two compile steps are \emph{only} necessary when code needs to be executed or highlighted. Otherwise, the document may be compiled just like a normal \LaTeX\ document; all output is cached. @@ -79,10 +79,12 @@ The last two compile steps are \emph{only} necessary when code needs to be execu \pygment{latex}{\pyv} only typesets code; nothing is executed. For example, \pygment{latex}{\pyv{var = 2}} produces \pyv{var = 2}. +\pygment{latex}{\pys} performs variable substitution or string interpolation on code. Substitution fields are denoted by \verb|!{...}|; details about escaping are provided in the main documentation. For example, using the pre-existing variable \pyv{var}, \pygment{latex}{\pys{\verb|var = !{var}|}} yields \pys{\verb|var = !{var}|}. + \section*{Basic environments} -There are \texttt{pycode}, \texttt{pyblock}, and \texttt{pyverbatim} environments, which are the environment equivalents of \pygment{latex}{\pyc}, \pygment{latex}{\pyb}, and \pygment{latex}{\pyv}. For example, +There are \texttt{pycode}, \texttt{pyblock}, \texttt{pyverbatim}, and \texttt{pysub} environments, which are the environment equivalents of \pygment{latex}{\pyc}, \pygment{latex}{\pyb}, \pygment{latex}{\pyv}, and \pygment{latex}{\pys}. For example, \begin{pygments}{text} \begin{pycode} print(r'\begin{center}') @@ -132,9 +134,9 @@ Console variable values may be accessed inline via the \pygment{latex}{\pycon} c \section*{Support for additional languages} -\pytex\ also provides support for additional languages. Currently, Ruby, Julia, and Octave support is included. To enable commands and environments for these language, see the \texttt{usefamily} package option in the main documentation. +\pytex\ also provides support for additional languages. Currently, Ruby, Julia, Octave, Sage, Bash, and Rust support is included. To enable commands and environments for these language, see the \texttt{usefamily} package option in the main documentation. -Language support is provided via a template system; in most cases, a new language can be added with about 100 lines of template code. If you would like support for a new language, please open an issue at \href{https://github.com/gpoore/pythontex}{GitHub}. The main documentation also contains a summary of the process for adding languages. +Language support is provided via a template system; in most cases, a new language can be added with about 100 lines of template code---and basic support can require less than 20 lines. If you would like support for a new language, please open an issue at \href{https://github.com/gpoore/pythontex}{GitHub}. The main documentation also contains a summary of the process for adding languages. \section*{Macro programming} @@ -147,7 +149,13 @@ Language support is provided via a template system; in most cases, a new languag \pytex\ also provides the \texttt{depythontex} utility, which creates a copy of a document in which all \pytex\ commands and environments have been replaced by their output. The resulting document is more suitable for journal submission, sharing, and conversion to other document formats. -Code may be run in interactive mode via the \verb|--interactive| and \verb|--debug| command-line options. This is primarily useful for working with interactive debuggers. +Code may be run in interactive mode on the command line via the \verb|--interactive| and \verb|--debug| options. This is primarily useful for working with interactive debuggers. + + +\section*{Customizing typesetting} + +\pytex\ typesets code using the \texttt{fancyvrb} package and the \texttt{fvextra} package that extends \texttt{fancyvrb}. There is a \pygment{latex}{\setpythontexfv} command for setting \pytex-specific \texttt{fancyvrb} and \texttt{fvextra} options. The normal \pygment{latex}{\fvset} works as well for document-wide settings. \pytex\ environments take a second optional argument that consists of \texttt{fancyvrb} and \texttt{fvextra} settings. This can be used to customize automatic line breaking or line highlighting for a single environment. + \section*{Unicode support} |