Apply Special Formatting
This chapter presents a collection of special formatting tips and techniques that have come in handy for Pressbooks users over the years.
Set Custom Indentation Rules for Selected Paragraphs
Pressbooks includes "Paragraph Separation" settings in Theme Options (in Web, PDF and Ebook Options) that allow you to choose between paragraph indentation or spacing between paragraphs. In addition, you can customize the indentation behavior for specific paragraphs using the ‘Formats’ dropdown in the visual editor. The Formats dropdown includes three different indentation styles which can be applied to paragraphs:
- Indent. Paragraphs with this style applied will have their first line indented.
- Hanging Indent. Paragraphs with this style applied with display a hanging indent (the first line will be flush left, while all subsequent lines will be indented). This style is commonly used for works cited pages.
- No Indent. Paragraphs with this style applied with not be indented in any way.
Insert a Soft Return
There are some instances where you’d like to insert a ‘soft return’ (line break) without creating a new paragraph. To create a soft return in the visual editor, press ‘Shift + Enter’. Soft returns can be useful for displaying poetry or other specially lineated text.
Disable Hyphenation for Specific Passages
Pressbooks provides a custom class that will allow you to disable hyphenation for a specific passage, even if hyphenation is enabled in your book in PDF Options. To disable hyphenation for a specific passage, wrap the passage in question with a span element with the class "no-hyphens". The resulting passage should look something like the following:
<span class="no-hyphens">phrase where I don't want hyphenation applied</span>
Any elements with the class no-hyphens will have their hyphens CSS property set to none.
Change Tracking for a Selected Passage
You can increase or decrease the space between letters and words in a specific passage by loosening or tightening its tracking. Tracking can be applied to a selection of any size by using the ‘Formats’ dropdown in the visual editor. The Formats dropdown includes four tracking styles which can be applied to text from your book:
- Tight Tracking reduces the space between letters and words in the selected passage.
- Very Tight Tracking further reduces the space between letters and words .
- Loose Tracking increases the space between letters and words in the selected passage
- Very Loose Tracking further increases the space between letters and words in the selected passage.
Create Section and Page Breaks in PDF Exports
Pressbooks provides two special classes which can be used to produce section breaks in your PDF exports:
- class=”section-break” can be applied to an element to create a section break
- class=”section-break-page” can be applied to an element create a section break which includes a page break after the section break
You can also force a page break in your PDF exports before or after any block-level element (like a paragraph or heading) by adding class="page-break-before"
or class="page-break-after"
to the desired element.
<h2 class="page-break-before">A heading which will have a page break before it is rendered</h>
<p class="page-break-after">This is a paragraph which will have a page break after it is rendered!</p>
To add a blank page to your PDF export you can add the following markup:
<div class="blank-page">*</div>
Note: The "*" won’t be displayed and is simply included as placeholder text.
Change List Display
The default setting for ordered lists in Pressbooks is numerical:
- Apples
- Bananas
- Cherries
Hierarchical lists will look like this:
- Fruit
- Apples
- Red Delicious
- Apples
However, you can change the default hierarchical styling ofordered lists from the default [1, 1, 1, 1, 1, 1] to Harvard [I, A, 1, a, (1), (a)] Decimal [1, 1.1, 1.1.1, 1.1.1.1, 1.1.1.1.1, 1.1.1.1.1.1], or Legal [1, a, i, 1), a), i)] by applying the relevant class to the <ol>
element using the text editor:
Harvard:
<ol class="harvard">
Decimal: <ol class="decimal">
Legal: <ol class="legal">
You can also change the sequential list style type for individual lists to upper alpha (A, B, C), lower alpha (a, b, c), upper roman (I, II, III), and lower roman (i, ii, iii) with the following inline styles:
Lower Alpha: <ol style="list-style-type:lower-alpha">
Upper Alpha: <ol style="list-style-type:upper-alpha">
Lower Roman: <ol style="list-style-type:lower-roman">
Upper Roman: <ol style="list-style-type:upper-roman">
Insert Pullquotes
Pullquotes are short sections of texts that are "pulled" from the text to call out and highlight, drawing attention to these passages and adding graphic interest to a page. Pressbooks allows you to create left- and right-aligned pullquotes using the Formats dropdown in the visual editor.
To designate a passage as a pullquote:
- Select the passage you’d like to render as a pullquote
- Choose Pullquote (left) or Pullquote (right) from the ‘Formats’ dropdown menu
- Click Save
The styling of pullquotes differs from theme to theme and may also differ across the various formats (webbook, ebook, and PDF exports) within a given theme.
Add Dropcaps
Dropcaps are a traditional, decorative element that have been used in manuscripts for centuries. They are best suited to PDF exports. Our Cleary, Leonard, and Lewis themes include dropcaps by default and Austen, Christie, Asimov, and Adunis include an theme option which allows you to toggled dropcaps on or off.
You can also use the firstcharacter
class to apply a dropcap to the first character of any paragraph in your book even in a theme which does not include dropcaps by default. To add a dropcap, wrap the first character of desired paragraph in a <span class="firstcharacter">
element:
<span class="firstcharacter">T</span>his is my first sentence.