ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Adding custom key/value pairs
@ 2008-04-12 19:44 Rory Molinari
  2008-04-13 10:08 ` Taco Hoekwater
  0 siblings, 1 reply; 14+ messages in thread
From: Rory Molinari @ 2008-04-12 19:44 UTC (permalink / raw)
  To: ntg-context

Hi,

I'm new to ConTeXt and decided to teach myself a bit by resetting my 
old thesis (originally done, many years ago, in LaTeX).  As the purpose 
is to teach myself ConTeXt rather than just have an electronic version 
of the thesis I decided to try to do things the "right" way.

So, in setting the title page I followed the pattern shown on 
Contextgarden here: http://wiki.contextgarden.net/Document_Titles.  
That page shows how to define a nice \placetitle command with an 
associated \setuptitle which allows us to define values for title, 
subject, and date.  However, I want also to be able to define values 
for degree, subject, and committee (to follow the school-standard LaTeX 
style file I had from all those years ago).  I can't work out how to do 
this.

Simply using a variable like \c!degree (to match the \c!title I found 
in the example) doesn't work, as ConTeXt doesn't know about such a 
control sequence.  I was quite puzzled for a while but then it dawned 
on me that the example I found on contextgarden works because the keys 
it uses (for key/value pairs) are ones that are already defined in the 
ConTeXt system: title, subject, date.  My attempt fails because the 
system doesn't know about degree, subject, and committee.

I tried defining a new variable with startvariables, but that didn't 
appear to help.

So, my question: what do I need to do to define a new key that can be 
used in a key/value pair?


Here's an example of what I tried:


\startvariables all
   degree: degree
\stopvariables

\definesystemvariable{tp}  % title page

\def\setuptitlepage{\dodoubleempty\dosetuptitlepage}

\def\dosetuptitlepage[#1][#2]%
   {\ifsecondargument
      \dodosetuptitlepage[#1][#2]%
    \else
      \dodosetuptitlepage[\v!content][#1]%
    \fi}

\def\dodosetuptitlepage[#1][#2]%
   {\def\dododosetuptitlepage##1%
      {\getparameters[\??tp##1][#2]}%
    \processcommalist[#1]\dododosetuptitlepage}

\def\placetitlepage
   {\startalignment[\v!middle]
     \doattributes{\??tp\c!degree}\c!style\c!color\@@tpcontentdegree
     \stopalignment}

\setuptitlepage
   [\c!degree]
   [\c!style=\tfa,\c!color=]

\startfrontmatter
\placetitlepage
\stopfrontmatter

\starttext
\stoptext


Cheers,
Rory

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Adding custom key/value pairs
  2008-04-12 19:44 Adding custom key/value pairs Rory Molinari
@ 2008-04-13 10:08 ` Taco Hoekwater
  2008-04-13 17:37   ` Rory Molinari
  0 siblings, 1 reply; 14+ messages in thread
From: Taco Hoekwater @ 2008-04-13 10:08 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Rory Molinari wrote:

> \startvariables all
>    degree: degree
> \stopvariables

\c!... commands (keys) are created by \startconstants,
\v!... commands (enumerated values) by \startvariables.

So:

   \startconstants all
      degree: degree
   \stopconstants

you also have a few smaller problems with the definitions
like missing \unprotects etc, but the above is the key to
getting it working.

Best wishes,
Taco
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Adding custom key/value pairs
  2008-04-13 10:08 ` Taco Hoekwater
@ 2008-04-13 17:37   ` Rory Molinari
  2008-04-14  9:56     ` Olivier Guéry
  0 siblings, 1 reply; 14+ messages in thread
From: Rory Molinari @ 2008-04-13 17:37 UTC (permalink / raw)
  To: mailing list for ConTeXt users


On Apr 13, 2008, at 3:08 AM, Taco Hoekwater wrote:

> Rory Molinari wrote:
>
>> \startvariables all
>>    degree: degree
>> \stopvariables
>
> \c!... commands (keys) are created by \startconstants,
> \v!... commands (enumerated values) by \startvariables.
>
> So:
>
>    \startconstants all
>       degree: degree
>    \stopconstants
>
> you also have a few smaller problems with the definitions
> like missing \unprotects etc, but the above is the key to
> getting it working.

