Re: [NTG-context] margin in TocEntry definition

2021-03-11 Thread jbf
It works, though I'm happy also to have Wolfgang's very simple version! 
I'm learning a lot! I'm a great believer in Occam's Razor - the law of 
parsimony, so the simpler version is the way to go, and my earlier use 
of a TeX hack (\-\) can be put to rest!


Thanks Bruce and thanks Wolfgang.

Julian

On 12/3/21 11:51 am, Bruce Horrocks wrote:



On 11 Mar 2021, at 22:22, jbf  wrote:

Thanks for trying, Bruce. That earlier question you refer to was for a similar 
situation and the answer resolved that one at the time (it was my question even 
then!) but not the precise one I am facing now.

The problem, you see, is that \startalignment only offers a few key words like 
flushleft, middle etc. and not what I need this time, which is a precise 
indentation feature like .5cm. I suppose my real problem is not being 
sufficiently au fait with how definitions work. I just can't seem to get a 
definition that gives me a result like

Chapter title
author . page number

the \startalignment approach with flushleft would not give me the indentation 
obviously, and middle does not work for what I need, and either of them also 
pushes the page number line down onto the next line, which I don't want. I 
tried \skip .5cm, so:

\define[1]\SectionTocEntry{%
#1\crlf% title
\hskip 
.5cm\doifnot{\structurelistuservariable{author}}{}{\structurelistuservariable{author}}%
}

But the \hskip is ignored at the beginning of a line. I wonder if there is 
something else I can substitute it for?

D'oh! Sorry - completely forgot about the indent.

Best I can come up with at the moment is this - but I'm not sure how to get 
leading dots.

\starttext

\define[3]\SectionToCEntry{
   #2\crlf
   \leftaligned
   \bgroup
 \hskip 0.5cm
 \structurelistuservariable{author}
 \rightaligned
  \bgroup
#3
  \egroup
   \egroup
}

\setuplist
   [chapter]
   [alternative=command,
command=\SectionToCEntry,
after=\endgraf]

\completecontent

\startchapter
   [title={This is my chapter title}]
   [author={Dummy Name}]
\input Tufte
\stopchapter

\stoptext

—
Bruce Horrocks
Hampshire, UK


___
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] margin in TocEntry definition

2021-03-11 Thread Wolfgang Schuster

jbf schrieb am 11.03.2021 um 23:22:
Thanks for trying, Bruce. That earlier question you refer to was for a 
similar situation and the answer resolved that one at the time (it was 
my question even then!) but not the precise one I am facing now.


The problem, you see, is that \startalignment only offers a few key 
words like flushleft, middle etc. and not what I need this time, which 
is a precise indentation feature like .5cm. I suppose my real problem is 
not being sufficiently au fait with how definitions work. I just can't 
seem to get a definition that gives me a result like


Chapter title
    author . page number

the \startalignment approach with flushleft would not give me the 
indentation obviously, and middle does not work for what I need, and 
either of them also pushes the page number line down onto the next line, 
which I don't want. I tried \skip .5cm, so:


\define[1]\SectionTocEntry{%
#1\crlf% title
\hskip 
.5cm\doifnot{\structurelistuservariable{author}}{}{\structurelistuservariable{author}}% 
}


But the \hskip is ignored at the beginning of a line. I wonder if there 
is something else I can substitute it for?


Use \par after the first line (and add \relax after \hskip).

\define[1]}SectionTocEntry
  {#1\par
   \hskip.5cm\relax\doifnot{...}{...}}

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] lmt_outline

2021-03-11 Thread Mohammad Hossein Bateni
Thanks for the pointer, Aditya.  I had not seen this, but I couldn't get it
to do what I wanted.

I don't fully understand what nofill does and how it interacts with fill
and eofill.  I get strange results sometimes.  One complication, though, is
that the picture I get from lmt_outline seems to cover some part (small
area around the joining part) twice, so that messes up the even/odd logic
of eofill.

Here is one of the things I tried:

\starttext
\definedfont[dejavusansmono*arabic]
\setupalign[r2l]
\startMPcode
picture op; op := lmt_outline [
  text = "سلام",
  kind = "fillup",
  align = "r2l",
] scaled 6mm;
for i within op:
  nofill pathpart i;
endfor;
for i within op:
eofill pathpart i withpen pencircle scaled 1mm;
endfor;
\stopMPcode
\stoptext


On Wed, Mar 10, 2021 at 11:09 PM Aditya Mahajan  wrote:

> On Wed, 10 Mar 2021, Mohammad Hossein Bateni wrote:
>
> > Hello,
> >
> > Hans said he's in the metapost mode now :)
> >
> > I have used lmt_outline in the following example and it is really an
> > improvement over the previous outline "effect" because one can set the
> > fillcolor and drawcolor separately.  (that was not possible before,
> right?)
> >
> > \starttext
> > \definedfont[dejavusansmono*arabic]
> > \setupalign[r2l]
> > \startMPcode
> > draw lmt_outline [
> >   text = "سلام",
> >   drawcolor = "red",
> >   fillcolor = "white",
> >   kind = "reverse",
> >   align = "r2l",
> > ] scaled 3mm;
> > \stopMPcode
> > \stoptext
> >
> > 1. This works well on a plain background.  I can specify the background
> > color in fillcolor and get the outline effect.  When the background is an
> > image, this does not work too well.  Can we use some clip trickery to
> allow
> > for "transparent" fill?  Ideally I want to set the fillcolor to a special
> > value that would lead to only the outlines drawn.
>
> Have you seen this example on the wiki which uses nofill:
>
> https://wiki.contextgarden.net/Cover_Pages#Empty_or_Transparent_letters
>
>
> Aditya___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
>
> ___
>
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


