ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Enumerations and numbered labels
@ 2007-07-10 10:45 Norbert Zeh
  2007-07-10 11:38 ` Wolfgang Schuster
  2007-07-11  7:39 ` Aditya Mahajan
  0 siblings, 2 replies; 5+ messages in thread
From: Norbert Zeh @ 2007-07-10 10:45 UTC (permalink / raw)
  To: ntg-context

Hi folks,

I've recently started to consider ConTeXt as an alternative to my  
long-time friend LaTeX.  I like ConTeXt very much but noticed a few  
things that are either less than ideal or maybe I simply haven't  
figured out yet how to do them right.  Here are the first two:

1)  Enumerations

I've read in a few places that this is what is to be used whenever I  
would use theorem-style environments in latex.  There are two things  
I seem to be unable to do:  Creating Theorems that look like this.

---------------------
THEOREM 1  It would be nice if Context could produce a theorem where  
the title is not separated from the text and the next line has no  
hanging indent.
---------------------

I was able to produce only

----------------------
THEOREM 1

It would be nice ...
----------------------

or

----------------------
THEOREM 1  It would
         be nice ...
----------------------

using location=top or location=hanging.  What I want is no hanging  
indent at all.  (I also tried location=serried, which produced an  
overly large gap between THEOREM 1 and the theorem text.  The second  
thing I am used to in latex is the option to place things in  
parentheses by providing an optional argument to the environment.   
E.g., in assignments I typeset, I often have either

\begin{question}
...
\end{question}

which simply produces

--------------------
Question 1  ...
--------------------

or

\begin{question}[20 marks]
...
\end{question}

which produces

--------------------
Question 1  (20 marks)  ...
--------------------

This second option is easy to simulate if I can produce something  
that has no hanging indents.  As it is, I can't.

2)  Numbered labels

I tried to use numbered labels plus a little bit of tex-code to  
simulate the above environment.  The gist is that I used

\definelabel[question][location=intext,text=Question]

to define the label and, wherever I needed a new question, \question 
[ref].

The result of writing \question[ref], however, was "Question Question  
1".  The label always seemed to be duplicated for some reason.  Is  
this a known bug?

Thanks for your help with this.

Cheers,
Norbert

--
NORBERT ZEH
Faculty of Computer Science : Dalhousie University
nzeh@cs.dal.ca : http://www.cs.dal.ca/~nzeh : 902.494.3154


___________________________________________________________________________________
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] 5+ messages in thread

* Re: Enumerations and numbered labels
  2007-07-10 10:45 Enumerations and numbered labels Norbert Zeh
@ 2007-07-10 11:38 ` Wolfgang Schuster
  2007-07-11  7:39 ` Aditya Mahajan
  1 sibling, 0 replies; 5+ messages in thread
From: Wolfgang Schuster @ 2007-07-10 11:38 UTC (permalink / raw)
  To: mailing list for ConTeXt users

2007/7/10, Norbert Zeh <nzeh@cs.dal.ca>:
> Hi folks,
>
> I've recently started to consider ConTeXt as an alternative to my
> long-time friend LaTeX.  I like ConTeXt very much but noticed a few
> things that are either less than ideal or maybe I simply haven't
> figured out yet how to do them right.  Here are the first two:
>
> 1)  Enumerations
>
> I've read in a few places that this is what is to be used whenever I
> would use theorem-style environments in latex.  There are two things
> I seem to be unable to do:  Creating Theorems that look like this.
>
> ---------------------
> THEOREM 1  It would be nice if Context could produce a theorem where
> the title is not separated from the text and the next line has no
> hanging indent.
> ---------------------

\defineenumeration[theorem][text=THEOREM,location=left,hang=1]

\starttext

\theorem \input knuth

\stoptext

> I was able to produce only
>
> ----------------------
> THEOREM 1
>
> It would be nice ...
> ----------------------
>
> or
>
> ----------------------
> THEOREM 1  It would
>          be nice ...
> ----------------------
>
> using location=top or location=hanging.  What I want is no hanging
> indent at all.  (I also tried location=serried, which produced an
> overly large gap between THEOREM 1 and the theorem text.  The second
> thing I am used to in latex is the option to place things in
> parentheses by providing an optional argument to the environment.
> E.g., in assignments I typeset, I often have either
>
> \begin{question}
> ...
> \end{question}
>
> which simply produces
>
> --------------------
> Question 1  ...
> --------------------
>
> or
>
> \begin{question}[20 marks]
> ...
> \end{question}
>
> which produces
>
> --------------------
> Question 1  (20 marks)  ...
> --------------------
>
> This second option is easy to simulate if I can produce something
> that has no hanging indents.  As it is, I can't.
>
> 2)  Numbered labels
>
> I tried to use numbered labels plus a little bit of tex-code to
> simulate the above environment.  The gist is that I used
>
> \definelabel[question][location=intext,text=Question]
>
> to define the label and, wherever I needed a new question, \question
> [ref].
>
> The result of writing \question[ref], however, was "Question Question
> 1".  The label always seemed to be duplicated for some reason.  Is
> this a known bug?

