Compare commits
No commits in common. "a911b98520ee67087e9b13df145e193951b16cb6" and "bde6c11a27c2896e6b0d0017359c34a1bc10026c" have entirely different histories.
a911b98520
...
bde6c11a27
10
Makefile
10
Makefile
@ -2,18 +2,10 @@ 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 && ls"
|
docker run simple sh -c "bopytex -q 2 tpl_example.tex && cat 1_example.tex"
|
||||||
|
|
||||||
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
|
|
||||||
|
44
README.md
44
README.md
@ -6,8 +6,6 @@ Bopytex is a command line tool which embed python into latex. It uses jinja2 to
|
|||||||
|
|
||||||
## Installing
|
## Installing
|
||||||
|
|
||||||
Bopytex depends on `texlive` and `textlive-extra-utils` (for latexmk and pdfjoin)
|
|
||||||
|
|
||||||
Install and update using [pip](https://pip.pypa.io/en/stable/quickstart/)
|
Install and update using [pip](https://pip.pypa.io/en/stable/quickstart/)
|
||||||
|
|
||||||
pip install -U bopytex
|
pip install -U bopytex
|
||||||
@ -43,7 +41,7 @@ We have two variables
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
The following command produces the [joined_example.pdf](./example/simple/joined_example.pdf) document
|
To create a version a this document type this
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
$ bopytex tpl_simple.tex
|
$ bopytex tpl_simple.tex
|
||||||
@ -58,11 +56,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,27 +81,6 @@ 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}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -118,21 +95,8 @@ 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](./example/usecase/joined_example.pdf)
|
Then I can produce a subject for each of my student
|
||||||
|
|
||||||
``` 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
|
|
||||||
|
|
||||||
I build two examples base of the simple example and how I use it. They are playable through dockerfiles with make commands.
|
|
||||||
|
|
||||||
For the simple example
|
|
||||||
|
|
||||||
make docker-simple
|
|
||||||
|
|
||||||
For how I use it
|
|
||||||
|
|
||||||
make docker-usecase
|
|
||||||
|
Binary file not shown.
@ -22,23 +22,9 @@ We have two variables
|
|||||||
|
|
||||||
\section{Variables}
|
\section{Variables}
|
||||||
\subsection{subject}
|
\subsection{subject}
|
||||||
\begin{itemize}
|
\Var{subject}
|
||||||
%- for k,v in subject.items()
|
|
||||||
\item
|
|
||||||
\begin{verbatim}
|
|
||||||
\Var{k}: \Var{v}
|
|
||||||
\end{verbatim}
|
|
||||||
%- endfor
|
|
||||||
\end{itemize}
|
|
||||||
\subsection{options}
|
\subsection{options}
|
||||||
\begin{itemize}
|
\Var{options}
|
||||||
%- for k,v in options.items()
|
|
||||||
\item
|
|
||||||
\begin{verbatim}
|
|
||||||
\Var{k}: \Var{v}
|
|
||||||
\end{verbatim}
|
|
||||||
%- endfor
|
|
||||||
\end{itemize}
|
|
||||||
|
|
||||||
|
|
||||||
\end{document}
|
\end{document}
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
import random
|
|
||||||
|
|
||||||
from mapytex import Expression
|
from mapytex import Expression
|
||||||
|
|
||||||
random.seed(0)
|
direct_access = {"Expression": Expression}
|
||||||
|
|
||||||
direct_access = {"Expression": Expression, "random": random.random}
|
|
||||||
|
Binary file not shown.
@ -15,22 +15,8 @@
|
|||||||
|
|
||||||
\section{Variables}
|
\section{Variables}
|
||||||
\subsection{subject}
|
\subsection{subject}
|
||||||
\begin{itemize}
|
\Var{subject}
|
||||||
%- for k,v in subject.items()
|
|
||||||
\item
|
|
||||||
\begin{verbatim}
|
|
||||||
\Var{k}: \Var{v}
|
|
||||||
\end{verbatim}
|
|
||||||
%- endfor
|
|
||||||
\end{itemize}
|
|
||||||
\subsection{options}
|
\subsection{options}
|
||||||
\begin{itemize}
|
\Var{options}
|
||||||
%- for k,v in options.items()
|
|
||||||
\item
|
|
||||||
\begin{verbatim}
|
|
||||||
\Var{k}: \Var{v}
|
|
||||||
\end{verbatim}
|
|
||||||
%- endfor
|
|
||||||
\end{itemize}
|
|
||||||
|
|
||||||
\end{document}
|
\end{document}
|
||||||
|
Loading…
Reference in New Issue
Block a user