Normal Topic Using pgn2ltx (Read 4499 times)
Bob(Guest)
Guest


Re: Using pgn2ltx
Reply #2 - 05/18/06 at 17:54:48
Post Tools
The script above surely will be evolving; I've already made some tuneups.  It would be pure clutter to continue to repost it, so I'll simply give this pointer:

http://www.bobnewell.net/filez/explatex

This will always be the most up-to-date version.

I'm having a good time downloading PGN from here and making up nice, portable booklets with lots of diagrams, for easy study at odd moments.
  
Back to top
 
IP Logged
 
Bob(Guest)
Guest


Re: Using pgn2ltx
Reply #1 - 05/17/06 at 19:14:53
Post Tools
OK, I solved the problem I raised about chesspublishing PGN files and LaTeX printing.  Here is a Linux shell script that will fix everything up and give you excellent typeset output, in a PDF file, with lots and lots of diagrams (maybe more than you want; you can hack the script if you don't want them).

You must be running Linux, unless you have LaTeX, SCID, and Cygwin Bash installed on your Windoze box.

There are some imperfections here, obviously, and I am doing a completely new pgn2ltx script in Perl, but it will be a long time until it's done, if ever.

Extract between the cut lines and save to 'explatex'.  Make it executable.  Run it.   Enjoy the output.  It makes a really nice booklet out of the monthly chesspublishing PGNs.

####################### cut here ########################
#!/bin/bash

# Usage: explatex filename.pgn

# where 'filename' must be in the current directory and must have a pgn
# suffix, in lower case.

# The output file generated will be filename.pdf.

# Output is best viewed with xpdf.  gpdf has problems with the skak fonts
# and acroread doesn't frame the diagrams properly (but not too bad).

# Requirements: 

#    full TeX installation, with pdflatex;
#    chess12 LaTeX style installed,
#    full SCID installation with all SCID commands in the command path,
#    and the usual Linux tools.   
#    Maybe some others too.

# Contact: explatex@bobnewell.net
# Alpha release 0.01 17 May 2006
# No warranties given; no liabilities accepted.
# This is freeware; do anything you wish with it, but I reserve all rights.

rm -Rf tempexp*

# This may not sit well with the powers that be, but if the following edit is not
# performed, the first page of the typeset output will be ruined.

sed -e "/{COPYR/d" <$1 >tempexp.pgn

# Comment out the next line if you don't want a diagram prior to every single
# comment.  I actually like it, but you may not!

sed -i -e "s/{/ \$201 {/g" tempexp.pgn

# No user-servicable parts below this point.

base=`basename $1 ".pgn"`
rm -Rf $base.tex
rm -Rf $base.pdf

pgnscid -f -x tempexp.pgn tempexp >/dev/null 2>&1

tkscid << EOF
sc_base open tempexp
sc_base export filter LaTeX tempexp1.tex -comments t -variations t -column t -symbols t
exit
EOF

cat >tempexphead << EOF
\documentclass[10pt,twocolumn]{article}
\usepackage{times}
\usepackage{a4wide}
\usepackage{chess}
\usepackage[T1]{fontenc}
\setlength{\columnsep}{7mm}
\setlength{\parindent}{0pt}
\newenvironment{variation}{\begin{quote}}{\end{quote}}
\newenvironment{diagram}{\begin{nochess}}{\$\$\showboard\$\$\end{nochess}}

\begin{document}
EOF

cat >tempexptail << EOF

\end{document}
EOF

cat tempexphead tempexp1.tex tempexptail >tempexp2.tex
pdflatex -interaction=batchmode tempexp2.tex >/dev/null 2>&1
mv tempexp2.pdf $base.pdf

rm -Rf tempexp*
######################## cut here ######################
  
Back to top
 
IP Logged
 
Bob(Guest)
Guest


Using pgn2ltx
05/12/06 at 20:42:13
Post Tools
Has anyone else tried to use the widely available free utility program pgn2ltx with Chess Publishing's PGN download files?

I am interested in printing these files with quality LaTeX typesetting, and the tool seems to not interpret Chess Publishing's comment and variation nesting properly, giving LaTeX output that won't compile and is in fact patently wrong.

Loading the PGN into the SCID database utility allows for output of correct LaTeX but it uses the old "chess12" package rather than the much nicer, up-to-date "skak" package, which would also allow easy interspersal of board diagrams.

Yes, this is a bit obscure but perhaps there are other LaTeXers out there who appreciate the excellent printed quality that is produced.
  
Back to top
 
IP Logged
 
Bookmarks: del.icio.us Digg Facebook Google Google+ Linked in reddit StumbleUpon Twitter Yahoo