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

2020-09-07 Thread jbf




 Forwarded Message 
Subject:Re: [NTG-context] styling individual parts of ToC entry
Date:   Tue, 8 Sep 2020 12:39:05 +1000
From:   jbf 
To: Wolfgang Schuster 



Wolfgang, I have tried an MWE below but I think I am hopelessly lost at 
this point. It is not producing anything like what I want.


But at least let me indicate what I have tried:

(1) I have defined two different 'title' items (Foreword and Preface 
unnumbered) since both of these require an author name of the kind 
produced by the \ChapterListCommand. Do I also need a \TitleListCommand 
for these? The \ChapterListCommand seems to call in a chapter number, 
and I don't want one in the Frontmatter items like foreword and preface. 
I didn't know how to adjust that definition to leave out the number. I 
did try a renamed copy of it, leaving out the line: \hbox to 
3cm{\currentlistsymbol\hss}, but that made no difference.


(2) And since I also need some sections with an author (but the chapter 
they are in has no author), I defined a 'mysection', though I have only 
tried to 'call in' the Foreword so far in the text below, to see if that 
at least worked - but it doesn't.


(3) I also assumed that having defined foreword, preface and mysection, 
they would need to be in a \setupcombinedlist.


(4) And finally, I thought I would then need a \setuplist and 
\setuplabeltext for Foreword (as indeed I might for the other two as 
well, but to start with, I wanted to get one of them working at least).


MWE:

\definehead [foreword] [title]
\definehead [preface] [title]
\definehead [mysection] [section]

\setupcombinedlist[chapter,foreword,preface,mysection,section, subsection]

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

   \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{\bf\structurelistuservariable{author}}}%
   \hfill\currentlistentrypagenumber % pagenumber
 \egroup
   \egroup}

\definehead [foreword] [title]
\definehead [preface] [title]
\definehead [mysection] [section]

\setupcombinedlist[chapter,foreword,preface,mysection,section, subsection]

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

\setuplabeltext
  [en]
  [chapter=Chapter ]

\setuplist
  [foreword]
  [label=foreword,
  alternative=command,
   command=\TitleListCommand]

\setuplabeltext
  [en]
  [title=Foreword ]

\starttext

\completecontent
\starttitle [title={Foreword}] [author={Author Name}]
\unknown
\stoptitle
\startchapter
\startchapter [title={Chapter title}] [author={Author 
Name},year={1980--2000}]

\unknown
\stopchapter

\stoptext

%%%

Let me remind you of what I am trying to achieve. If I can grasp some 
basic principles about this layout, I can experiment further.


Foreword                    A. Uthor     pg 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    "


Julian

On 7/9/20 4:57 pm, Wolfgang Schuster wrote:

\definehead [forward] [chapter]
    \definehead [preface] [chapter] 
___
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] Can't output direct glyphs either in MKIV

2020-09-07 Thread Andres Conrado Montoya
Hi Taco, thanks for the input. Your example works, and produces the glyphs.
Pdf attached, I hope this system allows it (only 36.3 kB). "u101F2" is the
unicode name for the glyph. I would guess, according to what you told me,
that the code point would be "00024", but honestly, I have no idea. This
used to work some months ago.

-- 
Andrés Conrado Montoya
Andi Kú
andresconr...@gmail.com
http://sesentaycuatro.com
http://messier87.com
http://chiquitico.org

Los fines no justifican los medios, porque la medida verdadera de nuestro
carácter está dada por los medios que estamos dispuestos a utilizar, no por
los fines que proclamamos.


“You develop an instant global consciousness, a people orientation, an
intense dissatisfaction with the state of the world, and a compulsion to do
something about it. From out there on the moon, international politics look
so petty. You want to grab a politician by the scruff of the neck and drag
him a quarter of a million miles out and say, ‘Look at that, you son of a
bitch.’” — Apollo 14 astronaut Edgar Mitchell


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


[NTG-context] Column not Balancing, Footnote is Missing

2020-09-07 Thread Art Chimes
Greetings, list. My first post here. Please be gentle!

The command \contextversion reports I am using 2020.09.03 20:03 on Windows 10.

