# Bopytex [![Build Status](https://drone.opytex.org/api/badges/lafrite/Bopytex/status.svg)](https://drone.opytex.org/lafrite/Bopytex) Bopytex is a command line tool which embed python into latex. It uses jinja2 to do so with a modified environnement to match with latex syntax. ## 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/) pip install -U bopytex ## Simple example ``` latex % save this as tpl_simple.tex \documentclass[12pt]{article} \title{Bopytex example -- {{ number }}} \begin{document} \maketitle %- set a = 10 %- set n = 2 We have two variables \begin{itemize} \item a: \Var{a} \item n: \Var{n} \end{itemize} \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} ``` The following command produces the [joined_example.pdf](./example/simple/joined_example.pdf) document ``` bash $ bopytex tpl_simple.tex ``` ## How I use it I build this program to produce individual exams subjects for each of my student with the correction associated. I write a template, and bopytex build subject and correction. To produce formulas and values, I use an another tool I an developing: `mapytex