[NTG-context] getting number from context.figurewidth

2021-10-26 Thread Pablo Rodriguez via ntg-context
Dear list,

I have the following sample:

  \starttext
  \startluacode
document.sample = "xml-mkiv.pdf"
context.getfiguredimensions({ document.sample })
context(context.figureheight)
context.par()
context(tex.dimen.paperheight)
  \stopluacode
  \stoptext

Is there a way that I can get a number from context.figureheight, such
as I get it from tex.dimen.paperheight?

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] [Solved] Line breaks, \wordright and hyphenation

2021-10-26 Thread kauśika cittūr via ntg-context
On Monday, October 25, 2021 7:34:06 AM IST kauśika cittūr wrote:
> On Sunday, October 24, 2021 7:42:59 AM IST kauśika cittūr wrote:
> > Dear list,
> > 
> > In short, my question is: why does \wordright cause a line-break when the
> > line preceding it breaks with hyphenation and does not otherwise? How to
> > avoid it (if at all possible)?
> > 
> > I have this delimitedtext instance called 'amnata' defined as below:
> > 
> > \definemeasure[amnatamargin][3cm]
> > \definedelimitedtext
> > 
> >   [amnata]
> > 
> > \setupdelimitedtext
> > 
> >   [amnata]
> >   [
> > 
> > left=,
> > right=,
> > leftmargin={\measure{amnatamargin}},
> > rightmargin={\measure{amnatamargin}},
> > 
> >   ]
> > 
> > I am using this to quote paragraph(s) of other authors.
> > Since, I also want to indicate where the quote is from, I use this as
> > follows:
> > 
> > \startamnata
> > 
> >   ⋮
> > 
> > \wordright{author}
> > \stopamnata
> > 
> > so that the author's name appears at the right-edge of the block.
> > 
> > When the penultimate line inside the block breaks without hyphenation,
> > then
> > argument of \wordright is typeset as expected (i.e. in the same line).
> > 
> > On the other hand, when the penultimate line inside this block breaks with
> > hyphenation, the argument of \wordright is pushed to the next line even
> > when there is enough space for it on the same line.
> > 
> > Here is a sample illustrating this:
> > 
> > \startamnata
> > A quote from another author : Suppose that thereisalongwordhere.
> > \wordright{– author}
> > \stopamnata
> > 
> > \startamnata
> > A quote from another author : Here, the text does not cause
> > hyphenation in the first line.
> > \wordright{– author}
> > \stopamnata
> > 
> > [I have attached the output here as an image]
> > 
> > How do I ensure that this does not happen, if that is possible at all? I
> > suppose this is expected behaviour but I am not able to understand why.
> > 
> > Thanks,
> > kauśika
> 
> Dear list,
> 
> Although, not a fix for the issue, here is a workaround that allowed me to
> achieve what I wanted:
> 
> \definedescription[amnata]
> \setupdescription[amnata]
>   [closesymbol={​},
>closecommand=\wordright,
>before=\startamnatanarrower,
>after=\stopamnatanarrower]
> 
> \startamnata
> A quote from another author : Suppose that thereisalongwordhere.
> \wordright{– author}
> \stopamnata
> 
> With this the argument of \wordright appears correctly at the right-edge of
> the block. Note that this does not work (as expected) when closesymbol is
> not set (or, is empty). Therefore, here I have set closesymbol={​​U+200B},
> which is the zero width space.
> 
> Thanks,
> kauśika

Dear list,

As it turns out, my workaround here is subpar since it inserts an undesired 
line after the description block.

Hans was very kind to send me a fix to place in cont-new.mkxl that fixes the 
issue. However, due to my errors in properly pasting the fix correctly, it did 
not work. I updated LMTX today and the fix is already merged.

I am pasting below Hans' fix for reference (for anyone who might come across 
this later) –

