Results 1 to 10 of 13

Thread: HOWTO: Crossword download/print system

Threaded View

  1. #1
    Join Date
    Jul 2006
    Beans
    Hidden!

    HOWTO: Crossword download/print system

    This system will automatically download and print the day's crossword puzzle from the Houston Chronicle. It also saves an answer key to your home directory. Alter as needed.

    I had to modify the original source code to have it do the answer key. That's the second program. If you are a coder and know how to combine this into a single program, be my guest. Credit to the author, I only hacked his code to make the second program and changed the script to bash (and used LPR instead of GS for printing):

    http://www.ctan.org/tex-archive/macr...rd/AcrossLite/

    This is my first HOWTO so it probably has mistakes; I'll correct as they're found.

    Step 1 - Create working directories

    We're going to create a temporary directory for setting everything up.

    Code:
    mkdir /tmp/crossword/
    cd /tmp/crossword/
    You should do everything else from this directory.

    Step 2 - Download and install components

    First make sure you have texlive.

    Code:
    sudo apt-get install texlive texlive-base texlive-base-bin
    Then get the utilities necessary for compiling:

    Code:
    sudo apt-get install psutils build-essential
    Next you want to download the file that is attached to this post. Scroll down and get it Then come back and run this:

    Code:
    tar -xf nytconv2.c.tar.gz
    sudo mv nytconv2.c /tmp/crossword/
    wget http://www.tug.org/tex-archive/macros/latex/contrib/gene/crossword/AcrossLite/nytconv.c
    gcc -o nytconv nytconv.c
    gcc -o nytconv2 nytconv2.c
    sudo mv nytconv /usr/bin/
    sudo mv nytconv2 /usr/bin/
    wget http://ftp.inf.utfsm.cl/pub/tex-archive/macros/latex/contrib/gene/crossword/cwpuzzle.dtx
    wget http://ftp.inf.utfsm.cl/pub/tex-archive/macros/latex/contrib/gene/crossword/cwpuzzle.ins
    tex cwpuzzle.ins
    sudo mv cwpuzzle.sty /usr/share/texmf-texlive/tex/latex/base/
    This next step is very important, otherwise it will not all convert properly. Run the following program and select "rehash". This allows latex to use the cwpuzzle.sty (which tells it how crossword puzzles work).

    Code:
    sudo texhash
    Step 3 - Create script file

    The follow script file should be enough to get you going. Replace YOURPRINTER with the name of your printer (as shown in System > Administration > Printing). Name the script something like autopuz (that's what I used).

    Code:
    #!/bin/bash
    mkdir /tmp/crossword
    cd /tmp/crossword
    todaydate=`date +%m-%d-%Y`
    
    wget http://www.chron.com/content/fun/games/xword/puzzles/today.puz
    
    #Processing unsolved puzzle
    nytconv today.puz >today.tex
    latex today.tex
    dvips  -x 1400 today.dvi
    psnup  -l -2 -pletter today.ps today.wps
    echo \"quit\" >>today.wps
    lpr -P YOURPRINTER today.wps
    
    #Processing solved puzzle
    nytconv2 today.puz >today2.tex
    latex today2.tex
    dvips  -x 1400 today2.dvi
    ps2pdf today2.ps ~/$todaydate.pdf
    
    rm -f /tmp/crossword/*.*
    rmdir /tmp/crossword
    then move it so it can be used from anywhere.

    Code:
    chmod +x autopuz
    sudo mv autopuz /usr/local/bin/
    Step 4 - Decide how you want to run the script

    You can either create a launcher or run a cronjob (or both!).

    For the launcher, I don't need to tell you how to do that. Here's the icon I used:

    Code:
    wget http://www.shapefit.com/crossword_icon.gif
    sudo mv crossword_icon.gif /usr/share/pixmaps/
    For a cronjob, I think they update their crosswords pretty early, but I'm not sure when. Either set it for when you know your computer will be on, or if you keep it on all the time, when you know you'll be asleep (unless the printer is in your bedroom).
    Attached Files Attached Files
    Last edited by Mateo; March 15th, 2007 at 06:01 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •