Toward Subtext a Mutable Translation Layer for Multi-Format Output
Total Page:16
File Type:pdf, Size:1020Kb
Haltiwanger NAJAAR 2010 45 Toward Subtext A Mutable Translation Layer for Multi-Format Output Abstract a new format come into existence. The demands of typesetting have shifted significantly since The raw fact of text on the computer screen is that, the original inception of TEX. Donald Knuth strove to de- overall, the situation is awful. Screenic text can be velop a platform that would prove stable enough to produce divided into three categories: semantic, formal, and the same output for the same input over time (assuming WYSIWYG. The semantic formats, for example HTML the absence of bugs). Pure TEX is a purely formal language, with no practical notion of the semantic characteristics of and XML, are notoriously machine-readable. Text can the text it is typesetting. The popularity of LATEX is largely easily be highlighted, copied, pasted, processed, con- related to its attempt to solve this problem. The flexibility verted, etc. Yet the largest “reading” software for se- of ConTEXt lends it to a great diversity of workflows. How- mantic formats is the web browser. Not a single web ever, document creation is not straight-forward enough to browser seems to have bothered to address line-break- lend itself to widespread adoption by a layman audience, nor ing with any sort of seriousness.3The ubiquity of is it particularly flexible in relation to its translatability into HTML, tied with its semantic processibility, means that other important output formats such as HTML. Subtext is a its importance cannot be ignored as an output format. proposed system of generative typesetting designed for pro- At this point, not producing an HTML version of a doc- viding an easy to use abstraction for interfacing with TEX, HTML, and other significant markup languages and output ument that one wishes to see widely read is tantamount formats. By providing a mutable translation layer in which to removing such widespread reading as an achievable both syntax and the actual effects of translation are defined goal. To top off the complexity of the situation, the within simple configuration files, the infinitely large set of machine-readability of a semantic document is offset typographic workflows can be accomodated without being by a distinct reduction of human readability. Asking known in advance. At the same time, once a workflow has anyone to write a thesis directly in XML. for instance, been designed within the Subtext system, it should enjoy is going to be a non-starter. the same long-term stability found in the TEX system itself. The second class of text are those defined by their This article briefly explains the conditions, motivations, and formal nature. This is not referring to some but- initial design of the emerging system. toned-down attitude, but rather to an opposite direc- tionality in terms of how the text is presented. In Keywords semantic markup, the format is not itself responsible generative typesetting, multi-output, translation layer, for how a display program arranges the text---rather, pre-format the display program digests the text in light of its semantic qualities and then lays that text out according Conditions for Subtext to algorithms that can and do vary between programs. Subtext arose as a practical conclusion during the writ- The easiest way to describe this approach is that it is ing of my masters thesis in New Media at the Uni- top-down. versiteit van Amsterdam.1The initial impulse for the Formal markup, on the other hand, is bottom-up. The thesis itself was to investigate what available media final display of text is defined by discrete instructions theories existed that could articulate the dynamics of a to a program that assembles that text in a highly spe- generative workflow pre-occupied with outputting itself cific way. TEX is one obvious example of this. Like- in multiple formats. In the case of the thesis, this meant wise, PostScript and PDF are formal specifications for PDF and HTML. Having heard about the translation typesetting text. The immediate drawbacks of formal software Pandoc,2I chose to utilize this software in my markups include an often byzantine syntax and a lack quest to produce a thesis whose materiality spanned of processibility into anything other than the output not a single document but multiple files, programs, and formats that the formal system knows how to handle. ‘glue’ scripts. In other words, the thesis would not be a To this day, copy-pasting from a PDF document often product, set in proprietary software like MS Word, but a leads to awkward extra characters such as linebreaks in process that could self-correct later in the future should the pasted text. 46 MAPS 41 Haltiwanger The third class of screenic text system is WYSIWYG. that instead of converting to HTML, one would rather While WYSIWYG is first and foremost a user interface generate a PDF using ConTEXt. Seems straight-forward design pattern (and thus can be used to output files in right? both formal and semantic formats), it is also defines the extremely pervasive Microsoft Word file formats. # My Header # By positioning the comfort of the user above all other considerations, WYSIWYG finds its strengths in its ease The above should simply convert into the top-level of use and its inherent predictability: whatever you se equivalent in ConTEXt. But wait.. That would be a on the screen should appear exactly that way on paper. matter of what one was trying to accomplish, wouldn't By privileging the human to such an extent, however, it? both translatability and the typographic quality of the After all, the above Markdown snippet could easily text suffer. Since text is intended to always appear refer to exactly as it was input, MS Word can do no calculations for line breaks other than on a per-line basis.4Worst of \subject{My Header} all, WYSIWYG formats (especially those derived from Microsoft products) are difficult to integrate into a or generative typesetting workflow which targets many output formats. \section{My Header} Problematics Within Generative Typesetting or Generative typesetting itself emerges from a very spe- cific set of problematics. A primary concern is a re- \chapter{My Header} duction in syntax complexity. This is solved by the introduction of a pre-format that provides sight-level or even semantics for specifying desired outcomes in the output formats. For example, the Markdown pre-format was \title{My Header} designed such that "a Markdown-formatted document should be publishable as-is, as plain text, without look- What is the solution here? Should a reserved character ing like it’s been marked up with tags or formatting be adopted for each of these cases? Questions of how instructions."5 to deal with such edge cases are intrinsically tied to the To demonstrate, while a top-level header in Mark- translation layer itself: because all format translation down reads as occurs within the translation layer, it is the decisions which that layer makes that determine how edge cases # My Header # are handled. Pandoc provides command-line switches for turning Once converted into HTML the above turns into on numbered sections and for determining the top-level “section.” However, were one to desire that a custom <h1>My Header</h1> command or macro be used in place of any of the above, a knowledge of Haskell is required to write scripts Sight-level semantics rely on visually distinct identi- or otherwise modify the way that Pandoc converts fiers. This stands in sharp contrast to both HTML/XML its inputs. Other tricks can be employed, such as the and T X, which rely on distinct tags combined with E introduction of a ‘glue’ layer based in a script which reserved characters. In short, this approach to se- solves certain edge cases with regular expressions and mantic formatting relies on utilizing more reserved if statements. From the standpoint of a generative characters than these other systems. Which charac- typesetting workflow that does not require program- ters are chosen and the nature of their organization ming expertise, these solutions for edge cases are far is an attempt to strike a balance between both read- from optimal. ability and processibility. Like WYSIWYG, sight-level semantics represent a redistribution of agency be- One Mutable Interface to Produce Them All tween the human and the machine. Unlike WYSIWYG, Today the largest demands of digital publishing re- the utilization of Markdown implies an intention for volve around flexibility. The vast array of existing translating it into other formats. and on-coming e-readers is but one example of this. The second problematic is an inevitable result of More general concerns include the necessity of both the first: there is always an edge case. Take as an machine-readable formats and typographically sound example a variation on the code I've already shown. Say documents. Currently this means HTML/XML and PDF. Toward Subtext NAJAAR 2010 47 Yet once e-readers are brought into the mix, the ePub variety of expectations and desires tied into a proposed format becomes imperative. means of accomplishing a more fluid and responsive Yet while ePub is the most accepted format for generative typesetting workflow. This does not mean, e-reader publishing today, there is always the chance however, that there has yet to be any thought put into (one might even say inevitability) that a new format the platforms that will underpin Subtext. will become standard in the future. Future-proofing is a The first choice is the programming language. Con- significant advantage of a generative typesetting work- sidering the importance of parsing, grammar, and flow, but the programming-required nature of edge metaprogramming functionality to the implementa- cases--and, indeed, any modification to the translation tion of a mutable translation layer, my first impulse layer--decreases the adoptability of generative typeset- is to write Subtext in Perl 6.