Re: [NTG-context] styling individual parts of ToC entry

2020-09-06 Thread jbf
Yes, Wolfgang, that corrects the minor problem of including the author 
name correctly, even when there is no year range. Thank you.


But since I use \title, not \chapter, for the frontmatter items, ( 
Foreword, Preface, A note on Contributors), the ChapterListCommand 
clearly does not apply, so currently my ToC looks as follows (leaving 
out the pg numbers which correctly align right):



                    Foreword

                    A. Uthor

                           Preface

                    A. Uthor

                            A note on contributors

Chapter One        Year range

                   A. Uthor


What I want is for 'Foreword', 'Preface' and 'A note on Contributors' to 
align flushleft with Chapter One, but with author names still where they 
should be (Foreword and Preface have authors, 'A note...' does not have 
an author).


So I tried creating a TitleListCommand which copies the 
ChapterListCommand. But where I run into difficulties then is with a new 
lot of \setuplist to accommodate that. There are three different labels 
involved (Foreword, Preface, and A note on Contributors).


And why is it that even with the current setup, 'Foreword' has aligned 
with author name, not with 'Preface' and 'A note...'? All three are 
\title, after all.


All in all this is a most complicated ToC! What I need is for the ToC to 
look like I show it below, and you will note the additional complication 
of Chapter Two which does not have an author, but instead it is the 
SECTIONS in the Chapter that have authors!


I'm sure if I can get on top of all this somehow, no future ToC is ever 
going to cause me problems! The body of the book is all looking good, 
all 300 pages of it. It is just the automatically produced ToC that is 
causing the headaches.


Foreword                    A. Uthorpg no.

Preface                 A. Uthor"

A note on Contributors  "

Chapter One                 Chapter Title

                            A. Uthor"
Chapter Two Chapter title
A section   Context
A. Uthor"
Another section Reflection
A. Author   "


So what I have below as an MWE is fundamentally what you gave me (I have 
left out the correctly working ChapterListCommand), altered for \title, 
but I haven't got the setups below correct because I don't know how to 
do it. I have replaced unknowns with a question mark!


And at the moment I have nothing for the 'sections' with authors I need 
for Chapter Two. I assume I would set up a third definition called 
\SectionListCommand. Sections will have different labels too - one will 
be called 'Context', the other 'Reflection'.


\define[3]\TitleListCommand
  {\hbox\bgroup
 \hbox to 3cm{\currentlistsymbol\hss}% number + labeltext
 \vtop\bgroup
   \hsize\dimexpr\makeupwidth-3cm\relax
   \doifsomething{\rawstructurelistuservariable{year}}
 {{\it\structurelistuservariable{year}}\crlf}%
   \currentlistentrytitle % title
   \doifsomething{\rawstructurelistuservariable{author}}
 {\crlf{\structurelistuservariable{author}}}%
   \hfill\currentlistentrypagenumber % pagenumber
 \egroup
   \egroup}

\setuplist
  [chapter]
  [label=chapter,
  alternative=command,
   command=\ChapterListCommand]

\setuplist
  [title]
  [label=?,
  alternative=command,
   command=\TitleListCommand]

\setuplabeltext
  [en]
  [chapter={\bf Chapter }]

\setuplabeltext
  [en]
  [title={\bf ? }] %There needs to be three different labels



Julian
On 6/9/20 5:36 pm, Wolfgang Schuster wrote:

jbf schrieb am 06.09.2020 um 02:03:
Thanks Wolfgang, while I don't pretend to fully understand the setup 
you have provided (but am working on doing so!), of course it 
provides the correct result for a chapter that has a title, an 
author, and a year.


My ever-so-complicated book (and its authors!) however, throws one 
small further complication into the mix.


Where a chapter does not have a year-range, and I either omit that 
declaration, or I leave the curly brackets empty (e.g. year={}), then 
I find that the author name also does not appear in the ToC. What 
adjustment to the \ChapterListCommand do I need to make to 
accommodate the following? Possibly an \else statement, but not sure 
how to include that:


\startchapter [title={Chapter title}] [author={Author Name}]


I forgot to change the argument for the check off the author entry, 
this should fix it.


