ePub Table columns changing widths
ePub Table columns changing widths
I have a document with recipe ingredient lists that I want to render in an ePub as 2 columns so it looks like a printed recipe. I could not use an Outdented paragraph with a tab between the quantity and the item and measure as I was doing in RTF as tabs do not work in ePubs. A 2-column table gives me the same look except for 1 circumstance. When the item and measure does a line wrap that column is expanded which reduces the quantity column width causing quantities like 2-1/2 to also line wrap. I want the first column of quantity to no do line wrapping. Is there a way to format in RTF to achieve this?
I have seen this same behavior on both my Kobo Glo eReader and in Calibre viewing on my PC on multiple ePubs I made with the same line wrap problem happening every time.
I have seen this same behavior on both my Kobo Glo eReader and in Calibre viewing on my PC on multiple ePubs I made with the same line wrap problem happening every time.
Atlantis 5
Windows 11 Pro for Workstations
Windows 11 Pro for Workstations
Attached “nowrap.docx” was created in Atlantis, then saved to EPUB.
The resulting EPUB file was tweaked so that the cell lines (paragraphs) containing measures were included within the <nobr></nobr> tag.
For example, I tweaked the following Atlantis code:
<p class="p1">1-1/2 cup</p>
So that it would be replaced with:
<nobr><p class="p1">1-1/2 cup</p></nobr>
This gave me attached “nowrap.epub”, where the paragraphs with measures do not wrap in Calibre. However, they do wrap in ADE.
Note that I got this tip from the following page:
Troubleshooting EPUB ebook files
The example given is as follows:
<nobr>non-breaking</nobr> hyphen
HTH.
The resulting EPUB file was tweaked so that the cell lines (paragraphs) containing measures were included within the <nobr></nobr> tag.
For example, I tweaked the following Atlantis code:
<p class="p1">1-1/2 cup</p>
So that it would be replaced with:
<nobr><p class="p1">1-1/2 cup</p></nobr>
This gave me attached “nowrap.epub”, where the paragraphs with measures do not wrap in Calibre. However, they do wrap in ADE.
Note that I got this tip from the following page:
Troubleshooting EPUB ebook files
The example given is as follows:
<nobr>non-breaking</nobr> hyphen
HTH.
- Attachments
-
- nowrap.epub
- (2.35 KiB) Downloaded 565 times
-
- nowrap.docx
- (3.72 KiB) Downloaded 506 times
The <nobr></nobr> tag is “deprecated” and is now considered obsolete. The recommendation is to use CSS instead.
Here is from Replace NOBR Tags with CSS:
1. I added a “.nobr” class to “style.css”:
.nobr{white-space:nowrap;}
2. I associated each paragraph containing measures in “001.html” with that “.nobr” class.
For example, the following code:
<p class="p1">1-1/2 cup</p>
became:
<p class="nobr p1">1-1/2 cup</p>
This gave me attached “nowrap2.epub”, where the paragraphs with measures do not wrap in Calibre. But they still wrap in ADE.
HTH
Here is from Replace NOBR Tags with CSS:
So I modified the EPUB code generated by Atlantis from “nowrap.docx” in the following way:While NOBR tags still work in major browsers, they've been deprecated and you should try to avoid them when possible. Instead, wrap your text in a SPAN tag with a nobr CSS class and apply the following settings to the nobr CSS class:
.nobr { white-space:nowrap; }
A quick reminder for those who've not yet moved onto using CSS to prevent line breaks. Especially useful for placing phone numbers on a website.
1. I added a “.nobr” class to “style.css”:
.nobr{white-space:nowrap;}
2. I associated each paragraph containing measures in “001.html” with that “.nobr” class.
For example, the following code:
<p class="p1">1-1/2 cup</p>
became:
<p class="nobr p1">1-1/2 cup</p>
This gave me attached “nowrap2.epub”, where the paragraphs with measures do not wrap in Calibre. But they still wrap in ADE.
HTH
- Attachments
-
- nowrap2.epub
- (2.36 KiB) Downloaded 539 times
Thanks Robert,
I downloaded the files and will look at them after my Christmas trip. I played around with RTF and ePubs and found that the non-breaking space does work but a non-breaking dash by itself never does. When I put a non-breaking space on both sides of of a non-breaking dash that also worked, if I use 2 non-breaking dashes then the line wrap occurred between the 2 dashes.
I downloaded the files and will look at them after my Christmas trip. I played around with RTF and ePubs and found that the non-breaking space does work but a non-breaking dash by itself never does. When I put a non-breaking space on both sides of of a non-breaking dash that also worked, if I use 2 non-breaking dashes then the line wrap occurred between the 2 dashes.
Atlantis 5
Windows 11 Pro for Workstations
Windows 11 Pro for Workstations
Hi Robert,
I looked at both files in Calibre and on the Kobo Glo. They both performed the same as far as line breaks. With Calibre I squeezed the window narrow until "tablespoon" wrapped in the right hand column. On the Glo I increased the font size until the same thing happened. Through trial and error I have determined that both are not honoring the No Break Space character, which causes the formatting to differ from what I want. I have attached 2 files with my worst recipe example if anyone is curious as to what I am talking about. I am trying to keep the "3/4 - 1" on one line, but it wraps the "1" to the next line. Since this is not an Atlantis problem I will stop here and do research on why ePubs are not honoring the No Break Space character. If I find a fix that can be done in an RTF I will post back here.
I looked at both files in Calibre and on the Kobo Glo. They both performed the same as far as line breaks. With Calibre I squeezed the window narrow until "tablespoon" wrapped in the right hand column. On the Glo I increased the font size until the same thing happened. Through trial and error I have determined that both are not honoring the No Break Space character, which causes the formatting to differ from what I want. I have attached 2 files with my worst recipe example if anyone is curious as to what I am talking about. I am trying to keep the "3/4 - 1" on one line, but it wraps the "1" to the next line. Since this is not an Atlantis problem I will stop here and do research on why ePubs are not honoring the No Break Space character. If I find a fix that can be done in an RTF I will post back here.
- Attachments
-
- Recipe example.epub
- (3.73 KiB) Downloaded 499 times
-
- Recipe example.rtf
- (10.31 KiB) Downloaded 473 times
Atlantis 5
Windows 11 Pro for Workstations
Windows 11 Pro for Workstations
Hi Alan,
Have a look at attached "Recipe example_modified.rtf" and the resulting EPUB file. "Recipe example_modified.epub" displays as you expect in ADE and Calibre.
I have modified your example document in the following way:
For the fractional numbers, I have used single characters instead of a combination of “number+slash+number”.
Instead of “dash” characters, I have used “underscore” characters.
Finally, I selected the underscore characters and changed their font properties so that “Spacing” “Location” was “upper” by 4 points.
I also selected the fractional characters and changed their font properties so their “Spacing” “Location” was “lower” by 2 points.
In this way, the fractional and the underscore characters look like they are horizontally aligned.
HTH.
Have a look at attached "Recipe example_modified.rtf" and the resulting EPUB file. "Recipe example_modified.epub" displays as you expect in ADE and Calibre.
I have modified your example document in the following way:
For the fractional numbers, I have used single characters instead of a combination of “number+slash+number”.
Instead of “dash” characters, I have used “underscore” characters.
Finally, I selected the underscore characters and changed their font properties so that “Spacing” “Location” was “upper” by 4 points.
I also selected the fractional characters and changed their font properties so their “Spacing” “Location” was “lower” by 2 points.
In this way, the fractional and the underscore characters look like they are horizontally aligned.
HTH.
- Attachments
-
- Recipe example_modified.epub
- (3.57 KiB) Downloaded 498 times
-
- Recipe example_modified.rtf
- (10.71 KiB) Downloaded 484 times
The attached document lists all Unicode characters representing fractions with the corresponding code points and HTML entities.
HTH.
HTH.
- Attachments
-
- Unicode Fraction Codes.rtf
- (16.18 KiB) Downloaded 498 times
Thanks Robert for the information. I have decided to stick with the regular size numbers and forward slash for readability reasons (as if the eReader were actually on the kitchen counter while the recipe was being made). I have found a document that says that No Break Spaces can be used as breakpoints in line wrapping (off the top of my head). I will have to look to see if this is an HTML standard or related to ePubs. I have found that the Zero Width No Break Space does seem to work and for a single measure works fine. For measure ranges like "3/4 to 1" cup that I render as "3/4 Space En dash Space 1" I have exhausted my options.
Atlantis 5
Windows 11 Pro for Workstations
Windows 11 Pro for Workstations
The problem is that the EPUB format is a reflowable format. If you try to force the eReaders to use non-breaking sequences, you are running against the grain.
One of the Atlantis users creates eBooks containing plenty of mathematical equations and formulae. These should not be wrapped over end of lines. The only solution he found was to type the math strings in Atlantis, create a screen capture for each formula, and reinsert them into his source documents as pictures.
Any other workaround is heavily dependent on the way the eReaders parse the HTML code. There is no guarantee that the EPUB code will be parsed in exactly the same way from one eReader to the next.
One of the Atlantis users creates eBooks containing plenty of mathematical equations and formulae. These should not be wrapped over end of lines. The only solution he found was to type the math strings in Atlantis, create a screen capture for each formula, and reinsert them into his source documents as pictures.
Any other workaround is heavily dependent on the way the eReaders parse the HTML code. There is no guarantee that the EPUB code will be parsed in exactly the same way from one eReader to the next.
I agree Robert. I am not worried about the reflowable part as that happens in my RTFs. I just want to create a "word" that is composed of numbers, a dash, and non-breaking spaces that would be a maximum of 7 characters long. The problem looks like it goes back to the soft wrap opportunity that is in CSS and has 4 setable levels. The information I read was from the CSS Text Module (Level 3), 5.1 Line Breaking Details specifically, and that referred to a further depth of detail. I am not willing to learn HTML and make changes each time I generate an ePub. The only other option I have thought of is to put a row in the table for the numbers column that contains a single word with the 7 character length and make it non-printing. The problem is that food & recipe articles contain multiple tables of recipe ingredients and only a few have a wrap problem, which would create a lot of extra work that I am not willing to undertake. For now I am finished with this topic as I do have a solution for the other wrap problem of "1-3/4" which is to use the Zero Width No Break Space.
Thanks for all the help.
Thanks for all the help.
Atlantis 5
Windows 11 Pro for Workstations
Windows 11 Pro for Workstations