ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* (no subject)
@ 2010-02-22 14:25 Roger Mason
  2011-09-10 15:39 ` Document title (was: (no subject)) Wolfgang Schuster
  0 siblings, 1 reply; 8+ messages in thread
From: Roger Mason @ 2010-02-22 14:25 UTC (permalink / raw)
  To: ntg-context

Hello,

I'm working on a project to set up exams, basing the work on Aditya's
asignment class that was published in Practex in 2006.

I have a problem getting title information printed correctly.  This is a
cut-down version:

\setupcolors  [state=start]
\definecolor  [colorone]    [r=0.625,g=0,b=0] %dark red
\definecolor  [colortwo]    [b=0.625,g=0,r=0] %dark blue

\def\exam[#1]
  {\getrawparameters
    [Exam]
    [     title=
         course=,
           date=,
          start=,
           stop=,
              #1]
  \title{\Examtitle}}

\definefont [BigFontOne]  [RegularSlanted sa 2.5]
\definefont [BigFontTwo]  [Regular sa 1.5]

\setuphead[title]
 [  style=\BigFontOne,
  command=\examtitle,
   before={},
    after={\blank[big] \bgroup \colortwo
     Date: \expanded{\date[Examdate]}
    \hfill
    Start: \expanded{Examstart}
    Stop: \expanded{Examstop}
   \egroup\blank},
 ]

%D This macro does the actual typesetting of the title
\def\examtitle#1#2%
  {\framed[
              width=broad,
              frame=off,
              align=middle,
    foregroundcolor=colortwo,
         % I want a shadow around the title frame
         background=shadow]
      {#2\\{Examcourse}}}

\exam[
  title=Mid-term 2010,
  course=ES2917,
  date={d=17,m=2,y=2010},
  start={9:00 am},
  stop={11:00 am}
]

I'm processing this with Mark II.  The problems are that

(1) The literal 'Examcourse' is typeset;
(2) Today's date is typset, not the one entered in the interface;
(3) The start and stop times are typeset as literals 'Examstart' &
'Examstop'

Thanks for any help,
Roger


%%% Local Variables: 
%%% mode: context
%%% TeX-master: t
%%% End: 
___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Document title (was: (no subject))
  2010-02-22 14:25 (no subject) Roger Mason
@ 2011-09-10 15:39 ` Wolfgang Schuster
  2011-09-10 16:20   ` Aditya Mahajan
  0 siblings, 1 reply; 8+ messages in thread
From: Wolfgang Schuster @ 2011-09-10 15:39 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 22.02.2010 um 15:25 schrieb Roger Mason:

> Hello,
> 
> I'm working on a project to set up exams, basing the work on Aditya's
> asignment class that was published in Practex in 2006.
> 
> I have a problem getting title information printed correctly.  This is a
> cut-down version:
> 
> […]
> 
> I'm processing this with Mark II.  The problems are that
> 
> (1) The literal 'Examcourse' is typeset;
> (2) Today's date is typset, not the one entered in the interface;
> (3) The start and stop times are typeset as literals 'Examstart' & 'Examstop'

You forgot the backslash in front of your values.

It’s also bad style to misuse the \title command for your document title
because \title is only the unnumbered version of \chapter, nothing else.

Another way to create your document title is the following code:

\setupcolors  [state=start]

\definecolor  [colorone]    [r=0.625,g=0,b=0] %dark red
\definecolor  [colortwo]    [b=0.625,g=0,r=0] %dark blue

\startsetups examtitle

    \startframedtext
        [
            width=broad,
            frame=off,
            align=middle,
            foregroundcolor=colortwo,
            background=shadow,
        ]

        {\definedfont[RegularSlanted sa 2.5]\getvariable{exam}{title}}
        \blank
        \getvariable{exam}{course}

    \stopframedtext

    \blank[big]

    \startcolor[colortwo]

        \doifelsevariable{exam}{date}{\expanded{\date[\getvariable{exam}{date}]}}{\currentdate}
        \hfill
        Start: \getvariable{exam}{start}
        \space
        Stop: \getvariable{exam}{stop}

    \stopcolor

    \blank

\stopsetups

\setvariables[exam][set={\setups[examtitle]}]

\starttext

\setvariables
  [exam]
  [ title=Mid-term 2010,
   course=ES2917,
     date={d=17,m=2,y=2010},
    start={9:00 am},
     stop={11:00 am}]

\stoptext

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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Document title (was: (no subject))
  2011-09-10 15:39 ` Document title (was: (no subject)) Wolfgang Schuster