\define[3]\ChapterListCommand
  {\hbox\bgroup
 \hbox to 3cm{\currentlistsymbol\hss}% number + labeltext
 \vtop\bgroup
   \hsize\dimexpr\makeupwidth-3cm\relax
   \doifsomething{\rawstructurelistuservariable{year}}
 {{\it\structurelistuservariable{year}}\crlf}%
   \currentlistentrytitle % title
   

Re: [NTG-context] Problems with tikz plot file

2020-09-06 Thread Christian Prim
Many thanks Hans for the quick fix!

Christian

Am Fr., 4. Sept. 2020 um 10:09 Uhr schrieb Hans Hagen :

> On 9/4/2020 8:32 AM, Christian Prim wrote:
> > Hi everyone
> >
> > Following MWE produces an error on newest lmtx (current version:
> > 2020.09.03 20:03):
> >
> > \usemodule[tikz]
> > \starttext
> > \placefigure[here][]{}{\hbox{\starttikzpicture
> > \draw plot file {data.table};
> > \stoptikzpicture}}
> > \stoptext
> >
> > with data.table:
> >
> > 150 -0.102
> > 150.1 -0.15
> > 150.2 -0.389
> > 150.3 -0.15
> > 150.4 -0.389
> > 150.5 -0.15
> > 150.6 -0.293
> > 150.7 -0.341
> > 150.8 -0.485
> > 150.9 -0.293
> >
> > (data.table could be any x-y-pair)
> >
> > The error says:
> > tex error on line 5 in file ./plot.tex: Argument of \pgf@parsexyline
> has
> > an extra }
> >
> > It doesn't seem to be directly related to
> >
> https://unix.stackexchange.com/questions/10267/how-to-find-unmatched-brackets-in-a-text-file
>  as
>
> > I have tested to convert data.table to dos-Format with unix2dos. No
> success.
> >
> > I'm working on linux (debian).
> >
> > What am I missing? Or is this a bug?
> seems that i need to append a space to the lines read in .. i'll fix it
>
> 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
>
> ___
>
___
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] \setupuserpagenumber not working as expected

