View Full Version : eBooks of chess problems. Center table bug?


Tibor
03-01-2009, 02:53 PM
Hi,

I am developing a tool to generate an ePub ebook with chess problems to solve. I have nearly finished, and now I am having a small problem with epub presentation.

The ePub file I attach has been made with a development version of the tool. If you unzip the files, you will see the xhtml files are showed correctly in browsers. Also, if you open the ePub file with calibre eViewer the content is showed correctly.... but if I open the eBook in Adobe Digital Editions or in the Sony PRS505, the board is left justified.

I have tried to replace deprecated "<center>" tag with CSS and the problem continue. The board appears in the left.

Download at: http://rodin.chess.googlepages.com/tmp.epub
(http://rodin.chess.googlepages.com/tmp.epub)
Does anybody know what can I do in order to get proper board aligment?

P.S.: xhtml files has been code checked in w3.org (html and css)

nrapallo
03-01-2009, 03:14 PM
I have tried to replace deprecated "<center>" tag with CSS and the problem continue. The board appears in the left.

Download at: http://rodin.chess.googlepages.com/tmp.epub
(http://rodin.chess.googlepages.com/tmp.epub)
Does anybody know what can I do in order to get proper board aligment?

P.S.: xhtml files has been code checked in w3.org (html and css)

Try surrounding the <table> describing the chessboard with <div class="docenter"> ... </div> and adding the "docenter" style (in bold) to the <style> section:<style type="text/css">
.docenter { text-align: center }
span { font-family: "DBChess", serif }
#wrap {
margin: 0 auto; /* margin 0 auto will center that box in your document */
width: 600px; /*size of your box*/
background: #fff;
text-align: center; /* everything will be written in that box will be centered horizontaly*/
}
</style>


The depreciated <div align="center"> may also work.

I tried this with my reader's .imp format and it worked. Your mileage may vary... ;)

dschill
03-01-2009, 03:33 PM
nice i wanna try this out when your done! http://photosnag.com/img/3045/y09w0131xdtc/82(2).gif

Tibor
03-01-2009, 04:40 PM
Try surrounding the <table> describing the chessboard with <div class="docenter"> ... </div> and adding the "docenter" style (in bold) to the <style> section:<style type="text/css">
.docenter { text-align: center }
span { font-family: "DBChess", serif }
#wrap {
margin: 0 auto; /* margin 0 auto will center that box in your document */
width: 600px; /*size of your box*/
background: #fff;
text-align: center; /* everything will be written in that box will be centered horizontaly*/
}
</style>


The depreciated <div align="center"> may also work.

I tried this with my reader's .imp format and it worked. Your mileage may vary... ;)

I have tried both and it does not work. It look like a bug in ADE and the Sony reader.... :(

any other ideas??

nrapallo
03-01-2009, 05:40 PM
I have tried both and it does not work. It look like a bug in ADE and the Sony reader.... :(

any other ideas??

If you give the <table> a boundary, then it can be centered. Try wrapping the <table> or that <div> with a <p class="docenter">. Experiment with the ordering/nesting.

If all else fails, then try altering the <body> tag to have everything centered. i.e. <body style="text-align: center">. Worth a try.

llasram
03-01-2009, 05:57 PM
It renders properly if you force the outermost table to be 'display: inline-table'. For example, by adding a rule like #wrap > table {
display: inline-table;
} to your CSS. (I would recommend instead giving your chess-problem tables a semantic @class attribute and hanging the CSS rule off of that, as well as ditching the nested tables and using CSS for everything except the board layouts, but YMMV.)

Tibor
03-05-2009, 09:20 AM
nice i wanna try this out when your done! http://photosnag.com/img/3045/y09w0131xdtc/82(2).gif

Hi,

I have a beta version. Any feedback would be wellcome.
Please, read readme.txt file to run.

http://rodin.chess.googlepages.com/cpegen-v1.0.zip