Create Perfect ePub Books from Multiple Txt Files

by JoHarrington

Sigil is a free, versatile and powerful program for converting lots of txt files into ePub format. You'll soon be reading your own work, alongside the classics, on your eReader.

It is very quick and simple to produce an eBook from your original txt documents. Unfortunately the formatting is destroyed.

For those who want a professionally rendered, multi-chaptered digital book, a little more work has to come into play. But hey! No pain, no gain! The result will be worth it.

Read on to discover how to utilize Sigil (a free program), in order to create your very own ePub book. This can then be uploaded onto your own eReader or shared with all of your friends and family.

Why Not Do it the Quick Way Through Calibre?

EPub relies upon the original formatting in your txt files. Unfortunately Microsoft Notepad isn't known for its bells and whistles.

Look at what Notepad is.  The reason that so many of us use it for our stories is that it's plain and simple; a white page upon which we add our words.

It's absolutely fit for purpose, right up until the moment that we wish to transform those chapters into an ePub format.

That's when we learn that our txt files are full of hard returns, which rip through our paragraphs like the enter button was never invented. 

This is a well known phenomenon in Notepad itself. We simply 'select all', then 'word wrap', in order to put it all back again.

There's no option to do that in the conversion into ePub.  And it will read the hard returns over anything that you formatted there.

If this doesn't matter - if you just wanted something quick and simple, without the aesthetics in place - then go for the quick way.  I've already walked you through it in a previous article.

The Quick Way to Create an ePub Book from Txt Files

Your work is scattered across several txt documents. You want them to be combined into PDF or ePub (or more), free of charge. Come right in!

If we're going to the trouble of creating ePub editions of our own multi-chapter txt files, we might as well do it properly.

This involves paragraphs beginning and ending where we want them to; a table of contents; and a front cover.  Then our own work can nestle on an equal footing alongside the literary greats. At least on our eReaders, if not the National Library.

Unfortunately, before we use the power of Sigil to make it happen, we're going to have to combine all of our txt documents into one. 

A line of command will make that a quicker process than you may have thought possible.

Classic Literature in eBook Form

Buy these digital books, so that your own ePub edition looks really great in the company.

Combining Multiple Txt Files into One

Are you planning on doing it the tedious, long-winded way? Or my way? Don't let me unduly influence your decision there.

Your mission is to take the contents of each of your txt files, then stick them into a single, very long txt file.

There are two ways to do this.  The first is to open a txt file, then copy and paste everything from the others into it.   Personally I'd rather watch paint dry.

The second is to merge them with a command line.  This is old-fashioned computing at its finest; and yes, it does still work, even though we have programs to do everything else for us these days.

So reverse!  We're going back into the matrix!

  • Create a folder called 'combine' and copy into it (in order) all of the txt files to be combined.
  • Place that file in the top folder of one of your drives.

