Go to file
2022-05-08 09:15:13 +02:00
bopytex Feat: dockerfile to test bopytex in new environment 2022-05-08 09:15:13 +02:00
documentation Remove pyMath occurency 2017-04-17 17:04:14 +03:00
example Feat: Organize script to work in CLI 2022-05-04 18:00:54 +02:00
test Feat: dockerfile to test bopytex in new environment 2022-05-08 09:15:13 +02:00
.drone.yml Fix: only on tagging? 2020-08-20 16:27:17 +02:00
.gitignore core: remove tests from .gitignore 2022-04-14 11:29:39 +02:00
Dockerfile Feat: dockerfile to test bopytex in new environment 2022-05-08 09:15:13 +02:00
MANIFEST.in spelling and wrong arg 2015-05-16 10:50:03 +02:00
README.md Feat: add badge 2020-08-20 16:20:43 +02:00
requirements.txt Feat: Create dockerfile to test in new env 2022-05-04 18:03:58 +02:00
setup.py Feat: dockerfile to test bopytex in new environment 2022-05-08 09:15:13 +02:00

Bopytex

Build Status

Bopytex is a command line tool for producing random math exercises with their correction. It embeds mapytex and python into latex through jinja.

Installing

Install and update using pip

pip install -U bopytex

Simple example

Let's say I want an exercise on adding 2 fractions (files are in examples).

The latex template called tpl_add_fraction.tex

\documentclass[12pt]{article}

\begin{document}

\section{Ajouts de fractions}

Adding two fractions
%- set e = Expression.random("{a} / {b} + {c} / {k*b}", ["b > 1", "k>1"])
\[
    A = \Var{e}
\]
Solution 
\[
    \Var{e.simplify().explain() | join('=')}
\]
\end{document}

Generate latex files and compile those for 2 different subjects.

bopytex -t tpl_add_fractions.tex -N 2

It produces 2 sources files

  • 01_add_fractions.tex
\documentclass[12pt]{article}

\begin{document}

\section{Ajouts de fractions}

Adding two fractions
\[
    A = \frac{- 2}{4} + \frac{7}{8}
\]
Solution 
\[
    \frac{- 2}{4} + \frac{7}{8}=\frac{- 2 \times 2}{4 \times 2} + \frac{7}{8}=\frac{- 4}{8} + \frac{7}{8}=\frac{- 4 + 7}{8}=\frac{3}{8}
\]

\end{document}
  • 02_add_fractions.tex
\documentclass[12pt]{article}

\begin{document}

\section{Ajouts de fractions}

Adding two fractions
\[
    A = \frac{8}{9} + \frac{3}{63}
\]
Solution 
\[
    \frac{8}{9} + \frac{3}{63}=\frac{8 \times 7}{9 \times 7} + \frac{3}{63}=\frac{56}{63} + \frac{3}{63}=\frac{56 + 3}{63}=\frac{59}{63}
\]

\end{document}

And a ready to print pdf.