@ 2011-09-10 16:20   ` Aditya Mahajan
  2011-09-11  9:05     ` Wolfgang Schuster
  0 siblings, 1 reply; 8+ messages in thread
From: Aditya Mahajan @ 2011-09-10 16:20 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1842 bytes --]

On Sat, 10 Sep 2011, Wolfgang Schuster wrote:

>
> Am 22.02.2010 um 15:25 schrieb Roger Mason:
>
>> Hello,
>>
>> I'm working on a project to set up exams, basing the work on Aditya's
>> asignment class that was published in Practex in 2006.
>>
>> I have a problem getting title information printed correctly.  This is a
>> cut-down version:
>>
>> […]
>>
>> I'm processing this with Mark II.  The problems are that
>>
>> (1) The literal 'Examcourse' is typeset;
>> (2) Today's date is typset, not the one entered in the interface;
>> (3) The start and stop times are typeset as literals 'Examstart' & 'Examstop'
>
> You forgot the backslash in front of your values.
>
> It’s also bad style to misuse the \title command for your document title
> because \title is only the unnumbered version of \chapter, nothing else.

OK. That style was my first real project with ConTeXt, so it some 
non-canonical setups. These days I use:

\definehead[assignment][...]

\setuphead[assignment][...]

\startassignment[...]
  ...
\stopassignment

which gives a much better control over the exported xhtml file.


> Another way to create your document title is the following code:

> \setupcolors  [state=start]
>
> \definecolor  [colorone]    [r=0.625,g=0,b=0] %dark red
> \definecolor  [colortwo]    [b=0.625,g=0,r=0] %dark blue
>
> \startsetups examtitle
> [...]
> \stopsetups
>
> \setvariables[exam][set={\setups[examtitle]}]
>
> \starttext
>
> \setvariables
>  [exam]
>  [ title=Mid-term 2010,
>   course=ES2917,
>     date={d=17,m=2,y=2010},
>    start={9:00 am},
>     stop={11:00 am}]
>
> \stoptext

Nice, I didn't realize that set key could be used this way.

If one is also interested in a usable XML export, then some 
\starttag..\stoptag must be added to the setups.

Aditya

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Document title (was: (no subject))
  2011-09-10 16:20   ` Aditya Mahajan
@ 2011-09-11  9:05     ` Wolfgang Schuster
  2011-09-11 14:49       ` Aditya Mahajan
  0 siblings, 1 reply; 8+ messages in thread
From: Wolfgang Schuster @ 2011-09-11  9:05 UTC (permalink / raw)
  To: Aditya Mahajan; +Cc: mailing list for ConTeXt users


Am 10.09.2011 um 18:20 schrieb Aditya Mahajan:

> If one is also interested in a usable XML export, then some \starttag..\stoptag must be added to the setups.

How about this: http://d.pr/o7Xz

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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Document title (was: (no subject))
  2011-09-11  9:05     ` Wolfgang Schuster
@ 2011-09-11 14:49       ` Aditya Mahajan
  2011-09-11 16:21         ` Wolfgang Schuster
  0 siblings, 1 reply; 8+ messages in thread
From: Aditya Mahajan @ 2011-09-11 14:49 UTC (permalink / raw)
  To: Wolfgang Schuster; +Cc: mailing list for ConTeXt users

On Sun, 11 Sep 2011, Wolfgang Schuster wrote:

>
> Am 10.09.2011 um 18:20 schrieb Aditya Mahajan:
>
>> If one is also interested in a usable XML export, then some \starttag..\stoptag must be added to the setups.
>
> How about this: http://d.pr/o7Xz

Thanks, that is very nice.

Can you make the alignment and the \blanks configurable, perhaps using 
spacebefore and spaceafter?

Is there an easy way to add multiple authors. Sometimes you need to add 
authors and their affiliation and I don't know what is a 
good key-value driven way to add them.

Thanks,
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Document title (was: (no subject))
  2011-09-11 14:49       ` Aditya Mahajan
@ 2011-09-11 16:21         ` Wolfgang Schuster
  2011-09-11 23:20           ` Aditya Mahajan
  0 siblings, 1 reply; 8+ messages in thread
From: Wolfgang Schuster @ 2011-09-11 16:21 UTC (permalink / raw)
  To: Aditya Mahajan; +Cc: mailing list for ConTeXt users


Am 11.09.2011 um 16:49 schrieb Aditya Mahajan:

> On Sun, 11 Sep 2011, Wolfgang Schuster wrote:
> 
>> 
>> Am 10.09.2011 um 18:20 schrieb Aditya Mahajan:
>> 
>>> If one is also interested in a usable XML export, then some \starttag..\stoptag must be added to the setups.
>> 
>> How about this: http://d.pr/o7Xz
> 
> Thanks, that is very nice.
> 
> Can you make the alignment and the \blanks configurable, perhaps using spacebefore and space after?

I can but when you need customization write your own style.

> Is there an easy way to add multiple authors. Sometimes you need to add authors and their affiliation and I don't know what is a good key-value driven way to add them.

The ConTeXt way would be “author={Author One,Author Two,…}” but with MkIV you can use Lua to provide a alternative key-val-interface:

\startplacetitle
    title = "…",
    author = {
        "First author",
        "Second author",
        "…",
    } ,
    date = "\\curentdate"
\stopplacetitle

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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Document title (was: (no subject))
  2011-09-11 16:21         ` Wolfgang Schuster
@ 2011-09-11 23:20           ` Aditya Mahajan
  2011-09-12 15:06             ` Wolfgang Schuster
  0 siblings, 1 reply; 8+ messages in thread
From: Aditya Mahajan @ 2011-09-11 23:20 UTC (permalink / raw)
  To: Wolfgang Schuster; +Cc: mailing list for ConTeXt users

