summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/hybrid-latex/examples
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/hybrid-latex/examples
Initial commit
Diffstat (limited to 'macros/latex/contrib/hybrid-latex/examples')
-rw-r--r--macros/latex/contrib/hybrid-latex/examples/example-01.pdfbin0 -> 129381 bytes
-rw-r--r--macros/latex/contrib/hybrid-latex/examples/example-01.pytex123
-rw-r--r--macros/latex/contrib/hybrid-latex/examples/example-01.tex267
-rw-r--r--macros/latex/contrib/hybrid-latex/examples/example-02.pdfbin0 -> 98382 bytes
-rw-r--r--macros/latex/contrib/hybrid-latex/examples/example-02.pytex20
-rw-r--r--macros/latex/contrib/hybrid-latex/examples/example-02.tex53
-rw-r--r--macros/latex/contrib/hybrid-latex/examples/example-03.pdfbin0 -> 93824 bytes
-rw-r--r--macros/latex/contrib/hybrid-latex/examples/example-03.pytex18
-rw-r--r--macros/latex/contrib/hybrid-latex/examples/example-03.tex73
-rw-r--r--macros/latex/contrib/hybrid-latex/examples/example-04-fig.pdfbin0 -> 175485 bytes
-rw-r--r--macros/latex/contrib/hybrid-latex/examples/example-04.pdfbin0 -> 281409 bytes
-rw-r--r--macros/latex/contrib/hybrid-latex/examples/example-04.pytex1
-rw-r--r--macros/latex/contrib/hybrid-latex/examples/example-04.tex119
-rw-r--r--macros/latex/contrib/hybrid-latex/examples/example-05.pdfbin0 -> 83216 bytes
-rw-r--r--macros/latex/contrib/hybrid-latex/examples/example-05.pytex12
-rw-r--r--macros/latex/contrib/hybrid-latex/examples/example-05.tex51
-rw-r--r--macros/latex/contrib/hybrid-latex/examples/example-06.pdfbin0 -> 106438 bytes
-rw-r--r--macros/latex/contrib/hybrid-latex/examples/example-06.pytex9
-rw-r--r--macros/latex/contrib/hybrid-latex/examples/example-06.tex89
-rw-r--r--macros/latex/contrib/hybrid-latex/examples/example-07.pdfbin0 -> 57402 bytes
-rw-r--r--macros/latex/contrib/hybrid-latex/examples/example-07.pytex9
-rw-r--r--macros/latex/contrib/hybrid-latex/examples/example-07.tex45
-rw-r--r--macros/latex/contrib/hybrid-latex/examples/example-08.pdfbin0 -> 113548 bytes
-rw-r--r--macros/latex/contrib/hybrid-latex/examples/example-08.pytex78
-rw-r--r--macros/latex/contrib/hybrid-latex/examples/example-08.tex215
-rw-r--r--macros/latex/contrib/hybrid-latex/examples/example-09.pdfbin0 -> 240360 bytes
-rw-r--r--macros/latex/contrib/hybrid-latex/examples/example-09.pytex6
-rw-r--r--macros/latex/contrib/hybrid-latex/examples/example-09.tex142
-rw-r--r--macros/latex/contrib/hybrid-latex/examples/examples.sty31
-rw-r--r--macros/latex/contrib/hybrid-latex/examples/summary.pdfbin0 -> 288391 bytes
-rw-r--r--macros/latex/contrib/hybrid-latex/examples/summary.tex148
-rw-r--r--macros/latex/contrib/hybrid-latex/examples/version.txt17
32 files changed, 1526 insertions, 0 deletions
diff --git a/macros/latex/contrib/hybrid-latex/examples/example-01.pdf b/macros/latex/contrib/hybrid-latex/examples/example-01.pdf
new file mode 100644
index 0000000000..6284929a7e
--- /dev/null
+++ b/macros/latex/contrib/hybrid-latex/examples/example-01.pdf
Binary files differ
diff --git a/macros/latex/contrib/hybrid-latex/examples/example-01.pytex b/macros/latex/contrib/hybrid-latex/examples/example-01.pytex
new file mode 100644
index 0000000000..cd366cd8ba
--- /dev/null
+++ b/macros/latex/contrib/hybrid-latex/examples/example-01.pytex
@@ -0,0 +1,123 @@
+\pytag{ans.101}{%
+a^{3} + 3 a^{2} b + 3 a b^{2} + b^{3}%
+}
+\pytag{ans.102}{%
+- x \left(- a + x\right) \left(x + 1\right)%
+}
+\pytag{ans.103}{%
+\left [ -2, \quad 2\right ]%
+}
+\pytag{ans.104}{%
+\left \{ a : \frac{1}{5}, \quad b : - \frac{13}{5}, \quad c : \frac{17}{5}\right \}%
+}
+\pytag{ans.105}{%
+3.1415926535897932384626433832795028841971693993751%
+}
+\pytag{ans.106}{%
+- \frac{1}{4 \left(x + 5\right)} + \frac{1}{4 \left(x + 1\right)}%
+}
+\pytag{ans.107}{%
+\frac{1}{\left(x + 1\right) \left(x + 5\right)}%
+}
+\pytag{rhs.108}{%
+\tanh{\left (\log{\left (x \right )} \right )}%
+}
+\pytag{rhs.109}{%
+i \tan{\left (x \right )}%
+}
+\pytag{rhs.110}{%
+0%
+}
+\pytag{lhs.108}{%
+\tanh{\left (\log{\left (x \right )} \right )}%
+}
+\pytag{lhs.109}{%
+\tanh{\left (i x \right )}%
+}
+\pytag{lhs.110}{%
+- 4 \sinh^{3}{\left (x \right )} - 3 \sinh{\left (x \right )} + \sinh{\left (3 x \right )}%
+}
+\pytag{ans.201}{%
+\left[\begin{matrix}2 & 3\\5 & 4\end{matrix}\right]%
+}
+\pytag{ans.202}{%
+\left[\begin{matrix}-1\\7\end{matrix}\right]%
+}
+\pytag{ans.203}{%
+\left[\begin{matrix}-5 & 3\\5 & 5\end{matrix}\right]%
+}
+\pytag{ans.204}{%
+\lambda^{2} - 6 \lambda - 7%
+}
+\pytag{ans.205}{%
+\left[\begin{matrix}3\\7\end{matrix}\right]%
+}
+\pytag{ans.206}{%
+\left ( \frac{9}{7}, \quad \frac{1}{7}\right )%
+}
+\pytag{ans.301}{%
+4%
+}
+\pytag{ans.302}{%
+\infty%
+}
+\pytag{ans.303}{%
+2 x%
+}
+\pytag{ans.304}{%
+\frac{4}{3}%
+}
+\pytag{ans.305}{%
+e^{a}%
+}
+\pytag{ans.401}{%
+\frac{1}{2} + \frac{3 \left(x - 1\right)^{2}}{16} - \frac{\left(x - 1\right)^{3}}{8} + \frac{5 \left(x - 1\right)^{4}}{64} - \frac{3 \left(x - 1\right)^{5}}{64} - \frac{x}{4} + O\left(\left(x - 1\right)^{6}; x\rightarrow 1\right)%
+}
+\pytag{ans.402}{%
+1 + x + \frac{x^{2}}{2} + \frac{x^{3}}{6} + \frac{x^{4}}{24} + \frac{x^{5}}{120} + O\left(x^{6}\right)%
+}
+\pytag{ans.403}{%
+\frac{3121579929551692678469635660835626209661709}{1920815367859463099600511526151929560192000}%
+}
+\pytag{ans.404}{%
+\frac{\pi^{4}}{90}%
+}
+\pytag{ans.501}{%
+x \cos{\left (x \right )} + \sin{\left (x \right )}%
+}
+\pytag{ans.502}{%
+\frac{\sqrt{2} \pi}{8} + \frac{\sqrt{2}}{2}%
+}
+\pytag{ans.503}{%
+- a + b + \sin{\left (a \right )} \cos{\left (a \right )} - \sin{\left (b \right )} \cos{\left (b \right )}%
+}
+\pytag{lhs.504}{%
+\int_{0}^{\infty} 2 e^{- x^{2}}\, dx%
+}
+\pytag{ans.504}{%
+\sqrt{\pi}%
+}
+\pytag{lhs.505}{%
+\int_{0}^{1}\int_{0}^{x} \left(x^{2} + y^{2}\right)\, dy\, dx%
+}
+\pytag{ans.505}{%
+\frac{1}{3}%
+}
+\pytag{ans.601}{%
+C_{1} e^{- x} + a \sin{\left (x \right )} - a \cos{\left (x \right )}%
+}
+\pytag{ans.602}{%
+a \sin{\left (x \right )} - a \cos{\left (x \right )} + a e^{- x}%
+}
+\pytag{ans.603}{%
+C_{1} \sin{\left (x \right )} + C_{2} \cos{\left (x \right )}%
+}
+\pytag{ans.604}{%
+\sin{\left (x \right )}%
+}
+\pytag{ans.605}{%
+C_{1} e^{- 6 x} + C_{2} e^{x}%
+}
+\pytag{ans.606}{%
+3 e^{x} + 2 e^{- 6 x}%
+}
diff --git a/macros/latex/contrib/hybrid-latex/examples/example-01.tex b/macros/latex/contrib/hybrid-latex/examples/example-01.tex
new file mode 100644
index 0000000000..08919ec095
--- /dev/null
+++ b/macros/latex/contrib/hybrid-latex/examples/example-01.tex
@@ -0,0 +1,267 @@
+\documentclass[12pt]{pylatex}
+\usepackage{examples}
+
+\begin{document}
+
+\section*{Elementary maths}
+
+\vspace{-5pt}
+
+This is a collection of basic mathematical computations using {\tt\small sympy}. The main purpose is to demonstrate the use of {\tt\small\verb|\py|} and {\tt\small\verb|\py*|}. Note that {\tt\small sympy 1.1.1} appears unable to simplify $\tanh(\log(x))$ (compare {\tt\small rhs.108} shown below against {\tt\small ans.108} shown in the \href{../../mathematica/examples/example-01.pdf}{Mathematica} examples). Note also the separate computaions for the left and right hand sides of results 108, 109 and 110.
+
+\vspace{-10pt}
+
+\begin{minipage}[t]{0.65\textwidth}
+\begin{python}
+ from sympy import *
+ x, y, z, a, b, c = symbols('x y z a b c')
+ ans = expand((a+b)**3) # py (ans.101,ans)
+ ans = factor(-2*x+2*x+a*x-x**2+a*x**2-x**3) # py (ans.102,ans)
+ ans = solve(x**2-4, x) # py (ans.103,ans)
+ ans = solve([2*a-b - 3, a+b+c - 1,-b+c - 6],[a,b,c]) # py (ans.104,ans)
+ ans = N(pi,50) # py (ans.105,ans)
+ ans = apart(1/((1 + x)*(5 + x))) # py (ans.106,ans)
+ ans = together((1/(1 + x) - 1/(5 + x))/4) # py (ans.107,ans)
+ ans = simplify(tanh(log(x))) # py (rhs.108,ans)
+ ans = simplify(tanh(I*x)) # py (rhs.109,ans)
+ ans = simplify(sinh(3*x) - 3*sinh(x) - 4*(sinh(x))**3) # py (rhs.110,ans)
+ ans = tanh(log(x)) # py (lhs.108,ans)
+ ans = tanh(UnevaluatedExpr(I*x)) # py (lhs.109,ans)
+ ans = sinh(3*x) - 3*sinh(x) - 4*(sinh(x))**3 # py (lhs.110,ans)
+\end{python}
+\end{minipage}
+\hskip 1cm
+\begin{minipage}[t]{0.35\textwidth}
+\begin{latex}
+ \begin{align*}
+ &\py*{ans.101}\\
+ &\py*{ans.102}\\
+ &\py*{ans.103}\\
+ &\py*{ans.104}\\
+ &\py*{ans.105}\\
+ &\py*{ans.106}\\
+ &\py*{ans.107}\\
+ \py{lhs.108} &= \Py{rhs.108}\\
+ \py{lhs.109} &= \Py{rhs.109}\\
+ \py{lhs.110} &= \Py{rhs.110}
+ \end{align*}
+\end{latex}
+\end{minipage}
+
+\vspace{-10pt}
+
+\begin{align*}
+ &\py*{ans.101}\\
+ &\py*{ans.102}\\
+ &\py*{ans.103}\\
+ &\py*{ans.104}\\
+ &\py*{ans.105}\\
+ &\py*{ans.106}\\
+ &\py*{ans.107}\\
+ \py{lhs.108} &= \Py{rhs.108}\\
+ \py{lhs.109} &= \Py{rhs.109}\\
+ \py{lhs.110} &= \Py{rhs.110}
+\end{align*}
+
+\clearpage
+
+\section*{Linear Algebra}
+
+\vspace{-10pt}
+
+\begin{minipage}[t]{0.65\textwidth}
+\begin{python}
+ from sympy import linsolve
+ lamda = Symbol('lamda')
+ mat = Matrix([[2,3], [5,4]]) # py (ans.201,mat)
+ eig1 = mat.eigenvects()[0][0] # 1st eigenvalue
+ eig2 = mat.eigenvects()[1][0] # 2nd eigenvalue
+ v1 = mat.eigenvects()[0][2][0] # 1st eigenvector
+ v2 = mat.eigenvects()[1][2][0] # 2nd eigenvector
+ eig = simplify(Matrix([eig1,eig2])) # py (ans.202,eig)
+ vec = simplify(5*Matrix([]).col_insert(0,v1)
+ .col_insert(1,v2)) # py (ans.203,vec)
+ det = expand((mat - lamda * eye(2)).det()) # py (ans.204,det)
+ rhs = Matrix([[3],[7]]) # py (ans.205,rhs)
+ ans = list(linsolve((mat,rhs),x,y))[0] # py (ans.206,ans)
+\end{python}
+\end{minipage}
+\hskip 1cm
+\begin{minipage}[t]{0.35\textwidth}
+\begin{latex}
+ \begin{align*}
+ &\py*{ans.201}\\
+ &\py*{ans.202}\\
+ &\py*{ans.203}\\
+ &\py*{ans.204}\\
+ &\py*{ans.205}\\
+ &\py*{ans.206}
+ \end{align*}
+\end{latex}
+\end{minipage}
+
+\begin{align*}
+ &\py*{ans.201}\\
+ &\py*{ans.202}\\
+ &\py*{ans.203}\\
+ &\py*{ans.204}\\
+ &\py*{ans.205}\\
+ &\py*{ans.206}
+\end{align*}
+
+\clearpage
+
+\section*{Limits}
+
+\vspace{-10pt}
+
+\begin{minipage}[t]{0.65\textwidth}
+\begin{python}
+ n, dx = symbols('n dx')
+ ans = limit(sin(4*x)/x,x,0) # py (ans.301,ans)
+ ans = limit(2**x/x,x,oo) # py (ans.302,ans)
+ ans = limit(((x+dx)**2 - x**2)/dx, dx,0) # py (ans.303,ans)
+ ans = limit((4*n + 1)/(3*n - 1),n,oo) # py (ans.304,ans)
+ ans = limit((1+(a/n))**n,n,oo) # py (ans.305,ans)
+\end{python}
+\end{minipage}
+\hskip 1cm
+\begin{minipage}[t]{0.35\textwidth}
+\begin{latex}
+ \begin{align*}
+ &\py*{ans.301}\\
+ &\py*{ans.302}\\
+ &\py*{ans.303}\\
+ &\py*{ans.304}\\
+ &\py*{ans.305}
+ \end{align*}
+\end{latex}
+\end{minipage}
+
+\begin{align*}
+ &\py*{ans.301}\\
+ &\py*{ans.302}\\
+ &\py*{ans.303}\\
+ &\py*{ans.304}\\
+ &\py*{ans.305}
+\end{align*}
+
+\section*{Series}
+
+\vspace{-10pt}
+
+\begin{minipage}[t]{0.65\textwidth}
+\begin{python}
+ ans = series((1 + x)**(-2), x, 1, 6) # py (ans.401,ans)
+ ans = series(exp(x), x, 0, 6) # py (ans.402,ans)
+ ans = Sum(1/n**2, (n,1,50)).doit() # py (ans.403,ans)
+ ans = Sum(1/n**4, (n,1,oo)).doit() # py (ans.404,ans)
+\end{python}
+\end{minipage}
+\hskip 1cm
+\begin{minipage}[t]{0.35\textwidth}
+\begin{latex}
+ \begin{align*}
+ &\py*{ans.401}\\
+ &\py*{ans.402}\\
+ &\py*{ans.403}\\
+ &\py*{ans.404}
+ \end{align*}
+\end{latex}
+\end{minipage}
+
+\begin{align*}
+ &\py*{ans.401}\\
+ &\py*{ans.402}\\
+ &\py*{ans.403}\\
+ &\py*{ans.404}
+\end{align*}
+
+\clearpage
+
+\section*{Calculus}
+
+This example shows how {\tt\small\verb|\Py|} can be used to set the equation tag on the far right hand side.
+
+\begin{minipage}[t]{0.65\textwidth}
+\begin{python}
+ ans = diff(x*sin(x),x) # py (ans.501,ans)
+ ans = diff(x*sin(x),x).subs(x,pi/4) # py (ans.502,ans)
+ ans = integrate(2*sin(x)**2, (x,a,b)) # py (ans.503,ans)
+ ans = Integral(2*exp(-x**2), (x,0,oo)) # py (lhs.504,ans)
+ ans = ans.doit() # py (ans.504,ans)
+ ans = Integral(Integral(x**2 + y**2, (y,0,x)), (x,0,1)) # py (lhs.505,ans)
+ ans = ans.doit() # py (ans.505,ans)
+\end{python}
+\end{minipage}
+\hskip 1cm
+\begin{minipage}[t]{0.35\textwidth}
+\begin{latex}
+ \begin{align*}
+ &\py*{ans.501}\\
+ &\py*{ans.502}\\
+ &\py*{ans.503}\\
+ \py{lhs.504}&=\Py{ans.504}\\
+ \py{lhs.505}&=\Py{ans.505}
+ \end{align*}
+\end{latex}
+\end{minipage}
+
+\begin{align*}
+ &\py*{ans.501}\\
+ &\py*{ans.502}\\
+ &\py*{ans.503}\\
+ \py{lhs.504}&=\Py{ans.504}\\
+ \py{lhs.505}&=\Py{ans.505}
+\end{align*}
+
+\clearpage
+
+\section*{Differential equations}
+
+\vspace{-10pt}
+
+\begin{minipage}[t]{0.70\textwidth}
+\begin{python}
+ y = Function('y')
+ C1, C2 = symbols('C1 C2')
+
+ ode = Eq(y(x).diff(x) + y(x), 2*a*sin(x))
+ sol = expand(dsolve(ode,y(x)).rhs) # py (ans.601,sol)
+ cst = solve([sol.subs(x,0)],dict=True)
+ sol = sol.subs(cst[0]) # py (ans.602,sol)
+
+ ode = Eq(y(x).diff(x,2) + y(x), 0)
+ sol = expand(dsolve(ode,y(x)).rhs) # py (ans.603,sol)
+ cst = solve([sol.subs(x,0),sol.diff(x).subs(x,0)-1],dict=True)
+ sol = sol.subs(cst[0]) # py (ans.604,sol)
+
+ ode = Eq(y(x).diff(x,2) + 5*y(x).diff(x) - 6*y(x), 0)
+ sol = expand(dsolve(ode,y(x)).rhs) # py (ans.605,sol)
+ sol = sol.subs({C1:2,C2:3}) # py (ans.606,sol)
+\end{python}
+\end{minipage}
+\hskip 1cm
+\begin{minipage}[t]{0.30\textwidth}
+\begin{latex}
+ \begin{align*}
+ &\py*{ans.601}\\
+ &\py*{ans.602}\\
+ &\py*{ans.603}\\
+ &\py*{ans.604}\\
+ &\py*{ans.605}\\
+ &\py*{ans.606}
+ \end{align*}
+\end{latex}
+\end{minipage}
+
+\begin{align*}
+ &\py*{ans.601}\\
+ &\py*{ans.602}\\
+ &\py*{ans.603}\\
+ &\py*{ans.604}\\
+ &\py*{ans.605}\\
+ &\py*{ans.606}
+\end{align*}
+
+\end{document}
diff --git a/macros/latex/contrib/hybrid-latex/examples/example-02.pdf b/macros/latex/contrib/hybrid-latex/examples/example-02.pdf
new file mode 100644
index 0000000000..49678e745f
--- /dev/null
+++ b/macros/latex/contrib/hybrid-latex/examples/example-02.pdf
Binary files differ
diff --git a/macros/latex/contrib/hybrid-latex/examples/example-02.pytex b/macros/latex/contrib/hybrid-latex/examples/example-02.pytex
new file mode 100644
index 0000000000..c48f72720e
--- /dev/null
+++ b/macros/latex/contrib/hybrid-latex/examples/example-02.pytex
@@ -0,0 +1,20 @@
+\pytag{CalculusTable}{%
+\frac{d}{d x} \sin{\left (x \right )}&=\cos{\left (x \right )}\quad & \quad%
+\int \sin{\left (x \right )}\, dx&=- \cos{\left (x \right )}\\%
+\frac{d}{d x} \cos{\left (x \right )}&=- \sin{\left (x \right )}\quad & \quad%
+\int \cos{\left (x \right )}\, dx&=\sin{\left (x \right )}\\%
+\frac{d}{d x} \tan{\left (x \right )}&=\tan^{2}{\left (x \right )} + 1\quad & \quad%
+\int \tan{\left (x \right )}\, dx&=- \log{\left (\cos{\left (x \right )} \right )}\\%
+\frac{d}{d x} \operatorname{asin}{\left (x \right )}&=\frac{1}{\sqrt{- x^{2} + 1}}\quad & \quad%
+\int \operatorname{asin}{\left (x \right )}\, dx&=x \operatorname{asin}{\left (x \right )} + \sqrt{- x^{2} + 1}\\[5pt]%
+\frac{d}{d x} \operatorname{acos}{\left (x \right )}&=- \frac{1}{\sqrt{- x^{2} + 1}}\quad & \quad%
+\int \operatorname{acos}{\left (x \right )}\, dx&=x \operatorname{acos}{\left (x \right )} - \sqrt{- x^{2} + 1}\\[5pt]%
+\frac{d}{d x} \operatorname{atan}{\left (x \right )}&=\frac{1}{x^{2} + 1}\quad & \quad%
+\int \operatorname{atan}{\left (x \right )}\, dx&=x \operatorname{atan}{\left (x \right )} - \frac{\log{\left (x^{2} + 1 \right )}}{2}\\[5pt]%
+\frac{d}{d x} \sinh{\left (x \right )}&=\cosh{\left (x \right )}\quad & \quad%
+\int \sinh{\left (x \right )}\, dx&=\cosh{\left (x \right )}\\%
+\frac{d}{d x} \cosh{\left (x \right )}&=\sinh{\left (x \right )}\quad & \quad%
+\int \cosh{\left (x \right )}\, dx&=\sinh{\left (x \right )}\\%
+\frac{d}{d x} \tanh{\left (x \right )}&=- \tanh^{2}{\left (x \right )} + 1\quad & \quad%
+\int \tanh{\left (x \right )}\, dx&=x - \log{\left (\tanh{\left (x \right )} + 1 \right )} %
+}
diff --git a/macros/latex/contrib/hybrid-latex/examples/example-02.tex b/macros/latex/contrib/hybrid-latex/examples/example-02.tex
new file mode 100644
index 0000000000..6bf01d1052
--- /dev/null
+++ b/macros/latex/contrib/hybrid-latex/examples/example-02.tex
@@ -0,0 +1,53 @@
+% based on example 7 in pythontex_gallery
+% https://github.com/gpoore/pythontex/
+
+\documentclass[12pt]{pylatex}
+\usepackage{examples}
+
+\begin{document}
+
+\section*{A table of derivatives and anti-derivatives}
+
+This example is based upon a nice example in the Pythontex gallery, see
+\ \url{https://github.com/gpoore/pythontex/}.
+It uses a tagged block to capture the {\tt\small Sympy} output for later use
+in the body of the LaTeX table.
+
+\lstset{numbers=left}
+
+\begin{minipage}[t]{0.72\textwidth}
+\begin{python}
+ from sympy import *
+
+ var('x')
+
+ # Create a list of functions to include in the table
+ funcs = [['sin(x)',r'\\'], ['cos(x)',r'\\'], ['tan(x)',r'\\'],
+ ['asin(x)',r'\\[5pt]'], ['acos(x)',r'\\[5pt]'], ['atan(x)',r'\\[5pt]'],
+ ['sinh(x)',r'\\'], ['cosh(x)',r'\\'], ['tanh(x)',r' ']]
+
+ # pyBeg (CalculusTable)
+ for func, eol in funcs:
+ myddx = 'Derivative(' + func + ', x)'
+ myint = 'Integral(' + func + ', x)'
+ print(latex(eval(myddx)) + '&=' + latex(eval(myddx + '.doit()')) + r'\quad & \quad')
+ print(latex(eval(myint)) + '&=' + latex(eval(myint + '.doit()')) + eol)
+ # pyEnd (CalculusTable)
+\end{python}
+\end{minipage}
+\hskip 1cm
+\begin{minipage}[t]{0.28\textwidth}
+\begin{latex}
+ \begin{align*}
+ \py {CalculusTable}
+ \end{align*}
+\end{latex}
+\end{minipage}
+
+\clearpage
+
+\begin{align*}
+ \py {CalculusTable}
+\end{align*}
+
+\end{document}
diff --git a/macros/latex/contrib/hybrid-latex/examples/example-03.pdf b/macros/latex/contrib/hybrid-latex/examples/example-03.pdf
new file mode 100644
index 0000000000..58e502141c
--- /dev/null
+++ b/macros/latex/contrib/hybrid-latex/examples/example-03.pdf
Binary files differ
diff --git a/macros/latex/contrib/hybrid-latex/examples/example-03.pytex b/macros/latex/contrib/hybrid-latex/examples/example-03.pytex
new file mode 100644
index 0000000000..1633cdcb18
--- /dev/null
+++ b/macros/latex/contrib/hybrid-latex/examples/example-03.pytex
@@ -0,0 +1,18 @@
+\pytag{lhs.01}{%
+\int_{0}^{4}\int_{0}^{3}\int_{0}^{2} f(x,y,z)\, dx\, dy\, dz%
+}
+\pytag{rhs.01}{%
+\int_{0}^{4}\int_{0}^{3}\int_{0}^{2} \left(x y + y \sin{\left (z \right )} + \cos{\left (x + y \right )}\right)\, dx\, dy\, dz%
+}
+\pytag{rhs.02}{%
+\int_{0}^{4}\int_{0}^{3} \left(2 y \sin{\left (z \right )} + 2 y - \sin{\left (y \right )} + \sin{\left (y + 2 \right )}\right)\, dy\, dz%
+}
+\pytag{rhs.03}{%
+\int_{0}^{4} \left(9 \sin{\left (z \right )} + \cos{\left (3 \right )} + \cos{\left (2 \right )} - \cos{\left (5 \right )} + 8\right)\, dz%
+}
+\pytag{rhs.04}{%
+4 \cos{\left (3 \right )} + 4 \cos{\left (2 \right )} - 4 \cos{\left (5 \right )} - 9 \cos{\left (4 \right )} + 41%
+}
+\pytag{rhs.05}{%
+40.1235865133293%
+}
diff --git a/macros/latex/contrib/hybrid-latex/examples/example-03.tex b/macros/latex/contrib/hybrid-latex/examples/example-03.tex
new file mode 100644
index 0000000000..abb9863d09
--- /dev/null
+++ b/macros/latex/contrib/hybrid-latex/examples/example-03.tex
@@ -0,0 +1,73 @@
+% based on example 8 in pythontex_gallery
+% https://github.com/gpoore/pythontex/
+
+\documentclass[12pt]{pylatex}
+\usepackage{examples}
+
+\begin{document}
+
+\section*{Step-by-step integration}
+
+This is another nice example drawn from the Pythontex gallery, see
+\ \url{https://github.com/gpoore/pythontex}.
+
+It shows the step-by-step computations of a simple triple integral.
+
+\begin{python}
+ from sympy import *
+
+ x, y, z = symbols('x,y,z')
+ f = Symbol('f(x,y,z)')
+
+ # Define limits of integration
+ x_max = 2; y_max = 3; z_max = 4;
+ x_min = 0; y_min = 0; z_min = 0;
+
+ lhs = Integral(f, (x, x_min, x_max),
+ (y, y_min, y_max),
+ (z, z_min, z_max)) # py(lhs.01,lhs)
+
+ f = x*y + y*sin(z) + cos(x+y)
+
+ rhs = Integral(f, (x, x_min, x_max),
+ (y, y_min, y_max),
+ (z, z_min, z_max)) # py(rhs.01,rhs)
+ rhs = Integral(Integral(f, (x, x_min, x_max)).doit(),
+ (y, y_min, y_max),
+ (z, z_min, z_max)) # py(rhs.02,rhs)
+ rhs = Integral(Integral(f, (x, x_min, x_max),
+ (y, y_min, y_max)).doit(),
+ (z, z_min, z_max)) # py(rhs.03,rhs)
+ rhs = Integral(f, (x, x_min, x_max),
+ (y, y_min, y_max),
+ (z, z_min, z_max)).doit() # py(rhs.04,rhs)
+
+ # And now, a numerical approximation
+ rhs = N(rhs) # py(rhs.05,rhs)
+
+\end{python}
+
+\begin{minipage}[t]{0.65\textwidth}
+\begin{align*}
+ \py{lhs.01} &= \py{rhs.01}\\
+ &= \py{rhs.02}\\
+ &= \py{rhs.03}\\
+ &= \py{rhs.04}\\[8pt]
+ &\approx \py{rhs.05}
+\end{align*}
+\end{minipage}
+\hskip 1cm
+\lower16pt\hbox{%
+\begin{minipage}[t]{0.35\textwidth}
+\begin{latex}
+ \begin{align*}
+ \py{lhs.01} &= \py{rhs.01}\\
+ &= \py{rhs.02}\\
+ &= \py{rhs.03}\\
+ &= \py{rhs.04}\\[8pt]
+ &\approx \py{rhs.05}
+ \end{align*}
+\end{latex}
+\end{minipage}}
+
+\end{document}
diff --git a/macros/latex/contrib/hybrid-latex/examples/example-04-fig.pdf b/macros/latex/contrib/hybrid-latex/examples/example-04-fig.pdf
new file mode 100644
index 0000000000..4cea66ebff
--- /dev/null
+++ b/macros/latex/contrib/hybrid-latex/examples/example-04-fig.pdf
Binary files differ
diff --git a/macros/latex/contrib/hybrid-latex/examples/example-04.pdf b/macros/latex/contrib/hybrid-latex/examples/example-04.pdf
new file mode 100644
index 0000000000..efb57d535c
--- /dev/null
+++ b/macros/latex/contrib/hybrid-latex/examples/example-04.pdf
Binary files differ
diff --git a/macros/latex/contrib/hybrid-latex/examples/example-04.pytex b/macros/latex/contrib/hybrid-latex/examples/example-04.pytex
new file mode 100644
index 0000000000..ecee7c0809
--- /dev/null
+++ b/macros/latex/contrib/hybrid-latex/examples/example-04.pytex
@@ -0,0 +1 @@
+% no Python output \ No newline at end of file
diff --git a/macros/latex/contrib/hybrid-latex/examples/example-04.tex b/macros/latex/contrib/hybrid-latex/examples/example-04.tex
new file mode 100644
index 0000000000..71e437b9fd
--- /dev/null
+++ b/macros/latex/contrib/hybrid-latex/examples/example-04.tex
@@ -0,0 +1,119 @@
+\documentclass[12pt]{pylatex}
+\usepackage{examples}
+\usepackage{caption}
+\usepackage{pgfplots}
+
+\begin{document}
+
+\section*{Plotting Bessel functions}
+
+\vspace{-5pt}
+
+This simple example uses {\tt\small numpy, scipy} and {\tt\small Matplotlib} to produce a plot of the first six Bessel functions. Two plots are shown, one created by {\tt\small Matplotlib} and a second created by LaTeX using the plotting package {\tt\small pgfplots} and the data exported from {\tt\small Matplotlib}.
+
+If you are using macOS, you may need to use the {\tt\small -Ppythonw} option when running {\tt\small pylatex.sh}. This is a known problem with macOS and {\tt\small Matplotlib}, see\ \url{https://matplotlib.org/faq/osx_framework.html}.
+
+\vspace{-10pt}
+
+\begin{minipage}[t]{0.60\textwidth}
+\begin{python}
+ import numpy as np
+ import scipy.special as sp
+ import matplotlib.pyplot as plt
+
+ plt.matplotlib.rc('text', usetex = True)
+ plt.matplotlib.rc('grid', linestyle = 'dotted')
+ plt.matplotlib.rc('figure', figsize = (6.4,4.8)) # (width,height) inches
+
+ x = np.linspace(0, 15, 500)
+
+ for v in range(0, 6):
+ plt.plot(x, sp.jv(v, x))
+
+ plt.xlim((0, 15))
+ plt.ylim((-0.5, 1.1))
+ plt.legend(('${J}_0(x)$', '${J}_1(x)$', '${J}_2(x)$',
+ '${J}_3(x)$', '${J}_4(x)$', '${J}_5(x)$'), loc = 0)
+ plt.xlabel('$x$')
+ plt.ylabel('${J}_n(x)$')
+ plt.grid(True)
+ plt.tight_layout(0.5)
+
+ plt.savefig('example-04-fig.pdf')
+
+ # save the data for later use by pgfplots
+ np.savetxt('example-04.txt',list(zip(x,sp.jv(0,x),sp.jv(1,x),sp.jv(2,x),
+ sp.jv(3,x),sp.jv(4,x),sp.jv(5,x))),
+ fmt="% .10e")
+\end{python}
+\end{minipage}
+\hskip 0.25cm
+\begin{minipage}[t]{0.35\textwidth}
+\begin{latex}
+ \begin{minipage}{\textwidth}
+ \centering
+ \IfFileExists{example-04-fig.pdf}%
+ {\includegraphics[width=6.4in]
+ {example-04-fig.pdf}}{Failed to create pdf plot.}
+ \captionof{figure}{The first six Bessel functions.}
+ \end{minipage}
+\end{latex}
+\end{minipage}
+
+\begin{minipage}{\textwidth}
+ \centering
+ \IfFileExists{example-04-fig.pdf}%
+ {\includegraphics[width=6.4in]
+ {example-04-fig.pdf}}{Failed to create pdf plot.}
+ \captionof{figure}{The first six Bessel functions.}
+\end{minipage}
+
+\clearpage
+
+\pgfplotsset{compat=newest}
+\pgfplotsset{width=0.45\textwidth,height=0.34\textwidth}
+
+\subsection*{Using pgfplots}
+
+\begin{minipage}[t]{\textwidth}
+ \centering
+ \begin{tikzpicture}
+ \begin{axis}
+ [xmin= 0.0, xmax=15.0,
+ ymin=-0.45, ymax=1.05,
+ xlabel=$x$, ylabel=$J_n(x)$,
+ grid=major, grid style={dashed,gray!30},
+ legend entries = {$J_0$, $J_1$, $J_2$, $J_3$, $J_4$, $J_5$}]
+ \addplot[blue] table [x index=0, y index=1]{example-04.txt};
+ \addplot[red] table [x index=0, y index=2]{example-04.txt};
+ \addplot[green] table [x index=0, y index=3]{example-04.txt};
+ \addplot[teal] table [x index=0, y index=4]{example-04.txt};
+ \addplot[orange] table [x index=0, y index=5]{example-04.txt};
+ \addplot[purple] table [x index=0, y index=6]{example-04.txt};
+ \end{axis}
+ \end{tikzpicture}
+ \captionof{figure}{The first six Bessel functions.}
+\end{minipage}
+
+\vfill
+
+\begin{latex}
+ \begin{tikzpicture} % requires \usepackage{pgfplots}
+ \begin{axis}
+ [xmin= 0.0, xmax=15.0,
+ ymin=-0.45, ymax=1.05,
+ xlabel=$x$, ylabel=$J_n(x)$,
+ grid=major, grid style={dashed,gray!30},
+ legend entries = {$J_0$, $J_1$, $J_2$, $J_3$, $J_4$, $J_5$}]
+ \addplot[blue] table [x index=0, y index=1]{example-04.txt};
+ \addplot[red] table [x index=0, y index=2]{example-04.txt};
+ \addplot[green] table [x index=0, y index=3]{example-04.txt};
+ \addplot[teal] table [x index=0, y index=4]{example-04.txt};
+ \addplot[orange] table [x index=0, y index=5]{example-04.txt};
+ \addplot[purple] table [x index=0, y index=6]{example-04.txt};
+ \end{axis}
+ \end{tikzpicture}
+ \captionof{figure}{The first six Bessel functions.} % requires \usepackage{caption}
+\end{latex}
+
+\end{document}
diff --git a/macros/latex/contrib/hybrid-latex/examples/example-05.pdf b/macros/latex/contrib/hybrid-latex/examples/example-05.pdf
new file mode 100644
index 0000000000..c5836ce869
--- /dev/null
+++ b/macros/latex/contrib/hybrid-latex/examples/example-05.pdf
Binary files differ
diff --git a/macros/latex/contrib/hybrid-latex/examples/example-05.pytex b/macros/latex/contrib/hybrid-latex/examples/example-05.pytex
new file mode 100644
index 0000000000..50d0cef9d6
--- /dev/null
+++ b/macros/latex/contrib/hybrid-latex/examples/example-05.pytex
@@ -0,0 +1,12 @@
+\pytag{ans.511}{%
+\frac{1}{x + 1}%
+}
+\pytag{ans.512}{%
+1 - x + x^{2} - x^{3} + x^{4} - x^{5} + x^{6} - x^{7} + x^{8} - x^{9} + O\left(x^{10}\right)%
+}
+\pytag{ans.513}{%
+1 - x + x^{2} - x^{3} + x^{4} - x^{5} + x^{6} - x^{7} + x^{8} - x^{9} + x^{10} - x^{11} + x^{12} - x^{13} + x^{14} - x^{15} + x^{16} - x^{17} + x^{18} - x^{19} + O\left(x^{20}\right)%
+}
+\pytag{ans.514}{%
+1 - x + x^{2} - x^{3} + x^{4} - x^{5} + x^{6} - x^{7} + x^{8} - x^{9} + x^{10} - x^{11} + x^{12} - x^{13} + x^{14} - x^{15} + x^{16} - x^{17} + x^{18} - x^{19} + x^{20} - x^{21} + x^{22} + O\left(x^{23}\right)%
+}
diff --git a/macros/latex/contrib/hybrid-latex/examples/example-05.tex b/macros/latex/contrib/hybrid-latex/examples/example-05.tex
new file mode 100644
index 0000000000..dfcb060f52
--- /dev/null
+++ b/macros/latex/contrib/hybrid-latex/examples/example-05.tex
@@ -0,0 +1,51 @@
+\documentclass[12pt]{pylatex}
+\usepackage{examples}
+
+\begin{document}
+
+\section*{Displaying long expressions}
+
+This example uses a simple (though contrived) example of a Taylor series expansion of $1/(1+x)$ to demonstrate the problems that can arise when displaying very long expressions.
+
+% \vspace{12pt}
+
+\begin{minipage}[t]{0.50\textwidth}
+\begin{python}
+ from sympy import *
+ x = Symbol('x')
+ ans = 1/(1+x) # py (ans.511,ans)
+ taylor = ans.series(x, 0, 10) # py (ans.512,taylor)
+ taylor = ans.series(x, 0, 20) # py (ans.513,taylor)
+ taylor = ans.series(x, 0, 23) # py (ans.514,taylor)
+\end{python}
+\end{minipage}
+\hskip 0.5cm
+\begin{minipage}[t]{0.50\textwidth}
+\begin{latex}
+ \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*[\hskip 2cm]{ans.514} \end{dmath*}
+ \end{dgroup*}
+\end{latex}
+\end{minipage}
+
+\vspace{18pt}
+
+The first four lines of the following output were set using {\tt\small\verb|\Py*|}
+while the final line used {\tt\small\verb|\Py*[\hskip=2cm]|}. The last pair of lines displays
+the output for the same tag {\tt\small ans.514} and clearly the formatting of the second
+last line is not ideal as the text has overlapped the tag. This was corrected in the final
+line by using the optional argument {\tt\small\verb|[\hskip=2cm]|} in the call to {\tt\small\verb|\Py*|}.
+
+\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*[\hskip 2cm]{ans.514} \end{dmath*}
+\end{dgroup*}
+
+\end{document}
diff --git a/macros/latex/contrib/hybrid-latex/examples/example-06.pdf b/macros/latex/contrib/hybrid-latex/examples/example-06.pdf
new file mode 100644
index 0000000000..8c94c5ebcd
--- /dev/null
+++ b/macros/latex/contrib/hybrid-latex/examples/example-06.pdf
Binary files differ
diff --git a/macros/latex/contrib/hybrid-latex/examples/example-06.pytex b/macros/latex/contrib/hybrid-latex/examples/example-06.pytex
new file mode 100644
index 0000000000..66a9c8eaa6
--- /dev/null
+++ b/macros/latex/contrib/hybrid-latex/examples/example-06.pytex
@@ -0,0 +1,9 @@
+\pytag{table}{%
+\RuleA 0 & 0.5000000000000000000000000 & -1.0653065971e-1 &\\%
+\RuleA 1 & 0.5663110031972181530416492 & -1.3045098060e-3 & -0.11495\\%
+\RuleA 2 & 0.5671431650348622127865121 & -1.9648047172e-7 & -0.11546\\%
+\RuleA 3 & 0.5671432904097810286995766 & -4.4574262753e-15 & -0.11546\\%
+\RuleA 4 & 0.5671432904097838729999687 & -2.2941072910e-30 & -0.11546\\%
+\RuleA 5 & 0.5671432904097838729999687 & -6.0767705445e-61 & -0.11546\\%
+\RuleA 6 & 0.5671432904097838729999687 & -4.2637434326e-122 & -0.11546\\%
+}
diff --git a/macros/latex/contrib/hybrid-latex/examples/example-06.tex b/macros/latex/contrib/hybrid-latex/examples/example-06.tex
new file mode 100644
index 0000000000..27b5d2cf3b
--- /dev/null
+++ b/macros/latex/contrib/hybrid-latex/examples/example-06.tex
@@ -0,0 +1,89 @@
+\documentclass[12pt]{pylatex}
+\usepackage{examples}
+
+\begin{document}
+
+\section*{Quadratic convergence of Newton-Raphson iterations}
+
+This is a simple example that uses Python and {\tt\small sympy} to demonstrate the quadratic converegnce of Newton-Raphson iterations to the exact root of a non-linear equation.
+
+\vspace{10pt}
+
+\begin{python}
+ from sympy import *
+
+ x = Symbol('x')
+
+ f = Lambda (x,x-exp(-x))
+ df = Lambda (x,diff(f(x),x))
+ Step = Lambda (x,x-f(x)/df(x))
+
+ Digits = 200 # use 200 decimal digits for all numerical computations
+
+ x_new = Float('0.5',Digits)
+ f_new = N (f(x_new),Digits)
+
+ # pyBeg (table)
+
+ print ('\RuleA {:2d} & {: .25f} & {: .10e} &\\\\'.format(0,x_new,f_new))
+
+ for n in range (1,7):
+ x_old = x_new
+ x_new = N (Step(x_new),Digits)
+ f_old = N (f(x_old),Digits)
+ f_new = N (f(x_new),Digits)
+ ratio = N (f_new / f_old**2,Digits)
+ print ('\RuleA {:2d} & {: .25f} & {: .10e} & {: .5f}\\\\'.format(n,x_new,f_new,ratio))
+
+ # pyEnd (table)
+\end{python}
+
+\clearpage
+
+Note the clear quadratic convergence in the iterations -- the last column settles to approximately $-0.11546$ independent of the number of iterations. This behaviour would not be seen using normal floating point computations as they are normally limited to no more than 18 decimal digits. This computation used 200 decimal digits.
+
+\def\RuleA{\vrule depth0pt width0pt height14pt}
+\def\RuleB{\vrule depth8pt width0pt height14pt}
+\def\RuleC{\vrule depth10pt width0pt height16pt}
+
+\setlength{\tabcolsep}{0.025\textwidth}%
+
+\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$&$ \epsilon_{n} = x_{n} - e^{-x_{n}}$&$\epsilon_{n}/\epsilon_{n-1}^2$\\
+ \noalign{\hrule height 0.5pt}
+ \py{table}
+ \noalign{\hrule height 1pt}
+ \end{tabular}
+\end{center}
+
+\vspace{20pt}
+
+\begin{latex}
+ \def\RuleA{\vrule depth0pt width0pt height14pt}
+ \def\RuleB{\vrule depth8pt width0pt height14pt}
+ \def\RuleC{\vrule depth10pt width0pt height16pt}
+
+ \setlength{\tabcolsep}{0.025\textwidth}%
+
+ \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$&$ \epsilon_{n} = x_{n} - e^{-x_{n}}$&$\epsilon_{n}/\epsilon_{n-1}^2$\\
+ \noalign{\hrule height 0.5pt}
+ \py{table}
+ \noalign{\hrule height 1pt}
+ \end{tabular}
+ \end{center}
+\end{latex}
+
+\end{document}
diff --git a/macros/latex/contrib/hybrid-latex/examples/example-07.pdf b/macros/latex/contrib/hybrid-latex/examples/example-07.pdf
new file mode 100644
index 0000000000..6d4fad78c0
--- /dev/null
+++ b/macros/latex/contrib/hybrid-latex/examples/example-07.pdf
Binary files differ
diff --git a/macros/latex/contrib/hybrid-latex/examples/example-07.pytex b/macros/latex/contrib/hybrid-latex/examples/example-07.pytex
new file mode 100644
index 0000000000..fc0464a831
--- /dev/null
+++ b/macros/latex/contrib/hybrid-latex/examples/example-07.pytex
@@ -0,0 +1,9 @@
+\pytag{info}{%
+date : &Mon 27 Aug 2018 10:37:23\\%
+python : &2.7.15\\%
+system : &Darwin\\%
+release : &17.7.0\\%
+machine : &x86_64\\%
+processor : &i386\\%
+platform : &Darwin-17.7.0-x86_64-i386-64bit%
+}
diff --git a/macros/latex/contrib/hybrid-latex/examples/example-07.tex b/macros/latex/contrib/hybrid-latex/examples/example-07.tex
new file mode 100644
index 0000000000..8c26db4ef8
--- /dev/null
+++ b/macros/latex/contrib/hybrid-latex/examples/example-07.tex
@@ -0,0 +1,45 @@
+\documentclass[12pt]{pylatex}
+\usepackage{examples}
+
+\begin{document}
+
+\section*{Using tagged blocks}
+
+The following Python code block contains a matched {\tt\small\verb|pyBeg/pyEnd|} pair, with the tag name {\tt\small info}, to capture the output from the formatted Python {\tt\small print} statements.
+
+\begin{minipage}[t]{0.75\textwidth}
+\begin{python}
+ import platform, datetime
+ # pyBeg(info)
+ print("date : &"+'{:%a %d %b %Y %H:%M:%S}'.format(datetime.datetime.now())+"\\\\")
+ print("python : &"+str(platform.python_version())+"\\\\")
+ print("system : &"+str(platform.system())+"\\\\")
+ print("release : &"+str(platform.release())+"\\\\")
+ print("machine : &"+str(platform.machine())+"\\\\")
+ print("processor : &"+str(platform.processor())+"\\\\")
+ print("platform : &"+str(platform.platform()))
+ # pyEnd(info)
+\end{python}
+\end{minipage}
+\hskip 1cm
+\begin{minipage}[t]{0.25\textwidth}
+\begin{latex}
+ \bgroup\tt
+ \begin{tabular}{rl}
+ \py{info}
+ \end{tabular}
+ \egroup
+\end{latex}
+\end{minipage}
+
+\vspace{12pt}
+
+Here is the output caught from the above block.
+
+\bgroup\tt
+\begin{tabular}{rl}
+ \py{info}
+\end{tabular}
+\egroup
+
+\end{document}
diff --git a/macros/latex/contrib/hybrid-latex/examples/example-08.pdf b/macros/latex/contrib/hybrid-latex/examples/example-08.pdf
new file mode 100644
index 0000000000..2b6c902233
--- /dev/null
+++ b/macros/latex/contrib/hybrid-latex/examples/example-08.pdf
Binary files differ
diff --git a/macros/latex/contrib/hybrid-latex/examples/example-08.pytex b/macros/latex/contrib/hybrid-latex/examples/example-08.pytex
new file mode 100644
index 0000000000..c3ac7a8a6b
--- /dev/null
+++ b/macros/latex/contrib/hybrid-latex/examples/example-08.pytex
@@ -0,0 +1,78 @@
+\pytag{ans.101}{%
+- \frac{1}{6}%
+}
+\pytag{ans.102}{%
+1 + \frac{x^{2}}{2} + \frac{5 x^{4}}{24} + O\left(x^{6}\right)%
+}
+\pytag{ans.103}{%
+- \frac{4 x \sin{\left (x^{2} \right )} \cos{\left (x^{2} \right )}}{x + 1} - \frac{\cos^{2}{\left (x^{2} \right )}}{\left(x + 1\right)^{2}}%
+}
+\pytag{ans.104}{%
+x^{2} \sin{\left (x \right )} + 2 x \cos{\left (x \right )} - 2 \sin{\left (x \right )}%
+}
+\pytag{ans.105}{%
+-2 + \frac{\pi^{2}}{4}%
+}
+\pytag{ans.106}{%
+9 f{\left (x \right )} + \frac{d^{2}}{d x^{2}} f{\left (x \right )} = 1%
+}
+\pytag{ans.107}{%
+f{\left (x \right )} = C_{1} \sin{\left (3 x \right )} + C_{2} \cos{\left (3 x \right )} + \frac{1}{9}%
+}
+\pytag{ans.108}{%
+9 f{\left (x \right )} + \frac{d^{2}}{d x^{2}} f{\left (x \right )} = 1%
+}
+\pytag{ans.109}{%
+f{\left (x \right )} = C_{1} \sin{\left (3 x \right )} + C_{2} \cos{\left (3 x \right )} + \frac{1}{9}%
+}
+\pytag{ans.110}{%
+\int_{0}^{2} \cos{\left (x \right )}\, dx%
+}
+\pytag{ans.111}{%
+\sin{\left (2 \right )}%
+}
+\pytag{ans.201}{%
+- \frac{1}{6}%
+}
+\pytag{ans.202}{%
+1 + \frac{x^{2}}{2} + \frac{5 x^{4}}{24} + O\left(x^{6}\right)%
+}
+\pytag{ans.203}{%
+- \frac{4 x \sin{\left (x^{2} \right )} \cos{\left (x^{2} \right )}}{x + 1} - \frac{\cos^{2}{\left (x^{2} \right )}}{\left(x + 1\right)^{2}}%
+}
+\pytag{ans.204}{%
+x^{2} \sin{\left (x \right )} + 2 x \cos{\left (x \right )} - 2 \sin{\left (x \right )}%
+}
+\pytag{ans.205}{%
+-2 + \frac{\pi^{2}}{4}%
+}
+\pytag{ans.206}{%
+9 f{\left (x \right )} + \frac{d^{2}}{d x^{2}} f{\left (x \right )} = 1%
+}
+\pytag{ans.207}{%
+f{\left (x \right )} = C_{1} \sin{\left (3 x \right )} + C_{2} \cos{\left (3 x \right )} + \frac{1}{9}%
+}
+\pytag{ans.208}{%
+9 f{\left (x \right )} + \frac{d^{2}}{d x^{2}} f{\left (x \right )} = 1%
+}
+\pytag{ans.209}{%
+f{\left (x \right )} = C_{1} \sin{\left (3 x \right )} + C_{2} \cos{\left (3 x \right )} + \frac{1}{9}%
+}
+\pytag{ans.210}{%
+\int_{0}^{2} \cos{\left (x \right )}\, dx%
+}
+\pytag{ans.211}{%
+\sin{\left (2 \right )}%
+}
+\pytag{ans.301}{%
+- 2 \sin{\left (x \right )} \cos{\left (x \right )}%
+}
+\pytag{ans.302}{%
+- e^{- x} \sin{\left (x \right )} - e^{- x} \cos{\left (x \right )}%
+}
+\pytag{ans.401}{%
+- 2 \sin{\left (x \right )} \cos{\left (x \right )}%
+}
+\pytag{ans.402}{%
+- e^{- x} \sin{\left (x \right )} - e^{- x} \cos{\left (x \right )}%
+}
diff --git a/macros/latex/contrib/hybrid-latex/examples/example-08.tex b/macros/latex/contrib/hybrid-latex/examples/example-08.tex
new file mode 100644
index 0000000000..86043fcc60
--- /dev/null
+++ b/macros/latex/contrib/hybrid-latex/examples/example-08.tex
@@ -0,0 +1,215 @@
+% based on
+% https://github.com/sympy/sympy/wiki/Quick-examples
+
+\documentclass[12pt]{pylatex}
+\usepackage{examples}
+
+\begin{document}
+
+\section*{Visible Python code}
+
+This is the first of two-part example. In this first part the Python code and tags are made visible using {\tt\small\verb|\PySetup{action=show}|} (this is the default). In the second part the Python code will be hidden using {\tt\small\verb|\PySetup{action=hide}|}. In both cases the Python output is identical (apart from the different tag names).
+
+\vspace{12pt}
+
+\PySetup{action=show}
+
+\begin{python}
+ from sympy import *
+
+ x, y = symbols('x y')
+
+ ans = limit((sin(x)-x)/x**3, x, 0) # py(ans.101,ans)
+ ans = (1/cos(x)).series(x, 0, 6) # py(ans.102,ans)
+ ans = diff(cos(x**2)**2 / (1+x), x) # py(ans.103,ans)
+ ans = integrate(x**2 * cos(x), x) # py(ans.104,ans)
+ ans = integrate(x**2 * cos(x), (x, 0, pi/2)) # py(ans.105,ans)
+
+ f = Function('f')
+
+ eqn = Eq(Derivative(f(x),x,x) + 9*f(x), 1) # py(ans.106,eqn)
+ sol = dsolve(eqn, f(x)) # py(ans.107,sol)
+
+ eqn = Eq(f(x).diff(x, x) + 9*f(x), 1) # py(ans.108,eqn)
+ sol = dsolve(eqn, f(x)) # py(ans.109,sol)
+
+ my_int = Integral(cos(x),(x,0,2)) # py(ans.110,my_int)
+ my_ans = my_int.doit() # py(ans.111,my_ans)
+\end{python}
+
+\clearpage
+
+\section*{Visible Python code output}
+
+Here is the output from the above Python code. This line of text is here for no other reason than to fill out the line so that we have two lines of text before the Python output. This makes it easier to compare the vertical spacing between this and the next example.
+%
+\begin{align*}
+ &\py*{ans.101}\\
+ &\py*{ans.102}\\
+ &\py*{ans.103}\\
+ &\py*{ans.104}\\
+ &\py*{ans.105}\\
+ &\py*{ans.106}\\
+ &\py*{ans.107}\\
+ &\py*{ans.108}\\
+ &\py*{ans.109}\\
+ &\py*{ans.110}\\
+ &\py*{ans.111}
+\end{align*}
+
+\clearpage
+
+\section*{Hidden Python code and output}
+
+\PySetup{action=hide}
+
+In this example the Python code is hidden and consumes no vertical space on the page. Compare the gap between this pair of lines and the following output text against that seen on the previous page.
+%
+\begin{python}
+ from sympy import *
+
+ x, y = symbols('x y')
+
+ ans = limit((sin(x)-x)/x**3, x, 0) # py(ans.201,ans)
+ ans = (1/cos(x)).series(x, 0, 6) # py(ans.202,ans)
+ ans = diff(cos(x**2)**2 / (1+x), x) # py(ans.203,ans)
+ ans = integrate(x**2 * cos(x), x) # py(ans.204,ans)
+ ans = integrate(x**2 * cos(x), (x, 0, pi/2)) # py(ans.205,ans)
+
+ f = Function('f')
+
+ eqn = Eq(Derivative(f(x),x,x) + 9*f(x), 1) # py(ans.206,eqn)
+ sol = dsolve(eqn, f(x)) # py(ans.207,sol)
+
+ eqn = Eq(f(x).diff(x, x) + 9*f(x), 1) # py(ans.208,eqn)
+ sol = dsolve(eqn, f(x)) # py(ans.209,sol)
+
+ my_int = Integral(cos(x),(x,0,2)) # py(ans.210,my_int)
+ my_ans = my_int.doit() # py(ans.211,my_ans)
+\end{python}
+%
+\begin{align*}
+ &\py*{ans.201}\\
+ &\py*{ans.202}\\
+ &\py*{ans.203}\\
+ &\py*{ans.204}\\
+ &\py*{ans.205}\\
+ &\py*{ans.206}\\
+ &\py*{ans.207}\\
+ &\py*{ans.208}\\
+ &\py*{ans.209}\\
+ &\py*{ans.210}\\
+ &\py*{ans.211}
+\end{align*}
+
+\clearpage
+
+\section*{Visible Python markup}
+
+There is nothing special in this particular example. Its purpose is to provide a constart with the following example where the tags have been hidden from view.
+
+\vspace{5pt}
+
+\PySetup{action=show}
+
+\begin{python}
+ from sympy import *
+
+ x = Symbol('x')
+
+ ans = diff(cos(x)**2, x) # py(ans.301,ans)
+ ans = integrate(2*sin(x)*exp(-x), x) # py(ans.302,ans)
+\end{python}
+
+\begin{align*}
+ &\py*{ans.301}\\
+ &\py*{ans.302}
+\end{align*}
+
+\section*{Hidden Python markup}
+This example creates the impression that there are no tags in the following block. But looks can be deceptive, the truth is revealed on the following page.
+
+\vspace{5pt}
+
+\PySetup{action=hide}
+
+\begin{python}
+ from sympy import *
+
+ x = Symbol('x')
+
+ ans = diff(cos(x)**2, x) # py(ans.401,ans)
+ ans = integrate(2*sin(x)*exp(-x), x) # py(ans.402,ans)
+\end{python}
+
+\PySetup{action=verbatim}
+
+\begin{python}
+ from sympy import *
+
+ x = Symbol('x')
+
+ ans = diff(cos(x)**2, x)
+ ans = integrate(sin(x)*exp(-x), x)
+\end{python}
+
+\begin{align*}
+ &\py*{ans.401}\\
+ &\py*{ans.402}
+\end{align*}
+
+\clearpage
+
+\section*{How to hide the tags}
+The easiest way to hide the tags from view is to include two blocks, one containing the tags but hidden from view using {\tt\small\verb|\PySetup{action=hide}|}, the other block is a copy of the first but with all tags stripped out. That second block is made visible using {\tt\small\verb|\PySetup{action=verbatim}|}. This is a bit cumbersome and prone to errors (the second block must be a faithful copy of the first block). Better solutions could be devised but they all appear to require significant changes to the current preprocessors -- so much so that the this cloning trick was deemed a reasonable compromise.
+
+Here is the LaTeX code from the previous example.
+
+\vspace{-5pt}
+
+\begin{minipage}[t]{0.65\textwidth}
+\bgcolour{white}
+\latexstyle
+\begin{latex}
+* \PySetup{action=hide}
+*
+* \begin{python}
+\end{latex}
+\pythonstyle
+\begin{python}
+* from sympy import *
+*
+* x = Symbol('x')
+*
+* ans = diff(cos(x)**2, x) # py(ans.401,ans)
+* ans = integrate(2*sin(x)*exp(-x), x) # py(ans.402,ans)
+\end{python}
+\latexstyle
+\begin{latex}
+* \end{python}
+*
+* \PySetup{action=verbatim}
+*
+* \begin{python}
+\end{latex}
+\pythonstyle
+\begin{python}
+* from sympy import *
+*
+* x = Symbol('x')
+*
+* ans = diff(cos(x)**2, x)
+* ans = integrate(sin(x)*exp(-x), x)
+\end{python}
+\latexstyle
+\begin{latex}
+* \end{python}
+*
+* \begin{align*}
+* &\py*{ans.401}\\
+* &\py*{ans.402}
+* \end{align*}
+\end{latex}
+\end{minipage}
+
+\end{document}
diff --git a/macros/latex/contrib/hybrid-latex/examples/example-09.pdf b/macros/latex/contrib/hybrid-latex/examples/example-09.pdf
new file mode 100644
index 0000000000..99c3e7c4b1
--- /dev/null
+++ b/macros/latex/contrib/hybrid-latex/examples/example-09.pdf
Binary files differ
diff --git a/macros/latex/contrib/hybrid-latex/examples/example-09.pytex b/macros/latex/contrib/hybrid-latex/examples/example-09.pytex
new file mode 100644
index 0000000000..2caa3d6a73
--- /dev/null
+++ b/macros/latex/contrib/hybrid-latex/examples/example-09.pytex
@@ -0,0 +1,6 @@
+\pytag{width}{%
+17.0%
+}
+\pytag{height}{%
+13.5%
+}
diff --git a/macros/latex/contrib/hybrid-latex/examples/example-09.tex b/macros/latex/contrib/hybrid-latex/examples/example-09.tex
new file mode 100644
index 0000000000..eb56b3a66c
--- /dev/null
+++ b/macros/latex/contrib/hybrid-latex/examples/example-09.tex
@@ -0,0 +1,142 @@
+\documentclass[12pt]{pylatex}
+\usepackage{examples}
+\usepackage{caption}
+\usepackage{graphicx}
+
+\makeatletter
+\def\cm#1{\strip@pt\dimexpr #1*65536/\number\dimexpr1cm}
+\def\inches#1{\strip@pt\dimexpr #1*65536/\number\dimexpr1in}
+
+\begin{document}
+
+\section*{Passing LaTeX data to Python}
+
+There are occassions where the active Python code may require information from the LaTeX source. Since Python has no direct access to LaTeX some other means must be provided to build this bridge. The idea presented here follows a standard LaTeX pattern -- run LaTeX twice, once before Python, leaving breadcrumbs for Python to pickup during its run, then a final LaTeX run to complete the job.
+
+The examaple shown here is a simple proof of concept. It shows how the dimensions of plot can be specified in the LaTeX source and then accessed later by Python.
+
+To compile this example, use
+
+\begin{lstlisting}
+ pdflatex example-09
+ pylatex.sh -i example-09
+\end{lstlisting}
+
+The idea is to use LaTeX to create a Python dictionary saved as a {\tt\small .json} file. The dictionary will contain just two entries, one for the height and one for the width of the plot. Here are the relevant lines of LaTeX.
+
+\vspace{10pt}
+
+\begin{latex}
+ \newdimen\mywidth\mywidth=17cm % target width
+ \newdimen\myheight\myheight=13.5cm % target height
+
+ \newwrite\breadcrumbs
+ \immediate\openout\breadcrumbs=\jobname.json % create Json file
+ \immediate\write\breadcrumbs{\writebgroup} % {
+ \immediate\write\breadcrumbs{"height":\inches{\myheight},} % "height":5.31496,
+ \immediate\write\breadcrumbs{"width":\inches{\mywidth}} % "width":6.69292
+ \immediate\write\breadcrumbs{\writeegroup} % }
+ \immediate\closeout\breadcrumbs % close the file
+\end{latex}
+
+% https://tex.stackexchange.com/questions/47452/writing-and-to-a-file-with-latex
+% macros to write { and }
+\begingroup
+\catcode`<=1 \catcode`>=2 \catcode`{=12 \catcode`}=12
+\gdef\writebgroup<{> \gdef\writeegroup<}>
+\endgroup
+% or:
+% \edef\writebgroup{\iftrue\string{\else}\fi}
+% \edef\writeegroup{\iffalse{\else\string}\fi}
+
+% set the width and height of the figure
+\newdimen\mywidth\mywidth=17cm
+\newdimen\myheight\myheight=13.5cm
+
+% save width and height in a Python-Json dictionary
+\newwrite\breadcrumbs
+\immediate\openout\breadcrumbs=\jobname.json
+\immediate\write\breadcrumbs{\writebgroup}
+\immediate\write\breadcrumbs{"height":\inches{\myheight},}
+\immediate\write\breadcrumbs{"width":\inches{\mywidth}}
+\immediate\write\breadcrumbs{\writeegroup}
+\immediate\closeout\breadcrumbs
+
+The target dimensions are: (width, height) = (\cm{\mywidth} cm, \cm{\myheight} cm).
+
+\lstset{numbers=left}
+
+\vspace{5pt}
+
+The following Python code does the job of reading the dictionary and setting the values of
+{\tt\small height} and {\tt\small width}.
+
+\vspace{5pt}
+
+\begin{python}
+ import io, os, json
+
+ # read the dictionary
+ try:
+ with io.open(os.getcwd() + '/' + 'example-09.json') as inp_file:
+ inp = json.load(inp_file)
+ except:
+ inp = { "width":"6.4",
+ "height":"4.8" }
+
+ # set figure dimensions in inches (yikes)
+ width = inp['width']
+ height = inp['height']
+
+\end{python}
+
+\vspace{5pt}
+
+This Python code does the job of plotting the Bessel functions (it is based on the code from example-04).
+
+\vspace{5pt}
+
+\begin{python}
+ # plot the Bessel functions
+ import numpy as np
+ import scipy.special as sp
+ import matplotlib.pyplot as plt
+
+ plt.matplotlib.rc('text', usetex = True)
+ plt.matplotlib.rc('grid', linestyle = 'dotted')
+ plt.matplotlib.rc('figure', figsize = (width,height))
+
+ x = np.linspace(0, 15, 500)
+
+ for v in range(0, 6):
+ plt.plot(x, sp.jv(v, x))
+
+ plt.xlim((0, 15))
+ plt.ylim((-0.5, 1.1))
+ plt.legend(('${J}_0(x)$', '${J}_1(x)$', '${J}_2(x)$',
+ '${J}_3(x)$', '${J}_4(x)$', '${J}_5(x)$'), loc = 0)
+ plt.xlabel('$x$')
+ plt.ylabel('${J}_n(x)$')
+ plt.grid(True)
+
+ plt.tight_layout(0.5)
+
+ plt.savefig('example-09-fig.pdf')
+
+ width_cm = round (width * 2.54, 2) # py (width,width_cm)
+ height_cm = round (height * 2.54, 2) # py (height,height_cm)
+\end{python}
+
+The following figure should have dimensions: (width, height) = (\py{width} cm, \py{height} cm).
+
+\vspace{10pt}
+
+\begin{minipage}{\textwidth}
+ \centering
+ \IfFileExists{example-09-fig.pdf}%
+ {\fbox{\includegraphics
+ {example-09-fig.pdf}}}{Failed to create pdf plot.}
+ \captionof{figure}{The first six Bessel functions.}
+\end{minipage}
+
+\end{document}
diff --git a/macros/latex/contrib/hybrid-latex/examples/examples.sty b/macros/latex/contrib/hybrid-latex/examples/examples.sty
new file mode 100644
index 0000000000..4276eaa31f
--- /dev/null
+++ b/macros/latex/contrib/hybrid-latex/examples/examples.sty
@@ -0,0 +1,31 @@
+\hypersetup{colorlinks=true,filecolor=magenta}
+
+\parindent=0pt
+
+\lstset{gobble=2}
+
+\def\bgcolour#1{\lstset{backgroundcolor=\color{#1}}}
+
+\def\pythonstyle{\lstset{%
+language=python,
+gobble=2,
+basicstyle={\small\tt},basewidth={0.50em},
+numbers=none,numberstyle=\tiny,numbersep=10pt,
+aboveskip=0pt,belowskip=0pt,
+frame=none,framesep=0pt,framerule=0pt,
+}}
+
+\def\latexstyle{\lstset{%
+language={[LaTeX]TeX},
+gobble=2,
+basicstyle={\small\tt},basewidth={0.50em},
+numbers=none,numberstyle=\tiny,numbersep=10pt,
+aboveskip=0pt,belowskip=0pt,
+backgroundcolor=\color{white},
+frame=none,framesep=0pt,framerule=0pt,
+texcsstyle=*\bfseries\color{blue},
+stringstyle=\color{green},
+commentstyle=\color{blue}\slshape,
+}}
+
+\lstnewenvironment{latex}{\begingroup\latexstyle}{\endgroup}
diff --git a/macros/latex/contrib/hybrid-latex/examples/summary.pdf b/macros/latex/contrib/hybrid-latex/examples/summary.pdf
new file mode 100644
index 0000000000..c02673dab8
--- /dev/null
+++ b/macros/latex/contrib/hybrid-latex/examples/summary.pdf
Binary files differ
diff --git a/macros/latex/contrib/hybrid-latex/examples/summary.tex b/macros/latex/contrib/hybrid-latex/examples/summary.tex
new file mode 100644
index 0000000000..d05a66dc64
--- /dev/null
+++ b/macros/latex/contrib/hybrid-latex/examples/summary.tex
@@ -0,0 +1,148 @@
+\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}
diff --git a/macros/latex/contrib/hybrid-latex/examples/version.txt b/macros/latex/contrib/hybrid-latex/examples/version.txt
new file mode 100644
index 0000000000..cea04032c6
--- /dev/null
+++ b/macros/latex/contrib/hybrid-latex/examples/version.txt
@@ -0,0 +1,17 @@
+macOS 10.13.3 High Sierra
+
+python: 3.6.5 (Anaconda3)
+Matplotlib: 2.2.2
+numpy: 1.14.3
+sympy: 1.1.1
+scipy: 1.1.0
+
+------------------------------
+python: 2.7.10 (Apple)
+Matplotlib: 1.3.1
+numpy: 1.8.0rc1
+sympy: 1.1.1
+scipy: 0.13.0b1
+
+platform: 1.0.7
+datetime: unknown