(Actually, you can call it what you like; and put it where you like.  I'm just trying to keep things simple!)

  • Open your Run menu and type 'CMD.exe'.  (On Windows Vista or 7, click the start icon and type it into the box labelled 'Search programs and files'.)
  • Feel like a proper haXX0r as the old run command window pops up.
  • Type in the drive, where your new folder lives.  (Unless the path is already there.  If you're feeling nervous, just move your folder to whatever path IS listed as default.)
  • Type in 'cd combine' and press your enter key. (Combine being the name of your folder. If you called it something different, then use that instead.)
  • Type in 'for %f in (*.txt) do type "%f" >> mycombinedfiles.txt' and press your enter key.
  • Revel in the rush of alerts, as the files are individually combined.
  • Check your original folder to see the combined file there.

Incidentally, you don't have to call it 'mycombinedfiles.txt'.   You can call it Gladys if you like, as long as you type something in there.

Image: Run command along with the folder it's affecting
Image: Run command along with the folder it's affecting

Books about Windows Command Line Scripting

Learn more about computing. Buy any of these guides to see what else you can do in the command prompt window. (And finally understand all of the Run CMD jokes.)

Using Sigil to Create and Edit an ePub Digital Book

Sigil is a free, open source program designed specifically as an eBook editor.

One day Sigil will be up-dated to allow us to add multiple txt documents directly; and all the world will cheer.

Until then, we have to go through the rigamarole above, just to get it into the program.  But the scary (or exciting) part is over, if you're not a coder.  Now we get to do what writers do best - mess around with words.

  • Download Sigil, after choosing your operating system from the list.  (I've got Windows 7, so I went for Windows x64.)
  • Open Sigil.
  • Click 'file' on the top toolbar, then select 'open'.
  • Find your combined txt file, that you just created, and highlight it.
  • Click 'Open'.
  • Happy dance at seeing your work appear in the Sigil workbook.

You now have a perfectly formatted book before you, albeit with a new file name.  If this makes you happy, then go ahead and save it (from the file menu) as an ePub book.

But beware.  It's not only all in one long document, but each new file didn't pay attention to the return tab at the end of the previous file.

In short, you have a huge wall of text.  And each new chapter apparently starts halfway through a paragraph.  But this is easily rectified.

Image: My story inputted into Sigil
Image: My story inputted into Sigil

Professional eBook Software

Buy these eBook editors if you want to go even further than Sigil can take you.

Creating Chapters in Sigil

Or should that be 'recreating chapters in Sigil', seeing as the software made you combine them in the first place!

On the top icon toolbar, there's a button decorated with an ornate 'Ch'.

This is what you will use to split your file into its component chapters again.  

Just scroll down to where you want a new chapter to begin, and press the 'Ch' button. Each new section will form a new file.

Image: Sigil Cursor BreakNB Since writing this, Sigil has received another upgrade. The latest version hasn't got the ornate 'Ch'. But the same function exists under another name.

Click the icon that I've circled to create a chapter break at your cursor. I'm going to leave both versions here, just in case anyone is running the old one.

I don't think it matters what the file names are called. But I'm a bit pedantic over these things.  I go through each file, right-click it and select 'rename'.  Then I list my chapters 01-10.

Of far more importance is what you do next.  This will come into its own, not only for aesthetics, but in creating a table of contents.

  • Open each chapter/section.
  • Edit the top of the page to write a chapter heading.
  • Take care to select a heading style from the pull-down menu on the left-hand side.  (It doesn't matter whether you center it, justify it or leave it be, as long as you choose any of the heading styles.)
Image: Creating a heading in Sigil
Image: Creating a heading in Sigil

Creating a Table of Contents in Sigil

This is where adding and standardizing your headers comes into its own.

All of the hard work is finished now.  All that's left is making use of what's gone before.

Sigil has its own automatic table of contents program.  You can access it either by clicking on 'view' from the top toolbar and selecting 'table of contents' from the bottom of the pull-down menu; or by pressing Alt + F3 on your keyboard.

A window will pop up, probably with the word 'start' in it.  But ignore that.  Go to the bottom instead, and click where it says 'Generate TOC from headings'.

A second pop-up window will come up.  All of the chapter titles that you just created will be listed there.  You have the option to untick any that you don't want listed.  Otherwise tick the 'TOC items only' box and then 'Ok'.

Your chapter headings have now created the Table of Contents, which is displayed in the TOC box.

Save it all as ePub from the file menu.

Image: Creating a Table of Contents (TOC) in Sigil
Image: Creating a Table of Contents (TOC) in Sigil

Learn More About Great Book Covers

Buy these books to discover how to create a stylish, professional and enduring cover for your eBook.

Adding a Front Cover in Sigil

We might as well go the whole hog, now that we're here.

You can add images anywhere in your ePub document. 

By right-clicking the images folder, then selecting 'add existing file', you can upload any picture from your computer.  They can be inserted into the pages, as often as you like, by clicking on the image button in the top icon toolbar.

But that's by-the-by.  What you really want to know is how to insert a cover page, that will look fantastic, when your eBook is sitting alongside Shakespeare and the Bronte sisters. Am I right?

This is incredibly simple to do in Sigil. 

  • Open an art program and create the best book cover in the history of the universe. (Or, if you're me, nick a picture out of Pixabay and slap a title on it in Paint.)
  • Right click the image folder and select 'add existing file'.
  • Find and add your book cover.
  • Right-click the image, when it's in Sigil, and rename it 'cover'.
  • Right-click the cover image and select 'Add Semantics'.
  • Ensure that 'Cover Image' is selected and ticked. (It may already be done for you.)
  • Right-click the text folder and select 'add blank section'.
  • Rename this 'cover'.
  • Use the image icon to add your cover image.
  • Right-click the cover document and select 'Add Semantics'.
  • Choose 'cover'.

That's it.  The eReader will now recognize that you have a front cover.  You didn't have to do this as an image by the way.  You could have just used that blank document to add a title page.

Image:  Adding a cover page using Sigil
Image: Adding a cover page using Sigil

Filling in the Metadata on Sigil

This is the final step; and probably the quickest part of all.

There's not a lot that I can say about this, other than it's worth doing. Your book will come complete with title and author name in your eReader library.

  • Select 'Edit' from the top toolbar.
  • Open 'Meta Editor'.
  • Fill in the information.

And that is actually the end.  All that you need do now is save your project as an eBook, then upload it onto your eReader. Happy reading!

Learn How to Upload your eBook onto your eReader

This article has a section on it towards the end.
Your work is scattered across several txt documents. You want them to be combined into PDF or ePub (or more), free of charge. Come right in!

Use This ePub Formatted eBook to Make a Perfect PDF

If you now run the ePub version of your story through Calibre, you can turn it into a PDF.  This will eliminate all of the issues which makes PDFs difficult to peruse on eReaders.

The page numbers will be consecutive, from the beginning of the eBook to the end, rather than counting only the pages in each chapter.  The font will be bigger; and the pages will fit neatly into your eReader screen size.

In short, the PDF will look and feel like an ePub document.  But it will be a heftier version, taking up much more memory than the it would leaving it as an ePub.

For more information about txt documents as PDF, and the use of Calibre, see the article above.

The Finished Product!

This is the eBook, in ePub format, which I have just created in Sigil. It works perfectly in Kobo, with beautiful formatting and a table of contents.
Image:  My ePub Digital Book on Kobo
Image: My ePub Digital Book on Kobo

Buy a Kobo from Amazon

The one that I use is a Kobo Wifi Touch. It will accept your home-made eBooks too!

More of my Geek Articles

Let me introduce you to my old friends SUPERAntiSpyware and MalwareBytes' Anti-Malware. They do what they say on the tin.
Frustrated by trying to fix a computer by telephone? Crossloop is a free must-have for family go-to geeks everywhere.
PC monitors are expensive items. You do not want to be squirting household cleaning products all over them.
If you are getting pain or a tingling sensation in your wrist, then maybe it's time to change your mouse. I have just the one for you!
Updated: 05/07/2014, JoHarrington
Thank you! Would you like to post a comment now?


Only logged-in users are allowed to comment. Login
JoHarrington on 09/10/2012

I was in my element! I like nothing more (except writing maybe :p ) than being thwarted by software, and working out how to make it do what I want it to. :D I'm glad that it's useful to you too.

And I'm looking forward to seeing your series in ebook format, so I can download and read them.

katiem2 on 09/10/2012

Now you're talking, this is very useful and highly sought after information! I have several series written and ready to be formatted to ebook format. Oh the time... ;)K

You might also like

How to Convert Multi-Chapter Txt Files Into eReader Formats

Your work is scattered across several txt documents. You want them to be com...

Why I Chose Kobo Over Kindle

I could have had a Kindle. I could have had a Nook, Sony or any e-Reader I f...

Disclosure: This page generates income for authors based on affiliate relationships with our partners, including Amazon, Google and others.
Loading ...