[NTG-context] \goto works but links don't when passed via textext() in METAPOST

2020-05-10 Thread Gerben Wierda
I am trying to get an URL link in a textext() via METAPOST. I’ve got this 
before \starttext (or after, tried both):

\setupinteraction
   [state=start,
color=blue,
style=bold]

The intended link shows up in blue and bold, but it is not clickable.

I’ve turned ConTeXt tracing on and see this when the text is passed to METAPOST:

cld > tex > f : 8 : picture pic; x:=1233.000; y:=913.000; 
w:=180.000; h:=407.000;pic := Label( w, h, (1.000,1.000,0.784), 1.0, 1.000, 
(0.000,0.000,0.000), 1.000, "dashed evenly", 1.000, (0.000,0.000,0.000), 1.000, 
"", "\definebodyfont[11pt][rm][default=Regular at 
11pt]\switchtobodyfont[11pt]\setupinterlinespace[12.1pt]\framed[align=flushleft,frame=off,offset=none,width=170.000bp]{\colored[r=0.000,
 g=0.000, b=0.000]{\tf The elements are shown in colors where blue represents 
active structure, yellow behaviour, and green passive structure. See 
\goto{here}[url(https://ea.rna.nl/2011/06/05/on-the-use-of-colours-in-archimate/)].\crlf{}\crlf{}
  {\bf Color codes:}\crlf{}\crlf{}  - \colored[mared]{\bf Red}{} and 
\colored[maviolet]{\bf Violet}{} stand for a 'higher' layer element used as an 
abstract representation of a lower layer element. When the target is the 
Business Layer, it implies automated business behavior (marked 
violet).\crlf{}\crlf{}  - \colored[maorange]{\bf Orange}{} and 
\colored[mablue]{\bf Blue}{} are used to model 'downward' serving, e.g. 
Business Layer serving the Technology Layer.\crlf{}\crlf{}  - 
\colored[magreen]{\bf Green}{} stands for class relations inside the metamodel. 
Important conseqence: relations of a parent (in the meta-model) Specialization 
are valid for {\it all} children (in the meta-model). This does not happen when 
Specialization is used in an actual model. There are in fact two fully 
different specializations in ArchiMate (see the book, including the free 
excerpt, for a full explanation)\\}}", "up", "center", "center") shifted (x, 
-y);draw pic;path AllPathIds_idCDCEH;  AllPathIds_idCDCEH := pathpart pic; pair 
AllNodeCenters_idCDCEH; AllNodeCenters_idCDCEH := center pic;

The red is what is being typeset, the \goto is part of that.

And later this when METAPOST passes it on to TeX via textext(): 

cld > tex > f : 8 : \definebodyfont [11pt][rm][default=Regular at 
11pt]\switchtobodyfont [11pt]\setupinterlinespace [12.1pt]\framed 
[align=flushleft,frame=off,offset=none,width=170.000bp]{\colored [r=0.000, 
g=0.000, b=0.000]{\tf The elements are shown in colors where blue represents 
active structure, yellow behaviour, and green passive structure. See \goto 
{here}[url(https://ea.rna.nl/2011/06/05/on-the-use-of-colours-in-archimate/)].\crlf
 {}\crlf {} {\bf Color codes:}\crlf {}\crlf {} - \colored [mared]{\bf Red}{} 
and \colored [maviolet]{\bf Violet}{} stand for a 'higher' layer element used 
as an abstract representation of a lower layer element. When the target is the 
Business Layer, it implies automated business behavior (marked violet).\crlf 
{}\crlf {} - \colored [maorange]{\bf Orange}{} and \colored [mablue]{\bf 
Blue}{} are used to model 'downward' serving, e.g. Business Layer serving the 
Technology Layer.\crlf {}\crlf {} - \colored [magreen]{\bf Green}{} stands for 
class relations inside the metamodel. Important conseqence: relations of a 
parent (in the meta-model) Specialization are valid for {\it all} children (in 
the meta-model). This does not happen when Specialization is used in an actual 
model. There are in fact two fully different specializations in ArchiMate (see 
the book, including the free excerpt, for a full explanation)\\}}

Still correct. But the end result doesn’t have a working hyperlink. Outside the 
route to METAPOST, the \goto statement does produce a working link.

Should this work when passed via textext()?

G___
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 page added after pagecolumns

2020-05-10 Thread Thangalin
Bump.

See also: https://tex.stackexchange.com/q/542993/2148

On Mon, May 4, 2020 at 11:46 AM Joey McCollum
 wrote:
>
> After continuing to look into this a bit, I noticed that a similar issue 
> involving the insertion of a blank page after a columnset environment has 
> been discussed on the mailing list in the thread "Blank page inserted when 
> text reaches column's end" (dated 08 Dec 2019). In that thread, a proposed 
> solution was to redefine the \page_grd_stop macro found in page-cst.mkiv as 
> follows:
>
> ```
> \unprotect
> \def\page_grd_stop{%
>   \endgraf % needed, else wrong vsize in one par case
>   \vfill % otherwise weird \placenotes[endnotes]
>   \page_grd_command_set_vsize % needed
>   \penalty\c_page_otr_eject_penalty
>   %\page_grd_command_flush_page
>   \page_otr_fill_and_eject_page
>   \page_grd_command_set_vsize % why here
>   \egroup
>   \page_otr_command_set_vsize
>   \page_otr_command_set_hsize
> }
> \protect
> ```
>
> Unfortunately, this approach was found to have potential issues in that 
> thread, and it does not fix the problem with pagecolumns in my MWE. Are 
> pagecolumns commands aliased to pagegrid commands like columnset commands 
> are, or are they defined somewhere else? I checked page-col.mkiv, but it 
> seems to be too short to be the file that defines pagecolumns behavior.
>
> Joey
>
> On Sat, May 2, 2020 at 11:46 AM Joey McCollum  
> wrote:
>>
>> I recently found the pagecolumns manual 
>> (http://www.pragma-ade.com/general/manuals/pagecolumns.pdf), and in several 
>> of the examples (including those for side floats and footnotes), the 
>> addition of a blank page after the end of the pagecolumns environment also 
>> seems to occur. So when the manual says, "We always start at a new page and 
>> end on a new one," does it mean that this is a feature of pagecolumns? And 
>> if so, is there any way to disable it? I have no problem with a page break 
>> after the end of the pagecolumns environment, but an empty page added after 
>> the break seems unnecessary. I checked for a wiki page on the 
>> \definepagecolumns command to get more information on its accepted inputs, 
>> but there doesn't appear to be a page for this command.
>>
>> Joey
>>
>> On Tue, Apr 28, 2020 at 1:40 PM Joey McCollum  
>> wrote:
>>>
>>> I am typesetting a document using pagecolumns to ensure that my footnotes 
>>> are set ragged-bottom in columns. I have observed some unexpected behavior 
>>> whenever the last column on a page is left incomplete: a blank page is 
>>> added at the end of the document. A minimal working example follows:
>>>
>>> ```
>>>
>>> \starttext
>>>
>>> \startpagecolumns[n=2]
>>>
>>> \dorecurse{3}{\par\input zapf}
>>>
>>> \stoppagecolumns
>>>
>>> \stoptext
>>>
>>> ```
>>>
>>> I typeset this using ConTeXt version 2020.03.10, as released with TeXLive 
>>> 2020. Notably, if \dorecurse{3} is changed to \dorecurse{2} or 
>>> \dorecurse{6} (so that the text ends in the first column of a page), then 
>>> there is no problem. I have tried to fix this by specifying page=no in the 
>>> \startpagecolumns arguments, but it did not change anything. Is there 
>>> something else I am missing?
>>>
>>> Thank you,
>>>
>>> Joey
>
> ___
> 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
___


[NTG-context] Would it be possible in LMTX to do something like variable font/lineheight to fit a fixed frame?

2020-05-10 Thread Gerben Wierda
Suppose I have a fixed sized frame, say 3 y 4 cm. And I have a variable-length 
text.

Would it be possible to write a macro that scaled the font and line height such 
that the text will fit in the frame?

What I have now is very basic:
Fixed width
Typeset (METAPOST textext())
If too high
METAPOST: scale down so it fits in frame

But the scaling wil scale both height and width so it doesn’t only go to the 
correct height, it also gets too narrow. Just scaling in the vertical direction 
squashes the text/font.

What would be great is some way to have the font size and lineheight result 
from TeX trying to fit it inside a predetermined size.

Doesn’t need to be perfect, a good approximation will do. I’ve been thinking 
about using the surface size difference between desired box size and the result 
of textext() as an approach to guess a right fontsize and line height.

What could make it possible for me too is a way to do a typeset command from 
lua that gives me the box sizes of typesetting without actually typesetting it 
to the true output of the job. Something like
typeset a piece of text without actually outputting it to the PDF output in a 
width (say 4)
get the width and height of the result (say 4 x 6)
Adapt front size and lineheight (from 4x6 to 4x3 means a 50% reduction, which 
may be too much as the result may have just a syllable on the last line)
typeset for real in 50% size
Is that doable? Or is there a better way?
 

G___
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] METAPOST subpath rounding issue

2020-05-10 Thread Gerben Wierda

> On 10 May 2020, at 00:01, Bruce Horrocks  wrote:
> 
>> You can save extracting the xparts and yparts by using direct subtraction of 
>> pairs and comparing with (0,0) like this:
> 
> Aaaargh, no, ignore that, it's nonsense. It's amazing how you can stare at 
> something for minutes but only see the flaw the moment you press send. Sorry 
> for the noise.

Instead, I would like to thank you for thinking about it and trying to help. 
Wrestling with it (and making mistakes) is part of all that (I’ve probably made 
more than most).

G

___
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] Retrieving original value of enviroment variable HOME

2020-05-10 Thread context

Hello, Hans,

I've just renewed the Ctx Beta installation, but 'environment.oldhome' 
seems be unavailable.


Was I "too quick" with renewing Ctx?

Testing sample:


\starttext
  Ahoj
  \startluacode
context(environment.oldhome or "??")
  \stopluacode
\stoptext


- prints "??".

I also attache the "status-of-update.lua" and the batch 
"first-setup.bat" (maybe a bit obsolete, but working so far) I used to 
renew Ctx.


Also result of "dir /s" is available here (~84 k packed):

  http://leteckaposta.cz/302654804

What am I doing wrong?

Best regards,

Lukas


On 2020-05-08 14:18, Hans Hagen wrote:


You can check it. Btw, when you're using lmtx there should be no real
differences between for instance unix and windows, although on windows
lmtx does support wide characters in environment variables, command
line arguments, filenames, filelinks etc. (not that that matters much
as one will seldom use more than ascii). Specific environment
variables like HOME are a bit tricky on windows as they come in
variants, so let me know if some more magic is needed.

Hans
\starttext
  Ahoj
  \startluacode
context(environment.oldhome or "??")
  \stopluacode
\stoptext


ChkEnv.pdf
Description: Adobe PDF document
-- generator : luat-sta.lua
-- state tag : whatever

return {
 ["context"]={
  ["version"]="beta",
 },
 ["engines"]={
  ["luatex"]=true,
  ["pdftex"]=true,
  ["xetex"]=true,
 },
 ["formats"]={
  ["cont-en"]=true,
  ["cont-nl"]=true,
  ["metafun"]=true,
 },
 ["info"]={
  ["comment"]="this file contains the settings of the last 'mtxrun --script 
update' run",
  ["count"]=138,
  ["date"]="2020-05-10 11:59:36",
  ["runtime"]=94.039,
  ["version"]=0.1,
 },
 ["modules"]={
  ["all"]=true,
 },
 ["paths"]={
  ["root"]="d:\\Ctx-Beta\\tex",
 },
 ["platforms"]={
  ["mswin"]=true,
  ["win64"]=true,
 },
 ["repositories"]={
  ["current"]=true,
 },
 ["rsync"]={
  ["flags"]={
   ["delete"]="--delete",
   ["normal"]="-rpztlv",
  },
  ["module"]="minimals",
  ["program"]="rsync",
  ["server"]="contextgarden.net::",
 },
}@echo off

setlocal

echo okay > ok.log
ruby -e "File.delete('ok.log')"
if not exist "ok.log" goto okay

echo.
echo You need to install Ruby first (if you want to use pdfTeX or XeTeX).
echo Fetching files anyway.
echo.

:okay


set OWNPATH=%~dp0
set CONTEXTROOT=%OWNPATH%tex

set PATH=%OWNPATH%bin;%CONTEXTROOT%\texmf-mswin\bin;%PATH%

set CYGWIN=nontsec

rsync -av --exclude 'rsync.exe' --exclude 'cygwin1.dll' --exclude 'cygiconv-2.dll' rsync://contextgarden.net/minimals/setup/mswin/bin/ bin

mtxrun --script ./bin/mtx-update.lua --force --update --make --engine=all --context=beta --texroot=%CONTEXTROOT% %*

echo.
echo When you want to use context, you need to initialize the tree with:
echo.
echo   %CONTEXTROOT%\setuptex.bat %CONTEXTROOT%
echo.
echo You can associate this command with a shortcut to the cmd prompt.
echo.

if not exist "ok.log" goto end

echo.
echo If you want to use pdfTeX or XeTeX you need to install Ruby first.
echo Remake formats or rerun this script afterwards.
echo.

del /q ok.log

:end

endlocal

___
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] Retrieving original value of enviroment variable HOME

2020-05-10 Thread Hans Hagen

On 5/10/2020 2:33 PM, cont...@vivaldi.net wrote:

I've just renewed the Ctx Beta installation, but 'environment.oldhome' 
seems be unavailable.

are you ser HOME is set?

\ctxlua{print("1",environment.homedir)}
\ctxlua{print("2",environment.oldhome)}
\ctxlua{print("3",os.getenv("HOME"))}
\ctxlua{print("4",os.getenv("USERPROFILE"))}

gives 4 values here

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
___