diff --git a/data/templates/maths/de/first_page.tex b/data/templates/maths/de/first_page.tex index 0a7552d..7505bc7 100644 --- a/data/templates/maths/de/first_page.tex +++ b/data/templates/maths/de/first_page.tex @@ -1,55 +1,55 @@ % First page - GERMAN \noindent \begin{minipage}[c]{350pt} \bf \prof~-~\ExamName~-~\SECTION \\ ~ \\ \bf \ExamDate~-~Dauer: \Time \end{minipage} \begin{minipage}[c]{100pt} \includegraphics[scale=0.24]{Logo_EPFL} \end{minipage} \vfill \begin{minipage}[c]{\textwidth} \noindent \hfill\fontsize{100}{120}{\selectfont{\ID{}}}\hfill \vspace{1cm} \par \noindent \hfill\fontsize{40}{48}{\selectfont{\NAME{}}}\hfill~ \end{minipage} \vfill \noindent -\namefield{SCIPER: {\Large \bf \SCIPER{} }} \hfill Unterschrift:~\textcolor{light-Gray}{\rule{6cm}{2cm}}\\ +\namefield{SCIPER: {\Large \bf \SCIPER{} }} \hfill Unterschrift:~\textcolor{light-Gray}{\rule{5cm}{1.5cm}}\\ ~ \\ \noindent \textbf{Drehen Sie diese Seite nicht um, bevor Sie dazu aufgefordert werden.} \textbf{Jedes Blatt hat eine Vorder- und eine R\"uckseite. Es gibt \totalPages\ Seiten, die letzten sind m\"oglicherweise leer.} \textbf{L\"osen Sie nicht die Heftklammern.} \begin{itemize} \item[--] Legen Sie Ihren Studentenausweis auf den Tisch. \item[--] Es sind \textbf{keine} weiteren Unterlagen zugelassen. \item[--] Die Nutzung eines \textbf{Taschenrechners} oder jedes anderen elektronischen Hilfsmittels ist w\"ahrend der Pr\"ufung nicht gestattet. \item[--] F\"ur die \textbf{Multiple Choice} Fragen erh\"alt man: \begin{itemize} \item [$+3$] Punkte, wenn die Antwort richtig ist, \item [$0$] Punkte, wenn die Frage nicht beantwortet ist oder mehrere M\"oglichkeiten angekreuzt sind, und \item [$-1$] Punkt, wenn die Antwort falsch ist. \end{itemize} \item [--] F\"ur die \textbf{Wahr/Falsch }Fragen erh\"alt man: \begin{itemize} \item [$+1$] Punkt, wenn die Antwort richtig ist, \item [$0$] Punkte, wenn die Frage nicht beantwortet ist oder mehrere M\"oglichkeiten angekreuzt sind, und \item [$-1$] Punkt, wenn die Antwort falsch ist. \end{itemize} \item[--] Benutzen Sie einen \textbf{Kugelschreiber mit schwarzer oder blauer Tinte} und verwenden Sie Korrekturfl\"ussigkeit (z.B. Tipp-Ex) um bei Bedarf Ihre Antwort zu \"andern. \item [--] Falls eine Fragestellung einen Fehler enth{\"a}lt, darf der/die Unterrichtende die entsprechende Frage annulieren. \item[--] Beachten Sie bitte die unten stehenden Richtlinien zum Markieren \textbf{der Antworten}: \end{itemize} \hfill \includegraphics[scale=0.2]{good_bad_square} \hfill % End of first page diff --git a/data/templates/maths/en/first_page.tex b/data/templates/maths/en/first_page.tex index db41a46..6cd57d8 100644 --- a/data/templates/maths/en/first_page.tex +++ b/data/templates/maths/en/first_page.tex @@ -1,56 +1,56 @@ % First page - ENGLISH \noindent \begin{minipage}[c]{350pt} \bf \prof~-~\ExamName~-~\SECTION \\ ~ \\ \bf \ExamDate~-~duration: \Time \end{minipage} \begin{minipage}[c]{100pt} \includegraphics[scale=0.24]{Logo_EPFL} \end{minipage} \vfill \begin{minipage}[c]{\textwidth} \noindent \hfill\fontsize{100}{120}{\selectfont{\ID{}}}\hfill \vspace{1cm} \par \noindent \hfill\fontsize{40}{48}{\selectfont{\NAME{}}}\hfill~ \end{minipage} \vfill \noindent -\namefield{SCIPER: {\Large \bf \SCIPER{} }} \hfill Signature:~\textcolor{light-Gray}{\rule{6cm}{2cm}}\\ +\namefield{SCIPER: {\Large \bf \SCIPER{} }} \hfill Signature:~\textcolor{light-Gray}{\rule{5cm}{1.5cm}}\\ ~ \\ \noindent \textbf{Do not turn the page before the start of the exam.} \textbf{This document is double-sided, has \totalPages\ pages, the last ones possibly blank.} \textbf{Do not unstaple.} \medskip \begin{itemize} \item[--] Place your student card on your table. \item[--] \textbf{No other paper materials} are allowed to be used during the exam. \item[--] Using a \textbf{calculator} or any electronic device is not permitted during the exam. \item[--] For the \textbf{multiple choice} questions, we give \begin{itemize} \item [$+3$] points if your answer is correct, \item [$0$] points if you give no answer or more than one, \item [$-1$] points if your answer is incorrect. \end{itemize} \item[--] For the \textbf{true/false} questions, we give \begin{itemize} \item [$+1$] points if your answer is correct, \item [$0$] points if you give no answer or more than one, \item [$-1$] points if your answer is incorrect. \end{itemize} \item[--] Use a \textbf{black or dark blue ballpen} and clearly erase with \textbf{correction fluid} if necessary. \item [--] If a question is wrong, the teacher may decide to nullify it. \item[--] Observe these guidelines when \textbf{recording your answers}: \end{itemize} \hfill \includegraphics[scale=0.2]{good_bad_square} \hfill % End of first page diff --git a/data/templates/maths/fr/first_page.tex b/data/templates/maths/fr/first_page.tex index 60f2abf..51900aa 100644 --- a/data/templates/maths/fr/first_page.tex +++ b/data/templates/maths/fr/first_page.tex @@ -1,56 +1,56 @@ % First page - FRENCH \noindent \begin{minipage}[c]{350pt} \bf \prof~-~\ExamName~-~\SECTION \\ ~ \\ \bf \ExamDate~-~durée\,: \Time \end{minipage} \begin{minipage}[c]{100pt} \includegraphics[scale=0.24]{Logo_EPFL} \end{minipage} \vfill \begin{minipage}[c]{\textwidth} \noindent \hfill\fontsize{100}{120}{\selectfont{\ID{}}}\hfill \vspace{1cm} \par \noindent \hfill\fontsize{40}{48}{\selectfont{\NAME{}}}\hfill~ \end{minipage} \vfill \noindent -\namefield{SCIPER\,: {\Large \bf \SCIPER{} }} \hfill Signature\,:~\textcolor{light-Gray}{\rule{6cm}{2cm}}\\ +\namefield{SCIPER\,: {\Large \bf \SCIPER{} }} \hfill Signature\,:~\textcolor{light-Gray}{\rule{5cm}{1.5cm}}\\ ~ \\ \noindent \textbf{Attendez le d\'ebut de l'\'epreuve avant de tourner la page.} \textbf{Ce document est imprim\'e recto-verso, il contient \totalPages\ pages, les derni\`eres pouvant \^etre vides.} \textbf{Ne pas d\'egrafer.} \medskip \begin{itemize} \item[--] Posez votre carte d'\'etudiant sur la table. \item[--] \textbf{Aucun} document n'est autoris\'{e}. \item[--] L'utilisation d'une \textbf{calculatrice} et de tout outil \'electronique est interdite pendant l'\'epreuve. \item[--] Pour les questions \`a \textbf{choix multiple}, on comptera\,: \begin{itemize} \item [$+3$] points si la r\'eponse est correcte, \item [$0$] point si la question n'est pas r\'epondue ou s'il y a plusieurs croix, \item [$-1$] point si la r\'eponse est incorrecte. \end{itemize} \item [--]Pour les questions de type \textbf{vrai-faux}, on comptera\,: \begin{itemize} \item [$+1$] point si la r\'eponse est correcte, \item [$0$] point si la question n'est pas r\'epondue ou s'il y a plusieurs croix, \item [$-1$] point si la r\'eponse est incorrecte. \end{itemize} \item[--] Utilisez un \textbf{stylo} \`a encre \textbf{noire ou bleu fonc\'e} et effacez proprement avec du \textbf{correcteur blanc} si n\'ecessaire. \item [--] Si une question est erronée, l'enseignant se réserve le droit de l'annuler. \item[--] Respectez les consignes suivantes pour \textbf{marquer vos réponses}\,: \end{itemize} \hfill \includegraphics[scale=0.2]{good_bad_square} \hfill %% End of first page diff --git a/data/templates/maths/project_build_script.sh b/data/templates/maths/project_build_script.sh index 0fc18eb..f675341 100644 --- a/data/templates/maths/project_build_script.sh +++ b/data/templates/maths/project_build_script.sh @@ -1,288 +1,292 @@ #!/bin/bash # This part is specific to the template. # Entry point from bamc: build_project $exam # $exam: name of the exam to build # # Useful variable # --------------- # DIR_WORKSPACE [current workspace dir (absolute)] # DIR_PROJECTS [projects target directory] # DIR_EXAMS [exams'directory in workspace] e.g. $DIR_WORKSPACE/$DIR_EXAMS/$exam # DIR_PROJECTS [projects's directory in workspace] # DIR_EXAM_TEMPLATE [directory of the exam template in use] # FILE_STUDENTS # ... # see 'conf/bamc.conf' for full reference # # Useful functions # ---------------- # verbose "text" # debug "text" # get_lang $exam # ... # see 'lib/bash/*.sh' files for full reference function build_project() { local exam=$1 lang=$(get_lang $exam) assert_exam $exam verbose "Project '$exam' uses '$lang' language" if [ $? -eq 1 ]; then return 1; fi verbose "Building AMC project for '$exam' in workspace '$DIR_WORKSPACE'..." # Project structure build_amc_project $exam if [ $? -ne 0 ]; then error "Could not build AMC project :("; return 1; fi # Build LaTeX sections build_sections $exam $lang if [ $? -ne 0 ]; then error "Could not build project sections :("; return 1; fi # Add media files import_media_files $exam $lang if [ $? -ne 0 ]; then error "Could not import media files :("; return 1; fi # Import LaTeX files import_tex_files $exam $lang if [ $? -ne 0 ]; then error "Could not import LaTeX files :("; return 1; fi # Import local LaTeX files override_tex_files $exam $lang if [ $? -ne 0 ]; then error "Could not override LaTeX files :("; return 1; fi # Customize LaTeX file customize_tex_files $exam $lang if [ $? -ne 0 ]; then error "Could not customize LaTeX files :("; return 1; fi # Import media files add_media_files $exam if [ $? -ne 0 ]; then error "Could not import media files :("; return 1; fi # Build student list file import_student_file $exam if [ $? -ne 0 ]; then error "Could not create student list :("; return 1; fi return 0 } function import_student_file() { verbose "Customizing student files" local project=$DIR_WORKSPACE/$DIR_PROJECTS/$1 local exam=$DIR_WORKSPACE/$DIR_EXAMS/$1 local lang=$2 local FILE=$exam/$FILE_STUDENTS check_file_exists $FILE if [ $? -ne 0 ]; then return 1; fi cp $FILE $project/$FILE_STUDENTS # Add extra students local nb IFS=$'\n' local id=$(tail -n 1 $project/$FILE_STUDENTS | cut -d ',' -f 1) local sample=$(head -n 1 $DIR_EXAM_TEMPLATE/csv/extra.csv) nb=0 while [ $nb -lt $EXTRA_STUDENTS ]; do ((nb++)) ((id++)) echo $sample |\ sed "s/#NB#/$nb/g" |\ sed "s/#ID#/$id/g" |\ sed "s/#SCIPER#/FAKE-$nb/g" |\ sed "s/#EMAIL#/$DEFAULT_EMAIL/g" |\ sed "s/#SEMESTER#/$SEMESTER/g" >> $project/$FILE_STUDENTS done return 0 } function add_media_files() { verbose "Importing media files" local project=$DIR_WORKSPACE/$DIR_PROJECTS/$1 cp $DIR_EXAM_TEMPLATE/media/* $project/media/ } function customize_tex_files() { verbose "Customizing LaTeX files" local project=$DIR_WORKSPACE/$DIR_PROJECTS/$1 local exam=$DIR_WORKSPACE/$DIR_EXAMS/$1 local lang=$2 local replace IFS=$'\n' - local FILE=$exam/$FILE_EXAM - check_file_exists $FILE + local CONFIG_EXAM=$exam/$FILE_EXAM + check_file_exists $CONFIG_EXAM if [ $? -ne 0 ]; then return 1; fi # professor.tex local prof_file=$project/professor.tex check_file_exists $prof_file if [ $? -ne 0 ]; then return 1; fi - for replace in $(cat $FILE); do + for replace in $(cat $CONFIG_EXAM); do replace_in_file "#$(echo $replace | cut -d ':' -f 1)#" "$(echo $replace | cut -d ':' -f 2-)" $prof_file done # exam.tex - replace_in_file "#LANG#" $(echo $lang | tr '[a-z]' '[A-Z]') $project/exam.tex + local exam_file=$project/exam.tex + replace_in_file "#LANG#" $(echo $lang | tr '[a-z]' '[A-Z]') $exam_file + if [ $(grep -c '^FONT_SIZE:' $CONFIG_EXAM) -gt 0 ]; then + replace_in_file "\[a4paper\]" "\[a4paper,$(grep '^FONT_SIZE:' $CONFIG_EXAM | tail -n 1 | cut -d ':' -f 2-)\]" $exam_file + fi # Add extra_packages.tex file if [ -r $project/common_packages.tex ]; then - replace_in_file '% #COMMON_PACKAGES#' '\\input{./common_packages.tex}' $project/exam.tex + replace_in_file '% #COMMON_PACKAGES#' '\\input{./common_packages.tex}' $exam_file fi # Add extra_packages.tex file if [ -r $project/common_commands.tex ]; then - replace_in_file '% #COMMON_COMMANDS#' '\\input{./common_commands.tex}' $project/exam.tex + replace_in_file '% #COMMON_COMMANDS#' '\\input{./common_commands.tex}' $exam_file fi # Add extra_section.tex file if [ -r $project/extra_section.tex ]; then - replace_in_file '% #EXTRA_SECTION#' '\\input{./extra_section.tex}' $project/exam.tex + replace_in_file '% #EXTRA_SECTION#' '\\input{./extra_section.tex}' $exam_file fi # Add extra_packages.tex file if [ -r $project/extra_packages.tex ]; then - replace_in_file '% #EXTRA_PACKAGES#' '\\input{./extra_packages.tex}' $project/exam.tex + replace_in_file '% #EXTRA_PACKAGES#' '\\input{./extra_packages.tex}' $exam_file fi # Add extra_packages.tex file if [ -r $project/extra_commands.tex ]; then - replace_in_file '% #EXTRA_COMMANDS#' '\\input{./extra_commands.tex}' $project/exam.tex + replace_in_file '% #EXTRA_COMMANDS#' '\\input{./extra_commands.tex}' $exam_file fi - + return 0 } function override_tex_files() { verbose "Importing supplementary LaTeX files" local common=$DIR_WORKSPACE/$DIR_COMMON local exam=$DIR_WORKSPACE/$DIR_EXAMS/$1 local project=$DIR_WORKSPACE/$DIR_PROJECTS/$1 local lang=$2 local f # Common (without lang) if [ -d $common ]; then for f in $(find $common -maxdepth 1 -type f -name '*.tex'); do verbose "- Common LaTeX file found: $f" cp $f $project/ done fi # Common (with lang) if [ -d $common/$lang ]; then for f in $(find $common/$lang -type f -name '*.tex'); do verbose "- Common LaTeX file found ($lang): $f" cp $f $project/ done fi # Extra for f in $(find $exam/ -type f -name '*.tex'); do verbose "- Extra LaTeX file found: $f" done find $exam/ -type f -name '*.tex' -exec cp {} $project/ \; return 0 } function import_tex_files() { verbose "Importing LaTeX files" local project=$DIR_WORKSPACE/$DIR_PROJECTS/$1 local lang=$2 cp $DIR_EXAM_TEMPLATE/base/* $project/ cp $DIR_EXAM_TEMPLATE/$lang/* $project/ return 0 } function build_amc_project() { local project=$DIR_WORKSPACE/$DIR_PROJECTS/$1 verbose "Creating AMC project structure" mkdir -p $project/cr/corrections/jpg mkdir -p $project/cr/corrections/pdf mkdir -p $project/cr/diagnostic mkdir -p $project/cr/zooms mkdir -p $project/data mkdir -p $project/exports mkdir -p $project/scans mkdir -p $project/copies mkdir -p $project/media cp $DIR_EXAM_TEMPLATE/config/$FILE_AMC_OPTIONS $project/$FILE_AMC_OPTIONS return $? } function import_media_files() { local project=$DIR_WORKSPACE/$DIR_PROJECTS/$1 local exam=$DIR_WORKSPACE/$DIR_EXAMS/$1 local lang=$2 local questions_dir=$DIR_WORKSPACE/$DIR_QUESTIONS/$lang local media_file verbose "Importing media files" for media_file in $(find $questions_dir/ -type f -not -name '*\.tex'); do verbose "Importing file '$media_file'" cp $media_file $DIR_WORKSPACE/$DIR_PROJECTS/$1/ done return 0 } function is_option_active() { local section_line=$1 local option=$2 if [ $(echo $section_line | grep -c "!$2,") -gt 0 ]; then return 1 else return 0 fi } function build_sections() { local project=$DIR_WORKSPACE/$DIR_PROJECTS/$1 local exam=$DIR_WORKSPACE/$DIR_EXAMS/$1 local lang=$2 local question_file question section_file section local IFS=$'\n' FILE=$exam/$FILE_SECTIONS verbose "Importing questions" check_file_exists $FILE if [ $? -ne 0 ]; then return 1; fi local section_num=0 rm -f $project/sections.tex $project/random-sections.tex for section in $(cat $FILE); do # Sample format of a section line: # !OPTION1,!OPTION2,tex_file1.tex,tex_file2.tex,... ((section_num++)) section_file=$project/section_${section_num}.tex rm -f $section_file for question in $(echo $section | tr ',' '\n'); do # Skip options (options start with "!") if [[ $question =~ ^! ]]; then verbose "This is an option, and not a question: $question (skipping)" continue; fi verbose "Adding $question to section $section_file..."; question_file=$DIR_WORKSPACE/$DIR_QUESTIONS/$lang/$question check_file_exists $question_file if [ $? -ne 0 ]; then return 1; fi echo "%% From $lang/$question =======================================" >> $section_file echo '\element{section'$section_num'}{' >> $section_file cat $question_file >> $section_file echo '}' >> $section_file done echo "\input{./section_${section_num}.tex}" >> $project/sections.tex echo "\input{./header_${section_num}.tex}" >> $project/random-sections.tex is_option_active $section 'NORAND' if [ $? -eq 0 ]; then # RANDOM order echo "\melangegroupe{section${section_num}}" >> $project/random-sections.tex fi echo "\restituegroupe{section${section_num}}" >> $project/random-sections.tex done return 0 } # EOF