\protect
\protected\def\spac_word_right_indeed#1#2%
  {\registerparwrapper
 {\v!word:\v!right}
 {\begingroup
  \frozen\parfillskip\zeropoint
  \frozen\finalhyphendemerits\zerocount
  \endgroup}
 {\doifelseparwrapper{\v!word:\v!right}{\unregisterparwrapper{\v!word:\v!
right}}\donothing
  \removeunwantedspaces
  \doifelse{#1}\v!right{\kern-\rightskip}{\doifsomething{#1}{\kern-#1}}%
  \hfilll
  \discretionary{\strut}{\strut}{\strut}% \allowbreak % changed back from 
\hskip\zeropoint
  \hfilll
  \quad % decent spacing
  #2}}
\unprotect

kauśika


___
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] Romanization of ancient greek

2021-10-26 Thread Marcus Vinicius Mesquita via ntg-context
Thank you, Jairo. It helped, the hack worked for what I needed. I'll mail
Philipp and ask him to fix the module.

Best regards

Marcus Vinicius

On Tue, Oct 26, 2021 at 7:25 AM Jairo A. del Rio 
wrote:

> Ugly hack: add this before loading transliterator:
>
> \startluacode
> unicode = unicode and unicode or _G
> \stopluacode
>
> I get the following output:
>
> kakon anagkē, all' udemia anagkē zēn meta anagkēs
>
> I hope this helps. I also think you should mail Philipp so that he fixes
> it (the Lua code looks pretty old).
>
> Cordially,
>
> Jairo
>
> El mar, 26 de oct. de 2021 a la(s) 05:08, Marcus Vinicius Mesquita via
> ntg-context (ntg-context@ntg.nl) escribió:
>
>> I tried the MWE example below with the transliterator module, but context
>> throws an error:
>> token call, execute:
>> ...ules/tex/context/third/transliterator/transliterator.lua:20: attempt to
>> index a nil value (global 'unicode')
>>
>> \usemodule[transliterator]
>> \starttext
>> \transliterate[mode=gr]{κακὸν ἀνάγκη, ἀλλ' οὐδεμία ἀνάγκη ζῆν μετὰ
>> ἀνάγκης}
>> \stoptext
>>
>> I'm using context current version: 2021.10.24 21:45
>> Marcus Vinicius
>>
>>
>>
>>
>> On Tue, Oct 26, 2021 at 5:13 AM Marcus Vinicius Mesquita <
>> marcusvinicius.mesqu...@gmail.com> wrote:
>>
>>> Thank you, Wolfgang. I'll look into it.
>>>
>>> Regards
>>>
>>> Marcus Vinicius
>>>
>>> On Tue, Oct 26, 2021 at 1:22 AM Wolfgang Schuster <
>>> wolfgang.schuster.li...@gmail.com> wrote:
>>>
 Marcus Vinicius Mesquita via ntg-context schrieb am 26.10.2021 um 00:38:
 > Dear list,
 >
 > Is there anything in ConTeXt that could help me with automatic
 > romanization of ancient greek words?

 Is the Transliterator module from Philipp Gesang what you're looking
 for?


 https://modules.contextgarden.net/cgi-bin/module.cgi/ruid=5025059042/action=view/id=50

 Wolfgang


>>>
>>> --
>>> Todas as coisas fatigam o corpo, salvo a música, que não fatiga nem o
>>> corpo nem seus membros, por ser descanso da alma, primavera do coração,
>>> distração do aflito, entretenimento do solitário, e viático do viajante.
>>>
>>> Kunnâsh al-Hâ'ik (Cancioneiro de al-Hâ'ik)
>>>
>>
>>
>> --
>> Todas as coisas fatigam o corpo, salvo a música, que não fatiga nem o
>> corpo nem seus membros, por ser descanso da alma, primavera do coração,
>> distração do aflito, entretenimento do solitário, e viático do viajante.
>>
>> Kunnâsh al-Hâ'ik (Cancioneiro de al-Hâ'ik)
>>
>> ___
>> 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
>>
>> ___
>>
>

-- 
Todas as coisas fatigam o corpo, salvo a música, que não fatiga nem o corpo
nem seus membros, por ser descanso da alma, primavera do coração, distração
do aflito, entretenimento do solitário, e viático do viajante.

