Re: [NTG-context] memoir-style chapter heading

2020-08-18 Thread jbf
Thank you Otared. The power of ConTeXt never ceases to amaze me, though 
despite the excellent work done on the wiki recently, it is the little 
things like the use of \raise that could be better described, especially 
in a range of applied instances. We find it, combined with hbox, in 
reference to marginal and centered headers, but it is not intuitive - 
for me at least - to be able to apply it as you have done in your 
example. The little process we have gone through, which is step-by-step, 
is most helpful, and I feel that I can now use these ideas in other 
instances and in slightly different ways. Thank you.


How important is the 'lohi' addition you made to \framed? I removed it 
to see what would happen and did not notice any appreciable difference 
in the output.


Julian

On 18/8/20 11:19 pm, Otared Kavian wrote:

Hi Julian,

Actually one can tweak more or less the height at which the chapter number 
appears: below is an example in which one uses \raise and \hbox.

\setuppagenumbering[state=start,location=footer]
\setuphead[chapter]
[
%   numberstyle={\switchtobodyfont[48pt]},
numbercolor=gray,
alternative=command,
command=\MemoirChapter,
]

%\define[2]\MemoirChapter
%   {\startoverlay
%   {#1}
%   {#2}
%   \stopoverlay}


\define[2]\MemoirChapter
{\framed[frame=off,width=broad,align={middle,lohi}]
{\startoverlay
{\raise1.5ex\hbox{\switchtobodyfont[48pt]#1}}
{#2}
\stopoverlay}
}

\starttext
\startchapter[title={This is a test},ownnumber=1234]
\input knuth.tex

\stopchapter

\stoptext

Best regards: Otared


On 18 Aug 2020, at 11:47, jbf  wrote:

Thanks Otared - and whether using the earlier example (Aditya's with my minor 
'centering' adjustment)) or yours, I agree - the number is just a bit too low, 
and of course, using this method we probably can't make adjustments to that. So 
ultimately it looks like I'll have to get my skills up to working with layers 
as well as overlays, where minute adjustments of the kind can be made. But 
wouldn't it be great if we could just do a bit of vertical adjustment in the 
overlay!

Julian

On 18/8/20 6:45 pm, Otared Kavian wrote:

Hi Julian,

Indeed you can modify slightly what Aditya said to obtain what you want: you 
can put the overlay into a framed environment as in the following example. 
Though, to my taste the number is a little bit too low…

%% begin example
\setuppagenumbering[state=start,location=footer]
\setuphead[chapter]
[
numberstyle={\switchtobodyfont[48pt]},
numbercolor=gray,
alternative=command,
command=\MemoirChapter,
]

\define[2]\MemoirChapter
{\framed[frame=off,width=broad,align=middle]
{\startoverlay
{#1}
{#2}
\stopoverlay}
}

\starttext
\startchapter[title={This is a test}]
\input knuth.tex

\stopchapter

\stoptext
%% end example

Best regards: Otared


On 18 Aug 2020, at 01:18, jbf  wrote:

I meant to include an example of what I mean, since at least it seems to work 
(am including just the definition part of your example), So at least I can get 
middle and right alignment.

\define[2]\MemoirChapter
  {\midaligned{\startoverlay
   {#1}
   {#2}
 \stopoverlay}}

Julian

On 17/8/20 4:54 pm, Aditya Mahajan wrote:

On Mon, 17 Aug 2020, jbf wrote:


Am completely new to using Metafun, which I presume I would need to use
to achieve a Hansen Memoir-style Chapter heading (chapter title
overlayed on a large lightgray number). Of course, I am assuming I would
need to use Metafun to create this...

So my first question is to ask if I could achieve the same effect
without Metafun?

I have read through the Metafun manual, and I think I can understand how
to overlay text on a graphic (MP), but it would be currently beyond me
to draw numbers of the kind we find in, say, the Memoir examples.

Has anyone created such an example? I was keenly looking for one in the
manual and elsewhere, in terms of ConTeXt/Metafun commands, but could
not find one. But I'd be quite prepared to 'have a go' at this, if I had
some pointers of just where to start! I assume I would have to
\defineoverlay[number] and then add text on top \framed (but without the
frame borders). Am I at least correct about this?

You don't need metafun for something this simple. Here is a crude 
implementation:

\setuphead[chapter]
   [
 numberstyle={\switchtobodyfont[48pt]},
 numbercolor=gray,
 alternative=command,
 command=\MemoirChapter,
   ]

\define[2]\MemoirChapter%
   {\startoverlay
   {#1}
   {#2}
 \stopoverlay}
   \starttext
\startchapter[title={This is a test}]
\stopchapter

\stoptext

Overlays don't allow tuning the location...for that you need layers. See the 
chapter on 

Re: [NTG-context] Chapter number with Luametafun

2020-08-18 Thread Wolfgang Schuster

Fabrice Couvreur schrieb am 18.08.2020 um 16:24:

Hello,
How to get the number of the current chapter ?


\namedheadnumber{chapter}


How to get the label "Chapitre" ?


\labeltext{chapter}

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] Chapter number with Luametafun

2020-08-18 Thread Fabrice Couvreur
Hello,
How to get the number of the current chapter ?
How to get the label "Chapitre" ?
Thanks for your help.
Fabrice

%%% Begin example

\mainlanguage[fr]

\setcharacterspacing [frenchpunctuation]

\setuplabeltext[fr][chapter=Chapitre~]

\startuseMPgraphic{fun}
  definecolor[name="Mycolor", s = 0.85 ]
  draw lmt_outline
   [
text = "1",
kind = "fillup",
fillcolor = "Mycolor",
rulethickness = 1,
   ]
  xsized 1cm;
\stopuseMPgraphic

\unexpanded\def\MyNumber#1{\useMPgraphic{fun}#1}

\unexpanded\def\Title#1#2{\framed[frame=off,width=fit,align=flushleft]
  {#1\blank#2}}

\setuphead[chapter]
  [style=\bfd,
   align={flushleft,broad},
   command=\Title,
   textcommand=\MyNumber,
   numbercommand=\groupedcommand{}{\MyNumber},
   number=no]

\starttext
\startchapter
  [title={First chapter}]
  \input knuth.tex
\stopchapter
\startchapter
  [title={Second chapter}]
  \input knuth.tex
\stopchapter
\stoptext

%%% end example
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] Index confusion with first entry

2020-08-18 Thread Henning Hraban Ramm
Hi, my index of locations shows a strange problem:

Hamburg 6, 12, 14, 24–25, 27, 31, 33, 35, 44, 46, 48, 57, 59, 64, 75, 79, 81, 
93–94, 96, 102, 104–105, 108–110, 112, 116–118, 120, 121–125, 6, 126–135, 6, 
137– 147, 149, 151–159, 161, 165, 168, 169–171, 174, 176, 178, 182, 207, 209, 
211, 215–216, 219–220, 224, 240, 242–244, 291

Page 6 is mentioned two times out of order. The problem doesn’t show at other 
locations.

The first index entry (p.6) is made by 
\startregister[locations][test]{Someplace}, second is Hamburg (single entry).
If I replace Hamburg with another town, the problem moves.
If I move the Hamburg entry in front of \startregister, it disappears!

I.e. if the first index entry is set by \startregister, the subsequent entry 
gets confused.

I tried to come up with a MWE, but couldn’t reproduce the problem in a simple 
example like

\starttext

\placeregister[index][criterium=all]

\startregister[index][test]{Knuth}
  \input tufte
  \index{Donald}
  \page
  \input knuth
  \index{Donald}
  \page
\stopregister[index][test]

\input darwin
\page

\dorecurse{5}{
\input knuth
\index{Knuth}\index{Donald}
\page
}

\stoptext


Hraban
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] TOC chapter and section numbering

2020-08-18 Thread Adrian
Hello,

I'm attempting to typeset a short book using ConTeXt (current version: 
2020.08.09 22:03).

EXAMPLE:

\setuplist[content][alternative=c]

\setuphead[title][alternative=middle,style=cap]

\setuphead[chapter][number=no]

\setuphead[section][sectionsegments=section]

\setuplist[section][width=1.5em,margin=3em]

\starttext
\title{contents}
\placecontent

\startchapter[title={Introductory}]
\startsection[title={The concept of a function}]
\stopsection
\startsection[title={Extension and intension}]
\stopsection
\startsection[title={Functions of several variables}]
\stopsection
\startsection[title={Abstraction}]
\stopsection
\stopchapter

\startchapter[title={Lambda-Conversion}]

\startsection[title={Primitive symbols, and formulas}]
\stopsection
\startsection[title={Conversion}]
\stopsection
\startsection[title={Fundamental theorems on well-formed formulas and on the 
normal form}]
\stopsection
\stopchapter

\stoptext

I would like all the chapters to be prefixed with "Chapter RN." and the 
sections to keep a single count,
for example:

Chapter I. Introductory .
1. The concept of a function
2. Extension and intension
3. Functions of several variables
4. Abstraction
Chapter II. Lambda Conversion .
5. Primitive symbols and formulas
6. Conversion
7. Fundamental theorems on well-formed formulas and on the normal form

I tried to the following for the chapters:

\defineconversion[church][Chapter \Romannumerals.\quad]

\setuphead[chapter][conversion=church]

Which appeared to generate the prefix correctly but it overlapped the title.

Any help would be greatly appreciated. Thanks

Adrian___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] memoir-style chapter heading

2020-08-18 Thread Otared Kavian
Hi Julian,

Indeed you can modify slightly what Aditya said to obtain what you want: you 
can put the overlay into a framed environment as in the following example. 
Though, to my taste the number is a little bit too low…

%% begin example
\setuppagenumbering[state=start,location=footer]
\setuphead[chapter]
[
numberstyle={\switchtobodyfont[48pt]},
numbercolor=gray,
alternative=command,
command=\MemoirChapter,
]

\define[2]\MemoirChapter
{\framed[frame=off,width=broad,align=middle]
{\startoverlay
{#1}
{#2}
\stopoverlay}
}

\starttext
\startchapter[title={This is a test}]
\input knuth.tex

\stopchapter

\stoptext
%% end example

Best regards: Otared

> On 18 Aug 2020, at 01:18, jbf  wrote:
> 
> I meant to include an example of what I mean, since at least it seems to work 
> (am including just the definition part of your example), So at least I can 
> get middle and right alignment.
> 
> \define[2]\MemoirChapter
>  {\midaligned{\startoverlay
>   {#1}
>   {#2}
> \stopoverlay}}
> 
> Julian
> 
> On 17/8/20 4:54 pm, Aditya Mahajan wrote:
>> On Mon, 17 Aug 2020, jbf wrote:
>> 
>>> Am completely new to using Metafun, which I presume I would need to use
>>> to achieve a Hansen Memoir-style Chapter heading (chapter title
>>> overlayed on a large lightgray number). Of course, I am assuming I would
>>> need to use Metafun to create this...
>>> 
>>> So my first question is to ask if I could achieve the same effect
>>> without Metafun?
>>> 
>>> I have read through the Metafun manual, and I think I can understand how
>>> to overlay text on a graphic (MP), but it would be currently beyond me
>>> to draw numbers of the kind we find in, say, the Memoir examples.
>>> 
>>> Has anyone created such an example? I was keenly looking for one in the
>>> manual and elsewhere, in terms of ConTeXt/Metafun commands, but could
>>> not find one. But I'd be quite prepared to 'have a go' at this, if I had
>>> some pointers of just where to start! I assume I would have to
>>> \defineoverlay[number] and then add text on top \framed (but without the
>>> frame borders). Am I at least correct about this?
>> You don't need metafun for something this simple. Here is a crude 
>> implementation:
>> 
>> \setuphead[chapter]
>>   [
>> numberstyle={\switchtobodyfont[48pt]},
>> numbercolor=gray,
>> alternative=command,
>> command=\MemoirChapter,
>>   ]
>> 
>> \define[2]\MemoirChapter%
>>   {\startoverlay
>>   {#1}
>>   {#2}
>> \stopoverlay}
>>   
>> \starttext
>> \startchapter[title={This is a test}]
>> \stopchapter
>> 
>> \stoptext
>> 
>> Overlays don't allow tuning the location...for that you need layers. See the 
>> chapter on ornaments in the details manual, which also explains an 
>> alternative method to set title of chapters (toward the end of that 
>> chapter), which is useful if you need absolute positioning.
>> 
>> 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://context.aanhet.net
>> archive  : https://bitbucket.org/phg/context-mirror/commits/
>> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Same counter for figures as theorems

2020-08-18 Thread Tim Steenvoorden
Hi Taco,

Thanks! This works for me.

It indeed seems at least inconsistent. Also, using
\definecounter[enumeration][object]
instead of
\setupenumeration[enumeration][counter=object]
Numbers figures correctly but forgets the object counter in enumerations, it 
numbers 1.1., 1.1., 1.1., ...

Hans: is this indeed the intended way it should work?

Cheers,
Tim


T.J. Steenvoorden, MSc

PhD Candidate | Radboud University Nijmegen
Faculty of Science | Department of Software Science
Mercator 1 Building | Room 01.08
Toernooiveld 212 | 6525 EC | Nijmegen | The Netherlands
+31 24 365 22 91 | t...@cs.ru.nl
On 14 Aug 2020, 23:12 +0200, Taco Hoekwater , wrote:
> Hi Tim,
>
> I misunderstood your goal, sorry. Proposed setup below.
>
>
> But first, what I think is a bug in ConTeXt:
>
> Neither
> \setupcaptions
> [counter=object]
> nor
> \setupcaption
> [figure]
> [counter=object]
>
> work. the caption always falls back to the ‘current float counter’; figure or 
> table or …
>
> For the singular explicit \setupcaption[figure], I think this is a bug.
>
>
> The solution I found is to blatantly redefine the ‘figure’ counter, that 
> works!
>
>
> Second, it seems that \setupenumerations does not modify the counter of an 
> explicit defined enumeration, so you need to use the explicit 
> \setupenumeration[enumeration] form. This may be intentional, I do not know 
> for sure.
>
>
>
> Here is what I believe is the required code for your desired effect 
> (re-indented for Hans' style):
>
> \setupcaptions
> [way=bysection,
> prefixsegments=chapter:section]
>
> \setupenumerations
> [prefix=yes,
> prefixsegments=chapter:section]
>
> \defineenumeration
> [enumeration]
> [text=Enumeration]
>
> \definecounter
> [object]
> [way=bysection]
>
> \setupenumeration
> [enumeration]
> [counter=object]
>
> \definecounter
> [figure]
> [object]
>
> Best wishes,
> Taco
>
>
> > On 14 Aug 2020, at 09:49, Tim Steenvoorden  
> > wrote:
> >
> > Hi Taco,
> >
> > Thanks for your example and the pointer to make a MWE.
> >
> > Sadly, it doesn’t work for me. It numbers the first enumeration 1.1.1 and 
> > the first figure _also_ 1.1.1, which I’d like to be 1.1.2.
> >
> > This time, you’ll find the code and the output pdf in the attachment!
> >
> > Cheers,
> > Tim
> >
> >
> > P.S. I’m on Context MacTeX/TeXLive 2020:
> >
> > mtx-context | ConTeXt Process Management 1.03
> > mtx-context |
> > mtx-context | main context file: 
> > /usr/local/texlive/2020basic/texmf-dist/tex/context/base/mkiv/context.mkiv
> > mtx-context | current version: 2020.03.10 14:44
> > mtx-context | main context file: 
> > /usr/local/texlive/2020basic/texmf-dist/tex/context/base/mkiv/context.mkxl
> > mtx-context | current version: 2020.03.10 14:44
> > On 13 Aug 2020, 13:12 +0200, Taco Hoekwater , wrote:
> > >
> > >
> > > > On 13 Aug 2020, at 10:06, Tim Steenvoorden  
> > > > wrote:
> > > >
> > > > Hi all,
> > > >
> > > > Anybody some pointers?
> > >
> > > Next time, prepare a minimal (non)working example. Because the attachment 
> > > works for me.
> > >
> > > 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://context.aanhet.net
> > > archive : https://bitbucket.org/phg/context-mirror/commits/
> > > 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://context.aanhet.net
> > archive : https://bitbucket.org/phg/context-mirror/commits/
> > wiki : http://contextgarden.net
> > ___
>
> Taco Hoekwater
> Elvenkind BV
>
>
>
>
> ___
> 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://context.aanhet.net
> archive : https://bitbucket.org/phg/context-mirror/commits/
> 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  : 

Re: [NTG-context] TOC chapter and section numbering

2020-08-18 Thread Taco Hoekwater


> On 18 Aug 2020, at 06:40, Adrian  wrote:
> 
> 
> I would like all the chapters to be prefixed with "Chapter RN." and the 
> sections to keep a single count,
> for example:
> 

\setuplabeltext[chapter=Chapter~]

\definestructureresetset[default][1,1,0][1] % reset part, chapter, but not 
section
\setupheads[sectionresetset=default]

\setuphead[section][sectionsegments=section:*]

Mostly copied from the wiki page about titles:

  https://wiki.contextgarden.net/Titles

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___