eBook Creation With Scrivener

Does anyone use Scrivener for eBook creation? I know I can use Compile & Print then save as PDF but I can’t seem to get the chapters formatted correctly (ie, a new chapter starts at a new page).

Also, I cant figure out how to add a header/footer image on every page of the book.

Are there any guides for using Scrivener for actual eBook creation and formatting.

I love scrivener for writing and I would love to be able to use it for eBook creation.

Thanks everyone!

In the Compile Draft window, under ‘content’, check the box in the first column after your chapter-name. It says ‘Pg break before’ (so every chapter will start at a new page)

The header/footer image is beyond the scope of Scrivener. You may want to export to a .doc and fix that in Pages/Neoffice/Word.
You may be able to do it in LaTeX, but I have too little experience with it (and it has been a while) to be sure you can.

hope this helps,

Tanja

You can do pretty much anything in LaTeX. The question isn’t whether something is possible, but whether you want it badly enough to tolerate the necessary level of pain and suffering.

IIRC–and it’s been a very long time-- setting up headers and footers in LaTeX is pretty easy. Incorporating an image is probably only a matter of showing LaTeX where to find the appropriate file.

Katherine

Hmm maybe I should look into this. It’s been a few months since I seriously looked into LaTeX, but I do remember figuring out at some point how to add an image to the chapter number. Don’t know how exactly (I’d have to go and find those files) but it did work just by adding 1.png and 2.png to the same directory as the LaTeX file itself. I’m guessing that creating a header/footer image would also simply require them in the same directory.
Hmm… maybe I’ll look into this.

Tanja

Thanks for the help guys! I will definitely look into these options :slight_smile:

I found a way to put a small image in the header / footer by using LaTeX. The basics turned out pretty easy, I had done most of the research / work when I wanted to add an image based on chapter (cause my boyfriend said ‘Wouldn’t it be cool if your book had images at the start of the chapter? Just like those old children’s books!’ and I couldn’t let that one slide).
I’m still fine-tuning, but if you’re interested and willing to do a little funky stuff like creating your own XLST file (not that hard really, you can mostly copy an existing one or perhaps I can upload mine).

cheers,

Tanja

Tanja,

I’m definitely interested :slight_smile: I appreciate it!

Peter

I’ve done most of the fine-tuning, could you let me know what image you’d want in the header/footer? Mostly the width-height in pixels, but if you want to attach it (or anything with the same size) to this post, that would work too.

I have assumed that you’d still want chapters to start on a new page (leaving previous page partially blank) and because it’s an ebook I’ve set the page-numbering to right on all pages. I can easily change this though.

With the image I can easily make an example pdf and describe the process of making it.

cheers,

Tanja

All right, I have tinkered enough!

I have attached ‘ebook.xslt’, which you should place in ~/Library/Application Support/Multimarkdown/XSLT right next to the other xslt-files.

In Scrivener you can set the header and/or footer image through the MultiMarkdown Settings panel. Add a ‘Headerimg’ and/or ‘Footerimg’ as the key and on the right fill in the name of the image. You don’t have to use the extension, as LaTeX will search for appropriate files apparently. As far as I know .jpg, .png and .eps will all work.
In the settingspanel also set the key ‘Latex XSLT’ to ‘ebook.xslt’

Once you have finished your document (remember to use Multimarkdown markup :wink: ) you can compile and export to LaTeX. Make sure you place the image(s) you want to use in the same directory as the resulting .tex file.

Use whatever you use to convert the LaTeX file to PDF.

I personally use TextMate because I can easily edit MultiMarkdown files in it and convert them to LaTeX from there, should I ever run into problems.

Should you want to use ebook.xslt but don’t want to use a headerimage, I recommend changing the following line either in ebook.xslt if you want to use it always, or in the resulting .tex file:

\setulmargins{*}{120pt}{*}

For a no headerimg document change it to:

\setulmargins{*}{110pt}{*}
(or something else if you like that better)

Slightly lowering this will make the resulting document look better.

Also, pay attention to the following line:

\setcounter{page}{4}

You can remove this without problems. I put it in because I found quite a few ebooks that would start the first chapter at page 1, but reading it in a PDF-reader would show that was page 4 (or 5 or 6) and any reference to another page got a bit messed up, due to the unsynchronised pages and page-numbers. For a table of contents, you need to run whatever you use to create the pdf twice, normally. After the first time you can check the actual page the first chapter starts on page 4 or not (sometimes the table of contents will overflow onto the next page, so keep that in mind when you have lots of chapters and sections and such). You can change the number 4 to any other number to fit the actual pagenumbering or remove it completely if you don’t mind the unsynchronised pages.

Anyway, enjoy.

Tanja
ebook.xslt.zip (2.93 KB)

hmm… does this really work? I get more than one LaTeX error when I try to compile the output of your ebook.xslt. :frowning:

I don’t use the memoir class, so I find I difficult to figure out what’s going wrong here. For starters it should help to remove the redundant calls of \usepackage[utf8]{inputenc} as well as the chapterstyle definitions that are not used in the document. The memoir class also has its own mechanism to set up headers and footers, which might clash with the fanyhdr package, so it’s a good idea to use the built-in macros. Off the top of my head:

\makepagestyle{newpagestyle} \makeevenhead{newpagestyle}{}{\includegraphics[height=40pt]{\myheaderimg}}{} ...
The new pagestyle should now work with LaTeX’s \pagestyle or \thispagestyle commands, except for chapters (which have the ‘plain’ pagestyle by default). Luckily, memoir.cls has a command to override pagestyles:

\aliaspagestyle{chapter}{newpagestyle} 

Hope that helps

It did give some errors but produced a pdf nonetheless. So it sort of worked :wink:

However, with your info I managed to remove the errors mostly. If either the header or footer image is not defined, I’ll get a ‘file not found `’ ’ message, which seems safe to ignore (that or I’ll try to see if I can come up with a ‘blank image’ just in case)

The info you provided filled the gap! I had looked for a way to change the header and footer to suit my needs and google kept on giving me the fancyhdr package. One of the sites said that the memoir class had a very limited header/footer adjustment and if you wanted fancy stuff, use fancyhdr.
I have since learned that this info is outdated and with your example I easily found the instructions in the memoir manual, which made everything soooo much easier. It takes away the need to manually adjust anything margin-related, the top and bottom margins stay the same even if you only specify either the header or the footer image.

I’m very new to all this LaTeX stuff, so I went for the memoir class because that’s basically the first I bumped into (I think Fletcher uses it in his example).

Hopefully, it works better this time.

Tanja
ebook.zip (2.48 KB)