When the November 2001 issue WebTechniques magazine arrived in the mail, I eventually flipped to merlyn's column, and found that it was mangled. In the code listing, " appears in place of double-quotes. In the process of converting to print from what I assume is his standard submission format, the article's source code was apparently run through an HTML conversion twice. Holy double-escaped-Entities, Batman! What a non-compilable mess. I hope it gets straightened out in the web version of the article.

This is hardly the first time I've seen mangled code in print. It happens to lots of authors, who pour their skills into article submissions, only to experience the horror of having their carefully formatted code examples appear mangled in print.

And so this Meditation, and appeal to the authors among us to share their wisdom:

What can an author do to avoid seeing code mangled when it finally appears in ink-on-paper print?
I have a bit of experience getting mangled in print, going years back to Dr. Dobbs and the old Mac Technical Journal (both of which did a pretty good job with code fragments), and to PC World, which didn't. The only two pieces of advice I can offer from direct experience are:
  1. After carefully reading through a publication's writers guidelines, walk through the entire pre-publication process with your Editor, since there always seem to be a few caveats about the process that haven't yet made it into the guidelines.
  2. Get a prior issue of the publication, and count the line lengths in code examples. If the guidelines say keep line to 64 characters or less, but what shows up in print seems to suggest 60 characters is the real limit, trust what you see in print, and format your code examples accordingly.

If you have experience getting or staying unmangled in Print, please share your suggestions.

Replies are listed 'Best First'.
No Proofs/Pre-prints?
by Masem (Monsignor) on Oct 08, 2001 at 15:09 UTC
    Knowing that there's a large difference between 'consumer' computer magazines and peer-reviewed scientific journals, I'm surprised that there is no process by which the author gets a proof or pre-print of the article before it goes to press to correct any errors that may have come about from typesetting. Sure, this delays the printing process more, but I would think particularly with a mix of text and code, an author would want to check to make sure everything's ok. In addition, I've seen cases of final articles in computer mags where the graphic-arts people went overboard on the clip-art-and/or-graphic-effect of the month and made the article itself practically impossible to read.

    Maybe this needs to be done; sure, the web version might be correct, but to most, the paper copy is going to have the most impact, and for code to be mangled that badly as to detract from the article could hurt the author's reputation despite the error not being his to start with.

    -----------------------------------------------------
    Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain
    It's not what you know, but knowing how to find it if you don't know that's important

      I normally see a PDF of the article after they've mangled, er, edited it, usually to remove all the jokes, and introduce technical errors by changing specific technical terms to their english synonyms {argh}.

      Often, the code listing is just a placeholder in this PDF, because I must be seeing the article before they've actually laid it out in the magazine. The indentation is universally screwed up, which makes me wonder if they go back in and add the indentation by hand to match my original file. Maybe I need to teach them about the powers of proper text processing. {grin}

      However in the last few months, I've been running late at getting the columns turned in, and so a time or two they've printed stuff without passing it by me.

      I've not yet seen my November hardcopy, but based on the various bug reports I've gotten in email (showing how widely read the hardcopy is, apparently), I dropped a note to my editor over the weekend, and hoping that we can catch the process error in time to prevent a repeat for December.

      -- Randal L. Schwartz, Perl hacker

        merlyn writes in part here that:
        ...they've mangled, er, edited it, usually to remove all the jokes

        I gotta say that I am part of the silent (majority?) of readers protected by the dour and humorless editors.

        Somebody's guidelines (apple's?) suggest that there be no more than (1) joke per chapter and that that joke be in a separate paragraph because:

        1. Non native speakers of English are unlikely to get it
        2. Jokes obfuscate the base material
        3. Few jokes are funny more than once and technical material tends to be read over and over again.

        I really should go through the Camel's material on regular expressions 2-3 more times. However, the prospect of even accidentally re-reading those jokes about the bestiary again makes me shudder and consider buying another less jokey book.

        Usual disclaimers apply:
        The authors of the Camel book are gods, I learned a lot from it, etc, etc.

        email: mandog

        Understandably, time is a key factor, but I would still strongly urge your publisher to send you color pre-prints of the article with everything in place after the layout is done. The only things that should be missing in this proof would be page numbers and spots for advertizing if the articles are not entirely full pages. In addition to catching typos, errors, and other weird things that might happen when they import your electronic text into their layout, there can sometimes be problems with colors and backgrounds to make the article unreadable (eg, using black on dark red or blue, which might look good on screen or printing in b&w, but falls apart in CMYK printing. The cost of overnighting these few sheets and the day or two turnaround to proof is more than outweighed than the embrassment to both the author and publisher for such mistakes.

        (This advice isn't just for merlyn, but for anyone that is publishing articles in computer magazines).

        -----------------------------------------------------
        Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain
        It's not what you know, but knowing how to find it if you don't know that's important

        PDF file? You have it easy. I remember greenbar paper with lineprinted output.

        Yes, editors have a way of messing things up. But Keven Weeks, once at Windows Tech Journal, actually made things better, or introduced themed jokes to match the issue, without messing things up.

        When I was a "contributing editor", various magazines ran stuff as-is without touching a comma. Nice! Then I was technical editor for two C++ newsletters, and would find and fix things messed up by the copyeditors, and tried to educate them as well.

        —John

Re: How to avoid being mangled in Print
by merlyn (Sage) on Oct 08, 2001 at 22:30 UTC
    Ahh... just got confirmation:
    You are correct; regrettably, that does seem to have happened. I'm not totally sure how, but I have a suspicion. The current method of translating your Perldoc formatted manuscript into workable text involves converting it first into HTML. Normally that doesn't include the listings, but in this case maybe they went through the wringer with the text. Unfortunate than none of us spotted it in proof. It didn't happen for December.
    What shocked me the most was "converting it first to HTML"!! Gack! HTML is not a useful markup language for generic items!

    -- Randal L. Schwartz, Perl hacker

Re: How to avoid being mangled in Print
by MZSanford (Curate) on Oct 08, 2001 at 19:30 UTC
Re: How to avoid being mangled in Print
by John M. Dlugosz (Monsignor) on Oct 08, 2001 at 20:55 UTC
    Ten years ago, I had that problem with the ATEX typesetting system. Sometimes my FedEx'ed galleys went right into the trash with a single glance. It would help if the people processing them had a clue as to what it's supposed to look like, or things to look out for. (This was Computer Language Magazine, BTW. C++ source contained a lot of chars it used for formatting!)

    —John