Sigil User Guide

0.7.2

Dave Heiland

Copyright © 2012, 2013 Dave Heiland

All rights reserved.

This work is licensed under a Creative Commons 3.0 Attribution-Share License.

Use of these materials is permitted only in accordance with license rights granted. Materials provided “AS IS”; no representations or warranties provided. User assumes all responsibility for use, and all liability related thereto, and must independently review all materials for accuracy and efficacy.

Introduction

— Sigil: The EPUB Editor —

Welcome to the Sigil User Guide – completely updated for Sigil 0.7.2.

Sigil 0.7.2 is the result of countless hours of volunteer effort to create the fastest, most stable and powerful version of the best free EPUB editing software available.

Jump right to the Tutorials to learn how to use Sigil step by step. Or view What’s New for changes in recent releases.

Download Sigil from:

The Official Sigil Website

Help is available from other users and the developers of Sigil at MobileRead:

Sigil Forum @ MobileRead

The Sigil User Guide includes documentation that will help you get the best out of editing your EPUB, including:

Installation: Installing Sigil on Windows, MAC and Linux.

Features: A complete description of all of Sigil’s features.

Tutorials: Step by step guides for using Sigil to create your book.

FAQ: Frequently asked questions about Sigil.

Contributing to Sigil: How to support Sigil.

You can download the Sigil User Guide ebook in EPUB format or read it online for free.

What’s New

The latest versions of Sigil contain hundreds of changes, bug fixes and new features while still retaining the same easy to use interface of earlier versions. Almost all of Sigil’s code has been updated and improved with particular focus on the following areas:

Stability: All known crashes and related bugs from previous versions have been identified and fixed – making Sigil completely stable for updating your EPUBs.

Robustness: Sigil can correct even more common problems when reading files, and will no longer exit when opening invalid EPUBs. Saving has been enhanced to perform more integrity checks. Splits and merges can now be done exactly where you want without potential data loss. The cursor position is correctly updated when you switch views, and Find & Replaces work consistently and accurately over one or all files.

Performance: Sigil is now significantly faster in many areas: opening and changing tabs, generating a TOC, merging files, bulk renaming, replacing text, etc.

Flexibility: More preferences, options and features were added to let you use Sigil the way you want.

For a detailed list of all the change made to Sigil, see the Changelog.

Changes in 0.7.2 include:

Add Cover feature (Tool→Add Cover) automatically creates an HTML cover file and sets cover semantics for any image you pick.

Search in Marked Text in Find & Replace allowing you to restrict your searches and replaces to specific sections of text.

Preview Can Be Zoomed Independently from Book View and Code View.

More data can now be read from OPF content files that contain errors.

UI Language selection now works for languages containing "_" in their code.

EPUBs that don't correctly specify that they contain UTF-8 filenames can now be opened.

UTF-16 encoded files can now be opened.

Qt has been upgrade to Qt 5.0.2

Changes in 0.7.1 include:

Clean Source preferences simplified. Sigil now warns if you are opening or saving invalid HTML when cleaning automatically.

Spellcheck allows case-insensitive sorting and remembers sort order.

Fixed incorrect wrap when using All HTML Files.

New view image feature in Code View to show resizable image.

Index entry no long splits on ";", and works correctly for nbsp characters.

Find after using Ctrl-F across multiple lines will now match selected text.

Sigil will now open EPUBs containing non-UTF-8 filenames.

Clean Source can run automatically on Open or Save, but is no longer run automatically when doing a Replace All (use the Code View right-click context menu Reformat HTML to reformat manually).

New features in 0.7.0 include:

Qt5: An upgrade to the latest graphics framework provides a number of fixes and enhancements.

Audio/Video Support: Insert, play and manage audio and video files. (Requires a compatible ereader to view as audio/video is not supported in EPUB 2).

Live Preview: A new Preview window (View→Preview) that dynamically updates as you edit in Code View or in CSS stylesheets – replacing Preview View and the old Split View.

Spellcheck Enhancements: See all misspelled words in one dialog. Easily add words to a dictionary or change them in all files. Select one or more active dictionaries to allow combining separate lists of words.

Edit TOC: Directly edit the Table Of Contents without having to generate the TOC.

Clip Bar and Clips Window: An optional Clip Bar (View→Toolbars→Clip Bar) to show toolbar buttons for the first 20 Clips, and a dockable window (View→Toolbars→Clips) listing all Clips for quick selection.

Updated Reports: New reports include All Files, Links, and Characters used in the book.

Find & Replace Wrap: Allow searching to wrap or not wrap to the other end of the file or book.

Embedded Fonts: Multiple embedded fonts now display correctly thanks to Qt5.

Other changes in 0.7.0 include:

An Autofill option in Clips that creates entries based on your CSS files.

Basic clips (such as <span> or →) can now be used in Book View.

Saved Searches will now use the options set in Find & Replaces when run.

Metadata Editor can stay open while editing.

Index Editor can import tab separated entries.

Spellcheck preferences can add lists of words pasted into a dictionary.

Generate TOC no longer creates ids when they aren’t used for headings at the top of files.

Random highlighting of text in Book View is now, mostly, gone in Book View due to Qt5.

Well-Formed checks are only done when absolutely necessary.

CSS validation uses CSS 2.1 profile instead of CSS 3 as it’s closer to EPUB 2 standards.

Cursor position should not move to the end of a page when a book is saved.

Epubs that are missing a container.xml file can now be opened.

HTML TOCs and Indexes can use default CSS stylesheets.

Book Browser filenames that are long have tooltips showing their names.

Table of Contents opens expanded, with tooltips showing their target.

Updated internal regex usage to use Qt5 QRegularExpression.

Preferences have moved to a new location for Linux users – so Linux users must copy old preference files to the new location.

New features in 0.6.x include:

Saved Searches: Never forget a frequently used Find & Replace search again. Edit and organise searches, run a group of searches, and quickly access searches using right-click in the Find & Replace text boxes.

Go To Links Or Styles: Quickly jump to the CSS style used for your HTML or to links, and go Back to your starting point.

Edit Files Externally: Open your HTML, Image or Stylesheet files with an external editor and Sigil will update your book as soon as you save in the other application.

Clip Editor: Store and share common text or formatting. Edit and group clips, apply starting and ending tags to text, and quickly access clips using right-click in Book View or Code View editors.

Indexes: Automatically create an Index by marking text or listing phrases to index.

HTML Table Of Contents: Convert your TOC into an HTML page.

Reports: View details about your files, images, styles – including word counts and file and image sizes.

Delete Unused Images Or Styles: Automatically remove unlinked images or unreferenced CSS classes.

Clipboard History: Quickly access your recently copied text.

Spellcheck: Step through misspelled words in addition to highlighting them, with improved word recognition.

Preferences: Customise Sigil even more by changing Sigil’s fonts and level of automatic source cleanup.

Special Characters: Insert from a list of common special characters.

Insert Links And IDs: Create footnotes and links to chapters or anything else.

Link Stylesheets: Quickly link and unlink stylesheets to your HTML files.

Validate CSS Stylesheets: Check your stylesheet pages using the W3C web service with a simple click.

Edit Headings In Generate TOC: Change the title and the level of any heading entry when using Generate TOC for quick corrections. Use the tooltips to see the actual HTML code for your heading.

Find & Replace: Use the new Replace button to replace without moving to the next match, or the new options to make using regex easier (click on the chevron icon on the lower left of Find & Replace to hide/show options).

Clean Source Preferences: Control exactly when and what type of cleaning, if any, should be done. (0.6.1)

Invalid EPUB Support: Invalid EPUBs can now be opened so that you can correct them in Sigil. (0.6.1)

Audio/Video Files: Audio and Video files are now moved to separate folders, their links are updated as needed, and their tags left intact. (0.6.1)

Other changes in 0.6.x include:

Support in Code View for using the formatting buttons.

Insert Image improvements – insert directly from disk, display thumbnails, view image size details.

Metadata Editor redesigned for simpler access and more control.

Change Case buttons to change the case of words.

Text direction buttons (use View→Toolbars to show them).

Automatic Well-Formed Checking – your code is now checked for errors only when necessary so you no longer need to turn it off then on to do complex replaces.

Updated icons and streamlined menus for easier access to functions.

Save a copy of your EPUB (without renaming your current file), or save individual files from your EPUB.

Easily insert closing tags with Ctrl+., or delete selected tags and attributes in Code View with Ctrl+Space

Quickly see the HTML code of selected text in Book View using Format→Show Tag.

Ctrl-click on a link in Code View to go to any link internal or external to the book.

Ctrl-click on an opening tag in Code View to jump to its stylesheet style.

Hold the Ctrl key while clicking Find/Replace/etc. (in Find & Replace or Saved Searches) to temporarily use Current File.

Hold the Ctrl key while clicking a Special Character to close the dialog after inserting the character.

Hold the Ctrl key while pasting a Clip and it will cut the tags in the selected text before applying the Clip.

Toggle between Book View and Code view using F2 or double-clicking the tab header.

Right-click on a tab header to select close all other tabs.

Split all files with a split marker not just the current one.

Locate your Preferences files with the click of a button.

Use and assign keyboard shortcuts for even more functions.

Sigil will now restart in whichever view you were using when it was last closed.

All third party software has been updated to their current versions, including Qt 4.8.3.

XPGT files are no longer supported and are treated as any other unknown file type.

Index Editor can load a list of words or phrases to index from a file. (0.6.1)

Print any type of file that displays in the editor. (0.6.1)

Bulk rename can change just the file extension. (0.6.1)

Display counts of book browser and TOC entries as tooltips. (0.6.1)

Reports can now be saved, or left onscreen while editing files. (0.6.1)

Deleting unused files or images allows you to select which to delete. (0.6.1)

And numerous other tweaks and polishing to make Sigil easier and more fun to use.

Replace can only be done in Code View since it was not reliable in Book View.

Clean Source is set to Pretty Print Tidy when you use Sigil for the first time, but can be changed in Preferences.

All of the new features, along with all features and functionality, are of course described in this completely updated Sigil User Guide.

About Sigil

Sigil was designed to make it easy to create great ebooks using the EPUB format. If you are formatting books for your own use, or you are a professional editor publishing books on multiple platforms, then Sigil is for you. You can use Sigil to format and package your books into an EPUB that looks exactly the way you want it to using an advanced set of features that have made Sigil one of most popular EPUB editors available.

This open-source and completely free software is written and supported entirely by volunteers. The Sigil development team includes John Schember (the lead developer and maintainer of Sigil), Grant Drake and Dave Heiland. Sigil was originally created by Strahinja Markovic in 2009 and remains completely free to download and use. Support is also provided by other volunteers who contribute code, translations and helpful answers to user’s questions. See the Help→About menu in Sigil for a complete list of contributors.

About EPUB

The EPUB (electronic publication) format is one of the most popular file formats for ebooks. It is an open and freely available standard that can be used by anyone.

An EPUB ebook is simply a file containing several other files stored together using the common zip format. These files include your words, images, Table of Contents, stylesheets, fonts and details about your book like author or title. EPUB’s standard format means your book can be read on many ereaders or converted easily to other ereaders not using EPUB.

Your EPUB stores your words and text in the book using the HTML format (Hyper Text Markup Language – the same code used by web pages to display text and images). This just means that the files contain your text along with markup codes and tags (like <h1> or <p>) which tell ereaders how to format and display the text – some words could be bold or italic, others could be a paragraph or a heading, etc.

In addition to HTML tags to control or style the layout, EPUB books typically make use of stylesheets to help organise the use of styles used by the HTML files. A stylesheet is another file in the EPUB that contains a list of HTML tags along with instructions on how to display any text using that tag, e.g. <h1> (heading level 1) should be larger and centered. This allows you to separate the content of your book from its layout and allows you to easily adjust the look of the EPUB.

Of course, when anyone actually reads an EPUB they don’t see all these HTML files or stylesheets. The ereader just displays the text and images like a normal book – as close as it can to the formatting you defined, even if there are thousands of pages or files.

You don’t have to understand all the details of the EPUB format or understand HTML formatting codes to start using Sigil. However, if you spend any time with Sigil you will soon need to become familiar with these areas in order to get the most out of the advanced features of Sigil, and, ultimately, to achieve the design you want.

Text files are actually stored in XHTML format (an XML compliant version of HTML), but to make the guide easier to read we’ll use HTML to refer to either HTML or XHTML.

Sigil is designed to work with version 2 of the EPUB standard, with support for some additional features found in EPUB 3.

Even though Sigil is designed to work with EPUB files, the EPUB format can easily be converted to other ebook formats like mobi.

To learn more about HTML you can read various online guides, including:

W3Schools HTML Guide

Help with on the EPUB format is available from EPUB users at MobileRead:

EPUB Forum @ MobileRead

If you really want to dig into the details of the official EPUB standard on which Sigil is built you can read the original technical specifications:

Official EPUB 2.0.1 IDPF Standard

OPS (Open Publication Structure): The key specification which describes everything in an EPUB file.

OPF (Open Packaging Format): How the EPUB files relate to each other, metadata details (content.opf).

OCF (OEBPS Container Format): How files are packaged into a .epub file.

You can download the EPUB version of the Sigil User Guide, which was created entirely in Sigil, and view it in Sigil to see an example of an EPUB ebook.

Installation

— Getting Started —

You can download the latest version of Sigil from the official Sigil web site and install it for your OS.

Windows

Sigil is supported on Windows 7, and should run on Windows XP, Vista, Windows 7 or 8.

Download Sigil for Windows

Double-click the file to run the installer, e.g.:

Sigil-0.7.0-Windows-Setup.exe

Mac

Sigil is supported on MAC OS 10.8 (Mountain Lion) x64 bit Intel, but should run on 10.7 or higher.

Download Sigil for MAC

Unpack the DMG file and drag the “Sigil.app” file to your Applications folder, e.g.

Sigil-0.7.0-Mac-Package.dmg

Linux

A binary version of Sigil is not available due to the number of versions of Linux.

However, since the source code is freely available, you can build from source for your version of linux. And due to the effort of many volunteers, there is most likely a pre-packaged version of Sigil built for your Linux distribution available online:

Sigil Linux Distribution Packages

Building Sigil From Source Code

Features

— An In-Depth Guide —

This section gives a quick overview of all of Sigil’s features, followed by chapters detailing everything available in Sigil.

You can also read the Tutorials section for step-by-step instructions for common tasks in Sigil, and then refer back here for additional details.

Editing

You can edit your book using either Book View or Code View. The Book View editor is a WYSIWYG editor which displays your book as it might appear to users and is useful when you need to make basic changes. The Code View editor allows you to directly edit the HTML formatting of your files when you want complete control over your book or you want to use Sigil’s advanced features. You can also use a live Preview window with Code View to show you what your page will look like as you type.

Find & Replace

The ability to search for or replace text is one of the most powerful functions in Sigil. Book View provides a basic find function, but Find & Replace is designed for Code View where all its features are available. You can search or replace in one file or in all the files at once, and you can search for simple text or use Regular Expressions to change or correct text or formatting. You can also use Saved Searches to store your searches for reuse.

Managing Files

The Book Browser organises all the files in your EPUB by type and gives you quick access to open files or to modify them. Double-click a file to open it in the editing window, or right-click on selected files to see options for renaming, deleting, merging, adding, linking stylesheets, etc. The HTML files are listed in the order they appear in your book – and you can drag and drop them to reorder them. You can also easily add or insert files into your book.

Table of Contents

The Table of Contents (TOC) window shows you exactly what your TOC will look like, and allows you to jump to specific chapters by clicking on chapter names. You can also generate a new TOC based on headings in your book at any time, edit the TOC directly, and create an HTML version of your TOC.

Modifying Book Details

The Metadata Editor provides a quick way to update book details like Title, Author, and Language. You can add any of the hundreds of standard EPUB metadata entries like publication date, co-authors, copyright information, etc.

Preferences

Many settings in Sigil can be customised in the Preferences window. In particular you can set Sigil’s user interface language, keyboard shortcuts, text appearance, dictionaries, and automatic level of formatting and cleaning.

Validation

Sigil includes the FlightCrew EPUB validator to check if your book conforms to EPUB standards, and it provides easy access to validate your CSS Stylesheets with the online W3C CSS validation service. Sigil also ensures that your code is valid XHTML when it is loaded, and can also automatically clean or format your code using HTML Tidy.

Reports

Reports can be generated to display details about your files including size, number of words, whether images are in use, which styles are used, characters in the book, etc.

Spellchecking

You can check the spelling of your text using the powerful Spellcheck dialog that allows you to see all misspelled words and to save them to a dictionary or correct them. Multiple user dictionaries can be created and you can use one or more dictionaries simultaneously.

Advanced Tools

Sigil has a number of custom tools to assist with creating your ebook – including Saved Searches to save your Find & Replace searches, and Clips to save and paste text or styles. Unused images and styles can be removed automatically, files can be edited with external programs, and you can jump directly to styles used by HTML code.

Language Support

Sigil has been translated into over 25 languages and makes it easy to change the user interface language as needed. It is written in C++ for high performance and includes full Unicode UTF-16 support.

User Interface

— Windows, Menus and Toolbars —

Sigil’s user interface consists of:

Windows: Displays for information like Book View, Book Browser, and TOC.

Main Menu: Most of the available commands, like File→Open, are listed here.

Toolbar Buttons: Movable buttons that provide quick access to many menu items.

Keyboard Shortcuts: User-definable shortcuts for all menu items, like Ctrl+S to save your file.

Context Menus: Commands shown when you right-click on something, like a filename or window.

The screenshots in the User Guide may be slightly different to what you see on your computer.

Windows

Sigil uses various windows in the main interface to present information: a window to show your files, to edit your book, to view your table of contents, etc.

Windows can be hidden – use the View menu entry to show or hide specific windows.

Certain windows can be also moved. To move a window, click on its header label and drag it to its new location. For instance you can place the Table of Contents under the Book Browser:

You can also create tabs for the Table of Contents and the Book Browser, and other windows, if you drag and drop it directly on the Book Browser window instead of just above or below it:

You can even undock windows (separate them from the main Sigil window). To undock a window, double-click on the heading of the window. In some OS’s you can also undock and re-dock the windows by clicking on the little button in the top right corner of the window.

Keyboard Shortcuts

Keyboard shortcuts (e.g. Ctrl+S for Save) are shown next to menu entries and in Edit→Preferences: Keyboard Shortcuts.

You can create or change keyboard shortcuts in Preferences.

Main Menu

This is the list of menu items that is always at the top of Sigil’s window or your screen:

File

New: Create a new, empty EPUB.

Open: Open an EPUB or HTML file from your computer.

Add:

Existing Files: Add HTML files, images, etc. from your computer.

Blank HTML File: Create a new HTML file in the book.

Blank Stylesheet: Create a new CSS Stylesheet in the book.

Blank SVG Image File: Create a new SVG image file in the book.

Save: Save your file (use often!).

Save As: Save your file under a different name.

Save A Copy: save a copy of your file under a different name without renaming your current file (useful for backups).

Print Preview: Preview the printing of the current tab.

Print: Print the current tab.

List of recently opened files.

Quit: Exit Sigil, asking if you want to save your file first if it hasn’t been saved.

Edit

Undo: Restore text just deleted, inserted or replaced.

Redo: Reverse the last Undo.

Cut: Remove the selected text and store it for paste.

Copy: Copy the selected text and store it for paste.

Paste: Insert previously cut or copied text into your document.

