lichess.org
Donate

Embedding a game in a text document

Hello,

A question i have always asked myself: could we embed a game in pgn in a TEXT document (Word or Office, i don't care)? Otherwise, what would be the most practical way to do it?

The idea behind it would be to have a self-contained document in which text and games are present; this would be the "ultimate" document to synthetize all kind of chess knowledge (opening study, analysis of games with text introduction, games, ...), as i find that Chessbase is not allowing us to merge very conveniently text and moves and several games together, in an attractive looking whole document. Of course we can export in a pdf but this is a step too rigid to be interesting (i am looking for a wysiwyg solution).

Another advantage of this solution is to have in the document only the initial chessboard or position for each game (then one has to click on arrows to make moves display), but not the entire games, so information would be more condensed. This would be far more "dynamic", "interactive" than having like a classical book with all displayed on the pages.

Hope my question is clear.
Thanks in advance!
PGNs are really just text files anyway (you can open them in WordPad). I don't think it's possible to embed an interactive diagram into Word, and I don\t think there is a file type or method for merging PGNs in the way you describe, because PGNs can only contain one game (and variations).

So no, I don't think what you are looking for exists (yet)
PGN is just text. You can copy-paste it in any text document.

Of course it will show no diagrams in that case, and it will certainly not allow interactive stepping through the game. Because that is not what text does. Text is just a static collection of characters. So if a game viewer is what you want, it is by definition impossible.

Of course there also exists 'hyper text' (HTML). There you can do such things (responding to mouse clicks), if it is powered by some programming script (e.g. JavaScript). There exist a pgn4web viewer script that can be embedded in HTML pages to interactively display PGN games as a diagram. But it would only work in programs that process HTMLformat (i.e. web browsers).
Thanks very much.

So how would you create the document i am looking for? (using java or html, i don't care). The idea is that on my tablet or my computer, i could open it and interact with it without internet.

I feel my idea could be implemented, but i am weak in Java and HTML. If you have any idea, thanks!
Java is a standalone programming language, JavaScript is the programming language that together with HTML and CSS forms websites. You can learn about HTML, CSS and Javascript (in that order) here:

http://www.w3schools.com/
Web browsers typically can also browse files on your local machine. E.g. when I have a html file on my PC, I can right-click it, and select 'Open with ...' from the context menu, and then select FireFox. Then FireFox will display the page for me. I can also use the FireFox menus, select 'Open'from the 'File' menu, ad then browse to a HTML file I want to display.

Just google for pgn4web, and learn to make HTML pages.
OK thanks.

I have already written HTML pages, so i think it will be easier for me than javascript (i have done java also, but a long time ago). I will try it.

In conclusion, it is a pity that it doesn't exist the pdf equivalent of a dynamic file with text + pgn emulated on a chessboard. why not creating it? it is strange, but i don't like the idea to use an internet navigator to open a dynamic text document (it is like using a sledgehammer to kill a fly).
Well, the internet navigation part of web browsers is in fact just a very tiny part of their functionality. They are basically programs to display hyper text, and interpret associated scripts. As a 1%extra they are able to read files not only on your local machine, but also from external sources.
OK, so i conclude that no commercial ebooks can be written in the manner i am telling (i am not at all interested by commercial matters, but it seems for me that it would be a great improvement of the existing ebook, with its tiring necessity to open a chessboard viewer in addition to the ebook to check some variations). I repeat that i find it strange that no-one created it (but when we see the relatively poor level of Chessbase, this is coherent in a way!).
If i am not wrong, dynamic stuff like navigating in chessboards is not supported in e-books.

This topic has been archived and can no longer be replied to.