Thanks Taco, that was exactly what I needed.

Cheers,
Rory

>
> Best wishes,
> Taco
> _______________________________________________________________________ 
> ____________
> If your question is of interest to others as well, please add an entry  
> to the Wiki!
>
> maillist : ntg-context@ntg.nl /  
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : https://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> _______________________________________________________________________ 
> ____________

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Adding custom key/value pairs
  2008-04-13 17:37   ` Rory Molinari
@ 2008-04-14  9:56     ` Olivier Guéry
  2008-04-14 10:18       ` Wolfgang Schuster
  0 siblings, 1 reply; 14+ messages in thread
From: Olivier Guéry @ 2008-04-14  9:56 UTC (permalink / raw)
  To: mailing list for ConTeXt users

>  Thanks Taco, that was exactly what I needed.
>
>  Cheers,
>  Rory

Can you post the good syntax you use, or put it on the wiki ?

Cheers,
Olivier.

-- 
[Message tapé sur un clavier Bépo : http://www.clavier-dvorak.org ]
Olivier nemolivier@gmail.com http://nemolivier.blogspot.com
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Adding custom key/value pairs
  2008-04-14  9:56     ` Olivier Guéry
@ 2008-04-14 10:18       ` Wolfgang Schuster
  2008-04-14 10:34         ` Olivier Guéry
  0 siblings, 1 reply; 14+ messages in thread
From: Wolfgang Schuster @ 2008-04-14 10:18 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Mon, Apr 14, 2008 at 11:56 AM, Olivier Guéry <nemolivier@gmail.com> wrote:
> >  Thanks Taco, that was exactly what I needed.
> >
> >  Cheers,
> >  Rory
>
> Can you post the good syntax you use, or put it on the wiki ?

What do you mean.

What he use use is already on the wiki and he midified it only it only.

http://wiki.contextgarden.net/Document_Titles#In_ConTeXt:_A_more_advanced_solution

Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Adding custom key/value pairs
  2008-04-14 10:18       ` Wolfgang Schuster
@ 2008-04-14 10:34         ` Olivier Guéry
  2008-04-14 10:58           ` Wolfgang Schuster
  0 siblings, 1 reply; 14+ messages in thread
From: Olivier Guéry @ 2008-04-14 10:34 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Mon, Apr 14, 2008 at 12:18 PM, Wolfgang Schuster
<schuster.wolfgang@googlemail.com> wrote:
> On Mon, Apr 14, 2008 at 11:56 AM, Olivier Guéry <nemolivier@gmail.com> wrote:
>  > >  Thanks Taco, that was exactly what I needed.
>  > >
>  > >  Cheers,
>  > >  Rory
>  >
>  > Can you post the good syntax you use, or put it on the wiki ?
>
>  What do you mean.
>
>  What he use use is already on the wiki and he midified it only it only.
>
>  http://wiki.contextgarden.net/Document_Titles#In_ConTeXt:_A_more_advanced_solution

Sorry I was thinking that there were more differences between the two.
Having various example on the wiki can  be great, to have idears… for
« normal » users like me !
But I understand that it's not totally necessary.

Regards,
Olivier.

-- 
[Message tapé sur un clavier Bépo : http://www.clavier-dvorak.org ]
Olivier nemolivier@gmail.com http://nemolivier.blogspot.com
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Adding custom key/value pairs
  2008-04-14 10:34         ` Olivier Guéry
@ 2008-04-14 10:58           ` Wolfgang Schuster
  2008-04-14 11:20             ` Taco Hoekwater
  0 siblings, 1 reply; 14+ messages in thread