2020-09-06 Thread Jan Willem Flamma
Dear Wolfgang, Thank you for taking the time to go through the example and indicating these improvements. I will definitely evaluate and start applying this to my own code. Kind regards,Jan WillemFrom: Wolfgang SchusterSent: Friday, 4 September 2020 10:47To: mailing list for ConTeXt users; Jan Willem FlammaSubject: Re: [NTG-context] \setupuserpagenumber not working as expected Jan Willem Flamma schrieb am 03.09.2020 um 10:29:> Dear Julian,> > I use something similar using a main product file, an environment file > that contain the styling and several components that build up the > frontmatter, the manual and the appendices.> > Below my setup where I start the roman numbering on the table of > contents page (page 5 or v in roman)> > Once the bodymatter starts the pagenumber is set  to the arabic 1 (see > below in the main product file)> > You should be able to copy and adapt to your needs. There are lot of things which can be improved in your example. 1. Pass the filename of the component/product to \startcomponent and not some dummy name (or just use *), this allows you to print the filename with \currentcomponent or \currentproduct 2. Use \setvariables or \setupdocument to set the document title, revision etc. 3. Use \startsectionblockenvironment to move setups from the document content into the environment file. 4. Use pagestate=start to increase the page counter with \startstandardmakeup. 5. Set search path for figures (\copypages use the figure mechanism) with \setupexternalfigure[location=...]. Below is a modified (but untested) version of your sample document. Wolfgang   begin product\startproduct product \environment env-WA % \setvariables%   [document]%   [ manual={Course Manual},%  title={Title},%    subtitleone={Subtitle 1},%    subtitletwo={Subtitle 2},%  revnumber={Revision number}] \setupdocument   [ manual={Course Manual},  title={Title},    subtitleone={Subtitle 1},    subtitletwo={Subtitle 2},  revnumber={Revision number}] \startfrontmatter    \component fm-frontpage   \component fm-titlepage   \component fm-tableofcontents \stopfrontmatter \startbodymatter    \component co-01   \component co-02 \stopbodymatter \startappendices    \component co-ap-01   \component co-ap-02 \stopappendices \startbackmatter    \copypages[app1.pdf][n=4] \stopbackmatter \stopproduct end product  begin environment\startenvironment env-WA \setuppagenumbering   [alternative=doublesided,  location=right]   \defineconversionset   [frontpart:pagenumber] [] [romannumerals] \setupexternalfigures   [directory={External PDF}] \startsectionblockenvironment [frontpart]    \setupbackgrounds [leftpage] [setups=pagenumber:left]    \setupbackgrounds [rightpage] [setups=pagenumber:right] \stopsectionblockenvironment \startsectionblockenvironment [bodypart]    \setupbackgrounds [leftpage] [setups=pagenumber:left]    \setupbackgrounds [rightpage] [setups=pagenumber:right]    \setuppagenumber [number=1] \stopsectionblockenvironment \startsectionblockenvironment [appendix]    \setupbackgrounds [leftpage] [setups=pagenumber:left]    \setupbackgrounds [rightpage] [setups=pagenumber:right] \stopsectionblockenvironment \startsectionblockenvironment [backpart]    \setuppagenumber[state=stop] \stopsectionblockenvironment \stopenvironment end environment  begin component\startcomponent fm-frontpage \product product \startstandardmakeup [top=,pagestate=start,align=middle,color=Modu_Blue] % \dontleavehmode\externalfigure[frontpage-logo.png][width=12cm] \framed   [height=5cm,width=broad,frame=off]   {\externalfigure[frontpage-logo.png][width=12cm]} \blank[6*big] {\bfc \documentvariable{manual}} \blank[4*big] {\tfc \documentvariable{title}} \blank[2*big] {\tfc \documentvariable{subtitleone}} \blank[2*big] {\tfc \documentvariable{subtitletwo}} \stopstandardmakeup \stopcomponent end component  begin component\startcomponent fm-titlepage \product product \startstandardmakeup [top=,pagestate=start,align=middle,color=Modu_Blue] {\tfb \documentvariable{manual}} \blank[2*big] {\tfb \documentvariable{title}} \blank[2*big] {\tfb \documentvariable{subtitleone}} \blank[2*big] {\tfb \documentvariable{subtitletwo}} \blank[10*big] {\tfb \documentvariable{revnumber}} \blank {\tfb \currentdate[month,year]} \blank[10*big] {\tfb Written by:} \blank {\tfb Company name} \blank {\tfb City, Country} \stopstandardmakeup \stopcomponent end component  begin component\startcomponent fm-tableofcontents \product product \starttitle [title=Table of Contents] \placecontent \stoptitle \stopcomponent end component 
___
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  : 

Re: [NTG-context] Combining modes and MetaFun

2020-09-06 Thread Jan Willem Flamma
Thank you Hans, this is exactly what I need. I will wikify the examples. Kind regards,Jan Willem Flamma  From: Hans HagenSent: Friday, 4 September 2020 15:09To: mailing list for ConTeXt users; Jan Willem FlammaSubject: Re: [NTG-context] Combining modes and MetaFun On 9/4/2020 2:20 PM, Jan Willem Flamma wrote:> Dear list members,> > Is it possible to combine modes and MetaFun?> > In the below MWE, the \doifmode construction does not work.> > Kind regards,> > Jan Willem Flamma> > ===> > \enablemode[en]> > %\enablemode[nl]> > \starttext> > \startbuffer[square]> >      u := 2cm ;> >      draw unitsquare scaled u ;> >      drawdblarrow (0,-0.2u)..(u,-0.2u) ;> >      drawdblarrow (1.2u, 0)..(1.2u, u) ;> >      %\doifmode{en}{label(\sometxt{length},  (0.5u,-0.4u)) ;}> >      %\doifmode{nl}{label(\sometxt{lengte},  (0.5u,-0.4u)) ;}> >      %\doifmode{en}{label(\sometxt{width},   (1.6u, 0.5u)) ;}> >      %\doifmode{nl}{label(\sometxt{breedte}, (1.6u, 0.5u)) ;}> > \stopbuffer> > \placefigure> >      [here,none][]{}> >      {\scale[width=0.5\textwidth]{\processMPbuffer[square]}}> > \stoptextYou need to compensate these solutions by "wikifying" them: \starttext \startuseMPgraphic{whatever}{s::mode} u := 2cm ; draw unitsquare scaled u ; drawdblarrow (0,-0.2u)..(u,-0.2u) ; drawdblarrow (1.2u, 0)..(1.2u, u) ; if "\MPvar{mode}" = "en" : label("e", (0.5u,-0.4u)) ; label("n", (1.6u, 0.5u)) ; else : label("n", (0.5u,-0.4u)) ; label("l", (1.6u, 0.5u)) ; fi ;\stopuseMPgraphic \useMPgraphic{whatever}{mode=en} \blank\useMPgraphic{whatever}{mode=nl} \blank \startuseMPgraphic{whatever} u := 2cm ; draw unitsquare scaled u ; drawdblarrow (0,-0.2u)..(u,-0.2u) ; drawdblarrow (1.2u, 0)..(1.2u, u) ; if texmode("en") : label("e", (0.5u,-0.4u)) ; label("n", (1.6u, 0.5u)) ; else : label("n", (0.5u,-0.4u)) ; label("l", (1.6u, 0.5u)) ; fi ;\stopuseMPgraphic { \enablemode[en] \useMPgraphic{whatever} } \blank{ \useMPgraphic{whatever} } \blank \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
___