Kunnâsh al-Hâ'ik (Cancioneiro de al-Hâ'ik)
___
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] Solved: Book setup with LHS-side quotes before chapters/parts, header/footer issues, TOC, etc.

2021-10-26 Thread Gerben Wierda via ntg-context
Thanks to Wolfgang Schuster and Bruce Horrocks I have now a working solution. I 
ended up following Bruce’s suggestion of doing a left hand side (LHS) page 
opposite the first (RHS) chapter or part page differently than using 
after/before modifications of the \chapter and \part setups as I had been doing 
years ago (but that book did not have parts and was done in mkii)

The modification of \chapter and \part setups with before= and after= never 
worked in the \component setup in LMTX. Creating a separate command to run 
immediately before a \chapter or \part, as suggested by Bruce, was simpler and 
and turned out to be more robust. So, this single file example also works when 
\components are used.

The only issues I have now left are very minimal. In the table of contents, the 
abstract for a part has some extra whitespace above, which the chapter 
abstracts don’t have. But that is not really a problem. And getting the part 
title somewhere more centred on its page is also left as an issue for later.

Example file. In a project/component setup: everything before the \starttext 
goes into the environment file, the rest in the product file.

%%%
%%% Sections that have a LHS preface with a quote
%%%

\startsetups SectionLHSPageSetup
 \page[left]
 \setupheader[state=empty]
 \start
\startalignment[left,nothyphenated]
\startnarrower[4*left]
\tf\it
\stopsetups

\definestartstop [SectionLHSPage]
 [ before={\setups{SectionLHSPageSetup}},
   after={\stopnarrower
\stopalignment\stop}]