From: Wolfgang Schuster @ 2008-04-14 10:58 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Mon, Apr 14, 2008 at 12:34 PM, Olivier Guéry <nemolivier@gmail.com> wrote:
>
> On Mon, Apr 14, 2008 at 12:18 PM, Wolfgang Schuster
> <schuster.wolfgang@googlemail.com> wrote:
> > On Mon, Apr 14, 2008 at 11:56 AM, Olivier Guéry <nemolivier@gmail.com> wrote:
> >  > >  Thanks Taco, that was exactly what I needed.
> >  > >
> >  > >  Cheers,
> >  > >  Rory
> >  >
> >  > Can you post the good syntax you use, or put it on the wiki ?
> >
> >  What do you mean.
> >
> >  What he use use is already on the wiki and he midified it only it only.
> >
> >  http://wiki.contextgarden.net/Document_Titles#In_ConTeXt:_A_more_advanced_solution
>
> Sorry I was thinking that there were more differences between the two.
> Having various example on the wiki can  be great, to have idears… for
> « normal » users like me !

It is easy to add a alternative key to setuptitle to switch between
different results.

I think the following link is something for you, I could make a module and
provide a few title page styles.

http://www.ctan.org/tex-archive/info/latex-samples/

> But I understand that it's not totally necessary.

Why not, I have nothing against a few predefined title pages layouts.

Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Adding custom key/value pairs
  2008-04-14 10:58           ` Wolfgang Schuster
@ 2008-04-14 11:20             ` Taco Hoekwater
  2008-04-14 11:53               ` Wolfgang Schuster
  2008-04-14 16:11               ` Aditya Mahajan
  0 siblings, 2 replies; 14+ messages in thread
From: Taco Hoekwater @ 2008-04-14 11:20 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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). The Maps module currently defines
an article in this fashion:

    \starttext
    \startArticle
       [Title=...,
        Author=...,
        RunningAuthor=...] % etc. etc.

    \startAbstract
    ... abstract ...
    \stopAbstract

    \startKeywords
    ... comma-separated keywords ...
    \stopKeywords

    ... body ...

    \stopArticle
    \stoptext

Obvious weak point: the Abstract / Keywords are too late to influence
typesetting of the title (page). Of course that could be fixed by using
named buffers and/or an explicit \maketitle-like command.

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.

Best wishes,
Taco
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Adding custom key/value pairs
  2008-04-14 11:20             ` Taco Hoekwater
@ 2008-04-14 11:53               ` Wolfgang Schuster
  2008-04-14 16:11               ` Aditya Mahajan
  1 sibling, 0 replies; 14+ messages in thread
From: Wolfgang Schuster @ 2008-04-14 11:53 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Mon, Apr 14, 2008 at 1:20 PM, Taco Hoekwater <taco@elvenkind.com> 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). The Maps module currently defines
> an article in this fashion:
>
>    \starttext
>    \startArticle
>       [Title=...,
>        Author=...,
>        RunningAuthor=...] % etc. etc.
>
>    \startAbstract
>    ... abstract ...
>    \stopAbstract
>
>    \startKeywords
>    ... comma-separated keywords ...
>    \stopKeywords
>
>    ... body ...
>
>    \stopArticle
>    \stoptext

I never thought of them, good to have someone mention this.

> Obvious weak point: the Abstract / Keywords are too late to influence
> typesetting of the title (page). Of course that could be fixed by using
> named buffers and/or an explicit \maketitle-like command.

Something like:

\def\startabstract
  {\dostartbuffer[abstract][startabstract][stopabstract]}

\startsetups titlepage

  \getbuffer[abstract]

\stopsetups

\def\starttitlepage
  {\begingroup
   \placetitle}

\def\stoptitlepage
  {\setups{titlepage}
   \endgroup}


\setuptitle
  [author=...,
   title=...]

or

\starttitlepage
  [author=...,
   title=...]

\startabstract
...
\stopabstract

...

\stoptitlepage

> 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.

To many ideas and too less time and motivation :-)

> Just saying this to let you know that I would really welcome a module
> with commands like \setuptitle, \definetitle, and \placetitle.

Greetings
Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Adding custom key/value pairs
  2008-04-14 11:20             ` Taco Hoekwater
  2008-04-14 11:53               ` Wolfgang Schuster
@ 2008-04-14 16:11               ` Aditya Mahajan
  2008-04-15 10:56                 ` Wolfgang Schuster
  1 sibling, 1 reply; 14+ messages in thread
From: Aditya Mahajan @ 2008-04-14 16:11 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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.

Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Adding custom key/value pairs
  2008-04-14 16:11               ` Aditya Mahajan
