4

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.

Torbjørn T.
  • 206,688
Dustin
  • 43
  • 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 '12 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 '12 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 '12 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 '12 at 17:32
  • @Dustin: It's pretty straight forward in the sense that you create a list of day-entries (having a date, a weekday, a saying, ...) in Excel and store that as a CSV. Then the TEX file reads that in and produces a PDF as output, with a page-a-day. – Werner Aug 30 '12 at 17:44
  • If you are interested in other calendar types see the calendar package. Is not available from either MiKTeX or TeX Live, but managing event list is easy and they can be used in time tables, weekly or monthly calendars. – Fran Aug 30 '12 at 19:43
  • @Werner, thank you again for answering, that sounds like it is less complex, without using python, i will try that. thank you so much. – Dustin Aug 31 '12 at 03:57
  • http://dl.dropbox.com/u/23016439/yes.png The command prompt screen is what i am typing, and the message i am receiving. The middle one is my Python27 folder, which is in C – Dustin Aug 31 '12 at 15:21
  • Place the file in your C:\Users\Dustin folder. Then rerun that command. – J M Aug 31 '12 at 15:25
  • http://dl.dropbox.com/u/23016439/yes.png The command prompt windows is what i am typing in, and what i am receiving. The middle window is my Python27 folder. With generate_daypage.py in it, and also python.exe is in it further down. And the small window is my path for my system, when i set up python i added the last part so it used the python extension. I am still getting an error. – Dustin Aug 31 '12 at 15:25
  • @Dustin Place the generate_daypage.py file in your C:\Users\Dustin folder then try it again. – J M Aug 31 '12 at 15:28
  • 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 '12 at 15:35
  • Please post another screenshot for me of the command line and the output. – J M Aug 31 '12 at 15:40
  • Sir, you are by far one of the greatest people i've encountered. I wasn't typing in 2012 in the command prompt by accident. Thank you so very much, it is now working thanks to you. Now last question i swear. How would i take away all the pages from before today, and then make the ones for 2013 up until a year from now? – Dustin Aug 31 '12 at 15:59
  • Here is an updated generate_daypage.py script: http://www.filedropper.com/generatedaypage_1

    It will generate one calendar year from today, and incorporate if needed the leap year.

    If this solves the problem for you, please consider marking my answer below as accepted (the green checkmark)

    – J M Aug 31 '12 at 16:20
  • @JM That python code is great, now do i need to put the folder with all the pictures in the same place that the python code is? – Dustin Sep 01 '12 at 01:35
  • In the spot where you run your latex code, create a folder called "imgs", place your images in that folder. They need to be labeled 1.pdf, 2.pdf, 3.pdf, 4.pdf etc...they must be pdf images, but there are lots of online converters for that. – J M Sep 01 '12 at 02:44

1 Answers1

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.

J M
  • 1,102
  • 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 "", line 1, in NameError: name 'f' is not defined

    – Dustin Aug 31 '12 at 03: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 '12 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 "", line 1, syntax error: invalid syntax. – Dustin Aug 31 '12 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 '12 at 14:13
  • @Dustin Download it here: http://www.filedropper.com/generatedaypage – J M Aug 31 '12 at 14:33
  • @does that file need to placed somewhere specific? because i deleted the other one i had and just had the one you gave me and i am still getting the same thing. This is really frustrating, i apologize for how long this is taking. – Dustin Aug 31 '12 at 14:54
  • @Dustin No, it doesn't matter where. Just try it in the base of your C drive C:\generate_daypage.py, or you can try in the same location as your python.exe file. Then follow Step #5 exactly, and proceed to steps 6 & 7 – J M Aug 31 '12 at 15:02