Paste from Clipboard History: Insert text automatically saved in a list when you used cut or copy.

Delete Line: Delete the current line in Code View.

Change Case:

Lowercase: Change the selected text to lowercase.

Uppercase: Change the selected text to uppercase.

Titlecase: Change the first letter of each selected word to uppercase.

Capitalise: Change the first letter of the selection to uppercase.

Split at Cursor: Split the current file into two files immediately.

Split at Markers: Split all files at previously inserted chapter markers.

Preferences: Open the Preferences window to change options.

Insert

Split Marker: Insert a marker to use for Split at Markers.

File: Insert an image, audio, or video file from your book or your computer.

Special Character: Insert special characters from a list.

ID: Insert an anchor name that can be used with links.

Link: Insert a link to something in your document or anywhere else.

Closing Tag: In Code View insert a tag to close the last unclosed tag.

Clip: Select a Clip to insert and view shortcuts for clips.

Format

Heading:

Heading 1: Format the paragraph as a level 1 heading.

Heading 2: Format the paragraph as a level 2 heading.

Heading 3: Format the paragraph as a level 3 heading.

Heading 4: Format the paragraph as a level 4 heading.

Heading 5: Format the paragraph as a level 5 heading.

Heading 6: Format the paragraph as a level 6 heading.

Normal: Format the paragraph as normal text.

Preserve existing attributes: Keep attributes like class when formatting.

Bold: Make text bold.

Italic: Make text italic.

Underline: Underline text.

Strikethrough: Make text striked through.

Subscript: Make text subscript.

Superscript: Make text superscript.

Align Left: Align text to the left margin (use remove formatting to reset to default).

Center: Align text centered on the screen.

Align Right: Align text to the right margin.

Justify: Align text to left and right margins.

Bulleted List: Change text into a list of items preceded by dots.

Numbered List: Change text into a list of items preceded by numbers.

Decrease Indent: Decrease the indentation of the text.

Increase Indent: Indent the text.

Text Direction LTR: Set the direction of text from left to right.

Text Direction RTL: Set the direction of text from right to left.

Text Direction Default: Set the direction of the text to the default.

Show tag: While in Book View show the HTML tag for the current location.

Remove Formatting: Remove some style formatting in Book View, delete tags in Code View.

Search

Find & Replace: Open the Find & Replace window.

Find Next: Search forwards for the next matching text.

Find Previous: Search backwards for the next matching text.

Replace: Replace any matched text.

Replace/Find Next: Replace any matched text and search forwards for the next matching text.

Replace/Find Previous: Replace any matched text and search backwards for the next matching text.

Replace All: Replace every matching text according to the Find & Replace settings.

Count All: Count every matching text according to the Find & Replace settings.

Current File:

Find Next In File: Find only in the current file regardless of F&R mode.

Replace Next In File: Replace/Find Next only in the current file regardless of F&R mode.

Replace All In File: Replace All only in the current file regardless of F&R mode.

Count All In File: Count All only in the current file regardless of F&R mode.

Bookmark Location: Bookmark your current location in Book View or Code View.

Go To Link Or Style: Go to the selected link or go to the CSS style for this tag.

Back: Go back to where you set a bookmark, clicked a link or used Go to Link or Style.

Mark Selected Text: Mark the selected text in Code View for use with Find & Replace.

Go To Line: Jump to a specific line number in Code View.

Tools

Add Cover: Select an image to make it the cover.

Metadata Editor: Open the Metadata Editor to edit book details.

Table Of Contents:

Generate Table Of Contents: Use predefined headings to generate a TOC.

Edit Table Of Contents: Edit the TOC manually.

Create HTML Table Of Contents: Create an HTML file version of the TOC.

Index:

Index Editor: Manage your index entries.

Add To Index Editor: Add the selected text to the Index Editor list.

Mark For Index: Add the selected text to the index when it is created.

Create Index: Create an HTML file containing the index list.

Spellcheck:

Spellcheck: Open dialog to spellcheck all words at once.

Highlight Misspelled Words: Toggle highlighting misspelled words in Code View.

Next Misspelled Word: Find the next misspelled word in Code View.

Add Misspelled Word: Add the misspelled word to the default dictionary.

Ignore Misspelled Word: Ignore the misspelled word temporarily while Sigil is running. Ignored words are also cleared when you open a new book.

Clear Ignored Words: Clear the list of temporarily ignored words.

Validate EPUB With FlightCrew: Check if your book meets EPUB standards.

Validate Stylesheets With W3C: Check if your CSS files are valid using the W3C web service.

Reports: Display various details about HTML files, images, CSS styles, etc.

Clip Editor: Edit and paste snippets of text and styles into your document.

Saved Searches: Edit and run saved Find & Replace searches.

Delete Unused Media Files: Remove unlinked image, video, and audio files from your book.

Delete Unused Stylesheet Classes: Remove unreferenced classes from CSS files.

View

Toolbars

File: Show or hide the open and save buttons.

Edit: Show or hide the undo and cut buttons.

View: Show or hide the Book and Code view buttons.

Insert: Show or hide the insert chapter and image buttons.

Back: Show or hide the Back button.

Donate: Show or hide the Donate button.

Tools: Show or hide the Tools buttons.

Heading: Show or hide the heading buttons.

Format: Show or hide the bold and formatting buttons.

Align: Show or hide the text alignment buttons.

List: Show or hide the numbered list buttons.

Indent: Show or hide the indent buttons.

Change Case: Show or hide the change case buttons.

Text Direction: Show or hide the text direction buttons (off by default).

Clip Bar: Show or hide buttons used for Clips (off by default).

Book View: Switch to Book View for editing.

Code View: Switch to Code View for editing.

Toggle View State: Change to Book View or Code View.

Zoom In: Increase the size of text and images in the view.

Zoom Out: Decrease the size of text and images in the view.

Zoom Reset: Reset the window zoom to 100%.

Book Browser: Open or close the list of files in the EPUB.

Clips: Open or close a selectable list of all Clips.

Preview: Open or close a live preview window.

Table of Contents: Open or close a clickable TOC window.

Validation Results: Open or close the validation window.

Window

Next Tab: Change view to the following tab.

Previous Tab: Change view to the preceding tab.

Close Tab: Close the current tab.

Close Other Tabs: Close all tabs other than the current tab.

Previous File: Open the file above the selected file in the Book Browser.

Next File: Open the file below the selected file in the Book Browser.

Help

User Guide: The official Sigil User Guide.

Tutorials: Step by step guides to using Sigil.

Frequently Asked Questions: Common questions about Sigil.

Donate: How to donate to ongoing development.

Report an Issue: How to submit a bug report.

Sigil Dev Blog: Occasional updates about development.

About: Sigil version and author information.

Toolbars

Toolbars are the rows of buttons at the top of the window. But the buttons don’t have to remain at the top of the screen – you can click and drag groups of buttons anywhere you want (shown here with an undocked Book Browser and Table of Contents at top):

Main Toolbar

The main toolbar contains buttons used for shortcuts to Sigil’s main features:

To move buttons, click and hold on the small bar to the left of each button group then drag it to where you want it.

Right-click on the toolbar to easily select which buttons or windows to show.

The buttons are listed below, with their equivalent menu entry:

New: File→New

Open: File→Open

Add Existing Files: File→Add→Existing Files

Save: File→Save

Undo: Edit→Undo

Redo: Edit→Redo

Cut: Edit→Cut

Copy: Edit→Copy

Paste: Edit→Paste

Find & Replace: Search→Find & Replace

Book View: View→Book View

Code View: View→Code View

Split At Cursor: Edit→Split At Cursor

Insert File: Insert→File

Insert Special Character: Insert→Special Character

Insert ID: Insert→ID

Insert Link: Insert→Link

Back: Search→Go Back To Link Or Style

Donate: Help→Donate

Metadata Editor: Tools→Metadata Editor

Generate Table of Contents: Tools→Table Of Contents→Generate Table Of Contents

Next Misspelled Word: Tools→Spellcheck→Spellcheck

Validate EPUB With FlightCrew: File→Validate EPUB With FlightCrew

Formatting Toolbar

The formatting toolbar contains buttons used mostly for formatting text. This is the default toolbar:

The icons are listed below with their equivalent menu entry:

Heading 1: Format→Heading→Heading 1

Heading 2: Format→Heading→Heading 2

Heading 3: Format→Heading→Heading 3

Heading 4: Format→Heading→Heading 4

Heading 5: Format→Heading→Heading 5

Heading 6: Format→Heading→Heading 6

Normal: Format→Heading→Normal

Bold: Format→Bold

Italic: Format→Italic

Underline: Format→Underline

Strikethrough: Format→Strikethrough

Subscript: Format→Subscript

Superscript: Format→Superscript

Align Left: Format→Align Left

Center: Format→Center

Align Right: Format→Align Right

Justify: Format→Justify

Bulleted List: Format→Bulleted List

Numbered List: Format→Numbered List

Decrease Indent: Format→Decrease Indent

Increase Indent: Format→Increase Indent

Lowercase: Format→Lowercase

Uppercase: Format→Uppercase

Propercase: Format→Propercase

Capitalise: Format→Capitalise

Left to Right: Format→Text Direction LTR

Right to Left: Format→Text Direction RTL

Default: Format→Text Direction Default

Clip Bar

Buttons are created for the first 20 Clips not in a group.

Text direction and the Clip Bar are not visible by default. Use View→Toolbars To hide/unhide button groups.

Context Menus

Context Menus are menus that appear when you right-click on text, a label, a window, a tab, a header, a text box, etc. – like a file name in the Book Browser, selected text in Code View, or an image in Book View. Context menu items are discussed in related chapters:

When in doubt, right-click on something to see if there are additional actions available!

Zoom

On the lower right of the main window is a zoom control that lets you shrink or enlarge the text and images independently in Book View, Code View, and the Preview window:

The 100% indicates the zoom level of the view and this percentage will increase or decrease when you click on the + or – icons.

Status Bar

The bottom area on the main window (to the left of the zoom control) will occasionally list status information when an action is completed.

The status bar can also show information about the currently opened file, such as Line and Column in Code View:

Tooltips

Many of the buttons, dropdown boxes, labels and fields have tooltips that provide information on how they are used.

To see a tooltip just hover your mouse over the button or other item and the help text should be displayed:

There are many tooltips available in Sigil – most dialogs and buttons will provide some help text.

Preferences

— Customise Sigil —

The Preferences dialog gives you control over many settings in Sigil.

Select the menu item Edit→Preferences to open the Preferences dialog:

You can change the following settings (see below for details):

Appearance

Clean Source

Keyboard Shortcuts

Language

Spellcheck Dictionaries

Once the Preferences window is open you can choose the area you want to modify by clicking on the entry on the left. Selecting OK or closing the window will save the current settings.

Appearance

Appearance settings do not affect how your EPUB is displayed on ereaders!

You can modify the fonts and colors that Sigil uses to display your book while editing:

The settings that can be changed include:

Book View / Preview: You can independently set the font family/size for serif fonts and san-serif fonts.

CSS / Code View: These settings control the font family/size for both HTML files in Code View and CSS files. You can also set the color used for highlighting text.

Insert Special Characters: You can set the font family/size of characters in the Special Characters dialog.

The default fonts for Book View and Code View are Arial and Times New Roman. If these are not available on your system the preferences will default to the first available font.

Clean Source

You can set the level of automatic formatting and cleaning that is performed on your HTML source code, and when cleaning should be done.

The default setting is to clean when opening or saving EPUBs and to use Pretty Print Tidy. This means that Sigil will re-format your source code to make it more readable and easier to search, and it will try to correct simple errors that make the code invalid.

Automatically Clean and Format Source Code

You can control when automatic cleaning and formatting of your code is done with the following options:

Open: When enabled, cleaning and formatting will be performed automatically when you open an EPUB or HTML file, or when switching from Book View to Code View after editing in Book View.

Save: When enabled, cleaning and formatting will be done when you use Save or Save As.

If an HTML file is not well-formed due to invalid code, then Sigil will prompt you to confirm opening or saving if automatic cleaning is enabled.

If you open an invalid EPUB without automatic clean on Open, then a list of the invalid files will be displayed.

When cleaning, use this type

You can set the following levels of cleaning:

Pretty Print Tidy: The HTML Tidy software will be used to format your code to make it easier to read, and it will convert your code to valid EPUB 2 XHTML (although some EPUB 3 features are allowed). For instance it will close tags that are opened but not closed. This is the recommended option for most users.

HTML Tidy: The HTML Tidy software will be used to clean your code – this will include Pretty Print Tidy plus converting some of your tags into styles and some of your styles into an internal stylesheet.

The ability to disable automatic clean on Save means you can save an invalid EPUB as is so you can continue working on it later. Make sure you disable Clean on Open as well.

Keyboard Shortcuts

You can view all the keyboard shortcuts assigned to functions in Sigil – and change them to what you prefer. So if you want F12 to always open Find & Replace then you can change it here.

You can also assign or re-assign a shortcut temporarily if you need a function to be easier to access for a short time.

To set or change a shortcut:

Select the entry from the list.

Click in the Shortcut text box.

Type the key you want to use – do not spell it out using letters, just press the key sequence.

Click on Assign to set the shortcut (if there is a conflict with another entry you will see a message).

You can also click on Remove to remove the shortcut – this will remove any shortcut for this entry.

Use Reset All to change all shortcuts back to their defaults.

Use the Filter text box to easily search for shortcuts.

Language

You can set the language of Sigil’s interface and the default language of your book:

User Interface Language

Sigil’s user interface has been translated into many languages:

You can select from the available languages using this option. If a translation is not available for specific words then they will be shown in English.

You must restart Sigil in order for the new user interface language to take effect.

Try setting the interface to another language and restarting Sigil to see the translations volunteers have created.

Default Language For Metadata

This option sets the language that will be selected in the Metadata Editor for new books or books that do not already have a language set.

Spellcheck Dictionaries

Sigil supports spell checking in Code View, and allows you to choose standard and personal user dictionaries:

Highlight Misspelled Words

Enabling this option will highlight misspelled words in Code View with a red wavy underline. You will then be able to right-click on the word to select a suggested correction or add it to a dictionary.

Dictionary

Sigil includes several standard dictionaries: US English, British English, French, German, Spanish. You can select one using the Dictionary drop-down menu.

If you want to add new standard dictionaries (which must be in the hunspell format) then you can click on the button Open Preferences Location and go into the "hunspell_dictionaries" directory. Put your new dictionary files into the "hunspell_dictionaries" directory.

To add other standard dictionaries, such as ones found at the OpenOffice Dictionaries site, download, extract, and copy the files, e.g. en_GB.aff, en_GB.dic, hyph_en_GB.dic to the "hunspell_dictionaries" directory location and restart Sigil.

User Dictionaries

You can create your own personal user dictionaries, and even use different ones for different books and different types of words (Places, Names, etc.).

If you have not created any user dictionaries, Sigil will create and enable a "default" user dictionary for you, which you can rename or delete.

To create a new user dictionary, select Add under User Dictionaries on the left and then enter a name for your new dictionary:

When you select a user dictionary on the left, you will see the words for that dictionary on the right which you can then add, edit, or remove.

To add words directly to a user dictionary, select the dictionary and then click on Add on the right. You can then type in as many words as you want or paste them in from a file – words can be separated by commas, spaces, or listed one per line.

You can also add words to a dictionary using Spellcheck, or by right-clicking on misspelled words in Code View and selecting one of the Add To Dictionary options.

Selecting a dictionary makes it the default dictionary – this is used when you add words using the Add Misspelled Word shortcut or the menu item Add To Default Dictionary.

You can copy a complete dictionary using Copy, and then rename it as needed.

You can select which user dictionaries are enabled by marking the checkbox next to the dictionary’s name. All enabled dictionaries will be used when checking words to see if they are misspelled.

You can enable more than one dictionary at a time.

Open Preferences Location

The Open Preferences Location button on all the Preferences screens can be used to open the directory containing all of your preference files. You can copy the files for backup or for sharing with others.

The preferences location will likely be in the following locations:

Windows:

…\Local Settings\Application Data\sigil-ebook\sigil

MAC:

~/Library/Application\ Support/sigil-ebook/sigil/

Linux:

$HOME/.local/share/sigil-ebook/sigil

And the files you are likely to see will include:

hunspell_dictionaries: Where any standard dictionaries you add are stored.

sigil_index.ini: Your Index entries.

sigil_searches.ini: Your Saved Searches.

sigil_clips.ini: Your saved Clips.

sigil.ini: General configuration information for Sigil.

user_dictionaries: Where any personal user dictionaries are stored.

Opening and Saving Files

— Load and Save Your Books —

Sigil supports opening EPUB files and reading HTML and text files. When Sigil saves your book it saves in the EPUB format: the EPUB file will contain all of your HTML files, images, stylesheets, fonts, etc. zipped up into one file.

Save early, save often, and make backup copies!

Always close Sigil before you open your EPUB in another program – or the other program will lock the file and prevent you from saving in Sigil.

Opening and Adding Documents

Open Files

To open a file, click the Open button , or select the menu item File→Open or its keyboard shortcut then choose the file you want to open:

EPUB Files

Everything in the EPUB file is loaded automatically: HTML files, images, stylesheets, metadata, etc..

Sigil will organise your files into standard folders as shown in the Book Browser.

If the EPUB contains common errors Sigil will try to correct them.

Depending on your preferences, Sigil will format or clean the HTML files.

If the EPUB still contains invalid HTML files after cleaning, Sigil will still load the file and report the errors that need to be fixed.

HTML Files

The HTML file and any linked files and stylesheets are imported if possible and placed into the appropriate folders.

The metadata in the HTML file will be loaded into the metadata for the book.

Depending on your preferences, Sigil will format or clean the files.

If the HTML file is still invalid after cleaning, Sigil will report the error but may not load the file. You may have to fix the errors outside of Sigil.

Text Files

The text file will be converted to HTML. Paragraphs must be separated by blank lines to have them split into separate paragraphs.

Add Files

Add files to your EPUB by clicking the Add Existing Files button , selecting the menu item File→Add→Existing Files, or right-clicking on a file in the Book Browser and choose Add Existing Files:

HTML Files

Metadata is not loaded from the file (unlike when you use Open).

Sigil will attempt to load files that are referenced.

Files will be placed into their appropriate folder.

Image Files

Files will be placed into the Images folder.

Video Files

Files will be placed into the Video folder.

Audio Files

Files will be placed into the Audio folder.

Stylesheet Files

Files will be placed into the Styles folder.

Font Files

Files will be placed into the Fonts folder.

Other Files

All other files will be placed in the Misc folder as they are not usually used in an EPUB, although certain text files in the Misc folder can be edited in Sigil.

Add Blank Files

You can also create new empty files in Sigil. Select the menu item File→Add and choose from blank HTML page, blank CSS stylesheet, or blank SVG image (a special image format). You can also do this using this Book Browser, or even add a keyboard shortcut in Preferences.

Saving Your EPUB

Save your book by clicking the Save button , or selecting the menu item File→Save or its shortcut. You should always save your document before doing major edits in case you want to undo them.

Your saved EPUB file contains all the files that make up your book – your text, images, stylesheets, embedded fonts, table of contents, metadata, etc.

If you edit any text in your document, an asterisk ( * ) is added to the file’s name in the titlebar.

When you save your book Sigil will check it for certain errors and warn you if you need to fix anything. But you should always run Validate EPUB with FlightCrew to check for typical EPUB issues.

