[NTG-context] Adding custom key/value pairs

Aditya Mahajan adityam at umich.edu
Tue Apr 15 17:34:49 CEST 2008


Hi Wolfgang,

On Tue, 15 Apr 2008, Wolfgang Schuster wrote:

> On Mon, Apr 14, 2008 at 6:11 PM, Aditya Mahajan <adityam at umich.edu> wrote:
>> On Mon, 14 Apr 2008, Taco Hoekwater wrote:
>>
>>> Wolfgang Schuster wrote:
>>>>
>>>> Why not, I have nothing against a few predefined title pages layouts.
>>>
>>> Somewhat related: it would be nice if there was some common code for
>>> titles (books as well as articles).
>>>
>>> [snip]
>>>
>>> Anyway, the maps module contains all the code to do everything. And
>>> the same is true for the TUG module. And for quite a few others I have
>>> laying around. Lots of duplicate code all over, so a common framework
>>> would be great. I've been meaning to write one for a long time, but
>>> somehow I never quite get around to actually doing it.
>>>
>>> Just saying this to let you know that I would really welcome a module
>>> with commands like \setuptitle, \definetitle, and \placetitle.
>>
>> I agree with that. It will be really nice to have a module that does a few
>> "simple" titles (alternate=(a|b|c), etc.) For one of my personal modules,
>> I was following something along the lines of the maps module. But I find
>> Wolfgang's solution on the wiki to be more ConTeXtish than what all other
>> modules use.
>
> Hi Aditya,
>
> could you use a few lines what do you expect from a placetitle/placetitlepage
> command or a titlepage environment.

Some of the things that I use \placetitle for:

* Writing academic papers. Currenly, I have a macro that I use like this:

\article
 	[title ={...},
 	 author={...},
 	publication={...},% This just goes to pdf subtitle
 	date={...},
 	bottom={...}, %text placed at page bottom,
 		      %usually current revision number
 	thanks={...}, %placed on the footer of the first page
 	]

\startabstract
...
\stopabstract

\startkeywords
....
\stopkeywords

The abstract environment places a head ("Abstract") followed by its 
content. The formatting depends on whether it is a journal article, or a 
conference article.

keyword also places a head followed by its content.

Currently, what I have is that \article places all its contents, and so do 
abstract and keyword. So, I do not have to store anything.

* TUGBoat articles: This uses a style file originally by Hans, which I 
have modified considerably, but still uses the same interface.

This uses

\setvariables
    [tugboat]
    [title={...},
     author={...},
     address={...},
     email={...},
     year={...},
     volume={..},
     number={...},
     page={...}]

The title and the author go to the document title. The address and email 
go at the end of the article. The year, volume, number, and page go to the 
header and footer of the article.

The rest of the article is somethng like

\starttext
\startArticle

\startAbstract
....
\stopAbstract
...

\stopArticle
\stoptext

This structure is the reason I think something like \setuptitle (or 
\setupdocumenttitle) is needed.

* Practex journal, which uses

http://wiki.contextgarden.net/Modules/Pracjourn

* My Ways which use

http://wiki.contextgarden.net/Modules/MyWay

* and finally Maps which use

http://wiki.contextgarden.net/Modules/Maps

--------------------

Notice that almost all of them so similar things, but in slightly 
different manner. What I wish for is a common interface, and I really like 
your idea of \setuptitle. In fact, I think that something like that should 
be part of the core.

The module does not need to take care of all the formatting requirements: 
just provide the interface. For a particular publications, the module for 
that publication can modify the \placetitle command to do what they want. 
With this, the user documentation can just say that use

\setuptitle[title=...,author=..., date=....] %and maybe setups={...}

So, we will have a consistent user inteferface for all documents.

> What should we do with the abstract, did it depend on the document title ...

In general, the formatting of the abstract will depend on the kind of the 
document. Just need something like

\definetitlesubstructure% or something more appropriate
   [abstract]
   [headtext={Abstract},
    headstyle=bold,
    headcolor=blue,
    headalign=middle,
    inbetween=\blank,%between the head and the body
    style=small, %for the contents
    color=black, %for the contents
   ]

This should define a command that captures its contents, and provides a 
command \placetitlesubstructure[abstract].

Similarly, we can define

\definetitlesubstructure
   [keywords]
   [....]

Then, \placetitlesubstructure[abstract] and 
\placetitlesubstracutre[keywords] and go in the after={...} key of 
\setuptitle.

As I said before, the module just needs to collect the information, and 
provide one or two simple styles. Once the information is collected, it is 
easy to use other keys (e.g. thanks key in my first case) and let the user 
define a setups that take of how to handle those keys.

Aditya


More information about the ntg-context mailing list