tag:blogger.com,1999:blog-7101933101966798446.post3623599246770134960..comments2024-03-28T10:33:06.910-07:00Comments on The View from Aristeia: Effective C++11: BackgroundScott Meyershttp://www.blogger.com/profile/05280964633768289328noreply@blogger.comBlogger23125tag:blogger.com,1999:blog-7101933101966798446.post-15917365186818738852013-02-01T12:53:59.361-08:002013-02-01T12:53:59.361-08:00@Scott
That's not always feasible but I take ...@Scott<br /><br />That's not always feasible but I take your point. Most of the code I am wrapping this is not an issue or I specifically handle those differently.<br /><br />Regards<br /><br />JamesJames Turnbullhttps://www.blogger.com/profile/09620938547957003750noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-106996198654723242013-02-01T09:59:38.624-08:002013-02-01T09:59:38.624-08:00@James Turnbull: Figuring out where to break a lin...@James Turnbull: Figuring out where to break a line is a challenge, but equally challenging is figuring out what the appropriate indentation of the wrapped part of the line is. And if what's being wrapped is a "//" comment or a string literal, simple wrapping will introduce a syntax error. My feeling is that if an author wants to maximize the likelihood that readers will see well-formatted code, that author has to take steps to minimize the likelihood that code displays will get wrapped by anybody other than the author.<br /><br />ScottScott Meyershttps://www.blogger.com/profile/05280964633768289328noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-52374724026819822262013-02-01T05:35:47.256-08:002013-02-01T05:35:47.256-08:00LaTeX using the Listings (or similar) packages is ...LaTeX using the Listings (or similar) packages is generally pretty good at auto-breaking lines and has a variety of options to configure the right bhavior (break on whitespace or not, etc). I use the following code to break the lines:<br /><br />\lstset{<br />prebreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\rhookleftarrow}},<br />breakindent=10pt,<br />breaklines=true,<br />breakatwhitespace=false<br />}<br /><br />You need a font that contains the Unicode character.James Turnbullhttps://www.blogger.com/profile/09620938547957003750noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-91966619507375149892013-02-01T00:13:19.465-08:002013-02-01T00:13:19.465-08:00Just an unicode character (↩). He uses it at some ...Just an unicode character (↩). He uses it at some long line logs in source code blocks at the free sample chapter.Anonymoushttps://www.blogger.com/profile/11653390099233773707noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-58771857117802545222013-02-01T00:07:50.176-08:002013-02-01T00:07:50.176-08:00@Scott Meyers, Sure, in truth I also disliked font...@Scott Meyers, Sure, in truth I also disliked font size variation. The last book I mention (The logstash Book), seems to use some nice arrow for line continuation, that the author also use in his own blog.Anonymoushttps://www.blogger.com/profile/11653390099233773707noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-86262089076412685072013-01-31T21:39:53.227-08:002013-01-31T21:39:53.227-08:00@ Francisco Lopes: Regarding Developing Backbone....@ Francisco Lopes: Regarding Developing Backbone.js Applications, I just downloaded the epub for chapter 2 and viewed it in Firefox (using EPUBReader 1.4.2.1). I agree that it looks nice, but the source code is blindly wrapped when the window isn't wide enough, and you need a pretty wide window to accommodate this on one line:<br /><br />console.log("I should " + todo.get("title") + ". Have I done it before? " + (todo.get("completed") ? 'Yeah!': 'Not.' ));<br /><br />I am unaware of any general automatic mechanism for wrapping code, so for the time being, I think that good code displays are dependent on proper care on the part of the author when s/he write the manuscript.<br /><br />ScottScott Meyershttps://www.blogger.com/profile/05280964633768289328noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-55032406043334174782013-01-31T09:40:37.293-08:002013-01-31T09:40:37.293-08:00Another promising one: Sample PDF Chapter;
Author...Another promising one: <a href="http://www.logstashbook.com/" rel="nofollow"> Sample PDF Chapter</a>;<br />Author's pandoc tip: <a href="http://www.kartar.net/2012/12/listing-captions-with-delimited-code-blocks-and-pandoc/" rel="nofollow">Listing captions with delimited code blocks and Pandoc</a>;<br />Author's experience with his publisher (same one as Pro Git) and self publishing:<a href="http://www.kartar.net/2013/01/lessons-from-self-publishing---part-i/" rel="nofollow"> Lessons from self-publishing - Part I </a>.Anonymoushttps://www.blogger.com/profile/11653390099233773707noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-35370865780135671362013-01-31T06:42:59.929-08:002013-01-31T06:42:59.929-08:00I just checked another markdown/pandoc based book ...I just checked another markdown/pandoc based book (produced in the open, I think there's nothing as modern as this): <a href="https://github.com/addyosmani/backbone-fundamentals" rel="nofollow">Developing Backbone.js Applications</a>. It's still in-progress but already look awesome. I've downloaded the prebuilt epub from the repository and opened on chrome with <a href="http://www.magicscroll.net" rel="nofollow">magicscroll</a> (with small fonts and default theme set). All I expect from good source code formatting is there, the only caveat seems it's still not built with night mode in mind (and by being produced in the open, he is able to be readily warned of that by his audience). Since the epub is able to look this good, the print and pdf can only be better (generally epub or other true ebook format is the least common factor in presentation goodness).Anonymoushttps://www.blogger.com/profile/11653390099233773707noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-59375131919819665412013-01-31T05:43:46.442-08:002013-01-31T05:43:46.442-08:00To my surprise (or not), I just that checked pando...To my surprise (or not), I just that checked pandoc documentation gives Pro Git as an example for ebook creation with its system (<a rel="nofollow">http://johnmacfarlane.net/pandoc/epub.html</a>). For me, this is a special, right in the spot, kind of guess, I was expecting Pro Git to only be built with something like that (given deployment to web page even), and just found it out to be true.Anonymoushttps://www.blogger.com/profile/11653390099233773707noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-62066861818022712582013-01-31T04:18:25.867-08:002013-01-31T04:18:25.867-08:00But, anyway, achieving good source code indentatio...But, anyway, achieving good source code indentation (maybe with some highlighting), never inside images is enough to make one e-book reader more happy. These critical points being properly addressed at deploying on multiple targets, despite the toolset, is what matters. If it can be done in Word, let's do it in Word then. Anonymoushttps://www.blogger.com/profile/11653390099233773707noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-5920832786909708332013-01-31T04:02:36.365-08:002013-01-31T04:02:36.365-08:00@Scott Meyers, I'm not totally convinced by th...@Scott Meyers, I'm not totally convinced by that point, when I said that they look produced with a proper typesetting system, I talk of someone with familiarity with it and willing to have more control of the final form (like Pro Git looks).<br /><br />By the source/object metaphor, there're times one is indeed able to look and know something was produced with bias for a given platform, and hence, in the given platform, and also one can guess just by looking at sources solely, it was written with a given toolset or not. Like in, "even thought multiplatform, this code is from a microsoft guy, look at this hungarian notation!".<br /><br />I mean that, the background environment one thing is produced, often times reverberates in its form. And I meant of making inference and judgement (and wrong guesses) from this point of view.Anonymoushttps://www.blogger.com/profile/11653390099233773707noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-21997301000227338522013-01-30T20:54:40.057-08:002013-01-30T20:54:40.057-08:00@Francisco Lopes: I don't view Word as a way t...@Francisco Lopes: I don't view Word as a way to produce the version of the book that's published, i.e., as a mechanism for producing what's displayed to readers. I view it as a tool for producing a manuscript that has the necessary information in it to permit that manuscript to be rendered well on multiple output devices. The idea is that I deliver Word to my publisher, and from that the publisher produces PDF or HTML or epub or whatever format the target device requires. <br /><br />Think of Word as the concrete syntax accepted by a system that takes a file (the book's "source code") and translates it into a file (the book's "object code") that's optimized for a particular platform. With this model, the fact that I'm working in Word is immaterial to you as a reader. Just as you can't tell what text editor was used to produce C++ source code from the executable, there's no reason you should be able to determine if I used Word or Notepad+LaTex or something else from the book you ultimately read.<br /><br />This is not breaking new ground, BTW. Most authors these days use Word to produce manuscripts that their publishers then typeset using something like InDesign. The fact that the document was originally written in Word (or whatever) is not apparent from the book that gets printed. Nor should it be.<br /><br />My choice to use Word is based on its widespread support and familiarity in publishing circles, plus the fact that it's a capable document production system. (I said <i>capable</i>, not <i>ideal</i> :-}) . As I've written elsewhere, I figure that if I do a good job of using styles in Word to indicate logical markup, it should be possible for my publisher to translate what I produce into whatever they need.<br /><br />ScottScott Meyershttps://www.blogger.com/profile/05280964633768289328noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-24174867880238425352013-01-30T13:19:45.640-08:002013-01-30T13:19:45.640-08:00I can't recall all the good ebooks I've re...I can't recall all the good ebooks I've read (but Pro Git is a good enough sample I guess). But I've the hard feeling none of those I've read and praised where built with Word, really. They look as the outcome of a proper typesetting system, LaTeX or maybe even markdown and <a href="http://johnmacfarlane.net/pandoc" rel="nofollow">pandoc</a>.Anonymoushttps://www.blogger.com/profile/11653390099233773707noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-91472518758916088702013-01-30T10:00:08.405-08:002013-01-30T10:00:08.405-08:00@Zenju: I'm not enthusiastic about LateX, beca...@Zenju: I'm not enthusiastic about LateX, because, as I've written <a href="http://fastwareproject.blogspot.com/2008/11/wysiwyg-in-multi-target-world.html" rel="nofollow">here</a>, I think that markup-based approaches are inherently inferior to WYSIWYG approaches for authors.<br /><br />Also, I want to leave all the detailed presentation decisions to my publisher. In the past, I've produced final PDF ("camera-ready copy") for my books, but when my book is going to be consumed on multiple devices with differing sizes and capabilities, I want to leave the porting work to people who do that for a living. They should worry about how to make my material look good and be most useful on Kindle and iPad and Surface and Samsung Galaxy n and, oh yes, ink on paper. I'd rather spend my time focusing on where to use curly brackets. <br /><br />With LaTeX, I can do all that, of course, but I should be able to do what I need with Word, too, I think, and Word is a more pleasant authoring environment for me. If I were planning to produce final PDF for each platform, my decision might be different. But I'm not.<br /><br />ScottScott Meyershttps://www.blogger.com/profile/05280964633768289328noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-71086170136006867522013-01-30T06:01:12.367-08:002013-01-30T06:01:12.367-08:00Hi Scott, I just wanted to share some thought as I...Hi Scott, I just wanted to share some thought as I'm deeply interested in publishing stuffs, more in the comics/audio-visual contexts, but the problems are basically the same for books.<br />I'm right now watching your presentation about an agnostic format for publishing.<br /><br />I understand the problem because I figured years ago that there is the same problem for digital comics (assuming they might or not, depending on the author wish and specificities of the work, be published on paper).<br /><br />I'm working on a format that would be used as inter-operable representation of digital story-telling. This format assume that the story is a sequence, controlled by the reader, but ultimately just a sequence of changes applied to "something in the screen" (or audio or other media). It is not suitable for plain document like books, but I believe that it's the right thing for stories exploiting fully the digital platform (my work is open source).<br /><br />So, I also have some informations about formats interesting for your case. I believe that the best bet would be the result of the work on the next versions of epub. Epub isn't perfect for now but might be suitable for your purpose once it is fixed and enhanced. Unfortunately, don't wait for it this year.<br /><br />It's both sad and awesome news: there is no good inter-operable format (which might not be the final format but a format used to generate other format for different specific targets) so far. However, it means there is a big opportunity to build such format.<br /><br />The problem I see is that most formats made to write something, being code or books etc. Are thought to be usable directly by the author as raw text, which limits a lot the inter-operability using tools to convert the format. I believe that the format itself shouldn't be made for humans to edit it, but for ease of writing tools and readers for it. That's what I do with my digital-story-telling format and that's what I think a format fixing your problem should be too.<br /><br />Klaim - Joel Lamottehttps://www.blogger.com/profile/16883177980078844091noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-18080176571529389402013-01-30T03:10:26.252-08:002013-01-30T03:10:26.252-08:00> write using Microsoft Word
This sounds crazy...> write using Microsoft Word<br /><br />This sounds crazy! :) Why don't you use Latex? (this is coming from someone who was using MS word for large documents and who was told by others that he was crazy doing so). Latex let's you define your format at a single place and apply it to all places in your book that apply. It also solves your "multiple target platforms: book, pdf, html, ect." problem. I had thought you'd be using it already for your EC++ books!<br /><br />>you'd post books you think have done this well<br /><br />Just take the formatting of Herb Sutter's Exceptional C++ Series! I'm sure he don't mind :)Zenjunoreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-27299620948539513422013-01-29T22:21:45.502-08:002013-01-29T22:21:45.502-08:00@Francisco Lopes: I agree that code should not be ...@Francisco Lopes: I agree that code should not be rendered as an image (as I mention <a href="http://scottmeyers.blogspot.com/2012/12/publishing-code-on-digital-platforms.html" rel="nofollow">here</a>). The problem of how to offer "good" source code formatting across output devices is a topic of active discussion among me, my publisher, and other authors I know. I'd be grateful if you'd post books you think have done this well as a comment on my post regarding <a href="http://scottmeyers.blogspot.com/2012/12/examples-of-good-code-based-digital.html" rel="nofollow">code in digital publications</a>.<br /><br />ScottScott Meyershttps://www.blogger.com/profile/05280964633768289328noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-58776939993563494982013-01-29T22:14:31.853-08:002013-01-29T22:14:31.853-08:00@Cory Riddell: I wish I were in Knuth's league...@Cory Riddell: I wish I were in Knuth's league, but I'm not. Also, I'd like to get the book out this year.<br /><br />ScottScott Meyershttps://www.blogger.com/profile/05280964633768289328noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-21941883922518845592013-01-29T22:13:26.589-08:002013-01-29T22:13:26.589-08:00@Tom: Thanks for expressing interest in being a re...@Tom: Thanks for expressing interest in being a reviewer. While I appreciate the offer of body parts, cold hard cash is somewhat more practical. Except...damn. I don't take bribes. Sigh.<br /><br />ScottScott Meyershttps://www.blogger.com/profile/05280964633768289328noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-38154163093627272972013-01-29T15:46:48.818-08:002013-01-29T15:46:48.818-08:00Text in pictures is bad for zooming and night mode...Text in pictures is bad for zooming and night mode in ereaders.Anonymoushttps://www.blogger.com/profile/11653390099233773707noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-80495968269061884372013-01-29T15:44:57.884-08:002013-01-29T15:44:57.884-08:00I admire how Pro Git was able to attain good enoug...I admire how Pro Git was able to attain good enough formatting in various platforms: http://git-scm.com/book. Good code formatting and illustrations, published even to html web page. I've seen other books that achieved similar success.<br />I own Williams book, physical, pdf and real ebook format, epub. Although a good book, source code in epub is displayed through pictures to preserve formatting. I really dislike this, and I think this is what someone may end up if proper attention is not taken from beginning. Best wishes. Anonymoushttps://www.blogger.com/profile/11653390099233773707noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-70024508660095696742013-01-29T11:58:16.504-08:002013-01-29T11:58:16.504-08:00For a minute there, I thought you were going to pu...For a minute there, I thought you were going to pull a Knuth and write a better publishing system so that you can write the books you want.Anonymoushttps://www.blogger.com/profile/12662831656012954737noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-10262584910082139512013-01-29T11:31:44.824-08:002013-01-29T11:31:44.824-08:00This is great news Scott, really pleased the book ...This is great news Scott, really pleased the book is finally under way! Can't wait to read it. Which arm can I offer to tech review it? :-)Tomhttps://www.blogger.com/profile/10532325487524827986noreply@blogger.com