Re: [NTG-context] Typing efficiency

2020-09-06 Thread Jan Willem Flamma
Thank you Taco and Wolfgang. I will have a look at both solutions. Kind regards,Jan Willem Flamma From: Wolfgang SchusterSent: Friday, 4 September 2020 16:26To: mailing list for ConTeXt usersSubject: Re: [NTG-context] Typing efficiency Taco Hoekwater schrieb am 04.09.2020 um 15:51:> > Hi,> > Sounds like a job for the blocks mechanism more so than buffers:> > > \defineblock[entext]> \defineblock[nltext]>    > \defineselector [language] [max=2,n=1]> \startmode[en]>  \setupselector[language][n=1]>  \keepblocks[entext]> \stopmode> \startmode[nl]>  \setupselector[language][n=2]>  \keepblocks[nltext]> \stopmode>   > \starttext>   > \startsection[title=\select{language}{English title}{Dutch title}]>   > \beginentext>  This is English text.> \endentext> \beginnltext>  This is Dutch text.> \endnltext>   > \stopsection>   > \stoptext  It can also be done with buffers. \definebuffer [entext]\definebuffer [nltext] \defineselector [language] [max=2,n=1] \startmode[en] \setupselector[language][n=1] \def\stopentext{\getentext}\stopmode \startmode[nl] \setupselector[language][n=2] \def\stopnltext{\getnltext}\stopmode \starttext \startsection[title=\select{language}{English title}{Dutch title}] \startentext This is English text.\stopentext\startnltext This is Dutch text.\stopnltext \stopsection \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-contextwebpage  : http://www.pragma-ade.nl / http://context.aanhet.netarchive  : 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] styling individual parts of ToC entry

2020-09-06 Thread Wolfgang Schuster

jbf schrieb am 06.09.2020 um 02:03:
Thanks Wolfgang, while I don't pretend to fully understand the setup you 
have provided (but am working on doing so!), of course it provides the 
correct result for a chapter that has a title, an author, and a year.


My ever-so-complicated book (and its authors!) however, throws one small 
further complication into the mix.


Where a chapter does not have a year-range, and I either omit that 
declaration, or I leave the curly brackets empty (e.g. year={}), then I 
find that the author name also does not appear in the ToC. What 
adjustment to the \ChapterListCommand do I need to make to accommodate 
the following? Possibly an \else statement, but not sure how to include 
that:


\startchapter [title={Chapter title}] [author={Author Name}]


I forgot to change the argument for the check off the author entry, this 
should fix it.


\define[3]\ChapterListCommand
  {\hbox\bgroup
 \hbox to 3cm{\currentlistsymbol\hss}% number + labeltext
 \vtop\bgroup
   \hsize\dimexpr\makeupwidth-3cm\relax
   \doifsomething{\rawstructurelistuservariable{year}}
 {{\it\structurelistuservariable{year}}\crlf}%
   \currentlistentrytitle % title
   \doifsomething{\rawstructurelistuservariable{author}}
 {\crlf{\bf\structurelistuservariable{author}}}%
   \hfill\currentlistentrypagenumber % pagenumber
 \egroup
   \egroup}

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
___