From 98f6c29d3a83ac4cc69ec4a79da55608a89bec55 Mon Sep 17 00:00:00 2001 From: lafrite Date: Fri, 18 Oct 2013 13:48:43 +0200 Subject: [PATCH] ??? --- DS_09_litt_mediane.tpl.tex | 2 +- number_rotation.py | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/DS_09_litt_mediane.tpl.tex b/DS_09_litt_mediane.tpl.tex index 7c62a58..3e953a9 100644 --- a/DS_09_litt_mediane.tpl.tex +++ b/DS_09_litt_mediane.tpl.tex @@ -50,7 +50,7 @@ Le barème est donné à titre indicatif, il pourra être modifié. \begin{Exo}[5.5] Voici les performances en saut en hauteur d'une classe de troisième. Les hauteurs sont données en centimètres. \begin{equation*} - %{{ random.hauteurs() %}} + %{{ "; \\quad ".join(random.gaussRandomlist_strInt(120, 20, 10)) %}} \end{equation*} \begin{enumerate}[a.] \item Quel est l'effectif total de cette série? diff --git a/number_rotation.py b/number_rotation.py index e3e85d1..e5f4ea6 100755 --- a/number_rotation.py +++ b/number_rotation.py @@ -12,6 +12,8 @@ def randfloat(approx = 1, low = 0, up = 10): ans = round(ans, approx) return ans +random.randfloat = randfloat + def gaussRandomlist(mu = 0, sigma = 1, size = 10, manip = lambda x:x): """ return a list of a gaussian sample """ ans = [] @@ -19,12 +21,13 @@ def gaussRandomlist(mu = 0, sigma = 1, size = 10, manip = lambda x:x): ans += [manip(random.gauss(mu,sigma))] return ans -def hauteurs(num = 15): - return " ;\\quad ".join(gaussRandomlist(mu = 120, sigma = 10, size = 15, manip = lambda x: str(int(x)))) - -random.randfloat = randfloat random.gaussRandomlist = gaussRandomlist -random.hauteurs = hauteurs + +def gaussRandomlist_strInt(mu = 0, sigma = 1, size = 10): + return gaussRandomlist(mu, sigma, size, manip = lambda x: str(int(x))) + +random.gaussRandomlist_strInt = gaussRandomlist_strInt + report_renderer = jinja2.Environment( block_start_string = '%{', @@ -50,7 +53,9 @@ def main(options): with open( dest, 'w') as f: f.write(template.render(random = random, infos = {"subj" : subj})) os.system("pdflatex " + dest) - os.system("rm *.aux *.log") + + if not options.dirty: + os.system("rm *.aux *.log") if __name__ == '__main__': @@ -59,6 +64,7 @@ if __name__ == '__main__': parser.add_option("-t","--tempalte",action="store",type="string",dest="template", help="File with template") parser.add_option("-o","--output",action="store",type="string",dest="output",help="Base name for output (without .tex or any extension))") parser.add_option("-n","--number_subjects", action="store",type="int", dest="num_subj", default = 2, help="The number of subjects to make") + parser.add_option("-d","--dirty", action="store_true", dest="dirty", help="Do not clean after compilation") (options, args) = parser.parse_args()