Re: [NTG-context] Using variables and macros for styling of section title and line in table of contents

2020-07-22 Thread James Withers
Thanks so much for such a quick reply Wolfgang

<https://www.avast.com/sig-email?utm_medium=email_source=link_campaign=sig-email_content=webmail>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email_source=link_campaign=sig-email_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Wed, 22 Jul 2020 at 20:38, Wolfgang Schuster <
wolfgang.schuster.li...@gmail.com> wrote:

> James Withers schrieb am 22.07.2020 um 21:20:
> > Dear list
> >
> > I have a document with section headings which include a title, date and
> > reference spread over two lines with different font style and
> > justification, plus a slightly different text for the table of contents.
> >
> > So that I can alter the styling of the section headings without having
> > to recode each \startsection command, I have used variables and a macro
> > command for the style.
> >
> > This works for section 'title' and 'marking', but not for the 'list'
> > attribute.
>
> The title argument works only because it is placed in the text but it
> won't work when you try to show the argument in the ToC like the list
> argument.
>
> > The minimal working example below shows what I'm trying to do.
> >
> > Best wishes and many thanks in advance.
> >
> > James
> >
> >
> \define\mytitle{\getvariable{myvar}{title}\crlf{\tfx\getvariable{myvar}{date}\hfill\getvariable{myvar}{ref}}}
> > \define\mylist{\getvariable{myvar}{list}---{\bf
> \getvariable{myvar}{date}}}
>
> In this case you have to use \defineexpandable to create your commands
> and enable expansion for sections.
>
> \defineexpandable\mytitle{...}
> \defineexpandable\mylist {...}
>
> \setuphead[section][expansion=yes]
>
> 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] Using variables and macros for styling of section title and line in table of contents

2020-07-22 Thread James Withers
Dear list


I have a document with section headings which include a title, date and
reference spread over two lines with different font style and
justification, plus a slightly different text for the table of contents.


So that I can alter the styling of the section headings without having to
recode each \startsection command, I have used variables and a macro
command for the style.


This works for section 'title' and 'marking', but not for the 'list'
attribute.


The minimal working example below shows what I'm trying to do.


Best wishes and many thanks in advance.


James



\define\mytitle{\getvariable{myvar}{title}\crlf{\tfx\getvariable{myvar}{date}\hfill\getvariable{myvar}{ref}}}
\define\mylist{\getvariable{myvar}{list}---{\bf \getvariable{myvar}{date}}}

\starttext

\completecontent

\setvariables[myvar][
title={What I would like},
date={2020},
ref={Reference No 1},
list={Variation on title},
]

\startsection[title=\mytitle,list={Variation on title---{\bf 2020}}]

Contents line to look like this:

\mylist

\stopsection


\setvariables[myvar][
title={What I get},
date={2021},
ref={Reference No 2},
list={Something for the contents},
]

\startsection[title=\mytitle,list=\mylist]

Contents line to look like this:

\mylist

\stopsection
\stoptext


Virus-free.
www.avast.com

<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
___
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] \blank space at the top of a page

2020-06-18 Thread James Withers
Many thanks Wolfgang

I tried using force but that caused a problem with aligning to the
grid, not included in my original example, but included below.

I think I have seen \mbox used in this way in Latex, so was trying to
find a quick solution.

James


\setuplayout[grid=yes]
\showgrid

\setuphead[chapter][before={\blank[4*big]}]

\starttext

\startchapter[title={No space above this chapter}]

chapter text etc

\stopchapter

\setuphead[chapter][before={\blank[4*big,force]}]

\startchapter[title={Chapter with spacing but out of line with grid}]

chapter text etc

\stopchapter

\setuphead[chapter][before={\blank[4*line,force]}]

\startchapter[title={Chapter with spacing but out of line with grid}]

chapter text etc

\stopchapter

\stoptext

On Thu, 18 Jun 2020 at 16:44, Wolfgang Schuster
 wrote:
>
> James Withers schrieb am 18.06.2020 um 17:35:
> > Hello list
> >
> > I have been trying to find a solution to how to insert blank lines
> > before a chapter heading at the start of a page. In the following
> > example the \blank[4*big] is ignored. The solution I've found is to
> > add an empty box using \mbox{} before the \blank command.
>
> I'm curious where the use of \mbox is documented.
>
> > Is this the right way to do it or is there a more elegant way that I
> > am missing?
> >
> > Many thanks
> >
> > James
> >
> >
> > \setuphead[chapter][before={\blank[4*big]}]
>
> You have to add the "force" keyword to \blank because TeX ignores by
> default vertical space at the begin of a page.
>
> \setuphead[chapter][before={\blank[force,4*big]}]
>
> 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] \blank space at the top of a page

2020-06-18 Thread James Withers
Hello list

I have been trying to find a solution to how to insert blank lines
before a chapter heading at the start of a page. In the following
example the \blank[4*big] is ignored. The solution I've found is to
add an empty box using \mbox{} before the \blank command.

Is this the right way to do it or is there a more elegant way that I
am missing?

Many thanks

James


\setuphead[chapter][before={\blank[4*big]}]

\starttext

\startchapter[title={No space above this chapter}]

chapter text etc

\stopchapter

\setuphead[chapter][before={\mbox{}\blank[4*big]}]

\startchapter[title={Chapter with the right spacing}]

chapter text etc

\stopchapter

\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] No dots in \dotfill with new font

2020-06-16 Thread James Withers
Many thanks Hans. That has made the dots appear. If possible I would
like to use the dot from the same font, especially if using a font
where full stops are diamond shaped rather than circular.

Is there any way to map the dot from the external font so that it can
be used by the \dotfill command?

James

On Tue, 16 Jun 2020 at 21:04, Hans Hagen  wrote:
>
> On 6/16/2020 1:03 PM, James Withers wrote:
> > Hello
> >
> > I've followed the instructions on the Context Garden wiki to make use
> > of a different font. Unfortunately when using \dotfill the dots do not
> > show up. My minimal example is below. I think this might be because
> > \dotfill takes its dots from the math mode font which I have not set
> > up correctly.
> >
> > Grateful for any assistance
> >
> > James
> >
> >
> > \starttypescript [cormorant]
> > \definefontsynonym[Cormorant-Regular] [file:Cormorant-Regular]
> > \stoptypescript
> >
> > \starttypescript [cormorant]
> > \setups[font:fallback:serif]
> > \definefontsynonym[Serif] [Cormorant-Regular] [features=default]
> > \stoptypescript
> >
> > \starttypescript [cormorant]
> > \definetypeface [cormorant] [rm] [serif] [cormorant] [default]
> > \definetypeface [cormorant] [mm] [math] [cormorant] [default]
> > \stoptypescript
> >
> > \setupbodyfont [cormorant]
> >
> > \starttext
> >
> > .
> >
> > text before dotfill\dotfill text after dotfill
> >
> > .
> >
> > \stoptext
> you need a math font
>
>  \definetypeface [cormorant] [mm] [math]  [pagella] [default]
>
>
>
> -
>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] No dots in \dotfill with new font

2020-06-16 Thread James Withers
Hello

I've followed the instructions on the Context Garden wiki to make use
of a different font. Unfortunately when using \dotfill the dots do not
show up. My minimal example is below. I think this might be because
\dotfill takes its dots from the math mode font which I have not set
up correctly.

Grateful for any assistance

James


\starttypescript [cormorant]
\definefontsynonym[Cormorant-Regular] [file:Cormorant-Regular]
\stoptypescript

\starttypescript [cormorant]
\setups[font:fallback:serif]
\definefontsynonym[Serif] [Cormorant-Regular] [features=default]
\stoptypescript

\starttypescript [cormorant]
\definetypeface [cormorant] [rm] [serif] [cormorant] [default]
\definetypeface [cormorant] [mm] [math] [cormorant] [default]
\stoptypescript

\setupbodyfont [cormorant]

\starttext

.

text before dotfill\dotfill text after dotfill

.

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