Rybka Chess Community Forum
Topic Rybka Support & Discussion / Rybka Discussion / New pgn to Latex conversion script
1 2
By Felix Kling Date 2017-07-16 21:01 Upvotes 2
I finished a little python script for converting complex games to Latex (using mostly skak). Maybe you want to try it :-)
By Capa1 Date 2018-01-31 09:49
This looks interesting. Is it possible to get a Windows exe file for the program? Thank you.
By Felix Kling Date 2018-02-01 10:46 Edited 2018-02-01 10:48
Well, it is written in Python, so although you may be able to create an .exe with some tricks, you usually want to run it with the Python interpreter.
See https://docs.python.org/3/using/windows.html

In Linux you browse to the script folder (via "cd C:\Script" for instance in Windows) and execute it via "python3 pgn2latex.py" (in Windows maybe "py pgn2latex.py")

I fixed some bugs in that script, so I'll attach a new version.
By Felix Kling Date 2018-02-05 11:10 Edited 2018-02-05 11:18
Here's a version numbering variations 1) 2) 2a) 2b) and so on. I'm not sure which behaviour is intended for numbering deep variations: 2aa) or 2a1)?

Btw., as you will have noticed, the code is pretty ugly :-) . Still, it works.
Attachment: pgn2latex2John.zip (10k)
By Capa1 Date 2018-02-05 22:21 Edited 2018-02-05 22:42
Thank you Felix for the new version. The output from this script is much nicer than from the Aquarium print game option.

I see your point about deep variations as it could get confusing but either version is understandable to me as a user.

John
By Felix Kling Date 2018-02-06 07:20
Btw., don't forget to set "copy only moves and text comments" in the Aquarium options (pgn options there). Otherwise coloured moved will appear as strange strings in the text.
By Felix Kling Date 2018-03-10 22:34
Here's a much nicer version from typographical point of view. Now you are ready to typeset your own chess book ;-)
By Felix Kling Date 2018-03-17 16:15 Upvotes 3
OK, I found out that my formatting was truly horrible, so here's a new version.
Attachment: pgn2latex3.zip (221k)
By Felix Kling Date 2018-08-27 07:46 Upvotes 1
Attachment: pgn2latex3.zip (18k)
By Vegan Date 2018-10-14 03:35
i have to point out while nicely done, who uses paper anymore, it's all on the web now
By Felix Kling Date 2018-10-14 17:45
are there public sales figures for books/dvds? I guess the chess print market is still much bigger than the digital market, at least from what I see. May change though :-)
By Vegan Date 2018-10-28 03:46
malls used to have more bookstores but most have closed in recent years as sales drifted down

many vendors of cd/dvd have also folded

while some vendors remain open, the book and media sector are not what they used to be

given my chess site is fairly popular makes chess books a tad obsolete, been posting some articles on openings lately and might do more games
By The Wizard Date 2018-10-30 16:37
Hi Felix, That really looks good m8

Regards
Tony
By Felix Kling Date 2018-10-30 21:34
thanks :-)
By Master Om Date 2020-01-04 16:22
Hi saw this post now. Looks so good. But how to do in windows ? no idea about python.
By Felix Kling Date 2020-01-16 18:01
You can install Anaconda (Version 4.4. works well on Windows 10). Then use the pythonw.exe in the installation folder as program to open the script with.
By Master Om Date 2020-01-16 19:06
Am having problem with latex one.
By Master Om Date 2020-01-16 19:14
What latex i have to use in win 10 to run your script ?
By Felix Kling Date 2020-02-06 06:37
I think I used MikTex, on Linux I use TeXLive.

