Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 05-31-2014, 02:14 AM   #1
weberr
New old guy
weberr began at the beginning.
 
Posts: 43
Karma: 10
Join Date: Feb 2012
Device: kindle fire
epub table/column widths

I am trying to learn everything I can about coding tables for epub. I have read every tutorial and forum I can find, but can't find anything other than obvious basics. I need to have a table that changes its width in accordance with the fonts and page widths being used in an epub eReader, and the columns maintain the same relative width dependent on the width of the table. Seems like a basic task, but nothing I can figure to do actually works: for me, the obvious solution is to work in percents, set table width at 100% and each column to a fraction of 100% so that the total for all columns add up to 100% -- but that doesn't work. The result seems almost random -- some smaller columns, some larger columns, and left-over table space.

I would appreciate any ideas on how to do what I want -- surely it is something that many of you know how to do.

BTW -- wouldn't it be something to have a WYSIWYG table generator in Sigil where you simply drag the column lines and table border to what you want and let Sigil generate the code? Could even include setting background and font colors of cells, columns, rows...

RW
weberr is offline   Reply With Quote
Old 05-31-2014, 04:51 AM   #2
odedta
Addict
odedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileRead
 
Posts: 211
Karma: 65572
Join Date: Dec 2013
Device: iPad
Try CSS rule:
Code:
table-layout:fixed;
On another note, I would switch to Calibre for 3 main reasons:
1. It has many more functions.
2. It supports both EPUB 2 and EPUB 3 creation.
3. Its development is on-going.
odedta is offline   Reply With Quote
 
Enthusiast
Old 05-31-2014, 05:07 AM   #3
Toxaris
Wizard
Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.
 
Toxaris's Avatar
 
Posts: 2,909
Karma: 3017317
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-300, PRS-T1
have I missed an update where the Calibre editor now creates ePUB3? AFAK the editor supports ePUB2 and AZW.

Sent from my Nexus 5 using Forum Fiend v1.2.5.
Toxaris is offline   Reply With Quote
Old 05-31-2014, 05:09 AM   #4
odedta
Addict
odedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileRead
 
Posts: 211
Karma: 65572
Join Date: Dec 2013
Device: iPad
My bad, I meant to say it won't remove or change your code automatically like Sigil does... yes yes, I know you can disable that feature in Sigil.
Anyhow, those reasons were only 3 main ones, there are plenty more why one should abandon Sigil :P
odedta is offline   Reply With Quote
Old 05-31-2014, 05:21 AM   #5
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 2,319
Karma: 12068769
Join Date: Apr 2010
Location: Phoenix, AZ
Device: Kindle2, iPad, KindleFire and NookColor
Quote:
Originally Posted by odedta View Post
My bad, I meant to say it won't remove or change your code automatically like Sigil does... yes yes, I know you can disable that feature in Sigil.
Anyhow, those reasons were only 3 main ones, there are plenty more why one should abandon Sigil :P
No. There aren't.

Hitch
Hitch is offline   Reply With Quote
Old 05-31-2014, 05:59 AM   #6
odedta
Addict
odedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileRead
 
Posts: 211
Karma: 65572
Join Date: Dec 2013
Device: iPad
Quote:
Originally Posted by Hitch View Post
No. There aren't.

Hitch
I sincerely hope you're not serious
odedta is offline   Reply With Quote
Old 05-31-2014, 08:13 AM   #7
Toxaris
Wizard
Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.
 
Toxaris's Avatar
 
Posts: 2,909
Karma: 3017317
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-300, PRS-T1
Yes, she is and so am I. There is absolutely no reason to switch over besides personal preference. I am still working with Sigil and it works more than fine. There is no feature currently in Calibre that I miss in Sigil. Just that Sigil is not maintained anymore does not make it stop working.
What I really don't like is that you can create an invalid (according to the specs) ePUB in the Calibre Editor and that the check-book function will not complain about it. The explanation from Kovid that if a non-compliance does not create an issue in the devices (as far as he knows), he is fine with it, does not cut it. If you want to publish an ePUB, most services require full compliance.
Toxaris is offline   Reply With Quote
Old 05-31-2014, 09:56 AM   #8
RbnJrg
Evangelist
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 450
Karma: 318994
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by weberr View Post
I am trying to learn everything I can about coding tables for epub. I have read every tutorial and forum I can find, but can't find anything other than obvious basics. I need to have a table that changes its width in accordance with the fonts and page widths being used in an epub eReader, and the columns maintain the same relative width dependent on the width of the table. Seems like a basic task, but nothing I can figure to do actually works: for me, the obvious solution is to work in percents, set table width at 100% and each column to a fraction of 100% so that the total for all columns add up to 100% -- but that doesn't work. The result seems almost random -- some smaller columns, some larger columns, and left-over table space.

