Archive for June, 2015

Teaching TextMate a new trick

I recently had to switch to TextMate 2 because I had upgraded to OSX 10.10 Yosemite, and my trusty old version of TextMate was no longer fully operational. Some of the bundles I am routinely using when formatting eBooks crashed Ruby, making them useless.

One of the features I constantly use is the “Wrap Each Selected Line in Open/Close Tag” command from the HTML Bundle. It is one of the most important commands I use when formatting eBooks, because it allows me to automatically wrap every paragraph in a text in <p> and its corresponding </p> tags.

After the update to TextMate 2 I found, however, that the functionality was no longer what I really expected. Instead of wrapping everything in <p> tags, I found my text wrapped in <li> tags instead, which was not very useful. Actually, it was not useful at all. It was detrimental.

I’ve done a little bit of TextMate Bundle coding myself in the past to create streamlined commands that help me format eBooks much faster. They have become essential part of my everyday tool chain. Seeing the unexpected behavior of the TextMate 2 bundle I decided to simply dive into the Bundle Editor and change the default behavior of the “Wrap Each Selected Line in Open/Close Tag” command to my needs.

If you want to do the same, here’s how you’d go about it. Simply open the Bundle Editor by selecting “Edit Bundles” from the “Bundle” menu in TextMate. Next, select the HTML entry in the list that appears on the left hand side of the window. You will now see a number of entries appear in the second column of the window. We want to drill into the one called “Menu Actions” and then the one called “Wrap Each Selected Line in Open/Close Tag”.

droppedImage

In the lower window that contains the code portion of the command, you will find the following lines

