summaryrefslogtreecommitdiff
path: root/macros/luatex/latex/luacas/doc/appendix/latexcode.tex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/luatex/latex/luacas/doc/appendix/latexcode.tex')
-rw-r--r--macros/luatex/latex/luacas/doc/appendix/latexcode.tex140
1 files changed, 140 insertions, 0 deletions
diff --git a/macros/luatex/latex/luacas/doc/appendix/latexcode.tex b/macros/luatex/latex/luacas/doc/appendix/latexcode.tex
new file mode 100644
index 0000000000..1f8ccd7471
--- /dev/null
+++ b/macros/luatex/latex/luacas/doc/appendix/latexcode.tex
@@ -0,0 +1,140 @@
+\documentclass{article}
+
+\usepackage{standalone}
+\usepackage{luacas}
+\usepackage{amsmath}
+\usepackage{amssymb}
+
+\usepackage[margin=1in]{geometry}
+\usepackage[shortlabels]{enumitem}
+
+\usepackage{pgfplots}
+\pgfplotsset{compat=1.18}
+\usetikzlibrary{positioning,calc}
+\usepackage{forest}
+\usepackage{minted}
+\usemintedstyle{pastie}
+\usepackage[hidelinks]{hyperref}
+\usepackage{parskip}
+\usepackage{multicol}
+\usepackage[most]{tcolorbox}
+ \tcbuselibrary{xparse}
+\usepackage{microtype}
+
+\usepackage[
+backend=biber,
+style=numeric,
+]{biblatex}
+\addbibresource{sources.bib}
+
+\newtcolorbox{codebox}[1][sidebyside]{
+ enhanced,skin=bicolor,
+ #1,
+ arc=1pt,
+ colframe=brown,
+ colback=brown!15,colbacklower=white,
+ boxrule=1pt,
+ notitle
+}
+
+\definecolor{rose}{RGB}{128,0,0}
+\definecolor{roseyellow}{RGB}{222,205,99}
+\definecolor{roseblue}{RGB}{167,188,214}
+\definecolor{rosenavy}{RGB}{79,117,139}
+\definecolor{roseorange}{RGB}{232,119,34}
+\definecolor{rosegreen}{RGB}{61,68,30}
+\definecolor{rosewhite}{RGB}{223,209,167}
+\definecolor{rosebrown}{RGB}{108,87,27}
+\definecolor{rosegray}{RGB}{84,88,90}
+
+\begin{document}
+
+\section{The \LaTeX{} code}
+
+As noted above, this package is really a Lua program; the package {\ttfamily luacas.sty} is merely a shell to make accessing that Lua program easy and manageable from within \LaTeX{}.
+\inputminted[
+ firstline=12,
+ lastline=14,
+ breaklines,
+ linenos,
+ numbersep=5pt]
+ {latex}
+ {luacas.dat}
+
+We check to make sure the user is compiling with Lua\LaTeX{}; if not, an error message is printed and compilation is aborted.
+
+\inputminted[
+ firstline=16,
+ lastline=24,
+ breaklines,
+ linenos,
+ numbersep=5pt]
+ {latex}
+ {luacas.dat}
+
+The following packages are required for various macros:
+
+\inputminted[
+ firstline=27,
+ lastline=32,
+ breaklines,
+ linenos,
+ numbersep=5pt]
+ {latex}
+ {luacas.dat}
+
+The files \verb|helper.lua| and \verb|parser.lua| help bridge the gap between the Lua program and \LaTeX{}.
+
+\inputminted[
+ firstline=35,
+ lastline=37,
+ breaklines,
+ linenos,
+ numbersep=5pt]
+ {latex}
+ {luacas.dat}
+
+We now define the \mintinline{latex}{\begin{CAS}..\end{CAS}} environment:
+
+\inputminted[
+ firstline=39,
+ lastline=42,
+ breaklines,
+ linenos,
+ numbersep=5pt]
+ {latex}
+ {luacas.dat}
+
+{\bf Note:} The contents are wrapped in the function \mintinline{lua}{CASparse()}. We now define the retrieving macros \mintinline{latex}{\get}, \mintinline{latex}{\fetch}, and \mintinline{latex}{\store}:
+
+\inputminted[
+ firstline=44,
+ lastline=67,
+ breaklines,
+ linenos,
+ numbersep=5pt]
+ {latex}
+ {luacas.dat}
+And now we define the printing macros \mintinline{latex}{\print}, \mintinline{latex}{\vprint}, and \mintinline{latex}{\lprint}:
+
+\inputminted[
+ firstline=75,
+ lastline=128,
+ breaklines,
+ linenos,
+ numbersep=5pt]
+ {latex}
+ {luacas.dat}
+
+And finally, we define the macros useful for printing expression trees:
+
+\inputminted[
+ firstline=130,
+ lastline=230,
+ breaklines,
+ linenos,
+ numbersep=5pt]
+ {latex}
+ {luacas.dat}
+
+\end{document} \ No newline at end of file