martedì 20 dicembre 2011

The Shunned House -- Titles and subtitles, step 3

This post is going to be a little out of context, since it's about structuring your book. Problem is, these subdivisions are going to be somewhat artificial, since "The Shunned House" is a story whose structure is only one level deep. So, I'm going to insert some artificial subdivisions in it.

Like LaTeX, and HTML, context comes with some handy commands for structuring the text. These commands produce titles in a hierarchical way, the same way h1..h4 commands do in HTML. These commands can produce numbered or unnumbered title; since we are designing an RPG, and we want to avoid an overly technical feel, I think that only level-1 titles (chapters) must be numbered, while lower-level heads should not bear numbering. Your mileage may vary, however, and you might not agree with me. That's fine -- I'm no designer, and I've laid out some publicily available games only for fun.




Head commands usually have this form:



\headCommand{test of heading}
And, directly from ConTeXt manual cont-enp.pdf, page 137, here's the list of head commands, along with their level.

Level Numbered Title Unnumbered Title
1 \part
2 \chapter \title
3 \section \subject
4 \subsection \subsubject
5 \subsubsection \subsubsubject
The \part command is quite peculiar, since it generates no title; however, this command is used to mark "special attention specific designs". I must say that, apart from this mention, I could not find any example of \part usage in the documentation, so
my attention will focus on headlines from \chapter | \section onwards.

Using these commands instead of simply formatting a paragraph bears two useful features that come very handy when authoring a book. These are:

  1. Using the \completecontent command, you can generate a Table of Contents based upon the titles you've inserted into your document.
  2. Moreover, if we invoke an headline command with the form \headcommand[ref]{title of chapter}, context store the first parameter as a reference, that can be used to generate automatic reference to the chapter.
  3. . This feature will be explained on a next post: for now, stick with the first item and enjoy the possibility to generate complete table of contents with a single command.

Tinkering with headlines

.
Caveat: the titles we will insert are completely fictious
Now it's time to begin using these commands. We see that we've already divided "The Shunned House" in five files -- a chapter, a file. So, we could take advantage of this layout and edit the first chapter this way: place your text editor at the beginning of the following paragraphs, add an empty row and insert an head command as per these examples:

...
\section{Rumors}

What I heard in my youth about the shunned house was merely that people
died there in alarmingly great numbers. That, I was told, was why the
original owners had moved out some twenty years after building the
place. It was plainly unhealthy, perhaps because of the dampness and...


...
\subsection{Fear of the night}

We never--even in our wildest Halloween moods--visited this cellar
by night, but in some of our daytime visits could detect the
phosphorescence, especially when the day was dark and wet. There was
also a subtler thing we often thought we detected--a very strange thing
...
Then, open up chapter 2 and edit it this way:
\subject{A menace is growing}

It was Ann White who first gave definite shape to the sinister idle
talk. Mercy should have known better than to hire anyone from the
Nooseneck Hill country, for that remote bit of backwoods was then, as
now, a seat of the most uncomfortable superstitions. As lately as 1892
an Exeter community exhumed a dead body and ceremoniously burnt its
Go down six paragraph and edit the text this way, inserting a \subsubject:
\subsubject{A Soldier's Death}

Rathbone was a practical man, and rented the Benefit Street house
despite William's wish to keep it vacant. He considered it an obligation
to his ward to make the most of all the boy's property, nor did he
concern himself with the deaths and illnesses which caused so many
Then, rename the main .tex file The_shunned_house_4.tex, and compile it in the usual way.
We will get a PDF displaying numbered sections in the first chapter, and unnumbered subections in the second.
As an exercise, you might want to add subsections, subsubsection here and there if you want numbers, and subjects, subsubjects,
subsubsubjects if you do not want them.

That's all well and good, but I hear some of you asking: in my favorite word processor I can alter headings' attributes (like font, paragraph properties, alignment) at will, can I do the same here in ConTeXt? The answer is a resounding: Yes, you can.
We can redefine normal headings' behavior: check page 140 of cont-enp.pdf manual; moreover, if we want to define new headings placed logically on one level but with different rendering behavior, we can setup new headline commands. Redefining a headline's behavior means at least knowing a little about fonts use in ConTeXt, so this will be the topic of a next post; for now, play a little with these new command and, if you're feeling brave, download some out-of-print novel in text format from Project Gutenberg and:

  1. Try to apply the concepts explained in these posts
  2. Download, read and play with the examples contained in "Context- An Excursion" (look to the sidebar for an handy link) and begin reading the manual. It assumes you're somewhat familiar with TeX, but I can assure you that the samples contained in "ConTeXt - An Excursion", while guaranteed to make Bringhurst cry, are "loud" enough to make you wonder "how can in TeX world can someone do something like this? "
See you at the next post, where we will take on lists.

Nessun commento:

Posta un commento