% language=uk \startcomponent hybrid-ebooks \environment hybrid-environment \startchapter[title={E-books: Old wine in new bottles}] \startsection [title={Introduction}] When Dave Walden asked me if \TEX\ (or \CONTEXT) can generate ebooks we exchanged a bit of mail on the topic. Although I had promised myself never to fall into the trap of making examples for the sake of proving something I decided to pick up an experiment that I had been doing with a manual in progress and look into the \HTML\ side of that story. After all, occasionally on the \CONTEXT\ list similar questions are asked, like \quotation {Can \CONTEXT\ produce \HTML ?}. \footnote {This text appeared in the \EUROTEX\ 2011 proceedings and TUGBoat 101. Thanks to Karl Berry for correcting it.} \stopsection \startsection [title={Nothing new}] When you look at what nowadays is presented as an ebook document, there is not much new going on. Of course there are very advanced and interactive documents, using techniques only possible with recent hardware and programs, but the average ebook is pretty basic. This is no surprise. When you take a novel, apart from maybe a cover or an occasional special formatting of section titles, the typesetting of the content is pretty straightforward. In fact, given that formatters like \TEX\ have been around that can do such jobs without much intervention, it takes quite some effort to get that job done badly. It was a bit shocking to notice that on one of the first e-ink devices that became available the viewing was quite good, but the help document was just some word processor output turned into bad|-|looking \PDF. The availability of proper hardware does not automatically trigger proper usage. I can come up with several reasons why a novel published as an ebook does not look much more interesting and in many cases looks worse. First of all it has to be produced cheaply, because there is also a printed version and because the vendor of some devices also want to make money on it (or even lock you into their technology or shop). Then, it has to be rendered on various devices so the least sophisticated one sets the standard. As soon as it gets rendered, the resolution is much worse than what can be achieved in print, although nowadays I've seen publishers go for quick and dirty printing, especially for reprints. Over a decade ago, we did some experiments with touch screen computers. They had a miserable battery life, a slow processor and not much memory, but the resolution was the same as on the now fashionable devices. They were quite suitable for reading but even in environments where that made sense (for instance to replace carrying around huge manuals), such devices never took off. Nowadays we have wireless access and \USB\ sticks and memory cards to move files around, which helps a lot. And getting a quality comparable to what can be done today was no big deal, at least from the formatting point of view. In the \CONTEXT\ distribution you will find several presentation styles that can serve as bases for an ebook style. Also some of the \CONTEXT\ manuals come with two versions: one for printing and one for viewing on the screen. A nice example is the \METAFUN\ manual (see \in {figure} [fig:metafun]) where each page has a different look. \placefigure [here] [fig:metafun] {A page from the \METAFUN\ manual.} {\externalfigure[ebook-metafun-2.png][width=\textwidth]} It must be said that the (currently only black and white) devices that use electronic ink have a perceived resolution that is higher than their specifications, due to the semi|-|analog way the \quote {ink} behaves. In a similar fashion clever anti|-|aliasing can do wonders on \LCD\ screens. On the other hand they are somewhat slow and a display refresh is not that convenient. Their liquid crystal counterparts are much faster but they can be tiresome to look at for a long time and reading a book on it sitting in the sun is a no|-|go. Eventually we will get there and I'm really looking forward to seeing the first device that will use a high resolution electrowetting \CMYK\ display. \footnote {http://www.liquavista.com/files/LQV0905291LL5-15.pdf} But no matter what device is used, formatting something for it is not the most complex task at hand. \stopsection \startsection[title={Impact}] Just as with phones and portable audio devices, the market for tablets and ebook|-|only devices is evolving rapidly. While writing this, at work I have one ebook device and one tablet. The ebook device is sort of obsolete because the e-ink screen has deteriorated even without using it and it's just too slow to be used for reference manuals. The tablet is nice, but not that suitable for all circumstances: in the sun it is unreadable and at night the backlight is rather harsh. But, as I mentioned in the previous section, I expect this to change. If we look at the investment, one needs good arguments to buy hardware that is seldom used and after a few years is obsolete. Imagine that a family of four has to buy an ebook device for each member. Add to that the cost of the books and you quickly can end up with a larger budget than for books. Now, imagine that you want to share a book with a friend: will you give him or her the device? It might be that you need a few more devices then. Of course there is also some data management needed: how many copies of a file are allowed to be made and do we need special programs for that? And if no copy can be made, do we end up swapping devices? It is hard to predict how the situation will be in a few years from now, but I'm sure that not everyone can afford this rapid upgrading and redundant device approach. A friend of mine bought ebook devices for his children but they are back to paper books now because the devices were not kid|-|proof enough: you can sit on a book but not on an ebook reader. The more general devices (pads) have similar problems. I was surprised to see that an iPad is a single user device. One can hide some options behind passwords but I'm not sure if parents want children to read their mail, change preferences, install any application they like, etc. This makes pads not that family friendly and suggests that such a personal device has to be bought for each member. In which case it suddenly becomes a real expensive adventure. So, unless the prices drop drastically, pads are not a valid large scale alternative for books yet. It might sound like I'm not that willing to progress, but that's not true. For instance, I'm already an enthusiastic user of a media player infrastructure. \footnote {The software and hardware was developed by SlimDevices and currently is available as Logitech Squeezeserver. Incidentally I can use the iPad as an advanced remote control.} The software is public, pretty usable, and has no vendor lock|-|in. Now, it would make sense to get rid of traditional audio media then, but this is not true. I still buy \CD{}s if only because I then can rip them to a proper lossless audio format (\FLAC). The few \FLAC s that I bought via the Internet were from self|-|publishing performers. After the download I still got the \CD{}s which was nice because the booklets are among the nicest that I've ever seen. Of course it makes no sense to scan books for ebook devices so for that we depend on a publishing network. I expect that at some point there will be proper tools for managing your own electronic books and in most cases a simple file server will do. And the most open device with a proper screen will become my favourite. Also, I would not be surprised if ten years from now, many authors will publish themselves in open formats and hopefully users will be honest enough to pay for it. I'm not too optimistic about the latter, if only because I observe that younger family members fetch everything possible from the Internet and don't bother about rights, so we definitely need to educate them. To some extent publishers of content deserve this behaviour because more than I like I find myself in situations where I've paid some 20 euro for a \CD\ only to see that half a year later you can get it for half the price (sometimes it also happens with books). Given that eventually the abovementioned problems and disadvantages will be dealt with, we can assume that ebooks are here and will stay forever. So let's move on to the next section and discuss their look and feel. \stopsection \startsection[title={Interactivity}] The nice thing about a paper book is that it is content and interface at the same time. It is clear where it starts and ends and going from one page to another is well standardized. Putting a bookmark in it is easy as you can fall back on any scrap of paper lying around. While reading you know how far you came and how much there is to come. Just as a desktop on a desktop computer does not resemble the average desktop, an ebook is not a book. It is a device that can render content in either a given or more free|-|form way. However, an electronic book needs an interface and this is also where at the moment it gets less interesting. Of course the Internet is a great place to wander around and a natural place to look for electronic content. But there are some arguments for buying them at a bookshop, one being that you see a lot of (potentially) new books, often organized in topics in one glance. It's a different way of selecting. I'm not arguing that the Internet is a worse place, but there is definitely a difference: more aggressive advertisements, unwanted profiling that can narrow what is presented to a few choices. Would I enter a bookshop if on the display tables there were stacks of (current) ebook devices showing the latest greatest books? I can imagine that at some point we will have ebook devices that have screens that run from edge to edge and then we get back some of the appeal of book designs. It is that kind of future devices that we need to keep in mind when we design electronic documents, especially when after some decades we want them to be as interesting as old books can be. Of course this is only true for documents that carry the look and feel of a certain time and place and many documents are thrown away. Most books have a short lifespan due to the quality of the paper and binding so we should not become too sentimental about the transition to another medium. Once you're in the process of reading a book not much interfacing is needed. Simple gestures or touching indicated areas on the page are best. For more complex documents the navigation could be part of the design and no screen real estate has to be wasted by the device itself. Recently I visited a school|-|related exhibition and I was puzzled by the fact that on an electronic schoolboard so much space was wasted on colorful nonsense. Taking some 20\% off each side of such a device brings down the effective resolution to 600 pixels so we end up with 10 pixels or less per character (shown at about 1 cm width). At the same exhibition there were a lot of compensation programs for dyslexia advertised, and there might be a relationship. \stopsection \startsection[title={Formatting}] So how important is the formatting? Do we prefer reflow on demand or is a more frozen design that suits the content and expresses the wish of the author more appropriate? In the first case \HTML\ is a logical choice, and in the second one \PDF\ makes sense. You design a nice \HTML\ document but at some point the reflow gets in the way. And yes, you can reflow a \PDF\ file but it's mostly a joke. Alternatively one can provide both which is rather trivial when the source code is encoded in a systematic way so that multiple output is a valid option. Again, this is not new and mostly a matter of a publisher's policy. It won't cost more to store in neutral formats and it has already been done cheaply for a long time. Somewhat interfering in this matter is digital rights management. While it is rather customary to buy a book and let friends or family read the same book, it can get complicated when content is bound to one (or a few) devices. Not much sharing there, and in the worst case, no way to move your books to a better device. Each year in the Netherlands we have a book fair and bookshops give away a book specially written for the occasion. This year the book was also available as an ebook, but only via a special code that came with the book. I decided to give it a try and ended up installing a broken application, i.e.\ I could not get it to load the book from the Internet, and believe me, I have a decent machine and the professional \PDF\ viewer software that was a prerequisite. \stopsection \startsection[title={Using \TEX}] So, back to Dave's question: if \CONTEXT\ can generate ebooks in the \EPUB\ format. Equally interesting is the question if \TEX\ can format an \EPUB\ file into a (say) \PDF\ file. As with much office software, an \EPUB\ file is nothing more than a zip file with a special suffix in which several resources are combined. The layout of the archive is prescribed. However, by demanding that the content itself is in \HTML\ and by providing a stylesheet to control the renderer, we don't automatically get properly tagged and organized content. When I first looked into \EPUB, I naively assumed that there was some well|-|defined structure in the content; turns out this is not the case. Let's start by answering the second question. Yes, \CONTEXT\ can be used to convert an \EPUB\ file into a \PDF\ file. The natural followup question is if it can be done automatically, and then some more nuance is needed: it depends. If you download the \EPUB\ for \quotation {A tale of two cities} from Charles Dickens from the Gutenberg Project website and look into a chapter you will see this: \starttyping