[NTG-context] Define a new command that inherits from multiple other command options

2024-04-25 Thread ai2472206007
hi!

I'm new to ConTeXt. I want to define a command with sidenote function. This 
[setupsidenote] command inherits the options of [setupmargindata], 
[setupcounter] and [setupframed]. just like [setupenumeration] inherits the 
option of [setupcounter].

I've defined the following sidenote command by searching, and I know how to 
define a new option for it. But what I don't know is how to get it to inherit 
the options of other commands and perform these features correctly.

Any clue is warmly welcome.

```
% macros=mkvi
\unprotect
\installnamespace  {sidenote}
\installcommandhandler \sidenote  {sidenote}  \sidenote
\setupsidenote[
   align=,
   conversion=n,
   way=bytext,
   style=,
]

\definecounter[SidenoteMarkNumber] [prefix=no]
\definemargindata [SidenoteContent][outer]
  [margin=margin,width=\outermarginwidth]
\setupmargindata  [SidenoteContent][stack=yes,style=\it]
\def\sidenotemark{\rawcountervalue[SidenoteMarkNumber]}
\def\convertsidenotemark#1{\high{\convertnumber{#1}{\sidenotemark}}}
\def\sidenote{\dosingleempty\dosidenote}
\def\dosidenote[#1]#2{%
\getparameters[SMsidenote]
  [align=\sidenoteparameter{align},
  conversion=\sidenoteparameter{conversion},
  way=\sidenoteparameter{way},
   #1]%
 \setupcounter[SidenoteMarkNumber] [#1]
 \incrementcounter[SidenoteMarkNumber]
 \convertsidenotemark{\SMsidenoteconversion}% mark in text
 \SidenoteContent[#1]{\setscript[hanzi]\setup[\SMsidenotealign]%
  \convertsidenotemark{\SMsidenoteconversion}% mark with 
note
  #2
}}
\protect
\starttext
天地玄黄,宇宙洪荒。日月盈昃,辰宿列张。寒来暑往,秋收冬\sidenote[align=flushleft] {天地玄黄,宇宙洪荒。}
\stoptext
```
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


Re: [NTG-context] define math function with \, inside

2023-05-01 Thread Stefan Haller via ntg-context
Hi Mikael,

On Mon, May 01, 2023 at 05:48:40PM +0200, Mikael Sundqvist via ntg-context 
wrote:
> [...]
> This works here (but maybe there should be a simpler way):
> 
> \definemathfunction
>   [argmax]
>   [mathlimits=auto]
> 
> \setupmathlabeltext
>   [en]
>   [argmax=arg\sixperemspace max]
> [...]

That was exactly what I was looking for. It is working perfectly. Thanks
a lot!

With this knowledge finding additional information in the wiki is much
easier: :)

1. https://wiki.contextgarden.net/Command/_setuplabeltext
2. https://wiki.contextgarden.net/Command/_labeltext

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

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] define math function with \, inside

2023-05-01 Thread Mikael Sundqvist via ntg-context
Hi,

On Mon, May 1, 2023 at 5:27 PM Stefan Haller via ntg-context
 wrote:
>
> Hi all,
>
> I wanted to define a custom math function (similar to log etc.) for
> argmax. However, I wanted to have a small space between "arg" and "max"
> and limits should work properly. I am using a up-to-date LMTX installation.
>
> Without the first constraint it's easy:
>
> > % old way:
> > \definemathcommand[argmax][limop]{\mfunction[argmax]}
> > % new way, discoverd by looking into math-def.mkxl
> > \definemathfunction[argmax]
>
> However, both methods do not work if I want to have "arg\,max" printed
> (error about \endcsname missing). With mkiv the first method works and
> can also be found in the wiki[1].
>
> What's the current way to define such a custom math function?
>
> Thanks!
> Stefan
>
> [1]: https://wiki.contextgarden.net/Math/functions

This works here (but maybe there should be a simpler way):

\definemathfunction
  [argmax]
  [mathlimits=auto]

\setupmathlabeltext
  [en]
  [argmax=arg\sixperemspace max]

\startTEXpage[offset=1ts]
\im{
  \argmax_{a\in A} f(a)
}
\blank[big]
\dm{
  \argmax_{a\in A} f(a)
}
\stopTEXpage

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

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


[NTG-context] define math function with \, inside

2023-05-01 Thread Stefan Haller via ntg-context
Hi all,

I wanted to define a custom math function (similar to log etc.) for
argmax. However, I wanted to have a small space between "arg" and "max"
and limits should work properly. I am using a up-to-date LMTX installation.

Without the first constraint it's easy:

> % old way:
> \definemathcommand[argmax][limop]{\mfunction[argmax]}
> % new way, discoverd by looking into math-def.mkxl
> \definemathfunction[argmax]

However, both methods do not work if I want to have "arg\,max" printed
(error about \endcsname missing). With mkiv the first method works and
can also be found in the wiki[1].

What's the current way to define such a custom math function?

Thanks!
Stefan

[1]: https://wiki.contextgarden.net/Math/functions
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Define new symbol by stitching two symbols together