@ 2008-04-15 10:56                 ` Wolfgang Schuster
  2008-04-15 15:34                   ` Aditya Mahajan
  0 siblings, 1 reply; 14+ messages in thread
From: Wolfgang Schuster @ 2008-04-15 10:56 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Mon, Apr 14, 2008 at 6:11 PM, Aditya Mahajan <adityam@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.

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

Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Adding custom key/value pairs
  2008-04-15 10:56                 ` Wolfgang Schuster
@ 2008-04-15 15:34                   ` Aditya Mahajan
  2008-04-17  8:24                     ` Wolfgang Schuster
  0 siblings, 1 reply; 14+ messages in thread
From: Aditya Mahajan @ 2008-04-15 15:34 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Wolfgang,

On Tue, 15 Apr 2008, Wolfgang Schuster wrote:

> On Mon, Apr 14, 2008 at 6:11 PM, Aditya Mahajan <adityam@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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Adding custom key/value pairs
  2008-04-15 15:34                   ` Aditya Mahajan
@ 2008-04-17  8:24                     ` Wolfgang Schuster
  2008-04-17  8:42                       ` Taco Hoekwater
  0 siblings, 1 reply; 14+ messages in thread
From: Wolfgang Schuster @ 2008-04-17  8:24 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Tue, Apr 15, 2008 at 5:34 PM, Aditya Mahajan <adityam@umich.edu> wrote:
> Hi Wolfgang,
>
>
> On Tue, 15 Apr 2008, Wolfgang Schuster wrote:
>
> > On Mon, Apr 14, 2008 at 6:11 PM, Aditya Mahajan <adityam@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.

I module should be enogh for the start, makes it easier to test without
the need to create a new relase or replace one of the core files and to
generate a new format file.

> 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
>   ]

I would replace headetext with \setuphead[abstract] and the format
for the table of content (is this what do you mean with "for the content")
with \setuplist but should abstract use a own command to place the
title \definehead[abstract]  or can we use one of the predefined ones
(title -- new page or subject -- if you need a abstract in different languages
on one page).

> 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.

Can't the abstract just placed after the text has been set with
\start/\stopabstract.

> 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.

Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Adding custom key/value pairs
  2008-04-17  8:24                     ` Wolfgang Schuster
@ 2008-04-17  8:42                       ` Taco Hoekwater
  0 siblings, 0 replies; 14+ messages in thread
From: Taco Hoekwater @ 2008-04-17  8:42 UTC (permalink / raw)
  To: mailing list for ConTeXt users



Wolfgang Schuster wrote:
> 
> Can't the abstract just placed after the text has been set with
> \start/\stopabstract.

Better not, because placement and spacing around and between
and relative ordering of abstracts and keywords are often bound
to very specific rules. Rules you don't want to burden users
with, like

   "if there is an english abstract, it should come before the
    german abstract. If there are freestyle keywords on top of the
    required classifications, they should follow the abstracts with
    a space above of 12pt and below of 12ot, otherwise there should
    be space below the classifications of 24pt, unless a motto
    (see below) is also given".

You get the idea? Journal editors can be evil bastards sometimes....

Best wishes,
Taco
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2008-04-17  8:42 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-12 19:44 Adding custom key/value pairs Rory Molinari
2008-04-13 10:08 ` Taco Hoekwater
2008-04-13 17:37   ` Rory Molinari
2008-04-14  9:56     ` Olivier Guéry
2008-04-14 10:18       ` Wolfgang Schuster
2008-04-14 10:34         ` Olivier Guéry
2008-04-14 10:58           ` Wolfgang Schuster
2008-04-14 11:20             ` Taco Hoekwater
2008-04-14 11:53               ` Wolfgang Schuster
2008-04-14 16:11               ` Aditya Mahajan
2008-04-15 10:56                 ` Wolfgang Schuster
2008-04-15 15:34                   ` Aditya Mahajan
2008-04-17  8:24                     ` Wolfgang Schuster
2008-04-17  8:42                       ` Taco Hoekwater

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).