Contents | Start | End | Previous: KB0221: Why are extra styles with 'No Space Before' or 'No Space After' created after importing from Word? | Next: KB0223: Why does Kindlegen complain about PostScript in my embedded OTF fonts?


KB0222: How do I remove unused styles from a style sheet?

See also: Why is Jutoh slow to load a document created by Google Docs?

You can ask Jutoh to remove unused styles in the generated ebook using the configuration option Optimize style sheet. This works for Epub, Kindle, HTML and ODT. When opening an ODT document in LibreOffice, you may still see a lot of built-in styles; in LibreOffice's Styles and Formatting palette, select Custom Styles to see only the styles that Jutoh created, which will be a smaller list if you checked Optimize style sheet.

This option doesn't remove redundant styles from the original Jutoh project. There may be reasons why you want to permanently trim the style sheet in Jutoh: for example if your project was imported from a Google Docs ODT file, which creates an outrageous number of unnecessary character styles that slow down editing and bloat the generated ebook.

To remove unused styles, click Edit on the toolbar to edit the project properties, and click Styles. Under the list of styles, choose the type of style you would like to delete, from Paragraph, Character, List and Box. Then click on the "..." button and Bulk Style Deletion. In the dialog that shows, the available styles are listed and you have the option of clicking Check Unused Styles. This searches the whole project and checks (ticks) all the styles that are not used in your content. You may wish to clear the styles that are standard in Jutoh; for character styles, these include Citation, Drop Caps, HTML Text, and URL. Now click on OK and then Yes to remove the redundant styles.

If you are trying to clean up a project imported from Google Docs, you may be surprised at the number of styles still left. Indeed Check Unused Styles may initially not find any redundant styles. To fix this, first use Formatting Cleanup on the Format | Book menu to remove direct formatting such as text size, font and colour. These should generally be specified in paragraph styles anyway.

This may leave some strange-looking styles such as T1234 + No Bold and T1234 + No Bold + Italic. The first kind is usually entirely redundant, and you can remove them by using the Find and Replace dialog (Edit | Find & Replace) to search for the character style T* + No Bold and replace it with (none).

To remove the second kind, create a new character style such as Italic Style. Then use Find and Replace to replace T* + No Bold + Italic with Italic Style. This consolidates lots of separate styles into one style.

You may need to do this a couple of times if all styles weren't replaced the first around - repeat it to be on the safe side.

Now, go back to bulk style deletion in Project Properties/Styles and you should find that a lot more unused styles are found for deletion.

When you next open and edit a document within your project, redundant styles will be deleted and you should find editing faster due to the smaller number of styles.


Contents | Start | End | Previous: KB0221: Why are extra styles with 'No Space Before' or 'No Space After' created after importing from Word? | Next: KB0223: Why does Kindlegen complain about PostScript in my embedded OTF fonts?