Just to add that getting LaTeX to run is quite tricky sometimes on Windows
By Master Om Date 2020-02-06 11:14
I used miktex too. Also texlive full. Now the output of scid can be used on texwork. But even your file am not able to do. So please help me out.
By Felix Kling Date 2020-02-10 20:55
could you post the latex output and does the python script run without errors?
By Master Om Date 2020-02-11 12:53
latex output has errors i think. I took your latex file and i had errors.
By Master Om Date 2020-02-11 13:26
This is output
LOG FILE :
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (MiKTeX 2.9.7250 64-bit) (preloaded format=pdflatex 2020.2.2) 11 FEB 2020 18:50
entering extended mode
**./pgn2latex_out.tex
(pgn2latex_out.tex
LaTeX2e <2019-10-01> patch level 3
! Undefined control sequence.
l.1 \newgame
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., \hobx'), type I' and the correct
spelling (e.g., I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Undefined control sequence.
l.2 \resetPgnTags
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., \hobx'), type I' and the correct
spelling (e.g., I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Undefined control sequence.
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., \hobx'), type I' and the correct
spelling (e.g., I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Undefined control sequence.
l.12 \mainline
[level=1]{1. e4 e5 2. Nf3 d6 }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., \hobx'), type I' and the correct
spelling (e.g., I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! LaTeX Error: Missing \begin{document}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.12 \mainline[
level=1]{1. e4 e5 2. Nf3 d6 }
You're in trouble here. Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
Missing character: There is no [ in font nullfont!
Missing character: There is no l in font nullfont!
Missing character: There is no e in font nullfont!
Missing character: There is no v in font nullfont!
Missing character: There is no e in font nullfont!
Missing character: There is no l in font nullfont!
Missing character: There is no = in font nullfont!
Missing character: There is no 1 in font nullfont!
Missing character: There is no ] in font nullfont!
Missing character: There is no 1 in font nullfont!
Missing character: There is no . in font nullfont!
Missing character: There is no e in font nullfont!
Missing character: There is no 4 in font nullfont!
Missing character: There is no e in font nullfont!
Missing character: There is no 5 in font nullfont!
Missing character: There is no 2 in font nullfont!
Missing character: There is no . in font nullfont!
Missing character: There is no N in font nullfont!
Missing character: There is no f in font nullfont!
Missing character: There is no 3 in font nullfont!
Missing character: There is no d in font nullfont!
Missing character: There is no 6 in font nullfont!
Missing character: There is no D in font nullfont!
Missing character: There is no i in font nullfont!
Missing character: There is no e in font nullfont!
Missing character: There is no P in font nullfont!
Missing character: There is no h in font nullfont!
Missing character: There is no i in font nullfont!
Missing character: There is no l in font nullfont!
Missing character: There is no i in font nullfont!
Missing character: There is no d in font nullfont!
Missing character: There is no o in font nullfont!
Missing character: There is no r in font nullfont!
Missing character: There is no - in font nullfont!
Missing character: There is no V in font nullfont!
Missing character: There is no e in font nullfont!
Missing character: There is no r in font nullfont!
Missing character: There is no t in font nullfont!
Missing character: There is no e in font nullfont!
Missing character: There is no i in font nullfont!
Missing character: There is no d in font nullfont!
Missing character: There is no i in font nullfont!
Missing character: There is no g in font nullfont!
Missing character: There is no u in font nullfont!
Missing character: There is no n in font nullfont!
Missing character: There is no g in font nullfont!
Missing character: There is no h in font nullfont!
Missing character: There is no a in font nullfont!
Missing character: There is no t in font nullfont!
Missing character: There is no d in font nullfont!
Missing character: There is no e in font nullfont!
Missing character: There is no n in font nullfont!
Missing character: There is no N in font nullfont!
Missing character: There is no a in font nullfont!
Missing character: There is no c in font nullfont!
Missing character: There is no h in font nullfont!
Missing character: There is no t in font nullfont!
Missing character: There is no e in font nullfont!
Missing character: There is no i in font nullfont!
Missing character: There is no l in font nullfont!
Missing character: There is no , in font nullfont!
Missing character: There is no d in font nullfont!
Missing character: There is no a in font nullfont!
LaTeX Font Info: Trying to load font information for +cmr on input line 13.
LaTeX Font Info: No file cmr.fd. on input line 13.
LaTeX Font Warning: Font shape /cmr/m/n' undefined
(Font) using /cmr/m/n' instead on input line 13.
! Corrupted NFSS tables.
wrong@fontshape ...message {Corrupted NFSS tables}
error@fontshape else let f...
l.13 ...dor-Verteidigung hat den Nachteil, da\~{A}
\"{Y} nicht nur im zweiten...
This error message was generated by an \errmessage
command, so I can't give any explicit help.
Pretend that you're Hercule Poirot: Examine all clues,
and deduce the truth by order and method.
LaTeX Font Warning: Font shape /cmr/m/n' undefined
(Font) using OT1/cmr/m/n' instead on input line 13.
Missing character: There is no n in font nullfont!
Missing character: There is no i in font nullfont!
Missing character: There is no c in font nullfont!
Missing character: There is no h in font nullfont!
Missing character: There is no t in font nullfont!
Missing character: There is no n in font nullfont!
Missing character: There is no u in font nullfont!
Missing character: There is no r in font nullfont!
Missing character: There is no i in font nullfont!
Missing character: There is no m in font nullfont!
Missing character: There is no z in font nullfont!
Missing character: There is no w in font nullfont!
Missing character: There is no e in font nullfont!
Missing character: There is no i in font nullfont!
Missing character: There is no t in font nullfont!
Missing character: There is no e in font nullfont!
Missing character: There is no n in font nullfont!
Missing character: There is no Z in font nullfont!
Missing character: There is no u in font nullfont!
Missing character: There is no g in font nullfont!
Missing character: There is no k in font nullfont!
Missing character: There is no e in font nullfont!
Missing character: There is no i in font nullfont!
Missing character: There is no n in font nullfont!
Missing character: There is no e in font nullfont!
Missing character: There is no F in font nullfont!
Missing character: There is no i in font nullfont!
Missing character: There is no g in font nullfont!
Missing character: There is no u in font nullfont!
Missing character: There is no r in font nullfont!
Missing character: There is no e in font nullfont!
Missing character: There is no n in font nullfont!
Missing character: There is no t in font nullfont!
Missing character: There is no w in font nullfont!
Missing character: There is no i in font nullfont!
Missing character: There is no c in font nullfont!
Missing character: There is no k in font nullfont!
Missing character: There is no e in font nullfont!
Missing character: There is no l in font nullfont!
Missing character: There is no t in font nullfont!
Missing character: There is no , in font nullfont!
Missing character: There is no s in font nullfont!
Missing character: There is no o in font nullfont!
Missing character: There is no n in font nullfont!
Missing character: There is no d in font nullfont!
Missing character: There is no e in font nullfont!
Missing character: There is no r in font nullfont!
Missing character: There is no n in font nullfont!
Missing character: There is no a in font nullfont!
Missing character: There is no u in font nullfont!
Missing character: There is no c in font nullfont!
Missing character: There is no h in font nullfont!
Missing character: There is no d in font nullfont!
Missing character: There is no e in font nullfont!
Missing character: There is no r in font nullfont!
! Undefined control sequence.
Attachment: pgn2latex_out.tex - output (5k)
By Felix Kling Date 2020-02-15 08:40
I guess the problem is that you need to execute the other .tex file that comes with my script. This is called pgn2latexENG.tex . The other file contains just the content.
By Master Om Date 2020-02-15 16:41
Sorry couldn't get u.
By Felix Kling Date 2020-02-16 20:55
So you did:

1) Execute the pgn2latex3.py script with Python
2) Open the pgn2latexENG.tex file with the latex editor of your choice

?
By Master Om Date 2020-02-17 03:44
Yes after u asked me i did. And I did get output. But that 3 column one isn't working.
Attachment: pgn2latexENG.pdf - This is my Output (258k)
By Felix Kling Date 2020-02-17 14:47
OK, can you post the Latex output after opening pgn2latexENG.tex? The Latex output you posted seems to be from the pgn2latex_out.tex.
By Master Om Date 2020-02-17 15:47
No its out put of pgn2latexENG.tex not of pgn2latex_out.tex.
By Felix Kling Date 2020-02-20 01:05
mmh. Is there no error output in that document or does it open the _out.tex when you compile the document? So is the second screenshot what happens when you press the build button?

Attachment: pgn2latex2.zip (13k)
By Master Om Date 2020-02-20 03:04

>Is there no error output in that document

There is. When i press the quick build there is. Now view pdf leads to "file not found".

>So is the second screenshot what happens when you press the build button?

Its the output of _out.tex

Your new ones i.e. the pgn2latex4.py is not creating the pgn_out file.
Can u generate the pdfs of these?
Attachment: 2020-01GamesSection.pgn (34k)
By Felix Kling Date 2020-02-25 17:43
With which software did you create this pgn with? It contains errors like 26. .. Qg8 .
However, it compiles just fine here.
By Master Om Date 2020-02-25 17:46
chessbase and aquarium i use.

but the last one u gave is not creating the pgn_out.tex file of the pgn_in file.
i want the 3 column one desperately.
By Felix Kling Date 2020-02-25 17:50
so the last pgn comes directly from chessbase? (the one named 2020-01GamesSection.pgn... you attached)?
By Master Om Date 2020-02-25 17:52
yes. most are given by players to our editor of AICCF.
By Master Om Date 2020-02-17 15:54

>The Latex output you posted seems to be from the pgn2latex_out.tex.

No....
By Felix Kling Date 2020-02-25 17:45
just to make sure, why isn't it pgn2latexENG.text at the top? Does it switch to pgn2latex_out when compiling?
By Master Om Date 2020-02-25 17:53
Could not understand u.
By Felix Kling Date 2020-06-21 11:08
Maybe you can give my online version a try: http://kling.rybkachess.com
By Master Om Date 2020-06-21 12:05
Supper awesome. But also give the offline ones. I want to keep myself too.
By Master Om Date 2020-08-10 03:04
Why your page is not opening ?
By Felix Kling Date 2020-08-15 19:53
I'm sorry, from time to time the server crashes and I need to reboot manually and somehow the cronjob to start the server doesn't work
By Master Om Date 2020-08-19 07:51
Can u add the 3 column style ?
By Felix Kling Date 2020-08-20 06:05
Isn't that the default? Or what do you mean with that?
By Master Om Date 2020-08-20 13:14
the file system u provided. I want that the offline one.
By Felix Kling Date 2020-08-22 14:01
ok, here's the latest version of that module file, but I thought it didn't work when you tried the last versions, so I guess this is still not working. note that this is the one used by the webserver, it just returns the tex file when you load it as module (I would have to rewrite it for a new standalone version).
Attachment: pgn2latex7.py.ext (40k)
By Master Om Date 2020-08-23 07:47
Let me try then.
By Master Om Date 2020-08-23 08:00
Not working.
By Master Om Date 2020-08-20 15:05
Am not able to generate from your website. None of the button works
By Felix Kling Date 2020-08-21 18:42
Mmh, it is possible that the server crashed, I restarted it. Could you provide the pgn in case it happens again?
Topic Rybka Support & Discussion / Rybka Discussion / New pgn to Latex conversion script
1 2