\documentclass[12pt]{article} \usepackage{pylatex} \usepackage{geometry} \usepackage{pgf} \usepackage{amsmath} \usepackage{listings} \usepackage{hyperref} \usepackage{breqn} \usepackage{caption} \usepackage{examples} \geometry{papersize={210mm,297mm},hmargin=2cm,tmargin=1.0cm,bmargin=1.5cm} \def\pyLaTeX{{\tt\small pyLaTeX}} \begin{document} \section*{Using output from other sources} This document performs no computations (i.e., it has no active code blocks) but instead uses selected parts of the output created by other documents. Thus this document can be compiled using {\tt\small pdflatex summary}. The basic structure of this document is as follows. \begin{minipage}[t]{0.75\textwidth} \begin{latex} \documentclass[12pt]{article} \usepackage{pylatex} % so that we can use \py{foo} \usepackage{amsmath} ... % other packages such as geometry, hyperref, breqn etc. \begin{document} ... \input{example-01.pytex} % all Python output from example-01.tex ... \begin{align*} &\py*{ans.301}\\ % the Python output &\py*{ans.302} \end{align*} ... \input{example-02.pytex} % all Python output from example-02.tex ... \begin{align*} &\py*{ans.401}\\ % the Python output &\py*{ans.402} \end{align*} ... \end{document} \end{latex} \end{minipage} \vspace{10pt} Note that care must be taken to avoid name clashes across tags from different sources. If two or more sources define tags with the same name (e.g., {\tt\small foo.pytex} and {\tt\small bah.pytex} both define {\tt\small\verb|\pytag{ans.101}|}) then the last definition will be used. \section*{Example 1} \input{example-01.pytex} \begin{align*} &\py*{ans.102}\\ &\py*{ans.302}\\ &\py*{ans.303}\\ &\py*{ans.305}\\ &\py*{ans.401}\\ &\py*{ans.402}\\ &\py*{ans.403}\\ &\py*{ans.404} \end{align*} \section*{Example 2} \input{example-02.pytex} \begin{align*} \py {CalculusTable} \end{align*} \section*{Example 3} \input{example-03.pytex} \begin{align*} \py{lhs.01} &= \py{rhs.01}\\ &= \py{rhs.02}\\ &= \py{rhs.03}\\ &= \py{rhs.04}\\ &\approx \py{rhs.05} \end{align*} \clearpage \section*{Example 4} \begin{minipage}{\textwidth} \centering \IfFileExists{example-04-fig.pdf}% % {\scalebox{0.75}{\input{example-04-fig.pdf}}}{Failed to create plot.} {\includegraphics[width=6.4in]{example-04-fig.pdf}}{Failed to create plot.} \captionof{figure}{The first six Bessel functions.} \end{minipage} \section*{Example 5} \input{example-05.pytex} \begin{dgroup*}[spread={5pt}] \begin{dmath*} f(x) = \Py*{ans.511} \end{dmath*} \begin{dmath*} {}= \Py*{ans.512} \end{dmath*} \begin{dmath*} {}= \Py*{ans.513} \end{dmath*} \begin{dmath*} {}= \Py*{ans.514} \end{dmath*} \begin{dmath*} {}= \Py*{ans.514} \end{dmath*}% LCB: do we need extar space for the tag? \end{dgroup*} \section*{Example 6} \input{example-06.pytex} \def\eps{\epsilon} \def\RuleA{\vrule depth0pt width0pt height14pt} \def\RuleB{\vrule depth8pt width0pt height14pt} \def\RuleC{\vrule depth10pt width0pt height16pt} \setlength{\tabcolsep}{0.025\textwidth}% \vspace{20pt} \begin{center} \begin{tabular}{cccc}% \noalign{\hrule height 1pt} \multicolumn{4}{c}{\RuleC\rmfamily\bfseries% Newton-Raphson iterations \quad% $x_{n+1} = x_n - f_n/f'_n\ ,\quad f(x) = x-e^{-x}$}\\ \noalign{\hrule height 1pt} \RuleB$ n$&$ x_n$&$ \eps_{n} = x_{n} - e^{-x_{n}}$&$\eps_{n}/\eps_{n-1}^2$\\ \noalign{\hrule height 0.5pt} \py{table} \noalign{\hrule height 1pt} \end{tabular} \end{center} \section*{Example 7} \input{example-07.pytex} \bgroup\tt \begin{tabular}{rl} \py{info} \end{tabular} \egroup \end{document}