summaryrefslogtreecommitdiff
path: root/macros/latex
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2022-08-22 03:01:56 +0000
committerNorbert Preining <norbert@preining.info>2022-08-22 03:01:56 +0000
commit0da533cdc3dbbf007f674c9cf301d0953cbeebd4 (patch)
tree3929482011c90cc8f8d5293d326d826e05691177 /macros/latex
parenteffef69bd4877e05494db8fcf9dae8a9fbef3ef7 (diff)
CTAN sync 202208220301
Diffstat (limited to 'macros/latex')
-rw-r--r--macros/latex/contrib/runcode/README14
-rw-r--r--macros/latex/contrib/runcode/generated/runcode_troubleshoot_inln2.tex1
-rw-r--r--macros/latex/contrib/runcode/generated/runcode_troubleshoot_inln4.tex1
-rw-r--r--macros/latex/contrib/runcode/generated/runcode_troubleshoot_inln5.tex1
-rw-r--r--macros/latex/contrib/runcode/generated/runcode_troubleshoot_inln6.tex1
-rw-r--r--macros/latex/contrib/runcode/generated/runcode_troubleshoot_inln7.tex4
-rw-r--r--macros/latex/contrib/runcode/generated/runcode_troubleshoot_inln8.tex4
-rw-r--r--macros/latex/contrib/runcode/generated/runcode_troubleshoot_inln9.tex1
-rw-r--r--macros/latex/contrib/runcode/generated/testWithrunR.tex19
-rw-r--r--macros/latex/contrib/runcode/runcode.pdfbin56780 -> 245634 bytes
-rw-r--r--macros/latex/contrib/runcode/runcode.sty29
-rw-r--r--macros/latex/contrib/runcode/runcode.tex387
-rw-r--r--macros/latex/contrib/runcode/runcode_troubleshoot.pdfbin0 -> 161688 bytes
-rw-r--r--macros/latex/contrib/runcode/runcode_troubleshoot.tex (renamed from macros/latex/contrib/runcode/troubleshoot.tex)12
-rw-r--r--macros/latex/contrib/runcode/troubleshoot.pdfbin66837 -> 0 bytes
15 files changed, 336 insertions, 138 deletions
diff --git a/macros/latex/contrib/runcode/README b/macros/latex/contrib/runcode/README
index 99088129e6..0aaa36a304 100644
--- a/macros/latex/contrib/runcode/README
+++ b/macros/latex/contrib/runcode/README
@@ -1,4 +1,4 @@
-LaTeX Package: runcode 2022/08/10 v1.6
+LaTeX Package: runcode 2022/08/20 v1.7
----------------------------------------
The runcode package enables the execution of source code (e.g., R,
Julia, Matlab, shell, Python, etc.) and embed the results in the pdf file
@@ -9,11 +9,13 @@ Copyright (C) 2020-2022
Haim Bar and HaiYing Wang https://github.com/Ossifragus/runcode
Files:
- * README - this file
- * runcode.sty - package source
- * runcode.tex - documentation (source)
- * runcode.pdf - documentation (pdf format)
- * runcodetroubleshoot.pdf (pdf format)
+ * README - this file
+ * runcode.sty - package source
+ * runcode.tex - documentation (source)
+ * runcode.pdf - documentation (pdf format)
+ * runcode_troubleshoot.tex - documentation (source)
+ * runcode_troubleshoot.pdf - documentation (pdf format)
+ * generated/ - a folder which contains files generated by runcode for the runcode_troubleshoot file
Installation:
[manual installation]
diff --git a/macros/latex/contrib/runcode/generated/runcode_troubleshoot_inln2.tex b/macros/latex/contrib/runcode/generated/runcode_troubleshoot_inln2.tex
new file mode 100644
index 0000000000..52e3c12483
--- /dev/null
+++ b/macros/latex/contrib/runcode/generated/runcode_troubleshoot_inln2.tex
@@ -0,0 +1 @@
+Error in Factorial(6) : could not find function "Factorial"
diff --git a/macros/latex/contrib/runcode/generated/runcode_troubleshoot_inln4.tex b/macros/latex/contrib/runcode/generated/runcode_troubleshoot_inln4.tex
new file mode 100644
index 0000000000..6e1cb3c44d
--- /dev/null
+++ b/macros/latex/contrib/runcode/generated/runcode_troubleshoot_inln4.tex
@@ -0,0 +1 @@
+**ZERO BYTES IN OUTPUT**
diff --git a/macros/latex/contrib/runcode/generated/runcode_troubleshoot_inln5.tex b/macros/latex/contrib/runcode/generated/runcode_troubleshoot_inln5.tex
new file mode 100644
index 0000000000..6e1cb3c44d
--- /dev/null
+++ b/macros/latex/contrib/runcode/generated/runcode_troubleshoot_inln5.tex
@@ -0,0 +1 @@
+**ZERO BYTES IN OUTPUT**
diff --git a/macros/latex/contrib/runcode/generated/runcode_troubleshoot_inln6.tex b/macros/latex/contrib/runcode/generated/runcode_troubleshoot_inln6.tex
new file mode 100644
index 0000000000..a1708fb1ce
--- /dev/null
+++ b/macros/latex/contrib/runcode/generated/runcode_troubleshoot_inln6.tex
@@ -0,0 +1 @@
+720
diff --git a/macros/latex/contrib/runcode/generated/runcode_troubleshoot_inln7.tex b/macros/latex/contrib/runcode/generated/runcode_troubleshoot_inln7.tex
new file mode 100644
index 0000000000..67a8b1431b
--- /dev/null
+++ b/macros/latex/contrib/runcode/generated/runcode_troubleshoot_inln7.tex
@@ -0,0 +1,4 @@
+ [,1] [,2] [,3]
+[1,] 1 4 7
+[2,] 2 5 8
+[3,] 3 6 9
diff --git a/macros/latex/contrib/runcode/generated/runcode_troubleshoot_inln8.tex b/macros/latex/contrib/runcode/generated/runcode_troubleshoot_inln8.tex
new file mode 100644
index 0000000000..67a8b1431b
--- /dev/null
+++ b/macros/latex/contrib/runcode/generated/runcode_troubleshoot_inln8.tex
@@ -0,0 +1,4 @@
+ [,1] [,2] [,3]
+[1,] 1 4 7
+[2,] 2 5 8
+[3,] 3 6 9
diff --git a/macros/latex/contrib/runcode/generated/runcode_troubleshoot_inln9.tex b/macros/latex/contrib/runcode/generated/runcode_troubleshoot_inln9.tex
new file mode 100644
index 0000000000..7ed7bc759c
--- /dev/null
+++ b/macros/latex/contrib/runcode/generated/runcode_troubleshoot_inln9.tex
@@ -0,0 +1 @@
+TIMED OUT+
diff --git a/macros/latex/contrib/runcode/generated/testWithrunR.tex b/macros/latex/contrib/runcode/generated/testWithrunR.tex
new file mode 100644
index 0000000000..f34ffbb051
--- /dev/null
+++ b/macros/latex/contrib/runcode/generated/testWithrunR.tex
@@ -0,0 +1,19 @@
+
+Call:
+lm(formula = y ~ x)
+
+Residuals:
+ Min 1Q Median 3Q Max
+-1.5900 -0.8153 -0.1531 0.6379 2.8379
+
+Coefficients:
+ Estimate Std. Error t value Pr(>|t|)
+(Intercept) 0.95130 0.09629 9.88 <2e-16 ***
+x 1.13879 0.10960 10.39 <2e-16 ***
+---
+Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
+
+Residual standard error: 0.9626 on 98 degrees of freedom
+Multiple R-squared: 0.5242, Adjusted R-squared: 0.5193
+F-statistic: 108 on 1 and 98 DF, p-value: < 2.2e-16
+
diff --git a/macros/latex/contrib/runcode/runcode.pdf b/macros/latex/contrib/runcode/runcode.pdf
index 803a3a401e..2c0f0d4db9 100644
--- a/macros/latex/contrib/runcode/runcode.pdf
+++ b/macros/latex/contrib/runcode/runcode.pdf
Binary files differ
diff --git a/macros/latex/contrib/runcode/runcode.sty b/macros/latex/contrib/runcode/runcode.sty
index 27202b469a..873fab14c1 100644
--- a/macros/latex/contrib/runcode/runcode.sty
+++ b/macros/latex/contrib/runcode/runcode.sty
@@ -4,7 +4,7 @@
%
% This package is based on an ongoing work by Haim Bar and HaiYing Wang, and comments and questions are welcome!
-\ProvidesPackage{runcode}[2022/08/10 runcode v1.6]
+\ProvidesPackage{runcode}[2022/08/20 runcode v1.7]
\newif\ifruncode
% Change to \runcodefalse if you want to suspend code execution
@@ -144,7 +144,8 @@
\usepackage{fvextra}
\fi
-\immediate\write18{mkdir -p tmp}
+\newcommand{\generated}{generated}
+\immediate\write18{mkdir -p \generated}
\definecolor{bg}{rgb}{0.95,0.95,0.95} % code block background color
@@ -226,8 +227,8 @@
\IfFileExists{#2}{
\stepcounter{codeOutput}
\ifthenelse{\isempty{#3}}
- { \setvalue{\tmpname}{tmp/\jobname_tmp\thecodeOutput.tex} }
- { \setvalue{\tmpname}{tmp/#3.tex} }
+ { \setvalue{\tmpname}{\generated/\jobname_tmp\thecodeOutput.tex} }
+ { \setvalue{\tmpname}{\generated/#3.tex} }
% toggle \runcode above if you want to enable/disable code execution
\ifthenelse{\isempty{#4}}
{ \ifruncode
@@ -250,8 +251,8 @@
\NewDocumentCommand{\includeOutput}{m O{vbox}}{\-
\ifthenelse{\isempty{#1}}
- {\setvalue{\tmpname}{tmp/\jobname_tmp\thecodeOutput.tex}}
- {\unskip\setvalue{\tmpname}{tmp/#1.tex}\unskip}\unskip
+ {\setvalue{\tmpname}{\generated/\jobname_tmp\thecodeOutput.tex}}
+ {\unskip\setvalue{\tmpname}{\generated/#1.tex}\unskip}\unskip
% even if the code is not executed, but we ran it before, we can use a
% cached version if it exists.
\IfFileExists{\tmpname}
@@ -288,7 +289,7 @@
\NewDocumentCommand{\inln}{m m O{inline}}{\-
\stepcounter{codeOutput}\unskip
- \unskip\setvalue{\tmpname}{tmp/\jobname_inln\thecodeOutput}\unskip\unskip\unskip
+ \unskip\setvalue{\tmpname}{\generated/\jobname_inln\thecodeOutput}\unskip\unskip\unskip
\ifruncode % cache mode - don't try to run the code, just get the previous results
\IfBeginWith{#2}{```}{\ifruncode\immediate\write18{#1 > \tmpname.tex}\unskip\fi}
{\newwrite\tempfile
@@ -362,17 +363,17 @@
\NewDocumentCommand{\runPythonBatch}{m m}{%\-\\
\stepcounter{codeOutput}
\ifthenelse{\isempty{#2}} % set the output file name
- { \setvalue{\tmpname}{tmp/\jobname_tmp\thecodeOutput.tex} }
- { \setvalue{\tmpname}{tmp/#2.tex} }
+ { \setvalue{\tmpname}{\generated/\jobname_tmp\thecodeOutput.tex} }
+ { \setvalue{\tmpname}{\generated/#2.tex} }
\IfFileExists{#1}{
\ifruncode
\newwrite\tempfile
- \immediate\openout\tempfile=tmp/\jobname_#1
+ \immediate\openout\tempfile=\generated/\jobname_#1
\immediate\write\tempfile{import dill}
\immediate\write\tempfile{from os.path import exists}
- \immediate\write\tempfile{if exists('tmp/session'):}
- \immediate\write\tempfile{ dill.load_session('tmp/session')}
+ \immediate\write\tempfile{if exists('\generated/session'):}
+ \immediate\write\tempfile{ dill.load_session('\generated/session')}
\immediate\write\tempfile{}
\newread\infile
\openin\infile=#1
@@ -383,10 +384,10 @@
\repeat
\endgroup
\closein\infile
- \immediate\write\tempfile{dill.dump_session('tmp/session')}
+ \immediate\write\tempfile{dill.dump_session('\generated/session')}
\immediate\write\tempfile{}
\immediate\closeout\tempfile
- \immediate\write18{python3 tmp/\jobname_#1 > \tmpname}
+ \immediate\write18{python3 \generated/\jobname_#1 > \tmpname}
\fi
}
{
diff --git a/macros/latex/contrib/runcode/runcode.tex b/macros/latex/contrib/runcode/runcode.tex
index 576f47d8cf..6fbd691ebc 100644
--- a/macros/latex/contrib/runcode/runcode.tex
+++ b/macros/latex/contrib/runcode/runcode.tex
@@ -1,182 +1,345 @@
- % LaTeX Package: runcode v1.6 2022/08/10
- %
- % Copyright (C) 2021 by Haim Bar and HaiYing Wang
- %
- % This file 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.
+% LaTeX Package: runcode 2022/08/20 v1.7
+%
+% Copyright (C) 2020-2022 by Haim Bar and HaiYing Wang
+%
+% This file 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{ltxdoc}
-\usepackage[hyphens]{url}
-\usepackage{runcode}
+\usepackage[utf8]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage{graphicx}
+\usepackage{longtable}
+\usepackage{wrapfig}
+\usepackage{rotating}
+\usepackage[normalem]{ulem}
+\usepackage{amsmath}
+\usepackage{amssymb}
+\usepackage{capt-of}
+\usepackage{hyperref}
+\usepackage{minted}
+\author{Haim Bar and HaiYing Wang \\haim.bar@uconn.edu, haiying.wang@uconn.edu}
+\date{\today}
+\title{The \textbf{runcode} package}
\begin{document}
- \title{The \textsf{runcode} package\thanks{This document corresponds to \textsf{runcode}~v1.6, dated~2022/08/10.}}
- \author{Haim Bar and HaiYing Wang \\ \texttt{haim.bar@uconn.edu}, \texttt{haiying.wang@uconn.edu}}
- \maketitle
-\abstract{\textsf{runcode} is a \LaTeX package that executes programming source codes (including all command line tools) from \LaTeX, and embeds the results in the resulting pdf file. Many programming languages can be easily used and any command-line executable can be invoked when preparing the pdf file from a tex file.
+\maketitle
+\begin{abstract}
-It is recommended to use this package in the server-mode together with the Python talk2stat package. Currently, the server-mode supports Julia, MatLab, Python, and R. More languages will be added.
+\texttt{runcode} is a \LaTeX{} package that executes programming source codes (including
+all command line tools) from \LaTeX{}, and embeds the results in the resulting pdf
+file. Many programming languages can be easily used and any command-line
+executable can be invoked when preparing the pdf file from a tex file. \texttt{runcode}
+is also available on \href{https://ctan.org/pkg/runcode}{CTAN}.
-For more details and usage examples and troubleshooting, refer to the package's github repository, at
-\url{https://github.com/Ossifragus/runcode}.
-}
+It is recommended to use this package in the server mode together with the
+\href{https://www.python.org/}{Python} \href{https://pypi.org/project/talk2stat/}{talk2stat} package. Currently, the server mode supports \href{https://julialang.org/}{Julia}, \href{https://www.mathworks.com/products/matlab.html}{MatLab},
+\href{https://www.python.org/}{Python}, and \href{https://www.r-project.org/}{R}. More languages will be added.
+
+For more details and usage examples and troubleshooting, refer to the
+package’s github repository, at \url{https://github.com/Ossifragus/runcode}.
+
+\end{abstract}
\section{Installation}
-The package on CTAN can be installed automatically by your \TeX\space software (e.g., MikTeX Update Wizard). You can also simply put the runcode.sty file in the \LaTeX\space project folder. To use the package you have to enable the `shell-escape' option when compiling a \LaTeX\space document.
-
-The server mode requires the \textit{talk2stat} Python package. To install it from the command line, use:
-\verb|pip3 install talk2stat|\\
-The \textit{talk2stat} source is available from \url{https://pypi.org/project/talk2stat/}.
-Note that Python version 3.8.* and up is required.
+\label{sec:org7e4c2ed}
+You can simply put the runcode.sty file in the \LaTeX{} project folder.
+
+The server mode requires the
+\href{https://pypi.org/project/talk2stat/}{talk2stat} package. To install
+it from the command line, use:
+
+\begin{verbatim}
+pip3 install talk2stat
+\end{verbatim}
+
+\textbf{Note}: \texttt{runcode} requires to enable the \texttt{shell-escape} option when
+compiling a \LaTeX{} document.
+
\section{Usage}
-\subsection{Load the package}
-\verb|\usepackage[options]{runcode}|\\
-\\
-Available options are:
-\begin{itemize}
-\item \texttt{julia}: start a \textit{talk2stat} server* for Julia [\url{https://julialang.org/}].
-\item \texttt{matlab}: start a \textit{talk2stat} server* for MatLab [\url{https://www.mathworks.com/products/matlab.html}].
-\item \texttt{R}: start a \textit{talk2stat} server* for R [\url{https://www.r-project.org/}].
-\item \texttt{run}: run source code, and store results in cache files.
-\item \texttt{cache}: use cached results.
-\item \texttt{stopserver}: stop the \textit{talk2stat} server(s) when the pdf compilation is done.
-\item \texttt{nohup}: when using the server-mode, some editors terminate all child processes after LaTeX compiling such as Emacs with Auctex. For this case, use the nohup option. It set the variable notnohup to be false, and the server will not be terminated by the parent process.
-\item \texttt{nominted}: use the \textit{fvextra} package [\url{https://ctan.org/pkg/fvextra}] instead of the \textit{minted} package [\url{https://ctan.org/pkg/minted}] to show code (\textit{fvextra} does not require Python's pygments package [\url{https://pygments.org/}], but it does not provide syntax highlights).
-\item \texttt{reducedspace}: with some document classes minted puts too much space after an embedded block of code. Use this option to remove the extra space.
-\end{itemize}
-* Requires the Python package \textit{talk2stat} to be installed.
-
-\subsection{Basic commands}
-\verb|\runExtCode{Arg1}{Arg2}{Arg3}[Arg4]| runs an external code. The arguments are:
+\label{sec:org2d22735}
+\subsection{Load the package:}
+\label{sec:orgbfab84d}
+\begin{minted}[]{latex}
+\usepackage[options]{runcode}
+\end{minted}
+
+Available options are:
+
+\begin{itemize}
+\item \texttt{cache}: use cached results.
+
+\item \texttt{julia}: start server for \href{https://julialang.org/}{Julia} (requires
+\href{https://pypi.org/project/talk2stat/}{talk2stat}).
+
+\item \texttt{matlab}: start server for
+\href{https://www.mathworks.com/products/matlab.html}{MatLab} (requires
+\href{https://pypi.org/project/talk2stat/}{talk2stat}).
+
+\item \texttt{nominted}: use the \href{https://ctan.org/pkg/fvextra}{fvextra} package
+instead of the \href{https://ctan.org/pkg/minted}{minted} package to show
+code (this does not require the \href{https://pygments.org/}{pygments}
+package, but it does not provide syntax highlights).
+
+\item \texttt{nohup}: use the \texttt{nohup} command when starting a server. When using
+the server-mode, some editors terminate all child processes after
+\LaTeX{} compiling such as Emacs with Auctex. This option set the
+variable notnohup to be false, and the server will not be terminated
+by the parent process. \textbf{This option has to be declared before
+declaring any language}, e.g., \texttt{[nohup, R]} works but \texttt{[R, nohup]}
+does not work.
+
+\item \texttt{python}: start server for \href{https://www.python.org/}{Python}
+(requires \href{https://pypi.org/project/talk2stat/}{talk2stat}).
+
+\item \texttt{run}: run source code.
+
+\item \texttt{R}: start server for \href{https://www.r-project.org/}{R} (requires
+\href{https://pypi.org/project/talk2stat/}{talk2stat}).
+
+\item \texttt{stopserver}: stop the server(s) when the pdf compilation is done.
+\end{itemize}
+
+\textbf{Note}: If \href{https://ctan.org/pkg/minted}{minted} is used, the style of
+the code block is controlled through the minted package,
+\href{https://github.com/Ossifragus/runcode/blob/master/examples/MontyHall/MontyHall.tex\#L3-L4}{e.g.:}
+
+\begin{minted}[]{latex}
+\setminted[julia]{linenos, frame=single, bgcolor=bg, breaklines=true}
+\setminted[R]{linenos, frame=single, bgcolor=lightgray, breaklines=true}
+\end{minted}
+
+The outputs from executing codes are displayed in
+\href{https://ctan.org/pkg/tcolorbox?lang=en}{tcolorbox}, so the style can
+be customized with \texttt{\textbackslash{}tcbset},
+\href{https://github.com/Ossifragus/runcode/blob/master/examples/MontyHall/MontyHall.tex\#L5}{e.g.:}
+
+\begin{minted}[]{latex}
+\tcbset{breakable,colback=red!5!white,colframe=red!75!black}
+\end{minted}
+
+\subsection{Basic commands:}
+\label{sec:org1b11cd1}
+\begin{itemize}
+\item \texttt{\textbackslash{}runExtCode\{Arg1\}\{Arg2\}\{Arg3\}[Arg4]} runs an external code.
+
\begin{itemize}
\item \texttt{Arg1} is the executable program.
\item \texttt{Arg2} is the source file name.
-\item \texttt{Arg3} is the output file name (with an empty value, the counter `codeOutput` is used).
-\item \texttt{Arg4} controls whether to run the code. \texttt{Arg4} is optional with three possible values: if skipped or with empty value, the value of the global Boolean variable \texttt{runcode} as determined by the \texttt{run} option when loading the package, is used; if the value is set to `run`, the code will be executed; if set to `cache` (or anything else), use cached results (see more about the cache below).
+\item \texttt{Arg3} is the output file name (with an empty value, the counter
+\texttt{codeOutput} is used).
+\item \texttt{Arg4} controls whether to run the code. \texttt{Arg4} is optional with
+three possible values: if skipped or with empty value, the value of
+the global Boolean variable \texttt{runcode} is used; if the value is set
+to \texttt{run}, the code will be executed; if set to \texttt{cache} (or anything
+else), use cached results (see more about the cache below).
\end{itemize}
-\bigskip
-\noindent \verb|\showCode{Arg1}{Arg2}[Arg3][Arg4]| shows the source code, using minted for a pretty layout or fvextra (if pygments is not installed).
+\item \texttt{\textbackslash{}showCode\{Arg1\}\{Arg2\}[Arg3][Arg4]} shows the source code, using
+\href{https://ctan.org/pkg/minted}{minted} for a pretty layout or
+\href{https://ctan.org/pkg/fvextra}{fvextra} (if
+\href{https://pygments.org/}{pygments} is not installed).
+
\begin{itemize}
\item \texttt{Arg1} is the programming language.
\item \texttt{Arg2} is the source file name.
\item \texttt{Arg3} is the first line to show (optional with a default value 1).
-\item \texttt{Arg4} is the last line to show (optional with a default value of the last line).
+\item \texttt{Arg4} is the last line to show (optional with a default value of
+the last line).
\end{itemize}
-\bigskip
-\noindent \verb|\includeOutput{Arg1}[Arg2]| is used to embed the output from executed code.
+\item \texttt{\textbackslash{}includeOutput\{Arg1\}[Arg2]} is used to embed the output from executed
+code.
+
\begin{itemize}
-\item \texttt{Arg1} is the output file name, and it needs to have the same value as that of \texttt{Arg3} in \verb|\runExtCode|. If an empty value is given to \texttt{Arg1}, the counter `codeOutput` is used.
-\item \texttt{Arg2} is optional and it controls the type of output with a default value `vbox`
+\item \texttt{Arg1} is the output file name, and it needs to have the same value
+as that of \texttt{Arg3} in \texttt{\textbackslash{}runExtCode}. If an empty value is given to
+\texttt{Arg1}, the counter \texttt{codeOutput} is used.
+\item \texttt{Arg2} is optional and it controls the type of output with a default
+value \texttt{vbox}
\begin{itemize}
\item \texttt{vbox} (or skipped) = verbatim in a box.
\item \texttt{tex} = pure latex.
-\item \texttt{inline} = embed result in text.
+\item \texttt{inline} = embed result in text.
\end{itemize}
\end{itemize}
-\bigskip
-\noindent \verb|\inln{Arg1}{Arg2}[Arg3]| is designed for simple calculations; it runs one command (or a short batch) and displays the output within the text.
+\item \texttt{\textbackslash{}inln\{Arg1\}\{Arg2\}[Arg3]} is designed for simple calculations; it runs
+one command (or a short batch) and displays the output within the
+text.
+
\begin{itemize}
-\item \texttt{Arg1} is the executable program or programming language.
-\item \texttt{Arg2} is the source code.
+\item \texttt{Arg1} is the executable program or programming language.
+\item \texttt{Arg2} is the source code.
\item \texttt{Arg3} is the output type.
\begin{itemize}
\item \texttt{inline} (or skipped or with empty value) = embed result in text.
\item \texttt{vbox} = verbatim in a box.
\end{itemize}
\end{itemize}
-
-\subsection{Language specific shortcuts}
-\verb|\runJulia[Arg1]{Arg2}{Arg3}[Arg4]| runs an external Julia code file.
-\begin{itemize}
-\item \texttt{Arg1} is optional and uses \textit{talk2stat}'s Julia server by default.
-\item \texttt{Arg2}, \texttt{Arg3}, and \texttt{Arg4} have the same effects as those of the basic command \verb|\runExtCode|.
\end{itemize}
-\noindent \verb|\inlnJulia[Arg1]{Arg2}[Arg3]| runs Julia source code (\texttt{Arg2}) and displays the output in line.
-\begin{itemize}
-\item \texttt{Arg1} is optional and uses the Julia server by default.
-\item \texttt{Arg2} is the Julia source code to run. If the Julia source code is wrapped between \verb|```| on both sides (as in the markdown grammar), then it will be implemented directly; otherwise the code will be written to a file on the disk and then be called.
-\item \texttt{Arg3} has the same effect as that of the basic command \verb|\inln|.
-\end{itemize}
+\subsection{Language specific shortcuts:}
+\label{sec:org154f922}
+\href{https://julialang.org/}{Julia}
-\bigskip
-\noindent \verb|\runMatLab[Arg1]{Arg2}{Arg3}[Arg4]| runs an external MatLab code file.
\begin{itemize}
-\item \texttt{Arg1} is optional and uses \textit{talk2stat}'s MatLab server by default.
-\item \texttt{Arg2}, \texttt{Arg3}, and \texttt{Arg4} have the same effects as those of the basic command \verb|\runExtCode|.
+\item \texttt{\textbackslash{}runJulia[Arg1]\{Arg2\}\{Arg3\}[Arg4]} runs an external
+\href{https://julialang.org/}{Julia} code file.
+\begin{itemize}
+\item \texttt{Arg1} is optional and uses
+\href{https://pypi.org/project/talk2stat/}{talk2stat}'s
+\href{https://julialang.org/}{Julia} server by default.
+\item \texttt{Arg2}, \texttt{Arg3}, and \texttt{Arg4} have the same effects as those of the
+basic command \texttt{\textbackslash{}runExtCode}.
\end{itemize}
-
-\noindent
-\verb|\inlnMatLab[Arg1]{Arg2}[Arg3]| runs MatLab source code (\texttt{Arg2}) and displays the output in line.
+\item \texttt{\textbackslash{}inlnJulia[Arg1]\{Arg2\}[Arg3]} runs \href{https://julialang.org/}{Julia}
+source code (\texttt{Arg2}) and displays the output in line.
\begin{itemize}
-\item \texttt{Arg1} is optional and uses the MatLab server by default.
-\item \texttt{Arg2} is the MatLab source code to run. If the MatLab source code is wrapped between \verb|```| on both sides (as in the markdown grammar), then it will be implemented directly; otherwise the code will be written to a file on the disk and then be called.
-\item \texttt{Arg3} has the same effect as that of the basic command \verb|\inln|.
+\item \texttt{Arg1} is optional and uses the \href{https://julialang.org/}{Julia}
+server by default.
+\item \texttt{Arg2} is the \href{https://julialang.org/}{Julia} source code to run.
+If the \href{https://julialang.org/}{Julia} source code is wrapped
+between "\texttt{```}" on both sides (as in the markdown grammar), then it
+will be implemented directly; otherwise the code will be written to
+a file on the disk and then be called.
+\item \texttt{Arg3} has the same effect as that of the basic command \texttt{\textbackslash{}inln}.
+\end{itemize}
\end{itemize}
+\href{https://www.mathworks.com/products/matlab.html}{MatLab}
-\bigskip
-\noindent \verb|\runR[Arg1]{Arg2}{Arg3}[Arg4]| runs an external R code file.
\begin{itemize}
-\item \texttt{Arg1} is optional and uses \textit{talk2stat]}'s R server by default.
-\item \texttt{Arg2}, \texttt{Arg3}, and \texttt{Arg4} have the same effects as those of the basic command \verb|\runExtCode|.
+\item \texttt{\textbackslash{}runMatLab[Arg1]\{Arg2\}\{Arg3\}[Arg4]} runs an external
+\href{https://www.mathworks.com/products/matlab.html}{MatLab} code file.
+\begin{itemize}
+\item \texttt{Arg1} is optional and uses
+\href{https://pypi.org/project/talk2stat/}{talk2stat}'s
+\href{https://www.mathworks.com/products/matlab.html}{MatLab} server by
+default.
+\item \texttt{Arg2}, \texttt{Arg3}, and \texttt{Arg4} have the same effects as those of the
+basic command \texttt{\textbackslash{}runExtCode}.
\end{itemize}
-
-\noindent \verb|\inlnR[Arg1]{Arg2}[Arg3]| runs R source code (\texttt{Arg2}) and displays the output in line.
+\item \texttt{\textbackslash{}inlnMatLab[Arg1]\{Arg2\}[Arg3]} runs
+\href{https://www.mathworks.com/products/matlab.html}{MatLab} source code
+(\texttt{Arg2}) and displays the output in line.
\begin{itemize}
-\item \texttt{Arg1} is optional and uses the R server by default.
-\item \texttt{Arg2} is the R source code to run. If the R source code is wrapped between \verb|```| on both sides (as in the markdown grammar), then it will be implemented directly; otherwise the code will be written to a file on the disk and then be called.
-\item \texttt{Arg3} has the same effect as that of the basic command \verb|\inln|.
+\item \texttt{Arg1} is optional and uses the
+\href{https://www.mathworks.com/products/matlab.html}{MatLab} server by
+default.
+\item \texttt{Arg2} is the
+\href{https://www.mathworks.com/products/matlab.html}{MatLab} source
+code to run. If the
+\href{https://www.mathworks.com/products/matlab.html}{MatLab} source
+code is wrapped between "```" on both sides (as in the markdown
+grammar), then it will be implemented directly; otherwise the code
+will be written to a file on the disk and then be called.
+\item \texttt{Arg3} has the same effect as that of the basic command \texttt{\textbackslash{}inln}.
+\end{itemize}
\end{itemize}
+\href{https://www.python.org/}{Python}
-\bigskip
-\noindent \verb|\runPython[Arg1]{Arg2}{Arg3}[Arg4]| runs an external Python code file.
\begin{itemize}
-\item \texttt{Arg1} is optional and uses \textit{talk2stat]}'s Python server by default.
-\item \texttt{Arg2}, \texttt{Arg3}, and \texttt{Arg4} have the same effects as those of the basic command \verb|\runExtCode|.
+\item \texttt{\textbackslash{}runPython[Arg1]\{Arg2\}\{Arg3\}[Arg4]} runs an external
+\href{https://www.python.org/}{Python} code file.
+\begin{itemize}
+\item \texttt{Arg1} is optional and uses
+\href{https://pypi.org/project/talk2stat/}{talk2stat}'s
+\href{https://julialang.org/}{Julia} server by default.
+\item \texttt{Arg2}, \texttt{Arg3}, and \texttt{Arg4} have the same effects as those of the
+basic command \texttt{\textbackslash{}runExtCode}.
\end{itemize}
-
-\noindent \verb|\inlnPython[Arg1]{Arg2}[Arg3]| runs Python source code (\texttt{Arg2}) and displays the output in line.
+\item \texttt{\textbackslash{}inlnPython[Arg1]\{Arg2\}[Arg3]} runs
+\href{https://www.python.org/}{Python} source code (\texttt{Arg2}) and displays
+the output in line.
\begin{itemize}
-\item \texttt{Arg1} is optional and uses the Python server by default.
-\item \texttt{Arg2} is the R source code to run. If the Python source code is wrapped between \verb|```| on both sides (as in the markdown grammar), then it will be implemented directly; otherwise the code will be written to a file on the disk and then be called.
-\item \texttt{Arg3} has the same effect as that of the basic command \verb|\inln|.
+\item \texttt{Arg1} is optional and uses the \href{https://www.python.org/}{Python}
+server by default.
+\item \texttt{Arg2} is the \href{https://julialang.org/}{Julia} source code to run.
+If the \href{https://www.python.org/}{Python} source code is wrapped
+between "```" on both sides (as in the markdown grammar), then it
+will be implemented directly; otherwise the code will be written to
+a file on the disk and then be called.
+\item \texttt{Arg3} has the same effect as that of the basic command \texttt{\textbackslash{}inln}.
\end{itemize}
-
-\noindent \verb|\runPythonBatch[Arg1][Arg2]| runs an external Python source code (\texttt{Arg1}) in batch mode (without a server running). Python (at least currently), unlike the other languages we use, does not have an option to save and restore a session, which means that once a Python session ends, the working environment (variable, functions) is deleted. In order to allow a batch-mode in Python, we implemented such capability. It requires the dill module (https://pypi.org/project/dill/) module, which has to be installed via `pip3 install dill`.
+\item \texttt{\textbackslash{}runPythonBatch[Arg1][Arg2]} runs an external
+\href{https://www.python.org/}{Python} code file in batch mode (without a
+server running). Python (at least currently), unlike the other
+languages we use, does not have an option to save and restore a
+session, which means that once a Python session ends, the working
+environement (variable, functions) is deleted. In order to allow a
+batch-mode in Python, we implemented such capability. It requires the
+\href{https://pypi.org/project/dill/}{dill} module, which has to be
+installed via \texttt{pip3 install dill}.
\begin{itemize}
-\item \texttt{Arg1} is the Python source code to run.
+\item \texttt{Arg1} is the \href{https://www.python.org/}{Python} source file name,
\item \texttt{Arg2} is the output file name.
\end{itemize}
+\end{itemize}
-
+\href{https://www.r-project.org/}{R}
+
+\begin{itemize}
+\item \texttt{\textbackslash{}runR[Arg1]\{Arg2\}\{Arg3\}[Arg4]} runs an external
+\href{https://www.r-project.org/}{R} code file.
+\begin{itemize}
+\item \texttt{Arg1} is optional and uses
+\href{https://pypi.org/project/talk2stat/}{talk2stat}'s
+\href{https://www.r-project.org/}{R} server by default.
+\item \texttt{Arg2}, \texttt{Arg3}, and \texttt{Arg4} have the same effects as those of the
+basic command \texttt{\textbackslash{}runExtCode}.
+\end{itemize}
+\item \texttt{\textbackslash{}inlnR[Arg1]\{Arg2\}[Arg3]} runs \href{https://www.r-project.org/}{R}
+source code (\texttt{Arg2}) and displays the output in line.
+\begin{itemize}
+\item \texttt{Arg1} is optional and uses the \href{https://www.r-project.org/}{R}
+server by default.
+\item \texttt{Arg2} is the \href{https://www.r-project.org/}{R} source code to run.
+If the \href{https://www.r-project.org/}{R} source code is wrapped
+between "```" on both sides (as in the markdown grammar), then it
+will be implemented directly; otherwise the code will be written to
+a file on the disk and then be called.
+\item \texttt{Arg3} has the same effect as that of the basic command \texttt{\textbackslash{}inln}.
+\end{itemize}
+\end{itemize}
\section{Revisions}
+\label{sec:orgf446497}
\begin{itemize}
-\item v1.6, August 10, 2022: stop only configured/running servers; a new reducedspace option - some document classes put more space after the code box; changed the default timeout of servers to 60 seconds; expanded the troubleshooting document. New examples are now available on GitHub, including how to collaborate with people who use Overleaf.
-\item v1.5, July 23, 2022: Removed the utf8x option when loading inputenc due to a conflict with hyperref.
+\item v1.7, August 20, 2022: changed the tmp/ folder to generated/ in order to
+conform with CTAN suggestions; renamed the troubleshooting file.
+\item v1.6, August 10, 2022: stop only configured/running servers; a new
+reducedspace option - some document classes put more space after the code box;
+changed the default timeout of servers to 60 seconds; expanded the
+troubleshooting document. New examples are now available on GitHub, including
+how to collaborate with people who use Overleaf.
+\item v1.5, July 23, 2022: Removed the utf8x option when loading inputenc due to a
+conflict with hyperref.
\item v1.4, July 18, 2022: Fixed a bug in the cache mode.
\item v1.3, May 14, 2022: Removed the hard-coded minted options.
\item v1.2, May 3, 2022: Added python options (server and batch).
-\item v1.1, April 17, 2021: Added a nohup option; improved error handling (missing code files, zero bytes in output files.)
+\item v1.1, April 17, 2021: Added a nohup option; improved error handling (missing
+code files, zero bytes in output files.)
\end{itemize}
-
-%
\section{Contributing}
-We welcome your contributions to this package by opening issues on GitHub and/or making a pull request. We also appreciate more example documents written using \textsf{runcode}.
+\label{sec:org0730899}
+We welcome your contributions to this package by opening issues on
+GitHub and/or making a pull request. We also appreciate more example
+documents written using \texttt{runcode}.
+
+\textbf{Citing} \texttt{runcode}:
+Haim Bar and HaiYing Wang (2021). \href{https://jds-online.org/journal/JDS/article/103/info}{Reproducible Science with \LaTeX{}},
+\emph{Journal of Data Science} 2021; 19, no. 1, 111-125, DOI 10.6339/21-JDS998
\end{document}
diff --git a/macros/latex/contrib/runcode/runcode_troubleshoot.pdf b/macros/latex/contrib/runcode/runcode_troubleshoot.pdf
new file mode 100644
index 0000000000..1c592c14e2
--- /dev/null
+++ b/macros/latex/contrib/runcode/runcode_troubleshoot.pdf
Binary files differ
diff --git a/macros/latex/contrib/runcode/troubleshoot.tex b/macros/latex/contrib/runcode/runcode_troubleshoot.tex
index 0a37015b9b..2d4d6c7956 100644
--- a/macros/latex/contrib/runcode/troubleshoot.tex
+++ b/macros/latex/contrib/runcode/runcode_troubleshoot.tex
@@ -1,7 +1,7 @@
\documentclass[a4paper,10pt]{article}
\usepackage[a4paper, total={6in, 10in}]{geometry}
%\usepackage[square,sort,comma]{natbib}
-%\usepackage[R,stopserver]{runcode}
+% \usepackage[R,stopserver]{runcode}
\usepackage[cache]{runcode}
\usepackage{caption}
@@ -130,7 +130,7 @@ If the source code file doesn't exist, we get an error message as with \verb|\ru
Check that the correct executable is used, since \verb|\runExtCode| requires the specific program and command line arguments. For example, using R as the executable will not work in the following example:\\
\verb|\runExtCode{R}{paper/supplement/Code/code1.R}{testWithR}|\\
%\runExtCode{R}{paper/supplement/Code/code1.R}{testWithR}
-It will create the file tmp/testWithR.tex, and in it you will see\\
+It will create the file generated/testWithR.tex, and in it you will see\\
\verb|ARGUMENT 'paper/supplement/Code/code1.R' __ignored__|\\
This is a fatal error -- the compiler will get stuck because it will wait for the code to finish, and the compilation process will have to be terminated by the user.
\noindent
@@ -168,7 +168,7 @@ Arg \#4 controls when to run the code (optional - if not given, it listens
The first argument can be \textit{any} command-line executable, including user-defined program names (compiled code, aliases, etc.). Because of that, we do not perform validity check before trying to execute it.
For example, the following will not produce any error message:\\
\verb|\runExtCode{C}{test.R}{}|\\
-but it will be possible to see an empty file in the tmp folder. This will be obvious to the user once the \verb|\includeOutput| command is executed in order to embed results in the compiled pdf document.
+but it will be possible to see an empty file in the generated folder. This will be obvious to the user once the \verb|\includeOutput| command is executed in order to embed results in the compiled pdf document.
\egroup
@@ -188,7 +188,7 @@ Then to see the output, the correct usage is\\
\verb|\includeOutput{testWithrunR}[vbox]|\\
\includeOutput{testWithrunR}[vbox]
-\noindent Although the physical file is named tmp/testWithrunR.tex, we drop the tmp/ prefix and the .tex suffix. If we do include them, the file will not be found and we'll get an error message:\\
+\noindent Although the physical file is named generated/testWithrunR.tex, we drop the generated/ prefix and the .tex suffix. If we do include them, the file will not be found and we'll get an error message:\\
\verb|\includeOutput{testWithrunR.tex}[vbox]|
\includeOutput{testWithrunR.tex}[vbox]
\egroup
@@ -232,7 +232,7 @@ Will look better: A matrix \inlnR{```matrix(1:9,ncol=3,nrow=3)```}[vbox].
This type of problem can also be due to invalid output in the cache files. If for some reason, the cache files contain special characters or an underscore in text-mode, then the output will be corrupted. It is recommended to clear the cache, and if server-mode is used to also restart the server. For example, suppose that the directory of the project is called proj, and we're using Python in server-mode. From the command line, run the following:
\begin{Verbatim}
cd proj
-rm -f proj.aux tmp/*.txt nohup.out proj.synctex.gz
+rm -f proj.aux generated/*.txt nohup.out proj.synctex.gz
python3 -c 'from talk2stat.talk2stat import client; client("./","python","QUIT")'
rm -f serverPIDpython.txt pythondebug.txt talk2stat.log
\end{Verbatim}
@@ -268,7 +268,7 @@ rm -f serverPIDjulia.txt juliadebug.txt talk2stat.log
\cause\bgroup
-If the correct output is in the files in tmp directory, but it's not showing in the pdf file, it can be due to the \LaTeX~ compiler's naming of temporary files. Usually, the auto-generated file names start with the main tex file name (e.g. if the main tex file is called troubleshoot.tex then runcode will create files such as \verb|troubleshoot_inln5.tex|). However, working with Overleaf we noticed that their compiler uses another convention for temporary file names. To prevent such problems, you can add the following in the preamble of the main document:
+If the correct output is in the files in generated directory, but it's not showing in the pdf file, it can be due to the \LaTeX~ compiler's naming of temporary files. Usually, the auto-generated file names start with the main tex file name (e.g. if the main tex file is called troubleshoot.tex then runcode will create files such as \verb|troubleshoot_inln5.tex|). However, working with Overleaf we noticed that their compiler uses another convention for temporary file names. To prevent such problems, you can add the following in the preamble of the main document:
\begin{Verbatim}
\edef\TeXjobname{\jobname} % (this line is not really essential.)
\edef\jobname{\detokenize{troubleshoot}}
diff --git a/macros/latex/contrib/runcode/troubleshoot.pdf b/macros/latex/contrib/runcode/troubleshoot.pdf
deleted file mode 100644
index c170da9113..0000000000
--- a/macros/latex/contrib/runcode/troubleshoot.pdf
+++ /dev/null
Binary files differ