Sigil will not always be able to save an EPUB that contains errors, so frequent saves will make it easier to identify if there are errors that you need to correct.

Sigil will also clean your source code according to your preferences when saving the file.

Save a Copy

You can select File→Save A Copy to save a copy of your EPUB to a different filename. The difference between Save or Save As is that the current book you are working on is not renamed. So you can use this feature to save your EPUB without changing the name of your book or the directory you save files to.

Use File→Save A Copy for quick backups.

Saving Individual Files

You can also right-click on a file name in the Book Browser and select Save As from the context menu. You can then name and save the specific file to a directory on your computer. If you select more than one file, all files will be saved to your chosen directory. This is a quick way to share a specific file with someone without sharing the EPUB, or to create a template file you can use for other books.

Book View

— WYSIWYG Editing —

Book View (or WYSIWYG mode – what you see is what you get) is one of two ways you can edit your book in Sigil. Book View is how most people edit their book when they start to use Sigil since it is the closest to a standard word processor. Its a good way to make basic changes to your book when you aren’t too concerned about the underlying HTML code. However, when you want more control over the format of your EPUB or to use Sigil’s advanced features then you can use Code View.

Book View is only an approximation of what your book will look like – you need to test your book on your target ereaders.

Switch to Book View by clicking the Book View button , selecting the menu item View→Book View or its keyboard shortcut:

As you can see, the text and images are displayed on the screen as they would be on your ereader. You can edit, delete or add any text you want in the editor.

When you apply formatting in Book View, Sigil will do its best to apply the formatting you intended. However, in some cases it may not look exactly as you want. You can undo the change, and then try to re-format the text. But if you want to make sure the formatting is exactly the way you want it, you will need to use Code View. You can switch between Book View and Code View at any time since they are just two views of the same page. Your current paragraph position will be remembered.

You can toggle between Book View and Code View by using the keyboard shortcut F2 or by double-clicking on the current tab’s name.

Certain features in Sigil are only available in Code View. For instance Spellchecking and the Search Editor can only be used in Code View, and Find & Replace will automatically switch you to Code View if you try to replace text, or do a find across all HTML files.

Formatting

All of the buttons on the formatting toolbar are available for you to use.

Context Menu

The Book View right-click context menu includes a number of useful features.

Right-click on an image to see these options:

Open Tab For "imagename": Open the image tab for the image.

Open With: Open the image in an External Editor.

Save As: Save the image to a selected location on your computer.

Copy Image: Copy the image so you can paste it into another application.

Right-click on text to see options for:

Clips: Any Clips you have defined will be available here.

Add To Clips: Add the selected text to your Clips.

Insert File: Insert image, video, or audio files into your page from your book or computer.

Inspect Element: Open the Preview window if not opened so you can use right-click in Preview to select Inspect Element to see how styles are applied to your text.

The standard text menu items are also available:

Undo

Redo

Cut

Copy

Paste

Select All

Code View

— Direct HTML Editing —

Code View allows you to directly edit the HTML code included in your EPUB and is the most common way to edit files for advanced users.

Switch to Code View by clicking the Code View button , selecting the menu item View→Code View or its keyboard shortcut:

You can toggle between Book View and Code View by using the keyboard shortcut F2 or by double-clicking on the current tab’s name.

You can also use the Preview window to display a read-only book view version of the page you are editing in Code View.

Code View is very powerful, but you must be careful when editing it to ensure you enter valid HTML code.

When switching from Code View to Book View or saving your file, Sigil will check if your code has any major errors. If there are any errors you will be prompted to correct them Manually or Automatically. You should usually choose Manually to fix the issue to avoid any chance of the Automatic correction deleting text.

In addition to displaying your HTML code exactly as it is in your EPUB, Code View highlights tags and elements in colors to make it easier to read and identify issues.

You can change the colors used for highlighting in Code View using Preferences.

Formatting

All of the buttons on the formatting toolbar are available for you to use.

Context Menu

Right-click on text to see a context menu which includes the following options:

Clips: Select from any text Clips you have defined.

Add To Clips: Save the selected text to your Clips.

Go To Link Or Style: Same as Search→Go to Link or Style.

Mark Selected Text: Same as Search→Mark Selected Text. May also show Unmark Marked Text.

Reformat HTML:

Clean Source: Clean the current file using your preferences.

Clean Source – All HTML Files: Clean all HTML files using your preferences.

To Valid HTML: Modify the current file to make it valid HTML if they aren’t already.

To Valid HTML – All HTML Files: Modify all HTML files to make them valid HTML if they aren’t already.

Right-click on a misspelled word to see these options:

suggestions: Select from suggested alternatives.

Add To Default Dictionary: Save the word to the default dictionary selected in Preferences.

Add To Dictionary: Save the word to the dictionary you select from the submenu.

Ignore: Skip spell checking this word until Sigil is restarted.

Right-click on an image to see these options:

View Image: Displays the image in a resizable window. You can also Ctrl Click on the filename or use the Go To Link Or Style shortcut. View Image will resize the image to fit the window, and can remain open while you edit.

Open Tab For Image: Opens the image file in a tab at full resolution.

Plus the usual options:

Undo

Redo

Cut

Copy

Paste

Delete

Select All

Preview

— Show Code View Changes —

Preview is a movable window that gives you a dynamically updated read-only view of what appears in Code View. It is the same view as Book View but it can be displayed at the same time you edit in Code View. You can also inspect your code and styles in a small window at the bottom (or hide the window).

You can use Preview to show the results of changes in your code (including immediate feedback of errors), and you can also open a CSS stylesheet to make changes that are shown in Preview.

Activate the Preview window by selecting the menu item View→Preview or its keyboard shortcut:

You can toggle the Preview window open or closed with its shortcut, and even move the window to a second monitor if you have one.

The Preview window will be updated immediately when you click somewhere in Code View or Book View. It will also be updated after you stop typing for a short time.

If you click in Preview the Code View or Book View tab will sync to the same location.

Context Menu

The Preview context menu includes one very useful feature:

Right-click on a heading, paragraph, or any area of the screen to see this option:

Inspect Element: Show details for this text in the Inspector window.

Inspector Window

The Inspector Window is the small window at the bottom of the Preview page. You can re-size this window by selecting the bar that divides the two windows and moving it to the size you want, including hiding it.

The Inspector window is an HTML developer’s tool that allows detailed examination of the code behind the book’s appearance. It is intended to allow you to see why specific sections of your book are displayed the way they are, and to make temporary changes to styles and text to see how they affect your text.

Any changes you make in the Inspector window are only temporary and are not saved!

The Inspector is basically the Chrome web developer toolset and you can find more information about it from their documentation. Not all the information applies to Sigil since the software is meant for general web page inspection. Scroll down to the Developer Window section to see what functions are available:

Inspector for Chrome Developer Tools

The easiest way to use the Inspector is to right-click on the text you are interested in the top window and select Inspect Element.

The other way to use the Inspector is to click on the magnifying glass at the bottom of the Inspector then scroll the preview area to the text of your book that you want to inspect and click on it. The inspector pane will scroll to the related section of code, allowing you to view various details about the text.

You can then make temporary modifications to the styles used by the text to test out changes. Changes to styles are reflected immediately in the Preview area, but if you edit any text you may need to click in the Preview area to refresh it. You can then update your CSS stylesheets to include any changes you decide to keep.

If you click on an area in the inspector section, the preview area will not sync as you might expect.

CSS Stylesheet Preview

You can see how changes in your CSS stylesheets affect your text immediately in Preview.

To use this feature, open an HTML page and open Preview. Then open your CSS Stylesheet.

As you edit your styles in the stylesheet the changes will be reflected in your HTML file in Preview after you stop typing for a second.

Book Browser

— Managing files in Your EPUB—

All of the files that make up your EPUB can be accessed using the Book Browser. Your text files, images, as well as any fonts or stylesheets or other files, are organised into folders – allowing easy access to open and edit them with a double-click, or to right-click on them to perform actions.

The Book Browser is usually open, but you can open it by selecting the menu item View→Book Browser:

Double-clicking a file will open it in a tab in the editing window.

Right-clicking on a file name displays a context menu of options.

Folders & Files

The Book Browser organises your files into several folders which can be expanded or collapsed by clicking on the little arrow or plus icon to the left of the folder’s name or double-clicking on the folder name. The folders and files include:

Text: The XHTML, HTML, XML, HTM files that make up the text of the book.

Styles: The CSS stylesheets that control the formatting of the book.

Images: The PNG, JPG, GIF, SVG image files in the book.

Fonts: The TTF and OTF embedded fonts that might be in the book.

Audio: The MP3, AAC, MPG, MPEG, M4A embedded audio files that might be in the book.

Video: The MP4, OGG, WEBM, M4V embedded video files that might be in the book.

Misc: Other files, which are not typically used by EPUB readers even though they can be stored with the book.

toc.ncx: The file containing the table of contents of the book.

content.opf: The file containing the list of files in the book.

To open a file just double-click the file name. If the file was not already open in a tab, a new tab will be created for it. If it was already open in a tab the view will switch to the tab containing the file.

If you change tabs, the Book Browser will select the file used by the tab.

The tooltip for each folder name shows the number of files in the folder. The tooltip for each file shows the full file name and any guide semantic types it has.

Selecting Multiple Files

You can select multiple files in the Book Browser by clicking on one entry, and then holding the Shift key while clicking another entry to select all entries between and including the two entries. Hold down the Ctrl key while clicking to add individual files to your selection. You can also use the right-click context menu entry Select All to select all entries easily. Once you have selected your files you can then use the right-click context menu to perform actions on all the selected files.

You can only select multiple items within the same folder.

Re-Ordering Files

The order of the files in the Text folder is important since it is the order in which the files will be displayed to readers.

You can drag a file in the Text folder and move it up or down if you need to re-arrange the order in which the chapters or files appear in your book.

You can also use the context menu to rename or re-sort the files.

All other folders are automatically sorted alphabetically and cannot be re-arranged – the order of their files does not affect how your book is displayed.

Context Menu

Right-clicking on one or more items in the Book Browser brings up a context menu with relevant actions:

The following sections describe the available context menu actions.

Delete

Delete the selected files. You cannot delete the last remaining HTML file.

You will be prompted to confirm you want to delete the files since the action cannot be undone.

Remember to update or regenerate the Table of Contents if your file was included in the TOC.

Rename

If you select a single file to rename, then the name of the file is highlighted so that you can type in its new name. By default the extension is not highlighted to make renaming easier, but you can also change the extension if necessary.

If you select multiple files, then a new dialog is displayed asking you how you want to rename the files:

Enter the name the first file should have, including numbers at the end of the name. Sigil will then name each of your files sequentially using the name you provided and starting at the number you provided. A file will not be renamed if it would result in the book having duplicate file names. You can also rename the extension.

For example:

Chapter 1

Will rename the files to: Chapter 1, Chapter 2, Chapter 3 … but will not change the file extension.

Section_0099

Will rename the files to: Section_0099, Section 0100, Section_0101 ….

Part 2 – Section 08

Will rename the files to: Part 2 – Section 08, Part 2 – Section 09, Part 2 – Section 10 ….

.xhtml

Will rename only the file extension of all files to: .xhtml.

Section_0099.xhtml

Will rename the files to: Section_0099.xhtml, Section 0100.xhtml, Section_0101.xhtml ….

When you rename a file, any links pointing to the file in your EPUB will be updated.

Merge

If you select a single HTML file, then the file will be merged into the previous HTML file in the list.

If you select multiple HTML files, then all files will be merged into the first HTML file you selected.

You can also use the Merge keyboard shortcut. See the Splitting and Merging chapter for more details.

Sort

Sort the selected HTML files alpha-numerically. This means filenames containing numbers will be sorted in their expected numerical order, e.g. “1 3 2 10” will be resorted as “1 2 3 10” instead of the default “1 10 2 3”.

Link Stylesheets

Link Stylesheets to the selected HTML files. Choose the stylesheets to link from the dialog window – only stylesheets marked with a checkmark will be linked, others will be unlinked from the HTML file.

When the dialog is first opened a checkmark is shown against stylesheets only if all selected files are linked to that stylesheet.

Stylesheets are applied in the order listed when the document is rendered.

Add Semantics

This sub-menu allows you to designate the semantic "type" for selected files. EPUB ereaders may use this information (stored in the content.opf file) to guide them in how to present these files to readers.

For Image files, the only option is Cover – to indicate that this image is the cover image of the book.

For HTML files you can select from any of the following options – but each file can have only one type:

Cover

TitlePage

Table Of Contents

Index

Glossary

Acknowledgements

Bibliography

Colophon

Copyright Page

Dedication

Epigraph

Foreword

List Of Illustrations

List Of Tables

Notes

Preface

Text

Text should be used to indicate the page of the book that should be shown when the book is first opened, but not all ereaders follow this convention.

Open With

Opens a dialog window to allow you to choose an external application to edit this file.

See the External Editors chapter for more details.

Save As

Allows you to save the selected files to your computer in case you need to access them outside of the EPUB.

Add Blank HTML File/Stylesheet/SVG Image

Adds a blank HTML document, CSS Stylesheet, or SVG Image file to the folder. For HTML it will add just below the file you right-clicked on, or at the bottom of the folder if you right-clicked on the folder name. For other folders it will add them in alphabetical order.

This is the same as the main menu item File→Add.

The new file will be numbered with the lowest available number starting from 0001 (e.g. Section0001.html), and you can then rename it.

Add Copy

Creates a copy of the HTML file you clicked on and adds it to the folder.

Add Existing Files

Opens a dialog window to allow you to choose one or more files from your computer to add to your EPUB.

Files will be added to the appropriate folder based on their file extension regardless of what file you right-clicked on.

This is the same as the main menu item File→Add→Existing Files and the Add Existing toolbar button.

Select All

A quick way to select all of the files in the current folder so you can rename, link, etc. all of them at once.

Font Obfuscation

If you are using custom fonts in your ebook, then this Font folder sub-menu allows you to define how the embedded fonts are stored in the EPUB. Normally when fonts are added to the EPUB the fonts are stored in a readable form. In some cases you may not want to make the fonts available for the readers to access directly. In these cases you can obfuscate or scramble the fonts in the ebook so that readers cannot access the fonts, but the fonts will still be useable by EPUB ereaders. The details of obfuscation and its implications are beyond the scope of this guide, but there are many references to it on the web.

The options are:

None

Use Adobe’s Method

Use IDPF’s Method

The method will have a checkmark next to it if all selected fonts use that method.

Renumber TOC Entries

An advanced feature that sequentially renumbers the playOrder and navPoint id numbers of the Table of Content entries in the toc.ncx file starting from 1. This feature is intended to clean up the TOC numbering if you have to manually add or delete an entry in the TOC.

You can also use the Edit TOC feature – just saving the TOC will renumber the ids.

Any navList or pageList items in the file are not saved – only the Table of Contents entries are saved after renumbering.

Metadata

— Edit details about your book —

The Metadata Editor allows you to add or edit details about your book – like Author, Title and Language, as well as hundreds of other entries defined by the EPUB standard.

Edit your book details by clicking the Metadata Editor button , or selecting the menu item Tools→Metadata Editor or its keyboard shortcut:

All of the details about the book (called metadata) are stored in the contents.opf file in the EPUB. You can edit this information manually, but the Metadata Editor allows you to edit it more easily.

Required Details

The Metadata Editor shows the 3 fields required for an EPUB at the top – you must fill these in in order to create a valid EPUB:

Title: The title of the book.

Author: The author of the book, usually in the form of "Firstname Lastname". You can add more authors using the fields below.

Language: The language the book is written in.

You can use the optional File-As field to list the author’s name for sorting purposes, usually of the form "Lastname, Firstname".

Optional Details

You can add optional details using the Add Basic or Add Role buttons. These will be added to the table below the required fields. The table allows you to provide the following values for each entry:

Name: The name of the field.

Value: The contents of the field.

File As: Some fields like author can or date have alternative values that are used for sorting, etc..

Role Type: All roles, like author, can be either a creator or contributor.

The Add Basic metadata items include about 30 items such as:

Date: Publication

Date: Creation

Date (custom): You can enter your own date type in the "File As" column.

Identifier: ISBN number.

Identifier (custom): You can enter your own identifier type in the "File As" column.

Rights: Copyright information such as Copyright 2012 An Author.

The Add Role metadata contains hundreds of possible activities that people may have performed in the creation of this book such as Authors, Editor, Proofreader, etc.:

You can add the same type of field multiple times.

You can copy an entry by selecting it and clicking the Copy button. You can then modify it as needed.

You can re-arrange the order of the entries (which may affect how ereaders display the information) by selecting the entries and clicking on the Up or Down buttons.

Add Cover

— Pick a cover for your book —

The Add Cover feature allows you to pick an image for your cover and have Sigil automatically make the necessary updates to mark the image as your cover.

Add a cover by selecting the menu item Search→Add Cover or its keyboard shortcut:

You can pick an image in your epub, or use Other Files to pick one from your computer.

Details

Sigil makes the following changes when you add a cover:

Creates a cover.xhtml file if one does not exist. If it does exist, it will use the file. If another file with a semantic of Cover exists, it will use that file.

Inserts the necessary HTML code to display and resize your image into the HTML file.

Marks the HTML cover file with the semantic of Cover.

Marks the image file with the semantic of Cover.

Custom HTML Cover File

Sigil inserts code in the HTML cover file that allows your cover to be re-sized and displayed on most ereaders, but you may want to use different code. You can edit the code after the file is created, or provide your own code for Sigil to use.

This is the HTML code Sigil inserts into the cover file by default:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>Cover</title>
</head>

<body>
  <div style="text-align: center; padding: 0pt; margin: 0pt;">
    <svg xmlns="http://www.w3.org/2000/svg" height="100%"
    preserveAspectRatio="xMidYMid meet" version="1.1"
    viewBox="0 0 SGC_IMAGE_WIDTH SGC_IMAGE_HEIGHT" width="100%"
    xmlns:xlink="http://www.w3.org/1999/xlink">
      <image width="SGC_IMAGE_WIDTH" height="SGC_IMAGE_HEIGHT"
      xlink:href="SGC_IMAGE_FILENAME"/>
    </svg>
  </div>
</body>
</html>

To modify the template Sigil uses for the HTML cover file, create a file in your Preferences directory called cover.xhtml

You can use certain placeholders in your text and Sigil will replace them with the appropriate values:

SGC_IMAGE_FILENAME: this will be replaced by the path to the image in your EPUB.

SGC_IMAGE_WIDTH: this will be replaced by the width in pixels of your image.

SGC_IMAGE_HEIGHT: this will be replaced by the height in pixels of your image.

Table of Contents

— A Map Of Your Book —

EPUB supports a Table of Contents (abbreviated as TOC) to help readers navigate their way around your book. Typically EPUB ereaders provide a button or menu item to open the TOC.

Sigil provides several ways to work with a TOC. The Table of Contents window in Sigil gives you a dynamic view of your TOC – you can view exactly what your TOC looks like, and select entries to jump to. The Generate TOC function can create a new TOC based on the headings in your document. The Edit TOC function allows you to update an existing TOC when you can’t or don’t want to use Generate TOC. And Create HTML TOC can create a new HTML page in your document showing what is in the EPUB TOC.

View the TOC

To open the TOC window if it isn’t already open select the menu item View→Table of Contents:

You can single-click on an entry to jump to its location in the book, and expand or collapse entries by clicking on the icons to the left of the chapter names if there are sub-chapters.

