Feat: produce joined_example.pdf for the two examples
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Bertrand Benjamin 2022-08-06 18:04:46 +02:00
parent bf237d77e5
commit a911b98520
7 changed files with 72 additions and 10 deletions

View File

@ -2,10 +2,18 @@ docker-build-simple:
docker build -f Dockerfile.simple -t simple . docker build -f Dockerfile.simple -t simple .
docker-simple: docker-build-simple docker-simple: docker-build-simple
docker run simple sh -c "bopytex -q 2 tpl_example.tex && cat 1_example.tex" docker run simple sh -c "bopytex -q 2 tpl_example.tex && ls"
docker-build-usecase: docker-build-usecase:
docker build -f Dockerfile.usecase -t usecase . docker build -f Dockerfile.usecase -t usecase .
docker-usecase: docker-build-usecase docker-usecase: docker-build-usecase
docker run usecase sh -c "bopytex -s students.csv tpl_example.tex && cat 1_example.tex" docker run usecase sh -c "bopytex -s students.csv tpl_example.tex && cat 1_example.tex"
usecase-example: docker-build-usecase
docker run usecase sh -c "bopytex -s students.csv tpl_example.tex && cat joined_example.pdf" > example/usecase/joined_example.pdf
simple-example: docker-build-simple
docker run simple sh -c "bopytex -q 2 tpl_example.tex && cat joined_example.pdf" > example/simple/joined_example.pdf
examples: usecase-example simple-example

View File

@ -43,7 +43,7 @@ We have two variables
``` ```
To create a version a this document type this The following command produces the [joined_example.pdf](./example/simple/joined_example.pdf) document
``` bash ``` bash
$ bopytex tpl_simple.tex $ bopytex tpl_simple.tex
@ -58,11 +58,11 @@ To produce formulas and values, I use an another tool I an developing: `mapytex
``` python ``` python
# bopytex_config.py # bopytex_config.py
from mapytex import Expression from mapytex import Expression
from random import random
random.seed(0) # Controlling the seed allows to make subject reproductible
direct_access = { direct_access = {
"Expression": Expression, "Expression": Expression,
"random": random
} }
``` ```
@ -83,6 +83,27 @@ Every variables, objects or function inside this file will be available inside t
\Var{e.simplify()} \Var{e.simplify()}
\section{Variables}
\subsection{subject}
\begin{itemize}
%- for k,v in subject.items()
\item
\begin{verbatim}
\Var{k}: \Var{v}
\end{verbatim}
%- endfor
\end{itemize}
\subsection{options}
\begin{itemize}
%- for k,v in options.items()
\item
\begin{verbatim}
\Var{k}: \Var{v}
\end{verbatim}
%- endfor
\end{itemize}
\end{document} \end{document}
``` ```
@ -97,12 +118,13 @@ Information about my students are stored in a csv file (here `students.csv`)
"Nicholas Taylor","28","n.taylor@randatmail.com","3","3" "Nicholas Taylor","28","n.taylor@randatmail.com","3","3"
``` ```
Then I can produce a subject for each of my student Then I can produce a [subject for each of my student](./example/usecase/joined_example.pdf)
``` bash ``` bash
$ bopytex tpl_simple.tex -s students.csv -c bopytex_config.py $ bopytex tpl_simple.tex -s students.csv -c bopytex_config.py
``` ```
## Running examples ## Running examples
I build two examples base of the simple example and how I use it. They are playable through dockerfiles with make commands. I build two examples base of the simple example and how I use it. They are playable through dockerfiles with make commands.

Binary file not shown.

View File

@ -22,9 +22,23 @@ We have two variables
\section{Variables} \section{Variables}
\subsection{subject} \subsection{subject}
\Var{subject} \begin{itemize}
%- for k,v in subject.items()
\item
\begin{verbatim}
\Var{k}: \Var{v}
\end{verbatim}
%- endfor
\end{itemize}
\subsection{options} \subsection{options}
\Var{options} \begin{itemize}
%- for k,v in options.items()
\item
\begin{verbatim}
\Var{k}: \Var{v}
\end{verbatim}
%- endfor
\end{itemize}
\end{document} \end{document}

View File

@ -1,3 +1,7 @@
import random
from mapytex import Expression from mapytex import Expression
direct_access = {"Expression": Expression} random.seed(0)
direct_access = {"Expression": Expression, "random": random.random}

Binary file not shown.

View File

@ -15,8 +15,22 @@
\section{Variables} \section{Variables}
\subsection{subject} \subsection{subject}
\Var{subject} \begin{itemize}
%- for k,v in subject.items()
\item
\begin{verbatim}
\Var{k}: \Var{v}
\end{verbatim}
%- endfor
\end{itemize}
\subsection{options} \subsection{options}
\Var{options} \begin{itemize}
%- for k,v in options.items()
\item
\begin{verbatim}
\Var{k}: \Var{v}
\end{verbatim}
%- endfor
\end{itemize}
\end{document} \end{document}