Separating presentation from content

In the late ’90s I went to a fair number of Microsoft presentations. One presentation would say “The problem with Technology X is that it mixes presentation and content. We’ve introduced Technology Y to make your code cleaner, separating presentation and content.” A few months later I’d be at another presentation that would announce “The problem with Technology Y is that it mixes presentation and content. We’ve introduced Technology Z …” (Does this remind anyone else of The Cat in the Hat Comes Back?)

When I first learned LaTeX, I was told that one of its strengths is that it separates presentation and content. Then a few years later I hear complaints that the problem with LaTeX is that it mingles presentation and content, unlike XHTML. A few years later, guess what? XHTML mixes presentation and content, so we need something else.

I shut down when I hear someone announce that everything before their product was bad because it mixed presentation and content, and now with their solution, presentation and content will be completely separate.

Sometimes one technology really does make a cleaner separation of presentation and content. But at best the separation is relative. LaTeX separates presentation and content more than Word, though not as much as well-written HTML and CSS, maybe. But presentation and content cannot be entirely separated. Nor is there unanimous agreement on what exactly the dividing line is between the two.

Many people don’t want to separate their presentation and content. They don’t understand why this would be desirable, and they’ll fight against anything designed to encourage separation. Maybe they need to learn the advantages, or maybe they’re just doing the best they can to get their job done and they can’t be bothered with long term advantages that may not materialize.

The principle of separating presentation and content is admirable. It really does have advantages, but it’s easier said than done.

9 thoughts on “Separating presentation from content

  1. I wish HTML did a better job of separating presentation and content, if for no other reason than security. Entire classes of bugs could be avoided if there were such a thing as a “really raw” string that would never get interpreted as a script.

  2. @Ben: the only problem is: how do you want to terminate this “really raw” string? Or do you want to put the length of the string before it? That’s not exactly error-proof either.

  3. LaTeX certainly fares much, much better because I can take a LaTeX document written for one journal, with one set of standards, and convert it in less than an hour for the purposes of any other journal or conferences.

    The same is simply not possible in Word.

    But that is not why I prefer LaTeX. I actually write all my documents in a text editor even if they need to be in some kind of Wordish format. The important point is that a minimalist text editor minimizes distractions. Word entices you to fiddle with fonts. Don’t do that while you are composing a document!

    But I have a special perspective on this. I wrote 450 pages of lecture notes on XML in my own XML vocabulary (I did this on purpose). Then I wrote XSLT files to convert it either to PDF or XHTML. What something like this teaches you is that content and presentation is an ill-defined dichotomy.

    For example, you do want figures to appear vastly differently online than on a PDF.

  4. @felix
    A little of both length pre-pending and string termination. Something like this:

    [raw len=”3″]abc[/raw]

    The main place where this would be important would be html that is programmatically generated by things like PHP or Ruby on Rails. If those languages were emitting these “raw” tags, then they could get the length right every time. If a browser sees a raw tag where the length and the termination don’t line up, it can just stop immediately before ever executing any script instructions on the entire page.

  5. I’m more interested in moving towards a style where the presentation is the content.

    For example, here’s a redesign I made of a famous Nature paper, with text and pictures tightly integrated as in a comic strip. I think this style of explanation is much more powerful than traditional formats. But the presentation is an essential and inseparable part of the content, from both the author’s and the reader’s perspectives.

    When “content” is composed separately from “presentation”, the author cannot use design as an explanatory tool. The author can only write plain old words, and the presentation can only make those words look pretty. Thus, millions of papers where authors are trying to describe what they should be depicting.

  6. The separation of presentation and content only makes sense when there are multiple presentations that you want or need to do for a single content string. If there is only one presentation, separating it from content is daft. That’s probably why tools which mix them thoroughly (like Word) do so well.

    I can think of a few cases where such separation makes sense (e.g. accessability requirements for websites) but they don’t strike me as being something an end-user (like an author of a scientific paper i.e. me) ought to think about.

  7. I really do like the separation of presentation and content in LaTeX. I enjoy using newcommand{myfile}{texttt{#1}} for setting file and folder names and so forth.

    Can you give me an example where LaTeX is not able to separate the both of them?

Comments are closed.