Use the right-click context menu to select Collapse All or Expand All to quickly show or hide sub-chapters.

An EPUB Table of Contents is stored in the toc.ncx file listed in the Book Browser.

Generate Table of Contents

In order to create a Table of Contents automatically you first need to define the headings or chapters in your book.

In Book View you can create the your headings by selecting the text you want to make into a heading, and then selecting the level of the heading you want from the Format→Heading menu, or more easily using the buttons on the toolbar, in Book View or Code View:

If your chapter names do not use heading tags (h1, h2, etc.) as described above, then you will not be able to generate a TOC automatically.

Start your TOC generation by clicking the Generate Table of Contents button generate-toc_22px, or selecting the menu item Tools→Table Of Contents→Generate Table Of Contents then select the headings you want included in the book’s Table of Contents:

Check any name that you want to be included in the Table of Contents, and uncheck any entry that you don’t want included.

When you use Generate Table Of Contents Sigil will update not only your TOC, but also your HTML documents – to make sure that the information you enter can be used again when you next generate the TOC.

You can use the Show TOC Items Only checkbox to show or hide entries that will not be included in the TOC. This does not affect your TOC, only what you see in the dialog. You can also use the Select headings to include in TOC drop-down menu to quickly select or unselect headings of a certain type, and then fine tune the selections manually.

You can rename the TOC entry by clicking Rename. This will also change your HTML code to set the "title" attribute of your heading.

You can change the level of your Headings using the left and right arrow keys. This will also change the level of the headings in your HTML code.

The tooltip for each title (just move your mouse over the title and leave it for a few seconds) will show you which file the heading is in and its HTML code.

The tooltip for the headings of table will show you the number of headings of each type:

When you select OK, Sigil will add or update automatically generated IDs to any headings you have selected if they don’t have regular IDs already. It will then create a new toc.ncx file containing links to your chapters. If your heading is "near" the beginning of your HTML file, Sigil will link directly to the file and not to the heading ID. This is because on some ereaders linking directly to an element slows down the display of the TOC.

Generating the TOC automatically will overwrite any existing TOC in the toc.ncx file.

Edit Table of Contents

If you can’t or don’t want to generate the TOC from the headings in the document, you can use Edit Table Of Contents to make changes to the existing TOC. Any changes made to the TOC will not affect your HTML files, and all changes would be lost if you use Generate TOC.

You can edit an entry by double-clicking on it. You can add new entries or delete existing ones. Use the arrows to increase or decrease the heading level of an entry.

To change what a TOC entry points to you can type in the target destination directly, or use the Insert Link button. This will open the Select Target dialog where you can choose which location to point the TOC entry to:

The right-click context menu allows you to delete or rename entries, or expand or collapse the list.

TOC entries must point to a valid target. If you just want a heading in the TOC, point it to the next valid entry.

Generate HTML Table of Contents

You can use the menu Tools→Table Of Contents→Generate HTML Table of Contents to create an Inline HTML TOC for your EPUB.

An inline TOC is just another HTML page in the EPUB that contains the Table of Contents in text format with links that can be used to jump to specific chapters.

For most EPUB ereaders, the TOC that is automatically generated from Generate Table Of Contents or stored in toc.ncx is used to display the TOC. However, there are times when an inline TOC is desired in an EPUB or when it is temporarily needed because the EPUB will be converted to another ebook format that does not use the EPUB TOC file.

The Generate HTML Table of Contents menu item will overwrite any existing HTML TOC file (if it has a semantic type of TOC). If no such file exists it will create an HTML file called TOC.xhtml and mark its semantic type as TOC. If TOC.xhtml already exists it will be replaced.

You can change the contents of the inline TOC once you’ve created it – but remember to do this each time you create the TOC.

Custom HTML TOC Stylesheet

The generated HTML TOC page uses a separate CSS file (sgc-toc.css) to format the TOC. If the file already exists in your book it will not be overwritten (so you can customise it without losing your changes). But if it does not exist, it will look for sgc-toc.css in your preferences directory and use that as the default file. If there is no file in your preferences directory, then Sigil will create a default stylesheet for the TOC.

Validation

— Making sure your EPUB is Error Free —

In order to be considered a valid EPUB, your ebook must meet the standards defined for EPUBs. This means it must include certain files and information and not contain any errors as defined by the EPUB specification. To help you check if your EPUB is valid you can use the following tools.

EPUB Validation With FlightCrew

Validate your EPUB with FlightCrew by clicking the Validate EPUB with FlightCrew button , or selecting the menu item Tools→Validate EPUB With FlightCrew:

FlightCrew is included as part of Sigil so it will simply display a new window underneath your editing window listing any issues that it finds. Once you have run Validate to produce a report, look at each of the issues listed and then edit your document to correct them.

You can double-click on most entries to be taken to the relevant part of the book.

You should validate your document each time you change it to verify there are no more errors.

Common Validation Issues:

Note that errors are highlighted in pink, and warnings are highlighted in yellow.

This resource is present in the OPF <manifest>, but it’s not reachable (it’s unused).

This warning means you have included the listed file in your EPUB, but you have not used it anywhere in your book. If you intended to use it, you should link to it, otherwise you can delete the file. Try to search all your files or toc.ncx for the filename – you should leave off the pathname when searching, e.g. if the error is in Text/Chapter1.html then just search for Chapter1.html

This OPS document is reachable but not present in the OPF <manifest or spine>. "Reachable" means that a reference of some kind that points to this resource exists in the epub.

This error means you have a reference or a link to a file or image in your EPUB, but that file is not included in the EPUB. You need to add the file to the EPUB or correct the name of the file used in your text. You can usually find these by searching for the filename listed in all the HTML files. You may also have to re-generate or update your TOC.

ID value 'SOMEIDNAME' is not unique

This error means you have an ID named SOMEIDNAME in your EPUB that is defined more than once. Typically these are in headers or footnotes and can be caused by copying and pasting or merging. You can find these by searching all HTML files for the ID name that is listed and changing them so all IDs are different from all other IDs. If the issue is in a heading and you have auto-generated your headings, you can delete the ID and they will be re-generated the next time you create your TOC.

attribute 'INVALIDATTRIBUTE' is not declared for element 'SOMEELEMENT'

This error means you have an HTML tag named SOMEELEMENT that contains an attribute INVALIDATTRIBUTE, but INVALIDATTRIBUTE is not valid for that tag. For instance <h2 invalidattribute="test">. This can be caused by typos or by old versions of HTML. You need to search for INVALIDATTRIBUTE in all HTML files and remove, correct, or replace each occurrence.

no declaration found for element 'INVALIDELEMENT'

This error means you have an HTML tag named INVALIDELEMENT that has not been defined. Typically this is simply because it is invalid and is old HTML syntax that need updating. You need to search for INVALIDELEMENT in all HTML files and remove, correct, or replace these with valid HTML.

element 'INVALIDELEMENT' is not allowed for content model '(p|d|h2|h3|h4|h5|h6|div|ul|ol|...'

This error means you have an HTML tag named INVALIDELEMENT that is not valid HTML for an EPUB. Typically this is old HTML syntax that needs updating (such as the <center> tag which should be implemented using a style). You need to search for INVALIDELEMENT in all HTML files and remove, correct, or replace each occurrence with valid HTML.

value 'SOMENAME' is invalid NCName

This error means you have an ID name that is invalid. It probably contains a space or other invalid character. You need to search for SOMENAME and change it.

CSS Validation With W3C

You can also easily validate your CSS Stylesheet files using the W3C website by selecting the menu item Tools→Validate Stylesheets With W3C.

This will send the contents of all of your stylesheets to the W3C service which will produce reports of any issues.

You can validate individual stylesheets by right-clicking on the stylesheet in the Book Browser and selecting the validate option.

Validation is done using CSS 2.1. This is close to but not exactly the version used by EPUB readers – so you should always check your styles on actual ereader devices.

EPUB Validation With EpubCheck

FlightCrew identifies most issues with EPUBs, but it may not catch everything.

As an additional check you should also run your EPUB through the EpubCheck program. You can use it online or download a local version of the program:

IDPF EPUB Validator

EPUB Validation With Devices

And in case you missed it: You should always test your EPUB on as many devices or programs as possible.

Spellcheck

— Checking and Correcting Spelling —

Sigil provides several ways to check your spelling – highlighting misspelled words, finding words one at a time, or showing all misspelled words at once. You can choose a standard dictionary to use, and create personal user dictionaries with your own words.

Spellcheck uses Code View to show misspelled words.

Configure Spellchecking

You can set the spell checking preferences that you want – including which main dictionary to use, and which personal user dictionaries to use if any. You can setup user dictionaries for different types of books or individual books, or use only the default user dictionary. You can change user dictionaries at any time.

Set up your dictionaries in Preferences.

Automatic Spellchecking

Code View will highlight any misspelled words with a wavy red underline when automatic spell checking is enabled in Preferences or using Tools→Spellcheck→Highlight Misspelled Words:

You can then right-click on the misspelled word to bring up a list of choices:

Suggested Words: A list of alternative words to choose from – selecting one will replace the misspelled word.

Add To Default Dictionary: Add this word to your current default user dictionary.

Add To Dictionary: Add this word to the dictionary you select from the list.

Ignore: Ignores the spelling of this word in the entire document until you restart Sigil.

Finding Misspelled Words

Find the next misspelled word in Code View by selecting the menu item Tools→Spellcheck→Find Next Misspelled Word or using its shortcut. You will be switched to Code View automatically if you are not in it already, and the next misspelled word will be highlighted each time you search for the next word.

In order to be able to right-click on the misspelled word to select a suggested word or add it to the dictionary you must have Tools→Spellcheck→Highlight Misspelled Words enabled.

Spellcheck

To open the Spellcheck dialog, click the Spellcheck button , or use the menu item Tools→Spellcheck→Spellcheck.

Words are shown with the number of times they occur in the book and if they are misspelled. Select a word to perform an action.

Selecting a word will also show the first occurrence of the word in Code View so you can view its context and change just the one occurrence if needed.

Double-click a selected word to find the next occurrence of the word.

You can add words to a dictionary by clicking Add to Dictionary. Select your user dictionary to add the word to from the dropdown list:

To Ignore words, click Ignore. The Misspelled Word column will update to "No" only if you have enabled the dictionary to be used in Preferences. To clear all ignored words use Tools→Spellcheck→Clear Ignored Words. Ignored words are also cleared when you open a new book.

To correct the spelling of words, select one of the suggested words from the dropdown below click Change Selected Word To: or type your own word in the box. Then click Change Selected Word To:. This will change every occurrence of the selected word to the new word. It will also automatically refresh the list of words from the HTML files.

You can see all words in your EPUB by selecting Show All Words. In addition, the tooltip for the column names shows the number of words in your EPUB:

If you enable Case-Insensitive Sort then the words will be sorted as AaBbCc instead of ABCabc.

Use the Refresh button if you edit your book while Spellcheck is open. You do not need to use it if you are just ignoring, adding, or changing a word.

Images, Video, Audio

— Inserting Media Files into your book —

You can insert any image, video, or audio file into your book clicking the Insert File button or selecting the menu item Insert→File or its shortcut. If the file has not already been added to your EPUB, you can select it from your computer.

EPUB 2 and most e-ink readers only support images, but the ability to insert video and audio is available if needed.

When you insert a media file into your book, it is first added to the EPUB and then a link to it is created. This allows you to add a file once and then link to it many times, or to add lots of files at one time and then later create links to them.

Adding Media Files to Your EPUB

You can add image, video, or audio files to your book in several ways:

Click the Add Existing Files button .

Select the menu item File→Add→Existing Files.

Right-click on a file in the Book Browser and select Add Existing Files.

All of these will display a standard file dialog allowing you to select one or more files from your computer. Select as many media files as you want. If any of the files already exists in the book, you will be prompted to confirm if you want to replace them.

The files will be added to the appropriate folder in the Book Browser based on their file extension. However, they are not yet actually used anywhere in your book – they are just available to use. To use them, you need to link to or insert them in your book.

You can actually add files to your book and insert them in one step:

Click the Insert File button and then click on Other Files.

Right-click in your document in Book View and select Insert File and then click on Other Files.

Select the menu item Insert→File and then click on Other Files.

Inserting Files Into Your Book

To insert an image, video, or audio file into your book click on the location in your file where you want the image to be located (in either Book View or Code View). Then click the Insert File button :

A list of the files in your book is displayed. Select one or more files to insert and click OK, or double-click on the file you want in order to select and insert it automatically.

You can choose files from your computer instead of from the EPUB by clicking on the Other Files button. Files will be added to your book and then inserted automatically.

You can filter which files are shown by selecting the type of file on the left, or entering part of the filename in the Filter text box.

You can enable thumbnails for images in the Insert File dialog by clicking on the zoom buttons on the lower left to choose the size of the thumbnails. The dialog is slower with thumbnails so you can remove them by making them smaller until they are gone.

You can also right-click in Book View where you want the image and choose Insert File from the context menu.

View File Details

To view details for an image, video or audio file double-click on its filename in the Book Browser or right-click on it in Book View and select Open Tab For….

For an image, the Width and Height in pixels, size of the file in kilobytes, and whether or not the image has any color defined are shown:

Editing Media Files

Sigil allows you to easily edit an image, video, or audio file once it is in your EPUB.

Simply right-click on the image in Book View, or right-click on its filename in the Book Browser, and select the menu item Open With. This will open the file in the external editor of your choice.

See the External Editors chapter for details.

Deleting Unused Media Files

You can select the menu item Tools→Delete Unused Media Files to automatically delete any unused image, video, or audio files. Sigil will present you a list of files that do not have any links to them from your HTML or CSS files and then allow you to confirm which files to delete – or to cancel deleting them.

For more control over deleting individual files, you can use a report to view the number of times a file is used and then delete the ones you want – see the Reports chapter.

You can double-click on a file to show that file in a tab.

Cover Images

You can quickly add a cover image using Add Cover.

But if you want to add a cover manually, then be aware that images for covers are special in that you must tell the EPUB which image should be used for the cover. Different ereaders use different methods to identify the cover, so you should use both methods:

Create a cover.html file at the start of your book and then insert your image into it.

Mark the cover.html file as a cover file by right-clicking on it in the Book Browser Text folder, selecting Add Semantics and choosing Cover.

Mark your actual cover image file as a Cover by right-clicking on it’s file in the Book Browser Images folder, selecting Add Semantics and choosing Cover.

Please make sure you have permission to use any images in your book as most images are copyrighted and their use may require a license.

Special Characters

— Insert Special Characters —

You can insert characters that might not be on your keyboard into your document using the Special Characters dialog.

To insert special characters click the Insert Special Character button , or select the menu item Insert→Special Characters.

The dialog will stay open to allow you to insert text multiple times, and you can move the window to any position on the screen you want.

You can use Ctrl-click to select and insert the character and close the dialog window immediately.

If you pause over a character you will see a tooltip listing the HTML entity code for the character and a description:

You can change the font and size of the characters in the dialog using Preferences.

Some characters may not display correctly in some fonts.

You can also create a Clip button and shortcut for special characters you use often.

Splitting and Merging

— Working with Chapters and Files —

An EPUB can consist of one large HTML file with all of your text, or multiple files each containing part of your book. In most EPUBs each main Chapter is stored in its own HTML file in the EPUB. This isn’t required, but it makes it easier to work with the book and can make reading and editing quicker since the files are smaller. All of your files can be accessed using the Book Browser.

If you have loaded an HTML file into Sigil and want to divide it into separate files, then you can use Sigil’s Split functions. And if you have several smaller files that you want to combine into a larger file, then you can use the Merge function.

Most ereaders start each new HTML file on a new page – giving you automatic page breaks between chapters if you split your Chapters into separate files.

Split One File

You can split a file into 2 files at your cursor position immediately by clicking the Split At Cursor button or selecting the menu item Edit→Split At Cursor.

This is the easiest way to split a single file. Simply click in your document exactly where you want the file to be split, e.g. at the beginning of a chapter name:

Then click to split the file:

Everything from the beginning of the original file up to the point where you clicked is kept in the first file, and everything after the point you clicked on is put into a new file. Note that the first file kept its name, and a new file with a new name was created to hold the second file. You can rename and edit the files as necessary.

Split Multiple Files

If you want to split several files or a large file into many files, then you can use the file marking approach.

1. Scroll through your file, and wherever you want a new chapter to start click in the document to set your cursor position. Then select the menu item Insert→Split Marker or its shortcut. This will insert code into your document telling Sigil to remember that you want a new chapter to begin here – you will see a horizontal line in Book View exactly where you inserted the marker:

2. When you have marked all your chapters, use Edit→Split At Markers. This will automatically split all of your files into as many files as you marked. If you decide not to split the file, you can delete the horizontal marker lines.

Once you have split your files you can rename them. And you can even Merge some or all of them together again.

You can use Find and Replace to insert split markers just before every chapter heading if you have a lot of chapters.

If you split a file, any header information is copied to the new file.

Merging Files

If you want to combine two or more files into one file, you can use Merge.

To Merge two adjacent files, right-click on the second file and then select the menu item Merge, or select the second file and use the Merge shortcut. The second file will be merged into the first file (the file above). You will not be prompted to confirm the merge.

To Merge more than two files, select all the files you want to merge, then right-click on the selection and choose Merge. You will be prompted to confirm the merge:

Once you confirm OK, your files will be combined into the first file.

Save your EPUB before Splitting or Merging!

Find & Replace

— Searching In Code View —

Finding text and updating it is one of the most common tasks in Sigil – to look for words, to remove unwanted text in one file, or to change the formatting of specific items in the entire book. In fact, if you ever need to make lots of changes to your text you will almost certainly want to use Find & Replace (and its related Saved Searches feature) since it allows you to quickly make a large number of edits across all your files.

See the Regex tutorial for information about advanced searching.

To open the Find & Replace dialog, select the menu item Search→Find & Replace or its keyboard shortcut:

Book View only supports finding text in the current file – all other actions will be done in Code View.

You can set various modes (Normal, Case-Sensitive, Regex, search some or all HTML files or just selected text, search down/up, etc.) and options (Wrap, DotAll, etc.) to modify the behaviour of the actions (find, replace, replace all, etc.) you select, e.g:

When open, the Find & Replace dialog is always positioned at the bottom of the editing window for easy access. You can use the buttons on the lower left to show or hide Options.

Keyboard shortcuts exist for all find and replace operations – such as Ctrl+G to find again. See the Search menu for a list of shortcuts.

Actions

The buttons on the right are used to run your search commands.

After you run a search, the text you entered in either the Find or Replace box is saved and is available for you to select later. Click the down-arrow to the right of the Find (or Replace) text box to show the list of items in the search histories.

Whenever you run a search, the results are shown in the Find & Replace status bar.

Find

Finds the next occurrence of your search term and highlights it.

To search for text, enter it in in the Find text box and press the Find button. Any text in the Replace box is ignored if you are just doing a Find.

If you select text in your document, you can use Ctrl+F to open Find & Replace window and your selected text will be placed in the Find box.

Replace

Replaces one occurrence of the text matched by Find.

Replaces are done in Code View so you must first run Find in Code View.

To replace text:

Enter the text to find in the Find box.

Enter the text you want to replace it with in Replace box.

Select Find to search for and highlight a match.

Select Replace to do the replacement.

To undo changes you can use the Undo button or right-click in the editing window and select Undo to change the text back. But if you are replacing across files and your next match is on a different page, you need to switch back to the file containing the replaced text before selecting undo.