I would appreciate any ideas on how to do what I want -- surely it is something that many of you know how to do.

BTW -- wouldn't it be something to have a WYSIWYG table generator in Sigil where you simply drag the column lines and table border to what you want and let Sigil generate the code? Could even include setting background and font colors of cells, columns, rows...

RW
You would need to know how to style a table with css. What you want is a no problem task; it's easy to do with css. Read this article:

http://www.w3.org/wiki/Styling_tables

Pay attention the subjects about tables/column width. Also, take in count that some properties are not applicables (so far) regarding ereader devices. But you can use anything related to table/columns width, paddings, borders, colors, etc. (no javascript and some css3 properties although some ereaders -iPad, modern Kindles- can accept them).

Regards
Rubén
RbnJrg is offline   Reply With Quote
Old 05-31-2014, 02:21 PM   #9
mrmikel
Book Twiddler
mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.
 
Posts: 1,996
Karma: 1405001
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
Tables are not easily controllable in epub. Columns will be as wide as the largest item in the column, so you have to shrink text.

Trying to center them consistently is a ticket to insanity. When I can get it to work, it knocks out borders unpredictably.

Sigil works fine and there is no reason to change. Calibre's editor will work in devices, but if you want to publish for pay it is a whole different story. You will probably have to put up with something like obnoxious epubcheck in any case. Lots of info and a lot of nitpicking stuff, but the publishers want to automate the process, that's what you have to deal with.

If you aren't publishing for pay, calibre's editor is more tolerant of junky epub conversions and doesn't require everything to be good all the time. One thing about the calibre check book is you must run it over and over until it finally says no errors.
mrmikel is offline   Reply With Quote
Old 05-31-2014, 05:15 PM   #10
RbnJrg
Evangelist
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 450
Karma: 318994
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by mrmikel View Post
Tables are not easily controllable in epub. Columns will be as wide as the largest item in the column, so you have to shrink text.
You can set the width of columns by styling them with css. For example if you set a TABLE width of 80% (will take 80% of the screen) and a COLUMN width of 30% (will take 30% of the table) then, the column will have a 24% of the screen width.