Re: [NTG-context] margin in TocEntry definition

2021-03-11 Thread Bruce Horrocks


> On 11 Mar 2021, at 22:22, jbf  wrote:
> 
> Thanks for trying, Bruce. That earlier question you refer to was for a 
> similar situation and the answer resolved that one at the time (it was my 
> question even then!) but not the precise one I am facing now.
> 
> The problem, you see, is that \startalignment only offers a few key words 
> like flushleft, middle etc. and not what I need this time, which is a precise 
> indentation feature like .5cm. I suppose my real problem is not being 
> sufficiently au fait with how definitions work. I just can't seem to get a 
> definition that gives me a result like
> 
> Chapter title
>author . page number
> 
> the \startalignment approach with flushleft would not give me the indentation 
> obviously, and middle does not work for what I need, and either of them also 
> pushes the page number line down onto the next line, which I don't want. I 
> tried \skip .5cm, so:
> 
> \define[1]\SectionTocEntry{%
> #1\crlf% title
> \hskip 
> .5cm\doifnot{\structurelistuservariable{author}}{}{\structurelistuservariable{author}}%
> }
> 
> But the \hskip is ignored at the beginning of a line. I wonder if there is 
> something else I can substitute it for?

D'oh! Sorry - completely forgot about the indent.

Best I can come up with at the moment is this - but I'm not sure how to get 
leading dots.

\starttext

\define[3]\SectionToCEntry{
  #2\crlf
  \leftaligned
  \bgroup
\hskip 0.5cm
\structurelistuservariable{author}
\rightaligned
 \bgroup
   #3
 \egroup
  \egroup
}

\setuplist
  [chapter]
  [alternative=command,
   command=\SectionToCEntry,
   after=\endgraf]

\completecontent

\startchapter
  [title={This is my chapter title}]
  [author={Dummy Name}]
\input Tufte
\stopchapter

\stoptext

—
Bruce Horrocks
Hampshire, UK

___
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] margin in TocEntry definition

2021-03-11 Thread jbf

Re: indented line in TocEntry definition:

I have come up with what is probably an inelegant solution (using \-\ so 
that \hskip is recognised at the beginning of a line), but it works! 
Maybe someone could suggest how to make it more elegant, but for the 
moment, it's all I need!


\define[1]\SectionTocEntry{%
#1\crlf% title
\-\ \hskip 
.5cm\doifnot{\structurelistuservariable{author}}{}{\structurelistuservariable{author}}%

}

Julian

On 12/3/21 9:04 am, Bruce Horrocks wrote:

On 11 Mar 2021, at 02:20, jbf  wrote:

Hi list,

I have:

\define[1]\SectionTocEntry{%
#1\crlf% title
\doifnot{\structurelistuservariable{author}}{}{\structurelistuservariable{author}}%
   }

which successfully gives me a ToC with:

Chapter title
Author name

But I want the author name indented by .5cm and do not know how to use 'margin' 
in the above definition, or some other way of getting the indentation. I have 
tried various versions of 'margin' before the \doifnot part of the definition, 
but to no avail.

There is a very similar previous question that might be what you are looking 
for.


Try that but use 'flushleft' instead of 'middle'.

—
Bruce Horrocks
Hampshire, UK

___
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] margin in TocEntry definition

2021-03-11 Thread jbf
Thanks for trying, Bruce. That earlier question you refer to was for a 
similar situation and the answer resolved that one at the time (it was 
my question even then!) but not the precise one I am facing now.


The problem, you see, is that \startalignment only offers a few key 
words like flushleft, middle etc. and not what I need this time, which 
is a precise indentation feature like .5cm. I suppose my real problem is 
not being sufficiently au fait with how definitions work. I just can't 
seem to get a definition that gives me a result like


Chapter title
   author . page number

the \startalignment approach with flushleft would not give me the 
indentation obviously, and middle does not work for what I need, and 
either of them also pushes the page number line down onto the next line, 
which I don't want. I tried \skip .5cm, so:


\define[1]\SectionTocEntry{%
#1\crlf% title
\hskip 
.5cm\doifnot{\structurelistuservariable{author}}{}{\structurelistuservariable{author}}%

}

But the \hskip is ignored at the beginning of a line. I wonder if there 
is something else I can substitute it for?


Julian


On 12/3/21 9:04 am, Bruce Horrocks wrote:

On 11 Mar 2021, at 02:20, jbf  wrote:

Hi list,

I have:

\define[1]\SectionTocEntry{%
#1\crlf% title
\doifnot{\structurelistuservariable{author}}{}{\structurelistuservariable{author}}%
   }

