Changes

Jump to navigation Jump to search
1,325 bytes added ,  08:48, 11 October 2010
m
continuing
</texcode>
Things become a bit more interesting when we look at the next level. We will start with the text proper, which is contained in the <tt>body</tt> element. For the text, we want line numbers in the margin, and we want this these linenumbers in steps of five, in a small font. Here you can see the three steps we have to take:
<texcode>
# add a specific setup for the element which puts its content within a <code>\startlinenumbering</code> environment
# add ConTeXt setup commands for the <code>\startlinenumbering</code> environment.
 
Things become even more interesting at the next level. When you look at our xml document, you will see that the entire body consists of different divisions in <code><div</code> elements; the different levels are distinguished by different <tt>type</tt> attributes. This means we cannot simply add the <code><div</code> element to our general <code>\xmlsetsetup</code>, but have to add a specific <code>\xmlsetsetup</code> for every type. Fortunately, ConTeXt makes it easy to address these different elements. We begin with the <tt>book</tt> level: (for clarity, I will now only show the new steps, not the entire style document):
 
<texcode>
\startxmlsetups xml:teisetups
\xmlsetsetup{#1}{*}{-}
\xmlsetsetup{#1}{TEI|text|body}{xml:*}
\xmlsetsetup{#1}{div[@type='book']}{xml:div:book}
\stopxmlsetups
 
\startxmlsetups xml:div:book
\blank[line]\midaligned{\xmlatt{#1}{n}}\blank[medium]
\xmlflush{#1}
\stopxmlsetups
 
What happens here? We want a blank line before the title of the book. Then, we take the value of the <tt>n</tt> attribute (that's what the construct <code>\xmlatt{#1}{n}</code> expands to: the value of the attribute <tt>n</tt> of the current tag) and typeset it midaligned. We add another, smaller blank. And don't forget to "flush" the content of the <code><div></code> element!
</texcode>
--[[User:Thomas|Thomas]] 11:37, 10 October 2010 (UTC)
gardener
111

edits

Navigation menu