diff options
author | Norbert Preining <norbert@preining.info> | 2020-10-17 03:01:01 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2020-10-17 03:01:01 +0000 |
commit | 683b627ec089f4ddb05f06b1e93ee368189f78a4 (patch) | |
tree | 7a6ef1c8a2545a0d181cb890cc8611610263b8f5 /macros/latex/contrib/sagetex | |
parent | d8395db550c4f6044f0f3586bbc5263f06444598 (diff) |
CTAN sync 202010170301
Diffstat (limited to 'macros/latex/contrib/sagetex')
-rw-r--r-- | macros/latex/contrib/sagetex/CONTRIBUTORS | 2 | ||||
-rw-r--r-- | macros/latex/contrib/sagetex/LICENSE | 16 | ||||
-rw-r--r-- | macros/latex/contrib/sagetex/PKG-INFO | 2 | ||||
-rw-r--r-- | macros/latex/contrib/sagetex/README.md (renamed from macros/latex/contrib/sagetex/README) | 29 | ||||
-rw-r--r-- | macros/latex/contrib/sagetex/example.pdf | bin | 285125 -> 276082 bytes | |||
-rw-r--r-- | macros/latex/contrib/sagetex/example.tex | 2 | ||||
-rw-r--r-- | macros/latex/contrib/sagetex/py-and-sty.dtx | 6 | ||||
-rw-r--r-- | macros/latex/contrib/sagetex/sagetex.dtx | 27 | ||||
-rw-r--r-- | macros/latex/contrib/sagetex/sagetex.pdf | bin | 499983 -> 497692 bytes | |||
-rw-r--r-- | macros/latex/contrib/sagetex/scripts.dtx | 19 | ||||
-rw-r--r-- | macros/latex/contrib/sagetex/setup.py | 2 |
11 files changed, 74 insertions, 31 deletions
diff --git a/macros/latex/contrib/sagetex/CONTRIBUTORS b/macros/latex/contrib/sagetex/CONTRIBUTORS index bd489e1dc9..48ec08bd12 100644 --- a/macros/latex/contrib/sagetex/CONTRIBUTORS +++ b/macros/latex/contrib/sagetex/CONTRIBUTORS @@ -19,3 +19,5 @@ Paul Masson Frédéric Chapoton Karl-Dieter Crisman Jérôme Benoit +John Palmieri +Tobias Müller diff --git a/macros/latex/contrib/sagetex/LICENSE b/macros/latex/contrib/sagetex/LICENSE new file mode 100644 index 0000000000..e4a61c504a --- /dev/null +++ b/macros/latex/contrib/sagetex/LICENSE @@ -0,0 +1,16 @@ +Copyright (C) 2008--2015 by Dan Drake <dr.dan.drake@gmail.com> +Copyright (C) 2016--2019 by SageMath Developers <sage-devel@googlegroups.com> + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. + diff --git a/macros/latex/contrib/sagetex/PKG-INFO b/macros/latex/contrib/sagetex/PKG-INFO index e3840db7b3..628c7e2da9 100644 --- a/macros/latex/contrib/sagetex/PKG-INFO +++ b/macros/latex/contrib/sagetex/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: sagetex -Version: 3.2 +Version: 3.5 Summary: Embed Sage code and plots into LaTeX Home-page: https://github.com/sagemath/sagetex Author: SageMath developers diff --git a/macros/latex/contrib/sagetex/README b/macros/latex/contrib/sagetex/README.md index fb35a8b4e8..f6e75ac061 100644 --- a/macros/latex/contrib/sagetex/README +++ b/macros/latex/contrib/sagetex/README.md @@ -1,20 +1,25 @@ -This is the SageTeX package. It allows you to embed code, results of +# This is the SageTeX package. + +It allows you to embed code, results of computations, and plots from the Sage mathematics software suite -(http://sagemath.org) into LaTeX documents. -==================================================================== +(https://www.sagemath.org) into LaTeX documents. + +## Using SageTeX SageTeX is included with Sage, so to use it, you only need to make the file sagetex.sty known to TeX; that file will be in SAGE_ROOT/local/share/texmf/tex/latex/sagetex, along with documentation and examples. See the Sage tutorial at -http://doc.sagemath.org/html/en/tutorial/sagetex.html +https://doc.sagemath.org/html/en/tutorial/sagetex.html for a quick usage introduction, and for complete installation instructions later on the same page at -http://doc.sagemath.org/html/en/tutorial/sagetex.html#sec-sagetex-install +https://doc.sagemath.org/html/en/tutorial/sagetex.html#sec-sagetex-install The complete documentation is in sagetex.pdf, in the SAGE_ROOT/... directory mentioned above. +## Generating SageTeX + If you want to extract any of SageTeX's files from the .dtx sources, you can do @@ -40,6 +45,15 @@ the documentation.) To use the SageTeX package with your own documents, see the "Installation" section of the documentation. +## Contributing to SageTeX + +Please let us know your experience with SageTeX, especially bug +reports or feature requests, at +https://github.com/sagemath/sagetex/ + +SageTeX welcomes code contributions, subject to approval by the +maintainers. Release managers should note the instructions at HACKING.md + This work builds on a lot of work by others; see the CONTRIBUTORS file and the "Credits" section of the documentation for credits. The source code may be modified and distributed under the terms of the GPL, version @@ -47,7 +61,4 @@ code may be modified and distributed under the terms of the GPL, version Creative Commons Attribution - Share Alike 3.0 License. See the "Copying and licenses" section of the documentation. -Please let me know if you find any bugs or have any ideas for -improvement! - -- Dan Drake <dr.dan.drake at gmail> +Sagemath Developers and SageTeX maintainers diff --git a/macros/latex/contrib/sagetex/example.pdf b/macros/latex/contrib/sagetex/example.pdf Binary files differindex 4894f323b6..af815f0b56 100644 --- a/macros/latex/contrib/sagetex/example.pdf +++ b/macros/latex/contrib/sagetex/example.pdf diff --git a/macros/latex/contrib/sagetex/example.tex b/macros/latex/contrib/sagetex/example.tex index 2c04afdd02..415092dfdf 100644 --- a/macros/latex/contrib/sagetex/example.tex +++ b/macros/latex/contrib/sagetex/example.tex @@ -487,7 +487,7 @@ will evaluate functions and write the results into a file: for t in tvals: try: lines.append('{0} {1} i'.format(fmt(x(t)), fmt(y(t)))) - except ValueError, ZeroDivisonError: + except (ValueError, ZeroDivisonError): pass with open(fn, 'w') as f: f.write('\n'.join(lines) + '\n') diff --git a/macros/latex/contrib/sagetex/py-and-sty.dtx b/macros/latex/contrib/sagetex/py-and-sty.dtx index a27dbc5bd8..49bf5cd05e 100644 --- a/macros/latex/contrib/sagetex/py-and-sty.dtx +++ b/macros/latex/contrib/sagetex/py-and-sty.dtx @@ -859,6 +859,7 @@ again}} pyversion = ' '.join(__version__.strip('[').split()[0:2]) from sage.misc.latex import latex from sage.repl.preparse import preparse +from six import PY3 import sys import os import os.path @@ -1532,7 +1533,10 @@ SAGE_ROOT/local/share/doc/sagetex.""") "print('SageT", "_st_.current_tex_line", " _st_.current_tex_line")): - m.update(bytearray(line,'utf8')) + if PY3: + m.update(bytearray(line,'utf8')) + else: + m.update(bytearray(line)) % \end{macrocode} % (The |current_tex_line| thing appears twice because it may appear % indented one space or not, depending on whether it's used before diff --git a/macros/latex/contrib/sagetex/sagetex.dtx b/macros/latex/contrib/sagetex/sagetex.dtx index da0b7ff86a..b5598d990e 100644 --- a/macros/latex/contrib/sagetex/sagetex.dtx +++ b/macros/latex/contrib/sagetex/sagetex.dtx @@ -1,6 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 2008--2015 by Dan Drake <dr.dan.drake (at) gmail (dot) com> +% Copyright (C) 2016--2020 by SageMath Developers <sage-devel (at) googlegroups (dot) com> % ------------------------------------------------------- % % See the "Copying and licenses" section in this file for the terms @@ -29,10 +30,10 @@ %<latex>\ProvidesPackage{sagetex} %<python>__version__ = """ %<*latex|python> - [2019/01/09 v3.2 embedding Sage into LaTeX documents] + [2020/08/12 v3.5 embedding Sage into LaTeX documents] %</latex|python> %<python>""".strip() -%<latex>\newcommand{\ST@ver}{2019/01/09 v3.2} +%<latex>\newcommand{\ST@ver}{2020/08/12 v3.5} %<*driver> \documentclass{ltxdoc} \usepackage{sagetex} @@ -175,9 +176,9 @@ suggestions. % \title{The \ST{} package\thanks{This document corresponds to % \ST \fileversion, dated \filedate.}} % -% \author{Dan Drake and others\thanks{Author's website: -% \href{http://mathsci.kaist.ac.kr/\textasciitilde drake/} -% {\texttt{mathsci.kaist.ac.kr/$\sim$drake/}}.}} +% \author{Dan Drake and others\thanks{Package's website: +% \href{https://github.com/sagemath/sagetex} +% {\texttt{github.com/sagemath/sagetex}}.}} % % \iffalse % Don't put any other code from this file into the .sty or .py @@ -818,20 +819,26 @@ suggestions. % provides Python syntax highlighting and line numbers. For example, % \begin{quote} % |\begin{sagecommandline}|\\ -% | sage: 1+1|\\ -% | 2|\\ +% | sage: t = 1+1|\\ +% | sage: for i in range(101): # multiline input example|\\ +% | ....: t+=1|\\ +% | sage: t|\\ +% | 103|\\ % | sage: factor(x^2 + 2*x + 1)|\\ % |\end{sagecommandline}| % \end{quote} % becomes \begin{sagecommandline} - sage: 1+1 - 2 + sage: t = 1+1 + sage: for i in range(101): # multiline input example + ....: t+=1 + sage: t + 103 sage: factor(x^2 + 2*x + 1) \end{sagecommandline} % You have a choice of either explicitly providing the Sage output or % leaving it up to the computer to fill in the blanks. Above, the output -% for $1+1$ was provided, but the output for the |factor()| command +% for $t$ was provided, but the output for the |factor()| command % wasn't. Moreover, any Sage comment that starts with a ``at'' sign is % escaped to \LTX. In particular, you can use |\label| to mark line % numbers in order to |\ref|erence and |\pageref|erence them as usual. diff --git a/macros/latex/contrib/sagetex/sagetex.pdf b/macros/latex/contrib/sagetex/sagetex.pdf Binary files differindex ac37a7258b..4ad0f319e8 100644 --- a/macros/latex/contrib/sagetex/sagetex.pdf +++ b/macros/latex/contrib/sagetex/sagetex.pdf diff --git a/macros/latex/contrib/sagetex/scripts.dtx b/macros/latex/contrib/sagetex/scripts.dtx index aec62a08cb..8f7048dcef 100644 --- a/macros/latex/contrib/sagetex/scripts.dtx +++ b/macros/latex/contrib/sagetex/scripts.dtx @@ -42,6 +42,7 @@ import sys import os import re import subprocess +from six import PY3 # CHANGE THIS AS APPROPRIATE path_to_sage = os.path.expanduser('~/bin/sage') @@ -55,14 +56,13 @@ if sys.argv[1].endswith('.sagetex.sage'): else: src = os.path.splitext(sys.argv[1])[0] -commented_out = r'^\s*%' -usepackage = r'\usepackage{sagetex}' +usepackage = r'usepackage(\[.*\])?{sagetex}' uses_sagetex = False -# if it doesn't use sagetex, obviously running sage is unnecessary +# if it does not use sagetex, obviously running sage is unnecessary with open(src + '.tex') as texf: for line in texf: - if not re.search(commented_out, line) and re.search(usepackage, line): + if line.strip().startswith(r'\usepackage') and re.search(usepackage, line): uses_sagetex = True break @@ -72,14 +72,17 @@ if not uses_sagetex: # if something goes wrong, assume we need to run Sage run_sage = True - ignore = r"^( _st_.goboom|print('SageT| ?_st_.current_tex_line))" +ignore = r"^( _st_.goboom|print\('SageT| ?_st_.current_tex_line)" try: with open(src + '.sagetex.sage', 'r') as sagef: h = hashlib.md5() for line in sagef: if not re.search(ignore, line): - h.update(bytearray(line,'utf8')) + if PY3: + h.update(bytearray(line,'utf8')) + else: + h.update(bytearray(line)) except IOError: print('{0}.sagetex.sage not found, I think you need to typeset {0}.tex first.'.format(src)) sys.exit(1) @@ -137,7 +140,7 @@ See the SageTeX documentation for more details.""" % sys.argv[0]) try: opts, args = getopt.getopt(sys.argv[1:], 'ho', ['help', 'overwrite']) -except getopt.GetoptError, err: +except getopt.GetoptError as err: print(str(err)) usage() sys.exit(2) @@ -213,7 +216,7 @@ See the SageTeX documentation for more details.""" % sys.argv[0]) try: opts, args = getopt.getopt(sys.argv[1:], 'ho', ['help', 'overwrite']) -except getopt.GetoptError, err: +except getopt.GetoptError as err: print(str(err)) usage() sys.exit(2) diff --git a/macros/latex/contrib/sagetex/setup.py b/macros/latex/contrib/sagetex/setup.py index 44631f6926..28e2712065 100644 --- a/macros/latex/contrib/sagetex/setup.py +++ b/macros/latex/contrib/sagetex/setup.py @@ -4,7 +4,7 @@ setup(name='sagetex', long_description="""The SageTeX package allows you to embed code, results of computations, and plots from the Sage mathematics software suite (http://sagemath.org) into LaTeX documents.""", - version='3.2', + version='3.5', author='Dan Drake', author_email='dr.dan.drake@gmail.com', maintainer='SageMath developers', |