Regarding center a table, if you, for example, set a table width of 80% you can center it perfectly with a left margin of 10% or (it doesn't work in ADE) by means of margin: 0 auto;.

Try this:

Code:
table {
  width: 80%;
  margin-left: 10%;
  border: 1px solid;
  border-collapse: collapse;
}

th, td {
  text-align: center;
  padding: 5px;
  border: 1px solid;

}

.width30 {
  width: 30%;
}

.width20 {
  width: 20%;
}

.width50 {
  width: 50%;
}
with:

Code:
<table>
    <colgroup>
      <col class="width30" />
      <col class="width50" />
      <col class="width20" />
    </colgroup>

    <tr>
      <th>First Col.</th>

      <th>Second Col.</th>

      <th>Third Col.</th>
    </tr>

    <tr>
      <td>Item #1</td>

      <td>Table with three columns</td>

      <td>- -</td>
    </tr>
</table>
Of course, this table will have problems with the columns width if the col width is (as you said) lower than the largest word in that column. You can reduce this issue by adding soft hyphens to each word inside the table but some ereaders have problems with soft hyphens.

Last edited by RbnJrg; 05-31-2014 at 05:17 PM.
RbnJrg is offline   Reply With Quote
Old 05-31-2014, 05:32 PM   #11
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 2,319
Karma: 12068769
Join Date: Apr 2010
Location: Phoenix, AZ
Device: Kindle2, iPad, KindleFire and NookColor
Quote:
Originally Posted by odedta View Post
I sincerely hope you're not serious
I most certainly am.

Hitch
Hitch is offline   Reply With Quote
Old 06-01-2014, 01:47 AM   #12
eschwartz
Irrational Optimist
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
Posts: 5,355
Karma: 8638834
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch (Wifi only)
Quote:
Originally Posted by Toxaris View Post
Yes, she is and so am I. There is absolutely no reason to switch over besides personal preference. I am still working with Sigil and it works more than fine. There is no feature currently in Calibre that I miss in Sigil. Just that Sigil is not maintained anymore does not make it stop working.
What I really don't like is that you can create an invalid (according to the specs) ePUB in the Calibre Editor and that the check-book function will not complain about it. The explanation from Kovid that if a non-compliance does not create an issue in the devices (as far as he knows), he is fine with it, does not cut it. If you want to publish an ePUB, most services require full compliance.
No one is stopping you from running a calibre-edited book through epubcheck.

calibre's job is to facilitate the creation of working epubs. The epub compliance specs have (as Kovid likes to point out) nothing to do with that.

Why should the calibre bundle a useless check that does not help it do its job, because the publishers insist on the placebo effect it provides, and inflict said check on everyone who uses it (creating unnecessary scares), merely to save the subset of users the effort of separately validating the book for upload to a distributor?
eschwartz is online now   Reply With Quote
Old 06-01-2014, 03:38 AM   #13
odedta
Addict
odedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileReadodedta has read every ebook posted at MobileRead
 
Posts: 211
Karma: 65572
Join Date: Dec 2013
Device: iPad
Quote:
Originally Posted by mrmikel View Post
You will probably have to put up with something like obnoxious epubcheck in any case. Lots of info and a lot of nitpicking stuff, but the publishers want to automate the process, that's what you have to deal with.
It's good practice to pass your file through validation, if you write your ePub with the right syntax in the first place you would be able to count the errors generated by both calibre and epubcheck on one hand.
I really don't understand your(and some others) "disgust" towards epubcheck.
odedta is offline   Reply With Quote
Old 06-01-2014, 09:49 AM   #14
theducks
Grand Sorcerer
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 14,503
Karma: 5567067
Join Date: Aug 2009
Location: The (original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
Quote:
Originally Posted by odedta View Post
It's good practice to pass your file through validation, if you write your ePub with the right syntax in the first place you would be able to count the errors generated by both calibre and epubcheck on one hand.
I really don't understand your(and some others) "disgust" towards epubcheck.
EPUB check
Mostly, Less user friendly error messages.
No auto-fix helper tools. Not even a Jump to error

Sigil (flightcrew)
Very rigid rules interpretation, but a more verbose and connects the error by a jump-to tool (in most cases)
Completely fails to identify the target location of (unknown) references (usually in the OPF or NCX). There are 2(+) ends of any good reference. Or Sigil would not have known it was bad

Calibre (editor)

IMHO Beats Sigil in the user friendly department: Messages (really verbose) and suggested fixes (tools)
Fails (the editor part) to clean a (guide) entry when deleting (unused/unwanted) files via the UI

Personally, I now use both (and on occasion: the hot link to W3C's CSS validation )
theducks is offline   Reply With Quote
Old 06-03-2014, 06:05 PM   #15
weberr
New old guy
weberr began at the beginning.
 
Posts: 43
Karma: 10
Join Date: Feb 2012
Device: kindle fire
Quote:
Originally Posted by odedta View Post
Try CSS rule:
Code:
table-layout:fixed;
On another note, I would switch to Calibre for 3 main reasons:
1. It has many more functions.
2. It supports both EPUB 2 and EPUB 3 creation.
3. Its development is on-going.
Thanks for the suggestion --- works fine for short string data -- but falls apart when using long-strings. I need a way for the columns to adjust to fixed equal widths and for the text to wrap-around within that fixed width, no matter how long that may make that particular. Also, vertical-align:top, the other columns also stay fixed.
weberr is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
EPUB 3 multi column text reading order across pages for epub laksathish ePub 7 10-04-2013 02:07 PM
Single column ePUB becomes 2 column when converted to Kindle (mobi) rmcape Conversion 0 09-21-2013 12:52 PM
Creating Sectionbreaks (i.e. defining widths) synosure Kindle Formats 4 06-04-2010 04:22 PM
Sideway Table in ePub (Rotate table/text) Lapiz ePub 3 01-29-2010 01:11 PM
EPUB Table of Contents Acey Calibre 7 11-19-2008 11:35 AM


All times are GMT -4. The time now is 02:38 AM.


MobileRead.com is a privately owned, operated and funded community.