<<

A Simple Design in ConTEXt

Steve Grathwohl Duke University Press, Durham, NC, USA [email protected]

Abstract As a test of implementation in ConTEXt, I report on a design for A Voyage to Arcturus by David Lindsay, including setups, heads, headers, and typescripts for . text was quite corrupt, and it took a while to make 1 Motivation the necessary edits to bring it to an acceptable stan- Whenever I learn a new TEX system, I try to im- dard. plement a design for a significant number of pages. The design I had in mind for the book was based Many years ago, when I was learning LATEX (2.09), I on a mathematics text I read in college. The unify- wrote a rawls.sty to mimic Harvard Press’s design ing theme was a vertical rule separating visual ele- for John Rawls’s A Theory of Justice [3], a design ments of the chapter headings and page headers. that featured a number of interesting features: not only were there parts, chapters, and sections, but 3 Fonts the sections were numbered consecutively through- out the book, orthogonally to the chapters. So the I decided to use a Bembo clone (called Bergamo) for first section of Chapter 3, say, might be numbered the text and an Optima clone (called Opus) for the section 16. Page headers had rules under the head- chapter headings and header texts. Both are from er texts. I mention all this because in those pre- the FontSite 500 [4]. To use these fonts LATEX2ε days, it was far from trivial to make sub- with ConTEXt, I write some typescripts. stantive changes to the default styles. I remember studying Don Knuth’s (plain) code for his \starttypescript [] [bergamo] [ec] Journal article on Literate Programming and think- \definefontsynonym [Bergamo-Roman] ing what a nightmare it would be to implement in [5borjx8t] [encoding=ec] LATEX; but that was 1988. Matters have certainly \definefontsynonym [Bergamo-Bold] improved since then. [5bobjx8t] [encoding=ec] When I first encountered ConTEXt I was imme- \definefontsynonym [Bergamo-Italic] diately impressed by the setups mechanism of key/ [5borix8t] [encoding=ec] value pairs approach to a design interface. I began \definefontsynonym [Bergamo-Bold-Italic] using ConTEXt for typesetting internal documenta- [5bobix8t] [encoding=ec] tion here at the Duke Press (coded in DocBook XML \definefontsynonym [Bergamo-Caps] and processed using Simon Pepping’s Docbook In [5borcj8t] [encoding=ec] ConTeXt [2]). But I had in mind all along trying \definefontsynonym [Bergamo-Bold-Caps] out ConTEXt in a larger project. I wanted to see [5bobcj8t] [encoding=ec] how easy it would be to render a book design com- \stoptypescript pared to LATEX. I suspected it would be much easier; I was right. Observant readers who know the Berry naming conventions will see that Bergamo contains both full ‘f’ ligatures and old-style numerals. 2 The Text In the following I declare that maths be in When I discovered that a very strange book I had scaled Palatino (even though in this project there first read as a youth, A Voyage to Arcturus by David are no maths). I find that Palatino for maths blends Lindsay [1], had been deposited in Project Guten- well with Bergamo, and I wanted to go ahead and berg, I knew I had my text. In the event, the OCR set this up for future projects.

52 TUGboat, 25 (2004), No. 1 — Proceedings of the Practical TEX 2004 Conference A Simple Book Design in ConTEXt

\starttypescript [Bergamo] % the % after ] and } suppresses \definetypeface [Bergamo] [rm] [serif] [bergamo] [default] [encoding=ec] \def\mychap#1#2% \definetypeface [Bergamo] [ss] [sans] {\hbox to \hsize \bgroup [opus] [default] [encoding=ec] \hfill \definetypeface [Bergamo] [tt] [mono] \setupframed [modern] [default] [offset=0.5em,frame=off]% \definetypeface [Bergamo] [mm] [math] \tbox [palatino] [default] [encoding=ec, {\framed rscale=.90] [width=2cm,align=left] \stoptypescript {\ss #1}}% % now instructions for #2, The code for Opus is similar. I store these % anything but ragged right with typescripts in -fontsite. and invoke them. % no hyphenation looks bad Note that I use hanging and open up \tbox the lines to improve readability. {\framed [width=.5\textwidth, % Set up , pure style; align=flushright, % Declare Berry naming conventions, ec leftframe=on] % encoding {\hyphenpenalty 10000 \ss #2}}% \egroup} \usetypescript[serif] [hanging] [pure] \usetypescript[berry] [ec] I want dropped caps for my chapter openers, and afterwards for a certain number of % Load Bergamo and Opus fonts, words that I choose. (It is also possible to set this up so the entire first line is in small caps automatically; % declare sizes and . but I prefer to choose my own breaks.) The dropped % Looks better with lines opened a bit. cap will be in Opus, be 3 \baselineskips tall, be dropped one line, and have 2 points of padding. \usetypescriptfile[type-fontsite] \usetypescript[Bergamo] \def\Drop {\DroppedCaps \setupbodyfont[Bergamo,10pt] {} {Sans} {3\baselineskip} \setupinterlinespace[line=1.35em] {2pt} {1\baselineskip} {2}}