which successfully gives me a ToC with:

Chapter title
Author name

But I want the author name indented by .5cm and do not know how to use 'margin' 
in the above definition, or some other way of getting the indentation. I have 
tried various versions of 'margin' before the \doifnot part of the definition, 
but to no avail.

There is a very similar previous question that might be what you are looking 
for.


Try that but use 'flushleft' instead of 'middle'.

—
Bruce Horrocks
Hampshire, UK

___
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] margin in TocEntry definition

2021-03-11 Thread Bruce Horrocks

> On 11 Mar 2021, at 02:20, jbf  wrote:
> 
> Hi list,
> 
> I have:
> 
> \define[1]\SectionTocEntry{%
> #1\crlf% title
> \doifnot{\structurelistuservariable{author}}{}{\structurelistuservariable{author}}%
>   }
> 
> which successfully gives me a ToC with:
> 
> Chapter title
> Author name
> 
> But I want the author name indented by .5cm and do not know how to use 
> 'margin' in the above definition, or some other way of getting the 
> indentation. I have tried various versions of 'margin' before the \doifnot 
> part of the definition, but to no avail.

There is a very similar previous question that might be what you are looking 
for.


Try that but use 'flushleft' instead of 'middle'.

—
Bruce Horrocks
Hampshire, UK

___
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] Problem creating format file after downloading current version: 2021.03.09 11:42

2021-03-11 Thread Willi Egger
Hello,

todau I decided to upgrade my ConTeXt LMTX installation.
However I get troubles and can not make a format file due to a fatal error. 
Please see cont-en-error.log

Kind regards

Willi

cont-en-error.log
Description: Binary data
___
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] issue with \in and \xmlrefatt

2021-03-11 Thread Pablo Rodriguez
Hans,

after the fix in current latest (2021.03.09 11:42), I get the following
error when using \in[\xmlrefatt{#1}{href}] in Windows (Linux has no
problems).

The error message reads:

fatal lua error:
run callback [6]: bad argument #2 to 'format' (number expected, got nil)
stack traceback:
[C]: in function 'string.format'
?: in field '?'
...ext/tex/texmf-context/tex/context/base/mkxl/luat-log.lmt:178: in
upvalue 'report'
...ext/tex/texmf-context/tex/context/base/mkxl/luat-log.lmt:391: in
upvalue 'report'
[string "
mtx-context | fatal error: return code: 1

I cannot provide a minimal sample and I wonder whether this could be
enough to find out what is missing.

Many thanks for your help,

Pablo
--
http://www.ousia.tk
___
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] Escaping reserved/problematic characters

2021-03-11 Thread Wolfgang Schuster

Benct Philip Jonsson schrieb am 11.03.2021 um 18:37:
In a program I'm writing I have a function for escaping characters which 
are reserved or problematic in LaTeX. I would like to have a 
corresponding function for ConTeXt, so I'm wondering which ones are 
different/superfluous/missing from a ConTeXt perspective in the 
following list (sorry about the formatting!):


     '{': "\\{"


\letterleftbrace


     '}': "\\}"


\letterrightbrace


     '_': "\\_"


No escape needed.


     '%': "\\%"


\letterpercent


     '#': "\\#"


\letterhash


     '$': "\\$"


\letterdollar


     '&': "\\&"


No escape needed.


     '`': "\\textasciigrave{}"


\textgrave


     '^': "\\textasciicircum{}"


\letterhat


     '~': "\\textasciitilde{}"


\lettertilde


     '\\': "\\textbackslash{}"


\letterbackslash


     '|': "\\textbar{}"


\letterbar


     '<': "\\textless{}"
     '>': "\\textgreater{}"
     '[': '{[}'
     ']': '{]}'


No escape needed.

Note that I'm not looking for accented letters, Unicode quotes and 
dashes etc. I'm assuming that people in the year 2021 are using an 
UTF-8-aware engine (and my corresponding HTML escape function similarly 
caters only to & < > " ').


Another option is to use \utfchar, e.g. \utfchar{0x60}

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] Escaping reserved/problematic characters

2021-03-11 Thread Benct Philip Jonsson
In a program I'm writing I have a function for escaping characters which
are reserved or problematic in LaTeX. I would like to have a corresponding
function for ConTeXt, so I'm wondering which ones are
different/superfluous/missing from a ConTeXt perspective in the following
list (sorry about the formatting!):

'{': "\\{"
'}': "\\}"
'_': "\\_"
'%': "\\%"
'#': "\\#"
'$': "\\$"
'&': "\\&"
'`': "\\textasciigrave{}"
'^': "\\textasciicircum{}"
'~': "\\textasciitilde{}"
'\\': "\\textbackslash{}"
'|': "\\textbar{}"
'<': "\\textless{}"
'>': "\\textgreater{}"
'[': '{[}'
']': '{]}'

Note that I'm not looking for accented letters, Unicode quotes and dashes
etc. I'm assuming that people in the year 2021 are using an UTF-8-aware
engine (and my corresponding HTML escape function similarly caters only to
& < > " ').

TIA,

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