The MWE below produces a column and a half of text, not balanced
(despite the \setupcolumns [...balance=yes...] command. Also, the
footnote *number* appears on the PDF, but the *text* of the footnote
doesn't.

However, when I use the online compiler (live.contextgarden.net,
reported version 2020.06.30 17:30, older than mine), the footnote text
*does* appear, though the columns are still not balanced.

%

\usemodule[ipsum]
\setupfootnotes[location=page,rule=on,bodyfont=8.5pt]
\setupcolumns [n=2,balance=yes,blank=line]

\starttext
\chapter{Footnote Test  —  \contextversion}
\startcolumns

\ipsum

Cursus metus aliquam eleifend mi in nulla posuere sollicitudin
aliquam. Id aliquet risus feugiat in ante metus dictum at
tempor.\footnote{Thor, A.U.: {\it Latin 101 for Dummies} (Rome,
Dummies Pub., MCMLXXIX)}

\ipsum[alternative=lines,n=20]

\end columns
\stoptext

%

Question (1) : Why don't the columns balance, and how can I fix it?
Question (2) : Why does the footnote appear only with the online
compiler? What am I doing wrong?
Question (3) : For extra credit: How can I get the footnotes to
stretch the entire width of the text block instead of the width of one
column?

I did try to parse the somewhat opaque (to me) information in the wiki
and looked in the mailing list archives, but I didn't find the
information I needed.

Thank you for any help you can offer.

Art in Arlington, Virginia, USA.
___
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] About Metapost and patterns, tessellations, fractals, etc.

2020-09-07 Thread Jairo A. del Rio
Hi, list! I have a problem with some graphics in Metapost. I've tried to
replicate the Koch curve cited here using ConTeXt:

https://en.wikipedia.org/wiki/L-system

To my own amusement, the patterns seem to appear. However, when I try with
a number from 6, ConTeXt stops doing anything or output looks wrong (see
attached PDF, please).

\startluacode
userdata = userdata or {}

function userdata.koch(n)

local init = "F"
local base = init
  local replacement = "F+F-F-F+F"

for i = 1, n do
init = init:gsub(base, replacement)
end

return init

end

function userdata.kochlen(n)
return string.len(userdata.koch(n))
end

function userdata.kochchar(k, n)
return string.sub(userdata.koch(n),k,k)
end

function MP.kochlen(n)
mp.print(userdata.kochlen(n))
end

function MP.kochchar(k,n)
mp.quoted(userdata.kochchar(k,n))
end

\stopluacode
\startMPpage[instance=doublefun]

def koch_curve(expr n, u) =

save p; save q;
save angle;

pair p, last; path q; numeric angle;
p:= origin;
q := origin;
angle := 0;

for i = 1 upto lua.MP.kochlen(n):
if lua.MP.kochchar(i,n) = "F":
q := q -- ((point infinity of q) + dir(angle));
else:
if lua.MP.kochchar(i,n) = "+":
angle := (angle + 90) mod 360;
else:
if lua.MP.kochchar(i,n) = "-":
angle := (angle - 90) mod 360;
fi
fi
fi
endfor;
draw q scaled u;
enddef;

koch_curve(5, 5mm);
%koch_curve(6, 5mm); does not give a right output

\stopMPpage

Maybe there's a fabulous trick to make it work with larger numbers, but I
don't know it. I'm aware of a TikZ library for Lindenmayer systems, but
it's not a possibility for me in this case (I add the remark just in case).

Thank you in advance,

Jairo :)


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


Re: [NTG-context] Can't output direct glyphs either in MKIV or LMTX

2020-09-07 Thread Taco Hoekwater
Hi,

> On 7 Sep 2020, at 22:05, Andres Conrado Montoya  
> wrote:
> 
> 
> Hello list. I'm trying to call a direct glyph from the Phaistos font, but it 
> seems it doesn't work. The font is loaded, the log file says it so:
> 
> system  >   12: filename=/home/vantta/.fonts/Phaistos.otf format=otf 
> foundname=/home/vantta/.fonts/Phaistos.otf 
> fullname=/home/vantta/.fonts/Phaistos.otf usedmethod=direct
> 
> However, the glyph is not displayed in the pdf. I've tried both in MKIV and 
> LMTX with no luck. Maybe someone here will have a clue.

