I am really new to the whole LaTeX thing, but it really interests me, so I'd like to learn more about it. I am also looking mostly to do just words, maybe a picture here and there but i just want words on the pages. I found http://blog.mattj.me/latex-page-a-day-calendar# this tutorial type thing on how to do so, I copied the LaTeX file onto the back page, and i finally got that working, a PDF with just the outline of a page-a-day sized calendar. But it is blank, the website says that the next thing needed is a Python script to run and generate the \daypages, but that doesn't make any sense to me, how will doing a python program(if i even knew how) even be inputted into LaTeX? So i guess i have 2 questions, does anyone know how to write up this python program, and how am i supposed to use it in LaTeX? thanks so much.

  • Does How to create Page-a-Day Calendar Template solve your problem? It uses datatool to read in a CSV file of dates (+ wording) and uses tikz to display the content. No Python required...
    – Werner
    Aug 30, 2012 at 17:21
  • 1
    The website gives you the python script to use. Python is free to install on your computer as well. The python script generates a file call tex-days.tex as well, and it is automatically included in the pdf with the line \include{tex-days}
    – J M
    Aug 30, 2012 at 17:28
  • J M, when i plug the Python script into python on my mac, it says that f is undefined. I'm not even sure what that means in the least. But that file does make sense.
    – Dustin
    Aug 30, 2012 at 17:31
  • Werner, i'll have to attempt that, i'm not sure of exactly what you said, but i will do as much as i can to figure it out.
    – Dustin
    Aug 30, 2012 at 17:32
  • 1
    @JM, I moved the file like you said, not it registered that file, but i am getting a different error message all together. It says, Printing TeX for year %s to %s % (sys.argv[1], sys.argv[2]) Index error: list index out of range.
    – Dustin
    Aug 31, 2012 at 15:35

1 Answer 1


Steps for this to work:

  1. Create the latex code, which you have compiled correctly

  2. Have python, which you have done

  3. Create a file called, generate_daypage.py

  4. Copy the contents of the python code into generate_daypage.py

  5. Type this exact command to run the python code

    python generate_daypage.py 2012 tex-days.tex

  6. The script will create a file called tex-days.tex, place this file in the same directory as your latex calendar code

  7. Compile the latex calendar again

If you do not have any images to use right now, the line in the latex code that says:

\usepackage[final]{graphicx} change it to

\usepackage[demo]{graphicx} and it will provide a black box.

I have confirmed the entire script works and generates the pdf correctly.

  • That was an extremely well laid out answer, thank you very much. Although, when i open the terminal (im on a mac) and type python, it gives me confirmation that is understood that, i copy the exact python code onto it and it says Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'f' is not defined
    – Dustin
    Aug 31, 2012 at 3:47
  • @Dustin you didn't follow the directions. I didn't say copy the script into the terminal. I said save it in a file called generate_daypage.py, then call python on that file. I promise if you follow those instructions exactly it will work. That error is because when you call the python file, it needs two parameters, which are in the command I gave you above. The year you want and the name of the output file. Follow the instructions EXACTLY and it will work
    – J M
    Aug 31, 2012 at 13:12
  • I am very sorry, that was my fault. So i went into notepad, pasted that python code, and saved it as generate_daypage.py. it is now saved as a python file. I open up my Python (command line) and type in exactly what you put, and it gives me "File "<stdin>", line 1, syntax error: invalid syntax.
    – Dustin
    Aug 31, 2012 at 14:09
  • p.s. i did switch to doing this on my pc, i wasnt sure how to save .py files on my mac, and my LaTeX file is on my PC too.
    – Dustin
    Aug 31, 2012 at 14:13
  • @Dustin Download it here: filedropper.com/generatedaypage
    – J M
    Aug 31, 2012 at 14:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .