ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Gavin via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Gavin <gavinpublic@comcast.net>
Subject: MetaFun manual's "texvar" is not working for me
Date: Sat, 21 May 2022 07:12:54 -0600	[thread overview]
Message-ID: <1FC42412-38AA-482A-994D-43A23F383741@comcast.net> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 4938 bytes --]

Hello list,

I’m trying to reproduce the positional graphics examples in the MetaFun manual on pp. 151-153. There are two examples of code for the mpos:box. The first example uses \MPvar to retrieve variables set using \setupMPvariables. This works fine. The second example uses texvar to retrieve variables, but it does not work in the current LMTX. However, the second example does work with my TeXLive install.

I’ve put my working example below, with both versions of the mpos:box code. Log output from a failed run is below that. Any ideas where I might be going wrong?

Thanks!
Gavin


\setupbackgrounds
  [page]
  [background={backgraphics,foreground,foregraphics}]
\defineoverlay [backgraphics] [\positionoverlay{backgraphics}]
\defineoverlay [foregraphics] [\positionoverlay{foregraphics}]

\setupMPvariables
  [mpos:box]
  [linecolor=blue,
   linewidth=\linewidth,
   fillcolor=lightgray,
   filloffset=2pt]

%%%%%%%%  This mpos:box works using \MPvar. %%%%%%%
\startMPpositiongraphic{mpos:box}{fillcolor,linecolor,linewidth}
  string tag; tag := "\MPvar{self}" ;
  path box ; box := positionbox(tag) ;
  box := box enlarged  \MPvar{filloffset} ;
  fill box
    withcolor \MPvar{fillcolor} ;
  draw box
    withcolor \MPvar{linecolor}
    withpen pencircle scaled \MPvar{linewidth} ;
  positioninregion ;
\stopMPpositiongraphic

%%%%%%%  This mpos:box does not work using texvar. (log below) %%%%%%%
%\startMPpositiongraphic{mpos:box}{fillcolor,linecolor,linewidth}
%  path box ; box := positionbox(texstr("self")) ;
%  box := box enlarged  texvar("filloffset") ;
%  fill box
%    withcolor texvar("fillcolor") ;
%  draw box
%    withcolor texvar("linecolor")
%    withpen pencircle scaled texvar("linewidth") ;
%  positioninregion ;
%\stopMPpositiongraphic


\starttext

to get \hpos {A-0} {positions} sorted

\startpositionoverlay{backgraphics}
   \setMPpositiongraphic{A-0}{mpos:box}{self=A-0}
\stoppositionoverlay

\stoptext


system          > 
system          > ConTeXt  ver: 2022.05.11 11:36 LMTX  fmt: 2022.5.20  int: english/english
system          > 
system          > 'cont-new.mkxl' loaded
open source     > level 1, order 1, name '/Users/Gavin/context-osx-arm64/tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl'
system          > beware: some patches loaded from cont-new.mkiv
close source    > level 1, order 1, name '/Users/Gavin/context-osx-arm64/tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl'
system          > files > jobname './ContractionExperiments', input './ContractionExperiments.tex', result './ContractionExperiments'
fonts           > latin modern fonts are not preloaded
languages       > language 'en' is active
system          > synctex functionality is enabled, expect 5-10 pct runtime overhead!
open source     > level 1, order 2, name './ContractionExperiments.tex'
fonts           > preloading latin modern fonts (second stage)
fonts           > 'fallback modern-designsize rm 12pt' is loaded
metapost        > initializing instance 'metafun:1' using format 'metafun' and method 'double'
metapost        > loading 'metafun' as 'metafun.mpxl' using method 'double'
metapost        > initializing number mode 'double'
metapost        > trace > This is MPLIB for LuaMetaTeX, version 3.12, running in double mode.
metapost        > trace > 
metapost        > trace > loading metafun for lmtx, including the plain 1.004 base definitions
metapost        > trace > 
metafun         > log >
metafun         > log > error: Missing ')' has been inserted
metafun         > log >
metapost        > trace > <to be read again> ,
metapost        > trace > <macro> paired -> <primary> -> begingroup.if.pair(EXPR2):(EXPR2)else:((EXPR2),(EXPR2))fi.endgroup
metapost        > trace > <to be read again> ,
metapost        > trace > <macro> llmoved -> -> ((llcorner(EXPR0))shifted(-xpart.paired((EXPR1)),-ypart.paired((EXPR1))))
metapost        > trace > <to be read again> {
metapost        > trace > <macro> -- -> -> {curl1}..{curl1}
metapost        > trace > <macro> enlarged -> -> ((EXPR0)llmoved(EXPR1)--(EXPR0)lrmoved(EXPR1)--(EXPR0)urmoved(EXPR1)--(EXPR0)ulmoved(EXPR1)--cycle)
metapost        > trace > <to be read again> ;
metafun         > log >
metafun         > log > I found no right delimiter to match a left one. So I've put one in, behind the
scenes; this may fix the problem.
metafun         > log >
metapost        > trace > <direct> path box ; box := positionbox(texstr("self")) ; box := box enlarged texvar("filloffset") ; fill box withcolor texvar("fillcolor") ; draw box withcolor texvar("linecolor") withpen pencircle scaled texvar("linewidth") ; positioninregion ; ;
metapost        > trace > 
backend         > xmp > using file '/Users/Gavin/context-osx-arm64/tex/texmf-context/tex/context/base/mkiv/lpdf-pdx.xml'
pages           > flushing realpage 1, userpage 1, subpage 1

[-- Attachment #1.2: Type: text/html, Size: 8711 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

                 reply	other threads:[~2022-05-21 13:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1FC42412-38AA-482A-994D-43A23F383741@comcast.net \
    --to=ntg-context@ntg.nl \
    --cc=gavinpublic@comcast.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).