I don’t have the font, but is u101F2 the glyphs’ name, or its code point?

Try this:

   \starttext
   \usemodule [fnt-10]
   \ShowCompleteFont{name:phaistos}{14pt}{1}
   \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
___


[NTG-context] Can't output direct glyphs either in MKIV or LMTX

2020-09-07 Thread Andres Conrado Montoya
Hello list. I'm trying to call a direct glyph from the Phaistos font, but
it seems it doesn't work. The font is loaded, the log file says it so:

system  >   12: filename=/home/vantta/.fonts/Phaistos.otf
format=otf foundname=/home/vantta/.fonts/Phaistos.otf
fullname=/home/vantta/.fonts/Phaistos.otf usedmethod=direct

However, the glyph is not displayed in the pdf. I've tried both in MKIV and
LMTX with no luck. Maybe someone here will have a clue.

MWE:
%%
\definesymbol[arbol]
  [\getnamedglyphdirect{phaistos}{u101F2}]

\starttext
\switchtobodyfont[72pt]
\symbol[arbol]
\stoptext
%%%


-- 
Andrés Conrado Montoya
Andi Kú
andresconr...@gmail.com
http://sesentaycuatro.com
http://messier87.com
http://chiquitico.org

Los fines no justifican los medios, porque la medida verdadera de nuestro
carácter está dada por los medios que estamos dispuestos a utilizar, no por
los fines que proclamamos.


“You develop an instant global consciousness, a people orientation, an
intense dissatisfaction with the state of the world, and a compulsion to do
something about it. From out there on the moon, international politics look
so petty. You want to grab a politician by the scruff of the neck and drag
him a quarter of a million miles out and say, ‘Look at that, you son of a
bitch.’” — Apollo 14 astronaut Edgar Mitchell
___
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] Fullwidth topfigure with caption in the margin

2020-09-07 Thread Mikael Sundqvist
Hi,

Is there a way to have a fullwith topfigure with caption in the margin so
that the figure does not interfere with the text? My try is


%%%
\setuplayout[
rightmargin=2in,
rightmargindistance=0.375in,
width=4.125in,
]

\showframe

\definecolor [transparentred] [r=1,t=.5,a=1]

\definefloat[topfigure][topfigures][figure]

\setupfloat[topfigure][
default={margin},
location=flushleft,
maxwidth=6.5in,
]

\setupcaption[topfigure][
number=no,
location=bottom,
style={\switchtobodyfont[8bp]},
]
\starttext
\dorecurse{4}{\samplefile{knuth}}

\startplacetopfigure[title={\samplefile{ward}}]
\blackrule[width=6.5in,height=2in,color=transparentred]
\stopplacetopfigure

\samplefile{knuth}
\stoptext
%%

but, as one can see on page two, the text from the previous page just
continues under the image. I want the "larg-scale user..." to start below
the image. It would be good if it was also possible to configure the
distance between the image and the text.

(I guess one option would be to not use a margin figure, and use
default=top, but then I don't know how to handle the caption.)

/Mikael
___
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] Force bottom float to be at the bottom

2020-09-07 Thread Mikael Sundqvist
Hi,

I'm defining a bottomfigure with default=bottom, but it does not always
seem to work (example below). If the float does not fit on the page, it
appears instead in the top of the next page. Can I force it to be in the
bottom of the next page? That is, can I setup a float that is always at the
bottom of the page? I hope what I ask makes sense.

/Mikael

\useMPlibrary[dum]

\definefloat[bottomfigure][bottomfigures][figure]

\setupfloat[bottomfigure][default=bottom]

\starttext
\dorecurse{4}{\samplefile{knuth}}

\startplacebottomfigure
\externalfigure[dummy][width=\textwidth]
\stopplacebottomfigure

\samplefile{knuth}
\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] styling individual parts of ToC entry

2020-09-07 Thread Wolfgang Schuster

jbf schrieb am 07.09.2020 um 01:31:


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


You need extra headings for the forward and preface

    \definehead [forward] [chapter]
    \definehead [preface] [chapter]

to have full control about their layout.

I can provide you a solution for your problems but you have to create a 
complete minimal example (including forward and preface titles) first.


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
___