2021-05-24 Thread Nicola
On 2021-05-24, Aditya Mahajan  wrote:
> On Sun, 23 May 2021, Hans Hagen wrote:
>
>> On 5/22/2021 8:23 PM, Nicola wrote:
>> > I would like to define new symbols by stitching together existing
>> > glyphs. This is what I have come up so far:
>> >
>> >  \define[1]\Transition{-\!\![#1]\!\!\rightarrow}
>> >  \starttext
>> >  \m{L\Transition{A}R}
>> >  \stoptext
>> >
>> > This should render as -[ ]->, ideally with no space between the dash or
>> > the arrow and the brackets, i.e., -[ should appear like a single glyph;
>> > ditto for ]-->. With the definition above, however, the space is
>> > variable, and in some circumstances the gliphs overlap.
>> >
>> > How can I improve the above definition?
>> don't use these funny \! skips ... use some font related metric:
>>
>>  \define[1]\Transition{-\kern-1ex[#1]\kern-1.1ex\rightarrow}
>
> This is how we used to define arrows in the old days ...
>
> \define[1]\Transition{\relbar\joinrel\mathrel{[}#1\mathrel{]}\joinrel\rightarrow}
> \define[1]\BigTransition{\relbar\joinrel\relbar\joinrel\mathrel{[}#1\mathrel{]}\joinrel\relbar\joinrel\rightarrow}
>
> \starttext
> \m{L\Transition{A}R}
>
> \m{L\BigTransition{A}R}
> \stoptext

Thanks Hans, Aditya,

combining your ideas (\joinrel plus \kern) seems to work best for my use
case.

Nicola

___
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] Define new symbol by stitching two symbols together

2021-05-24 Thread Aditya Mahajan
On Sun, 23 May 2021, Hans Hagen wrote:

> On 5/22/2021 8:23 PM, Nicola wrote:
> > I would like to define new symbols by stitching together existing
> > glyphs. This is what I have come up so far:
> > 
> >  \define[1]\Transition{-\!\![#1]\!\!\rightarrow}
> >  \starttext
> >  \m{L\Transition{A}R}
> >  \stoptext
> > 
> > This should render as -[ ]->, ideally with no space between the dash or
> > the arrow and the brackets, i.e., -[ should appear like a single glyph;
> > ditto for ]-->. With the definition above, however, the space is
> > variable, and in some circumstances the gliphs overlap.
> > 
> > How can I improve the above definition?
> don't use these funny \! skips ... use some font related metric:
> 
>  \define[1]\Transition{-\kern-1ex[#1]\kern-1.1ex\rightarrow}

This is how we used to define arrows in the old days ...

\define[1]\Transition{\relbar\joinrel\mathrel{[}#1\mathrel{]}\joinrel\rightarrow}
\define[1]\BigTransition{\relbar\joinrel\relbar\joinrel\mathrel{[}#1\mathrel{]}\joinrel\relbar\joinrel\rightarrow}

\starttext
\m{L\Transition{A}R}

\m{L\BigTransition{A}R}
\stoptext

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
___


Re: [NTG-context] Define new symbol by stitching two symbols together

2021-05-23 Thread Hans Hagen

On 5/22/2021 8:23 PM, Nicola wrote:

I would like to define new symbols by stitching together existing
glyphs. This is what I have come up so far:

 \define[1]\Transition{-\!\![#1]\!\!\rightarrow}
 \starttext
 \m{L\Transition{A}R}
 \stoptext

This should render as -[ ]->, ideally with no space between the dash or
the arrow and the brackets, i.e., -[ should appear like a single glyph;
ditto for ]-->. With the definition above, however, the space is
variable, and in some circumstances the gliphs overlap.

How can I improve the above definition?

don't use these funny \! skips ... use some font related metric:

\define[1]\Transition{-\kern-1ex[#1]\kern-1.1ex\rightarrow}
\starttext
\m{L\Transition{A}R}
\stoptext



-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
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] Define new symbol by stitching two symbols together

2021-05-22 Thread Nicola
I would like to define new symbols by stitching together existing
glyphs. This is what I have come up so far:

\define[1]\Transition{-\!\![#1]\!\!\rightarrow}
\starttext
\m{L\Transition{A}R}
\stoptext

This should render as -[ ]->, ideally with no space between the dash or
the arrow and the brackets, i.e., -[ should appear like a single glyph;
ditto for ]-->. With the definition above, however, the space is
variable, and in some circumstances the gliphs overlap.

How can I improve the above definition?

Nicola

___
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] \define in conflict with \startxtable[]

2020-11-08 Thread Wolfgang Schuster

Sylvain Hubert schrieb am 08.11.2020 um 04:54:

Dear List,

Could anyone manage to typeset the following example? Here [] causes an 
error "Extra }, or forgotten \endgroup".


     \starttext
     \define\sample{
     \startxtable[]
     \startxtablehead
     \startxrow
     \startxcell 123\stopxcell
     \stopxrow
     \stopxtablehead
     \stopxtable
     }
     \sample
     \stoptext



\starttext

\define\sample
  {\startembeddedxtable
 \startxrow
   \startxcell \unknown \stopxcell
 \stopxrow
   \stopembeddedxtable}

\sample

\stoptext


or


\starttext

\startbuffer[sample]
  \startxtable
\startxrow
  \startxcell \unknown \stopxcell
\stopxrow
  \stopxtable
\stopbuffer

\getbuffer[sample]

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


[NTG-context] \define in conflict with \startxtable[]

2020-11-07 Thread Sylvain Hubert
Dear List,

Could anyone manage to typeset the following example? Here [] causes an
error "Extra }, or forgotten \endgroup".

\starttext
\define\sample{
\startxtable[]
\startxtablehead
\startxrow
\startxcell 123\stopxcell
\stopxrow
\stopxtablehead
\stopxtable
}
\sample
\stoptext

Thanks in advance.

Best,
Sylvain
___
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] Define color with calculations

2019-02-18 Thread Henri Menke
On 19/02/19 10:33 AM, Wolfgang Schuster wrote:
> Mohammad Hossein Bateni schrieb am 18.02.19 um 04:37:
>> Hi,
>>
>> When I use definecolor, (how) can I use computations in setting the
>> value of a component?  Something like the following...
>>
>> \definecolor[mycolor][r=0.5*0.7]
> 
> \starttext
> 
> \colored[r=\cldcontext{0.5*0.7}]{\cldcontext{0.5*0.7}}
> 
> \colored[r=\cldcontext{"\letterpercent
> .3f",0.5*0.7}]{\cldcontext{"\letterpercent .3f",0.5*0.7}}
> 
> \stoptext
> 

Better use \luaexpr.  From the manual:

The \luaexpr command can also better deal with for instance conditions,
 where it returns true or false , while \cldcontext would interpret the
 boolean value as a special signal.

Although I think my solution is superior because you can just type

   \eval{1.0*sin(pi)}

instead of

   \eval{1.0*math.sin(math.pi)}

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

___
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] Define color with calculations

2019-02-18 Thread Wolfgang Schuster

Mohammad Hossein Bateni schrieb am 18.02.19 um 04:37:

Hi,

When I use definecolor, (how) can I use computations in setting the 
value of a component?  Something like the following...


\definecolor[mycolor][r=0.5*0.7]


\starttext

\colored[r=\cldcontext{0.5*0.7}]{\cldcontext{0.5*0.7}}

\colored[r=\cldcontext{"\letterpercent 
.3f",0.5*0.7}]{\cldcontext{"\letterpercent .3f",0.5*0.7}}


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


Re: [NTG-context] Define color with calculations

2019-02-18 Thread Mohammad Hossein Bateni
Thanks, Henri!  Works like a charm.

On Sun, Feb 17, 2019 at 11:03 PM Henri Menke  wrote:

> Use Lua.
>
>
> \def\eval#1{\ctxlua{%
> local context = context
> local _ENV = math
> context(#1)
> }}
>
> \definecolor[mycolor][r=\eval{0.5*0.7}]
>
> \starttext
>
> \color[mycolor]{Hello!}
>
> \stoptext
>
>
>
> On 18/02/19 4:37 PM, Mohammad Hossein Bateni wrote:
> > Hi,
> >
> > When I use definecolor, (how) can I use computations in setting the value
> > of a component?  Something like the following...
> >
> > \definecolor[mycolor][r=0.5*0.7]
> >
> > Thanks,
> > ~MHB
> >
> >
> >
> ___
> > 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] Define color with calculations

2019-02-17 Thread Henri Menke
Use Lua.


\def\eval#1{\ctxlua{%
local context = context
local _ENV = math
context(#1)
}}

\definecolor[mycolor][r=\eval{0.5*0.7}]

\starttext

\color[mycolor]{Hello!}

\stoptext



On 18/02/19 4:37 PM, Mohammad Hossein Bateni wrote:
> Hi,
> 
> When I use definecolor, (how) can I use computations in setting the value
> of a component?  Something like the following...
> 
> \definecolor[mycolor][r=0.5*0.7]
> 
> Thanks,
> ~MHB
> 
> 
> ___
> 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
___


[NTG-context] Define color with calculations

2019-02-17 Thread Mohammad Hossein Bateni
Hi,

When I use definecolor, (how) can I use computations in setting the value
of a component?  Something like the following...

\definecolor[mycolor][r=0.5*0.7]

Thanks,
~MHB
___
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] Define the dimensions of a layout

2018-08-09 Thread Lizardo M. Reyna Bowen
Hi,

May be this setup works.

\setuppapersize[A4]


\setuplayout[
  header=20mm,
  footer=20mm,
  height=fit,
  topspace=0cm,
  width=fit,
  backspace=2cm,
  rightmargin=0cm,
  leftmargin=0cm,
  leftmargindistance=0pt,
  rightmargindistance=0pt]

\showframe

\starttext
 \showsetups
\stoptext


Regards

-- 
Dr. Lizardo M. Reyna Bowen
Docente
Facultad de Ingeniería Agrícola | Universidad Técnica de Manabí
[Dirección]  Lodana, Santa Ana, Manabí, Ecuador
[Móvil]  +593  982924637
PGP Key: 0xa35a15b90ee64e8d

___
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] Define the dimensions of a layout

2018-08-08 Thread Wolfgang Schuster

\setuplayout
  [topspace=10mm,
   header=10mm,
   footer=10mm,
   height=middle,
   backspace=20mm,
   width=middle]

\showframe

\starttext
\showsetups
\stoptext

Wolfgang


Lizardo M. Reyna Bowen schrieb am 09.08.18 um 04:50:

Hi,

May be this setup works.

\setuppapersize[A4]

\setuplayout[
   header=20mm,
   footer=20mm,
   height=fit,
   topspace=0cm,
   width=fit,
   backspace=2cm,
   rightmargin=0cm,
   leftmargin=0cm,
   leftmargindistance=0pt,
   rightmargindistance=0pt]

\showframe

\starttext
  \showsetups
\stoptext



___
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] Define the dimensions of a layout

2018-08-08 Thread Lizardo M. Reyna Bowen
Hi,

May be this setup works.

\setuppapersize[A4]

\setuplayout[
  header=20mm,
  footer=20mm,
  height=fit,
  topspace=0cm,
  width=fit,
  backspace=2cm,
  rightmargin=0cm,
  leftmargin=0cm,
  leftmargindistance=0pt,
  rightmargindistance=0pt]

\showframe

\starttext
 \showsetups
\stoptext

-- 
Dr. Lizardo M. Reyna Bowen
Docente
Facultad de Ingeniería Agrícola | Universidad Técnica de Manabí
[Dirección]  Lodana, Santa Ana, Manabí, Ecuador
[Móvil]  +593  982924637
PGP Key: 0xa35a15b90ee64e8d

___
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] Define the dimensions of a layout

2018-08-08 Thread Fabrice Couvreur
Hello,
I want the text area to be surrounded by a margin of 20 mm (top, right,
left and bottom).
I have already done this to have a left and right margin of 20 mm.

\setuplayout
  [height=middle,
   backspace=20mm,
   width=middle]

I  think that I must now have :

topdistance + header + headerdistance = 20mm

footerdistance + footer + bottomdistance + bottom = 20 mm

How to do ?
Thanks
Fabrice
___
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] define xml entity

2018-04-03 Thread Hans Hagen

On 4/3/2018 9:00 AM, dr. Hans van der Meer wrote:

How do I define an xml entity like ?
Is there an \xml-operation for defining an entity?
Such that I can say \xml{ABC}{an alphabet} for using  so that it 
produces “an alphabet”, for example.

You can find some in the test suite but it boils down to ...

\xmlsetentity{one}  {...}
\xmltexentity{sim}  {...}

or defining them in the preamble section of the xml file itself.

Entities are tricky. When they are used as abstraction you often want 
them roundtrip while otherwise you might want them expanded. YOu can 
have double escaped entities (which can result from import/export in 
half clever or inconsistent databases).  There's all kinds of control in 
context.


Another tricky thing is that because tex doesn't like # etc we need to 
have our own 'escapes' as well, so that runs in parallel of the 
subsystem that carries (unexpanded) entities around.


It's a conceptual mess deel down ... (well, you can read/understand lua 
so ...).


Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
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] define xml entity

2018-04-03 Thread dr. Hans van der Meer
How do I define an xml entity like ? 
Is there an \xml-operation for defining an entity? 
Such that I can say \xml{ABC}{an alphabet} for using  so that it produces 
“an alphabet”, for example.

dr. Hans van der Meer


___
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] Define font based on language

2016-05-08 Thread Wolfgang Schuster

Michal Ondrejáš 
4. April 2016 um 15:17
Hello

I need some help regarding font definitions.

The situation is like this:

\definefont
[issuefont]
[SansRegular at 14pt]

{\issuefont \labeltext{issue} \crlf \documentvariable{issue}}

I need to get chinese text into the issue variable, but for that I 
need to change the font. I need something like this:


\def\chooseissufont{%
\translate
[zh={Sim Sun},
 en={SansRegular}]}

\definefont
[issuefont]
[\chooseissuefont at 14pt]

Using "zh" is ok, I managed to somehow make ConTeXt accept the "zh" 
language code. It's not perfect but it's for another topic. I get the 
text in this way, but the sizing doesn't work. The text is too small 
in all languages.
You can use ConTeXt’s fallback mechanism to pull missing glyphs from 
other fonts.


\definefallbackfamily [mainface] [rm] [MS Mincho] 
[range=cjkunifiedideographs]

\definefontfamily [mainface] [rm] [Latin Modern Roman]

\setupbodyfont[mainface]

\starttext
People’s Republic of China (中华人民共和国)
\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
___

Re: [NTG-context] Define font based on language

2016-05-05 Thread luigi scarso
On Mon, Apr 4, 2016 at 3:17 PM, Michal Ondrejáš 
wrote:

> Hello
>
> I need some help regarding font definitions.
>
>
Sorry for delay, we were busy with the texlive deadline.


-- 
luigi
___
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
___

[NTG-context] Define font based on language

2016-05-05 Thread Michal Ondrejáš

Hello

I need some help regarding font definitions.

The situation is like this:

\definefont
[issuefont]
[SansRegular at 14pt]

{\issuefont \labeltext{issue} \crlf \documentvariable{issue}}

I need to get chinese text into the issue variable, but for that I need 
to change the font. I need something like this:


\def\chooseissufont{%
\translate
[zh={Sim Sun},
 en={SansRegular}]}

\definefont
[issuefont]
[\chooseissuefont at 14pt]

Using "zh" is ok, I managed to somehow make ConTeXt accept the "zh" 
language code. It's not perfect but it's for another topic. I get the 
text in this way, but the sizing doesn't work. The text is too small in 
all languages.


Any dieas

Thank you,

Michal

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

[NTG-context] define macros only visible in a definestartstop-block that have arguments?

2015-03-20 Thread Norbert Melzer
Hi!

I have trouble to define macros which are only visible inside a block
defined using `\definestartstop`:

```tex
\setuppapersize[A6]
\definestartstop[Foo][before={Foo}]
\definestartstop[Bar][before={\bgroup\define\Foo{Foo}},after={\egroup}]
%\definestartstop[Baz][before={\bgroup\define[1]\Foo{Foo#1}},after={\egroup}]

\starttext
  \startFoo
Bar
  \stopFoo

  \startBar
\Foo Bar
  \stopBar

%  \startBaz
%\Foo{Bar}
%  \stopBaz
\stoptext
```

The code as above works and typesets FooBar on two separate lines. But if
I uncomment everything `Baz`-related, I end up with the following error:

```plain
tex errorerror on line 4 in file C:/HIDDEN/mwe.tex: ! Illegal
 parameter number in definition of \m_syst_action_yes



to be read again

1

argument ...{Baz}][{before={\bgroup \define [1]\Foo {Foo##1

  }},after={\egroup }}]

\doifnextoptionalelse ...ef \m_syst_action_yes {#1

  }\def \m_syst_action_nop
{...
l.4 ...bgroup\define[1]\Foo{Foo#1}},after={\egroup}]





 1 \setuppapersize[A6]

 2 \definestartstop[Foo][before={Foo}]

 3
\definestartstop[Bar][before={\bgroup\define\Foo{Foo}},after={\egroup}]

 4 
 \definestartstop[Baz][before={\bgroup\define[1]\Foo{Foo#1}},after={\egroup}]

 5

 6 \starttext

 7   \startFoo

 8 Bar

 9   \stopFoo

10

11   \startBar

12 \Foo Bar

13   \stopBar

14

```

Can someone help me get this running?
___
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
___

Re: [NTG-context] define macros only visible in a definestartstop-block that have arguments?

2015-03-20 Thread Norbert Melzer
OK, took me a while to figure out that this was not an empty response but
an attachement was available ;)

I did a quick test run and realized that it seems to do what I want, I'll
take a further look into it tommorrow, thank you!

2015-03-20 17:23 GMT+01:00 Hans Hagen pra...@wxs.nl:

 On 3/20/2015 12:05 PM, Norbert Melzer wrote:

 Hi!

 I have trouble to define macros which are only visible inside a block
 defined using `\definestartstop`:

 ```tex
 \setuppapersize[A6]
 \definestartstop[Foo][before={Foo}]
 \definestartstop[Bar][before={\bgroup\define\Foo{Foo}},after={\egroup}]
 %\definestartstop[Baz][before={\bgroup\define[1]\Foo{Foo#1}}
 ,after={\egroup}]

 \starttext
\startFoo
  Bar
\stopFoo

\startBar
  \Foo Bar
\stopBar

 %  \startBaz
 %\Foo{Bar}
 %  \stopBaz
 \stoptext
 ```

 The code as above works and typesets FooBar on two separate lines. But
 if I uncomment everything `Baz`-related, I end up with the following
 error:

 ```plain
 tex errorerror on line 4 in file C:/HIDDEN/mwe.tex: ! Illegal
   parameter number in definition of \m_syst_action_yes
 to be read again
 1
 argument ...{Baz}][{before={\bgroup \define [1]\Foo {Foo##1
}},after={\egroup }}]
 \doifnextoptionalelse ...ef \m_syst_action_yes {#1
}\def
 \m_syst_action_nop {...
 l.4 ...bgroup\define[1]\Foo{Foo#1}},after={\egroup}]
   1 \setuppapersize[A6]
   2 \definestartstop[Foo][before={Foo}]
   3
 \definestartstop[Bar][before={\bgroup\define\Foo{Foo}},after={\egroup}]
   4 
   \definestartstop[Baz][before={\bgroup\define[1]\Foo{Foo#1}},
 after={\egroup}]
   5
   6 \starttext
   7   \startFoo
   8 Bar
   9   \stopFoo
 10
 11   \startBar
 12 \Foo Bar
 13   \stopBar
 14
 ```

 Can someone help me get this running?


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



 --

 -
   Hans Hagen | PRAGMA ADE
   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
  | www.pragma-pod.nl
 -


 ___
 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

 ___

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

Re: [NTG-context] define macros only visible in a definestartstop-block that have arguments?

2015-03-20 Thread Hans Hagen

On 3/20/2015 12:05 PM, Norbert Melzer wrote:

Hi!

I have trouble to define macros which are only visible inside a block
defined using `\definestartstop`:

```tex
\setuppapersize[A6]
\definestartstop[Foo][before={Foo}]
\definestartstop[Bar][before={\bgroup\define\Foo{Foo}},after={\egroup}]
%\definestartstop[Baz][before={\bgroup\define[1]\Foo{Foo#1}},after={\egroup}]

\starttext
   \startFoo
 Bar
   \stopFoo

   \startBar
 \Foo Bar
   \stopBar

%  \startBaz
%\Foo{Bar}
%  \stopBaz
\stoptext
```

The code as above works and typesets FooBar on two separate lines. But
if I uncomment everything `Baz`-related, I end up with the following error:

```plain
tex errorerror on line 4 in file C:/HIDDEN/mwe.tex: ! Illegal
  parameter number in definition of \m_syst_action_yes
to be read again
1
argument ...{Baz}][{before={\bgroup \define [1]\Foo {Foo##1
   }},after={\egroup }}]
\doifnextoptionalelse ...ef \m_syst_action_yes {#1
   }\def
\m_syst_action_nop {...
l.4 ...bgroup\define[1]\Foo{Foo#1}},after={\egroup}]
  1 \setuppapersize[A6]
  2 \definestartstop[Foo][before={Foo}]
  3
\definestartstop[Bar][before={\bgroup\define\Foo{Foo}},after={\egroup}]
  4 
  \definestartstop[Baz][before={\bgroup\define[1]\Foo{Foo#1}},after={\egroup}]
  5
  6 \starttext
  7   \startFoo
  8 Bar
  9   \stopFoo
10
11   \startBar
12 \Foo Bar
13   \stopBar
14
```

Can someone help me get this running?


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




--

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-


setups-003.tex
Description: TeX document
___
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
___

Re: [NTG-context] Define a new command from the command \periods[n]

2015-01-19 Thread Fabrice

Hi Hans,
It works perfectly, thank you.
Fabrice
___
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
___

Re: [NTG-context] Define a new command from the command \periods[n]

2015-01-19 Thread Hans Hagen

On 1/18/2015 10:01 PM, Fabrice wrote:

Hi Hans,
The size of the float does not center the frame unless I replace by
\dorecurse{5}{\filler[dots]} by \dorecurse{10}{\filler[dots]}.
Is there a better way ?
Thanks,
Fabrice


% macros=mkvi

\definefiller[dots][left=\dontleavehmode,right=\hskip\zeropoint\par]

\definefloat
   [recipe]
   [figure]

\setupfloat
   [recipe]
   [default={right,none}]

\defineframed
   [myframed]
   [width=6cm,
foregroundstyle={\switchtobodyfont[10pt]},
align={high,flushleft},
frame=on,
framecolor=red,
background=color,
backgroundcolor=lightgray]

\definecolor[Border][c=0.00, m=0.00, y=0.00, k=0.25]

\startuniqueMPgraphic{borderline}
path p ; p := unitsquare xscaled \overlaywidth yscaled \overlayheight ;
draw p withcolor \MPcolor{Border} dashed evenly withpen pencircle scaled
1.2pt ;
\stopuniqueMPgraphic

\defineoverlay[borderline][\uniqueMPgraphic{borderline}]

\defineframedtext
  [Myframed]
  [width=0.6\textwidth,
   foregroundstyle={\switchtobodyfont[10pt]},
   align={high,flushleft},
   frame=off,
   framecolor=0.625white,
   background=borderline,
   location=middle,
   offset=.5ex]

\starttext

\startbuffer
 Ingrédients (pour 4 personnes)
 \startitemize[1]
 \startitem \unit{1 kg} de pommes de terre \stopitem
 \startitem \unit{60 g} de fromage râpé \stopitem
 \startitem \unit{25 Centiliter} de crème fraîche \stopitem
 \stopitemize
\stopbuffer

\placerecipe
   {}
   {\myframed{\getbuffer}}

\startitemize[n][stopper={.},style=bold]
 \startitem
 \dorecurse{5}{\filler[dots]}
 \stopitem
\stopitemize

\startbuffer
\input ward
\stopbuffer
\startMyframed
\getbuffer
\stopMyframed

\stoptext


\placerecipe
   {}
   {\myframed{\getbuffer}}

\startitemize[n][stopper={.},style=bold]
 \startitem
 \dorecurse{5}{\filler[dots]}
 \stopitem
\stopitemize

\flushsidefloats

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-
___
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
___

Re: [NTG-context] Define a new command from the command \periods[n]

2015-01-18 Thread Fabrice

Hi Hans,
The size of the float does not center the frame unless I replace by 
\dorecurse{5}{\filler[dots]} by \dorecurse{10}{\filler[dots]}.

Is there a better way ?
Thanks,
Fabrice


% macros=mkvi

\definefiller[dots][left=\dontleavehmode,right=\hskip\zeropoint\par]

\definefloat
   [recipe]
   [figure]

\setupfloat
   [recipe]
   [default={right,none}]

\defineframed
   [myframed]
   [width=6cm,
foregroundstyle={\switchtobodyfont[10pt]},
align={high,flushleft},
frame=on,
framecolor=red,
background=color,
backgroundcolor=lightgray]

\definecolor[Border][c=0.00, m=0.00, y=0.00, k=0.25]

\startuniqueMPgraphic{borderline}
path p ; p := unitsquare xscaled \overlaywidth yscaled \overlayheight ;
draw p withcolor \MPcolor{Border} dashed evenly withpen pencircle scaled
1.2pt ;
\stopuniqueMPgraphic

\defineoverlay[borderline][\uniqueMPgraphic{borderline}]

\defineframedtext
  [Myframed]
  [width=0.6\textwidth,
   foregroundstyle={\switchtobodyfont[10pt]},
   align={high,flushleft},
   frame=off,
   framecolor=0.625white,
   background=borderline,
   location=middle,
   offset=.5ex]

\starttext

\startbuffer
 Ingrédients (pour 4 personnes)
 \startitemize[1]
 \startitem \unit{1 kg} de pommes de terre \stopitem
 \startitem \unit{60 g} de fromage râpé \stopitem
 \startitem \unit{25 Centiliter} de crème fraîche \stopitem
 \stopitemize
\stopbuffer

\placerecipe
   {}
   {\myframed{\getbuffer}}

\startitemize[n][stopper={.},style=bold]
 \startitem
 \dorecurse{5}{\filler[dots]}
 \stopitem
\stopitemize

\startbuffer
\input ward
\stopbuffer
\startMyframed
\getbuffer
\stopMyframed

\stoptext


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

Re: [NTG-context] Define a new command from the command \periods[n]

2015-01-06 Thread Alan BRASLAU
On the subject of recipes, Fabrice clearly should have come to the 8th
ConTeXt Meeting that took place on September 8-13, 2014 at Bassange,
Belgium...

;-)

Alan


On Mon, 5 Jan 2015 22:49:39 +0100
Hans Hagen pra...@wxs.nl wrote:

 On 1/5/2015 6:58 PM, Fabrice wrote:
  Hi,
  How to make the dotted lines stop at the edge of the frame?
 
  \definefiller[dots][left=\dontleavehmode,right=\hskip\zeropoint]
  \definecolor[H1prime][c=0.50, m=0.00, y=1.00, k=0.00]
  \definecolor[H4][c=0.07, m=0.00, y=0.15, k=0.00]
  \starttext
  \startitemize[n][stopper={.},style=bold]
  \placefigure[right,none]{}{
  \startframedtext[
  width=6cm,
  frame=on,
  framecolor=H1prime,
  location=middle,
  background=color,
  backgroundcolor=H4]
  \switchtobodyfont[10pt]
  Ingrédients (pour 4 personnes)
  \startitemize[1]
  \item \unit{1 kg} de pommes de terre
  \item \unit{60 g} de fromage râpé
  \item \unit{25 Centiliter} de crème fraîche
  \stopitemize
  \stopframedtext
  }
  \item
  \filler[dots]
 
  \filler[dots]
 
  \filler[dots]
 
  \filler[dots]
 
  \stopitemize
  \stoptext
  Best regards,
  Fabrice
 
 \definefiller[dots][left=\dontleavehmode,right=\hskip\zeropoint\par]
 
 \definefloat
[recipe]
[figure]
 
 \setupfloat
[recipe]
[default={right,none}]
 
 \defineframed
[myframed]
[width=6cm,
 foregroundstyle={\switchtobodyfont[10pt]},
 align={high,flushleft},
 frame=on,
 framecolor=red,
 background=color,
 backgroundcolor=lightgray]
 
 \starttext
 
 \startbuffer
  Ingrédients (pour 4 personnes)
  \startitemize[1]
  \startitem \unit{1 kg} de pommes de terre \stopitem
  \startitem \unit{60 g} de fromage râpé \stopitem
  \startitem \unit{25 Centiliter} de crème fraîche \stopitem
  \stopitemize
 \stopbuffer
 
 \placerecipe
{}
{\myframed{\getbuffer}}
 
 \startitemize[n][stopper={.},style=bold]
  \startitem
  \dorecurse{5}{\filler[dots]}
  \stopitem
 \stopitemize
 
 \stoptext

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

Re: [NTG-context] Define a new command from the command \periods[n]

2015-01-06 Thread Couvreur Fabrice
I am impressed !
Best regards,
Fabriçe

Envoyé de mon iPad
___
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
___

Re: [NTG-context] Define a new command from the command \periods[n]

2015-01-06 Thread Couvreur Fabrice
Hi Alan,
 What should I include ?
Fabrice
Envoyé de mon iPad
___
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
___

Re: [NTG-context] Define a new command from the command \periods[n]

2015-01-05 Thread Hans Hagen

On 1/5/2015 6:58 PM, Fabrice wrote:

Hi,
How to make the dotted lines stop at the edge of the frame?


\definefiller[dots][left=\dontleavehmode,right=\hskip\zeropoint]
\definecolor[H1prime][c=0.50, m=0.00, y=1.00, k=0.00]
\definecolor[H4][c=0.07, m=0.00, y=0.15, k=0.00]
\starttext
\startitemize[n][stopper={.},style=bold]
\placefigure[right,none]{}{
\startframedtext[
width=6cm,
frame=on,
framecolor=H1prime,
location=middle,
background=color,
backgroundcolor=H4]
\switchtobodyfont[10pt]
Ingrédients (pour 4 personnes)
\startitemize[1]
\item \unit{1 kg} de pommes de terre
\item \unit{60 g} de fromage râpé
\item \unit{25 Centiliter} de crème fraîche
\stopitemize
\stopframedtext
}
\item
\filler[dots]

\filler[dots]

\filler[dots]

\filler[dots]

\stopitemize
\stoptext

Best regards,
Fabrice


\definefiller[dots][left=\dontleavehmode,right=\hskip\zeropoint\par]

\definefloat
  [recipe]
  [figure]

\setupfloat
  [recipe]
  [default={right,none}]

\defineframed
  [myframed]
  [width=6cm,
   foregroundstyle={\switchtobodyfont[10pt]},
   align={high,flushleft},
   frame=on,
   framecolor=red,
   background=color,
   backgroundcolor=lightgray]

\starttext

\startbuffer
Ingrédients (pour 4 personnes)
\startitemize[1]
\startitem \unit{1 kg} de pommes de terre \stopitem
\startitem \unit{60 g} de fromage râpé \stopitem
\startitem \unit{25 Centiliter} de crème fraîche \stopitem
\stopitemize
\stopbuffer

\placerecipe
  {}
  {\myframed{\getbuffer}}

\startitemize[n][stopper={.},style=bold]
\startitem
\dorecurse{5}{\filler[dots]}
\stopitem
\stopitemize

\stoptext

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-
___
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
___

Re: [NTG-context] Define a new command from the command \periods[n]

2015-01-05 Thread Fabrice

Hi,
How to make the dotted lines stop at the edge of the frame?


\definefiller[dots][left=\dontleavehmode,right=\hskip\zeropoint]
\definecolor[H1prime][c=0.50, m=0.00, y=1.00, k=0.00]
\definecolor[H4][c=0.07, m=0.00, y=0.15, k=0.00]
\starttext
\startitemize[n][stopper={.},style=bold]
\placefigure[right,none]{}{
\startframedtext[
width=6cm,
frame=on,
framecolor=H1prime,
location=middle,
background=color,
backgroundcolor=H4]
\switchtobodyfont[10pt]
Ingrédients (pour 4 personnes)
\startitemize[1]
\item \unit{1 kg} de pommes de terre
\item \unit{60 g} de fromage râpé
\item \unit{25 Centiliter} de crème fraîche
\stopitemize
\stopframedtext
}
\item
\filler[dots]

\filler[dots]

\filler[dots]

\filler[dots]

\stopitemize
\stoptext

Best regards,
Fabrice
___
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
___

Re: [NTG-context] Define a new type section with metafun

2014-12-29 Thread Fabrice

Hi Hans,
Thank you for your answer, text placement is correct as long as the 
policy is not too great.
For cons, I'll remove the red line separation because its placement is 
random.

Best regards,
Fabrice
___
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
___

Re: [NTG-context] Define a new type section with metafun

2014-12-28 Thread Fabrice

Thank you to Akira and Hans for these solutions.
How do now to the numbering and the title text are equidistant from the 
red line separation ?

Fabrice
___
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
___

Re: [NTG-context] Define a new type section with metafun

2014-12-28 Thread Fabrice
Another worry: when the title is too long, there is a line break, which 
is normal, but what follows is under the dial.

Thanks,
Fabrice

% macros=mkvi
\setuppapersize[A4][A4]

\setuphead
[section]
[sectionstopper={},
conversion=Characters,
sectionsegments=section:section]

\setuphead
[subsection]
[sectionstopper={},
sectionsegments=subsection:subsection,
conversion=number,]

\setupcolors[state=start,cmyk=yes,mpcmyk=yes]
\definecolor[mycolor][c=0.45,m=0.00,y=0.1,k=0.00]
\definecolor[colortext][c=1,m=0.00,y=0.3,k=0.3]

\starttext

\startuniqueMPgraphic{funny}
 numeric h ; h := OverlayHeight ;
 pathp ; p := unitsquare xscaled \overlaywidth yscaled
\overlayheight superellipsed 0.9 ;
 pickup pencircle scaled \overlaylinewidth ;
 fill p withcolor \MPcolor{\overlaycolor} ;
 draw (20,-1)--(20,h+1) withcolor red ;
 clip currentpicture to p ;
 draw p withcolor \MPcolor{\overlaylinecolor} ;
\stopuniqueMPgraphic

\defineoverlay[funny][\uniqueMPgraphic{funny}]

\define[2]\MySectionCommand
   {\framed
  [background=funny,
   frame=off,
   width=fit,
   align={right},
   framecolor=mycolor,
   rulethickness=1.5pt,
   backgroundcolor=white,
   offset=6pt]
  {#1\space\colortext#2}}

\setuphead[section][command=\MySectionCommand,ownnumber=yes,numbercolor=colortext]

\section{A}{REPRÉSENTATION EN PERSPECTIVE CAVALIÈRE ET RÈGLES DE BASE}
\subsection{Représentation en perspective cavalière de solides}
___
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
___

Re: [NTG-context] Define a new type section with metafun

2014-12-28 Thread Hans Hagen

On 12/28/2014 1:00 PM, Fabrice wrote:


align={right},


align={flushright,lohi}

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-
___
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
___

[NTG-context] Define a new type section with metafun

2014-12-27 Thread Akira Kakuto

Dear Fabrice,

A try and error method which you may not want:

% macros=mkvi
\setuppapersize[A4][A4]

\setupcolors[state=start,cmyk=yes,mpcmyk=yes]
\definecolor[mycolor][c=0.45,m=0.00,y=0.1,k=0.00]
\definecolor[colortext][c=1,m=0.00,y=0.3,k=0.3]

\starttext

\startuniqueMPgraphic{funny}
path p ;
numeric h ;
h := OverlayHeight ;
p:=unitsquare xscaled \overlaywidth yscaled \overlayheight superellipsed
0.9 ;
pickup pencircle scaled \overlaylinewidth ;
fill p withcolor \MPcolor{\overlaycolor} ;
draw (20,1)--(20,h-1) withcolor red ;
draw p withcolor \MPcolor{\overlaylinecolor} ;
\stopuniqueMPgraphic

\defineoverlay[funny][\uniqueMPgraphic{funny}]

\define[2]\MySectionCommand
  {\framed
 [background=funny,
  frame=off,
  width=0.5\textwidth,
  align={right},
  framecolor=mycolor,
  rulethickness=1.5pt,
  backgroundcolor=white,
  offset=4pt]
 {\tfb #1\space\colortext#2}}

\setuphead[section][command=\MySectionCommand,ownnumber=yes,numbercolor=colortext]

\section{A}{PLAN DE L'ESPACE}
\stoptext

Best,
Akira

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

[NTG-context] Define a new type section with metafun

2014-12-26 Thread Fabrice Couvreur
Hi,
I wish red separation is exactly in the middle of the dial and the title of the
section. Then, the line is too long, it should not exceed the boundary of
the ellipse.
Best regards,
Fabrice

% macros=mkvi
\setuppapersize[A4][A4]

\setupcolors[state=start,cmyk=yes,mpcmyk=yes]
\definecolor[mycolor][c=0.45,m=0.00,y=0.1,k=0.00]
\definecolor[colortext][c=1,m=0.00,y=0.3,k=0.3]

\starttext

\startuniqueMPgraphic{funny}
path p ;
numeric h ;
h := OverlayHeight ;
p:=unitsquare xscaled \overlaywidth yscaled \overlayheight superellipsed
0.9 ;
pickup pencircle scaled \overlaylinewidth ;
fill p withcolor \MPcolor{\overlaycolor} ;
draw p withcolor \MPcolor{\overlaylinecolor} ;
draw (20,0)--(20,h) withcolor red ;
\stopuniqueMPgraphic

\defineoverlay[funny][\uniqueMPgraphic{funny}]

\define[2]\MySectionCommand
   {\framed
  [background=funny,
   frame=off,
   width=0.5\textwidth,
   align={right},
   framecolor=mycolor,
   rulethickness=1.5pt,
   backgroundcolor=white,
   offset=4pt]
  {\tfb #1\space\colortext#2}}

\setuphead[section][command=\MySectionCommand,ownnumber=yes,numbercolor=colortext]

\section{A}{PLAN DE L'ESPACE}
\stoptext
___
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
___

[NTG-context] Define a new command from the command \periods[n]

2014-05-20 Thread Fabrice Couvreur
Hi,
Is it possible to redefine the command \periods[n] to have a line that goes
from the end of the word to the edge of the page without having to play on
the number n ?
Regards,
Fabrice

\starttext
\startitemize[a][stopper=),style=bold]
\item $x\mapsto -x^2+x+1$ : \periods[66]
\item $x\mapsto 2x^3+4x-7$ : \periods[65]
\item $x\mapsto x^2-3$ : \periods[70]
\item $x\mapsto \frac{x^2+x}2$ : \periods[72]
\item $x\mapsto (x-2)^2$ : \periods[69]
\stopitemize
\stoptext
___
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
___

Re: [NTG-context] Define a new command from the command \periods[n]

2014-05-20 Thread luigi scarso
On Tue, May 20, 2014 at 10:30 AM, Fabrice Couvreur 
fabrice1.couvr...@gmail.com wrote:

 Hi,
 Is it possible to redefine the command \periods[n] to have a line that
 goes from the end of the word to the edge of the page without having to
 play on the number n ?
 Regards,
 Fabrice

 \starttext
 \startitemize[a][stopper=),style=bold]
 \item $x\mapsto -x^2+x+1$ : \periods[66]
 \item $x\mapsto 2x^3+4x-7$ : \periods[65]
 \item $x\mapsto x^2-3$ : \periods[70]
 \item $x\mapsto \frac{x^2+x}2$ : \periods[72]
 \item $x\mapsto (x-2)^2$ : \periods[69]
 \stopitemize
 \stoptext




They are called leaders
http://tex.stackexchange.com/questions/38423/want-to-fill-line-with-repeating-string

\showframe
\starttext
\startitemize[a][stopper=),style=bold]
\item $x\mapsto -x^2+x+1$ : \leavevmode\xleaders\hbox{.}\hfill\kern0pt
%\periods[66]
\item $x\mapsto 2x^3+4x-7$ : \periods[65]
\item $x\mapsto x^2-3$ : \periods[70]
\item $x\mapsto \frac{x^2+x}2$ : \periods[72]
\item $x\mapsto (x-2)^2$ : \periods[69]
\stopitemize
\stoptext


-- 
luigi
___
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
___

Re: [NTG-context] Define a new command from the command \periods[n]

2014-05-20 Thread Wolfgang Schuster

Am 20.05.2014 um 10:47 schrieb luigi scarso luigi.sca...@gmail.com:

 
 
 
 On Tue, May 20, 2014 at 10:30 AM, Fabrice Couvreur 
 fabrice1.couvr...@gmail.com wrote:
 Hi, 
 Is it possible to redefine the command \periods[n] to have a line that goes 
 from the end of the word to the edge of the page without having to play on 
 the number n ? 
 Regards, 
 Fabrice
 
 \starttext
 \startitemize[a][stopper=),style=bold]
 \item $x\mapsto -x^2+x+1$ : \periods[66]
 \item $x\mapsto 2x^3+4x-7$ : \periods[65]
 \item $x\mapsto x^2-3$ : \periods[70]
 \item $x\mapsto \frac{x^2+x}2$ : \periods[72]
 \item $x\mapsto (x-2)^2$ : \periods[69]
 \stopitemize
 \stoptext
 
 
 
 They are called leaders
 http://tex.stackexchange.com/questions/38423/want-to-fill-line-with-repeating-string
 
 \showframe
 \starttext
 \startitemize[a][stopper=),style=bold]
 \item $x\mapsto -x^2+x+1$ : \leavevmode\xleaders\hbox{.}\hfill\kern0pt 
 %\periods[66]
 \item $x\mapsto 2x^3+4x-7$ : \periods[65]
 \item $x\mapsto x^2-3$ : \periods[70]
 \item $x\mapsto \frac{x^2+x}2$ : \periods[72]
 \item $x\mapsto (x-2)^2$ : \periods[69]
 \stopitemize
 \stoptext

ConTeXt has a user level interface for leaders which is called \filler.

\definefiller[dots][right=\hskip\zeropoint]

\starttext
text \filler[dots]
\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
___

Re: [NTG-context] Define a new command from the command \periods[n]

2014-05-20 Thread Fabrice

Hello,
@ Luigi @Wolfgang Thanks for your suggestions.

Since I want to continue my learning ConTeXt, I will use the command 
\filler[dots].

Can we do the same thing if there is no text in the beginning ?
Fabrice
___
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
___


Re: [NTG-context] Define a new command from the command \periods[n]

2014-05-20 Thread Wolfgang Schuster

Am 20.05.2014 um 19:50 schrieb Fabrice couvreur.fabr...@wanadoo.fr:

 Hello,
 @ Luigi @Wolfgang Thanks for your suggestions.
 
 Since I want to continue my learning ConTeXt, I will use the command 
 \filler[dots].
 Can we do the same thing if there is no text in the beginning ?

You can add “left=\dontleavehmode” to the filler definition:

\definefiller[dots][left=\dontleavehmode,right=\hskip\zeropoint]

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
___


Re: [NTG-context] Define a new command from the command \periods[n]

2014-05-20 Thread Fabrice

Perfect !
thank you,
Fabrice
___
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
___


[NTG-context] \define with more than 9 parameters??

2013-06-06 Thread Jaroslav Hajtmar

Hello ConTeXist.
Is there in ConTeXt any dirty trick, which can put more than 9 
parameters into macro?


I mean for example \define[25]\macrowithtwentyfiveparams{  }

I use rarely any trick from Peter Olsak (see below) and I'd like 
something like that used in ConTeXt.


Thanx
Jaroslav Hajtmar

Here is minimal example of trick of Petr Olsak:

\newcount\tempnum
\def\terminator{*}
\newcount\tempnum
\def\readparameters{\tempnum=0\let\next=\readone \next}
\def\readone #1,{\advance\tempnum by 1 \def\param{#1}%
%\the\tempnum - \param\par%
\ifx\param\terminator \let\next=\relax
\else\expandafter\gdef\csname param\the\tempnum\endcsname{#1}%
\fi\next}


\def\moreparameters#1{%
 \readparameters #1 %
 \csname param1\endcsname, % write first parameter
 \csname param3\endcsname, % write third parameter
 \csname param5\endcsname, % write fifth parameter
}


\starttext

%\readparameters a,b,c,d,e,f,g,h,i,j,k,m,n,o,*, %
%\def\parameters{aaa,,,,e,f,g,*,}
%\expandafter\readparameters\parameters

\moreparameters{a,b,c,d,e,f,g,h,i,j,k,m,n,o,*,}

\stoptext






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


Re: [NTG-context] \define with more than 9 parameters??

2013-06-06 Thread Wolfgang Schuster

Am 06.06.2013 um 09:56 schrieb Jaroslav Hajtmar hajt...@gyza.cz:

 Hello ConTeXist.
 Is there in ConTeXt any dirty trick, which can put more than 9 parameters 
 into macro?
 
 I mean for example \define[25]\macrowithtwentyfiveparams{  }

There are a few tricks when you need more then nine parameters
but it’s better to use a different method to pass argument from
one command to another. Better and more readable solutions are
intermediate commands for each value or assignment lists (a=x,b=y,…).

 I use rarely any trick from Peter Olsak (see below) and I'd like something 
 like that used in ConTeXt.
 
 Thanx
 Jaroslav Hajtmar
 
 Here is minimal example of trick of Petr Olsak:
 
 \newcount\tempnum
 \def\terminator{*}
 \newcount\tempnum
 \def\readparameters{\tempnum=0\let\next=\readone \next}
 \def\readone #1,{\advance\tempnum by 1 \def\param{#1}%
%\the\tempnum - \param\par%
\ifx\param\terminator \let\next=\relax
\else\expandafter\gdef\csname param\the\tempnum\endcsname{#1}%
\fi\next}
 
 
 \def\moreparameters#1{%
 \readparameters #1 %
 \csname param1\endcsname, % write first parameter
 \csname param3\endcsname, % write third parameter
 \csname param5\endcsname, % write fifth parameter
 }
 
 
 \starttext
 
 %\readparameters a,b,c,d,e,f,g,h,i,j,k,m,n,o,*, %
 %\def\parameters{aaa,,,,e,f,g,*,}
 %\expandafter\readparameters\parameters
 
 \moreparameters{a,b,c,d,e,f,g,h,i,j,k,m,n,o,*,}
 
 \stoptext


Can be simplified with \processcommalist:

\starttext

\def\domoreparameters#1%
  {\advance\scratchcounter\plusone
   \setvalue{param\number\scratchcounter}{#1}}

\def\moreparameters[#1]%
  {\scratchcounter\zerocount
   \processcommalist[#1]\domoreparameters}

\moreparameters[a,b,c,d,e,f,g,h,i,j,k,m,n,o]

\getvalue{param1},
\getvalue{param2},
\getvalue{param3}

\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
___


Re: [NTG-context] \define a command with square-bracket arguments

2012-09-28 Thread Sietse Brouwer
 Question for the others: What's the difference of \dodoubleargument
 and \dodoubleempty? I expected \dodoubleargument to throw an error
 since the arguments are supposed to be mandatory.

 In MkIV Hans didn’t add this check and in MkII he disabled is for command
 with three or less argument but even then you get only a message in the log
 when your command has no argument (i.e. a command with four argument
 complains only when it has zero argument but doesn’t complain when it
 has one to four arguments).

Wikified: http://wiki.contextgarden.net/Command/dodoubleempty
(I've been meaning to document that command for a while now. As a
complement to the existing explanation at
http://wiki.contextgarden.net/Commands_with_optional_arguments, I mean.)

--Sietse
___
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
___

Re: [NTG-context] \define a command with square-bracket arguments

2012-09-28 Thread Hans Hagen

On 28-9-2012 14:41, Sietse Brouwer wrote:

Question for the others: What's the difference of \dodoubleargument
and \dodoubleempty? I expected \dodoubleargument to throw an error
since the arguments are supposed to be mandatory.


In MkIV Hans didn’t add this check and in MkII he disabled is for command
with three or less argument but even then you get only a message in the log
when your command has no argument (i.e. a command with four argument
complains only when it has zero argument but doesn’t complain when it
has one to four arguments).


Wikified: http://wiki.contextgarden.net/Command/dodoubleempty
(I've been meaning to document that command for a while now. As a
complement to the existing explanation at
http://wiki.contextgarden.net/Commands_with_optional_arguments, I mean.)


Originally the 'argument' variant reported a message but when the code 
was cleaned up that went away ... actually it means that we can say:


\let\dosingleargument\dosingleempty
\let\dodoubleargument\dodoubleempty
\let\dotripleargument\dotripleempty
\let\doquadrupleargument \doquadrupleempty
\let\doquintupleargument \doquintupleempty
\let\dosixtupleargument  \dosixtupleempty
\let\doseventupleargument\doseventupleempty

in syst-aux.mkiv, which is somewhat more efficient

There is still checking in the {} variants.

Hans


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-
___
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
___

[NTG-context] \define a command with square-bracket arguments

2012-09-27 Thread Sietse Brouwer
Hi all,

As I understand it, \define[2] is preferred over \def#1#2 because it
refuses to overwrite existing commands.

\define[2]\mycommand{code code code}
defines a command to be invoked with
\mycommand{...}{...}

Can I use \define, or a related command, to define a command that
takes square-bracket arguments, like so:
\mycommand[...][...]
?

When I type
\define[1][2]\mycommand{code code code}
that doesn't work.

Cheers,
Sietse
___
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
___


Re: [NTG-context] \define a command with square-bracket arguments

2012-09-27 Thread Thomas A. Schmitz

On 09/27/2012 05:45 PM, Sietse Brouwer wrote:

Hi all,

As I understand it, \define[2] is preferred over \def#1#2 because it
refuses to overwrite existing commands.

\define[2]\mycommand{code code code}
defines a command to be invoked with
\mycommand{...}{...}

Can I use \define, or a related command, to define a command that
takes square-bracket arguments, like so:
\mycommand[...][...]
?

When I type
\define[1][2]\mycommand{code code code}
that doesn't work.

Cheers,
Sietse
___


You know the wiki better than most, but I wonder: are you looking for 
this page?


http://wiki.contextgarden.net/Commands_with_optional_arguments

Thomas
___
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
___


Re: [NTG-context] \define a command with square-bracket arguments

2012-09-27 Thread Marco Patzer
2012-09-27 Sietse Brouwer sbbrou...@gmail.com:

Hi Sietse,

 As I understand it, \define[2] is preferred over \def#1#2 because it
 refuses to overwrite existing commands.

\define overwrites existing commands with pleasure. In contrast to
\def it prints a message to the log file: “\mycommand is already
defined”.

 Can I use \define, or a related command, to define a command that
 takes square-bracket arguments, like so:
 \mycommand[...][...]

\def\mycommand
  {\dodoubleempty\domycommand}

\def\domycommand [#1][#2]
  {first: #1, second: #2}

\mycommand [foo] [bar]
\mycommand [foo][bar]
\mycommand [foo]

Question for the others: What's the difference of \dodoubleargument
and \dodoubleempty? I expected \dodoubleargument to throw an error
since the arguments are supposed to be mandatory.


Marco

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

Re: [NTG-context] define vs setup

2012-07-26 Thread Hans Hagen

On 26-7-2012 05:21, S Barmeier wrote:

You can \setup what you \define|d yourself and \setup what is
pre\define|d, but not \setup something that is not \define|d.

Maybe ;)


it depends .. often it's:

\definexx[whatever]
\definexx[whatever][settings]
\definexx[another][parent]
\definexx[another][parent][settings]

\setupxx[settings]
\setupxx[another][settings]
\setupxx[whatever][settings]

sometimes there are no defines because a feature is generic or global in 
nature. often a define generates a command (\whatever, \startwhatever), etc


btw, a redefine does not reset already set parameters (in mkii that is 
often the case but not in mkiv)


it all depends on what kind of functionality you're dealing with

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-
___
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
___


Re: [NTG-context] define vs setup

2012-07-26 Thread Bill Meahan

On 07/26/2012 04:13 AM, Hans Hagen wrote:

On 26-7-2012 05:21, S Barmeier wrote:

You can \setup what you \define|d yourself and \setup what is
pre\define|d, but not \setup something that is not \define|d.

Maybe ;)


it depends .. often it's:

\definexx[whatever]
\definexx[whatever][settings]
\definexx[another][parent]
\definexx[another][parent][settings]

\setupxx[settings]
\setupxx[another][settings]
\setupxx[whatever][settings]

sometimes there are no defines because a feature is generic or global in
nature. often a define generates a command (\whatever, \startwhatever), etc

btw, a redefine does not reset already set parameters (in mkii that is
often the case but not in mkiv)

it all depends on what kind of functionality you're dealing with

Hans



OK, let's deal with a specific use case.

I'm publisher/editor/reporter/photographer/mailer/janitor/coffeemaker 
for an organizational newsletter. I've done lots of other newsletters 
before but using DTP programs. I really want to use ConTeXt for this one
because the layout is (required to be) absolutely identical from one 
issue to the next.


Like a traditional newspaper, the front page will contain the masthead, 
headline and (for this one) a mandatory Privacy Act Notification. I'm 
virtually certain I can handle the three special bits using layers and
which will leave the margins and text area the same as the rest of the 
pages albeit with no header or footer. Hence, by definition, the front 
page is a makeup page for which the examples on the wiki are a bit, 
shall we say, sparse.


Without the makeup page, a \setuplayout [settings] works just 
wonderfully - I have a dummy with which I'm doing testing so I actually 
tried it. :)


Would I correctly, then, do the following:

% Global layout
\setuplayout
[settings]

\definelayout
[frontpage]
[settings]   % Only those things that are different from the global

\definemakeup
[frontpage]

% other definitions, fonts yadda, yadda, yadda

\starttext

\startmakeup [frontpage]
% place the layers

% content

\stopmakup

% continue content as required

\stoptext

Sorry for the length of this note but I thought it better to explain the 
whole thing upfront than in bits and pieces.


Thanks for all the help. I'm really loving ConTeXt but switching after
mumble years of using LaTeX and DTP programs is proving a little more 
of a challenge than I expected. Old dogs *can* learn new tricks but it 
takes a bit more work. :)


--
Bill Meahan, Westland, Michigan USA

“Writing is a combination of intangible
  creative fantasy and appallingly
  hard work.”

  —Anthony Powell


This message is digitally signed with an X.509 certificate
to prove it is from me and has not been altered since it was sent.



smime.p7s
Description: S/MIME Cryptographic Signature
___
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
___

Re: [NTG-context] define vs setup

2012-07-26 Thread Marco Patzer
On 2012-07-26 Bill Meahan wmeaha...@gmail.com wrote:

Hi Bill,

it's a typo:

 \stopmakup

\stopmakeup


Marco

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


Re: [NTG-context] define vs setup

2012-07-26 Thread Bill Meahan

On 07/26/2012 11:34 AM, Marco Patzer wrote:

On 2012-07-26 Bill Meahan wmeaha...@gmail.com wrote:

Hi Bill,

it's a typo:


\stopmakup


\stopmakeup



Sorry 'bout that. :)

I've never been a good typist even though I can dump a lot of text 
into a file in a short time. It *is* correct in my actual test file.



--
Bill Meahan, Westland, Michigan USA

“Writing is a combination of intangible
  creative fantasy and appallingly
  hard work.”

  —Anthony Powell


This message is digitally signed with an X.509 certificate
to prove it is from me and has not been altered since it was sent.



smime.p7s
Description: S/MIME Cryptographic Signature
___
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
___

Re: [NTG-context] define vs setup

2012-07-26 Thread Mojca Miklavec
On Thu, Jul 26, 2012 at 5:04 PM, Bill Meahan wrote:

 I really want to use ConTeXt for this one
 because the layout is (required to be) absolutely identical from one issue
 to the next.

There is one thing that I warmly suggest you to do, and that is making
backups of ConTeXt versions that you use for production. ConTeXt is
lightweight enough, so you can easily afford storing the versions you
use along with content, and then try to compile your documents both
with the latest  greatest version as well as some backup version,
just to make sure that everything is still perfectly fine in both.
MKII is stable, but MKIV is still a moving target and from time to
time one or the other thing changes (LaTeX is in a sense way more
stable, but on the other hand 99.9% of the time you have no chance
that anyone would implement any feature request to make your life
easier).

Mojca
___
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
___


Re: [NTG-context] define vs setup

2012-07-26 Thread Khaled Hosny
On Thu, Jul 26, 2012 at 06:15:31PM +0200, Mojca Miklavec wrote:
 LaTeX is in a sense way more stable

Which is mostly an illusion, packages do change all the time,
hyphenation patterns change, fonts change and engines change (even
pdfTeX), and unlike ConTeXt backups are much harder to take (short of
backing up your whole TeX Live installation).

Regards,
 Khaled
___
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
___


[NTG-context] define vs setup

2012-07-25 Thread Bill Meahan

I'm confused again. :\

When do you use a \defineSOMETHING instead of \setupSOMETHING ?

Must something be \define'ed before it is \setup or is it the other 
way around or is one required or one not or Reading the manual and 
wiki just leaves me more confused since examples are given which use one 
OR the other but don't seem to require both. Or am I missing something 
again.


Reading the pages for the individual commands doesn't help since it is 
often the case the page detailing the \define commands mostly seem

to imply \define inherits from \setup.

Sigh.

--
Bill Meahan, Westland, Michigan USA

“Writing is a combination of intangible
  creative fantasy and appallingly
  hard work.”

  —Anthony Powell


This message is digitally signed with an X.509 certificate
to prove it is from me and has not been altered since it was sent.



smime.p7s
Description: S/MIME Cryptographic Signature
___
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
___

Re: [NTG-context] define vs setup

2012-07-25 Thread S Barmeier
You can \setup what you \define|d yourself and \setup what is
pre\define|d, but not \setup something that is not \define|d.

Maybe ;)

Severin

On 07/26/2012 12:18 PM, Bill Meahan wrote:
 I'm confused again. :\
 
 When do you use a \defineSOMETHING instead of \setupSOMETHING ?
 
 Must something be \define'ed before it is \setup or is it the other
 way around or is one required or one not or Reading the manual and
 wiki just leaves me more confused since examples are given which use one
 OR the other but don't seem to require both. Or am I missing something
 again.
 
 Reading the pages for the individual commands doesn't help since it is
 often the case the page detailing the \define commands mostly seem
 to imply \define inherits from \setup.
 
 Sigh.
 
 
 
 ___
 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
 ___
 

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


[NTG-context] define macro from xml-attribute

2012-03-16 Thread Meer, H. van der
I would like to accomplish the following in xml processing.

node macro=various macro calls and then define the attribute value as a TeX 
macro.
For example, to use this in font switching: node 
macro=\switchtobodyfont[helvetica]

Doing this in the following manner does not work:

\startxmlsetups namespace
  \def\macro{\xmlattdef{#1}{macro}{\empty}} 
\stopxmlsetups

The contents evaluates not to a working macro.
Something with catcodes, I presume, but I do not how to do it properly.
Preferably I would like to see \meaning\macro evaluate to: 
\switchtobodyfont[helvetica].

Can someone enlighten me?

Hans van der Meer



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


Re: [NTG-context] define macro from xml-attribute

2012-03-16 Thread Hans Hagen

On 16-3-2012 10:25, Meer, H. van der wrote:

I would like to accomplish the following in xml processing.

node macro=various macro calls  and then define the attribute value as a 
TeX macro.
For example, to use this in font switching:node 
macro=\switchtobodyfont[helvetica]

Doing this in the following manner does not work:

\startxmlsetups namespace
   \def\macro{\xmlattdef{#1}{macro}{\empty}}
\stopxmlsetups

The contents evaluates not to a working macro.
Something with catcodes, I presume, but I do not how to do it properly.
Preferably I would like to see \meaning\macro evaluate to: 
\switchtobodyfont[helvetica].

Can someone enlighten me?

\edef

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-
___
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
___


[NTG-context] Define `\luatexversion` similar to `\contextversion`

2011-12-03 Thread Paul Menzel
Dear ConTeXt folks,


thanks to Robin’s example documents I found out about the following last
two commands

\Context\ \contextmark\ \contextversion

allowing to put the used components and versions into the document.

Then I found `\luaversion` to display the version of Lua. But I could
not find `\luatexversion`. Is there something similar? Can this command
be defined?


Thanks,

Paul


signature.asc
Description: This is a digitally signed message part
___
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
___

Re: [NTG-context] Define `\luatexversion` similar to `\contextversion`

2011-12-03 Thread Wolfgang Schuster

Am 03.12.2011 um 19:23 schrieb Paul Menzel:

 Dear ConTeXt folks,
 
 
 thanks to Robin’s example documents I found out about the following last
 two commands
 
\Context\ \contextmark\ \contextversion
 
 allowing to put the used components and versions into the document.
 
 Then I found `\luaversion` to display the version of Lua. But I could
 not find `\luatexversion`. Is there something similar? Can this command
 be defined?


\starttext
\starttabulate
\NC Engine  \EQ \texenginename\NC\NR
\NC Version \EQ \texengineversion \NC\NR
\stoptabulate
\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
___


[NTG-context] \define[1]\command or \define\command[1]? (was: math: command for absolute value: `\define\abs[1]{\lvert #1 \rvert}` throws `\lvert -\Udelimiter`.)

2011-06-05 Thread Paul Menzel
Dear Otared,


Am Samstag, den 04.06.2011, 23:59 +0200 schrieb Otared Kavian:

 I think the error comes from your way of using \define: you use
\define\abs[1]{\lvert #1 \rvert}
 instead of
   \define[1]\abs{\lvert#1\rvert}
 
  the following works fine for me:
 
 \starttext
 
 %\define[1]\abs{|#1|} % this works
 
 \define[1]\abs{\lvert#1\rvert} % this works too
 
 $\abs{-1} = 1$
 \stoptext

thank you very much for the solution. I took my definition from the Wiki
[1].

Could the developers please clarify the correct syntax so that it can be
updated in the source or the Wiki.


Thanks,

Paul


[1] http://wiki.contextgarden.net/Reference/en/define


signature.asc
Description: This is a digitally signed message part
___
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
___

Re: [NTG-context] \define[1]\command or \define\command[1]? (was: math: command for absolute value: `\define\abs[1]{\lvert #1 \rvert}` throws `\lvert -\Udelimiter`.)

2011-06-05 Thread Wolfgang Schuster

Am 05.06.2011 um 12:11 schrieb Paul Menzel:

 thank you very much for the solution. I took my definition from the Wiki [1].
 
 Could the developers please clarify the correct syntax so that it can be
 updated in the source or the Wiki.


The wiki entry is correct, the syntax is

  \define[number of arguments]\name of the command{do something with the 
arguments}


When you want a command without argument you can omit the brackets and write

  \define\command{...}


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
___


Re: [NTG-context] \define...

2010-04-20 Thread Vyatcheslav Yatskovsky


Curiouser and curiouser! cried Alice.
:)



context has two different versions of \define, there is one in
syst-ext.mkii/syst-aux.mkiv
which has no parameters but prevents you from overwriting a existing
command (there \redefine
with allows this) and another one in core-sys.mkii/mkiv which replace
the first one and has
support for parameters but replace on the other side the old definition
(you get only the
terminal message)

the question is, which behavious is correct, replace the old macro or
keep it, in my
opinion \define should leave the old definition untouced and \redefine
should be used
in this case (but we need a version with parameters)



--
Best Regards,
Vyatcheslav Yatskovsky
___
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
___


[NTG-context] \define... (was: Re: Structuring topics)

2010-04-19 Thread Peter Münster
On Mon, Apr 19 2010, Wolfgang Schuster wrote:

 \starttext
 \define\hans{hans}
 \define\hans{taco}
 \stoptext

 the output now is 'hans' because \define checks whether a command with the 
 name \hans is already defined

Hello Wolfgang,

Did you test it? The output is taco here on my system:
MTXrun | current version: 2010.04.16 21:08

Cheers, Peter

-- 
Contact information: http://pmrb.free.fr/contact/


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


Re: [NTG-context] \define...

2010-04-19 Thread Wolfgang Schuster

Am 19.04.10 21:15, schrieb Peter Münster:

On Mon, Apr 19 2010, Wolfgang Schuster wrote:
   

\starttext
\define\hans{hans}
\define\hans{taco}
\stoptext

the output now is 'hans' because \define checks whether a command with the
name \hans is already defined
 

Hello Wolfgang,

Did you test it? The output is taco here on my system:
MTXrun | current version: 2010.04.16 21:08
   

no i didn't test it

context has two different versions of \define, there is one in 
syst-ext.mkii/syst-aux.mkiv
which has no parameters but prevents you from overwriting a existing 
command (there \redefine
with allows this) and another one in core-sys.mkii/mkiv which replace 
the first one and has
support for parameters but replace on the other side the old definition 
(you get only the

terminal message)

the question is, which behavious is correct, replace the old macro or 
keep it, in my
opinion \define should leave the old definition untouced and \redefine 
should be used

in this case (but we need a version with parameters)

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
___


Re: [NTG-context] Define tex macro on the context command line

2009-11-12 Thread Hans Hagen

Aditya Mahajan wrote:

On Wed, 11 Nov 2009, John Devereux wrote:


Hi,

Is it possible to define a tex macro on the context command line (MkII)?

For example:

 texexec manual.tex --define Title X99 Operators Manual

so that

 \Title

would expand to the appropriate text?


You can do that with pdftex command,

pdftex -progname=context -fmt=cont-en -translate-file=natural.tcx 
--output-format=pdf --8bit --jobname=filename

 \\def\\Title{whatever} \\input filename

but you loose all the goodies of texexec (multiple runs, running bibtex, 
sorting index, etc.)


Alternatively, it is possible to read from console during a tex run

\starttext
\immediate\write16{What is the title?}
\read16 to \Title
Title is \Title
\stoptext



\starttext

test: \env{whatever}

\stoptext

context --arguments=whatever=Test ...


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-
___
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
___


[NTG-context] Define tex macro on the context command line

2009-11-11 Thread John Devereux
Hi,

Is it possible to define a tex macro on the context command line (MkII)?

For example:

  texexec manual.tex --define Title X99 Operators Manual

so that 

  \Title

would expand to the appropriate text?

(I know about modes I think)

-- 

John Devereux
___
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
___


Re: [NTG-context] Define exercise captions

2009-11-04 Thread Vyatcheslav Yatskovsky

Thank you, Aditya, for help!

My further questions:

Why after={}or after= does not remove the space between enumeration 
caption and next paragraph?


For example:

\defineenumeration[exercise][title=yes, text=Вправа, prefix=yes,

prefixset=section, titleleft=, titleright=, after=]


\exercise{Розрахунок кривої, яка плавно з'єднує заданий відрізок та 
точку на площині}Якщо нам потрібно з'єднати, наприклад, відрізок, який 
лежить...


produces blank line after the caption.

Could we have all the switches listed in tex-show, btw?

Now you probably think that giving me advise to use enumerations was not 
good idea ))


Regards,
Vyatcheslav
___
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
___


Re: [NTG-context] Define exercise captions

2009-11-04 Thread Aditya Mahajan

On Thu, 5 Nov 2009, Vyatcheslav Yatskovsky wrote:


Thank you, Aditya, for help!

My further questions:

Why after={}or after= does not remove the space between enumeration 
caption and next paragraph?


For example:

\defineenumeration[exercise][title=yes, text=Вправа, prefix=yes,

prefixset=section, titleleft=, titleright=, after=]


\exercise{Розрахунок кривої, яка плавно з'єднує заданий відрізок та 
точку на площині}Якщо нам потрібно з'єднати, наприклад, відрізок, який 
лежить...


produces blank line after the caption.


Change location=top (the default) to location=serried.

Now you probably think that giving me advise to use enumerations was not 
good idea ))


Its alright as long as you add something about enumerations to the wiki :)

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
___


Re: [NTG-context] Define exercise captions

2009-11-04 Thread Vyatcheslav Yatskovsky
Please, disregard my last question about enumeration setup. Now I know 
more and created definition that works fine for me:


\defineenumeration[exercise][title=yes, text=Вправа, prefix=yes,

prefixset=section, titleleft=, titleright=, after=, 
inbetween={\blank[medium]}]



The trick is that after sets space after the next paragraph text. I 
wonder why http://texshow.contextgarden.net/cmd/setupenumerations is empty.



Regards,
Vyatcheslav

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


Re: [NTG-context] Define exercise captions

2009-11-02 Thread Vyatcheslav Yatskovsky

Hello Aditya,

Thanks for help again. However, the result is far from OK.

[title=yes, text=Вправа, way=bysection, prefix=yes, width=broad]

I use enumeration within subsubsection, namely 1.3.1. If I put 
prefix=yes, the first exercise is 1.3.1.1. That is, it is numbered 
within subsubsection, while I want to be only 
SectionNumber.ExerciseNumber, like 1.1, 1.2, etc.


I suspected that [way=bysection] key does the job but it does nothing in 
this case.


And another major issue is: why the text is put in the frame and is 
either a few centimenters wide (without width=broad) or goes out of the 
page (with width=broad)? I need just ordinary paragraph.



Please, try

\starttext
\defineenumeration[exercise][title=yes, text=Вправа, way=bysection, 
width=broad]


\exercise{Розрахунок кривої, яка з'єднує три точки на площині}
\stoptext


The Вправа is putted twice, next time inside some strange brackets. 
The text gets out of the page.


Looks like a bug in mkiv. Hans, text need to be handled differently in 
descriptions and enumerations.


How to setup so that numeration will be done by subsection (1.1, 1.2, 
etc.)?


prefix=yes,


Thanks, Vyatcheslav
___
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
___


Re: [NTG-context] Define exercise captions

2009-11-02 Thread Longmin Wang
On Mon, Nov 02, 2009 at 01:31:02PM +0200, Vyatcheslav Yatskovsky wrote:
Hello Aditya,

Thanks for help again. However, the result is far from OK.

[title=yes, text=Вправа, way=bysection, prefix=yes, width=broad]

I use enumeration within subsubsection, namely 1.3.1. If I put 
prefix=yes, the first exercise is 1.3.1.1. That is, it is numbered 
within subsubsection, while I want to be only 
SectionNumber.ExerciseNumber, like 1.1, 1.2, etc.

You may try prefixset=section. 


I suspected that [way=bysection] key does the job but it does nothing in 
this case.

And another major issue is: why the text is put in the frame and is 
either a few centimenters wide (without width=broad) or goes out of the 
page (with width=broad)? I need just ordinary paragraph.

 Please, try

 \starttext
 \defineenumeration[exercise][title=yes, text=Вправа, way=bysection, 
 width=broad]

 \exercise{Розрахунок кривої, яка з'єднує три точки на площині}
 \stoptext


 The Вправа is putted twice, next time inside some strange brackets. 
 The text gets out of the page.

 Looks like a bug in mkiv. Hans, text need to be handled differently in 
 descriptions and enumerations.

 How to setup so that numeration will be done by subsection (1.1, 1.2, 
 etc.)?

 prefix=yes,

Thanks, Vyatcheslav
___
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
___

-- 
Longmin Wang longminw...@gmail.com
Math. Dept., Nankai Univ., China
http://math.nankai.edu.cn/~wanglm/
GnuPG-Key ID: 1024D/2A5CFA5C
Fingerprint: 8587 1246 3AAD C185 D419  ADF1 B620 D8B8 2A5C FA5C
___
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
___


Re: [NTG-context] Define exercise captions

2009-11-02 Thread Vyatcheslav Yatskovsky

Hello,

I want to be only
ExerciseSectionNumber.ExerciseNumber, like 1.1, 1.2, etc.
 

You may try prefixset=section.

   
Thank you, Longmin, for your suggestion, it works! But other problems 
persist.


Hans (or someone else who can fix it), please, look into my minimal example:


\defineenumeration[exercise][title=yes, text=Exercise, prefix=yes, 
prefixset=section, width=fit] %way=bysection,


\starttext
\exercise{Bla-bla-bla Bla-bla-bla Bla-bla-bla Bla-bla-bla Bla-bla-bla 
Bla-bla-bla}


Bla-bla-bla
\stoptext


1) the text is framed in odd manner and goes out of the page

2) the caption text is put into unexpected round brackets

3) the word Exercise is repeated twice, second time inside brackets 
before caption text.


Please, fix it because I use it. If it's impossible at the moment, 
please, suggest me another way of achieving this.


Reagards,
Vyatchelsav


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


Re: [NTG-context] Define exercise captions

2009-11-02 Thread Aditya Mahajan

On Tue, 3 Nov 2009, Vyatcheslav Yatskovsky wrote:


Hello,

I want to be only
ExerciseSectionNumber.ExerciseNumber, like 1.1, 1.2, etc.


You may try prefixset=section.


Thank you, Longmin, for your suggestion, it works! But other problems 
persist.


Hans (or someone else who can fix it), please, look into my minimal example:


\defineenumeration[exercise][title=yes, text=Exercise, prefix=yes, 
prefixset=section, width=fit] %way=bysection,


\starttext
\exercise{Bla-bla-bla Bla-bla-bla Bla-bla-bla Bla-bla-bla Bla-bla-bla 
Bla-bla-bla}


Bla-bla-bla
\stoptext


1) the text is framed in odd manner and goes out of the page


I don't know what you mean by this.


2) the caption text is put into unexpected round brackets


That is the expected behaviour. If you do not want the brackets, you can 
add


titleleft=, titleright=

3) the word Exercise is repeated twice, second time inside brackets before 
caption text.


This is already fixed in the latest beta.

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
___


Re: [NTG-context] Define exercise captions

2009-11-01 Thread Vyatcheslav Yatskovsky

Hello,

I need to define a Exercise command that will enumerate exercises and provide
  captions.

  For example,

  \exercise{Conversion from hex to dec}

  should produce

  Exercise 1.1. Conversion from hex to dec.

  What is the best way to achieve that? Use \definehead or another command?
 

\defineenumeration[exercise][title=yes,way=bysection]
   


Thank you Aditya, but the result is rather shoking )
Please, try

\starttext
\defineenumeration[exercise][title=yes, text=Вправа, way=bysection, 
width=broad]


\exercise{Розрахунок кривої, яка з'єднує три точки на площині}
\stoptext


The Вправа is putted twice, next time inside some strange brackets. 
The text gets out of the page.



How to setup so that numeration will be done by subsection (1.1, 1.2, etc.)?

Reards,
Vyatcheslav


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


Re: [NTG-context] Define exercise captions

2009-11-01 Thread Aditya Mahajan

On Sun, 1 Nov 2009, Vyatcheslav Yatskovsky wrote:


Hello,
I need to define a Exercise command that will enumerate exercises and 

provide

  captions.

  For example,

  \exercise{Conversion from hex to dec}

  should produce

  Exercise 1.1. Conversion from hex to dec.

  What is the best way to achieve that? Use \definehead or another 

command?



\defineenumeration[exercise][title=yes,way=bysection]



Thank you Aditya, but the result is rather shoking )
Please, try

\starttext
\defineenumeration[exercise][title=yes, text=Вправа, way=bysection, 
width=broad]


\exercise{Розрахунок кривої, яка з'єднує три точки на площині}
\stoptext


The Вправа is putted twice, next time inside some strange brackets. 
The text gets out of the page.


Looks like a bug in mkiv. Hans, text need to be handled differently in 
descriptions and enumerations.



How to setup so that numeration will be done by subsection (1.1, 1.2, etc.)?


prefix=yes,

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
___


[NTG-context] Define exercise captions

2009-10-31 Thread Vyatcheslav Yatskovsky

Hello,

I need to define a Exercise command that will enumerate exercises and 
provide captions.


For example,

\exercise{Conversion from hex to dec}

should produce

Exercise 1.1. Conversion from hex to dec.

What is the best way to achieve that? Use \definehead or another command?

Best regards,
Vyatcheslav
___
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
___


[NTG-context] define font | font with name Delicious-Roman is not found

2009-05-28 Thread Nicolas Girard
Hi all,
I'm using the latest beta of context minimals, rsynced over a TeXlive
2008 on ubuntu.

LuaTeX is Version beta-0.40.1-2009050920 (Web2C 7.5.7)
MTXrun is TDS Runner Tool 1.22
ConTeXt is 2009.05.28 14:36

$ mtxrun --script fonts --list|grep Delicious gives:
deliciousbold  Delicious-Bold
/usr/local/share/fonts/d/delicious_bold.otf
deliciousbolditalicDelicious-BoldItalic
/usr/local/share/fonts/d/delicious_bolditalic.otf
deliciousheavyDelicious-Heavy
/usr/local/share/fonts/d/delicious_heavy.otf
deliciousitalic  Delicious-Italic
/usr/local/share/fonts/d/delicious_italic.otf
deliciousroman   Delicious-Roman
/usr/local/share/fonts/d/delicious_roman.otf
delicioussmallcaps  Delicious-SmallCaps
/usr/local/share/fonts/d/delicious_smallcaps.otf

while env|grep ^OS gives
OSFONTDIR=/usr/local/share/fonts


Running the following file is okay:

\starttext
\font\Myfont=/usr/local/share/fonts/d/delicious_roman.otf at 24pt
\Myfont Hello, world
\stoptext

but running

\starttext
\font\Myfont=Delicious-Roman at 24pt
\Myfont Hello, world
\stoptext

leads to

define font | font with name Delicious-Roman is not found
define font | unknown font Delicious-Roman, loading aborted
! Font \Myfont=Delicious-Roman at 24pt not loadable: metric data
not found or bad.

What's going wrong ?
Thanks very much in advance !

--
Nicolas
___
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
___


Re: [NTG-context] define font | font with name Delicious-Roman is not found

2009-05-28 Thread Wolfgang Schuster


Am 28.05.2009 um 17:59 schrieb Nicolas Girard:


Hi all,
I'm using the latest beta of context minimals, rsynced over a TeXlive
2008 on ubuntu.

[...]

Running the following file is okay:

   \starttext
   \font\Myfont=/usr/local/share/fonts/d/delicious_roman.otf at 24pt
   \Myfont Hello, world
   \stoptext

but running

   \starttext
   \font\Myfont=Delicious-Roman at 24pt
   \Myfont Hello, world
   \stoptext



Please don't use \font, use ConTeXt's \definefont instead:

\definefont[Myfont][name:Delicious-Roman][features=default]

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
___


Re: [NTG-context] define an incremental personal bullet of item

2009-05-27 Thread dalyoung

Dear Hans,

Thank you for your code.
I tested it using ConTeXt and LuaTeX, but I got following error.


(/Users/graph/ConTeXtBeta/tex/texmf-context/tex/context/base/pdfr- 
def.tex)

(./test-lua.tuo)
systems : begin file test-lua at line 2
! Argument of \MyCircledNumber has an extra }.
inserted text
\par
to be read again
   }
\doattributes ...name #1...@ea \endcsname \fi {#4}
  \dostopattributes
\dolistitem ...evel \c!style \c!color {\listitem }
  \fi \fi } 
\ifconditional \f...


\complexdoitemgroupitem ...obreak \fi \dolistitem
  \relax  
\ifconditional \pac...

to be read again
   t
...
l.15 \dorecurse{20}{\item test \recurselevel}

?

However, I don't see any extra }.
I just copy your code and run it.

Thank you again

Best regards,

Dalyoung

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


Re: [NTG-context] define an incremental personal bullet of item

2009-05-27 Thread Willi Egger

Hi,

It works here with:
This is LuaTeX, Version beta-0.40.1-2009050813 (Web2C 7.5.7)
ConTeXt  ver: 2009.05.26 17:57 MKIV  fmt: 2009.5.26  int: english/ 
english



KR

Willi
On May 27, 2009, at 3:22 PM, dalyoung wrote:


Dear Hans,

Thank you for your code.
I tested it using ConTeXt and LuaTeX, but I got following error.


(/Users/graph/ConTeXtBeta/tex/texmf-context/tex/context/base/pdfr- 
def.tex)

(./test-lua.tuo)
systems : begin file test-lua at line 2
! Argument of \MyCircledNumber has an extra }.
inserted text
\par
to be read again
   }
\doattributes ...name #1...@ea \endcsname \fi {#4}
  \dostopattributes
\dolistitem ...evel \c!style \c!color {\listitem }
  \fi \fi } 
\ifconditional \f...


\complexdoitemgroupitem ...obreak \fi \dolistitem
  \relax  
\ifconditional \pac...

to be read again
   t
...
l.15 \dorecurse{20}{\item test \recurselevel}

?

However, I don't see any extra }.
I just copy your code and run it.

Thank you again

Best regards,

Dalyoung

__ 
_
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
___


Re: [NTG-context] define an incremental personal bullet of item

2009-05-27 Thread Peter Rolf

dalyoung schrieb:

Dear Hans,

Thank you for your code.
I tested it using ConTeXt and LuaTeX, but I got following error.


(/Users/graph/ConTeXtBeta/tex/texmf-context/tex/context/base/pdfr-def.tex) 


(./test-lua.tuo)
systems : begin file test-lua at line 2
! Argument of \MyCircledNumber has an extra }.
inserted text
\par
to be read again
   }
\doattributes ...name #1...@ea \endcsname \fi {#4}
  \dostopattributes
\dolistitem ...evel \c!style \c!color {\listitem }
  \fi \fi 
}\ifconditional \f...


\complexdoitemgroupitem ...obreak \fi \dolistitem
  \relax 
\ifconditional \pac...

to be read again
   t
...
l.15 \dorecurse{20}{\item test \recurselevel}

?

However, I don't see any extra }.
I just copy your code and run it.


I did the same (copy  run) and both marks work here. Must be some 
problem with your tex installation...



Best wishes, Peter



Thank you again

Best regards,

Dalyoung

___ 

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
___


Re: [NTG-context] define an incremental personal bullet of item

2009-05-27 Thread Dalyoung


Thank you for the checking.

I typed the text and run it.
At this time, it worked.
There may be a garbage attached during the process of copy and paste.

By the way, is it possible to  modify this code to use circled  
character a, b, c, ...?
By using the command \sym{symbol}, I may use them, but is there a  
automatic way of doing that?


Thank you again.

Best regards,

Dalyoug
___
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
___


[NTG-context] define an incremental personal bullet of item

2009-05-26 Thread polytope

Dear all,

I'd like to use circled number 1, circled number 2, ... as bullets  
of itemized block.

There is an explanation how to define a personal bullet in the manual.
For each \item the same bullet is used.  But I want bullets  
automatically changed to the next character in unicode table.

(For example, the command \startitemize[n]
displays next number as a bullet  when the command \item is issued. )

Is there a way to do that?

Thank you.

Best regards,

Dalyoung
___
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
___


Re: [NTG-context] define an incremental personal bullet of item

2009-05-26 Thread Hans Hagen

polytope wrote:

Dear all,

I'd like to use circled number 1, circled number 2, ... as bullets 
of itemized block.

There is an explanation how to define a personal bullet in the manual.
For each \item the same bullet is used.  But I want bullets 
automatically changed to the next character in unicode table.

(For example, the command \startitemize[n]
displays next number as a bullet  when the command \item is issued. )

Is there a way to do that?


\starttext

\startuniqueMPgraphic{circle}
draw fullcircle xsized(bbwidth (OverlayBox enlarged 2pt)) ;
\stopuniqueMPgraphic

\defineoverlay[circle][\uniqueMPgraphic{circle}]

\def\MyCircledNumber#1%
  {\inframed[background=circle,frame=off]{\number#1}}

\defineconversion[n][\MyCircledNumber]

\startitemize[n,broad]
\dorecurse{20}{\item test \recurselevel}
\stopitemize

\stoptext



-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-
___
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
___


[NTG-context] \define was: Section format using /def

2009-02-05 Thread Wolfgang Schuster


Am 05.02.2009 um 19:45 schrieb Michael Bynum:


Ah, I think I see. So \define[1]\mysectionhead{\bfa
\WORD{\underbar{#1}}} would also be valid.  Is \define a context
equivalent to the \def command for tex?  I couldn't find much
documentation on it.


\define is ConTeXt's equivalent to \newcommand in LaTeX, you can set
with the optional parameter the number of arguments. It makes a check
if the command you create is already defined and writes a message to
the terminal.

Usage:

\define\commanda   {First Command}
\define[1]\commandb{Second command: #1}
\define[2]\commandc{Third command: #1 #2}

\starttext
\commanda
\commandb{text}
\commandc{text}{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
___


[NTG-context] define command

2008-11-14 Thread Alan STONE
Hi,

For example

\define\somemacro[3]{...}

gets invoked with

\somemacro{#1}{#2}{#3}

How do you get rid of those repeating pesky curly brackets and
invoke a user defined macro with

\somemacro{#1,#2,#3}

instead ?  :O)

-- 
Best,
Alan

* TeX engine = LuaTeX
* ConTeXt  minimals ver: 2008.56.06 19:11 MKIV  fmt: 2008.11.10  int:
english/english
* Ubuntu 8.04 Hardy Heron
___
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
___


Re: [NTG-context] define command

2008-11-14 Thread Wolfgang Schuster

Am 14.11.2008 um 12:58 schrieb Alan STONE:

 Hi,

 For example

 \define\somemacro[3]{...}

 gets invoked with

 \somemacro{#1}{#2}{#3}

 How do you get rid of those repeating pesky curly brackets and
 invoke a user defined macro with

 \somemacro{#1,#2,#3}


\starttext

\def\somemacro#1%
   {\def\dosomemacro##1{(##1)}%
\processcommalist[#1]\dosomemacro}

\somemacro{A,B,C}

\stoptext

http://wiki.contextgarden.net/System_Macros/Comma_Separated_Lists
http://wiki.contextgarden.net/Inside_ConTeXt

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
___


Re: [NTG-context] define command

2008-11-14 Thread luigi scarso
On Fri, Nov 14, 2008 at 12:58 PM, Alan STONE
[EMAIL PROTECTED]wrote:

 Hi,

 For example

 \define\somemacro[3]{...}

 gets invoked with

 \somemacro{#1}{#2}{#3}

 How do you get rid of those repeating pesky curly brackets and
 invoke a user defined macro with

 \somemacro{#1,#2,#3}



Not what you want, but I have found useful this

\def\SomeMacro[#1]{%
\getparameters[SOMEMACRO][#1]
%%
%%now you have \csname SOMEMACRO{}\endcsname
%%
%%
}

\SomeMacro[foo=2,boo=4,goo=\TeX, my name is =joe]

\SOMEMACROfoo
\SOMEMACROboo
\SOMEMACROgoo
\csname SOMEMACROmy name is\endcsname


-- 
luigi
___
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
___


Re: [NTG-context] define command

2008-11-14 Thread Aditya Mahajan
On Fri, 14 Nov 2008, Alan STONE wrote:

 Hi,

 For example

 \define\somemacro[3]{...}

 gets invoked with

 \somemacro{#1}{#2}{#3}

 How do you get rid of those repeating pesky curly brackets and
 invoke a user defined macro with

 \somemacro{#1,#2,#3}

 instead ?  :O)

Others have replied how to define this if you want arbitrary number of 
parameters. But if you want something similar to \somemacro#1#2#3 you can 
use (the is some extra book-keeing because you want {..} as delimiters. 
Which means you either change catcodes, or do this shuffling around of 
arguments)

\def\somemacro#1%
{\dosomemaco[#1]}

\def\dosomemacro[#1,#2,#3]%
   {whatever you want the macro to be}

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
___


Re: [NTG-context] Define doifoneelse

2006-09-11 Thread Peter Münster
On Mon, 11 Sep 2006, Aditya Mahajan wrote:

 \doifoneelse{1}{a}{b}  gives a
 \doifoneelse{1.5}{a}{b} gives b
 \doifonelese{string}{a}{b} gives b
 
 Can someone suggest how to define this?

\def\doifoneelse#1#2#3{\doifelse{1}{#1}{#2}{#3}}
\starttext
\doifoneelse{1}{a}{b}  gives a
\doifoneelse{1.5}{a}{b}gives b
\doifoneelse{string}{a}{b} gives b
\stoptext

Cheers, Peter

-- 
http://pmrb.free.fr/contact/
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] Define doifoneelse

2006-09-11 Thread Aditya Mahajan



On Mon, 11 Sep 2006, Peter M?nster wrote:


On Mon, 11 Sep 2006, Aditya Mahajan wrote:


\doifoneelse{1}{a}{b}  gives a
\doifoneelse{1.5}{a}{b} gives b
\doifonelese{string}{a}{b} gives b

Can someone suggest how to define this?


\def\doifoneelse#1#2#3{\doifelse{1}{#1}{#2}{#3}}


Thanks Peter,

 I ended up using

\def\doifoneelse#1{\doifelse{#1}{1}}

which saves a few keystrokes :)

Aditya___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] Define doifoneelse

2006-09-11 Thread Hans Hagen
Aditya Mahajan wrote:


 On Mon, 11 Sep 2006, Peter M�nster wrote:

 On Mon, 11 Sep 2006, Aditya Mahajan wrote:

 \doifoneelse{1}{a}{b}  gives a
 \doifoneelse{1.5}{a}{b} gives b
 \doifonelese{string}{a}{b} gives b

 Can someone suggest how to define this?

 \def\doifoneelse#1#2#3{\doifelse{1}{#1}{#2}{#3}}

 Thanks Peter,

  I ended up using

 \def\doifoneelse#1{\doifelse{#1}{1}}

 which saves a few keystrokes :)
\def\doifoneelse{\doifelse{1}}

or 

\def\doifoneelse{\doifelse1}

saves you even more keystrokes and also a bit of runtime (measured in 
nanoseconds) 

Hans 

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


[NTG-context] Define doifoneelse

2006-09-10 Thread Aditya Mahajan
Hi,

  I want to define a macro, \doifoneelse, that checks if the first 
argument is 1 or not. It should work for decimals and strings also. 
So,

\doifoneelse{1}{a}{b}  gives a
\doifoneelse{1.5}{a}{b} gives b
\doifonelese{string}{a}{b} gives b

Can someone suggest how to define this?

Thanks,
Aditya

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


  1   2   >