|
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 ######################
|