#!/bin/bash
[[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] && . "${TM_SUPPORT_PATH}/lib/bash_init.sh"
perl -pe 's/[\$`\\]/\\$&/g; s/([ \t]*)(.+)/$1<\${1:li}>$2<\/\${1\/\\s.*\/\/}>/'

As you can see, in the jumble of the regular expression there is a reference to the unwanted “li” tag. All we have to do is change that entry to “p” instead and make the line look like this

#!/bin/bash
[[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] && . "${TM_SUPPORT_PATH}/lib/bash_init.sh"
perl -pe 's/[\$`\\]/\\$&/g; s/([ \t]*)(.+)/$1<\${1:p}>$2<\/\${1\/\\s.*\/\/}>/'

Once you’ve done that, hit Ctrl-S to save the change, and you’re done. Whenever you now press the Shift-Control-Command-W keys or select “Wrap Each Selected Line in Open/Close Tag” from the Bundle menu, every paragraph of your text will be neatly wrapped with the correct <p> tags.

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Feeling lucky? You should, because I can feel that today is your lucky day. All you have to do is enter in Covertopia’s Give-away, and keep your fingers crossed. You may just win a cool cover for your next book! Heck, I’ll even throw in the formatting for your book.

As you may know, Covertopia.com is a new service provider that I am closely affiliated with. Primarily, the website offers pre-designed covers for authors at an affordable price with an almost instant turn-around time. With a catalog of almost 200 instantly available premade covers at this point, from many genres, you can win any one of these covers for your own book.

CoverTopia_Logo

Participating is easy and you will be helping us spread the word to the community, to make sure more and more authors hear about Covertopia.com. It will enable us to make even more covers, make even cooler covers, create a wider variety of covers, and you can be instrumental in the process.

The way it works is really simple. Go to Covertopia’s give-away page and share info about this give-away on your social network, tweet about it, Facebook about it, or post your favorite cover on Pinterest, and earn points for the give-away. The more points you have, the better your chance of winning—it is that easy! You can even earn points by signing up to my newsletter, liking the Covertopia Facebook page, following on Twitter and more.

Just head on over there and take a look for yourself for the full details, and please, help us letting other writers out there know that the perfect cover for their book might already be waiting for them at Covertopia.com.

Thank you so much for your support! If you want to, you can also submit your entries right here! Keep in mind you can come back every day during the duration of the give-away to collect more entries.

a Rafflecopter giveaway

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Over the past weeks I’ve been reading a number of non-fiction eBooks—don’t ask me, why, it just happened for some reason. The interesting thing is that I noticed a number of recurring eBook formatting problems that permeated virtually each one of these books, and I thought I’d touch upon the subject for a change.

The problem in question revolves around terms that should be treated as a unit. Take a look at the screenshot and see if you can figure out what’s wrong with it.

bent1

The problem her is, of course, the way the term “30 days” has been line wrapped—twice actually, and the term 1,667 words has been wrapped also. Plenty of bad formatting going on here!

When you have something like this term, a professional typesetter will always make sure that the individual words in the term will not be word-wrapped… ever. There is nothing worse than having the number “30” on one line and the word “days” on the next, or worse yet, on the next page. It just doesn’t look professional and instantly gives off a whiff of amateur that you do not want in your book.

Certain terms need to stick together like Laurel and Hardy

In novels this is oftentimes not such an acute problem, because most authors would actually write “thirty days” instead, which can be wrapped perfectly fine, but by their very nature, non-fiction books often wrangle a lot of data and as such it is no surprise that I found the error striking in the past weeks in particular.

Naturally, the same applies to terms,such as “3 months,” “4 years,” “5 minutes,” “10 dollars” and so forth. Other occasions where you may find terms that should never be wrapped is in dates, for example, such as “November 5,” “Day 3,” “3 AM” or even in situations like a “1964 Mustang” or a “1953 Corvette.”

The most prevalent occurrence of such terms, in both fiction and non-fiction is on cases, such as “Mr. Potter,” “Mrs. Bates,” or “Dr. Jekyll,” and one could even go as far as applying the rule to terms such as “Agent Mulder.”

The solution to the problem is fairly simple, really. If you are formatting your eBook in HTML, you simply replace the space between the words of the term with a non-breaking space character, like this: 30&nbsp;days. This way, you disallow the eBook software to break apart the entity.

The solution: Prevent word-wrapping with non-breakable space characters

To achieve this one can use a very simple Regular Expression to isolate the cases. The concept is to search for one of multiple digits, followed by a space character, followed by a letter.

A simple search expressions like this

([0-9]) ([a-zA-Z])

will locate such instances. I do not recommend simply running a replacement on this search, however, because there would be too many false positives. Instead, simply go through them one by one and decide whether they need to be adjusted or not. I know, this is time-consuming, but that’s part of the reason why professional ebook formatting costs a bit of money.

bent2

As you know, I do not recommend exporting eBooks straight from word processors, but I do understand that many authors do so nonetheless. It is possible to avoid this kind of word-wrapping in word processors as well, by replacing the space character with a Ctrl-space character. And voilà…

If you can actually make this practice to use Ctrl-space in all the right places part of your general writing habit, all the better, you will be properly prepared right off the bat, and you will make the life of your eBook formatter a whole lot easier.

The thing about this kind of eBook formatting error is that it is not something that readers would report to you, but it is wrong nonetheless. It gives authors the impression that nothing is wrong with the eBooks, when, in fact, there are formatting errors in it. Many such issues can be evidenced in eBooks, pitfalls that most people are not aware of but that hinder the reading flow and somehow give off a bad impression.

That’s why it make sense to hire professionals to handle your eBook formatting. Someone with credentials, someone who understands actual typesetting, in order to make sure these kinds of things don’t happen.

Will you take a look at your books and see if you’ve been a victim of this particular pitfall?


ZenCover
Zen of eBook Formatting is currently on sale for only $2.99 instead of its original $5.99 price!

If you want to keep up with my eBook formatting work, don’t forget to subscribe to my Newsletter. That way I can keep you updated about the latest developments, updates to my books, code snippets, techniques and formatting tips.

Also, don’t forget to check out my book Zen of eBook Formatting that is filled with tips, techniques and valuable information about the eBook formatting process.

Facebooktwittergoogle_plusredditpinterestlinkedinmail