Skip to content

A simple Python script to automate the generation and email distribution of students' score breakdown for a course in the form of PDFs made with LaTeX.

License

Notifications You must be signed in to change notification settings

nayakazna/LaTeX_ScoreAutoReport

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LaTeX_ScoreAutoReport

A simple Python script to automate the generation and email distribution of students' score breakdown for a course in the form of PDFs made with LaTeX.

Background

For a course I took, the lecturer provided the detailed students' scores in a spreadsheet that can be viewed by everyone. However, students sometimes prefer to not share their scores with others. To respect their privacy, I created this script to automate the generation and email distribution of the students' score breakdown in the form of PDFs made with LaTeX.

Installation

  1. Clone this repository:
    git clone https://github.com/nayakazna/LaTeX_ScoreAutoReport.git
  2. Make sure you have Python installed. This script is tested on Python 3.8.5 but should work on other versions as long as it has os, csv, smtplib, and email installed (these packages are included in the Python standard library). You can check your Python version by running:
    python --version
  3. Make sure you have LaTeX installed. This script uses pdflatex to compile the LaTeX template. You can check if you have LaTeX installed by running:
    pdflatex --version
    If you don't have LaTeX installed, you can download it here.
  4. (Optional) Modify the email and LaTeX template in accordance with your needs (see Template Modification).

Usage

  1. Prepare the students' scores in a CSV file. The CSV file should have the following columns (see data.csv for an example):
    • nama: Student's name
    • nim: Student's ID
    • email: Student's email
    • the rest of the columns are the scores for each category
    • The first row should be the header
    • The second row contains the 'nickname' of the category i.e. the name of the category that will be displayed in the PDF
    • The third row contains the weight of the category (written in decimal notation, must sums up to 1)
    • The rest of the rows contain the data of the students
  2. If you are using Gmail and have enabled 2-step verification, you need to create an app password. Follow the instructions here. The app password is the password you will use in the script used instead of your actual password.
  3. Run the script:
    python main.py
  4. Enter your email and password when prompted.
  5. Wait and see!

Template Modification

Email Template

The email template can be modified in the 35-36th line of main.py.

35 subject = 'Rincian Nilai IF2123 Aljabar Linear dan Geometri'
36 body = f'Berikut adalah rincian nilai Anda untuk mata kuliah IF2123 Aljabar Linear dan Geometri.\n\nTerima kasih.'

LaTeX Template

The original LaTeX template is in Indonesian. You can modify it in template.tex. The header for the table can be modified in line 12-14 of latexutils.py.

12 kategori = 'Kategori' # Category, in Indonesian
13 bobot = 'Bobot' # Weight, in Indonesian
14 nilai = 'Nilai' # Score, in Indonesian

Images

An example of the generated PDF files. image image

About

A simple Python script to automate the generation and email distribution of students' score breakdown for a course in the form of PDFs made with LaTeX.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published