[-- Attachment #1: Type: TEXT/PLAIN, Size: 2263 bytes --]

On Sun, 11 Sep 2011, Wolfgang Schuster wrote:

>
> Am 11.09.2011 um 16:49 schrieb Aditya Mahajan:
>
>> On Sun, 11 Sep 2011, Wolfgang Schuster wrote:
>>
>>>
>>> Am 10.09.2011 um 18:20 schrieb Aditya Mahajan:
>>>
>>>> If one is also interested in a usable XML export, then some \starttag..\stoptag must be added to the setups.
>>>
>>> How about this: http://d.pr/o7Xz
>>
>> Thanks, that is very nice.
>>
>> Can you make the alignment and the \blanks configurable, perhaps using spacebefore and space after?
>
> I can but when you need customization write your own style.

OK. Do you plan to release this on contextgarden? This will simplify the 
title page setup of the simple-slides module. I think that others might 
find it useful as well. If you don't want to go through the hassle, I can
maintain it.

>> Is there an easy way to add multiple authors. Sometimes you need to add authors and their affiliation and I don't know what is a good key-value driven way to add them.
>
> The ConTeXt way would be “author={Author One,Author Two,…}” but with MkIV you can use Lua to provide a alternative key-val-interface:
>
> \startplacetitle
>    title = "…",
>    author = {
>        "First author",
>        "Second author",
>        "…",
>    } ,
>    date = "\\curentdate"
> \stopplacetitle

Sorry, I should have explained in more detail. Suppose I want to indicate 
that there are two authors, "first author" and "second author". First 
author is at "institute 1" and second author is at institute 2. I want 
authors and institutes to be set in different styles. There are a couple 
of ways of setting this up:

\setuptitle
    [
 	authors={ {name={First author}, institute={insitute 1}},
 	          {name={Second author}, institute={insitute 2}} },
     ...
    ]

or

\setuptitle
   [author1]
   [name={First author},
    insititute={institute 1}]

\setuptitle
   [author2]
   [name={Second author},
    institute={institute 2}]

\setuptitle
   [authors={author1, author2}]


or

\setuptitle
   [authors={First author, second author},
    institutes={institute 1, institute 2}]


To me, none of these look satisfatory, so I am wondering if there is a better
solution.

Thanks,
Aditya

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Document title (was: (no subject))
  2011-09-11 23:20           ` Aditya Mahajan
@ 2011-09-12 15:06             ` Wolfgang Schuster
  0 siblings, 0 replies; 8+ messages in thread
From: Wolfgang Schuster @ 2011-09-12 15:06 UTC (permalink / raw)
  To: Aditya Mahajan; +Cc: mailing list for ConTeXt users


Am 12.09.2011 um 01:20 schrieb Aditya Mahajan:

> On Sun, 11 Sep 2011, Wolfgang Schuster wrote:
> 
>> 
>> Am 11.09.2011 um 16:49 schrieb Aditya Mahajan:
>> 
>>> On Sun, 11 Sep 2011, Wolfgang Schuster wrote:
>>> 
>>>> 
>>>> Am 10.09.2011 um 18:20 schrieb Aditya Mahajan:
>>>> 
>>>>> If one is also interested in a usable XML export, then some \starttag..\stoptag must be added to the setups.
>>>> 
>>>> How about this: http://d.pr/o7Xz
>>> 
>>> Thanks, that is very nice.
>>> 
>>> Can you make the alignment and the \blanks configurable, perhaps using spacebefore and space after?
>> 
>> I can but when you need customization write your own style.
> 
> OK. Do you plan to release this on contextgarden? This will simplify the title page setup of the simple-slides module. I think that others might find it useful as well. If you don't want to go through the hassle, I can maintain it.

I can put the module on the garden but not yet, until then you can find the recent version here: https://bitbucket.org/wolfs/title

>>> Is there an easy way to add multiple authors. Sometimes you need to add authors and their affiliation and I don't know what is a good key-value driven way to add them.
>> 
>> The ConTeXt way would be “author={Author One,Author Two,…}” but with MkIV you can use Lua to provide a alternative key-val-interface:
>> 
>> \startplacetitle
>>   title = "…",
>>   author = {
>>       "First author",
>>       "Second author",
>>       "…",
>>   } ,
>>   date = "\\curentdate"
>> \stopplacetitle
> 
> Sorry, I should have explained in more detail. Suppose I want to indicate that there are two authors, "first author" and "second author". First author is at "institute 1" and second author is at institute 2. I want authors and institutes to be set in different styles. There are a couple of ways of setting this up:
> 
> […]
> 
> To me, none of these look satisfatory, so I am wondering if there is a better solution.

I can see what you mean and this is why a suggested a Lua input:

author = {
    [1] = { name = "…", institute = "…" },
    [2] = { name = "…", institute = "…" },
    …
}

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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

end of thread, other threads:[~2011-09-12 15:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-22 14:25 (no subject) Roger Mason
2011-09-10 15:39 ` Document title (was: (no subject)) Wolfgang Schuster
2011-09-10 16:20   ` Aditya Mahajan
2011-09-11  9:05     ` Wolfgang Schuster
2011-09-11 14:49       ` Aditya Mahajan
2011-09-11 16:21         ` Wolfgang Schuster
2011-09-11 23:20           ` Aditya Mahajan
2011-09-12 15:06             ` Wolfgang Schuster

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