\define[1]\SectionPrequote{\startSectionLHSPage #1\stopSectionLHSPage}

%%%
%%% part is managed here
%%%
\defineconversionset [part] [Romannumerals] [numbers]
\setuplabeltext[en][partlabel=Part~]

\setuphead [part]
  [sectionsegments=part,
   bodypartlabel=partlabel,
   appendixlabel=,
   sectionconversionset=part,
   page=yes,
   header=empty,
   footer=empty,
   placehead=yes]

\definelist[parttext]
\setuplist[parttext][margin=1.3em,pagecommand=\gobbleoneargument]
\define[1]\PartAbstract{\writetolist[parttext]{}{\start\itx#1\stop}}

%%%
%%% chapter is managed here
%%%
\definetext
  [chapterfooter] % name
  [footer]% vertical location
  [pagenumber]% content

\setuplabeltext[en][appendixchapterlabel=Appendix~]
\setuphead
  [chapter]
  [page=yes,
   header=empty,
   bodypartlabel=,
   appendixlabel=appendixchapterlabel,
   footer=chapterfooter,
   sectionsegments=chapter,
   before={\blank[force,2*big]},
   after={\blank[3*big]}]

\definelist[chaptertext]
\setuplist[chaptertext][margin=1.3em,pagecommand=\gobbleoneargument]
\define[1]\ChapterAbstract{\writetolist[chaptertext]{}{\start\itx#1\stop}}

\defineresetset [default] [0,0] [1]
\setupcombinedlist [content] [list={part,parttext,chapter,chaptertext}]

\starttext

\startfrontmatter
\completecontent
\SectionPrequote{If you think good architecture is expensive, try bad 
architecture\crlf
{\tf Brian Foote and Joseph Yoder}}
\startchapter[title={One}]
\dorecurse{7}{\input tufte \par \input knuth}
\stopchapter
\stopfrontmatter

\startbodymatter
\dorecurse{3}{
  \SectionPrequote{The world is not \rationals, it is \reals\crlf {\tf Gerben 
Wierda}}
  \part{Title title title}
  \PartAbstract{This is a part abstract.}
  \dorecurse{2}{
\SectionPrequote{If you think good architecture is expensive, try
bad architecture\crlf
{\tf Brian Foote and Joseph Yoder}}
\startchapter[title={Two}]
\ChapterAbstract{This is a chapter abstract.}
\dorecurse{5}{\input tufte \par \input knuth}
\stopchapter
  }
}
\stopbodymatter
\startappendices
  \defineresetset[default][0,1][1] %% reset , chapter, but not part
  \setuphead[part][number=no]
  \SectionPrequote{The world is not \rationals, it is \reals\crlf {\tf Gerben 
Wierda}}
  \part{Title title title}
  \PartAbstract{This is a part abstract.}
  \dorecurse{2}{
\SectionPrequote{If you think good architecture is expensive, try
bad architecture\crlf
{\tf Brian Foote and Joseph Yoder}}
\startchapter[title={Two}]
\ChapterAbstract{This is a chapter abstract.}
\dorecurse{5}{\input tufte \par \input knuth}
\stopchapter
  }
\stopappendices
\stoptext

In a component setup, a part component may look like this:

\startcomponent p_partone
\product prd_book
\project project_book

\SectionPrequote{The world is not \rationals, it is \reals\crlf
{\tf Gerben Wierda}}
\part{Title title title}
\PartAbstract{This is a part abstract for a normal part.}
\component c_chapter
\component c_chapter
\stopcomponent

and a chapter component like this:

\startcomponent c_chapter
\product prd_book
\project project_book

\starttext

\SectionPrequote{If you think good architecture is expensive, try bad 
architecture\crlf
{\tf Brian Foote and Joseph Yoder}}
\chapter{An Inconvenient Truth}
\ChapterAbstract{This is a chapter abstract.}

\setupindenting[next]
\placeinitial I{\kap{\bf n the half}} century or so that human kind has had IT,
the IT sector has increasingly wrestled with the fact that IT projects often
fail in one w

Re: [NTG-context] Romanization of ancient greek

2021-10-26 Thread Jairo A. del Rio via ntg-context
Ugly hack: add this before loading transliterator:

\startluacode
unicode = unicode and unicode or _G
\stopluacode

I get the following output:

kakon anagkē, all' udemia anagkē zēn meta anagkēs

I hope this helps. I also think you should mail Philipp so that he fixes it
(the Lua code looks pretty old).

Cordially,

Jairo

El mar, 26 de oct. de 2021 a la(s) 05:08, Marcus Vinicius Mesquita via
ntg-context (ntg-context@ntg.nl) escribió:

> I tried the MWE example below with the transliterator module, but context
> throws an error:
> token call, execute:
> ...ules/tex/context/third/transliterator/transliterator.lua:20: attempt to
> index a nil value (global 'unicode')
>
> \usemodule[transliterator]
> \starttext
> \transliterate[mode=gr]{κακὸν ἀνάγκη, ἀλλ' οὐδεμία ἀνάγκη ζῆν μετὰ ἀνάγκης}
> \stoptext
>
> I'm using context current version: 2021.10.24 21:45
> Marcus Vinicius
>
>
>
>
> On Tue, Oct 26, 2021 at 5:13 AM Marcus Vinicius Mesquita <
> marcusvinicius.mesqu...@gmail.com> wrote:
>
>> Thank you, Wolfgang. I'll look into it.
>>
>> Regards
>>
>> Marcus Vinicius
>>
>> On Tue, Oct 26, 2021 at 1:22 AM Wolfgang Schuster <
>> wolfgang.schuster.li...@gmail.com> wrote:
>>
>>> Marcus Vinicius Mesquita via ntg-context schrieb am 26.10.2021 um 00:38:
>>> > Dear list,
>>> >
>>> > Is there anything in ConTeXt that could help me with automatic
>>> > romanization of ancient greek words?
>>>
>>> Is the Transliterator module from Philipp Gesang what you're looking for?
>>>
>>>
>>> https://modules.contextgarden.net/cgi-bin/module.cgi/ruid=5025059042/action=view/id=50
>>>
>>> Wolfgang
>>>
>>>
>>
>> --
>> Todas as coisas fatigam o corpo, salvo a música, que não fatiga nem o
>> corpo nem seus membros, por ser descanso da alma, primavera do coração,
>> distração do aflito, entretenimento do solitário, e viático do viajante.
>>
>> Kunnâsh al-Hâ'ik (Cancioneiro de al-Hâ'ik)
>>
>
>
> --
> Todas as coisas fatigam o corpo, salvo a música, que não fatiga nem o
> corpo nem seus membros, por ser descanso da alma, primavera do coração,
> distração do aflito, entretenimento do solitário, e viático do viajante.
>
> Kunnâsh al-Hâ'ik (Cancioneiro de al-Hâ'ik)
>
> ___
> 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] Romanization of ancient greek

2021-10-26 Thread Marcus Vinicius Mesquita via ntg-context
I tried the MWE example below with the transliterator module, but context
throws an error:
token call, execute:
...ules/tex/context/third/transliterator/transliterator.lua:20: attempt to
index a nil value (global 'unicode')

\usemodule[transliterator]
\starttext
\transliterate[mode=gr]{κακὸν ἀνάγκη, ἀλλ' οὐδεμία ἀνάγκη ζῆν μετὰ ἀνάγκης}
\stoptext

I'm using context current version: 2021.10.24 21:45
Marcus Vinicius




On Tue, Oct 26, 2021 at 5:13 AM Marcus Vinicius Mesquita <
marcusvinicius.mesqu...@gmail.com> wrote:

> Thank you, Wolfgang. I'll look into it.
>
> Regards
>
> Marcus Vinicius
>
> On Tue, Oct 26, 2021 at 1:22 AM Wolfgang Schuster <
> wolfgang.schuster.li...@gmail.com> wrote:
>
>> Marcus Vinicius Mesquita via ntg-context schrieb am 26.10.2021 um 00:38:
>> > Dear list,
>> >
>> > Is there anything in ConTeXt that could help me with automatic
>> > romanization of ancient greek words?
>>
>> Is the Transliterator module from Philipp Gesang what you're looking for?
>>
>>
>> https://modules.contextgarden.net/cgi-bin/module.cgi/ruid=5025059042/action=view/id=50
>>
>> Wolfgang
>>
>>
>
> --
> Todas as coisas fatigam o corpo, salvo a música, que não fatiga nem o
> corpo nem seus membros, por ser descanso da alma, primavera do coração,
> distração do aflito, entretenimento do solitário, e viático do viajante.
>
> Kunnâsh al-Hâ'ik (Cancioneiro de al-Hâ'ik)
>


-- 
Todas as coisas fatigam o corpo, salvo a música, que não fatiga nem o corpo
nem seus membros, por ser descanso da alma, primavera do coração, distração
do aflito, entretenimento do solitário, e viático do viajante.

Kunnâsh al-Hâ'ik (Cancioneiro de al-Hâ'ik)
___
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] Romanization of ancient greek

2021-10-26 Thread Marcus Vinicius Mesquita via ntg-context
Thank you, Wolfgang. I'll look into it.

Regards

Marcus Vinicius

On Tue, Oct 26, 2021 at 1:22 AM Wolfgang Schuster <
wolfgang.schuster.li...@gmail.com> wrote:

> Marcus Vinicius Mesquita via ntg-context schrieb am 26.10.2021 um 00:38:
> > Dear list,
> >
> > Is there anything in ConTeXt that could help me with automatic
> > romanization of ancient greek words?
>
> Is the Transliterator module from Philipp Gesang what you're looking for?
>
>
> https://modules.contextgarden.net/cgi-bin/module.cgi/ruid=5025059042/action=view/id=50
>
> Wolfgang
>
>

-- 
Todas as coisas fatigam o corpo, salvo a música, que não fatiga nem o corpo
nem seus membros, por ser descanso da alma, primavera do coração, distração
do aflito, entretenimento do solitário, e viático do viajante.

Kunnâsh al-Hâ'ik (Cancioneiro de al-Hâ'ik)
___
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
___