Posts tagged mate in one


New version of chess PGN to TeX to PDF converter

OK, I’m shameful. After fighting with Scid’s exporter, and then correcting bugs in pgn2ltx’s source, I finally decided to take a look at that PGN file format. And guess what? It’s already composed of FEN notation. And guess what? that super-über cool new skaknew module for LaTeX gets its input as FEN!!


Updated mate-in-one document, now includes chess coordinates

Update: A new updated version of the PDF is available, which includes which side to play.

After a request to have coordinates on the board, to be able to write answers (a really nice idea, especially that Ido begins writing), I noticed I couldn’t do it so easily, because the LaTeX module (chess12) didn’t support that. What a disappointment!

And the only way I had for converting from PGN to TeX was through Scid (still cool, still being developed), but supporting only exports to TeX with chess12 module. Fortunately, Dirk Baechle wrote a tool to convert directly from PGN format to TeX, using his tool pgn2ltx. That tool, written in C++ hasn’t been updated since 2003, so after a small patch to the source, it worked!

And the best part, is that it generates TeX files for the skak module, the best alternative to the old, dead chess12 module.


Easy chess games for kids (mate in one)


UPDATE: You can get a much better revised version of the PDF now, with coordinates, in this newer post.

In my journey to teach chess to Ido, an easy (I thought) job was to generate diagrams where he has to find mate in a fixed number of turns. Starting with mate in one.
It appeared that making diagrams is an easy task, as there are many programs (Linux and Windows) that permit this.
On Linux, the best I could find is scid. That’s cool as I use it to maintain my databases of games. Even cooler, is that scid development has just restarted (stopped around 2004!), with the help of Pascal Georges. Using scid (I’m using the 3.7devel2009 version) I can export games to HTML or even to LaTeX files.

At first I thought I’d create the endings myself, for example, using online diagrams generators or using Wikipedia/MediaWiki’s templates, but it was not so easy, so I thought about making a program to generate them.
Generating one from scratch would take me time I really don’t have, and there are just two python modules that give high-level functions to chess.
So I started looking for projects similar to mine, that include games with mate in one. I found a small database of mate in one on my favorite chess website, in the download section: a Chessbase datafile with 1171 mate in one studies! So cool.

Well, It was really a pain to convert that Chessbase (.cbv) file, as the only program able to convert to PGN is running on Windows (at least it’s free). You just have to follow the instructions from this thread.
After getting a nice PGN file, just open it with scid, go to “Tools”, then select “Write the filter”, and choose LaTeX. You’ll get a TeX file. Use you favorite TeX generator (Live TeX seems to be the one today), like this for example, to generate directly a PDF file:

cat mat_temp.tex |grep -v "\\\\$" > mate_in_one.tex
latex --output-format=pdf mate_in_one.tex

(Yes I had to cleanup a bit the file before generating the .pdf)

The result is here, 196 pages of tests (6 one each page) if you don’t want to fight with the missing TeX modules (you’ll need chess12.sty) and get a nice result.

I’m sure many people search for this kind of file, so I’m pretty happy to help other parents/coaches.

White mate in one

White mate in one

Edit: I added a PDF version without the solution included.

Go to Top