Ask Your Question
0

How should EPUB flow layout work?

asked 2020-11-23 11:21:21 +0200

Richard Kirk gravatar image

I understand the idea in principle: if we have a small display and/or poor eyesight, then we need the same text but less on each page. This is reflowable layout, and it works well for pure text documents such as novels. Other objects such equations, images, diagrams, or tables are harder but they usually fit into rectangles. I would expect these to resize to fit in the new page size. Text items such as tables and equations might scale as text, while images might scale as the page width. We cannot move objects past the text, as the text may refer to 'the diagram above' or something like that. But anything extra we can do to preserve the look, such as flowing text, is a bonus.

I have a large technical document. It has diagrams and equations but I do not was text. It largly works as an EPUB. When something is broken it is usually obvious ( e.g. bug 138043 ). However, sometimes a table is split in silly ways with the header on one page and the rest on the next; or a particular image comes out smaller than others that were the same size. I cannot file a bug because I do not know it is broken: it may look a bit odd but the EPUB layout might be doing the right thing for a perfectly good reason.

If I knew what the EPUB flow layout wanted, I might be able to lay out my document slightly differently. A good explanation in the documentation might help others get good results too.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2020-11-23 13:58:10 +0200

ajlittoz gravatar image

If I understand correctly the problem, it all boils down to changing the global appearance of the document in a few steps.

If your document is fully styled, i.e. you never used direct-formatting all over your document and exclusively worked with styles, the text parts can be changed very easily for larger font size. This requires managing very rigorously your styles.

Remember that all styles are organized hierarchically, with Default Paragraph Style being the common ancestors to all. However, some built-in styles creates "breaks" in the inheritance:

  • Heading, ancestor of all heading and titling styles
  • Index, ancestor of all TOC, bibliography and index styles
  • List, ancestor of List n and Numbering n styles and derived ones, usually used in lists
  • Caption, ancestor of targeted caption styles

These may be configured for font face and size in Tools>Options, LibreOffice Writer>Basic Fonts (Western) and this is where you create the "break" in inheritance unless you don't use the feature and configure the styles in their definition using the following rule.

To minimize the number of fixes when you decide for a new base font size, make sure that where you change font size (if you don't touch at all the parameter, it inherits from the ancestor; but whenever you click on a size, be it the same as the ancestor, you freeze the parameter to this value) the new size is defined in % units so that it is recomputed whenever it changes in the ancestor.

E.g., if size in Default Paragraph Style is 12pt and Heading is 14pt, respecify Heading size as 116% or round it to 120% which is more user-friendly (not for the end reader but for the editor).

The same can be done for vertical spacing but nit is a bit more tricky because it requires to list all used styles to compute sensible values.

Don't code font size changes in character styles. Character styles are also organized, if needed, in a hierarchical way, but only between themselves. %-units are relative to their user-created ancestor, not to the paragraph in which there are applied. A character style should only change "non metric" parameters like weight, angle, ... Unfortunately, subscript and superscripts are "metric" changes. They should receive their own styles so that only these need to be adapted in case of a global font size change.

Tables should not be a problem as long as you have used so-called table styles to format them because these in fact collection of macros direct-format the table and the cells and take over whatever you do to them.

Standard manual tables extend from margin to margin. The width therefore cannot be extend. If you manually set the width smaller than the distance between margins, of course it will not change either.

Text inside the cells is styled, which means it ultimately inherit from Default Paragraph Style. If your initial document requires that table text be set in different size than the text, modify Table ... (more)

edit flag offensive delete link more

Comments

Thanks for the long answer. My document is long (225 pages) and though all the fonts ought to come from the page styles, I am still finding the odd paragraph with its own settings. I have put in some page breaks to help the ordinary layout. I would be happy if EPUB ignored these, but this might not be everyone's choice. I suspect my tables problem may be genuine: if I can demonstrate it in a simple document, I will file a bug. I will try the frames layout for images and the cross-references for text.

Richard Kirk gravatar imageRichard Kirk ( 2020-11-23 14:21:25 +0200 )edit

Page breaks can be considered acceptable direct-formatting exceptions provided they are used in exceptional cases such as the only transition between preface and chapters. If you can assert a systematic rule for the page break, then it belongs in a page style.

If your page breaks are kind of conditional ("to help ordinary layout"), maybe they cover another reality. Perhaps a do-not-split-paragraph ? In which case, think again about the semantics of your formatting.

I don't see the "table problem". Explain it thoroughly in another question.

ajlittoz gravatar imageajlittoz ( 2020-11-23 15:02:53 +0200 )edit

I understand your comments about the page breaks. I am not splitting paragraphs, but sometimes I tweak things to get a better page layout, putting in a break to shift something from a crowded page to an emptier one. This is how I have been working to date, and it has got the PDF to a good state; but I can understand it is not the 'right thing to do'.

Once I have used your suggestions, the 'table problem' may just go away. If it persists and I can demonstrate it with a simple document, I will file a bug and provide the document as an example.

Thanks.

Richard Kirk gravatar imageRichard Kirk ( 2020-11-23 15:16:34 +0200 )edit

CAVEAT: I made a mistake in my previous comment. The page break belongs in a paragraph style, not a page style.

ajlittoz gravatar imageajlittoz ( 2020-11-23 16:05:10 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2020-11-23 11:21:21 +0200

Seen: 36 times

Last updated: Nov 23 '20