http://www.tug.org/pracjourn/2006-4/mahajan/

> Thanks for your help with this.
>
> Cheers,
> Norbert

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] 5+ messages in thread

* Re: Enumerations and numbered labels
  2007-07-10 10:45 Enumerations and numbered labels Norbert Zeh
  2007-07-10 11:38 ` Wolfgang Schuster
@ 2007-07-11  7:39 ` Aditya Mahajan
  2007-07-11  9:18   ` Norbert Zeh
  1 sibling, 1 reply; 5+ messages in thread
From: Aditya Mahajan @ 2007-07-11  7:39 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Tue, 10 Jul 2007, Norbert Zeh wrote:

> E.g., in assignments I typeset, I often have either
>
> \begin{question}
> ...
> \end{question}
>
> which simply produces
>
> --------------------
> Question 1  ...
> --------------------
>
> or
>
> \begin{question}[20 marks]
> ...
> \end{question}
>
> which produces
>
> --------------------
> Question 1  (20 marks)  ...
> --------------------
>
> This second option is easy to simulate if I can produce something
> that has no hanging indents.  As it is, I can't.

\defineenueration[question][title=yes]

\startquestion
...
\stopquestion

and

\startquestion {20 marks}
....
\stopquestion

title is a relatively new feature and right now there is no 
documentation for it. Search in the dev mailing list for theorems for 
some examples. If you want some specific details, ask here. I will 
write a myway on theorems "soon".


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] 5+ messages in thread

* Re: Enumerations and numbered labels
  2007-07-11  7:39 ` Aditya Mahajan
@ 2007-07-11  9:18   ` Norbert Zeh
  2007-07-12 13:39     ` Wolfgang Schuster
  0 siblings, 1 reply; 5+ messages in thread
From: Norbert Zeh @ 2007-07-11  9:18 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Ah, excellent.  Also thanks to Wolfgang for his earlier comment.  I  
had looked at location=left before but was thrown off by the  
excessive distance between the heading and the text...until I  
discovered the meaning of width=fit.  As you can see, I'm new to  
context.

Has anybody looked into the bug (?) with numbered labels?

Cheers,
Norbert

On 11-Jul-07, at 4:39 AM, Aditya Mahajan wrote:

> On Tue, 10 Jul 2007, Norbert Zeh wrote:
>
>> E.g., in assignments I typeset, I often have either
>>
>> \begin{question}
>> ...
>> \end{question}
>>
>> which simply produces
>>
>> --------------------
>> Question 1  ...
>> --------------------
>>
>> or
>>
>> \begin{question}[20 marks]
>> ...
>> \end{question}
>>
>> which produces
>>
>> --------------------
>> Question 1  (20 marks)  ...
>> --------------------
>>
>> This second option is easy to simulate if I can produce something
>> that has no hanging indents.  As it is, I can't.
>
> \defineenueration[question][title=yes]
>
> \startquestion
> ...
> \stopquestion
>
> and
>
> \startquestion {20 marks}
> ....
> \stopquestion
>
> title is a relatively new feature and right now there is no
> documentation for it. Search in the dev mailing list for theorems for
> some examples. If you want some specific details, ask here. I will
> write a myway on theorems "soon".
>
>
> 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
> ______________________________________________________________________ 
> _____________

--
NORBERT ZEH
Faculty of Computer Science : Dalhousie University
nzeh@cs.dal.ca : http://www.cs.dal.ca/~nzeh : 902.494.3154

___________________________________________________________________________________
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] 5+ messages in thread

* Re: Enumerations and numbered labels
  2007-07-11  9:18   ` Norbert Zeh
@ 2007-07-12 13:39     ` Wolfgang Schuster
  0 siblings, 0 replies; 5+ messages in thread
From: Wolfgang Schuster @ 2007-07-12 13:39 UTC (permalink / raw)
  To: mailing list for ConTeXt users

2007/7/11, Norbert Zeh <nzeh@cs.dal.ca>:
> Ah, excellent.  Also thanks to Wolfgang for his earlier comment.  I
> had looked at location=left before but was thrown off by the
> excessive distance between the heading and the text...until I
> discovered the meaning of width=fit.  As you can see, I'm new to
> context.
>
> Has anybody looked into the bug (?) with numbered labels?
>
> Cheers,
> Norbert

\unprotect

\def\do@@label[#1][#2]%
  {\numberparameter{#1}\c!before
   \numberparameter{#1}\c!command
     {\doattributes{\@@thenumber{#1}}\c!headstyle\c!headcolor
        {%\dotextprefix{\numberparameter{#1}\c!text}%
         \getvalue{\e!next#1}[#2]}}%
   \numberparameter{#1}\c!after}%

\protect

\definelabel[frage][text=Frage,location=inmargin]

\starttext

\frage text

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


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

end of thread, other threads:[~2007-07-12 13:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-10 10:45 Enumerations and numbered labels Norbert Zeh
2007-07-10 11:38 ` Wolfgang Schuster
2007-07-11  7:39 ` Aditya Mahajan
2007-07-11  9:18   ` Norbert Zeh
2007-07-12 13:39     ` 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).