\setupalign[hanging] \def\chap#1/#2/{\Drop #1{\sc#2}}

so I can say 4 Chapter Heads, Page Headers and Footers \chapter{The S\’eance} I set up the heads with these options \chap O/n a march evening/, at eight \setuphead o’clock, Backhouse, the [chapter] [page=yes, You can see the result in Figure 1. before={\blank[force,4*line]}, To unify the design, I make the headlines mir- after={\blank[4*line]}, ror the chapter openers, with a vertical rule sep- command=\mychap] arating verso the page number and book title and recto the chapter title and page number, all in Opus. Note the command option. This allows me to First I declare doublesided pages and turn off auto design my own chapter head appearance. \mychap page-number placement. Then I specify a different looks like this (#1 refers to the chapter number, and scheme for chapter opening pages. #2 refers to the chapter title):

TUGboat, Volume 25 (2004), No. 1 — Proceedings of the Practical TEX 2004 Conference 53 Steve Grathwohl

% Remove auto placement; \setuplist % I’ll do it manually. [chapter] [alternative=a, \setuppagenumbering =.2\textwidth, [alternative=doublesided, numbercommand=\NumCom] location=] \def\NumCom#1{\hbox to 2em{\hfill #1}} % Set up header texts, 5 Setting Up the Pages \setupheadertexts [] [\setups{text:header:1}] Last (actually first) I set up the pages and a switch [\setups{text:header:2}] [] for page imposition. Pay attention to the comment- ed lines for crop marks, etc. \startsetups text:header:1 \getmarking[chapter][current] % Set the sizes. \quad\vrule\quad \pagenumber \definepapersize \stopsetups [arc] [height=220mm, \startsetups text:header:2 width=145mm] \pagenumber \quad\vrule\quad \setuppapersize A Voyage to Arcturus [arc] \stopsetups [letter]

% Define heads for chapter opening pages % Set up arrangements for as % booklet. Toggle as needed. \definetext [chapterstart] % \setuparranging[2UP,rotated,doublesided] [footer] [pagenumber] \setuplayout [margin=0pt, \setuphead width=middle] [chapter] [header=empty, \setuplayout footer=chapterstart] [topspace=2\baselineskip, height=middle] \setupheader [style=\ss] % Layout modifications to headers, etc

A page spread can be seen in Figure 2. \setuplayout Now I specify the Table of Contents: [header=2\baselineskip, footer=2\baselineskip, % Set up table of contents format. location=middle] % Move whole operation to the right % to better center the TOC, and make % Crop marks. % sure chap numbers align properly % % (flushright) in their own box % \setuplayout[marking=on]

\definelist \setupindenting [chapter] [medium]

54 TUGboat, Volume 25 (2004), No. 1 — Proceedings of the Practical TEX 2004 Conference A Simple Book Design in ConTEXt

% I guess Bush would call this suitable cover page for it. Other versions will fol- % ‘freedomspacing’ low when ready. But be warned—many have found Lindsay’s \setuplanguage philosophy detestable (a worship of suffering is one [] characteristic of it). The English writer C. S. Lewis [spacing=broad] % french spacing certainly found it so, even if the book did influence his wonderful space . Finally, for output targeted for a computer screen instead of print, I can say Acknowledgments. Thanks are due to Hans Hagen for improving my humble code in places and for writ- \setuppapersize[S6][S6] ing the ConTEXt TUGboat style. \setupinteraction[state=start] References I can’t argue emphatically enough for this ap- proach to and articles destined for a com- [1] Lindsay, David, A Voyage to Arcturus, Lon- puter screen. The advantages to making one’s way don, Methuen, 1920. Text available at Project through the text by just the touch of the space bar Gutenberg: http://www.gutenberg.net are, to me, self evident. /etext/1329. Other, corrupt editions can be found on amazon.com. [2] Pepping, Simon, DocbookInConTeXt, avail- 6 Future Work able at http://www.leverkruid.nl/context Clearly, implementing a simple design in ConTEXt /.. is quite straightforward. In fact, the advantages of [3] Rawls, John, A Theory of Justice, Revised using ConTEXt become more obvious the more com- , Belknap Press, Cambridge, MA, 1999. plicated the design. I hope that this arti- [4] FontSite. http://www.fontsite.com.TEX cle might motivate others to give ConTEXt a try for metrics and LATEX support files by their own typesetting projects. Christopher League are available at http: Eventually I plan to code the book in XML //contrapunctus.net/league/haques along with supporting files for browser display and /fs500tex/. direct typesetting with ConTEXt. For the moment, I will post the screen version at http://www.duke. edu/~grath/arcS6.pdf, after a friend designs a

TUGboat, Volume 25 (2004), No. 1 — Proceedings of the Practical TEX 2004 Conference 55 Steve Grathwohl

1 The Séance

O n a march evening, at eight o’clock, Backhouse, the medium—a fast-rising star in the psychic world—was ushered into the study at Prolands, the Hampstead residence of Montague Faull. The room was illumi- nated only by the light of a blazing fire. The host, eying him with indolent curiosity, got up, and the usual conventional greetings were exchanged. Hav- ing indicated an easy chair before the fire to his guest, the South American merchant sank back again into his own. The electric light was switched on. Faull’s prominent, clear-cut features, metallic-looking skin, and general air of bored impassiveness, did not seem greatly to impress the medium, who was accustomed to regard men from a special angle. Backhouse, on the con- trary, was a novelty to the merchant. As he tranquilly studied him through half closed lids and the smoke of a cigar, he wondered how this little, thick- set person with the pointed beard contrived to remain so fresh and sane in appearance, in view of the morbid nature of his occupation. “Do you smoke?” drawled Faull, by way of starting the conversation. “No? Then will you take a drink?” “Not at present, I thank you.” A pause. “Everything is satisfactory? The materialisation will take place?” “I see no reason to doubt it.” “That’s good, for I would not like my guests to be disappointed. I have your check written out in my pocket.” “Afterward will do quite well.” “Nine o’clock was the time specified, I believe?” “I fancy so.”

1

Figure 1 A chapter opening page

56 TUGboat, Volume 25 (2004), No. 1 — Proceedings of the Practical TEX 2004 Conference A Simple Book Design in ConTEXt obahForest. Wombflash ewnee ftesno at a iil,adi owihoei was. it one which so if and constellations. visible, familiar was clouds, earth no the of saw was sun of the Maskull wind rifts if appeared. The wondered the He precipice. brilliant, Through the and faces. of their faint edge into stars, the grit skirted drove they and more searching, or mile a For way.” the on land.” but the stranger, of nothing, out Regret once loyalty. at and away love go soft her with ideas, his down crime!” leave this.” shall all too on I reflect Tomorrow to pleasure. Sant, of sprouting—out another only is men faith?” his accepted have it.” of come can 122 iapae notedarkness. the into disappeared ospesr pers hmflt us?” to shameful so appear pleasure does the to descended this but up; come had he which by one the resembled It hycm oteha faruhsarae edn ontecli the down leading staircase, rough a of head the to came They night. the into away walked they and Maskull’s, in arm his linked you put He will I minds. deepest the meet will you where Wombflash, “To go?” I shall Where “Tonight? dragged have would woman the henceforward and played was a part but “His necessity, a not were deaths two these “Then shuddered. Maskull our of pride the that see “I Catice. really replied you man,” great-souled would a Spadevil, was “He follow to elected had I If Catice. me, “Tell joy.” and laughter meditated. but Maskull destruction; and change fear not good “Do “Nothing Maskull. said blood,” much too through here.” not wading but am tomorrow; “I him to nearer get will “You Surtur?” is “Who answer. not did exist?” Catice to world horrible this comes “How illusion.” of stripped Shaping is “It aigmd hsrpy edsnae isl,ad unn i back, his turning and, himself, disengaged he reply, this made Having Catice. answered “Muspel,” Adta is home.” that our “And forget company—why we pleasure, part feeling in we “Because before this, farther.” any just come “Say not shall him. I “and detained Catice, Maskull said ’,” path your is “That oaet Arcturus to Voyage A ... ?” ff side. r evsfraplo,adimdaeyfln isl ont le.Deep sleep. instantly. to almost down him himself seized flung some unconsciousness together immediately heavy heaped and and pillow, He a night. for that leaves few farther a no dry happened go had to this After determined trunks. he tree times, with collide to and roots, over trip the approached warm. he and as still louder became grew interminable air trees the an the bottom; seemed of what sighing and during rustling step matter. The to discharge time. step to from began himself probe lowered uninjured He His pains. his of contemptuous ea atrahdlvlgon.Silatmtn opoed ebgnto began he proceed, to attempting Still ground. level reached last at He but tired, was He could. he best as staircase the down stumbled Maskull Spadevil 123

Figure 2 A page spread as arranged in signatures

TUGboat, Volume 25 (2004), No. 1 — Proceedings of the Practical TEX 2004 Conference 57