diff options
author | Karl Berry <karl@freefriends.org> | 2022-03-11 22:03:51 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-03-11 22:03:51 +0000 |
commit | f7047aebf5fc4b143b53cb23f9d9ea3c3eddf3be (patch) | |
tree | cebef55a7e2e238f4cb95eeac7a072191816eb60 | |
parent | 0a573a4905225d13a773434edef1a5e0bf1d3da9 (diff) |
pyluatex (11mar22)
git-svn-id: svn://tug.org/texlive/trunk@62638 c570f23f-e606-0410-a88d-b1316a301751
17 files changed, 1299 insertions, 46 deletions
diff --git a/Master/texmf-dist/doc/lualatex/pyluatex/example/beamer.tex b/Master/texmf-dist/doc/lualatex/pyluatex/example/beamer.tex new file mode 100644 index 00000000000..6dea2ea6c96 --- /dev/null +++ b/Master/texmf-dist/doc/lualatex/pyluatex/example/beamer.tex @@ -0,0 +1,122 @@ +%% Copyright 2021-2022 Tobias Enderle +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. + +\documentclass{beamer} + +\usepackage{pyluatex} +\usepackage{listings} +\usepackage{xcolor} +\lstset{ + language=Python, + breaklines=true, + framesep=1ex, + frame=lrtb, + framerule=0pt, + numbers=none, + basicstyle=\ttfamily, + keywordstyle=\bfseries\color{green!40!black}, + stringstyle=\bfseries\color{red!80!black}, + identifierstyle=\color{blue}, + backgroundcolor=\color{gray!10!white}, +} + +\usepackage{luacode} +\begin{luacode} +function pytypeset() + tex.print("\\begin{lstlisting}[language=Python]") + tex.print(pyluatex.get_last_code()) + tex.print("\\end{lstlisting}") + tex.print("") -- ensure newline +end + +function pytypeset_inline() + -- assume there is only one line of code in get_last_code() + tex.print("\\lstinline[columns=fixed]@" .. pyluatex.get_last_code()[1] .. "@") +end +\end{luacode} + +\newcommand*{\pytypeset}{% + \textbf{Input:} + \directlua{pytypeset()} + \textbf{Output:} + \begin{center} + \directlua{tex.print(pyluatex.get_last_output())} + \end{center} +} +\newcommand*{\coderaw}{\directlua{tex.print(pyluatex.get_last_code())}} +\newcommand*{\codeinline}{\directlua{pytypeset_inline()}} +\newcommand*{\outputraw}{\directlua{tex.print(pyluatex.get_last_output())}} + +\title{PyLuaTeX Example -- BEAMER Presentation} +\author{Tobias Enderle} + +\begin{document} + +\maketitle + +%%%%%%%%%%%%%%%%%%%%%% frame + +\begin{frame}{Important} +Using PyLuaTeX environments (\emph{python} or \emph{pythonq}) inside BEAMER frames +requires the \emph{fragile} option for those frames. +\end{frame} + +%%%%%%%%%%%%%%%%%%%%%% frame + +\begin{frame}[fragile]{Slide 1} +\begin{pythonq} +msg = 'Hello slide 1' + +print(msg) +\end{pythonq} +\pytypeset + +Calling \pycq{print('test', end='')}\codeinline\ in Python outputs ``\outputraw''. + +\begin{python} +x = 4 +\end{python} +The value of \pyq{x}\codeinline\ is \outputraw. + +The result of \pyq{17 + 300}$\coderaw$ is \outputraw. +\end{frame} + +%%%%%%%%%%%%%%%%%%%%%% frame + +\begin{pythonq} +msg = 'Hello slide 2' + +print(msg) +\end{pythonq} + +\begin{frame}{Slide 1} +\pytypeset + +The \emph{fragile} option is not required in this frame because +the \emph{pythonq} environment is outside the frame. +Only the macro \emph{\textbackslash pytypeset} for typesetting the code and output is inside +the frame. +\end{frame} + +%%%%%%%%%%%%%%%%%%%%%% frame + +\newenvironment{typesetpython} + {\PyLTVerbatimEnv\begin{pythonq}} + {\end{pythonq}\pytypeset} + +\begin{frame}[fragile]{Slide 2} +\begin{typesetpython} +msg = 'Custom environment' + +print(msg) +\end{typesetpython} +\end{frame} + +\end{document} diff --git a/Master/texmf-dist/doc/lualatex/pyluatex/example/data-visualization.tex b/Master/texmf-dist/doc/lualatex/pyluatex/example/data-visualization.tex new file mode 100644 index 00000000000..3a2d20a2bdd --- /dev/null +++ b/Master/texmf-dist/doc/lualatex/pyluatex/example/data-visualization.tex @@ -0,0 +1,137 @@ +%% Copyright 2021-2022 Tobias Enderle +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. + +\documentclass{article} + +\usepackage{pgfplots} +\pgfplotsset{compat=1.15} +\usepackage{pyluatex} +\usepackage{booktabs} + +\usepackage{url} +\urldef\dataurl\url{https://population.un.org/wpp/Download/Files/1_Indicators%20(Standard)/CSV_FILES/WPP2019_TotalPopulationBySex.csv} + +\begin{python} +import pandas as pd +import datetime + +def pgf_coords(x, y): + return ' '.join(f'({a},{b})' for a, b in zip(x, y)) + +file = 'population.csv' +df = pd.read_csv(file) +data = df.set_index(['Location', 'Time']).sort_index() +world_data = data.loc['World'] + +year = datetime.datetime.now().year +current_pop = world_data.loc[year].PopTotal + +diffs = world_data.PopTotal.diff() +highest_increase_year = diffs.idxmax() +highest_increase = diffs.max() / 1e3 +\end{python} + +\title{PyLuaTeX Example -- Data Visualization} +\author{Tobias Enderle} + +\begin{document} + +\maketitle + +This document demonstrates how data can be visualized flexibly in a \LaTeX{} +document with the help of the Python package \emph{pandas} and the \LaTeX{} +package \emph{pgfplots}. + +We show some statistics of the United Nations' \emph{World Population Prospects}% +\footnote{United Nations, Department of Economic and Social Affairs, Population +Division (2019). World Population Prospects 2019, Online Edition. Rev.\ 1.} in the +form of plots, tables or individual values. +The data file \texttt{\py{file}} is a subset of the file +\texttt{WPP2019\_TotalPopulationBySex.csv}\footnote{\dataurl{} (last accessed: +2021/07/04)}. + +The following plot shows the estimated world population between \py{df.Time.iloc[0]} +and \py{df.Time.iloc[-1]}. The red lines mark the current year and population. + +\begin{center} +\begin{tikzpicture} +\begin{axis}[ + width=\textwidth, + height=0.7\textwidth, + enlarge x limits=false, + ymin=0, + ylabel={Estimated world population in billions}, + xlabel={Year}, + xticklabel style={/pgf/number format/1000 sep=}, + grid=both, +] +\addplot[no marks,black,thick] coordinates {% + \py{pgf_coords(world_data.index, world_data.PopTotal / 1e6)}% +}; +\draw[red,thick] (axis cs:\py{year},0) |- (axis cs:0,\py{current_pop / 1e6}); +\end{axis} +\end{tikzpicture} +\end{center} + +The year with the highest increase of \py{round(highest_increase)} million people +was \py{highest_increase_year}. The world population is expected to reach a value +of \py{round(world_data.loc[2100].PopTotal / 1e6, 2)} billion by 2100. + +The following table shows the total as well as the male and female population at +the beginning of each decade. The values are given in thousands. +\begin{center} +\begin{python} +table_data = world_data.iloc[::10].reset_index() +table_data = table_data[['Time', 'PopTotal', 'PopMale', 'PopFemale']] +table_data.columns = ['Year', 'Total (thousands)', 'Male (thousands)', 'Female (thousands)'] +table = table_data.style.hide(axis='index').format( + formatter={ + 'Total (thousands)': '{:,.0f}', + 'Male (thousands)': '{:,.0f}', + 'Female (thousands)': '{:,.0f}' + } +).to_latex(hrules=True) +print(table) +\end{python} +\end{center} + +The plot below shows the estimated population of China and the United States +of America (USA). The numbers are given in millions. +\begin{center} +\begin{python} +marker_year = 2030 +plots = [ + ('China', data.loc['China'].PopTotal / 1e3), + ('USA', data.loc['United States of America'].PopTotal / 1e3) +] +\end{python} +\begin{tikzpicture} +\begin{axis}[ + width=\textwidth, + height=0.55\textwidth, + enlarge x limits=false, + ymin=0, + ylabel={Estimated population in millions}, + xlabel={Year}, + xticklabel style={/pgf/number format/1000 sep=}, + grid=both, +] +\pgfplotsinvokeforeach{0,1}{% + \addplot[no marks,black,thick] coordinates {% + \py{pgf_coords(plots[#1][1].index, plots[#1][1])}% + }; + \node[below] at (axis cs:\py{marker_year},\py{plots[#1][1].loc[marker_year]}) + {\py{plots[#1][0]}}; +} +\end{axis} +\end{tikzpicture} +\end{center} + +\end{document} diff --git a/Master/texmf-dist/doc/lualatex/pyluatex/example/matplotlib-external.tex b/Master/texmf-dist/doc/lualatex/pyluatex/example/matplotlib-external.tex new file mode 100644 index 00000000000..bdea9c0afd8 --- /dev/null +++ b/Master/texmf-dist/doc/lualatex/pyluatex/example/matplotlib-external.tex @@ -0,0 +1,53 @@ +%% Copyright 2021-2022 Tobias Enderle +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. + +\documentclass{article} + +\usepackage{pyluatex} +\usepackage{graphicx} + +\title{PyLuaTeX Example -- Matplotlib External} +\author{Tobias Enderle} + +\begin{document} + +\maketitle + +In this document we demonstrate how \emph{matplotlib} plots can be generated and +included in a document. In the Python code in this document, the plot is +configured and saved to an external PDF file. This PDF file is then +included as picture using \verb|\includegraphics|. + +\begin{center} +\begin{python} +# example based on +# https://matplotlib.org/stable/gallery/lines_bars_and_markers/simple_plot.html +import matplotlib.pyplot as plt +import numpy as np + +t = np.arange(0.0, 2.0, 0.01) +s = 1 + np.sin(2 * np.pi * t) + +fig, ax = plt.subplots() +ax.plot(t, s) + +ax.set(xlabel='time (s)', ylabel='voltage (mV)', + title='About as simple as it gets, folks') +ax.grid() + +fig.savefig('matplotlib-plot.pdf', bbox_inches='tight', pad_inches=0.1) +\end{python} +\includegraphics[width=0.8\textwidth]{matplotlib-plot.pdf} +\end{center} + +For an alternative approach using the PGF backend, consider the example +\verb|matplotlib-pgf.tex|. + +\end{document} diff --git a/Master/texmf-dist/doc/lualatex/pyluatex/example/matplotlib-pgf.tex b/Master/texmf-dist/doc/lualatex/pyluatex/example/matplotlib-pgf.tex new file mode 100644 index 00000000000..2962be862f8 --- /dev/null +++ b/Master/texmf-dist/doc/lualatex/pyluatex/example/matplotlib-pgf.tex @@ -0,0 +1,61 @@ +%% Copyright 2021-2022 Tobias Enderle +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. + +\documentclass{article} + +\usepackage{pyluatex} +\usepackage{unicode-math} +\usepackage{pgf} +\usepackage{url} + +\title{PyLuaTeX Example -- Matplotlib PGF} +\author{Tobias Enderle} + +\begin{document} + +\maketitle + +In this document we demonstrate how \emph{matplotlib} plots can be generated and +included in a document. In the Python code in this document, the plot is +configured and saved to PGF\footnote{\url{https://ctan.org/pkg/pgf}} code. +The PGF code is then included in the document and creates the plot. + +To avoid intermediate files, the PGF code is saved into an in-memory file +using the Python \verb|io.StringIO| class% +\footnote{\url{https://docs.python.org/3/library/io.html#io.StringIO}}. + +\begin{center} +\begin{python} +# example based on +# https://matplotlib.org/stable/gallery/lines_bars_and_markers/simple_plot.html +import matplotlib.pyplot as plt +import numpy as np +import io + +t = np.arange(0.0, 2.0, 0.01) +s = 1 + np.sin(2 * np.pi * t) + +fig, ax = plt.subplots(figsize=(5, 3.5)) +ax.plot(t, s) + +ax.set(xlabel='time (s)', ylabel='voltage (mV)', + title='About as simple as it gets, folks') +ax.grid() + +with io.StringIO() as file: # save to "in-memory file" + fig.savefig(file, format='pgf', bbox_inches='tight', pad_inches=0.1) + print(file.getvalue()) +\end{python} +\end{center} + +For an alternative approach of creating plots with \emph{matplotlib}, +consider the example \verb|matplotlib-external.tex|. + +\end{document} diff --git a/Master/texmf-dist/doc/lualatex/pyluatex/example/population.csv b/Master/texmf-dist/doc/lualatex/pyluatex/example/population.csv new file mode 100644 index 00000000000..9f7f2c11c2a --- /dev/null +++ b/Master/texmf-dist/doc/lualatex/pyluatex/example/population.csv @@ -0,0 +1,454 @@ +Location,Variant,LocID,VarID,Time,MidPeriod,PopMale,PopFemale,PopTotal,PopDensity +World,Medium,900,2,1950,1950.5,1266259.5559999999,1270171.462,2536431.018,19.497 +World,Medium,900,2,1951,1951.5,1290237.638,1293796.5890000002,2584034.227,19.863 +World,Medium,900,2,1952,1952.5,1313854.565,1317007.125,2630861.69,20.223 +World,Medium,900,2,1953,1953.5,1337452.7859999998,1340156.275,2677609.0609999998,20.581999999999997 +World,Medium,900,2,1954,1954.5,1361313.834,1363532.92,2724846.7539999997,20.945 +World,Medium,900,2,1955,1955.5,1385658.299,1387361.616,2773019.915,21.316 +World,Medium,900,2,1956,1956.5,1410643.208,1411800.0459999999,2822443.2539999997,21.695 +World,Medium,900,2,1957,1957.5,1436364.62,1436941.438,2873306.058,22.086 +World,Medium,900,2,1958,1958.5,1462864.322,1462822.358,2925686.68,22.489 +World,Medium,900,2,1959,1959.5,1490141.399,1489434.7480000001,2979576.147,22.903000000000002 +World,Medium,900,2,1960,1960.5,1518186.7019999998,1516763.013,3034949.715,23.329 +World,Medium,900,2,1961,1961.5,1547019.3530000001,1544824.16,3091843.5130000003,23.766 +World,Medium,900,2,1962,1962.5,1576718.9030000002,1573701.858,3150420.7610000004,24.215999999999998 +World,Medium,900,2,1963,1963.5,1607439.247,1603561.699,3211000.9460000005,24.682 +World,Medium,900,2,1964,1964.5,1639369.3280000002,1634608.9440000001,3273978.272,25.166 +World,Medium,900,2,1965,1965.5,1672618.879,1666964.631,3339583.51,25.671 +World,Medium,900,2,1966,1966.5,1707237.638,1700684.993,3407922.631,26.195999999999998 +World,Medium,900,2,1967,1967.5,1743114.2219999998,1735655.882,3478770.104,26.74 +World,Medium,900,2,1968,1968.5,1779990.92,1771608.5159999998,3551599.436,27.3 +World,Medium,900,2,1969,1969.5,1817510.8,1808170.165,3625680.965,27.87 +World,Medium,900,2,1970,1970.5,1855390.166,1845046.876,3700437.042,28.444000000000003 +World,Medium,900,2,1971,1971.5,1893576.3180000002,1882183.7119999998,3775760.03,29.023000000000003 +World,Medium,900,2,1972,1972.5,1932065.884,1919584.7040000001,3851650.588,29.607 +World,Medium,900,2,1973,1973.5,1970688.779,1957091.74,3927780.519,30.191999999999997 +World,Medium,900,2,1974,1974.5,2009259.494,1994534.6840000001,4003794.1780000003,30.776 +World,Medium,900,2,1975,1975.5,2047666.0259999998,2031814.448,4079480.474,31.358 +World,Medium,900,2,1976,1976.5,2085824.4530000002,2068842.374,4154666.827,31.936 +World,Medium,900,2,1977,1977.5,2123811.87,2105694.049,4229505.919,32.510999999999996 +World,Medium,900,2,1978,1978.5,2161887.5919999997,2142646.0069999998,4304533.598999999,33.088 +World,Medium,900,2,1979,1979.5,2200418.504,2180087.681,4380506.185,33.672 +World,Medium,900,2,1980,1980.5,2239689.027,2218314.4390000002,4458003.466,34.268 +World,Medium,900,2,1981,1981.5,2279673.275,2257323.344,4536996.619,34.875 +World,Medium,900,2,1982,1982.5,2320329.605,2297056.921,4617386.526000001,35.493 +World,Medium,900,2,1983,1983.5,2361892.5840000003,2337676.603,4699569.187,36.124 +World,Medium,900,2,1984,1984.5,2404645.374,2379366.143,4784011.517,36.773 +World,Medium,900,2,1985,1985.5,2448724.603,2422197.063,4870921.666,37.442 +World,Medium,900,2,1986,1986.5,2494279.319,2466288.681,4960568.0,38.131 +World,Medium,900,2,1987,1987.5,2541075.233,2511446.765,5052521.998,38.836999999999996 +World,Medium,900,2,1988,1988.5,2588387.929,2557038.065,5145425.994,39.552 +World,Medium,900,2,1989,1989.5,2635233.492,2602207.942,5237441.433999999,40.259 +World,Medium,900,2,1990,1990.5,2680895.262,2646335.779,5327231.041,40.949 +World,Medium,900,2,1991,1991.5,2725113.1789999995,2689176.204,5414289.382999999,41.618 +World,Medium,900,2,1992,1992.5,2768050.729,2730869.164,5498919.892999999,42.269 +World,Medium,900,2,1993,1993.5,2809940.82,2771656.778,5581597.597999999,42.903999999999996 +World,Medium,900,2,1994,1994.5,2851196.9960000003,2811953.432,5663150.427999999,43.531000000000006 +World,Medium,900,2,1995,1995.5,2892141.5489999996,2852071.381,5744212.93,44.153999999999996 +World,Medium,900,2,1996,1996.5,2932815.962,2892075.9689999996,5824891.931,44.773999999999994 +World,Medium,900,2,1997,1997.5,2973160.99,2931884.6569999997,5905045.647000001,45.391000000000005 +World,Medium,900,2,1998,1998.5,3013295.709,2971498.3660000004,5984794.075,46.004 +World,Medium,900,2,1999,1999.5,3053349.42,3010889.613,6064239.033,46.614 +World,Medium,900,2,2000,2000.5,3093433.858,3050059.9480000003,6143493.806,47.223 +World,Medium,900,2,2001,2001.5,3133601.7610000004,3089024.77,6222626.531,47.832 +World,Medium,900,2,2002,2002.5,3173900.4489999996,3127872.723,6301773.172,48.44 +World,Medium,900,2,2003,2003.5,3214422.0310000004,3166763.11,6381185.141,49.051 +World,Medium,900,2,2004,2004.5,3255262.626,3205896.765,6461159.391,49.665 +World,Medium,900,2,2005,2005.5,3296485.267,3245421.689,6541906.956,50.286 +World,Medium,900,2,2006,2006.5,3338132.9289999995,3285384.988,6623517.917,50.913000000000004 +World,Medium,900,2,2007,2007.5,3380183.02,3325763.623,6705946.642999999,51.547 +World,Medium,900,2,2008,2008.5,3422546.3819999998,3366542.29,6789088.672,52.18600000000001 +World,Medium,900,2,2009,2009.5,3465089.423,3407677.565,6872766.988,52.82899999999999 +World,Medium,900,2,2010,2010.5,3507703.635,3449119.953,6956823.5879999995,53.475 +World,Medium,900,2,2011,2011.5,3550332.5930000003,3490861.575,7041194.168,54.123999999999995 +World,Medium,900,2,2012,2012.5,3592963.006,3532864.9510000004,7125827.957,54.773999999999994 +World,Medium,900,2,2013,2013.5,3635575.332,3575006.709,7210582.041,55.426 +World,Medium,900,2,2014,2014.5,3678161.837,3617128.922,7295290.759,56.077 +World,Medium,900,2,2015,2015.5,3720696.374,3659100.5930000003,7379796.967,56.727 +World,Medium,900,2,2016,2016.5,3763157.2210000004,3700864.713,7464021.933999999,57.373999999999995 +World,Medium,900,2,2017,2017.5,3805469.0930000003,3742389.807,7547858.9,58.018 +World,Medium,900,2,2018,2018.5,3847487.861,3783603.252,7631091.113,58.658 +World,Medium,900,2,2019,2019.5,3889034.611,3824433.5939999996,7713468.205,59.291000000000004 +World,Medium,900,2,2020,2020.5,3929973.953,3864824.776,7794798.728999999,59.917 +World,Medium,900,2,2021,2021.5,3970238.39,3904727.3419999997,7874965.732000001,60.533 +World,Medium,900,2,2022,2022.5,4009829.762,3944122.815,7953952.5770000005,61.14 +World,Medium,900,2,2023,2023.5,4048771.753,3983028.585,8031800.3379999995,61.738 +World,Medium,900,2,2024,2024.5,4087120.942,4021484.313,8108605.255,62.32899999999999 +World,Medium,900,2,2025,2025.5,4124919.51,4059517.943,8184437.453,62.912 +World,Medium,900,2,2026,2026.5,4162157.7630000003,4097118.8880000003,8259276.651000001,63.486999999999995 +World,Medium,900,2,2027,2027.5,4198812.392,4134265.9260000004,8333078.318,64.054 +World,Medium,900,2,2028,2028.5,4234898.159,4170965.142,8405863.301,64.61399999999999 +World,Medium,900,2,2029,2029.5,4270434.916999999,4207225.806,8477660.723,65.166 +World,Medium,900,2,2030,2030.5,4305436.923,4243050.448,8548487.371,65.71 +World,Medium,900,2,2031,2031.5,4339910.899,4278438.555,8618349.454,66.247 +World,Medium,900,2,2032,2032.5,4373852.541999999,4313375.331,8687227.873,66.777 +World,Medium,900,2,2033,2033.5,4407252.206,4347831.306,8755083.512,67.298 +World,Medium,900,2,2034,2034.5,4440095.078,4381767.627,8821862.705,67.811 +World,Medium,900,2,2035,2035.5,4472370.475,4415153.754,8887524.229,68.316 +World,Medium,900,2,2036,2036.5,4504074.999,4447973.886,8952048.885,68.812 +World,Medium,900,2,2037,2037.5,4535212.7639999995,4480224.852,9015437.616,69.29899999999999 +World,Medium,900,2,2038,2038.5,4565789.971,4511903.674,9077693.645,69.778 +World,Medium,900,2,2039,2039.5,4595815.916,4543012.646000001,9138828.562,70.248 +World,Medium,900,2,2040,2040.5,4625296.608,4573550.774,9198847.382000001,70.709 +World,Medium,900,2,2041,2041.5,4654233.007,4603512.476,9257745.483,71.16199999999999 +World,Medium,900,2,2042,2042.5,4682621.46,4632886.693,9315508.152999999,71.60600000000001 +World,Medium,900,2,2043,2043.5,4710457.197,4661661.05,9372118.247000001,72.041 +World,Medium,900,2,2044,2044.5,4737734.143,4689821.239,9427555.382000001,72.467 +World,Medium,900,2,2045,2045.5,4764446.973999999,4717356.298,9481803.272,72.884 +World,Medium,900,2,2046,2046.5,4790594.206,4744260.467,9534854.673,73.292 +World,Medium,900,2,2047,2047.5,4816175.052,4770532.697,9586707.749,73.691 +World,Medium,900,2,2048,2048.5,4841185.259,4796172.061000001,9637357.32,74.08 +World,Medium,900,2,2049,2049.5,4865620.226,4821179.92,9686800.146,74.46 +World,Medium,900,2,2050,2050.5,4889476.137,4845557.763,9735033.9,74.831 +World,Medium,900,2,2051,2051.5,4912753.77,4869307.988,9782061.758,75.192 +World,Medium,900,2,2052,2052.5,4935453.691000001,4892431.75,9827885.441,75.544 +World,Medium,900,2,2053,2053.5,4957572.608,4914928.954,9872501.562,75.887 +World,Medium,900,2,2054,2054.5,4979106.4,4936798.851,9915905.251,76.221 +World,Medium,900,2,2055,2055.5,5000054.515,4958044.231000001,9958098.746,76.545 +World,Medium,900,2,2056,2056.5,5020416.864,4978668.303,9999085.167000001,76.86 +World,Medium,900,2,2057,2057.5,5040200.141,4998681.121,10038881.262,77.166 +World,Medium,900,2,2058,2058.5,5059417.113,5018100.967,10077518.08,77.46300000000001 +World,Medium,900,2,2059,2059.5,5078085.161,5036951.199,10115036.36,77.752 +World,Medium,900,2,2060,2060.5,5096218.399,5055251.284,10151469.683,78.032 +World,Medium,900,2,2061,2061.5,5113824.311000001,5073012.898,10186837.208999999,78.304 +World,Medium,900,2,2062,2062.5,5130906.26,5090242.78,10221149.04,78.567 +World,Medium,900,2,2063,2063.5,5147469.268,5106949.7360000005,10254419.004,78.82300000000001 +World,Medium,900,2,2064,2064.5,5163517.276000001,5123141.078,10286658.354,79.071 +World,Medium,900,2,2065,2065.5,5179054.658,5138824.657,10317879.315,79.311 +World,Medium,900,2,2066,2066.5,5194087.268999999,5154010.81,10348098.079,79.543 +World,Medium,900,2,2067,2067.5,5208621.301,5168709.529,10377330.83,79.768 +World,Medium,900,2,2068,2068.5,5222662.0030000005,5182928.529,10405590.532,79.985 +World,Medium,900,2,2069,2069.5,5236214.416999999,5196674.719,10432889.136,80.195 +World,Medium,900,2,2070,2070.5,5249283.714,5209955.787,10459239.501,80.398 +World,Medium,900,2,2071,2071.5,5261875.63,5222779.228,10484654.858,80.593 +World,Medium,900,2,2072,2072.5,5273995.495,5235154.907,10509150.402,80.781 +World,Medium,900,2,2073,2073.5,5285647.053,5247095.808,10532742.861,80.96300000000001 +World,Medium,900,2,2074,2074.5,5296833.337,5258616.666,10555450.002999999,81.137 +World,Medium,900,2,2075,2075.5,5307558.352,5269729.843,10577288.195,81.305 +World,Medium,900,2,2076,2076.5,5317828.46,5280445.712,10598274.172,81.46600000000001 +World,Medium,900,2,2077,2077.5,5327650.719,5290770.19,10618420.909,81.62100000000001 +World,Medium,900,2,2078,2078.5,5337030.84,5300705.978999999,10637736.819,81.77 +World,Medium,900,2,2079,2079.5,5345975.152,5310253.081,10656228.233,81.91199999999999 +World,Medium,900,2,2080,2080.5,5354490.414,5319414.04,10673904.454,82.04799999999999 +World,Medium,900,2,2081,2081.5,5362581.26,5328192.075,10690773.335,82.177 +World,Medium,900,2,2082,2082.5,5370256.1,5336596.326,10706852.426,82.301 +World,Medium,900,2,2083,2083.5,5377530.581,5344640.794,10722171.375,82.419 +World,Medium,900,2,2084,2084.5,5384423.2979999995,5352342.146000001,10736765.444,82.531 +World,Medium,900,2,2085,2085.5,5390949.038,5359713.315,10750662.353,82.63799999999999 +World,Medium,900,2,2086,2086.5,5397115.414,5366758.609,10763874.023,82.73899999999999 +World,Medium,900,2,2087,2087.5,5402924.365,5373477.654,10776402.019000001,82.835 +World,Medium,900,2,2088,2088.5,5408377.091,5379871.857000001,10788248.947999999,82.927 +World,Medium,900,2,2089,2089.5,5413472.043,5385941.323,10799413.365999999,83.012 +World,Medium,900,2,2090,2090.5,5418208.072000001,5391684.231000001,10809892.303,83.09299999999999 +World,Medium,900,2,2091,2091.5,5422585.5139999995,5397097.129,10819682.643,83.16799999999999 +World,Medium,900,2,2092,2092.5,5426605.848999999,5402175.11,10828780.959,83.238 +World,Medium,900,2,2093,2093.5,5430270.716,5406911.3610000005,10837182.077,83.303 +World,Medium,900,2,2094,2094.5,5433580.881,5411297.917,10844878.798,83.36200000000001 +World,Medium,900,2,2095,2095.5,5436535.751,5415324.393999999,10851860.145,83.416 +World,Medium,900,2,2096,2096.5,5439132.293,5418979.294,10858111.587000001,83.464 +World,Medium,900,2,2097,2097.5,5441365.752,5422249.024,10863614.775999999,83.506 +World,Medium,900,2,2098,2098.5,5443228.989,5425118.647000001,10868347.636,83.542 +World,Medium,900,2,2099,2099.5,5444712.816000001,5427571.318,10872284.134000001,83.573 +World,Medium,900,2,2100,2100.5,5445805.4629999995,5429588.256,10875393.719,83.596 +China,Medium,156,2,1950,1950.5,287739.865,266679.404,554419.269,59.055 +China,Medium,156,2,1951,1951.5,295567.965,274341.143,569909.108,60.705 +China,Medium,156,2,1952,1952.5,301939.82399999996,280636.673,582576.497,62.053999999999995 +China,Medium,156,2,1953,1953.5,307333.563,286032.31899999996,593365.882,63.203 +China,Medium,156,2,1954,1954.5,312143.382,290908.934,603052.316,64.235 +China,Medium,156,2,1955,1955.5,316679.542,295562.01,612241.552,65.214 +China,Medium,156,2,1956,1956.5,321165.115,300198.118,621363.233,66.185 +China,Medium,156,2,1957,1957.5,325739.211,304938.437,630677.6479999999,67.178 +China,Medium,156,2,1958,1958.5,330466.798,309828.979,640295.777,68.202 +China,Medium,156,2,1959,1959.5,335354.975,314857.756,650212.731,69.258 +China,Medium,156,2,1960,1960.5,340401.908,320006.146,660408.054,70.344 +China,Medium,156,2,1961,1961.5,345648.969,325303.732,670952.701,71.468 +China,Medium,156,2,1962,1962.5,351226.376,330876.278,682102.6540000001,72.655 +China,Medium,156,2,1963,1963.5,357372.80100000004,336966.283,694339.084,73.959 +China,Medium,156,2,1964,1964.5,364379.894,343874.708,708254.6020000001,75.441 +China,Medium,156,2,1965,1965.5,372429.283,351789.68700000003,724218.97,77.141 +China,Medium,156,2,1966,1966.5,381611.05799999996,360803.82899999997,742414.887,79.079 +China,Medium,156,2,1967,1967.5,391796.727,370784.44899999996,762581.176,81.22800000000001 +China,Medium,156,2,1968,1968.5,402668.343,381406.37200000003,784074.715,83.51700000000001 +China,Medium,156,2,1969,1969.5,413776.039,392209.902,805985.941,85.851 +China,Medium,156,2,1970,1970.5,424765.456,402835.929,827601.385,88.15299999999999 +China,Medium,156,2,1971,1971.5,435557.24700000003,413202.46200000006,848759.709,90.40700000000001 +China,Medium,156,2,1972,1972.5,446159.375,423326.58700000006,869485.962,92.615 +China,Medium,156,2,1973,1973.5,456413.55299999996,433071.815,889485.368,94.745 +China,Medium,156,2,1974,1974.5,466158.309,442305.89700000006,908464.2059999999,96.766 +China,Medium,156,2,1975,1975.5,475291.833,450949.05600000004,926240.8890000001,98.66 +China,Medium,156,2,1976,1976.5,483746.63,458938.782,942685.412,100.412 +China,Medium,156,2,1977,1977.5,491570.92299999995,466320.348,957891.271,102.031 +China,Medium,156,2,1978,1978.5,498936.41,473269.031,972205.441,103.556 +China,Medium,156,2,1979,1979.5,506094.367,480037.847,986132.214,105.039 +China,Medium,156,2,1980,1980.5,513254.169,486835.059,1000089.228,106.52600000000001 +China,Medium,156,2,1981,1981.5,520383.823,493638.388,1014022.2109999999,108.01 +China,Medium,156,2,1982,1982.5,527494.38,500454.609,1027948.9890000001,109.494 +China,Medium,156,2,1983,1983.5,534882.8539999999,507548.547,1042431.401,111.036 +China,Medium,156,2,1984,1984.5,542922.384,515249.589,1058171.973,112.713 +China,Medium,156,2,1985,1985.5,551836.686,523752.677,1075589.363,114.568 +China,Medium,156,2,1986,1986.5,561798.689,533215.417,1095014.106,116.637 +China,Medium,156,2,1987,1987.5,572625.011,543470.464,1116095.475,118.883 +China,Medium,156,2,1988,1988.5,583740.46,553983.774,1137724.2340000002,121.186 +China,Medium,156,2,1989,1989.5,594344.178,564013.215,1158357.393,123.384 +China,Medium,156,2,1990,1990.5,603859.475,573024.206,1176883.6809999999,125.35799999999999 +China,Medium,156,2,1991,1991.5,612077.869,580819.4079999999,1192897.277,127.06299999999999 +China,Medium,156,2,1992,1992.5,619162.85,587548.3929999999,1206711.243,128.535 +China,Medium,156,2,1993,1993.5,625367.136,593449.923,1218817.0590000001,129.82399999999998 +China,Medium,156,2,1994,1994.5,631105.159,598914.8670000001,1230020.0259999998,131.018 +China,Medium,156,2,1995,1995.5,636686.865,604233.674,1240920.539,132.179 +China,Medium,156,2,1996,1996.5,642170.0970000001,609466.081,1251636.178,133.32 +China,Medium,156,2,1997,1997.5,647469.136,614526.881,1261996.017,134.423 +China,Medium,156,2,1998,1998.5,652586.59,619395.759,1271982.3490000002,135.487 +China,Medium,156,2,1999,1999.5,657496.739,624018.094,1281514.8329999999,136.503 +China,Medium,156,2,2000,2000.5,662187.757,628363.01,1290550.767,137.465 +China,Medium,156,2,2001,2001.5,666683.3420000001,632446.405,1299129.747,138.379 +China,Medium,156,2,2002,2002.5,671028.743,636323.5129999999,1307352.256,139.255 +China,Medium,156,2,2003,2003.5,675255.679,640047.843,1315303.522,140.102 +China,Medium,156,2,2004,2004.5,679398.8559999999,643685.7829999999,1323084.639,140.93 +China,Medium,156,2,2005,2005.5,683485.9,647290.48,1330776.38,141.75 +China,Medium,156,2,2006,2006.5,687528.8509999999,650879.793,1338408.644,142.563 +China,Medium,156,2,2007,2007.5,691533.479,654460.412,1345993.8909999998,143.371 +China,Medium,156,2,2008,2008.5,695511.0179999999,658058.462,1353569.48,144.178 +China,Medium,156,2,2009,2009.5,699470.312,661699.098,1361169.41,144.987 +China,Medium,156,2,2010,2010.5,703414.0190000001,665396.585,1368810.604,145.80100000000002 +China,Medium,156,2,2011,2011.5,707339.988,669157.645,1376497.6330000001,146.62 +China,Medium,156,2,2012,2012.5,711236.6309999999,672969.777,1384206.408,147.441 +China,Medium,156,2,2013,2013.5,715082.615,676800.72,1391883.335,148.259 +China,Medium,156,2,2014,2014.5,718849.365,680604.6009999999,1399453.966,149.065 +China,Medium,156,2,2015,2015.5,722508.0059999999,684339.8620000001,1406847.868,149.85299999999998 +China,Medium,156,2,2016,2016.5,726052.413,687996.94,1414049.3530000001,150.62 +China,Medium,156,2,2017,2017.5,729462.38,691559.4140000001,1421021.794,151.362 +China,Medium,156,2,2018,2018.5,732677.7829999999,694970.0059999999,1427647.789,152.06799999999998 +China,Medium,156,2,2019,2019.5,735624.2590000001,698159.433,1433783.6919999998,152.722 +China,Medium,156,2,2020,2020.5,738247.34,701076.434,1439323.774,153.312 +China,Medium,156,2,2021,2021.5,740521.76,703694.3420000001,1444216.102,153.833 +China,Medium,156,2,2022,2022.5,742454.663,706016.7409999999,1448471.404,154.286 +China,Medium,156,2,2023,2023.5,744065.907,708061.767,1452127.674,154.67600000000002 +China,Medium,156,2,2024,2024.5,745391.547,709863.315,1455254.862,155.009 +China,Medium,156,2,2025,2025.5,746460.564,711447.684,1457908.2480000001,155.291 +China,Medium,156,2,2026,2026.5,747276.937,712815.314,1460092.251,155.524 +China,Medium,156,2,2027,2027.5,747838.01,713959.628,1461797.638,155.70600000000002 +China,Medium,156,2,2028,2028.5,748159.905,714892.941,1463052.846,155.839 +China,Medium,156,2,2029,2029.5,748261.449,715629.887,1463891.336,155.929 +China,Medium,156,2,2030,2030.5,748158.67,716181.48,1464340.15,155.976 +China,Medium,156,2,2031,2031.5,747862.303,716555.199,1464417.5019999999,155.985 +China,Medium,156,2,2032,2032.5,747379.071,716751.3509999999,1464130.4219999998,155.954 +China,Medium,156,2,2033,2033.5,746715.948,716764.8979999999,1463480.846,155.885 +China,Medium,156,2,2034,2034.5,745878.396,716586.728,1462465.124,155.77700000000002 +China,Medium,156,2,2035,2035.5,744872.12,716210.91,1461083.03,155.63 +China,Medium,156,2,2036,2036.5,743703.8809999999,715637.291,1459341.1719999998,155.444 +China,Medium,156,2,2037,2037.5,742381.178,714870.995,1457252.1730000002,155.221 +China,Medium,156,2,2038,2038.5,740910.927,713917.517,1454828.4440000001,154.963 +China,Medium,156,2,2039,2039.5,739299.95,712784.316,1452084.2659999998,154.671 +China,Medium,156,2,2040,2040.5,737554.247,711477.173,1449031.42,154.346 +China,Medium,156,2,2041,2041.5,735680.127,710000.1209999999,1445680.2480000001,153.989 +China,Medium,156,2,2042,2042.5,733681.708,708353.4240000001,1442035.132,153.601 +China,Medium,156,2,2043,2043.5,731559.998,706534.714,1438094.7119999998,153.181 +China,Medium,156,2,2044,2044.5,729314.3659999999,704539.7540000001,1433854.12,152.72899999999998 +China,Medium,156,2,2045,2045.5,726945.6240000001,702366.6209999999,1429312.245,152.245 +China,Medium,156,2,2046,2046.5,724457.8670000001,700018.6540000001,1424476.521,151.73 +China,Medium,156,2,2047,2047.5,721856.9079999999,697501.7170000001,1419358.625,151.185 +China,Medium,156,2,2048,2048.5,719147.363,694819.8879999999,1413967.251,150.611 +China,Medium,156,2,2049,2049.5,716334.2890000001,691978.021,1408312.31,150.009 +China,Medium,156,2,2050,2050.5,713423.046,688982.1209999999,1402405.167,149.379 +China,Medium,156,2,2051,2051.5,710419.052,685838.6590000001,1396257.711,148.725 +China,Medium,156,2,2052,2052.5,707328.2409999999,682556.026,1389884.267,148.046 +China,Medium,156,2,2053,2053.5,704157.431,679145.186,1383302.6169999999,147.345 +China,Medium,156,2,2054,2054.5,700913.91,675618.718,1376532.628,146.624 +China,Medium,156,2,2055,2055.5,697605.077,671989.066,1369594.1430000002,145.884 +China,Medium,156,2,2056,2056.5,694236.435,668265.517,1362501.9519999998,145.129 +China,Medium,156,2,2057,2057.5,690814.766,664458.498,1355273.264,144.359 +China,Medium,156,2,2058,2058.5,687350.2579999999,660583.299,1347933.5569999998,143.577 +China,Medium,156,2,2059,2059.5,683854.2890000001,656656.81,1340511.0990000002,142.787 +China,Medium,156,2,2060,2060.5,680336.5190000001,652694.113,1333030.632,141.99 +China,Medium,156,2,2061,2061.5,676802.515,648705.017,1325507.5320000001,141.189 +China,Medium,156,2,2062,2062.5,673256.2,644698.187,1317954.387,140.384 +China,Medium,156,2,2063,2063.5,669703.0129999999,640685.639,1310388.652,139.578 +China,Medium,156,2,2064,2064.5,666147.951,636679.512,1302827.463,138.773 +China,Medium,156,2,2065,2065.5,662594.759,632689.816,1295284.575,137.969 +China,Medium,156,2,2066,2066.5,659047.11,628724.807,1287771.9170000001,137.16899999999998 +China,Medium,156,2,2067,2067.5,655506.156,624789.118,1280295.274,136.373 +China,Medium,156,2,2068,2068.5,651969.562,620883.947,1272853.509,135.58 +China,Medium,156,2,2069,2069.5,648432.998,617008.089,1265441.087,134.79 +China,Medium,156,2,2070,2070.5,644893.129,613161.094,1258054.223,134.004 +China,Medium,156,2,2071,2071.5,641351.274,609346.35,1250697.624,133.22 +China,Medium,156,2,2072,2072.5,637808.587,605567.542,1243376.129,132.44 +China,Medium,156,2,2073,2073.5,634261.382,601824.674,1236086.0559999999,131.664 +China,Medium,156,2,2074,2074.5,630704.816,598116.8420000001,1228821.658,130.89 +China,Medium,156,2,2075,2075.5,627136.211,594443.942,1221580.153,130.119 +China,Medium,156,2,2076,2076.5,623555.764,590807.931,1214363.695,129.35 +China,Medium,156,2,2077,2077.5,619967.166,587211.554,1207178.72,128.585 +China,Medium,156,2,2078,2078.5,616375.748,583656.551,1200032.299,127.823 +China,Medium,156,2,2079,2079.5,612788.74,580144.787,1192933.527,127.06700000000001 +China,Medium,156,2,2080,2080.5,609212.75,576678.547,1185891.297,126.31700000000001 +China,Medium,156,2,2081,2081.5,605650.279,573259.213,1178909.492,125.573 +China,Medium,156,2,2082,2082.5,602104.505,569889.834,1171994.3390000002,124.837 +China,Medium,156,2,2083,2083.5,598583.619,566576.527,1165160.146,124.109 +China,Medium,156,2,2084,2084.5,595097.241,563326.747,1158423.988,123.391 +China,Medium,156,2,2085,2085.5,591652.894,560146.31,1151799.2040000001,122.686 +China,Medium,156,2,2086,2086.5,588253.0129999999,557035.545,1145288.558,121.992 +China,Medium,156,2,2087,2087.5,584898.214,553994.4839999999,1138892.6979999999,121.311 +China,Medium,156,2,2088,2088.5,581591.547,551027.779,1132619.326,120.64299999999999 +China,Medium,156,2,2089,2089.5,578335.645,548140.749,1126476.394,119.988 +China,Medium,156,2,2090,2090.5,575131.301,545335.627,1120466.928,119.348 +China,Medium,156,2,2091,2091.5,571976.983,542610.331,1114587.314,118.72200000000001 +China,Medium,156,2,2092,2092.5,568869.0229999999,539958.87,1108827.893,118.109 +China,Medium,156,2,2093,2093.5,565801.9870000001,537372.45,1103174.437,117.506 +China,Medium,156,2,2094,2094.5,562769.159,534840.583,1097609.742,116.914 +China,Medium,156,2,2095,2095.5,559762.949,532352.252,1092115.201,116.32799999999999 +China,Medium,156,2,2096,2096.5,556775.037,529896.299,1086671.336,115.74799999999999 +China,Medium,156,2,2097,2097.5,553796.475,527461.5970000001,1081258.072,115.17200000000001 +China,Medium,156,2,2098,2098.5,550817.703,525037.152,1075854.855,114.596 +China,Medium,156,2,2099,2099.5,547828.515,522612.036,1070440.551,114.02 +China,Medium,156,2,2100,2100.5,544818.071,520175.386,1064993.457,113.439 +United States of America,Medium,840,2,1950,1950.5,79233.218,79571.179,158804.397,17.361 +United States of America,Medium,840,2,1951,1951.5,80165.741,80706.523,160872.264,17.587 +United States of America,Medium,840,2,1952,1952.5,81281.509,81984.517,163266.02599999998,17.848 +United States of America,Medium,840,2,1953,1953.5,82534.378,83375.618,165909.99599999998,18.137 +United States of America,Medium,840,2,1954,1954.5,83884.15299999999,84852.237,168736.39,18.445999999999998 +United States of America,Medium,840,2,1955,1955.5,85296.618,86388.719,171685.337,18.769000000000002 +United States of America,Medium,840,2,1956,1956.5,86743.656,87961.35,174705.00600000002,19.099 +United States of America,Medium,840,2,1957,1957.5,88203.12,89548.35699999999,177751.47699999998,19.432000000000002 +United States of America,Medium,840,2,1958,1958.5,89658.37,91130.01699999999,180788.387,19.764 +United States of America,Medium,840,2,1959,1959.5,91097.416,92688.83300000001,183786.24899999998,20.092 +United States of America,Medium,840,2,1960,1960.5,92510.602,94209.96800000001,186720.57,20.412 +United States of America,Medium,840,2,1961,1961.5,93888.04199999999,95681.808,189569.85,20.724 +United States of America,Medium,840,2,1962,1962.5,95217.352,97096.395,192313.747,21.024 +United States of America,Medium,840,2,1963,1963.5,96482.77699999999,98449.623,194932.4,21.31 +United States of America,Medium,840,2,1964,1964.5,97667.821,99740.67599999999,197408.497,21.581 +United States of America,Medium,840,2,1965,1965.5,98763.245,100970.43400000001,199733.67899999997,21.835 +United States of America,Medium,840,2,1966,1966.5,99759.41,102136.35,201895.76,22.070999999999998 +United States of America,Medium,840,2,1967,1967.5,100664.42199999999,103240.659,203905.081,22.291 +United States of America,Medium,840,2,1968,1968.5,101509.677,104296.079,205805.75600000002,22.499000000000002 +United States of America,Medium,840,2,1969,1969.5,102339.103,105320.171,207659.27399999998,22.701 +United States of America,Medium,840,2,1970,1970.5,103185.603,106327.737,209513.34,22.904 +United States of America,Medium,840,2,1971,1971.5,104062.103,107321.976,211384.079,23.109 +United States of America,Medium,840,2,1972,1972.5,104963.948,108305.85699999999,213269.805,23.315 +United States of America,Medium,840,2,1973,1973.5,105885.329,109293.46800000001,215178.797,23.523000000000003 +United States of America,Medium,840,2,1974,1974.5,106813.662,110301.23599999999,217114.89800000002,23.735 +United States of America,Medium,840,2,1975,1975.5,107740.711,111340.539,219081.25,23.95 +United States of America,Medium,840,2,1976,1976.5,108666.035,112420.39199999999,221086.427,24.169 +United States of America,Medium,840,2,1977,1977.5,109597.272,113538.38699999999,223135.65899999999,24.393 +United States of America,Medium,840,2,1978,1978.5,110543.20199999999,114680.105,225223.307,24.622 +United States of America,Medium,840,2,1979,1979.5,111515.448,115823.873,227339.32100000003,24.853 +United States of America,Medium,840,2,1980,1980.5,112521.78199999999,116954.57800000001,229476.36,25.086 +United States of America,Medium,840,2,1981,1981.5,113568.715,118067.35,231636.065,25.323 +United States of America,Medium,840,2,1982,1982.5,114652.95199999999,119168.899,233821.85100000002,25.561999999999998 +United States of America,Medium,840,2,1983,1983.5,115760.64,120269.59599999999,236030.236,25.803 +United States of America,Medium,840,2,1984,1984.5,116871.96800000001,121384.881,238256.849,26.046 +United States of America,Medium,840,2,1985,1985.5,117974.009,122525.81300000001,240499.822,26.291999999999998 +United States of America,Medium,840,2,1986,1986.5,119063.541,123699.59599999999,242763.137,26.539 +United States of America,Medium,840,2,1987,1987.5,120149.52,124903.26,245052.78,26.789 +United States of America,Medium,840,2,1988,1988.5,121246.288,126125.97,247372.258,27.043000000000003 +United States of America,Medium,840,2,1989,1989.5,122374.171,127351.638,249725.80899999998,27.3 +United States of America,Medium,840,2,1990,1990.5,123549.353,128570.95599999999,252120.30899999998,27.561999999999998 +United States of America,Medium,840,2,1991,1991.5,124767.793,129771.57800000001,254539.371,27.826 +United States of America,Medium,840,2,1992,1992.5,126028.071,130962.537,256990.608,28.094 +United States of America,Medium,840,2,1993,1993.5,127351.15699999999,132180.973,259532.13,28.372 +United States of America,Medium,840,2,1994,1994.5,128763.429,133477.775,262241.20399999997,28.668000000000003 +United States of America,Medium,840,2,1995,1995.5,130278.69900000001,134885.042,265163.74100000004,28.988000000000003 +United States of America,Medium,840,2,1996,1996.5,131912.038,136422.97,268335.00800000003,29.335 +United States of America,Medium,840,2,1997,1997.5,133644.783,138068.851,271713.63399999996,29.704 +United States of America,Medium,840,2,1998,1998.5,135415.666,139759.643,275175.309,30.081999999999997 +United States of America,Medium,840,2,1999,1999.5,137140.99599999998,141407.152,278548.148,30.451 +United States of America,Medium,840,2,2000,2000.5,138761.58800000002,142949.326,281710.914,30.796999999999997 +United States of America,Medium,840,2,2001,2001.5,140249.955,144358.03699999998,284607.99199999997,31.113000000000003 +United States of America,Medium,840,2,2002,2002.5,141624.546,145654.766,287279.312,31.406 +United States of America,Medium,840,2,2003,2003.5,142928.38199999998,146887.185,289815.567,31.683000000000003 +United States of America,Medium,840,2,2004,2004.5,144227.34900000002,148127.314,292354.663,31.96 +United States of America,Medium,840,2,2005,2005.5,145568.081,149425.428,294993.50899999996,32.249 +United States of America,Medium,840,2,2006,2006.5,146962.229,150796.74800000002,297758.977,32.551 +United States of America,Medium,840,2,2007,2007.5,148389.984,152218.441,300608.425,32.863 +United States of America,Medium,840,2,2008,2008.5,149828.894,153657.128,303486.022,33.177 +United States of America,Medium,840,2,2009,2009.5,151244.42,155063.145,306307.565,33.486 +United States of America,Medium,840,2,2010,2010.5,152610.91,156400.559,309011.469,33.781 +United States of America,Medium,840,2,2011,2011.5,153923.75699999998,157660.294,311584.05100000004,34.063 +United States of America,Medium,840,2,2012,2012.5,155189.795,158854.09,314043.885,34.330999999999996 +United States of America,Medium,840,2,2013,2013.5,156408.505,159992.034,316400.539,34.589 +United States of America,Medium,840,2,2014,2014.5,157581.861,161091.561,318673.422,34.838 +United States of America,Medium,840,2,2015,2015.5,158712.12099999998,162166.191,320878.312,35.079 +United States of America,Medium,840,2,2016,2016.5,159798.231,163217.761,323015.99199999997,35.312 +United States of America,Medium,840,2,2017,2017.5,160840.943,164243.815,325084.75800000003,35.538000000000004 +United States of America,Medium,840,2,2018,2018.5,161847.18300000002,165249.08,327096.26300000004,35.758 +United States of America,Medium,840,2,2019,2019.5,162826.299,166238.61800000002,329064.917,35.974000000000004 +United States of America,Medium,840,2,2020,2020.5,163786.016,167216.631,331002.647,36.185 +United States of America,Medium,840,2,2021,2021.5,164729.43099999998,168185.643,332915.07399999996,36.394 +United States of America,Medium,840,2,2022,2022.5,165658.009,169147.259,334805.268,36.601 +United States of America,Medium,840,2,2023,2023.5,166575.859,170103.372,336679.231,36.806 +United States of America,Medium,840,2,2024,2024.5,167487.134,171055.428,338542.56200000003,37.01 +United States of America,Medium,840,2,2025,2025.5,168395.211,172004.393,340399.604,37.213 +United States of America,Medium,840,2,2026,2026.5,169301.417,172950.55800000002,342251.975,37.415 +United States of America,Medium,840,2,2027,2027.5,170206.89899999998,173893.8,344100.69899999996,37.617 +United States of America,Medium,840,2,2028,2028.5,171114.152,174833.695,345947.847,37.819 +United States of America,Medium,840,2,2029,2029.5,172025.652,175769.389,347795.041,38.021 +United States of America,Medium,840,2,2030,2030.5,172942.431,176699.445,349641.876,38.223 +United States of America,Medium,840,2,2031,2031.5,173866.197,177623.98100000003,351490.17799999996,38.425 +United States of America,Medium,840,2,2032,2032.5,174794.664,178540.788,353335.45200000005,38.626999999999995 +United States of America,Medium,840,2,2033,2033.5,175719.72600000002,179443.194,355162.92,38.827 +United States of America,Medium,840,2,2034,2034.5,176630.367,180322.605,356952.972,39.022 +United States of America,Medium,840,2,2035,2035.5,177518.371,181172.62600000002,358690.99700000003,39.211999999999996 +United States of America,Medium,840,2,2036,2036.5,178380.987,181990.87300000002,360371.86,39.396 +United States of America,Medium,840,2,2037,2037.5,179219.545,182778.075,361997.62,39.574 +United States of America,Medium,840,2,2038,2038.5,180035.11,183534.887,363569.99700000003,39.746 +United States of America,Medium,840,2,2039,2039.5,180830.299,184263.237,365093.536,39.912 +United States of America,Medium,840,2,2040,2040.5,181607.268,184964.88199999998,366572.15,40.074 +United States of America,Medium,840,2,2041,2041.5,182366.18600000002,185640.23899999997,368006.425,40.231 +United States of America,Medium,840,2,2042,2042.5,183106.822,186289.733,369396.555,40.383 +United States of America,Medium,840,2,2043,2043.5,183830.78,186915.525,370746.305,40.53 +United States of America,Medium,840,2,2044,2044.5,184540.09,187520.30399999997,372060.394,40.674 +United States of America,Medium,840,2,2045,2045.5,185236.65,188106.707,373343.357,40.814 +United States of America,Medium,840,2,2046,2046.5,185921.665,188676.40300000002,374598.06799999997,40.951 +United States of America,Medium,840,2,2047,2047.5,186596.355,189231.27899999998,375827.63399999996,41.086000000000006 +United States of America,Medium,840,2,2048,2048.5,187262.735,189774.509,377037.244,41.218 +United States of America,Medium,840,2,2049,2049.5,187923.02899999998,190309.65,378232.679,41.349 +United States of America,Medium,840,2,2050,2050.5,188579.208,190839.889,379419.097,41.478 +United States of America,Medium,840,2,2051,2051.5,189232.345,191367.08399999997,380599.429,41.607 +United States of America,Medium,840,2,2052,2052.5,189883.539,191892.91100000002,381776.45,41.736000000000004 +United States of America,Medium,840,2,2053,2053.5,190534.84399999998,192420.046,382954.89,41.865 +United States of America,Medium,840,2,2054,2054.5,191188.474,192951.26899999997,384139.74299999996,41.994 +United States of America,Medium,840,2,2055,2055.5,191846.063,193488.79,385334.85299999994,42.125 +United States of America,Medium,840,2,2056,2056.5,192508.44600000003,194033.858,386542.304,42.257 +United States of America,Medium,840,2,2057,2057.5,193175.556,194587.00199999998,387762.55799999996,42.39 +United States of America,Medium,840,2,2058,2058.5,193846.889,195148.59399999998,388995.48299999995,42.525 +United States of America,Medium,840,2,2059,2059.5,194521.41100000002,195718.60100000002,390240.01200000005,42.661 +United States of America,Medium,840,2,2060,2060.5,195198.145,196296.747,391494.89200000005,42.798 +United States of America,Medium,840,2,2061,2061.5,195876.59,196883.051,392759.641,42.937 +United States of America,Medium,840,2,2062,2062.5,196556.23,197476.97100000002,394033.201,43.076 +United States of America,Medium,840,2,2063,2063.5,197235.919,198076.891,395312.81,43.216 +United States of America,Medium,840,2,2064,2064.5,197914.288,198680.62,396594.908,43.356 +United States of America,Medium,840,2,2065,2065.5,198589.917,199286.177,397876.094,43.496 +United States of America,Medium,840,2,2066,2066.5,199262.08899999998,199892.635,399154.724,43.636 +United States of America,Medium,840,2,2067,2067.5,199929.62300000002,200499.0,400428.62299999996,43.775 +United States of America,Medium,840,2,2068,2068.5,200590.16,201103.092,401693.25200000004,43.913000000000004 +United States of America,Medium,840,2,2069,2069.5,201240.872,201702.39800000002,402943.27,44.05 +United States of America,Medium,840,2,2070,2070.5,201879.543,202294.861,404174.404,44.185 +United States of America,Medium,840,2,2071,2071.5,202505.163,202879.40899999999,405384.57200000004,44.317 +United States of America,Medium,840,2,2072,2072.5,203117.401,203455.438,406572.839,44.446999999999996 +United States of America,Medium,840,2,2073,2073.5,203715.712,204021.944,407737.656,44.574 +United States of America,Medium,840,2,2074,2074.5,204299.793,204578.014,408877.80700000003,44.699 +United States of America,Medium,840,2,2075,2075.5,204869.565,205123.073,409992.638,44.821000000000005 +United States of America,Medium,840,2,2076,2076.5,205424.918,205656.583,411081.501,44.94 +United States of America,Medium,840,2,2077,2077.5,205966.046,206178.59699999998,412144.643,45.056000000000004 +United States of America,Medium,840,2,2078,2078.5,206493.603,206689.938,413183.541,45.169 +United States of America,Medium,840,2,2079,2079.5,207008.556,207191.865,414200.42100000003,45.281000000000006 +United States of America,Medium,840,2,2080,2080.5,207511.92899999997,207685.46899999998,415197.398,45.39 +United States of America,Medium,840,2,2081,2081.5,208004.333,208171.37,416175.703,45.497 +United States of America,Medium,840,2,2082,2082.5,208486.67,208649.857,417136.527,45.602 +United States of America,Medium,840,2,2083,2083.5,208960.672,209121.41,418082.08200000005,45.705 +United States of America,Medium,840,2,2084,2084.5,209428.38600000003,209586.514,419014.9,45.806999999999995 +United States of America,Medium,840,2,2085,2085.5,209891.65399999998,210045.78399999999,419937.43799999997,45.908 +United States of America,Medium,840,2,2086,2086.5,210351.40600000002,210499.734,420851.14,46.008 +United States of America,Medium,840,2,2087,2087.5,210808.532,210949.358,421757.89,46.107 +United States of America,Medium,840,2,2088,2088.5,211264.603,211396.30899999998,422660.912,46.205 +United States of America,Medium,840,2,2089,2089.5,211721.343,211842.59100000001,423563.934,46.303999999999995 +United States of America,Medium,840,2,2090,2090.5,212180.09,212289.832,424469.922,46.403 +United States of America,Medium,840,2,2091,2091.5,212641.671,212739.046,425380.717,46.503 +United States of America,Medium,840,2,2092,2092.5,213106.46600000001,213190.72600000002,426297.19200000004,46.603 +United States of America,Medium,840,2,2093,2093.5,213574.50699999998,213645.047,427219.554,46.70399999999999 +United States of America,Medium,840,2,2094,2094.5,214045.658,214102.053,428147.711,46.805 +United States of America,Medium,840,2,2095,2095.5,214519.734,214561.93,429081.664,46.907 +United States of America,Medium,840,2,2096,2096.5,214996.568,215025.012,430021.58,47.01 +United States of America,Medium,840,2,2097,2097.5,215476.046,215491.866,430967.912,47.114 +United States of America,Medium,840,2,2098,2098.5,215958.082,215963.3,431921.38200000004,47.218 +United States of America,Medium,840,2,2099,2099.5,216442.63199999998,216440.331,432882.963,47.323 +United States of America,Medium,840,2,2100,2100.5,216929.693,216924.198,433853.891,47.428999999999995 diff --git a/Master/texmf-dist/doc/lualatex/pyluatex/example/readme-custom-env.tex b/Master/texmf-dist/doc/lualatex/pyluatex/example/readme-custom-env.tex new file mode 100644 index 00000000000..b3257fbb013 --- /dev/null +++ b/Master/texmf-dist/doc/lualatex/pyluatex/example/readme-custom-env.tex @@ -0,0 +1,25 @@ +%% Copyright 2021-2022 Tobias Enderle +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. + +\documentclass{article} + +\usepackage{pyluatex} + +\newenvironment{custompy} +{\PyLTVerbatimEnv\begin{python}} +{\end{python}} + +\begin{document} + +\begin{custompy} +print('Hello PyLuaTeX') +\end{custompy} + +\end{document} diff --git a/Master/texmf-dist/doc/lualatex/pyluatex/example/readme-example.tex b/Master/texmf-dist/doc/lualatex/pyluatex/example/readme-example.tex new file mode 100644 index 00000000000..177aa40c15c --- /dev/null +++ b/Master/texmf-dist/doc/lualatex/pyluatex/example/readme-example.tex @@ -0,0 +1,32 @@ +%% Copyright 2021-2022 Tobias Enderle +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. + +\documentclass{article} + +\usepackage{pyluatex} + +\begin{python} +import math +import random + +random.seed(0) + +greeting = 'Hello PyLuaTeX!' +\end{python} + +\newcommand{\randint}[2]{\py{random.randint(#1, #2)}} + +\begin{document} +\py{greeting} + +$\sqrt{371} = \py{math.sqrt(371)}$ + +\randint{2}{5} +\end{document} diff --git a/Master/texmf-dist/doc/lualatex/pyluatex/example/repl.tex b/Master/texmf-dist/doc/lualatex/pyluatex/example/repl.tex new file mode 100644 index 00000000000..28de0090cf9 --- /dev/null +++ b/Master/texmf-dist/doc/lualatex/pyluatex/example/repl.tex @@ -0,0 +1,84 @@ +%% Copyright 2021-2022 Tobias Enderle +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. + +\documentclass{article} + +\usepackage{pyluatex} +\usepackage{listings} +\usepackage{xcolor} +\lstset{ + language=Python, + breaklines=true, + framesep=1ex, + frame=lrtb, + framerule=0pt, + numbers=none, + basicstyle=\ttfamily, + keywordstyle=\bfseries\color{green!40!black}, + stringstyle=\bfseries\color{red!80!black}, + identifierstyle=\color{blue}, + backgroundcolor=\color{gray!10!white}, +} +\usepackage{luacode} + +\begin{luacode} +function pytypeset() + tex.print("\\begin{lstlisting}") + tex.print(pyluatex.get_last_output()) + tex.print("\\end{lstlisting}") +end +\end{luacode} + +\newcommand{\pytypeset}{\directlua{pytypeset()}} + +\newenvironment{pyrepl} +{\PyLTVerbatimEnv\begin{pythonrepl}} +{\end{pythonrepl}\pytypeset} + +\begin{filecontents*}{repl.py} +def square(x): + return x**2 + +square(5) +\end{filecontents*} + +\title{PyLuaTeX Example -- Typesetting Python Interactive Console Sessions} +\author{Tobias Enderle} + +\begin{document} + +\maketitle + +PyLuaTeX allows you to run and typeset Python code in an interactive console +or read–eval–print loop (REPL) fashion. Very much like in an IPython session, +code is prefixed with \verb|>>>| (or \verb|...| in case of multi-line commands) +and the results are printed automatically. + +Both code and output are stored in PyLuaTeX's ouput buffer and can be accessed +by \verb|pyluatex.get_last_output()|. In this way, you can adjust the typesetting +to your needs. For examples on typesetting see \verb|typesetting-listings.tex| +and \verb|typesetting-minted.tex|. + +In the following example, we use the custom environment \verb|pyrepl|, which is +based on the \verb|pythonrepl| environment provided by PyLuaTeX. +\begin{pyrepl} +def fun(): + print('Hello PyLuaTeX!') + +3 + 1 *\ +4 +fun() +\end{pyrepl} + +Python sessions can also be read from files: +\pyfilerepl{repl.py} +\pytypeset + +\end{document} diff --git a/Master/texmf-dist/doc/lualatex/pyluatex/example/sessions.tex b/Master/texmf-dist/doc/lualatex/pyluatex/example/sessions.tex new file mode 100644 index 00000000000..8d206a6b0c0 --- /dev/null +++ b/Master/texmf-dist/doc/lualatex/pyluatex/example/sessions.tex @@ -0,0 +1,54 @@ +%% Copyright 2021-2022 Tobias Enderle +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. + +\documentclass{article} + +\usepackage{pyluatex} + +\title{PyLuaTeX Example -- Sessions} +\author{Tobias Enderle} + +\pysession{session-a} +\pyc{greeting = "Hi, I'm session A"} +\pyc{var = 'Only available in session A'} + +\pysession{session-b} +\pyc{greeting = "Hi, I'm session B"} + +\begin{document} + +\maketitle + +In this document the use of sessions is demonstrated. +Sessions provide a way to structure and separate code. +Variables, function definitions, etc. of one session are only accessible +by that very session. +This can be helpful if you have long documents with a lot of code. + +\paragraph{Session A} +\pysession{session-a} +The content of the variable \texttt{greeting} in session A is:\\ +\py{greeting} + +\paragraph{Session B} +\pysession{session-b} +The content of the variable \texttt{greeting} in session B is:\\ +\py{greeting} + +The variable \texttt{var} is only defined in session A, therefore +an error is printed here: +\begin{python} +try: + print(var) +except NameError as e: + print(e) +\end{python} + +\end{document} diff --git a/Master/texmf-dist/doc/lualatex/pyluatex/example/typesetting-example.tex b/Master/texmf-dist/doc/lualatex/pyluatex/example/typesetting-example.tex new file mode 100644 index 00000000000..7c6cc910154 --- /dev/null +++ b/Master/texmf-dist/doc/lualatex/pyluatex/example/typesetting-example.tex @@ -0,0 +1,43 @@ +%% Copyright 2021-2022 Tobias Enderle +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. + +\documentclass{article} + +\usepackage{pyluatex} +\usepackage{listings} +\usepackage{luacode} + +\begin{luacode} +function pytypeset() + tex.print("\\begin{lstlisting}[language=Python]") + tex.print(pyluatex.get_last_code()) + tex.print("\\end{lstlisting}") + tex.print("") -- ensure newline +end +\end{luacode} + +\newcommand*{\pytypeset}{% + \noindent\textbf{Input:} + \directlua{pytypeset()} + \textbf{Output:} + \begin{center} + \directlua{tex.print(pyluatex.get_last_output())} + \end{center} +} + +\begin{document} + +\begin{pythonq} +greeting = 'Hello PyLuaTeX!' +print(greeting) +\end{pythonq} +\pytypeset + +\end{document} diff --git a/Master/texmf-dist/doc/lualatex/pyluatex/example/typesetting-listings.tex b/Master/texmf-dist/doc/lualatex/pyluatex/example/typesetting-listings.tex new file mode 100644 index 00000000000..f83a6abd9a9 --- /dev/null +++ b/Master/texmf-dist/doc/lualatex/pyluatex/example/typesetting-listings.tex @@ -0,0 +1,94 @@ +%% Copyright 2021-2022 Tobias Enderle +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. + +\documentclass{article} + +\usepackage{pyluatex} +\usepackage{listings} +\usepackage{xcolor} +\lstset{ + language=Python, + breaklines=true, + framesep=1ex, + frame=lrtb, + framerule=0pt, + numbers=none, + basicstyle=\ttfamily, + keywordstyle=\bfseries\color{green!40!black}, + stringstyle=\bfseries\color{red!80!black}, + identifierstyle=\color{blue}, + backgroundcolor=\color{gray!10!white}, +} + +\usepackage{luacode} +\begin{luacode} +function pytypeset() + tex.print("\\begin{lstlisting}") + tex.print(pyluatex.get_last_code()) + tex.print("\\end{lstlisting}") +end + +function pytypeset_inline() + -- assume there is only one line of code in get_last_code() + tex.print("\\lstinline[columns=fixed]@" .. pyluatex.get_last_code()[1] .. "@") +end +\end{luacode} + +\newcommand*{\pytypeset}{% + \noindent\textbf{Input:} + \directlua{pytypeset()} + \textbf{Output:} + \begin{center} + \directlua{tex.print(pyluatex.get_last_output())} + \end{center} +} +\newcommand*{\coderaw}{\directlua{tex.print(pyluatex.get_last_code())}} +\newcommand*{\codeinline}{\directlua{pytypeset_inline()}} +\newcommand*{\outputraw}{\directlua{tex.print(pyluatex.get_last_output())}} + +\title{PyLuaTeX Example -- Typesetting Code Using the \emph{listings} Package} +\author{Tobias Enderle} + +\begin{document} + +\maketitle + +\section*{Typesetting of Code Blocks and Ouput} +\begin{pythonq} +msg = 'Hello' + +print(msg) +\end{pythonq} +\pytypeset + +\section*{Typesetting of Inline Code and Ouput} +Calling \pycq{print('test', end='')}\codeinline\ in Python outputs ``\outputraw''. + +\begin{python} +x = 4 +\end{python} +The value of \pyq{x}\codeinline\ is \outputraw. + +The result of \pyq{17 + 300}$\coderaw$ is \outputraw. + +\section*{Custom Environments} +You can create a custom environment for typesetting: + +\newenvironment{typesetpython} +{\PyLTVerbatimEnv\begin{pythonq}} +{\end{pythonq}\pytypeset} + +\begin{typesetpython} +msg = 'Custom environment' + +print(msg) +\end{typesetpython} + +\end{document} diff --git a/Master/texmf-dist/doc/lualatex/pyluatex/example/typesetting-minted.tex b/Master/texmf-dist/doc/lualatex/pyluatex/example/typesetting-minted.tex new file mode 100644 index 00000000000..f36c7b802b8 --- /dev/null +++ b/Master/texmf-dist/doc/lualatex/pyluatex/example/typesetting-minted.tex @@ -0,0 +1,81 @@ +%% Copyright 2021-2022 Tobias Enderle +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. + +\documentclass{article} + +\usepackage{pyluatex} +\usepackage{minted} + +\usepackage{luacode} +\begin{luacode} +function pytypeset() + tex.print("\\begin{minted}[bgcolor=gray!10!white]{python}") + tex.print(pyluatex.get_last_code()) + tex.print("\\end{minted}") + tex.print("") -- ensure newline +end + +function pytypeset_inline() + -- assume there is only one line of code in get_last_code() + tex.print("\\mintinline{python}@" .. pyluatex.get_last_code()[1] .. "@") +end +\end{luacode} + +\newcommand*{\pytypeset}{% + \noindent\textbf{Input:} + \directlua{pytypeset()} + \textbf{Output:} + \begin{center} + \directlua{tex.print(pyluatex.get_last_output())} + \end{center} +} +\newcommand*{\coderaw}{\directlua{tex.print(pyluatex.get_last_code())}} +\newcommand*{\codeinline}{\directlua{pytypeset_inline()}} +\newcommand*{\outputraw}{\directlua{tex.print(pyluatex.get_last_output())}} + +\title{PyLuaTeX Example -- Typesetting Code Using the \emph{minted} Package} +\author{Tobias Enderle} + +\begin{document} + +\maketitle + +\section*{Typesetting of Code Blocks and Ouput} +\begin{pythonq} +msg = 'Hello' + +print(msg) +\end{pythonq} +\pytypeset + +\section*{Typesetting of Inline Code and Ouput} +Calling \pycq{print('test', end='')}\codeinline\ in Python outputs ``\outputraw''. + +\begin{python} +x = 4 +\end{python} +The value of \pyq{x}\codeinline\ is \outputraw. + +The result of \pyq{17 + 300}$\coderaw$ is \outputraw. + +\section*{Custom Environments} +You can create a custom environment for typesetting: + +\newenvironment{typesetpython} +{\PyLTVerbatimEnv\begin{pythonq}} +{\end{pythonq}\pytypeset} + +\begin{typesetpython} +msg = 'Custom environment' + +print(msg) +\end{typesetpython} + +\end{document} diff --git a/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.pdf b/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.pdf Binary files differindex 173c053483c..62127e2871c 100644 --- a/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.pdf +++ b/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.pdf diff --git a/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.tex b/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.tex index 7446313863b..eeff387c21d 100644 --- a/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.tex +++ b/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.tex @@ -15,7 +15,7 @@ \usepackage{url} \title{The \emph{pyluatex} package} \author{Tobias Enderle\\\url{https://github.com/tndrle/PyLuaTeX}} -\date{v0.4.2 (2022/02/13)} +\date{v0.4.3 (2022/03/10)} \begin{document} \maketitle \raggedright @@ -90,34 +90,12 @@ The folder \inlcode|example| contains additional example documents: \item \inlcode|typesetting-minted.tex|\\[0.5ex] A detailed example for typesetting code and output with the \textit{minted} package \end{itemize} -For more intricate use cases have a look at our tests in the folder \inlcode|test|. - \section{Installation} PyLuaTeX is available in TeX Live, MiKTeX, and on CTAN\footnote{\url{https://ctan.org/pkg/pyluatex}} as \inlcode|pyluatex|. To install PyLuaTeX in \textbf{TeX Live} run \inlcode|tlmgr install pyluatex|.\\[0.5ex] In \textbf{MiKTeX}, PyLuaTeX can be installed in the \textit{MiKTeX Console}. -To install PyLuaTeX \textbf{manually}, do the following steps: -\begin{enumerate} -\item Locate your local \textit{TEXMF} folder\\[0.5ex] -The location of this folder may vary. Typical defaults for TeX Live are \inlcode|~/texmf| for Linux, -\inlcode|~/Library/texmf| for macOS, and \inlcode|C:\Users\<user name>\texmf| for Windows. -If you are lucky, the command \inlcode|kpsewhich -var-value=TEXMFHOME| tells you the location. -For MiKTeX, the folder can be found and configured in the \textit{MiKTeX Console}. -\item Download the latest release\footnote{\url{https://github.com/tndrle/PyLuaTeX/releases/latest}} of PyLuaTeX -\item Put the downloaded files in the folder \inlcode|TEXMF/tex/latex/pyluatex| (where \inlcode|TEXMF| is the folder located in 1.)\\[0.5ex] -The final folder structure must be -\begin{tcblisting}{breakable,listing only, - size=fbox,colframe=black!8,boxrule=3pt,colback=black!8} -TEXMF/tex/latex/pyluatex/ -|-- pyluatex-interpreter.py -|-- pyluatex-json.lua -|-- pyluatex.lua -|-- pyluatex.sty -|-- ... -\end{tcblisting} -\end{enumerate} \section{Reference} PyLuaTeX offers a simple set of options, macros and environments. @@ -129,9 +107,6 @@ For an example, see the Typesetting Code section. \subsection{Package Options} \begin{itemize} -\item \inlcode|verbose|\\[0.5ex] - If this option is set, Python input and output is written to the \LaTeX{} log file.\\[0.5ex] - \textit{Example:} \inlcode|\usepackage[verbose]{pyluatex}| \item \inlcode|executable|\\[0.5ex] Specifies the path to the Python executable. (default: \inlcode|python3|)\\[0.5ex] \textit{Example:} \inlcode|\usepackage[executable=/usr/local/bin/python3]{pyluatex}| @@ -139,13 +114,19 @@ For an example, see the Typesetting Code section. By default, PyLuaTeX aborts the compilation process when Python reports an error. If the \inlcode|ignoreerrors| option is set, the compilation process is not aborted.\\[0.5ex] \textit{Example:} \inlcode|\usepackage[ignoreerrors]{pyluatex}| +\item \inlcode|localimports|\\[0.5ex] + If this option is set, the folder containing the TeX input file is added to the Python path. This allows local Python packages to be imported. (default: \inlcode|true|)\\[0.5ex] + \textit{Example:} \inlcode|\usepackage[localimports=false]{pyluatex}| \item \inlcode|shutdown|\\[0.5ex] Specifies when the Python process is shut down. (default: \inlcode|veryveryend|)\\[0.5ex] \textit{Options:} \inlcode|veryveryend|, \inlcode|veryenddocument|, \inlcode|off|\\[0.5ex] PyLuaTeX uses the hooks of the package \textit{atveryend} to shut down the Python interpreter when the compilation is done. With the option \inlcode|veryveryend|, Python is shut down in the \inlcode|\AtVeryVeryEnd| hook. With the option \inlcode|veryenddocument|, Python is shut down in the \inlcode|\AtVeryEndDocument| hook. With the option \inlcode|off|, Python is not shut down explicitly. However, the Python process will shut down when the LuaTeX process finishes even if \inlcode|off| is selected. Using \inlcode|off| on Windows might lead to problems with SyncTeX, though.\\[0.5ex] \textit{Example:} \inlcode|\usepackage[shutdown=veryenddocument]{pyluatex}| +\item \inlcode|verbose|\\[0.5ex] + If this option is set, Python input and output is written to the \LaTeX{} log file.\\[0.5ex] + \textit{Example:} \inlcode|\usepackage[verbose]{pyluatex}| \end{itemize} -Package options (except for \inlcode|executable| and \inlcode|shutdown|) can be changed in the document with the +The package options \inlcode|verbose| and \inlcode|ignoreerrors| can be changed in the document with the \inlcode|\pyoption| command, e.g. \inlcode|\pyoption{verbose}{true}| or \inlcode|\pyoption{ignoreerrors}{false}|. \subsection{Macros} diff --git a/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex-interpreter.py b/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex-interpreter.py index 4d713e7ab3c..77d09bbb645 100644 --- a/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex-interpreter.py +++ b/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex-interpreter.py @@ -31,6 +31,8 @@ import json import textwrap from collections import defaultdict import re +import os +import sys class Interpreter(InteractiveInterpreter): def execute_repl(self, code, ignore_errors): @@ -104,6 +106,13 @@ class Handler(socketserver.StreamRequestHandler): self.wfile.write((json.dumps(response) + '\n').encode('utf-8')) if __name__ == '__main__': + try: + tex_file = sys.argv[1] + tex_file_folder = os.path.normpath(os.path.dirname(tex_file)) + sys.path.insert(0, tex_file_folder) + except: + pass + with socketserver.TCPServer(('localhost', 0), Handler) as server: print(server.server_address[1], end='\n', flush=True) # publish port server.handle_request() diff --git a/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.lua b/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.lua index f9d8ff68a65..0b785239da9 100644 --- a/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.lua +++ b/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.lua @@ -31,6 +31,8 @@ pyluatex = pyluatex or { session = "default" } +local dir_sep = package.config:sub(1,1) + -- status.filename: path to pyluatex.sty local folder = file.pathpart(file.collapsepath(status.filename, true)) local tcp = nil @@ -43,6 +45,23 @@ local env_repl_mode = false local last_code = nil local last_output = nil +local function get_tex_file() + for k, v in ipairs(arg) do + if not v:find("^%-") then + local path = lfs.currentdir() .. dir_sep .. v + if lfs.attributes(path, "mode") == "file" then + return path + else + path = path .. ".tex" + if lfs.attributes(path, "mode") == "file" then + return path + end + end + end + end + return nil +end + local function trim(s) return (s:gsub("^%s*(.-)%s*$", "%1")) end @@ -51,14 +70,22 @@ local function err_cmd(message) return "\\PackageError{PyLuaTeX}{" .. message .. "}{}" end -function pyluatex.start(executable) +function pyluatex.start(executable, local_imports) local script = file.join(folder, "pyluatex-interpreter.py") - local is_windows = package.config:sub(1,1) ~= "/" - local cmd + local is_windows = dir_sep ~= "/" + + local cmd = "" + if local_imports then + local tex_file = get_tex_file() + if tex_file ~= nil then + cmd = " \"" .. tex_file .. "\"" + end + end + cmd = executable .. " \"" .. script .. "\"" .. cmd if is_windows then - cmd = "start /B " .. executable .. " \"" .. script .. "\"" + cmd = "start /B " .. cmd else - cmd = executable .. " \"" .. script .. "\" &" + cmd = cmd .. " &" end local f = io.popen(cmd, "r") local port = f:read("*l") diff --git a/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.sty b/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.sty index 6c247993a91..3413dba4c3e 100644 --- a/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.sty +++ b/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.sty @@ -1,15 +1,15 @@ %% Copyright 2021-2022 Tobias Enderle %% %% This work may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3 +%% conditions of the LaTeX Project Public License, either version 1.3c %% of this license or (at your option) any later version. %% The latest version of this license is in %% http://www.latex-project.org/lppl.txt -%% and version 1.3 or later is part of all distributions of LaTeX +%% and version 1.3c or later is part of all distributions of LaTeX %% version 2005/12/01 or later. \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{pyluatex}[2022/02/13 v0.4.2 Execute Python code on the fly] +\ProvidesPackage{pyluatex}[2022/03/10 v0.4.3 Execute Python code on the fly] \RequirePackage{expl3} \ExplSyntaxOn @@ -27,20 +27,16 @@ \DeclareStringOption[python3]{executable} \DeclareBoolOption{ignoreerrors} \DeclareBoolOption{verbose} +\DeclareBoolOption[true]{localimports} \DeclareStringOption[veryveryend]{shutdown} \ProcessKeyvalOptions* -\ifpyluatex@ignoreerrors - \directlua{pyluatex.ignore_errors = true} -\else - \directlua{pyluatex.ignore_errors = false} -\fi -\ifpyluatex@verbose - \directlua{pyluatex.verbose = true} -\else - \directlua{pyluatex.verbose = false} -\fi -\directlua{pyluatex.start([==[\pyluatex@executable]==])} +\directlua{pyluatex.ignore_errors = \ifpyluatex@ignoreerrors true\else false\fi} +\directlua{pyluatex.verbose = \ifpyluatex@verbose true\else false\fi} +\directlua{pyluatex.start( + [==[\pyluatex@executable]==], + \ifpyluatex@localimports true\else false\fi +)} \ExplSyntaxOn \cs_generate_variant:Nn \tl_if_eq:nnTF { V } |