Replace/Find

Replaces one occurrence of the next matched by Find and then runs Find automatically to highlight the next match.

To replace text, enter the old text in the Find box, and the new text in the Replace box. Then click Replace/Find.

The first time you do a Replace/Find the first match will be highlighted. Subsequent use of Replace/Find will replace the highlighted matched text and then automatically Find the next match.

You can safely use Replace/Find instead of Find if no text is selected since it will act just like Find until a match is highlighted.

Replace All

Replaces all text matching your search term with your replace term according to your settings. This is done all at once automatically.

You cannot undo a Replace All – save first!

Replace All always replaces from the start of a file.

Test your find and replace strings using Count All, or Replace a few times before using Replace All to avoid surprises.

Save your book before a Replace All and check it after the replace in case of issues.

Check if your mode is set for Current File or All HTML Files

Count All

Count All can be displayed using the Options button (see below) – or you can use its keyboard shortcut.

Count All displays a count of the number of times the search term you entered in the Find text box occurs in the selected files. It uses the settings of both the Up/Down modes and the Wrap option.

It's a good idea to use Count All before doing a replace to check the number of replacements are what you expect. And you should run it after a Replace All in case the particular search and replace created new matches.

Mode – What to Search

You can control what type of text to search for using these options.

Normal

This mode will search for exactly what you type except that it will ignore case, e.g. “A” and “a” will be considered the same letter.

Case Sensitive

This mode will search for exactly what you type.

Regex

Regex is an abbreviation of “Regular Expression”. This mode allows you to search for patterns instead of exact words or characters. Regex is very powerful and one of the main benefits of using Sigil to work with ebooks.

For instance, you can search for “Page [0-9]+” which will find "Page " followed by one or more numbers.

See the Regular Expressions chapter for more details about using regex.

Mode – Where to Search

You can control which files to search with these options making it easy to search all or just some of your files.

Current File

This restricts your search to just the file you are viewing. You can search HTML files and Style files.

If your search reaches the end of the file and wrap is on it will automatically wrap around and search from the other end of the file. You will see a small picture of an arrow flash on the screen to indicate the search wrapped around.

If you hold the Ctrl key down while clicking on an action you will be able to temporarily run the search only on the Current File.

All HTML Files

This searches in every HTML file. It does not search in every file – just every HTML file.

When a search reaches the end or beginning of the book it will automatically move to the next or previous file (in the order listed in the book browser), and it will loop around when all files have been searched if wrap is on.

Selected HTML Files

This searches only the HTML files that you selected in the Book Browser.

When a search reaches the end of a file it will automatically move to the next or previous selected file (in the order listed in the book browser), and it will loop around when all files have been searched if wrap is on.

Marked Text

This is a special option that is only shown when you mark text.

You can restrict your search to a selection of text by marking that text. To mark text, select some text in Code View and then use the Search→Mark Selected Text or use the right-click context menu to select Mark Selected Text.

Text can be unmarked by using the menu item again without a selection.

Text will be unmarked if you use Undo, type any text, or change views or tabs. If you just use Replace or Replace All, the marked text will be expanded or shrunk appropriately.

Mode – Search Direction

You can control the direction of searching with these options.

Up

Searches from your position in the document upwards and finds the previous occurrence of your search.

Down

Searches from your position in the document downwards and finds the next occurrence of your search.

Options

Find & Replace provides several options when using Regex mode.

Click the show button on the Find & Replace window to expand the window if it’s not already expanded to show the options and the button Count All:

Click the hide button to hide the options:

DotAll

This regex option prepends (?s) to all regex searches and is used when you want the ".*" pattern to match any character even across lines.

Minimal Match

This regex option prepends (?U) to all regex searches and is used when you want a pattern to match the shortest occurrence instead of the longest match.

Auto-Tokenise

When using Ctrl-F on selected text to add text to Find & Replace, this will convert spaces to \s and escape certain characters so they are suitable for regex.

Wrap

When enabled, searches in the Current File will automatically wrap around from the bottom of the file to the top to look for your text (or the reverse if searching Up). When disabled, searches will stop at the end of the file.

When you are searching in All HTML Files, then when wrap is enabled if your search reaches the last HTML file the search will continue automatically from the first HTML file to look for your text (or the reverse if searching Up). When disabled, searches will stop at the last file in the book (or the first if searching Up).

Context Menu

If you right-click on the Find or Replace box you are given various options:

Saved Searches: A list of Saved Searches you can select to load into Find & Replace.

Save Search: Save this Find & Replace search in Saved Searches.

Tokenise Selection: Convert spaces to \s and escape certain characters.

Saved Searches

— Saved Searches for Find & Replace —

The Saved Searches dialog allows you to save and edit all your common Find & Replace searches. You can also use it to run your searches.

To open Saved Searches, select the menu item Tools→Saved Searches or its keyboard shortcut:

All Saved Searches are run using the options and modes set in Find & Replace.

Context Menu Commands

Most actions concerning editing searches are accessed using the right-click context menu:

Select one or more entries then right-click on the selection for the following options:

Add Entry: Add a blank search under the entry you clicked.

Add Group: Add a new group under the entry you clicked.

Edit: Edit or rename the entry (same as double-click).

Cut: Delete one or more entries that can be pasted later.

Copy: Copy one or more entries that can be pasted later.

Paste: Paste any cut/copied entries.

Delete: Delete entries or groups.

Import: Read a list of exported entries from a file into the list.

Reload: Restore the list from the last saved state.

Export: Save selected entries to a file for sharing.

Export All: Save all entries to a file.

Collapse All: Collapse the display of all groups.

Expand All: Expand the display of all groups.

Running Searches

Saved Searches can be used to run your searches as well as manage them.

All of the Find & Replace actions are available from the Saved Searches window, and you do not need Find & Replace open to use them (although the options set in Find & Replace will be used when you run the search).

To run a search, just select an entry and click one of the actions. All result messages will be displayed in the window and in Find & Replace.

Although all searches are done using the modes set in Find & Replace you can hold the Ctrl key down when selecting a search to force it to run temporarily in the Current File.

Group Searches

You can actually run a group of searches. Each search will be run sequentially.

Simply select a group name and then, for example, run Count All. Or select several non-group entries and run, for example, Replace All.

Save

To save your entries to disk, click Save.

To exit without saving your entries you can just close the window (with the Close button or the Esc key) and confirm you do not want to save if prompted. You can also use the context menu Reload to reload your entries from disk – which will delete your current entries.

You can use the Export and Import context menu items to save your searches so that they can be shared with others.

If you save and are running more than one copy of Sigil, then the other instances of Sigil will automatically reload the newly saved searches to keep all copies in sync.

Filter

You can use the filter text box to restrict the list of searches shown to make it easier to find a search.

Load Search

Clicking the button Load Search will load the search you have selected into the Find & Replace box.

Loading does not run the search – it is only a way to populate the fields in Find & Replace. You can also just right-click in the Find & Replace text boxes and select a saved search from the context menu to do the same thing.

You do not need to load a search if you are going to run the search from the Saved Searches dialog.

You can load a search using just the keyboard by using the shortcut to open Saved Search, typing your search name in the filter box and hitting return (followed by Esc if you want to close the window).

Moving Entries

You can move searches or groups around by using the arrow keys or by drag and drop.

In order to group entries you must first create a group to put them in.

Using Saved Searches in Find & Replace

Save Searches

While in Find & Replace you can save your search by right-clicking in the Find or Replace text boxes and selecting the menu item Save Search.

Load Searches

You can also load saved searches into Find & Replace by right-clicking in the Find or Replace text boxes and selecting the menu item corresponding to your saved search.

Once you have loaded a search you can change the mode or options before running it.

Clips

— Saving Text and Styles —

Clips allow you to save snippets of text and paste them into your document at any time. They can also be used to insert HTML style tags around your text. You can create clips using the Clip Editor, use the Clips window to quickly select a clip, use a Clip Bar toolbar to select a clip using a button, or use keyboard shortcuts to access the clips. And you can even automatically fill the Clips list from your CSS stylesheet styles.

Clip Editor

To open the Clip Editor, select the menu item Tools→Clip Editor or its keyboard shortcut:

Context Menu

Most actions concerning editing clips are accessed using the right-click context menu:

Select one or more entries then right-click on the selection for the following options:

Add Entry: Add a blank search under the entry you clicked.

Add Group: Add a new group under the entry you clicked.

Edit: Edit the entry.

Cut: Delete one or more entries that can be pasted later.

Copy: Copy one or more entries that can be pasted later.

Paste: Paste any cut/copied entries.

Delete: Delete entries or groups.

Import: Read a list of exported entries from a file into the list.

Reload: Restore the list from the last saved state.

Export: Save selected entries to a file for sharing.

Export All: Save all entries to a file.

Autofill: Create clips from your CSS stylesheets.

Collapse All: Collapse the display of all groups.

Expand All: Expand the display of all groups.

You can also use the Add Entry or Add Group buttons to add new items.

Save

To save your entries to disk, click Save.

To exit without saving your entries you can just close the window (with the Close button or the Esc key) and confirming you don’t want to save if prompted. You can also use the context menu Reload to reload your entries from disk – which will delete your current entries.

You can use the Export and Import context menu items to save your searches so that they can be shared with others.

If you save and are running more than one copy of Sigil, then the other instances of Sigil will automatically reload the newly saved clips to keep all copies in sync.

Filter

You can use the filter text box to restrict the list of clips shown to make it easier to find text.

Moving Entries

You can move entries or groups around by using the arrow keys or by drag and drop.

In order to group entries you must first create a group to put them in.

Pasting Clips

Clicking the button Paste Clip will paste the entry you selected into the last window you selected (your document in Book View or Code View, or Find & Replace).

You can paste a clip using just the keyboard by using the shortcut to open Clips, typing your clip name in the filter box and hitting return (and then Esc if you want to close the window). But using a keyboard shortcut may be easier.

You can also paste a group or selection of clips if necessary.

You can also right-click on your text in Book View or Code View to bring up the context menu. You can then select your clip and it will be inserted immediately.

Autofilling CSS Entries

The Autofill context menu item will scan your CSS stylesheets and create a clip entry for each simple selector it finds.

For example, if you have the selector or style "p.first" then Autofill will create a clip for it as follows:

<p class="first">\1</p>

If the selector is "*.class" then Autofill will create entries for "p.class", "div.class", and "span.class".

All new Autofill clips are stored in the "Autofill" group. If the "Autofill" group does not exist it will be created. You can rename the group once it has been created, and you can move or copy any entry to any group.

Clip Bar

The Clip Bar is an optional toolbar that will show buttons for the first 20 clips that are not in a group. You can display the Clip Bar by selecting the menu View→Toolbars→Clips:

The buttons will show the clip’s name, so you may want to keep the names short. You can use them as shortcuts for your own styles or even for common special characters.

Clips can also have keyboard shortcuts – see Insert→Clip

Clips Window

The Clips window is a dockable window that shows all your Clips in a list and allows you to click an entry to paste it into your text. You can display the Clips window by selecting the menu View→Clips:

Using Clips to Format Text

Clips provide a way to paste text before and after selected text – to give you a basic ability to format your text.

If you define a clip using "\1" in the text then Clips will treat this as a Regex replacement command. When you paste the clip, the "\1" will be replaced with whatever text was selected.

For example, if your clip is

<span class="name">\1</span>

and you select the text

Hello World

Then when you apply the clip the text will be changed to

<span class="name">Hello World</span>

You can use this to build up a library of styles and formatting that can be applied quickly. Any text can be used in Code View. But in Book View only limited clips can be used – in particular span tags. This is because you will be inserting into an existing paragraph – and you can’t insert certain tags inside a paragraph tag.

You can use other regex commands in your clip, although complex regex statements might not work.

You can use Ctrl+Space to remove formatting tags from selected text before pasting a clip.

Clipboard History

— Clipboard List —

Clipboard History allows quick access to your most recently copied or cut text.

To add text to your clipboard, just use Copy or Cut.

To paste text from the clipboard, select the menu item Edit→Paste From Clipboard History or its keyboard shortcut:

Click on the text you want to use and it will be pasted into your last selected window and the dialog will close automatically.

You can also just type the character shown for the entry to select it.

Links and IDs

— Links, Notes, and IDs —

Sigil provides some helpful tools for creating ids and links which can make creating footnotes, endnotes, and cross-references easier.

Insert IDs

To mark text as a destination for a link you need to give it a name by inserting an anchor ID.

Select the text you want to mark with an ID and click the button or select the menu item Insert→ID:

Type the name you want for this ID, e.g. footnote-1 (it must start with a letter).

To edit the ID, select the word or click somewhere in the word then click the button again.

The ID is actually inserted using HTML code like this:

<a id="footnote-1">Footnote 1</a>

You cannot use identical IDs in the same file.

If you click on the drop-down arrow you will see a list of existing IDs for the file for reference.

To delete an ID you will need to edit the HTML code in Code View to remove the tags completely.

To identify IDs in your book you can search in Code View. Or you can highlight them in Book View in color by adding the following CSS temporarily to your stylesheet:

[id class!=sigil_index_marker] { color:#00ff00; }

Insert Links

To create a link to another part of the document select the text you want to link and then click the button or select the menu item Insert→Link:

You will be given a list of valid targets in the EPUB that you can select (double-click one or select and click OK). A valid target in the EPUB is any filename, any anchor IDs that have been created, or even any images. The list will be sorted so that targets in the current file are listed first, followed by all remaining files in book order.

To edit a link, select the text again or move your cursor in the text using the arrow keys (you can’t click in it or you will be taken to the link) and then click the button . The link will be highlighted in the list if it is valid.

You can also enter any URL you want as a target for the link (e.g. to point to web sites) by typing the entry in the Target box.

Navigating Links

To go to a link in Book View just click on it.

To go to a link in Code View, hold the Ctrl key down while clicking on the HTML opening tag.

Ctrl-clicking on text will take you to the link if the text is a link, or it will take you to the CSS style defined for the tag if the text is just a tag.

To go back to where you clicked the link, just click the Back button or select the menu item Go Back to Link or Style.

Styles

— Working with Stylesheets —

EPUB editing is all about styles. Sigil provides very easy to use but powerful tools for helping you work with stylesheets.

Styles can be inserted in your individual HTML files, but the usual approach is to define a stylesheet containing your styles and then link that file to your HTML files.

Creating Stylesheets

To create a stylesheet, just use File→Add→Blank Stylesheet. Then just add the style definitions you want to use. Or add an existing stylesheet file (such as a template you use often) to the EPUB.

Do not include spaces in your stylesheet filename.

Linking Stylesheets

You can easily link your stylesheets to your HTML files by right-clicking on them in the Book Browser and selecting Link Stylesheets then choosing which stylesheet to link or unlink.

Navigating Styles

You can quickly jump to the definition of a style being used by your HTML code.

While in Code View hold the Ctrl key down and click on an HTML tag, or select the menu item Search→Go To Link Or Style or its keyboard shortcut. You will immediately be taken to the exact location of the style used for the HTML tag you are in – if one exists.

To return to where you were, just click the Back button or select the menu item Go Back to Link or Style or its keyboard shortcut.

Deleting Styles

You can select the menu item Tools→Delete Unused Stylesheet Classes to automatically delete any unused classes in stylesheets. Sigil will present you a list of class names in your stylesheets that do not have any references to them from your HTML files and then allow you to confirm or cancel deleting them.

While Sigil makes several checks to ensure the style is not used, if a particular complicated CSS declaration is used it may list the tag incorrectly so you should check the styles carefully.

You can double-click on a style to show that style in the CSS stylesheet.

Context Menu and Formatting Styles

The context menu for a stylesheet allows you to re-format your stylesheet:

Clips: Select a clip to enter into your stylesheet.

Add To Clips: Add the selected text to Clips.

Go To Link Or Style: Not used.

Reformat CSS

Multiple Lines Per Style: Arrange the styles with over multiple lines with spacing.

Single Lines Per Style: Arrange each style on one line.

Although most stylesheets are formatted with multiple lines per style, the single lines per style would look like this:

Viewing Styles

You can use the menu item Tools→Reports to show a list of reports about your styles – see the Reports chapter.

For more control over deleting individual classes, you can use a report to view the number of times a class is used and then delete the ones you want.

Indexes

— Create an Index For Your Book —

If you want to create an Index for your book, you can use Sigil to identify what to index and then to automatically create a new HTML page containing the index.

You can mark individual words in your text for indexing, or use the Index Editor to make sure every occurrence of the word is indexed.

Mark Entries for Indexing

The first way to identify entries to include in the index is to mark specific words or phrases in your text. Only the occurrence of the word or phrase you mark will be included in the Index – if you need all occurrences use the Index Editor.

Highlight a word or phrase in either Book View or Code View and then select the menu item Tools→Index→Mark For Index or its keyboard shortcut (which you can change). This will then open a prompt for you to enter how you want these words to appear in the index:

The text you enter as the name to use in the Index will be show up in the Index as follows:

[blank]: If you leave the name empty, then the exact words you highlighted will be used in the index.

words: If you enter a word or phrase, then that word or phrase will be used (e.g. Oak instead of oak).

heading/words: If you use a "/" in the name then a hierarchical group will be created (e.g. Forest/Tree/Oak will create an entry Oak filed under Tree filed under Forest).

entrya;entryb: If you use a ";" then multiple entries will be created for this word or phrase.

When you mark text for indexing, it just adds add some Sigil-specific HTML code that tells Sigil to include these words when you create the index. In code view it might appear as follows:

<a class="sigil_index_marker" title="Character/Alice">Alice</a>

If you no longer want a word or phrase to be indexed by Sigil, you will need to delete the special HTML tags around the word.

To find indexed words you can search in Code View. Or you can highlight them in Book View in color by adding the following CSS temporarily to your stylesheet:

[class="sigil_index_marker"] { color:#335500; }

Add Entries to Index Editor

The second way identify words to index is to add the words to a list. Then when you create the index every occurrence of that word will be included in the index automatically. You can use words marked for indexing and a list of words to index at the same time.

To add specific words to the index list while in Book View or Code View, highlight the word or phrase, and then select the menu item Tools→Index→Add To Index Editor. If your selected text includes any HTML tags, you should remove them.

This will bring up the Index Editor with the word added to the list of entries to index. You can also enter words directly in the Index Editor as described below.

Create the Index

To actually create your index once you have marked words and/or added them to the list just select the menu item Tools→Index→Create Index.

This will create or update an HTML page called index.xhtml. It will be marked with the semantic type "index". Entries are listed alphabetically, and, using the default styling, look like this:

You can edit the index page as with any HTML page, but if you re-create the index your changes will be over-written.

Custom Index Stylesheet

The index page uses a separate CSS file (sgc-index.css) to format the index. If the file already exists in your book it will not be overwritten (so you can customise it without losing your changes). But if it does not exist, it will look for sgc-index.css in your preferences directory and use that as the default file. If there is no file in your preferences directory, then Sigil will create a default stylesheet for the index.

Index Editor

The Index Editor is used to manage the list of entries that will be included in the index. It does not include the words you marked for indexing – they are included automatically.

To open the Index Editor select the menu item Tools→Index→Index Editor or its keyboard shortcut:

Text To Include

The "Text To Include" column is a list of patterns you want Sigil to search for in your text and then to create an Index entry for using the format in the "Index Entries" column. Entries in the "Text To Include" column can use the following formats:

words: The words in the book must exactly match the listed words (case-sensitive). Do not include any HTML tags, just the words as they appear in Book View.

Regex: You can enter most regex patterns - they will be match on a paragraph by paragraph basis. For example, to match words while ignoring case sensitivity you can use "[Gg]utenberg" or "(?i)Gutenberg".

You can paste text into the Text To Include field – e.g. from a file containing a list of words – and the text will be automatically split into separate entries for each line.

You can also use Open to open a text file of words (and entries separated by tabs).

Index Entries

The "Index Entries" column is what will actually appear in the Index for words matching the "Text To Include" column.

Entries in the "Index Entries" column can use the following formats:

blank: If you leave the entry blank, then the words entered in the Text to Include column will be used for the entry's name.

words: If you enter a word or phrase, then that word or phrase will be used (e.g. Oak instead of oak).

heading/words: If you use a "/" in your name then a hierarchical group will be created (e.g. Forest/Tree/Oak will create an entry Oak filed under Tree filed under Forest).

heading/: If you use a "/" at the end of the entry name, then a hierarchical group will be created and the words in the Text to Include column will be used as a sub-entry.

Context Menu

Most actions concerning editing clips can be done by using the context menu.

Select one or more entries then right-click on the selection for the following options:

Add Entry: Add a blank search under the entry you clicked.

Edit: Edit the entry.

Cut: Delete one or more entries that can be pasted later.

Copy: Copy one or more entries that can be pasted later.

Paste: Paste any cut/copied entries.

Delete: Delete entries.

Open: Replace the current Index List with entries from a file (either an index file or a text file).

Reload: Restore the list from the last saved state.

Save As: Save all entries to a file for keeping a per-book list of index entries.

Autofill: Fill the list with every word in the book.

Select All: Select all entries (for easy deletion).

Save

To save your entries to disk, click Save.

To exit without saving your entries you can just close the window (with the close button or the Esc key). You can also use the context menu Reload to reload your entries from disk – which will delete your current entries.

If you save and are running more than one copy of Sigil, then the other instances of Sigil will automatically reload the newly saved index entries to keep all copies in sync.

Filter

You can use the filter text box to restrict the list of searches shown to make it easier to find a search.

Opening or Importing Text Files

The Open context menu item can be used to open saved Index files, but it can also open text files.

You can list just the Text To Include words in the text file – one per line. Or you can include both the Text To Include and Index Entry values by separating them with a tab – one per line.

Reports

— View Details About Your Book —

Sigil provides several reports that list details about the files and styles in your book.

You can usually double-click on an entry in the report to jump to the filename listed.

Some entries have tooltip information. For instance in the Image Report the number of times used column shows which files use the image.

Use Tools→Reports to generate the reports and then select which report to view:

All Files

This report lists all of the files in the EPUB, the size of the file, the location and type of the file, and whether there are any guide semantic types applied to the file.

HTML Files

This report lists all of your HTML files and details about the files.

You can delete files from the EPUB while in the report by right-clicking on selected files and choosing Delete From Book.

Image Files

This report lists all of your images and indicates whether or not they were used in the book and how many times. You can double-click on an entry to jump to the first occurrence of the image in your HTML files (not images in CSS files).

You can delete files from the EPUB while in the report by right-clicking on selected files and choosing Delete From Book.

CSS Files

This report lists all of your CSS Stylesheets and indicates whether or not they were linked to and how many times.

You can delete files from the EPUB while in the report by right-clicking on selected files and choosing Delete From Book.

Style Classes in HTML Files

This report scans the HTML files in your book and extracts a list of style class names that are used in the files. For each class name it lists whether or not it was found in a CSS Stylesheet or an Inline Style.

Style Classes in CSS Files

This report scans the CSS stylesheets in your book and for each style that uses a class name it lists whether it was used in the book or not.

You can delete specific style classes from the stylesheets while in the report by right-clicking on selected styles and choosing Delete From Stylesheet.

Links And Footnotes

This report lists every link (href) found in your HTML files. These are the "<a>" tags in your code. It includes whether the link has an id, what the target of the link is, and whether that target exists.

In addition, to help with footnotes or endnotes, it checks for reverse links. A reverse link is a link from a target that points back to the original link. In other words, if you create links like this for footnotes the report can confirm if they both link to each other:

Link in text:      <a id="t1" target="../Text/footfile1.xhtml#f1">text to footnote</a>
Link in footnote: <a id="f1" target="../Text/file1.xhtml#t1">footnote back to text</a>

This only works if you use ids within the anchor ("a") tag.

Characters in HTML Files

This report extracts a list of all the characters that are used in your HTML files. More specifically, it lists any character that is displayed in Book View. HTML entity codes are listed if they exist for the character, along with their decimal and hexadecimal codes. And all characters are listed at the bottom for easy cut and paste.

This report can be used to identify if extra characters are being used in the book unexpectedly, and it may be of assistance if you are subsetting fonts.

External Editors

— Using Open With To Edit Files —

Sigil is a powerful editor but it can’t edit images and it may not have some of the features you use in other editors. In these cases you can edit the file in an external program – and when you save, Sigil will immediately update its copy. This is very useful if you want to quickly edit images or want to edit CSS stylesheets and immediately see how changes affect the layout of your book.

To edit a file externally, right-click on the file’s name in the Book Browser and choose Open With from the context menu (you can also right-click on an image in Book View):

When you open a file you first need to choose the application to use with that file type. Each file type (html, image, stylesheet) can use a different application.

You can then give the application a friendly name that will be used in the menu the next time you use Open With:

When you next use Open With on the file you will see the friendly name you gave the application, and the option to choose a different application. Only one default application will be listed but you can change it at any time:

If you make changes to the file in Sigil while the file is being edited in another program then you may lose data. You should always open the file for editing externally, make the changes, then save and close the file in the external application before making any changes to that file in Sigil.

In some cases images may not update properly in Book View, especially if Preview is open. You may need to switch to Code View and back or close and re-open the file to see the edited image.

Tutorials

— How-To Guides —

Create your first EPUB ebook and learn about using Sigil with the tutorials in this section.

Details on all of Sigil’s features can be found in the Features chapter.

To give you an idea of what is involved in making an EPUB, here is an overview of the steps you might follow:

Convert your document to HTML (if it’s not an EPUB already) so it can be loaded into Sigil.

Enter book details including Author and Title.

Add a cover image.

Create a Table of Contents.

Validate your ebook against the EPUB standards.

Test everything looks and works ok in Sigil.

Test on actual ereaders – what works in one may not work on another.

To see what an EPUB looks like and to try out Sigil, you can download the EPUB version of the Sigil User Guide and open it in Sigil.

Getting Started With EPUB

If you are going to create an EPUB ebook, it’s probably a good idea to understand what EPUB is and how Sigil can help.

EPUB is a standard file format created to display books, and Sigil helps you create EPUBs. Sigil is designed to take the book you created in a word processor and convert it to a standard EPUB file that can be published and read on ereaders. It can also be used to clean up and reformat existing EPUBs.

How much you want or need to "clean up" your EPUB depends on you. If you are just formatting a book for yourself you may not be concerned with too many details and will be able to use Sigil just enough to get it to look right on your ereader. But if you are formatting for publication then you’ll find Sigil makes it easy to access and change any detail about your book.

When you edit a document in a typical word processor you usually end up with 1 file, e.g. mybook.doc. This file contains all the information about your document. An EPUB is slightly different. Instead of using just 1 file to store your information, it uses separate files to store the parts that make up your document: chapters, images, table of contents, etc. But because it would be difficult to share lots of separate files with people, all these separate files are actually stored into a single compressed zip file with the file extension .epub, e.g. mybook.epub. An EPUB file is actually just a zip file that contains all of the files needed by your book.

Sigil can open and create EPUB files, and it allows you to edit, rearrange, and format the individual files in the EPUB (like your text and table of contents).

Once you copy or import your document into Sigil, it becomes part of the EPUB file. And when you save your book in Sigil, your document is saved in the EPUB file.

Note that Sigil is designed to work with EPUB 2 – the version supported by most e-ink readers and which is easily convertible to other formats. It also supports some EPUB 3 features such as audio and video – but these may not be supported on most devices.

Prepare Your File For Sigil

If you already have an EPUB or HTML file, or are writing from scratch in Sigil, you can skip this step.

If you are starting with a document created by a word processor, then the first thing you need to do is convert your document to HTML so that you can import it into Sigil. Some programs can generate EPUB files as output. And some programs have add-ons or features to cleanup their HTML output. Whether it is best to use the HTML or EPUB (or even plain text) output of these programs depends on the program – you can always test different ways to see what works best.

The "cleaner" your HTML file is, the easier it will be to turn it into an EPUB and the more likely it will display correctly on multiple devices. This means using styles for formatting and not using too many fancy formats and layouts.

Do not expect an EPUB to look like a printed book – EPUB is designed so that the reader can control how the book is displayed.

Although conversion is not part of Sigil, here are some suggestions for converting files for importing into Sigil.

Word Documents

Use the MS Word menu item File→Save As Filtered HTML. Or use the MS Word Macro @ MobileRead.

Both approaches try to reduce the amount of extra code exported by MS Word so that your HTML file is cleaner and simpler to edit in Sigil. You really want to have your code as clean as possible since Word adds lots of extra HTML tags that you will probably want to delete at some point.

When using Word or any word processor, you should always try to use styles to format your code instead of just making some text bold, some larger, etc. Styles are also an important concept when formatting EPUBs.

Text Files

It is not strictly necessary to convert text files to HTML. Sigil can directly open .txt files.

Text files must have a blank line between paragraphs so that Sigil can split them into separate paragraphs.

Text files are not an ideal source, but they can still be better than some formats as they will have fewer unnecessary HTML tags. They may be worth using if you have lots of issues with other formats. Sometimes it is faster to add styles to a clean document than to try to clean up a converted file.

Other Formats

Many other word processors, such as LibreOffice, also have a save-as or export to HTML or even save-as EPUB function that you can try. You can also convert other formats to HTML or EPUB using other software such as calibre.

Note that any automatic conversion of your files will introduce lots of extra code. If you are just formatting a book for personal use you may not be concerned with this. But if you are formatting books for professional purposes or want as little extra code in your EPUB as possible, then it should be avoided.

Sigil only supports importing HTML files since converting from other formats is actually quite specialised and best left to other tools.

Open Your File With Sigil

Once you have an HTML or EPUB file, it’s time to load it into Sigil. Even if you have an EPUB file already you should follow these steps for a quick introduction to using Sigil.

If you are starting with an EPUB file, make a backup copy of the file before opening it in Sigil.

Start Sigil

When you first start Sigil you will be shown a screen with several windows:

The Book Browser window on the left shows you all of the files in your EPUB, the editing Window is in the center and defaults to Book View (to edit your book – although it will be blank since you haven’t loaded any files yet), and a Table of Contents window is on the right (to show you any chapter titles you’ve defined).

This is how Sigil might look if an EPUB was loaded:

You can open individual files in your book for editing by double-clicking on their names in the Book Browser.

See the User Interface chapter for more details.

Load Your File

To load your HTML or EPUB file into Sigil, click the Open button document-open_22px or use the menu item File→Open:

Select the file you want to open from your file manager, e.g. TestBook.html.

You will now see your HTML file(s) in the Book Browser window under the Text folder on the left. The file will be opened in the Book View editor in the middle, with its filename showing on the tab header:

Your HTML file is now part of an EPUB. From now on you are editing your EPUB and not just an HTML file. You may have noticed that when you opened your file in Sigil it created a couple of other files needed by the EPUB format, which you can see alongside your original document in the Book Browser.

If your file includes any images or stylesheets, etc., Sigil will attempt to load them as well and store them in the appropriate folder in the Book Browser.

When converting your file to EPUB or loading an EPUB Sigil may add some necessary details and organise your files into standard folder names.

Save Your EPUB File

Now that you’ve loaded your file into Sigil, you should save it.

You should always save right after loading a new file – even if it was an EPUB to start with – to make sure there are no problems with saving.

Since the file you are editing is now an EPUB (even if you loaded an HTML file to start with), when you save in Sigil you will be saving an EPUB formatted file (although it might be missing some details that you will need to add later).

To save your EPUB, click the Save button document-save_22px or use the menu item File→Save:

If you loaded an HTML file, your EPUB won’t have a name yet – so you will be prompted to enter a name for your file. It will be given a .epub extension since it will be saved as an EPUB file.

You can click the Save button to save your EPUB at any time – and you should save often.

Notice that the title of your book – at the top of your window – is updated (e.g. to TestBook.epub) and that the status bar briefly shows "File saved":

You now have an EPUB file – but don’t stop yet!

To make sure your ebook conforms to EPUB standards, you need to add a bit more information as shown in the following tutorials.

Add the Author and Title

In addition to the actual content of your book, EPUB files also contain book details like Author and Title. These can be added with Sigil.

To add details (called metadata) about your book to your EPUB, click the Metadata Editor button metadata-editor_22px or the menu item Tools→Metadata Editor:

The Metadata Editor window will be displayed:

You may notice that the Metadata Editor already has one detail about your book – the last time you modified the file. This is added or updated each time you save the book in Sigil. There are many other details you can add, but the entries required by an EPUB are Title, Author, and Language.

To add the Title, Author, and Language to your book:

Title: Type the full title of your book.

Author: Type the author’s name, for example enter Lewis Carroll.

Language: Select the primary language the book was written in from the drop-down box.

File-As: This is actually optional so it can be left blank. But it is usually included as it controls how the author's name is sorted. Type the author’s name as it should be sorted, for example enter Carroll, Lewis.

This is how your data might look when filled in:

Once you have updated the information, you can click OK and then save button-save your EPUB again.

You may have noticed that there is a lot of room for other values in the Metadata Editor. Only the Title, Author, and Language are required for EPUBs, but if you want to add more values using the Add Basic or Add Role buttons you can.

See the Metadata Editor chapter for more details.

Add a Cover Image

Every book should have a cover image, and Sigil can make adding one to your EPUB easy. You will need to have an existing cover image available to use (and have permission to use it). The exact size of the cover is up to you and the guidelines for your device.

To add a cover, just select the menu item Add Cover:

The Add Cover window shows you a list of images already in your EPUB. But since you haven’t loaded any images yet, it’s empty.

You can insert the image into your EPUB and make it the cover in one step by clicking on the Other Files button.

Select your cover image from your filesystem and click OK.

And that's it. Sigil has added your image to the EPUB and marked it as the cover image. It has also created an HTML file at the start of your book and inserted your cover image into the file so that it will be displayed at the start of the book:

You should Save button-save your book.

Create Files For Each Chapter

If you loaded an HTML file into Sigil, this usually means all of your text and chapters are in one large file. This is okay, but the standard practice with EPUBs is to put each chapter in your book into a separate HTML file. The smaller file sizes are needed for some ereaders to read your book, but it is also faster to display and easier to edit.

Since most ereaders start a new file in the EPUB on a new page, it means your chapters will also start on a new page.

Create One File Per Chapter

The easiest way to split your book into separate files is to use the Split At Cursor button split-section_22px wherever you want to start a new file.

For example, to start a chapter on a new page, click just to the left of the chapter heading so that your cursor is at the start of the line:

Now click the Split At Cursor button split-section_22px to split the text into two parts:

You can see that everything after where you split is now in a new file called "Section0001.html".

If you look at the original file you can see it only contains the text before where you split:

You can continue splitting every chapter in your book, and putting any section that should start on a new page in a separate file.

If you want to rename your files, see the Rename section. This includes how to rename many files at once, e.g. Chapter_1, Chapter_2, etc..

See the Splitting and Merging chapter for more details – including how to insert Split Markers and split every file at once.

Identify Your Chapters

EPUBs can provide a Table of Contents (abbreviated as TOC) to help readers find their way around your ebook. Sigil can display and generate a Table of Contents automatically from your ebook – you just need to tell it what your chapter names are.

Sigil shows the Table of Contents in a separate window – on the right by default:

Mark Your Chapters

In order to create a Table of Contents you need to tell Sigil what your chapter names are. To do this just select each chapter name in your book and use one of the toolbar buttons to mark it as a chapter heading:

Just click anywhere in the paragraph that you want to be a chapter:

Click on the Heading Level 1 button heading-1_22px to mark the text as a chapter heading:

You can then mark the remaining chapter headings in your book:

When you click on a heading in your text the Heading buttons will highlight the heading level.

The other heading levels (h2, h3, etc.) allow you to create sub-chapters. The paragraph button heading-normal_22px can be used to change your text back to a normal paragraph instead of a heading.

If you have multiple HTML files in your book, just double-click on them in the Book Browser to open them.

Generate A Table of Contents

In order for Sigil to generate a table of contents for you, you must have already identified the chapter names. See the previous tutorial if you have not done this already.

Once you have marked all your chapter headings you can click the Generate Table Of Contents button generate-toc_22px or use the menu item Tool→Table Of Contents→Generate Table Of Contents to open a new dialog:

The dialog allows you to mark which headings to include or not include in your Table of Contents.

Click OK when you are finished.

The Table of Contents window will be updated to show your current TOC – which includes the headings you selected:

If you click on an entry in the Table of Contents window you will jump to its location in the book.

You should re-generate the TOC any time you change your headings.

Save button-save your book if you haven’t already.

See the Table of Contents chapter for more details.

Create Links and Notes

— Linking your Text —

Sigil allows you to easily link text to other parts of your book, such as chapter names and notes, so that readers can select the link and jump to the identified text.

IDs

In order for Sigil to create a link from certain words in your book to other locations in your book, you first need to give a name or ID to the text you want your link to go to.

If the target for your link is just the top of a file, then you don’t need to do anything since you can use the filename as the target ID.

But if you want to point to specific words in your book, then you need to assign a name or ID to the text.

An ID is just a unique name, like note1 that you will assign to a some of your text so that you can refer to it. ID names must be unique within an HTML file (and start with a letter), but its best if they are unique throughout the whole EPUB in case you move text around.

IDs and links are usually created with the HTML anchor tag ("a") – so the ID is often considered the anchor ID for a link, hence the button used for inserting IDs.

Create an ID

To create an ID, select some text in your book and click on the Insert ID button insert-id_22px:

This will open the Insert ID dialog where you can type the name of your ID:

You won’t see any change to your text in Book View, but if you click on your text and click on the Insert ID button again you will see the ID listed.

In order to remove an anchor tag and its ID in Book View you will need to select all the text and delete it and retype it. Or use Code View.

Links

A link is a way to point to your ID, and when selected by the reader it "jumps" the reader to the location of the ID.

To create a link in Sigil, select some text to use for the link and click on the Insert Link button insert-hyperlink_22px:

This will open the Select Target dialog which shows you the IDs in your book that you can link to:

You will notice a number of different IDs in the list. At first it might not look like yours is there, so to find it, it helps to understand what a link looks like:

Filename.html: This points to just a filename as the target of your link and tells the link to jump to the top of the file. This is what is used for the Generate Table Of Contents links.

Filename.html#ID1: This points to a specific ID in a file. When you use this as the target of your link the reader will go to the exact location of the text with the ID in the file listed.

#ID1: This is just the ID name, and implies that it is in the same file as your link so no filename is needed.

When you select a link you will see that the Target text box shows the actual link that will be used. Click OK, or double-click on an entry, and the link will be created for your text.

If you click on the newly created link in your text you will jump to where the ID is. You can then click the Back button back-to-link-style_22px to return to where you clicked the link.

Reverse Linking

Most ereaders have a Back button that you can select once you follow a link to take you back to the original linked text. But for those that don’t, you can create a link from your destination back to your original source text. This is often called reverse linking.

Reverse linking is just like any other kind of linking – it just means you have to create a link from the source text to your destination note, and also from your destination note back to your source text – so both source and destination will need IDs and links, and will be mirror versions of each other:

For example, in the typical case of creating endnotes:

Select your note at the end of your book (or chapter) and assign an ID to it, e.g. note1.

Select your text in the book and assign an ID for it, e.g. text1.

Select the same text again and create a link to the note’s ID.

Select your note again (click on the link to jump you to the note and to test the link), and create a link pointing back to your text’s ID.

Click on the note to jump you back to your text to test the link.

A Quick Introduction To Code View

Until now you have probably been viewing your text exactly as ereaders would display your book – using the WYSIWYG Book View mode in Sigil.

However, your text is not actually stored in an EPUB looking like it does in Book View. In fact, it is stored in HTML format – which is a mix of your text and HTML tags that tell ereaders how to interpret and display your book.

You can see the HTML code in your files by using Code View.

So why do you need to know anything about this? Because in order to use Find & Replace, or to control the formatting of your book easily, or even to understand Spellcheck you need to be familiar with Code View.

It’s worth learning a little about Code View to help understand why your formatting looks the way it does. And it is really necessary if you want to use some of Sigil’s advanced features.

Code View

To switch to Code View, click the Code View button view-code_22px. You can switch back to Book View at any time by clicking the Book View button view-book_22px. Or you can double-click on the tab-header or use the shortcut for View→Toggle View State.

This is Book View and Code View side by side for comparison:

That’s quite a lot of text, but it’s not as jumbled as it appears. First, ignore everything at the top of the file up to and including the <body> tag on line 11 in this example. The "header" is just information required by HTML files and not something you normally need to change.

Your text starts after the <body> tag:

You can see all the same words that are shown in Book View – the chapter name "Introduction" and several paragraphs of text. But you can also see the HTML code tags that tell readers how to display that text.

HTML Basics

A full description of HTML is beyond this tutorial, but understanding the basics will help you edit your text.

If you look at the HTML version of your file in Code View you will see lots of words like <p> or <h1>, etc. These are the HTML tags that tell ereaders what to do with your text.

For instance, the HTML code below tells the ereader that the text Chapter 8 is a level 1 Heading:

<h1>Chapter 8</h1>

The <h1> tag is the start of the text to be treated like a heading, and the </h1> tag indicates the end of the text included in the heading. This is what Sigil enters into your document when you click the heading-1_22px button. Ereaders will typically make the text of a heading larger and center it on the screen.

The HTML code below tells the ereader that the text This is a paragraph is an ordinary paragraph. Since it’s a paragraph the ereader will apply a certain formatting, perhaps indenting the first line.

<p>This is a paragraph.</p>

There are many more tags in HTML. The important point to remember is that the HTML tags tell ereaders how to format and display your content. They allow you to keep your content separate from your formatting which makes it easier to change how your book looks.

HTML tags can get more fancy since they can include attributes that modify how they are interpreted. For example, here is a paragraph with some tags that define an ID used for linking as shown in the last chapter:

<p><span id="note1">This is a note</span> for linking.</p>

The span tag is used around small sections of text that need to be formatted differently or to contain information. In this case the information is that the words "This is a note" has an ID of "note1". The span tags with the ID attribute are the code that Sigil inserts when you use Insert ID.

These are just a few examples of HTML code, but they give you an idea of what the majority of HTML is all about.

What is important to remember is that in Code View you have access to both your text and the formatting codes that control the look of your book – so you can find and change them.

See the Introduction, Code View and Stylesheets chapters for more details.

Editing in Code View

Once you are in Code View you can edit your text just like in Book View. Try changing some of your words (but not the HTML tags just yet), and then switch back to Book View. You will see the updates you made. In fact, any changes you make in Book View or Code View will be visible in the other view as they both change the exact same file. It's just that Code View shows you the tags, and Book View uses them to format the text.

Unlike Book View, where you can make any changes you want without breaking your EPUB, when you are in Code View it is essential that you edit carefully. You will need to make sure all the tags you use are valid and are opened and closed properly – if they aren’t, you will get a warning when you try to save or switch to Book View and you will be unable to save your EPUB until they are fixed.

Preview

To really see changing the code in action, you can open the Preview window using View→Preview (you can always close it using View→Preview or its shortcut again). You may need to make the window bigger or drag it to another part of your desktop.

Preview shows your text like Book View, but it stays open when you are in Code View. So once you open Preview, click on the Code View button view-code_22px to bring up Code View. You can type in Code View and Preview will update to show your changes after a second.

Save often to have your code checked for any errors to catch them early.

Check For Spelling Mistakes

Sigil can check the spelling in your book using standard dictionaries, and dictionaries you create.

Before checking the spelling in your book, you should first configure a dictionary using Preferences→Spellcheck Dictionaries. You will need to select a primary dictionary (English, French, etc.). You can just use the "default" personal user dictionary to store any words you want to remember, or create a new user dictionary for each book.

Spellcheck

To check the spelling in your book click the Spellcheck button document-spellcheck_22px or use the menu item Tools→Spellcheck→Spellcheck:

This will open a dialog that shows you every word Sigil has identified as misspelled.

If you select a word you will notice that Sigil will find the first occurrence of that word in your book – and display it in Code View. This is useful to see the word in context, but can be a little confusing if you are not used to Code View, but is necessary to ensure Sigil can find your misspelled word accurately.

You can switch back to Book View using the Book View button view-book_22px, but each time you select a word it will reset to Code View.

Once you have selected a word, you have several choices:

Use Ignore to skip marking this word as misspelled until you switch to a new book or restart Sigil. Sigil will not remember to ignore this word if you restart.

Click on the button Add To Dictionary to add the word to the dictionary you select from the list below the button. You will start with just a "default" dictionary in the list unless you created additional user dictionaries in Preferences.

Use Change Selected Word To to change every occurrence of the selected word in your book to the word you enter below. The dropdown list contains a list of suggested alternatives, or you can type your own word.

The other options available to you are:

Refresh can be used if you edit your book while Spellcheck is open. You do not need to use it if you are just ignoring, adding, or changing a word.

Show All Words: Check this to show all unique words in the book and not just the misspelled words.

Case-Insensitive Sort: Enable this to sort words as AaBbCc instead of ABCabc.

You may also notice that in Code View, misspelled words are optionally underlined. This is another way to check spelling with Sigil.

See the Spellcheck chapter for more details.

Check For Errors In Your EPUB

Your book is almost ready. You just need to check your EPUB to see if there are any issues that might cause problems for ereaders. This can range from missing or extra files, or broken links, etc. This may be unlikely for your first file, but it’s good practice to do the checks to help make sure your EPUB complies to the standard.

To check or validate your book, use the Validate EPUB With FlightCrew button document-validate_22px. This will open a window just below your document and list any problems that were found. For instance, if you forgot to enter the Title of the book in the Metadata Editor you might see:

It can be difficult to interpret exactly what the issues are sometimes, but you should read through them to see if there is anything that you recognise and can fix. Pink lines are errors that must be fixed, and yellow lines are warnings that should be fixed,

Details on the messages are available in the Validation chapter.

Once you have fixed all the issues, Validate will confirm everything is okay:

Now just save button-save your EPUB and you are done!

Keep reading for tutorials on some other features in Sigil.

See the Validation chapter for more details and suggestions on how to correct errors that are found, and how to use other tools like EPUBCHECK to check your EPUB.

Edit With Find & Replace

In Sigil, Find & Replace can be used to find any text in any of your files. And even more important, it can be used to change text – but only in Code View.

You can only search for text in the current file in Book View. All other Find & Replace actions will switch you to Code View.

To open the Find & Replace, use Search→Find & Replace or its shortcut. The Find & Replace window will open just below your editing window, and will stay there until you close it:

There are quite a few option, so if you want to hide some of them you can click on the show/hide chevron on the lower left to hide the Options line (click again to show them again):

The Find and Replace text boxes are where you enter what to look for and change. The buttons on the right (Find, Replace, Replace/Find, Replace All, and Count All) are used to run your search. The Mode dropdown boxes on the bottom allow you to change what to search for, where to search, and which direction to search in.

Each dropdown and button has a tooltip with more details.

Using Find & Replace

To make a simple change enter some text to search for in the Find box, and in the Replace box enter the new text to replace it with:

Click on Count All to show how many matches there are for the text in the Find box (Count and Find ignore what is in the Replace box):

You’ll notice that you switched to Code View if you weren’t already using it! This is because all major searches are done in Code View. You should stay in Code View for this tutorial.

Note that the number of matches is shown on the bottom right.

Now click on Find. The next occurrence of the word in the Find box will be highlighted:

Click on Replace – this changes the text to what is in the Replace box and leaves the new text highlighted:

To make it a little easier to find and replace one occurrence after another, you can use the Replace/Find button. When you click on this button Sigil will replace the selected text if it matches, and then find and highlight the next match.

If you are satisfied that the Replace is working okay, you can use Replace All to update all the matching text in your document at once instead of one at a time.

Always use Count All and possibly a few Replace commands before using Replace All – to make sure you have entered your find and replace strings correctly.

You may have noticed the selection box containing "Current HTML File". If you change "Current HTML File" to "All HTML Files", your Find or Replace will be done across every HTML file in your EPUB:

This is why editing in Sigil can be done quickly.

The last main part of Find & Replace is its ability to use Regular Expressions – but see the Advanced Find & Replace chapter for more details.

Use Stylesheets

— Formatting with Style —

This tutorial describes stylesheets and how to use them in your EPUB.

A stylesheet (or CSS – Cascading Style Sheet) is a list of instructions that tells ereaders how to display the text in your book. More specifically it tells the ereader how to style text using HTML tags used in your book. For example, this is a style for a paragraph of type (or class) "author":

Understanding and using CSS is the best and most flexible way to layout your book exactly as you want.

You can find other introductions to CSS online, including:

W3Schools CSS Guide

Using CSS can get quite involved, but if you become familiar with the basics it will make it much easier to understand why your book looks the way it does and how to modify its layout.

This chapter assumes you are familiar with Code View since you need to use Code View to see the details of styles.

What is a Style?

Styles are used in a book to do things like “make this text blue”, or “make that text centered”, or "leave a little more space above this text". A style definition is just text that looks like:

color: blue;

which says make the color of the text blue.

But styles aren’t very useful unless they are applied to something. In the case of an EPUB styles are applied to the HTML elements in your document, tags like p (paragraphs), h1 (level 1 headings), div (divisions), span (spans), etc.

There are 3 ways styles can be used in an EPUB:

Style Attribute: A style applied directly to one specific HTML tag in the document.

Style Element: A group of styles in one document that can only be used by that document.

Stylesheet: A separate CSS or stylesheet file that can be used by many HTML files and is therefore the most flexible approach.

A separate file is the recommended way to use styles. The descriptions below of each approach will help you understand why.

Style Attributes

To apply a style directly to an HTML tag, you can use the style attribute in the tag. For example, to apply the style color: blue to a paragraph you would change

<p>Hello</p>

to:

<p style="color: blue">Hello</p>

This works perfectly well if you just want to change a few things and rarely update the formatting. But if you later want to change from using bold to italic for certain words then you will have to edit every place in the book that set the specific style.

Styles attributes are rarely used unless they were created by WYSIWYG software or from an automatic conversion and should be avoided.

There is a much better way to manage styles: using style selectors.

Style Selectors

A style selector is a way to give a particular style a name, and then use the style in the document just by referring to its name. More specifically the style selector is used to select which elements in your document should use the style you define.

For example, if you wanted to style all paragraphs in your EPUB to be centered, you could define a rule for a style selector as follows:

p {
    text-align: center;
}

This defines a style selector p that will match (or select) all paragraph elements p.

Just using the tag name as a selector is useful for changing every tag, but you can also select specific tags.

One of the most common ways to select specific tags is by using a class name in the tag and the selector. A class is just a name that you choose (like "firstparagraph" or "example").

For example if you wanted to style the first paragraph in a chapter slightly differently than other paragraphs, you could define a style selector as follows (an "em" is one character width):

p.first {
    text-indent: 0em;
}

This defines a style selector that will match (or select) paragraph tags that use the class name first. You could then use that style in your document for a paragraph by assigning the class name first to the paragraph as follows:

<p class="first">First paragraph in a chapter</p>

The great advantage of this abstraction is that you can now update the values of the style (to change the indentation or other settings) without having to update your text.

It is common practice to use class names that refer to the purpose of the style and not what the style does in case you change the styling later. For instance, use span.placename instead of span.bold in case you want to change your place names to italic later.

Now that you know what a style selector is and how to use them in your text, you need to actually put your style selectors somewhere in order to allow them to work.

In an EPUB you can store your stylesheet in the same file as your text (using the style element), or in separate files (external stylesheets or CSS files). You should avoid storing the styles in the HTML files, but it’s explained here in case you see it in your files.

Style Elements

If you store style selectors and rules in the same file as your text they can only be applied to the HTML file they are in and cannot be shared by other HTML files.

When using these internal styles, the style definitions are stored inside a style tag at the top of your HTML files. If you open a file in your book and switch to Code View, you will see that the top of the file contains text between two head tags. This section of your document contains information about the file, and one of the things you can put here is the style tag that defines your internal style rules.

Here is a typical use of internal styles (they are surround by the style tag):

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html >
<head>
<title></title>

<style>
        h1 { text-align: center; }
        p.boldtext { font-weight: bold; }
</style>

</head>

Internal styles are a way of grouping styles together and using style selectors, but when you have many files in an EPUB it becomes a bit confusing as you have to have separate style rules in each file.

The best way to manage styles is to use a separate stylesheet file to hold your style rules.

You can convert or copy your inline styles and your style elements into a separate CSS file. Just remember to link your stylesheet to your HTML file and to delete the old style attributes and elements.

External Stylesheets – CSS Files

If you create a separate file to hold all your style rules, they can apply to the entire book. They are also much easier to find and edit, and updates are much easier to manage as you add and remove files. It also helps to ensure your book is formatted consistently as you can see all your styles in one place.

In Sigil, external stylesheets are stored in the Book Browser in the Styles folder.

To add a new blank stylesheet to your EPUB, use the menu item File→Add→Blank Stylesheet:

As you can see the stylesheet is empty.

You can copy or type the styles that you want into the file, and edit it at any time. For example, if you open the styles.css file in an EPUB you might see something like this:

Even though you have created the external stylesheet, it’s not actually used by anything yet.

To use it, you need to tell your HTML files to use the stylesheet – by linking to them as described below.

Link your HTML files to a Stylesheet File

To tell your HTML files which CSS file to use you need to link the stylesheet to your HTML file:

Select one or more HTML files in the Book Browser.

Right-click on the selection.

Choose Link Stylesheets from the context menu:

Click on the stylesheet(s) you want to be used for the files and select OK.

If you link multiple stylesheets they will be applied in order, so the styles in the last stylesheet will override the styles in the preceding stylesheets.

What Styles Should Be Used?

The styles you use for your text are entirely up to you.

The best way to learn how to use styles is to find an EPUB that contains formatting you like and look at what its CSS files contain and how it uses those styles in the book.

If you have any errors in your style definitions they will silently be ignored. You can use the menu item Tools→Validate Stylesheets With W3C to check for errors.

Include Custom Fonts

— Embedding Fonts In Your Book —

This tutorial shows you how to use custom fonts in your EPUB.

One of the benefits of ereaders is that you can choose your own font, so it’s usually best to only use embedded fonts to highlight specific types of text – such as chapter headings, quotes, etc. – and not to change the font of the entire book.

To use a font in an EPUB you need to load the font into the EPUB, define a style for the font, and then apply the style to your text.

You will need to know about stylesheets to embed fonts so you should read through the Stylesheets chapter first.

Adding Fonts to your EPUB

To add fonts to your book, use the Add Existing Files button document-add_22px. This will display a dialog allowing you to select one or more files from your computer. Select as many font files as you want.

Many fonts are not free. Before you include fonts in your EPUB please make sure that you have a license or permission to use them. There are many free fonts available online if you search for them.

Fonts files must be either OpenType (.otf) or TrueType (.ttf) format. All ereaders should support otf but most will likely support both formats.

The fonts will be added to the Fonts folder in the Book Browser. However, they are not yet actually used anywhere in your book – they are just available to use.

Defining Styles for Your Font

Once the fonts are in your EPUB, you must define a style that includes them.

Add or open a stylesheet that is linked to your HTML files (see the Stylesheets chapter for more details).

Add a definition of the font, e.g.:

@font-face {
    font-family: 'Garamond';
    font-weight: normal;
    font-style: normal;
    src: url('../Fonts/Garamond.ttf');
}

@font-face {
    font-family: 'Garamond';
    font-weight: bold;
    font-style: normal;
    src: url('../Fonts/Garamond Bold.ttf');
}

@font-face {
    font-family: 'Garamond ;
    font-weight: normal;
    font-style: italic;
    src: url('../Fonts/Garamond Italic.ttf');
}

Font names are case-sensitive!

You must define one @font-face rule for each style of font (normal, bold, italics, etc.).

When using the name of a font-family the font name must either be quoted or unquoted every time you use it – you cannot mix quoted and unquoted names. Always using quotes around the font name makes things more consistent and avoids having to check if a name is valid without quotes.

The font still isn’t actually being used in the book yet, that’s the next step.

Apply Your Font to Text

To make use of the font you need to create another style that you will then assign to sections of your text.

So, for example, to use your new font for headings, define the style for the heading tag as follows:

h1 {
    font-family: 'Garamond', serif;
}

Or to certain paragraphs:

p.longhand {
    font-family: 'Garamond', serif;
    font-style: italic;
}

Or if you want, although it’s not recommended, you can apply the font to all text in the book:

body {
    font-family: 'Garamond', serif;
    font-weight: bold;
}

The font-family rules above instruct the ereader to use your font if possible for the text, but if it’s not possible use a generic serif font.

Font Obfuscation

When you use a font in an EPUB, the font file could be extracted by someone and used somewhere else. If your fonts are licensed you may want to prevent this.

You can use Sigil’s font obfuscation menu to scramble the font file using one of two standard methods, Adobe or IDPF – which one is up to you, but you should test on your target ereader to make sure the font is still readable. Obfuscation is not encryption – it just modifies the font file making it hard to use elsewhere while still being useable by readers to display fonts.

To use font obfuscation, right-click on your fonts in the Book Browser window, right-click and select Font Obfuscation from the menu and choose a method to use for obfuscation.

Testing Your Font

Not all devices will show embedded fonts. Even Sigil may not show all your embedded fonts. Its best to test on your target device to check if your fonts are displayed as you expect.

Advanced Find & Replace – Regex

The real power of Find & Replace in Sigil is provided by its support of Regular Expressions (also called regex). Regex is basically using patterns instead of plain text for searches to make matching text more flexible.

You can use regex in Find & Replace by changing the mode of the search from Normal to Regex.

Regex is a very important tool in Sigil, but only a very brief introduction can be given in this tutorial. See the next chapter for a reference list of regular expressions.

For example, instead of searching for very specific text to replace or delete, such as "Page 123", it would be much more useful to search for text that contains "Page" followed by a number – that’s exactly what regular expressions can provide.

Instead of putting your actual text into the Find or Replace boxes, you can substitute it with special regex codes. So in the example above you could search for "Page \d+" instead of "Page 123" because "\d+" is a regex code that means any digit (the "\d") repeated at least once (the "+").

Using Regex to Replace Text

But even more useful is that you can use regex to help with replacing text as well. In the example above, you might want to keep the page numbers but replace the word "Page". You could use then use something like:

Find:

Page (\d+)

Replace:

This is page number \1

This will replace any occurrence of "Page" followed by a number with "This is page" followed by the same number:

Before:

Page 418

After:

This is page 418

The first point to note about this replacement is the use of the regex code (\d+) in the Find box. The \d+ code tells the search to look for numbers as above. But the use of parenthesis around the code tells the search to remember what those numbers were – to remember anything matched in the parenthesis. The other point to note is the use of the regex code \1 in the Replace box, which tells Replace to substitute the characters remembered in the Find statement for the string \1 wherever it finds it.

Using Regex to Change Formatting

As a further example of regex, this is how you might change the formatting of certain text into chapter headings.

Let’s say that you have an imported HTML file that contains lots of chapter headings, but none of them are marked using the h1 heading tag. Instead they are all marked as paragraphs like this:

<p>CHAPTER 7</p>

Assuming every paragraph like this is a chapter heading, you could use this regex:

Find:

<p>\sCHAPTER\s(\d+)\s</p>

Replace:

<h1>Chapter \1</h1>

That’s quite a lot to digest, but if you look carefully you can see that it’s very similar to the Page number example above in that it’s remembering the digits in the chapter name and using them in the replace.

It's the Find that is the most interesting. It breaks down like this:

<p> – Look for a starting paragraph tag.

\s – Regex code to match any white space (blanks, tabs, etc.).

CHAPTER – Match the word CHAPTER (Regex is case-sensitive by default).

\s – Regex code to match any white space.

(\d+) – Regex code to match any number of digits in a row and remember them.

\s – Regex code to match any white space.

</p> – Look for an end paragraph tag.

You could just use a space instead of \s but \s is more flexible since it will match any number of blank spaces and tabs.

So the results of that search could be:

Before:

<p>  CHAPTER    14</p>

After:

<h1>Chapter 14<h1>

It becomes more difficult to use regex if the formatting used in a file is not consistent – in these cases you may have to do several Find & Replace passes and even resort to making the updates one by one manually.

This is only a very basic description of what regex is, but it gives you an idea of what is possible. The trick with regex is getting the right find and replace strings, and that only comes from reading, asking questions, and testing.

Helpful Options

You may have noticed the extra Options in Find & Replace: DotAll, Minimal Match, and Auto-Tokenise. All of these options are useful when using Regex. If you are starting out using regex, then the recommendation is to check each of the boxes:

This is what each of the options is used for:

DotAll: This regex option prepends (?s) to all regex searches and is used when you want the ".*" pattern to match across separate lines.

Minimal Match: This regex option prepends (?U) to all regex searches and is used when you want a pattern to match the shortest occurrence instead of the longest match.

Auto-Tokenise: When using Ctrl-F on selected text to add text to Find & Replace, this will convert spaces to \s and escape certain characters so they are suitable for regex.

See the Regular Expression Reference chapter for more details.

Regular Expression Reference

— Regex Reference —

This tutorial is basically a quick reference for Regex.

Regex is a very powerful way for you to edit and cleanup your EPUB when using Find & Replace. However, when you first start using regex it can be confusing because there are a lot of commands you can use. This is a brief summary of some basic regex commands.

You can find more details about regex at these links (or ask for help in the Sigil forum):

Regex overview at MobileRead

A one page command summary

Regex as used by Python

Official PCRE details – start at the PCRESYNTAX(3) section

Overview

When using regex commands in Find & Replace the purpose is to allow you to search for patterns instead of exact text. This means that you can tell Find & Replace to search for "a number" instead of "8", or to match any words between certain tags and then replace it with new tags or new words.

In order to allow you to search for patterns, you need to use regex commands in place of the specific text you want in your search. For instance, instead of searching for 8 you could search for \d (which means one digit) or \d+ (which means one or more digits).

An example Find & Replace command using regex might be to change all level 1 headings to level 2 headings:

Find: <h1(.*?)</h1>

Replace: <h2\1</h2>

where the Find command searches for any text between the h1 start and end tags, and using () to save the text. (The start tag is left open in order to catch any class definitions, and the ? tells .* to do minimal matching). The Replace command is used to replace the matched text with the saved text (indicated by \1) surrounded by the h2 start and end tags.

The following sections give a sample of common regex commands that you may find useful.

General Modifiers:

You can put these commands at the start of any regex to modify how the expression behaves:

(?s) – search across lines when using .* since by default .* only matches within a line of text. This is done by the DotAll option in Find & Replace.

(?U) – match the first occurrence of your string (also called minimal or ungreedy matching). This is very useful when using .* to avoid matching too much. This is done by the Minimal Match option in Find & Replace.

(?i) – ignore case when matching.

You can combine modifiers, e.g. (?sU) is commonly used.

Single Characters:

You can use these regex commands to represent single characters:

. – matches one character

\d – match one digit

\t – match one tab

[abc] – any character that is a b or c

[^abc] – any character that is NOT a b or c

[0-9] – any digit from 0 to 9

[:alpha:] – any letter, upper or lower case

[^:alnum:] – any character that is NOT a digit or upper or lowercase letter

Multiple Characters:

These regex quantifiers or codes allow you to represent multiple characters:

* – use after a character to mean 0 or more, e.g. .* means 0 or more of any character

+ – use after a character to mean 1 or more, e.g. \d+ means 1 or more digits

? – use after a character to mean 0 or 1 instance, e.g. \d? means none or 1 digit

\s – matches whitespace, including space, tab, end of line carriage returns or newlines

And there is a special character that tells your search to stop at the first match it finds instead of the largest match which you can use instead of the general modifier (?U):

? – use after a quantifier to do a minimal search, e.g. .*? or \d+?

Groups:

In some cases you need to group your expressions together so that, for example, you can save them for a later replace, or to indicate a choice of words:

(atext|btext) – atext or btext

(group) – group the words together for later retrieval – you can use multiple groups

Replacing:

When replacing text, one of the most useful features is to be able to use text that was matched by storing it in a group. Once you have grouped text you can reference it in your replace command:

\1 – use in Replace to retrieve the value of a saved group (use \2 for the second group, etc.)

Tips

Here are some useful suggestions for checking that your EPUB is complete:

Use the Metadata Editor button metadata-editor_22px to set your Title, Author, and Language. And if you want, also set the Copyright, Publication Date, Subject, Description, and ISBN if there is one.

Create an HTML file for your cover, and set the file and your cover image as type Cover.

Right-click on your first text file and select Add Semantics→Text to tell ereaders that this is where the book should open to.

Use the Generate TOC button generate-toc_22px if you generated your TOC, and re-create your HTML TOC if there is one, to make sure you have the latest updates.

Test your TOC links work as expected.

Test your links, footnotes or endnotes work as expected.

Check your spelling with the Spellcheck button document-spellcheck_22px, and consider creating a separate dictionary for your book if it has lots of unique words.

Click on the Validate button document-validate_22pxto find EPUB errors then fix them – see Validation for typical error messages and what to do about them.

Check your stylesheets are valid using Tools→Validate Stylesheets with W3C.

Link your stylesheets to all files that need them.

Remove unused images, audio, or video files or unused style classes using Tools→Delete Unused…

Run Tools→Reports and look at the reports for anything unexpected (extra files, broken links, classes used but not defined, etc.).

If you are using CSS files for your styles, search for, "<style>" tags used in inline CSS, or "style=" attributes used by inline styling and convert them to CSS stylesheet files.

If you are really keen, search for and replace code like &nbsp;, <br />, empty paragraphs <p>&nbsp;</p>, empty <div></div> tags, empty attributes like src="", href="", or ="", change - to &ndash;, change ' to ’, etc. – unless of course you want to keep them. Check again if you use Book View for just one more update.

And if that isn’t too much for you, you can even scan your book in Code View line by line for unexpected formatting, especially if you’ve used Book View to make updates.

Proofread on actual ereaders. Sigil can only give an approximation of what your book will look like. Despite EPUB being a standard, there are a lot of ereader devices and software and they all have their own quirks and bugs.

And in case you missed it – test your book on actual devices and ereader software!

FAQ

— Frequently Asked Questions —

Common Questions

Does Sigil Support EPUB 3?

Sigil is an EPUB 2 editor and does not currently support all the features of EPUB 3. However it does support audio and video files which are the most often requested parts of EPUB 3, and does allow you to preserve EPUB 3 tags. A future version may support EPUB 3, but EPUB 3 ereaders are not common yet, even though some ereaders support certain parts of EPUB 3.

Why does my book look okay in Sigil but not on my device?

Every device or program that displays your book uses slightly different software. Despite EPUB being a standard, this means there may be differences in how your book appears on each device. Sigil also supports some features not in the EPUB 2 standard (such as audio, video, and various HTML 5 tags). In some cases, although it looks okay in Sigil, it may not look okay on a specific device. And in other cases, it might not look ok in Sigil but it might display fine on your ereader. You must test your book on as many devices as you can.

What are all these "&nbsp;" words in my code?

&nbsp; is a non-breaking space. If you edit in Book View you may end up with these HTML entities in your code because Book View will create them anytime it thinks you wanted one (e.g. if you type two spaces in a row it will convert one to &nbsp; so that it is not lost – multiple spaces are reduced to one space by ereaders). You can replace them with a normal space if you don’t actually need them for your text.

Where to Get Help

Where can I get help with Sigil?

If you have any questions about Sigil not covered in the Sigil User Guide, then visit the Sigil Forum at MobileRead where the users and developers of Sigil will try to help.

Where can I ask questions about EPUB?

You can post on the EPUB Forum at MobileRead if your questions are more about how to format and style something in an EPUB than how to do something in Sigil.

Where can I report bugs or request features?

Read the Reporting Issues information to submit a bug report or feature request.

Using Sigil

Sigil does not start on MAC OS 10.6?

Sigil on the MAC requires MAC OS 10.7 or later.

Is there a tutorial or manual for Sigil?

Yes – in Sigil use Help→User Guide to see an HTML version of the Sigil User Guide which also includes tutorials. Or visit the Sigil home page for a link to the HTML and EPUB versions.

Can I write my book using Sigil?

Yes, you can, but Sigil is primarily an editing program for books that have already been written in one of the many existing word processors. You may prefer to write using your favourite editor, export it to HTML, and then use Sigil to format it for EPUB. But if you really want to write and edit it in Sigil, then you certainly can – the Sigil User Guide was written completely using Sigil.

Are DOC, Mobi, KF8 formats supported?

Sigil is an EPUB editor. It can open EPUB files and import HTML files, but all other formats must be converted to HTML first before importing.

There are a lot of formats out there, and converting from one format to another is not a trivial issue. Since there are already excellent tools for converting from one format to another, Sigil will remain focused on being the best EPUB editor available.

See the Prepare Your File For Sigil chapter for more information.

To convert EPUB to Mobi or KF8 you should use Kindle tools.

How do I use Regex?

See the Regular Expressions chapter in the User Guide for more details and tips on using Regex.

Sigil won’t import my file?

Sigil can only import or open valid HTML and EPUB files. It will try to recover from some common problems in files, but if there is a significant issue (missing standard code or files) then it may be unable to open the file.

If your Preferences have Clean Source turned off, try setting it to Pretty Print Tidy as it will correct certain errors. Sometimes Sigil will give you an error message that might identify the problem with the file. In this case you may be able to open your file with a Zip or archive program and edit the files to correct them. But often the cause of the problem is not clear.

If you want to report a problem with a file that cannot load and crashes Sigil, then you must attach the EPUB file to your bug report. You can set bug reports to private so that non-developers cannot see your file. But in most cases you will need to correct the file.

Spellcheck does not handle quotes or dashes correctly?

If you install your own hunspell dictionary and it isn’t recognizing curly quotes, em-dashes, etc. then you may need additional hyphenation dictionary files. See Spellcheck Dictionary preferences in the User Guide for more details.

Text pasted into Sigil does not look right?

Pasting rich text into Sigil may not work very well. You can try to export (or convert) your text to HTML and then import the new file directly. This may preserve the formatting.

If you want to paste something as plain text, you may need to paste it into Code View to avoid preserving formatting tags.

Formatting and Styles

Why does my book display random question marks?

This may be because your original file has soft hyphens. ADE (the Adobe software that is used to display EPUB files on many systems) does not handle soft hypens. So just remove the soft hypens from your file and the question marks will go away. Look for something like &shy; or &#8209;. Basically anything “strange” that exists between those two characters. You have to look in Code View to see the raw HTML, but you can use the Reports feature to show what characters are used in the document.

It may also be because ADE cannot perform font substitution.

In Sigil, if the font you are using does not have the required glyphs to render a character present in the text, glyphs from a different font that can render it are used. This is called font substitution. So as long as some fonts on your computer can display these characters, so can Sigil.

ADE on the other hand only displays a small subset of Unicode characters by default. The supported characters are listed in the Adobe PDF Reference v1.7, Appendix D, tables D.1 and D.3.

If you want other characters than these to display in ADE, you will have to embed the required fonts.

How do I change the style of my text?

Read the Stylesheet tutorial in the User Guide – you’ll need it to make use of many of the answers in this section.

Note that ereaders may support displaying formats or styles differently and how text is display in one reader, or in Sigil, may be slightly different to how it’s displayed in another ereader.

What are stylesheets and CSS?

CSS stands for Cascading Stylesheets. See the Stylesheet tutorial in the User Guide for more details on CSS and why you should use stylesheets to format your text.

Can I embed my own fonts using Sigil?

Yes – see the Fonts tutorial in the User Guide.

What does sgc-1 mean in my document?

sgc indicates a Sigil class that is used to set the formatting style for certain parts of your text. sgc classes are automatically created for certain span tags and "style=" attributes if you have HTML Tidy turned on (Edit→Clean Source).

Why does my code have &nbsp; and <p>&nbsp;</p> entries in it?

If you edit in Book View it may insert blank spaces or other formatting text you weren’t expecting. Book View is generally for basic editing. To avoid unexpected characters you can edit in Code View, or use Find & Replace to remove/change any unexpected text.

How do I add blank lines?

Don’t. Its much better to use stylesheets to define the amount of space above or below your special sections using a style definition. For instance to leave 1.5 lines of space above a paragraph you can use this style class:

p.blankabove { margin-top: 1.5em; }

and in your text use the class with your paragraph:

<p class="blankabove">My paragraph</p>

If you really want to, you can insert a break:

<br />

or an empty paragraph:

<p>&nbsp;</p>

For multiple blank lines,it’s best to use a style to define the amount of space you want to leave.

How do I start a new page?

If you use a separate file for your page, then almost all ereaders will start a new page for your text.

How can I use an image for a Chapter heading in the TOC?

Insert your image where you want it – it will look something like this in Code View:

<img src="../Images/myimage.png" />

Add the heading tag you want to use for the image and give it a title to display in the TOC, e.g.

<h1 title="CHAPTER 1"><img src="../Images/myimage.png" /></h1>

The TOC will now have an entry called "CHAPTER 1" which links to your image.

You can even use heading tags with no text in your document if you just want a Chapter entry:

<h2 title="Chapter Subsection"></h2>

But it's probably easier just to link the TOC to the file if the image is at the top.

How do I add margins to my text?

Add this text with your preferred left and right margins to your CSS definitions:

@page {
   margin-left: 5px;
   margin-right: 5px;
}

How do I remove the white space between paragraphs?

To remove the white space between all paragraphs, add this to CSS definitions:

p {
    margin: 0;
    padding: 0;
}

This will affect only the paragraph spacing (the p means paragraph). To remove all the whitespace between the various elements and make the document look more “book like”, use this code:

body, div, p, h1, h2, h3, h4 { margin: 0; padding: 0; }

How do I add a “drop cap”?

Drop caps are not supported in all readers, but there are several ways to do a drop cap. If your book is formatted just right, it can be done just with CSS.

Add this code to your CSS definitions, which will set the text using the dropcap class in a span tag to use certain values:

span.dropcap {
    float: left;
    font-size: 4.7em;
    line-height: 0.8em;
    margin-right: 3pt;
    margin-bottom: -0.1em;
}

In Sigil, find the paragraph you want to start with a drop cap, and switch to Code View. Change the text from something like this:

<p>Hello</p>

to:

<p><span class="dropcap">H</span>ello</p>

Switch back to Book View and you should see the drop-cap.

Add <span class="dropcap"></span> around all the letters at the start of paragraphs where you want a drop cap.

You might need to adjust the values for font-size, line-height and margin-bottom to get the effect you want. Sigil’s Book View may not show exactly how it’ll appear on all ereaders, but it’s pretty close.

Why doesn’t my font show up in iBooks?

If you embed a font in your EPUB, iBooks requires a non-standard file in the EPUB to tell it to use your font. This cannot be done in Sigil.

Create a file called com.apple.ibooks.display-options.xml with a text editor and put these lines into it:

<?xml version="1.0" encoding="UTF-8"?>
<display_options>
<platform name="*">
<option name="specified-fonts">true</option>
</platform>
</display_options>

Then use an archive manager to unzip or access the EPUB file. Add the xml file you created to your EPUB in the META-INF directory, then re-zip your EPUB.

Why doesn’t my file pass EPUBCHECK due to plist?

If you open your EPUB in iTunes it will automatically add an extra .plist file to the top of the EPUB. This will cause it to fail EPUBCHECK. Do not open your EPUB in iTunes if you intend to use it elsewhere. You can unzip the EPUB and remove the file, then re-zip the file.

Contributing to Sigil

— Helping Development —

Sigil is completely free and open-source software, and it is developed and supported entirely by volunteers who love books and want well-edited ebooks to be easily available. Your entirely optional contributions can help improve Sigil and show your appreciation for making the software available. Feel free to just say hi on the Sigil forum and let others know how useful Sigil is to you.

Translating Sigil

Translating Sigil into other languages is highly encouraged. There is an active community of volunteers who translate Sigil already, and new languages can always be added.

The best way to translate Sigil is to use the web based translation system provided by Transifex. Translations done using Transifex are downloaded just before releasing a new version:

Sigil translations @ Transifex

Alternatively you can use local Desktop tools for translation. Sigil uses Qt’s Linguist tool for creating and editing translations. You can either download Qt and compile the tools manually or use the pre-built packages:

Pre-built Translation tools

Updating and creating new translation files using the Desktop tools is the same process:

Open a terminal and change to the src/Sigil/Resource_Files/ts directory. This holds all of the raw translation files.

Run lupdate ../../ * -ts out.ts to either generate a new translation file or to update an existing one with any new strings that have been added.

Use Linguist to write translations for the strings in a given ts file.

All translations files should have the form sigil_lang.ts. Where lang is a two letter language code. For example the Polish translation will have the filename sigil_pl.ts.

Assisting Users

If you are an experienced Sigil user, EPUB expert, or working your way there, you can help by answering questions or commenting on your experiences – primarily at the official Sigil Forum at MobileRead. You can also check issues on the development website and add comments.

Coding

If you are a C++ programmer and have suggestions for improvements or bug fixes you are welcome to submit patches for consideration.

Donations

Sigil is free software, but your donations are greatly appreciated.

Please use Help→Donate to say thanks and to help maintain Sigil.

The Sigil User Guide is also free. If you have found it useful, you can say thanks by donating directly to the author.