[NTG-context] Re: MetaPost lines in tables?

2024-02-22 Thread Henning Hraban Ramm

Am 22.02.24 um 18:35 schrieb Hans Hagen via ntg-context:

On 2/21/2024 7:47 PM, Henning Hraban Ramm wrote:

(I’m sure I already used that somewhere… Must document…)
ok, new feature dedicated to Hraban ... who then of course has to 
document it.


This is nice.
Thank you, will do.

(Actually I’m not much interested in dashed borders but to have lines 
affected by my sketchy style - courtesy of Aditya et al., see below)


Taco, will the syntax pages in the wiki update automatically to a newer 
version?



"""
\startuseMPgraphic{mp:sketchy}
input mp-sketch.mp;
sketchypaths;

sketch_amount := 1 + (uniformdeviate 2);
sketch_passes := 3;
sketch_segments := 2 + (uniformdeviate 3);
sketch_length := OverlayWidth / 3;

draw topboundary withpen pensquare withcolor lightgray;
naturalizepaths;
\stopuseMPgraphic

\defineoverlay[sketchylines][\useMPgraphic{mp:sketchy}]

\setupTABLE[r][first][style=bold]
\setupTABLE[r][each][
topoffset=1em,bottomoffset=0.5em,
background=sketchylines,
% would be nice if the background wouldn’t start at each column
]
\setupTABLE[c][each][frame=off]
\bTABLE[]
\bTR
\bTD{Stadt}\eTD
\bTD{Land}\eTD
\bTD{Fluss}\eTD
\eTR
\dorecurse{10}{
\bTR
\bTD\strut \eTD\bTD \eTD\bTD \eTD
\eTR
}
\eTABLE
"""


Hraban%D \module
%D   [   file=mp-sketch.mp
%Dversion=2021.05.13
%D  title=\CONTEXT\ \METAPOST\ graphics,
%D   subtitle=Sketch drawing,
%D author=Aditya Mahajan,
%D   date=\currentdate,
%D  copyright={Aditya Mahajan}]

%D This metapost module is inspired by a TeX.SE question:
%D http://tex.stackexchange.com/q/39296/323
%D
%D I thought that it would be fun to implement a similar feature in MetaPost.
%D
%D To use this package in MetaPost:
%D
%D \starttyping
%Dinput mp-sketch;
%D
%Dbeginfig(1)
%D  sketchypaths; % Make draw and fill sketchy
%D  ...
%D  naturalizepaths; % Restore the value of draw and fill
%D  ...
%Dendfig
%D \stoptyping
%D
%D The code is heavily inspired by Hans Hagen's Metafun macros.
%D
%D The macro \type{sketchypaths} is modeled after \type{visualizepaths} from
%D \filename{mp-tool}.

def sketchypaths =
let draw = sketchdraw ;
let fill = sketchfill ;
enddef ;

%D Check if \filename{mp-tool} is loaded
if not known context_tool :
  let normaldraw = draw;
  let normalfill = fill;

  def naturalizepaths =
  let fill = normalfill ;
  let draw = normaldraw ;
  enddef ;
fi

%D The variable \type{sketch_amount} determines the amount of randomness in the
%D drawing
numeric sketch_amount; sketch_amount := 0.75bp;

%D The variable \type{sketch_passes} determines the number of times the path
%D is drawn
numeric sketch_passes; sketch_passes := 1;

%D Based on \type{randomized}. Assumes p is path:
numeric sketch_segments; sketch_segments := 20;

%D Length (time) of line segments:
numeric sketch_length; sketch_length := 5mm;

primarydef p sketchrandomized s = (
if path p :
for t = 0 step 1/sketch_segments until 1-1/sketch_segments :
((point   (t*arclength(p)) on p) 
randomshifted s) .. controls
((postcontrol (t*arclength(p)) on p) 
randomshifted s) and
((precontrol  ((t+1/sketch_segments)*arclength(p)) on p) 
randomshifted s) ..
endfor
% TODO: beide Ansätze kombinieren. Eckpunkte erhalten!

%for t = 0 step sketch_length until arclength p:
%  (point (arctime t of p) of p) randomshifted s ..
%endfor
if cycle p : % funktioniert nicht
  cycle
else :
  ((point   (arclength(p)) on p) randomshifted 
s)
  %(point (arctime t of p) of p) randomshifted s
fi
else :
p
fi
) enddef ;



%D The macro \type{sketchdraw} draws the randomized path. The
%D \type{expr} ... \type{text} trick is copied from the definition of
%D \type{drawarrow}
def sketchdraw expr p =
   do_sketchdraw(p)
enddef;

def do_sketchdraw(expr p) text t =
  if (path p) :
  for i = 1 upto max(1,sketch_passes) :
normaldraw p
   sketchrandomized sketch_amount
   withtransparency ("multiply", 1/max(1,sketch_passes))
   t ;
  endfor;
  else :
  normaldraw p t;
  fi
enddef;

%D The macro \type{sketchfill} randomizes the path before filling it.
def sketchfill expr p =
  do_sketchfill(p)
enddef ;

def do_sketchfill(expr p) text t =
  if (path p) :
  for i = 1 upto max(1,sketch_passes) :
normalfill p
   sketchrandomized sketch_amount
   withtransparency ("multiply", 1/max(1,sketch_passes))
   t ;
  endfor;
  else :
  normalfill p t;
  fi
enddef;

picture NoisePattern;
NoisePattern := image(
  pickup pencircle xyscaled 0.5bp;
  numeric pmax ; pmax := 7 ;
  numeric x ; numeric y ;
for i = 1 upto pmax:
for j = 1 upto pmax:
 

[NTG-context] \xmlinclusion?

2023-11-09 Thread Hans van der Meer via ntg-context
I cannot get \xmlinclusion working. Below an MWE with its output. What I am missing here or is \xmlinclusion not ok?\startxmlsetups demo	\xmlsetsetup{#1}{		root|test	}{demo:*}\stopxmlsetups\xmlregisterdocumentsetup{demo}{demo}\startxmlsetups demo:root	\blank{\bf Start test}\crlf	\string\xmlinclusion\{\#1\} ===> "\xmlinclusion{#1}"\crlf	\xmlflush{#1}\crlf	{\bf End test}\blank\stopxmlsetups\startxmlsetups demo:test	\xmlflush{#1}\stopxmlsetups\starttext\currentdate-\currenttime\quad\ConTeXt-version=\contextversion\blankThe following text is on page 52 of xml-mkiv.pdf:\crlf\type{\xmlinclusion{...}}\crlfreturns the file where the node comes from\blankFollows the test of this claim:\xmlprocessfile{demo}{demo.xml}{}\blank\typefile{demo.xml}\stoptext	node TEST

xml-inclusion.pdf
Description: Adobe PDF document

met vriendelijke groet,dr. Hans van der MeerBurgemeester Rijnderslaan 244 ingang D1185 MC Amstelveentel. 020 6452701 / 06 53743629




___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Why overbar is so big

2023-08-13 Thread Hans Hagen

On 8/13/2023 10:39 PM, Xavier B. wrote:

Running LMTX I have an error: lualibs-os not found:

lua error   > lua error on line 35 in file 
ng-pre-informacio-document.conTeXt:

token call, execute: 
...nt/tex/texmf-context/tex/context/base/mkiv/l-sandbox.lua:180: module 
'lualibs-os' not found:
 no field package.preload['lualibs-os']
 no file '/usr/local/share/lua/5.4/lualibs-os.lua'
 no file '/usr/local/share/lua/5.4/lualibs-os/init.lua'
 no file '/usr/local/lib/lua/5.4/lualibs-os.lua'
 no file '/usr/local/lib/lua/5.4/lualibs-os/init.lua'
 no file './lualibs-os.lua'
 no file './lualibs-os/init.lua'
stack traceback:
 [C]: in upvalue 'requiem'
 ...nt/tex/texmf-context/tex/context/base/mkiv/l-sandbox.lua:180: in function 
<...nt/tex/texmf-context/tex/context/base/mkiv/l-sandbox.lua:165>
 (...tail calls...)
 [ctxlua]:1: in main chunk
25 \subsubject{Versió}
26
27 Contínuament canvio aquest document, afegint, modificant o eliminant 
algunes parts seves. En aquest sentit, és una obra permanentment inacabada. Per 
aquest motiu convé saber quina versió del document esteu llegint.
28
29 \medskip
30 La versió d'aquest document és la {\bf 0.4.0-alfa.\currentdate[year,-, 
mm,-,dd]}.
31
32 \bigskip
33 Aquest document ha estat generat, \currentdate[weekday,{ },day,{ 
},month,{ },year] a les \currenttime, usant programari lliure 
(\goto{\Context}[url(http://wiki.contextgarden.net)] versió 
\contextversionnumber, \goto{\texenginename}[url(http://www.luatex.org)] versió 
\texengineversion\space i \goto{PGF/Ti{\em 
k}Z}[url(http://sourceforge.net/projects/pgf/)]) sota un entorn 
\goto{GNU/Linux}[url(https://www.linuxfoundation.org)] (\goto{Artix 
Linux}[url(https://artixlinux.org)]). La revisió d'aquest document és la número 
\goto{\directlua{
34require "lualibs-os"
35 >> tex.sprint(math.floor(os.resultof("git log --pretty=oneline | wc 
-l")+1))}}[url(https://repo.or.cz/apunts-espa-matematiques.git/shortlog/HEAD)]. El conjunt 
de les versions s'administra amb \goto{git}[url(http://git-scm.com/)]. Teniu el codi font del 
document en aquest repositori: 
\goto{https://repo.or.cz/apunts-espa-matematiques.git}[url(https://repo.or.cz/apunts-espa-matematiques.git)].
36


Can you give me the solution here?
I have no clue what lualibs-os is so ... if it's something third party 
you and try.


--permitloadlib

and cross your fingers. Also, whenever using lua code that is not part 
of context keep in mind that we use lua 5.4


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 / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___

[NTG-context] Re: Why overbar is so big

2023-08-13 Thread Xavier B.
Running LMTX I have an error: lualibs-os not found:

lua error   > lua error on line 35 in file 
ng-pre-informacio-document.conTeXt:

token call, execute: 
...nt/tex/texmf-context/tex/context/base/mkiv/l-sandbox.lua:180: module 
'lualibs-os' not found:
no field package.preload['lualibs-os']
no file '/usr/local/share/lua/5.4/lualibs-os.lua'
no file '/usr/local/share/lua/5.4/lualibs-os/init.lua'
no file '/usr/local/lib/lua/5.4/lualibs-os.lua'
no file '/usr/local/lib/lua/5.4/lualibs-os/init.lua'
no file './lualibs-os.lua'
no file './lualibs-os/init.lua'
stack traceback:
[C]: in upvalue 'requiem'
...nt/tex/texmf-context/tex/context/base/mkiv/l-sandbox.lua:180: in 
function <...nt/tex/texmf-context/tex/context/base/mkiv/l-sandbox.lua:165>
(...tail calls...)
[ctxlua]:1: in main chunk
25 \subsubject{Versió}
26
27 Contínuament canvio aquest document, afegint, modificant o eliminant 
algunes parts seves. En aquest sentit, és una obra permanentment inacabada. Per 
aquest motiu convé saber quina versió del document esteu llegint.
28
29 \medskip
30 La versió d'aquest document és la {\bf 0.4.0-alfa.\currentdate[year,-, 
mm,-,dd]}.
31
32 \bigskip
33 Aquest document ha estat generat, \currentdate[weekday,{ },day,{ 
},month,{ },year] a les \currenttime, usant programari lliure 
(\goto{\Context}[url(http://wiki.contextgarden.net)] versió 
\contextversionnumber, \goto{\texenginename}[url(http://www.luatex.org)] versió 
\texengineversion\space i \goto{PGF/Ti{\em 
k}Z}[url(http://sourceforge.net/projects/pgf/)]) sota un entorn 
\goto{GNU/Linux}[url(https://www.linuxfoundation.org)] (\goto{Artix 
Linux}[url(https://artixlinux.org)]). La revisió d'aquest document és la número 
\goto{\directlua{
34require "lualibs-os"
35 >> tex.sprint(math.floor(os.resultof("git log --pretty=oneline | wc 
-l")+1))}}[url(https://repo.or.cz/apunts-espa-matematiques.git/shortlog/HEAD)]. 
El conjunt de les versions s'administra amb 
\goto{git}[url(http://git-scm.com/)]. Teniu el codi font del document en aquest 
repositori: 
\goto{https://repo.or.cz/apunts-espa-matematiques.git}[url(https://repo.or.cz/apunts-espa-matematiques.git)].
36


Can you give me the solution here?

Thanks,
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


[NTG-context] Re: Triaging tikz error: Cannot parse this coordinate

2023-08-08 Thread Hans Hagen

On 8/8/2023 7:43 PM, Hans Hagen wrote:

On 8/8/2023 6:13 PM, Xavier B. wrote:
After some time, I could write a minimal example with tikz with 
strange error: Cannot parse this coordinate.


Can someone help me to find the bug?

I attach the file and the log.

Help very appreciate
I run

  \starttikzpicture
    \foreach \p in {(6,2)}
    {
    \tracingall
  \startscope[shift={\p}]
     \draw[color=green!60, thick] (0,0) -- (1,1);
  \stopscope
    }
   \stoptikzpicture

looks like some parsing issue, are you sure that you can assign \p to 
shift this way?

ok, i found it but i'm not going to make it custom to fix tikz

you need to use this:

 \normalexpanded{\noexpand\startscope[shift={\p}]}

instead of

  \startscope[shift={\p}]

this can be automated with (maybe we need a m-fixz module for that)

% fix

\appendtoks
\let\normaltikzstartscope\startscope
\def\startscope[#1]%
  {\normalexpanded
 {\noexpand\normaltikzstartscope[#1]}}%
\to \everyinsidetikzpicture

% end of fix

but for that you need to use the attached module so that we hook it in 
aftert tikz sets itself up


the fix you can put in your style or in a cont-loc.mkxl in a local tree

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
-
%D \module
%D   [   file=m-tikz,
%Dversion=2021.07.12,
%D  title=\CONTEXT\ Extra Modules,
%D   subtitle=TIKZ support,
%D author=Hans Hagen,
%D   date=\currentdate,
%D  copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

%D A fixed variant of the t-tikz module distributed with tikz. For practical 
reasons
%D per 2021 we split the module for \MKIV\ and \LMTX. (Maybe some day I'll 
optimize
%D TIKZ a bit.)
%D
%D All these t-* modules in the tikz distribution make no sense as we can just 
load
%D them here which is way cleaner. There is also some mkii filename mapping 
going on
%D that is not needed on todays systems (windows has no 8.3 limitation and on 
unix
%D tds finally adopted a case insensitive approach.)

%D Just in case someone does a hard input ...

\ifdefined\pgfdefined\endinput \fi
\ifdefined\pgfcoredefined\endinput \fi

%D ... but normally we end up here:

\startmodule[tikz]

\ifdefined\pdflastxpos \else
\unprotect

\frozen\overloaded\protected\def\pdflastxpos{\numexpr\clf_lastxpos\relax}

\frozen\overloaded\protected\def\pdflastypos{\numexpr\clf_lastypos\relax}
\protect
\fi

\newcatcodetable \tikzcatcodes

\startcatcodetable \tikzcatcodes
\catcode\tabasciicode \spacecatcode
\catcode\endoflineasciicode   \endoflinecatcode
\catcode\formfeedasciicode\endoflinecatcode
\catcode\spaceasciicode   \spacecatcode
\catcode\endoffileasciicode   \ignorecatcode
\catcode\circumflexasciicode  \superscriptcatcode
\catcode\underscoreasciicode  \subscriptcatcode
\catcode\ampersandasciicode   \alignmentcatcode
\catcode\backslashasciicode   \escapecatcode
\catcode\leftbraceasciicode   \begingroupcatcode
\catcode\rightbraceasciicode  \endgroupcatcode
\catcode\dollarasciicode  \mathshiftcatcode
\catcode\hashasciicode\parametercatcode
\catcode\commentasciicode \commentcatcode
\catcode\atsignasciicode  \lettercatcode
\catcode\exclamationmarkasciicode \othercatcode
\catcode\questionmarkasciicode\lettercatcode
\catcode\tildeasciicode   \activecatcode
\catcode\barasciicode \othercatcode
\stopcatcodetable

\permanent\protected\def\starttikzinput
  {\pushoverloadmode
   \pushcatcodetable
   \setcatcodetable\tikzcatcodes
   \pushmacro\meaning
   \let\meaning\meaningless
   \autoparagraphmode\zerocount}

\permanent\protected\def\stoptikzinput
  {\autoparagraphmode\plusone
   \popcatcodetable
   \popmacro\meaning
   \popoverloadmode}

\permanent\protected\def\tikzinputfile#1%
  {\starttikzinput
   \input{#1}\relax
   \stoptikzinput}

\permanent\protected\def\tikzerrormessage#1#2#3%
  {\writestatus{#1}{#2}}

% For now we need this but we need to educate the user to wrap settings in the
% wrappers. So some day the next line will go. I need to check what commands are
% possible outside a picture.

\overloadmode\zerocount

\newtoks\everytikzpicture
\newtoks\everyinsidetikzpicture

% \appendtoks
% \resetcharacterspacing
% \to \everytikzpicture

\permanent\protected\def\starttikzsettings
  {\pushoverloadmode
   \pushmacro\meaning
   \let\meaning\meaningless
   \autoparagraphmode\zerocount}

\permanent

[NTG-context] \version[temporary] fatal error

2023-07-23 Thread Jacob Kauffmann via ntg-context
Hi all,

\version[temporary] produces an error for me (see below).
Is this a permanent change, or is this version really just temporary? ;)

All the best,
Jacob

Missing number, treated as zero



r

 \currentnote
\vskip 6\points \hbox to \makeupwidth {\infofont \getmessage \m!system 
{27}:\space \currentdate \quad \donefalse \ifcstok \currentproject
\currentproduct \ifcstok \currentproduct \currentcomponent \donetrue \fi 
\fi \ifdone \donefalse \else \ifempty \
 \page_info_add_to_box
#1->\scratchdimen \wd #1\setbox \b_page_versions \vpack to \ht #1{\vfill 
\settexthoffset \hsize \dimexpr \scratchdimen -2\texthoffset \relax \hkern 
\texthoffset \vbox to \zeropoint {\vss \page_info_place_info
}\vkern \bodyfontsize }\dp \b_page_versio
 \page_boxes_constructed_page_body
... \bgroup \boxmaxdepth \maxdimen \dontcomplain 
\page_marks_synchronize_page {#2}\page_boxes_construct_content \pagebox 
{#1}{#2}\page_backgrounds_add_to_main \pagebox \page_boxes_apply_offsets 
\pagebox \page_info_add_to_box \pagebox
\ifcase \page ...
 \page_boxes_constructed_page
...everybeforepagebody \starttextproperties \checkmarginblocks \expand 
\beforeeverypage \normalexpanded {\global \beforepage \emptytoks \expand 
\beforepage }\inpagebodytrue \pagebodymode \plusone 
\page_boxes_constructed_page_body #1#2
\normalexpand ...
 ...


\stoptext

1 >>  \version[temporary]
2
3 \starttext
4 \input{tufte}
5 \stoptext
6
A number should have been here; I inserted '0'. (If you can't figure out why I
needed to see a number, look up 'weird error' in the index to The TeXbook.)
mtx-context | fatal error: return code: 1


signature.asc
Description: Message signed with OpenPGP
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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

[NTG-context] tikz + lmtx

2023-04-27 Thread Aditya Mahajan via ntg-context
Hi all,

For a few months now, all features of tikz have not been working with LMTX. 
After help from Hans and a bit of trial and error, I think that figured out 
what was going wrong with the catcodes in m-tikz: Since the texcatcodes are 
different from what tikz expects, the catcodes have to be set inside 
\starttikzpicture (in addition to before the loading of tikz files, which was 
already being done). 

I am attaching the working m-tikz.mkxl file. 

I have tested this on my course notes, which make extensive use of simple tikz 
block diagrams and pgfplots graphs. Perhaps others who were having issues with 
tikz could test if this fixes everything and, if so, we can add this to the 
distribution.

Aditya%D \module
%D   [   file=m-tikz,
%Dversion=2021.07.12,
%D  title=\CONTEXT\ Extra Modules,
%D   subtitle=TIKZ support,
%D author=Hans Hagen,
%D   date=\currentdate,
%D  copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

%D A fixed variant of the t-tikz module distributed with tikz. For practical 
reasons
%D per 2021 we split the module for \MKIV\ and \LMTX. (Maybe some day I'll 
optimize
%D TIKZ a bit.)
%D
%D All these t-* modules in the tikz distribution make no sense as we can just 
load
%D them here which is way cleaner. There is also some mkii filename mapping 
going on
%D that is not needed on todays systems (windows has no 8.3 limitation and on 
unix
%D tds finally adopted a case insensitive approach.)

%D Just in case someone does a hard input ...

\ifdefined\pgfdefined\endinput \fi
\ifdefined\pgfcoredefined\endinput \fi

%D ... but normally we end up here:

\startmodule[tikz]

\ifdefined\pdflastxpos \else
\unprotect

\frozen\overloaded\protected\def\pdflastxpos{\numexpr\clf_lastxpos\relax}

\frozen\overloaded\protected\def\pdflastypos{\numexpr\clf_lastypos\relax}
\protect
\fi

\newcatcodetable \tikzcatcodes

\startcatcodetable \tikzcatcodes
\catcode\tabasciicode \spacecatcode
\catcode\endoflineasciicode   \endoflinecatcode
\catcode\formfeedasciicode\endoflinecatcode
\catcode\spaceasciicode   \spacecatcode
\catcode\endoffileasciicode   \ignorecatcode
\catcode\circumflexasciicode  \superscriptcatcode
\catcode\underscoreasciicode  \subscriptcatcode
\catcode\ampersandasciicode   \alignmentcatcode
\catcode\backslashasciicode   \escapecatcode
\catcode\leftbraceasciicode   \begingroupcatcode
\catcode\rightbraceasciicode  \endgroupcatcode
\catcode\dollarasciicode  \mathshiftcatcode
\catcode\hashasciicode\parametercatcode
\catcode\commentasciicode \commentcatcode
\catcode\atsignasciicode  \lettercatcode
\catcode\exclamationmarkasciicode \othercatcode
\catcode\questionmarkasciicode\lettercatcode
\catcode\tildeasciicode   \activecatcode
\catcode\barasciicode \othercatcode
\stopcatcodetable

\permanent\protected\def\starttikzinput
  {\pushoverloadmode
   \pushcatcodetable
   \setcatcodetable\tikzcatcodes
   \pushmacro\meaning
   \let\meaning\meaningless
   \autoparagraphmode\zerocount}

\permanent\protected\def\stoptikzinput
  {\autoparagraphmode\plusone
   \popcatcodetable
   \popmacro\meaning
   \popoverloadmode}

\permanent\protected\def\tikzinputfile#1%
  {\starttikzinput
   \input{#1}\relax
   \stoptikzinput}

\permanent\protected\def\tikzerrormessage#1#2#3%
  {\writestatus{#1}{#2}}

% For now we need this but we need to educate the user to wrap settings in the
% wrappers. So some day the next line will go. I need to check what commands are
% possible outside a picture.

\overloadmode\zerocount

\newtoks\everytikzpicture

% \appendtoks
% \resetcharacterspacing
% \to \everytikzpicture

\permanent\protected\def\starttikzsettings
  {\pushoverloadmode
   \pushmacro\meaning
   \let\meaning\meaningless
   \autoparagraphmode\zerocount}

\permanent\protected\def\stoptikzsettings
  {\autoparagraphmode\plusone
   \popmacro\meaning
   \popoverloadmode}

\permanent\protected\def\starttikzpicture
  {\dontleavehmode
   \hcontainer\bgroup
   \setcatcodetable\tikzcatcodes
   \the\everytikzpicture
   \autoparagraphmode\zerocount
   \pushmacro\meaning
   \let\meaning\meaningless
 % \pushoverloadmode
   \ifdefined\PackageError\else \let\PackageError\tikzerrormessage \fi
   \tikzpicture}

\permanent\protected\def\stoptikzpicture
  {\endtikzpicture
 % \popoverloadmode
   \popmacro\meaning
   \egroup}

\let\pgfdefined\relax
\let\pgfcoredefined\relax

\tikzinputfile{pgfutil-common.tex}
\tikzinputfile{pgfutil-context.def}
\tikzinputfile{pgfrcs.code.tex}
\tikzinputfile{pgfsys.code.tex}
\tikzinputfile{pgfkeys.code.tex}
\tikzinputfile{pgfsyssoftpath.code.tex}
\tikzinputfile{pgfsysprotocol.code.tex}
\tikz

Re: [NTG-context] Kaktovik numerals

2023-04-19 Thread Hans Hagen via ntg-context

On 4/19/2023 10:45 PM, Willi Egger via ntg-context wrote:

Hello Gavin,

thank you so much for your input. — Indeed you are right. Please find attached 
the corrected version.



Willi


On 19 Apr 2023, at 20:58, Gavin via ntg-context  wrote:

Hi Willi,

What fun! I think I found a couple math items to correct.

1) The second line of the tables at the top of page 2 should be:
1000' 100, 10, 1; 8000, 400, 20, 1

2) For the year conversion: 2023 = 5x20^2 + 1x20 + 3. (Your 0 should be my 1). 
This will give a three digit Kaktovik numeral. You have 4 digit Kaktovik 
numerals for 2023, with both a 0 and a 1.
je kunt direct dat nummer converteren maar blijkbaar gaf ik de verkeerde 
volgorde uit:


\useMPlibrary[kaktovik] % de officiele manier

\definefontfeature
  [default]
  [default]
  [metapost=kaktovik]

\setupbodyfont[dejavu]

\starttext
 2023 \kaktoviknumerals{5}\kaktoviknumerals{1}\kaktoviknumerals{3}

\kaktoviknumerals{2023} % deze split dus voor je, order fixed

\stoptext


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
%D \module
%D   [   file=meta-imp-kaktovik,
%Dversion=2023.04.18,
%D  title=\METAPOST\ Graphics,
%D   subtitle=Kaktovik Numbers,
%D author=Hans Hagen,
%D   date=\currentdate,
%D  copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

%D Just a quick hack for Hraban (after a post on the mailing list).

\startMPcalculation{simplefun}

path kaktovik_glyphs[] ;

def InitializeKaktovik =

save p, d, u ;

pair p[] ; numeric d ; d := .1 ; numeric u ; u := .15 ;

  % d := getparameterdefault "mpsfont" "d" .10 ;
  % u := getparameterdefault "mpsfont" "u" .15 ;

p[0] := (0,1) ;
p[1] := (1,0) ;
p[2] := (2,1 -  d) ;
p[3] := (3,0) ;
p[4] := (4,1 - 2d) ;

p[5] := (4,1 +  u) ;
p[6] := (0,1 + 2u) ;
p[7] := (4,1 + 4u) ;

kaktovik_glyphs[0] := (1,1)  { right } .. { left } (2,1/2) { left } .. 
{ right } (3,1);

for i= 1 upto 4 :
kaktovik_glyphs[i] := p[0] for j=1 upto i : -- p[j] endfor ;
endfor ;

kaktovik_glyphs[ 5] := p[5] -- p[0] ;for i= 6 upto  9 : 
kaktovik_glyphs[i] := p[5] -- kaktovik_glyphs[i-5] ; endfor ;
kaktovik_glyphs[10] := p[6] -- kaktovik_glyphs[ 5] ; for i=11 upto 14 : 
kaktovik_glyphs[i] := p[6] -- kaktovik_glyphs[i-5] ; endfor ;
kaktovik_glyphs[15] := p[7] -- kaktovik_glyphs[10] ; for i=16 upto 19 : 
kaktovik_glyphs[i] := p[7] -- kaktovik_glyphs[i-5] ; endfor ;

enddef ;

vardef Kaktovik(expr i) =
draw image (
draw kaktovik_glyphs[i]
xscaled (10/20 -1/20)
yscaled (25/20 -2/20)
withpen (pencircle xscaled 1/20 yscaled 5/20) rotated -(2*20)
  % withpen (pencircle xscaled 1/40 yscaled 5/40) rotated -(2*20)
  % withpen (pencircle xscaled 2.5/40 yscaled 5/40) rotated -(2*20)
;
) shifted (2/20,2/20)
enddef ;

lmt_registerglyphs [
name = "kaktovik",
units= 2,
usecolor = true,
width= 2,
height   = 2,
depth= 0,
preamble = "InitializeKaktovik"
] ;

for i=0 upto 19 :
lmt_registerglyph [
category = "kaktovik",
unicode  = 119488 + i, % "0x1D2C0"
code = "Kaktovik(" & decimal i & ")"
] ;
endfor ;

\stopMPcalculation

\startluacode
interfaces.implement {
name  = "kaktoviknumerals",
arguments = "integer",
actions   = function(n)
local digits = { }
local count  = 1
while true do
digits[count] = utf.char(0x1D2C0 + (n % 20))
n = n // 20
if n == 0 then
break;
end
count = count + 1
end
table.reverse(digits)
context("%t",digits)
end
}
\stopluacode

\unprotect

\permanent\def\kaktoviknumerals#1{\clf_kaktoviknumerals\numexpr#1\relax}

\defineconversion [kaktoviknumerals] [\kaktoviknumerals]
\defineconversion [K][\kaktoviknumerals]

\definefontfeature
  [kaktovik]
  [metapost=kaktovik]

\protect

\continueifinputfile{meta-imp-kaktovik.mkxl}

\definefontfeature
  [default]
  [default]
  [metapost=kaktovik]
% [metapost={category=kakto

Re: [NTG-context] Kaktovik numerals

2023-04-18 Thread Hans Hagen via ntg-context

On 4/18/2023 10:57 AM, Henning Hraban Ramm via ntg-context wrote:
I just came across this thread about the base-20 system of the Inuit 
people and the numerals invented for it in the 1990s:

https://mathstodon.xyz/@johncarlosbaez/110215432175491555

This makes simple calculations just beautiful.

interesting ... quick hack attached

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
-


meta-imp-kaktovik.pdf
Description: Adobe PDF document
%D \module
%D   [   file=meta-imp-kaktovik,
%Dversion=2023.04.18,
%D  title=\METAPOST\ Graphics,
%D   subtitle=Kaktovik Numbers,
%D author=Hans Hagen,
%D   date=\currentdate,
%D  copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

%D Just a quick hack for Hraban (after a post on the mailing list).

\startMPcalculation{simplefun}

path kaktovik_glyphs[] ;

def InitializeKaktovik =

save p, d, u ;

pair p[] ; numeric d ; d := .1 ; numeric u ; u := .15 ;

  % d := getparameterdefault "mpsfont" "d" .10 ;
  % u := getparameterdefault "mpsfont" "u" .15 ;

p[0] := (0,1) ;
p[1] := (1,0) ;
p[2] := (2,1 -  d) ;
p[3] := (3,0) ;
p[4] := (4,1 - 2d) ;

p[5] := (4,1 +  u) ;
p[6] := (0,1 + 2u) ;
p[7] := (4,1 + 4u) ;

kaktovik_glyphs[0] := (1,1)  { right } .. { left } (2,1/2) { left } .. 
{ right } (3,1);

for i= 1 upto 4 :
kaktovik_glyphs[i] := p[0] for j=1 upto i : -- p[j] endfor ;
endfor ;

kaktovik_glyphs[ 5] := p[5] -- p[0] ;for i= 6 upto  9 : 
kaktovik_glyphs[i] := p[5] -- kaktovik_glyphs[i-5] ; endfor ;
kaktovik_glyphs[10] := p[6] -- kaktovik_glyphs[ 5] ; for i=11 upto 14 : 
kaktovik_glyphs[i] := p[6] -- kaktovik_glyphs[i-5] ; endfor ;
kaktovik_glyphs[15] := p[7] -- kaktovik_glyphs[10] ; for i=16 upto 19 : 
kaktovik_glyphs[i] := p[7] -- kaktovik_glyphs[i-5] ; endfor ;

enddef ;

vardef Kaktovik(expr i) =
draw image (
draw kaktovik_glyphs[i]
xscaled (10/20 -1/20)
yscaled (25/20 -2/20)
withpen (pencircle xscaled 1/20 yscaled 5/20) rotated -(2*20)
  % withpen (pencircle xscaled 1/40 yscaled 5/40) rotated -(2*20)
  % withpen (pencircle xscaled 2.5/40 yscaled 5/40) rotated -(2*20)
;
) shifted (2/20,2/20)
enddef ;

lmt_registerglyphs [
name = "kaktovik",
units= 2,
usecolor = true,
width= 2,
height   = 2,
depth= 0,
preamble = "InitializeKaktovik"
] ;

for i=0 upto 19 :
lmt_registerglyph [
category = "kaktovik",
unicode  = 119488 + i, % "0x1D2C0"
code = "Kaktovik(" & decimal i & ")"
] ;
endfor ;

\stopMPcalculation

\startluacode
interfaces.implement {
name  = "kaktoviknumerals",
arguments = "integer",
actions   = function(n)
local digits = { }
local count  = 1
while true do
digits[count] = utf.char(0x1D2C0 + (n % 20))
n = n // 20
if n == 0 then
break;
end
count = count + 1
end
context("%t",digits)
end
}
\stopluacode

\unprotect

\permanent\def\kaktoviknumerals#1{\clf_kaktoviknumerals\numexpr#1\relax}

\defineconversion [kaktoviknumerals] [\kaktoviknumerals]
\defineconversion [K][\kaktoviknumerals]

\definefontfeature
  [kaktovik]
  [metapost=kaktovik]

\protect

\continueifinputfile{meta-imp-kaktovik.mkxl}

\definefontfeature
  [default]
  [default]
  [metapost=kaktovik]
% [metapost={category=kaktovik,u=.25,d=.20,x=}]

\setupbodyfont[dejavu]

% \nopdfcompression

\startTEXpage[offset=1ts,width=3es]

\start
\showglyphs
KAKTOVIK
\dostepwiserecurse{0}{19}{1}{\kaktoviknumerals{#1}\space }
\stop

kaktovik \start
\red\glyphxscale 700
\dostepwiserecurse{0}{19}{1}{\kaktoviknumerals{#1}\space }
\stop

\startitemize[packed,K][color=orange,stopper=]
\startitem first  \stopitem
\startitem second \stopitem
\startitem third  \stopitem
\stopitemize

KAKTOVIK \start
\red  \kaktoviknumerals{2023} --
\green\kaktoviknumerals{4}--
\blue \kaktovikn

Re: [NTG-context] rewrite for Greek in the wiki

2023-01-21 Thread Jean-Pierre Delange via ntg-context

Thank you very much about this accurate "mise au point", Pablo !

Le 21/01/2023 à 13:16, Pablo Rodriguez via ntg-context a écrit :

Dear list,

just in case it might help, I’ve rewritten the Greek entry in the wiki:

   https://wiki.contextgarden.net/Greek

Although nobody seemed to have mentioned them (afaIk), there are two issues:

1. Hyphenation patterns are different for ancient, monotonic and modern
polytonic Greek. Greek ortography was polytonic before 1982.

ConTeXt includes patterns for ancient and monotonic Greek, but none for
modern polytonic Greek
(http://mirror.ctan.org/language/hyph-utf8/tex/generic/hyph-utf8/patterns/tex/hyph-el-polyton.tex).

Ironically, modern polytonic Greek patterns would be required to typeset
both the act and the decree that introduced the monotonic ortography.

2. Greek doesn’t seem to have language-dependent commands (such as
\currentdate).

In both cases, Hans will reply that nobody asked for any of them.

Of course, I totally agree. AfaIk, nobody asked for these features.

Just in case it might help,

Pablo
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


--
Jean-Pierre Delange
Ancients&Moderns
Professeur Agrégé de Philosophie (HC)

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


Re: [NTG-context] rewrite for Greek in the wiki

2023-01-21 Thread Thomas A. Schmitz via ntg-context

Hi Pablo,

thanks for this; it is very informative and clear. Just one short remark 
and one correction:


1. "Before 1982, Greek ort[h]ography was polytonic." That's a bit of an 
oversimplification. I'm no expert here, but I think many Greek print 
publications had already given up on using circumflex and grave accent 
or at least greatly simplified their use; the law of 1982 simple 
codified what had been developing for some time. Your sentence makes it 
sound like a sudden and random decision.


2. I think it would be worth pointing out that unfortunately, Greek 
lowercase letters with acute accent occur separately in two unicode 
blocks: the combinations in U+03AC-U+03AF and U+03CC-U+03CF ("Greek 
small letter X with tonos") are functionally identical to the 
combinations in the U+1F7 block ("Greek small letter X with acute 
accent"). This is a source of confusion both in fonts and in 
programming, because some programs normalize these letters, so for 
string operations and searches, you may obtain surprising results.


Thank you for the article!

Thomas

On 1/21/23 13:16, Pablo Rodriguez via ntg-context wrote:

Dear list,

just in case it might help, I’ve rewritten the Greek entry in the wiki:

   https://wiki.contextgarden.net/Greek

Although nobody seemed to have mentioned them (afaIk), there are two issues:

1. Hyphenation patterns are different for ancient, monotonic and modern
polytonic Greek. Greek ortography was polytonic before 1982.

ConTeXt includes patterns for ancient and monotonic Greek, but none for
modern polytonic Greek
(http://mirror.ctan.org/language/hyph-utf8/tex/generic/hyph-utf8/patterns/tex/hyph-el-polyton.tex).

Ironically, modern polytonic Greek patterns would be required to typeset
both the act and the decree that introduced the monotonic ortography.

2. Greek doesn’t seem to have language-dependent commands (such as
\currentdate).

In both cases, Hans will reply that nobody asked for any of them.

Of course, I totally agree. AfaIk, nobody asked for these features.

Just in case it might help,

Pablo
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


[NTG-context] rewrite for Greek in the wiki

2023-01-21 Thread Pablo Rodriguez via ntg-context
Dear list,

just in case it might help, I’ve rewritten the Greek entry in the wiki:

  https://wiki.contextgarden.net/Greek

Although nobody seemed to have mentioned them (afaIk), there are two issues:

1. Hyphenation patterns are different for ancient, monotonic and modern
polytonic Greek. Greek ortography was polytonic before 1982.

ConTeXt includes patterns for ancient and monotonic Greek, but none for
modern polytonic Greek
(http://mirror.ctan.org/language/hyph-utf8/tex/generic/hyph-utf8/patterns/tex/hyph-el-polyton.tex).

Ironically, modern polytonic Greek patterns would be required to typeset
both the act and the decree that introduced the monotonic ortography.

2. Greek doesn’t seem to have language-dependent commands (such as
\currentdate).

In both cases, Hans will reply that nobody asked for any of them.

Of course, I totally agree. AfaIk, nobody asked for these features.

Just in case it might help,

Pablo
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


Re: [NTG-context] Parallel texts: verse with blanks between stanzas via tabulate

2022-08-29 Thread Hans Hagen via ntg-context

On 8/29/2022 1:31 PM, Denis Maier via ntg-context wrote:

-Ursprüngliche Nachricht-
Von: Hans Hagen 
Gesendet: Sonntag, 28. August 2022 10:41
An: mailing list for ConTeXt users 
Cc: Maier, Denis Christian (UB) 
Betreff: Re: [NTG-context] Parallel texts: verse with blanks between stanzas
via tabulate

On 8/27/2022 11:25 PM, Denis Maier via ntg-context wrote:

Thanks, Wolfgang. That gives me a blank between the verses. However the

blank is rather huge and I don't see how I could make it smaller? Is it possible
to do this?
morning exercise attached (you can run the file)

Hans


Another, more general question on this: why is the function poetry.sidebyside 
defined twice? If I understand correctly, depending on the input one or the 
other will be used, but I don't see where that happens...

the first can be commented as it is the first simple variant

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
-%D \module
%D   [   file=m-poetry,
%Dversion=2022.08.28
%D  title=\CONTEXT\ Extra Modules,
%D   subtitle=Whatever comes up,
%D author=Hans Hagen,
%D   date=\currentdate,
%D  copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

% For Denis Maier (see mails to list end of August 2022)

\startluacode

local  poetry = moduledata.poetry or { }
moduledata.poetry = poetry

-- function poetry.sidebyside(specification)
-- local first   = string.splitlines(buffers.getcontent(specification.left))
-- local second  = 
string.splitlines(buffers.getcontent(specification.right))
-- local template = specification.template or "|||"
-- context.starttabulate { template }
-- for i=1,#first do
-- local f = first [i] or ""
-- local s = second[i] or ""
-- if f == "" and s == "" then
-- context.TB { "medium" }
-- else
-- context.NC() context(f)
-- context.NC() context(s)
-- context.NC() context.NR()
-- end
-- end
-- context.stoptabulate()
-- end

function poetry.sidebyside(specification)
local left= specification.left
local right   = specification.right
local first   = left  and string.splitlines(buffers.getcontent(left )) or { 
}
local second  = right and string.splitlines(buffers.getcontent(right)) or { 
}

if #first > 0 and #second == 0 then
for i=1,#first do
local t = string.split(first[i], "|")
first[i]  = string.strip(t[1] or "")
second[i] = string.strip(t[2] or "")
end
end

local template = specification.template or "|||"

context.starttabulate { template }
local fi = 1
local si = 1
local n  = #first > #second and #first or #second

local function flush(f,s)
context.NC() context(f)
context.NC() context(s)
context.NC() context.NR()
if f ~= "" then
fi = fi + 1
end
if s ~= "" then
si = si + 1
end
end

while fi <= n and si <= n do
local f = first [fi] or ""
local s = second[si] or ""
if f ~= "" and s ~= "" then
flush(f,s)
else
while true do
if f ~= "" or s ~= "" then
flush(f,s)
else
while f == "" do
fi = fi + 1
f = first [fi] or ""
end
while s == "" do
si = si + 1
s = second[si] or ""
end
break
end
f = first [fi] or ""
s = second[si] or ""
end
 -- context.HL()
context.TB { "medium" }
end
end
context.stoptabulate()
end

interfaces.implement {
name  = "poetrysidebyside",
protected = true,
public= true,
actions   = poetry.sidebyside,
arguments = "hash",
}

\stopluacode

\continueifinputfile{m-poetry.mkxl}

\starttext

\starttext

\startbuffer

Re: [NTG-context] Parallel texts: verse with blanks between stanzas via tabulate

2022-08-28 Thread Hans Hagen via ntg-context

On 8/27/2022 11:25 PM, Denis Maier via ntg-context wrote:

Thanks, Wolfgang. That gives me a blank between the verses. However the blank 
is rather huge and I don't see how I could make it smaller? Is it possible to 
do this?

morning exercise attached (you can run the file)

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
-%D \module
%D   [   file=m-poetry,
%Dversion=2022.08.28
%D  title=\CONTEXT\ Extra Modules,
%D   subtitle=Whatever comes up,
%D author=Hans Hagen,
%D   date=\currentdate,
%D  copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

% For Denis Maier (see mails to list end of August 2022)

\startluacode

local  poetry = moduledata.poetry or { }
moduledata.poetry = poetry

function poetry.sidebyside(specification)
local first   = string.splitlines(buffers.getcontent(specification.left))
local second  = string.splitlines(buffers.getcontent(specification.right))
local template = specification.template or "|||"
context.starttabulate { template }
for i=1,#first do
local f = first [i] or ""
local s = second[i] or ""
if f == "" and s == "" then
context.TB { "medium" }
else
context.NC() context(f)
context.NC() context(s)
context.NC() context.NR()
end
end
context.stoptabulate()
end

function poetry.sidebyside(specification)
local left= specification.left
local right   = specification.right
local first   = left  and string.splitlines(buffers.getcontent(left )) or { 
}
local second  = right and string.splitlines(buffers.getcontent(right)) or { 
}

if #first > 0 and #second == 0 then
for i=1,#first do
local t = string.split(first[i], "|")
first[i]  = string.strip(t[1] or "")
second[i] = string.strip(t[2] or "")
end
end

local template = specification.template or "|||"

context.starttabulate { template }
for i=1,#first do
local f = first [i] or ""
local s = second[i] or ""
if f == "" and s == "" then
context.TB { "medium" }
else
context.NC() context(f)
context.NC() context(s)
context.NC() context.NR()
end
end
context.stoptabulate()
end

interfaces.implement {
name  = "poetrysidebyside",
protected = true,
public= true,
actions   = poetry.sidebyside,
arguments = "hash",
}

\stopluacode

\continueifinputfile{m-poetry.mkxl}

\starttext

\startbuffer[lines-1]
THIS
IS
A
POEM

WITH
TWO
STANZAS
\stopbuffer

\startbuffer[lines-2]
this
is
a
poem

with
two
stanzas
\stopbuffer

\startbuffer[lines-3]
this | THIS
is   | IS
a| A
poem | POEM
 |
with | WITH
two  | TWO
stanzas  | STANZAS
\stopbuffer

\ctxlua {
moduledata.poetry.sidebyside {
left = "lines-1",
right= "lines-2",
template = "|l|i2r|"
}
}

\ctxlua {
moduledata.poetry.sidebyside {
left = "lines-3",
template = "|r|il|"
}
}

\poetrysidebyside
  [left=lines-3,
   template={|r|il|}]

\stoptext
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


Re: [NTG-context] C with macron

2022-08-24 Thread Hans Hagen via ntg-context

On 8/24/2022 8:45 PM, Pablo Rodriguez via ntg-context wrote:

On 8/24/22 18:11, Thangalin via ntg-context wrote:

Another nice solution, Pablo, thank you.

The macron is shifted a little too far to the left


I don’t know how ConTeXt handles it internally, but placement to main
character differs with each letter:

   \starttext
 \doloopoverlist{\tf,\ss,\tt}
   {\bgroup\recursestring\doloopoverlist{\tf,\it,\bf,\bi,\sc}
 {\bgroup\recursestring\dorecurse{26}
   {\character{\recurselevel}̱ }\par}\egroup}
   \stoptext

just run the attached

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-%D \module
%D   [   file=m-gimmicks,
%Dversion=2022.07.25
%D  title=\CONTEXT\ Extra Modules,
%D   subtitle=Whatever comes up,
%D author=Hans Hagen,
%D   date=\currentdate,
%D  copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\def\MacScale{.7}%
\def\MacRule {.05}%
\def\MacDistance {.05}%
\def\MacKern {0}%

\protected\def\Mac
  {\dontleavehmode
   \begingroup
   \scratchwidth   \fontcharwd\font`M\relax
   \scratchdistance\MacScale\fontcharwd\font`c\relax
   \scratchoffset  \dimexpr\fontcharht\font`M -\MacScale\fontcharht\font`c\relax
   \scratchdepth   \MacRule\exheight
   \kern\scratchwidth
   \vrule
 width  \scratchdistance
 height \dimexpr \scratchoffset- \scratchdepth-\MacDistance\exheight\relax
 depth  \dimexpr-\scratchoffset+2\scratchdepth+\MacDistance\exheight\relax
   \relax
   \kern-\dimexpr\scratchwidth+\scratchdistance\relax
   M%
   \glyphscale\numexpr\numericscale\MacScale*\glyphyscale/\plusthousand\relax
   \glyph
 yoffset \scratchoffset `c
   \kern\MacKern\emwidth
   \endgroup}

\continueifinputfile{m-gimmicks.mkxl}

\setupbodyfont[pagella]

\startTEXpage [offset=1dk]
\def\Test#1{%
\begingroup
#1%
\dostepwiserecurse{5}{8}{1}{
\def\MacScale{.##1}%
\Mac Anulty
\par
}
\endgroup
}
\Test\tf
\Test\bf
\Test\it
\Test\sl
\Test\bfb
\def\MacScale{.6}
\def\MacKern {-.1}
\Mac Anulty
\stopTEXpage
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


Re: [NTG-context] Using alegreya typescript

2022-07-06 Thread Hans Hagen via ntg-context


\usetypescriptfile[alegreya]

\usebodyfont[alegreya-light]
\usebodyfont[alegreya-medium]

\setupbodyfont[alegreya]

\setuplayout[tight]

\starttext
\switchtobodyfont[alegreya-light]\input tufte \par
\switchtobodyfont[alegreya]  \input tufte \par
\switchtobodyfont[alegreya-medium]   \input tufte \par
\switchtobodyfont[alegreya-light,sans]   \input tufte \par
\switchtobodyfont[alegreya,sans] \input tufte \par
\switchtobodyfont[alegreya-medium,sans]  \input tufte \par
\stoptext


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-%D \module
%D   [   file=type-imp-dejavu,
%Dversion=2010.06.21,
%D  title=\CONTEXT\ Typescript Macros,
%D   subtitle=Alegreya fonts,
%D author=Hans Hagen,
%D   date=\currentdate,
%D  copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

%D This is cleaned up ersion of thwe one on the wiki. The font can be fetched 
from:
%D
%D \type {https://www.huertatipografica.com/en/fonts/alegreya-ht-pro}

% \usetypescriptfile[alegreya]
%
% \usebodyfont[alegreya-light]
% \usebodyfont[alegreya-medium]
%
% \setupbodyfont[alegreya]
%
% \setuplayout[tight]
%
% \starttext
% \switchtobodyfont[alegreya-light]\input tufte \par
% \switchtobodyfont[alegreya]  \input tufte \par
% \switchtobodyfont[alegreya-medium]   \input tufte \par
% \switchtobodyfont[alegreya-light,sans]   \input tufte \par
% \switchtobodyfont[alegreya,sans] \input tufte \par
% \switchtobodyfont[alegreya-medium,sans]  \input tufte \par
% \stoptext

\starttypescriptcollection[alegreya]

\usetypescriptfile
  [imp-gentium]

\definefontfallback
  [alegreyagentium-fallback]
  [name:gentium]
  [greekandcoptic,greekextended]

\starttypescript [serif] 
[alegreya-serif,alegreya-light-serif,alegreya-medium-serif] [name]
\setups[font:fallback:serif]
\definefontsynonym[Serif]   [name:alegreyaregular]
[features=default,fallbacks=alegreya-gentium-fallback]
\definefontsynonym[SerifItalic] [name:alegreyaitalic] 
[features=default,fallbacks=alegreya-gentium-fallback]
\definefontsynonym[SerifBold]   [name:alegreyabold]   
[features=default,fallbacks=alegreya-gentium-fallback]
\definefontsynonym[SerifBoldItalic] [name:alegreyabolditalic] 
[features=default,fallbacks=alegreya-gentium-fallback]
\stoptypescript

\starttypescript [sans] [alegreya-sans] [name]
\setups[font:fallback:sans]
\definefontsynonym [Sans]   [name:alegreyasansregular]
[features=default]
\definefontsynonym [SansItalic] [name:alegreyasansitalic] 
[features=default]
\definefontsynonym [SansBold]   [name:alegreyasansbold]   
[features=default]
\definefontsynonym [SansBoldItalic] [name:alegreyasansbolditalic] 
[features=default]
\stoptypescript

\starttypescript [sans] [alegreya-light-sans] [name]
\setups[font:fallback:sans]
\definefontsynonym [Sans]   [name:alegreyasanslight]
[features=default]
\definefontsynonym [SansItalic] [name:alegreyasanslightitalic]  
[features=default]
\definefontsynonym [SansBold]   [name:alegreyasansmedium]   
[features=default]
\definefontsynonym [SansBoldItalic] [name:alegreyasansmediumitalic] 
[features=default]
\stoptypescript

\starttypescript [sans] [alegreya-medium-sans] [name]
\setups[font:fallback:sans]
\definefontsynonym [Sans]   [name:alegreyasansmedium]  
[features=default]
\definefontsynonym [SansItalic] [name:alegreyasansmediumitalic]
[features=default]
\definefontsynonym [SansBold]   [name:alegreyasansextrabold]   
[features=default]
\definefontsynonym [SansBoldItalic] [name:alegreyasansextrabolditalic] 
[features=default]
\stoptypescript

\starttypescript [alegreya,alegreya-light,alegreya-medium]

\definefallbackfamily[alegreya][serif][gentium][range={greekandcoptic,greekextended}]
\definetypeface [\typescriptone] [rm] [serif] [\typescriptone-serif] 
[default]
\definetypeface [\typescriptone] [ss] [sans]  [\typescriptone-sans]  
[default]
\definetypeface [\typescriptone] [tt] [mono]  [modern]   
[default]
\definetypeface [\typescriptone] [mm] [math]  [default]  
[default]
\stoptypescript

\stoptypescriptcollection
___
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

Re: [NTG-context] Fallback fails for Linux Libertine O to Junicode over private area, debugging?

2022-01-07 Thread Hans Hagen via ntg-context

On 1/7/2022 4:18 PM, J. P. Ascher via ntg-context wrote:


% Libertine with a Junicode fallback, lib-fb-jun
looks like there is some beta junicode two (i tried the variable font 
but the ttf crashes (no hvar table) and the otf also has issues so 
probably a bit too beta) .. maybe that font will cover what libertine has?


- ttf variable : crash (probably due to missing hvar or invalid deltas)
- otf variable : issues
- otf normal   : crash on italic due to stem problem
- ttf normal   : seems to work

(it makes no sense to add all kind of sanity checks for fonts with issues)

the font has a fi ligature but not as feature so you need to add it:

\startluacode
fonts.handlers.otf.addfeature {
name = "xlig",
type = "ligature",
data = {
[64257] = { "f", "i" },
}
}
\stopluacode

\definefontfeature[default][default][xlig=yes,dlig=yes] % is dflt defined ?

\setupbodyfont[junicode]

\starttext

% fi ligature in \char 64257 but not in liga feature

 Ik fiets op de stoep en dat mag niet. \blank
{\it Ik fiets op de stoep en dat mag niet.}\blank
{\bf Ik fiets op de stoep en dat mag niet.}\blank
{\bi Ik fiets op de stoep en dat mag niet.}\blank
\stoptext

attached a possible typescript file (patched from ws 2011 version)

anyway ... these fonts are probably to beta to be useful now although 
one needs users like you to test them and feedback


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
-%D \module
%D   [ file=type-junicode,
%D  version=2011.09.18,
%Dtitle=\CONTEXT\ Typescript Macros,
%D subtitle=Junicode Font Definitions,
%D   author=Wolfgang Schuster,
%D date=\currentdate,
%Dcopyright=Wolfgang Schuster,
%D  license=GNU General Public License]

% adapted by hh

\usetypescriptfile[texgyre]
\usetypescriptfile[dejavu]

\starttypescriptcollection [junicode]

% crash on data points / hvar inconsistency
%
% \definefontfeature[junicodebold][default]
%
% \definefontsynonym[junicoderegular][\s!file:junicodetwobetavf-roman.ttf]
% \definefontsynonym[junicodeitalic] [\s!file:junicodetwobetavf-italic.ttf]
%
% \starttypescript [\s!serif] [junicode]
% \definefontsynonym [Junicode-Regular]
[junicoderegular][\s!features=default]
% \definefontsynonym [Junicode-Italic] [junicodeitalic] 
[\s!features=default]
% \definefontsynonym [Junicode-Bold]   
[junicoderegular][\s!features={default,junicodebold}]
% \definefontsynonym [Junicode-BoldItalic] [junicodeitalic] 
[\s!features={default,junicodebold}]
% \stoptypescript

% italic crashes on stems in cff
%
% \starttypescript [\s!serif] [junicode]
% \definefontsynonym [Junicode-Regular]
[\s!file:junicodetwobeta-regular.otf]   [\s!features=\s!default]
% \definefontsynonym [Junicode-Italic] 
[\s!file:junicodetwobeta-italic.otf][\s!features=\s!default]
% \definefontsynonym [Junicode-Bold]   
[\s!file:junicodetwobeta-bold.otf]  [\s!features=\s!default]
% \definefontsynonym [Junicode-BoldItalic] 
[\s!file:junicodetwobeta-bolditalic.otf][\s!features=\s!default]
% \stoptypescript

\starttypescript [\s!serif] [junicode]
\definefontsynonym [Junicode-Regular]
[\s!file:junicodetwobeta-regular.ttf]   [\s!features=\s!default]
\definefontsynonym [Junicode-Italic] 
[\s!file:junicodetwobeta-italic.ttf][\s!features=\s!default]
\definefontsynonym [Junicode-Bold]   [\s!file:junicodetwobeta-bold.ttf] 
 [\s!features=\s!default]
\definefontsynonym [Junicode-BoldItalic] 
[\s!file:junicodetwobeta-bolditalic.ttf][\s!features=\s!default]
\stoptypescript

\starttypescript [\s!serif] [junicode]
\setups[\s!font:\s!fallback:\s!serif]
\definefontsynonym [\s!Serif]   [Junicode-Regular]   
[\s!features=\s!default]
\definefontsynonym [\s!SerifItalic] [Junicode-Italic]
[\s!features=\s!default]
\definefontsynonym [\s!SerifBold]   [Junicode-Bold]  
[\s!features=\s!default]
\definefontsynonym [\s!SerifBoldItalic] 
[Junicode-BoldItalic][\s!features=\s!default]
\stoptypescript

\starttypescript [junicode]
\definetypeface [junicode] [rm] [\s!serif] [junicode] [\s!default]
\definetypeface [junicode] [tt] [\s!mono]  [dejavu]   [\s!default]
\definetypeface [junicode] [mm] [\s!math]  [pagella]  [\s!default]
\quittypescriptscanning
\stoptypescript

\stoptypescriptcollection

\endinput
___
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
we

Re: [NTG-context] how to setup path of ConTeXtLMTX for MacVim?

2021-12-14 Thread Jan-Erik Hägglöf via ntg-context
>  1. Re: how to setup path of ConTeXtLMTX for MacVim?
>> (Jan-Erik Hägglöf)
>>  2. Re: circuitikz module seems broken (Hans Hagen)
>>  3. Re: TeXWorks and synctex SOLVED (Bruce Horrocks)
>> 
>> 
>> --
>> 
>> Message: 1
>> Date: Tue, 14 Dec 2021 00:48:25 +0100
>> From: Jan-Erik Hägglöf 
>> To: mailing list for ConTeXt users 
>> Subject: Re: [NTG-context] how to setup path of ConTeXtLMTX for
>>  MacVim?
>> Message-ID: <32566c08-2359-48df-b24c-2aa2e3d02...@gmail.com>
>> Content-Type: text/plain; charset="utf-8"
>> 
>> let g:context_mtxrun = 
>> 'PATH=$HOME/context/context-osx-64/tex/texmf-osx-64/bin:$PATH mtxrun'
>> 
>> nnoremap å :ConTeXt
>> nnoremap  ö :call tex#preview()
>> nnoremap  ä
>>   \ :call tex#goto_texshop(expand("%:p"), line('.'), col('.'), 1, 1)
>> 
>> Here is my snippet from my personal context.vim file
>> 
>> I see that you have :! and that means that you instruct vim to execute a 
>> shell command.
>> 
>> Just write :ConTeXt and it should work fine
>> 
>>> 13 dec. 2021 kl. 14:30 skrev Jeong Dal via ntg-context :
>>> 
>>> Dear John, Nicola,
>>> 
>>> I created a file context.vim under the folder ~/.vim/after/ftplugin/ which 
>>> contains
>>> 
>>> map > :w:!ConTeXt
>>> let g:context_mtxrun = 'PATH=$HOME/ConTeXtLM/tex/texmf-osx-64/bin:$PATH 
>>> mtxrun'
>>> let g:tex_flavor = "context"
>>> 
>>> The result is
>>> 1. using “:ConTeXt”   issued an error message:  “E492: not an editor 
>>> command: ConTeXt
>>> 2. using “make” issued an error message: "No targets specified and no 
>>> makefile found. …" 
>>> Pressing C-h, compiling started and succesfully ended. However, it use 
>>> /usr/local/texlive/… not LMTX tex folder.
>>> 
>>> Without context.vim, “:ConTeXt" and “:make" worked fine.
>>> 
>>> I’ll do more test. 
>>> 
>>> Thank you.
>>> Best regards,
>>> 
>>> Dalyoung
>>> 
>>> ___
>>> 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
>>> ___
>> 
>> -- next part --
>> An HTML attachment was scrubbed...
>> URL: 
>> <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20211214/d4e3531d/attachment-0001.htm>
>> 
>> --
>> 
>> Message: 2
>> Date: Tue, 14 Dec 2021 00:54:44 +0100
>> From: Hans Hagen 
>> To: mailing list for ConTeXt users , Aditya
>>  Mahajan 
>> Subject: Re: [NTG-context] circuitikz module seems broken
>> Message-ID: <41f06234-caab-6576-aa5e-8396c8ee3...@xs4all.nl>
>> Content-Type: text/plain; charset="utf-8"; Format="flowed"
>> 
>> Hi,
>> 
>> This works here:
>> 
>> \usemodule[circuitikz]
>> 
>> \starttext
>>\startcircuitikz
>>\draw (0,2) to[I] (2,2);
>>\stopcircuitikz
>>\startcircuitikz
>>\draw (0,2) to[I] (2,2);
>>\stopcircuitikz
>> \stoptext
>> 
>> with the attached. Make sure to put it in the regular context base path 
>> and run mtxrun --generate.
>> 
>> Aditya: can you check if we load enough? We really need to get rid of 
>> all these (kind of strange) t-* modules that somehow ended up in tikz 
>> and it's way easier and robust to occasionally add something needed to 
>> m-tikz than to try to catch hard-to-locate-and-fix stuff in the tikz 
>> distribution. If needed we can apply runtime patches too.
>> 
>> (nyw, it looks like tikz creates empty pfg files during a run but that's 
>> probbably has a reason)
>> 
>> Hans
>> 
>> -
>>  Hans Hagen | PRAGMA ADE
>>  Ridderstraat 27 | 8061 GH Hasselt | The N

Re: [NTG-context] how to setup path of ConTeXtLMTX for MacVim?

2021-12-14 Thread Jeong Dal via ntg-context
ething needed to 
> m-tikz than to try to catch hard-to-locate-and-fix stuff in the tikz 
> distribution. If needed we can apply runtime patches too.
> 
> (nyw, it looks like tikz creates empty pfg files during a run but that's 
> probbably has a reason)
> 
> 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
> -
> -- next part --
> %D \module
> %D   [   file=m-tikz,
> %Dversion=2021.07.12,
> %D  title=\CONTEXT\ Extra Modules,
> %D   subtitle=TIKZ support,
> %D author=Hans Hagen,
> %D   date=\currentdate,
> %D  copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
> %C
> %C This module is part of the \CONTEXT\ macro||package and is
> %C therefore copyrighted by \PRAGMA. See mreadme.pdf for
> %C details.
> 
> %D A fixed variant of the t-tikz module distributed with tikz. For practical 
> reasons
> %D per 2021 we split the module for \MKIV\ and \LMTX. (Maybe some day I'll 
> optimize
> %D TIKZ a bit.)
> %D
> %D All these t-* modules in the tikz distribution make no sense as we can 
> just load
> %D them here which is way cleaner. There is also some mkii filename mapping 
> going on
> %D that is not needed on todays systems (windows has no 8.3 limitation and on 
> unix
> %D tds finally adopted a case insensitive approach.)
> 
> %D Just in case someone does a hard input ...
> 
> \ifdefined\pgfdefined\endinput \fi
> \ifdefined\pgfcoredefined\endinput \fi
> 
> %D ... but normally we end up here:
> 
> \startmodule[tikz]
> 
> \ifdefined\pdflastxpos \else
>\unprotect
>
> \frozen\overloaded\protected\def\pdflastxpos{\numexpr\clf_lastxpos\relax}
>
> \frozen\overloaded\protected\def\pdflastypos{\numexpr\clf_lastypos\relax}
>\protect
> \fi
> 
> \permanent\protected\def\starttikzinput
>  {\pushoverloadmode
>   \pushcatcodetable
>   \setcatcodetable\texcatcodes
>   \catcode`\@=11
>   \catcode`\|=12
>   \catcode`\!=12
>   \autoparagraphmode\zerocount}
> 
> \permanent\protected\def\stoptikzinput
>  {\autoparagraphmode\plusone
>   \popcatcodetable
>   \popoverloadmode}
> 
> \permanent\protected\def\tikzinputfile#1%
>  {\starttikzinput
>   \input{#1}\relax
>   \stoptikzinput}
> 
> \permanent\protected\def\tikzerrormessage#1#2#3%
>  {\writestatus{#1}{#2}}
> 
> % For now we need this but we need to educate the user to wrap settings in the
> % wrappers. So some day the next line will go. I need to check what commands 
> are
> % possible outside a picture.
> 
> \overloadmode\zerocount
> 
> \permanent\protected\def\starttikzsettings
>  {\pushoverloadmode
>   \autoparagraphmode\zerocount}
> 
> \permanent\protected\def\stoptikzsettings
>  {\autoparagraphmode\plusone
>   \popoverloadmode}
> 
> \permanent\protected\def\starttikzpicture
>  {\dontleavehmode
>   \hcontainer\bgroup
>   \autoparagraphmode\zerocount
> % \pushoverloadmode
>   \ifdefined\PackageError\else \let\PackageError\tikzerrormessage \fi
>   \tikzpicture}
> 
> \permanent\protected\def\stoptikzpicture
>  {\endtikzpicture
> % \popoverloadmode
>   \egroup}
> 
> \let\pgfdefined\relax
> \let\pgfcoredefined\relax
> 
> \tikzinputfile{pgfutil-common.tex}
> \tikzinputfile{pgfutil-context.def}
> \tikzinputfile{pgfrcs.code.tex}
> \tikzinputfile{pgfsys.code.tex}
> \tikzinputfile{pgfkeys.code.tex}
> \tikzinputfile{pgfsyssoftpath.code.tex}
> \tikzinputfile{pgfsysprotocol.code.tex}
> \tikzinputfile{pgfcore.code.tex}
> \tikzinputfile{pgffor.code.tex}
> \tikzinputfile{pgfmoduleplot.code.tex}
> \tikzinputfile{tikz.code.tex}
> 
> \let\startpgfpicture \pgfpicture  \let\stoppgfpicture 
>\endpgfpicture
> \let\startpgfscope   \pgfscope\let\stoppgfscope   
>\endpgfscope
> \let\startpgflowlevelscope   \pgflowlevelscope
> \let\stoppgflowlevelscope  \endpgflowlevelscope
> \let\startpgfinterruptpath   \pgfinterruptpath    
> \let\stoppgfinterruptpath  \endpgfinterruptpath
> \let\startpgfinterruptpicture\pgfinterruptpicture 
> \let\stoppgfinterruptpicture   \endpgfinterruptpicture
> \let\startpgfinterruptboundingbox\pgfinterruptboundinbox  
> \let\stoppgfinterruptboudingbox\endpgfinterruptboundingbox
> 
> \let\normalusepgfmodule\usepgfmodule
> \let\normalusepgflibrary\usepgfl

Re: [NTG-context] circuitikz module seems broken

2021-12-13 Thread Hans Hagen via ntg-context

Hi,

This works here:

\usemodule[circuitikz]

\starttext
\startcircuitikz
\draw (0,2) to[I] (2,2);
\stopcircuitikz
\startcircuitikz
\draw (0,2) to[I] (2,2);
\stopcircuitikz
\stoptext

with the attached. Make sure to put it in the regular context base path 
and run mtxrun --generate.


Aditya: can you check if we load enough? We really need to get rid of 
all these (kind of strange) t-* modules that somehow ended up in tikz 
and it's way easier and robust to occasionally add something needed to 
m-tikz than to try to catch hard-to-locate-and-fix stuff in the tikz 
distribution. If needed we can apply runtime patches too.


(nyw, it looks like tikz creates empty pfg files during a run but that's 
probbably has a reason)


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
-%D \module
%D   [   file=m-tikz,
%Dversion=2021.07.12,
%D  title=\CONTEXT\ Extra Modules,
%D   subtitle=TIKZ support,
%D author=Hans Hagen,
%D   date=\currentdate,
%D  copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

%D A fixed variant of the t-tikz module distributed with tikz. For practical 
reasons
%D per 2021 we split the module for \MKIV\ and \LMTX. (Maybe some day I'll 
optimize
%D TIKZ a bit.)
%D
%D All these t-* modules in the tikz distribution make no sense as we can just 
load
%D them here which is way cleaner. There is also some mkii filename mapping 
going on
%D that is not needed on todays systems (windows has no 8.3 limitation and on 
unix
%D tds finally adopted a case insensitive approach.)

%D Just in case someone does a hard input ...

\ifdefined\pgfdefined\endinput \fi
\ifdefined\pgfcoredefined\endinput \fi

%D ... but normally we end up here:

\startmodule[tikz]

\ifdefined\pdflastxpos \else
\unprotect

\frozen\overloaded\protected\def\pdflastxpos{\numexpr\clf_lastxpos\relax}

\frozen\overloaded\protected\def\pdflastypos{\numexpr\clf_lastypos\relax}
\protect
\fi

\permanent\protected\def\starttikzinput
  {\pushoverloadmode
   \pushcatcodetable
   \setcatcodetable\texcatcodes
   \catcode`\@=11
   \catcode`\|=12
   \catcode`\!=12
   \autoparagraphmode\zerocount}

\permanent\protected\def\stoptikzinput
  {\autoparagraphmode\plusone
   \popcatcodetable
   \popoverloadmode}

\permanent\protected\def\tikzinputfile#1%
  {\starttikzinput
   \input{#1}\relax
   \stoptikzinput}

\permanent\protected\def\tikzerrormessage#1#2#3%
  {\writestatus{#1}{#2}}

% For now we need this but we need to educate the user to wrap settings in the
% wrappers. So some day the next line will go. I need to check what commands are
% possible outside a picture.

\overloadmode\zerocount

\permanent\protected\def\starttikzsettings
  {\pushoverloadmode
   \autoparagraphmode\zerocount}

\permanent\protected\def\stoptikzsettings
  {\autoparagraphmode\plusone
   \popoverloadmode}

\permanent\protected\def\starttikzpicture
  {\dontleavehmode
   \hcontainer\bgroup
   \autoparagraphmode\zerocount
 % \pushoverloadmode
   \ifdefined\PackageError\else \let\PackageError\tikzerrormessage \fi
   \tikzpicture}

\permanent\protected\def\stoptikzpicture
  {\endtikzpicture
 % \popoverloadmode
   \egroup}

\let\pgfdefined\relax
\let\pgfcoredefined\relax

\tikzinputfile{pgfutil-common.tex}
\tikzinputfile{pgfutil-context.def}
\tikzinputfile{pgfrcs.code.tex}
\tikzinputfile{pgfsys.code.tex}
\tikzinputfile{pgfkeys.code.tex}
\tikzinputfile{pgfsyssoftpath.code.tex}
\tikzinputfile{pgfsysprotocol.code.tex}
\tikzinputfile{pgfcore.code.tex}
\tikzinputfile{pgffor.code.tex}
\tikzinputfile{pgfmoduleplot.code.tex}
\tikzinputfile{tikz.code.tex}

\let\startpgfpicture \pgfpicture  \let\stoppgfpicture   
 \endpgfpicture
\let\startpgfscope   \pgfscope\let\stoppgfscope 
 \endpgfscope
\let\startpgflowlevelscope   \pgflowlevelscope
\let\stoppgflowlevelscope  \endpgflowlevelscope
\let\startpgfinterruptpath   \pgfinterruptpath
\let\stoppgfinterruptpath  \endpgfinterruptpath
\let\startpgfinterruptpicture\pgfinterruptpicture 
\let\stoppgfinterruptpicture   \endpgfinterruptpicture
\let\startpgfinterruptboundingbox\pgfinterruptboundinbox  
\let\stoppgfinterruptboudingbox\endpgfinterruptboundingbox

\let\normalusepgfmodule\usepgfmodule
\let\normalusepgflibrary\usepgflibrary

\tolerant\protected\def\usepgfmodule[#1]#;#2% somehow both variants are used
  {\starttikzinput
   \normalusepgfmodule[#1#2]%
   \stoptikzinput}

\tolerant\protected\def\us

Re: [NTG-context] [DKIM] Re: [DKIM] circuitikz module seems broken

2021-12-06 Thread Hans Hagen via ntg-context

On 12/6/2021 6:39 PM, Aditya Mahajan via ntg-context wrote:

On Mon, 6 Dec 2021, Aditya Mahajan via ntg-context wrote:


Something is still not working correctly though. With the simple example that 
Hans sent, I get error messages:

tex error   > tex error on line 76 in file m-circuitikz.mkxl: Package 
pgfkeys Error: I do not know the key '/tikz/resistor', to which you passed 
'american', and I am going to ignore it. Perhaps you misspelled it

which are weird because tikz is looking at keys tikz/resistor rather than 
tikz/circuittikz/resistor. But I don't understand why this is the case.


Here is a minimal example to show the error.

\usemodule[m][tikz]

\tikzinputfile{pgfcirc.defines.tex}
\tikzinputfile{pgfcircbipoles.tex}

\starttext
\bgroup
\loggingall
\ctikzset{resistor=american}
\egroup
\stoptext

which gives the error

tex error   > tex error on line 10 in file ./t2.tex: Package pgfkeys Error: 
I do not know the key '/tikz/resistor', to which you passed 'american', and I am 
going to ignore it. Perhaps you misspelled it


different error here ... i need to load more files


The file pgfcirc.defines.tex has:

\def\circuitikzbasekey{/tikz/circuitikz}
\pgfkeys{\circuitikzbasekey/.is family}
\def\circuitikzset{\expandafter\pgfqkeys\expandafter{\circuitikzbasekey}}
\let\ctikzset\circuitikzset


The file pgfcircbipoles.tex has the code:

\newif\ifpgf@circuit@europeanresistor
\ctikzset{resistor/.is choice}
\ctikzset{resistor/american/.code = \pgf@circuit@europeanresistorfalse }
\ctikzset{resistor/european/.code = \pgf@circuit@europeanresistortrue }
\tikzset{american resistors/.style = {\circuitikzbasekey/resistor = american}}
\tikzset{european resistors/.style = {\circuitikzbasekey/resistor = european}}%

So, the key which is defined is \circuitikzbasekey/resistor. Not sure why 
pgfkeys is searching for tikz/resistor.


don't worry ... i'm even less sure ... one needs a bit different mindset 
for that kind of tex code (all can be fixed i guess but when it's not 
context specific it makes more sense to let the maintainer do it)


ths only difference wrt tikz between mkiv and mkxl is that we have 
different defaults wrt par handling (afaik both have the same catcode 
settings here) and i don't think tikz uses anything low level context



@Hans, does the above code work correctly for you? If so, then we can wait 
until the next upload and test again.

with the attached:

\usemodule[m][circuitikz]

\starttext
\starttikzsettings % to be sure
\ctikzset{resistor=american}
\stoptikzsettings
\stoptext

that works (tons of files loaded) here but nothing graphic

(for those whio try: make sure that the t-* variants are gone)

i see it loading other t-* files so maybe we should more that code to 
the m-* files too ... easier to maintain that way .. and if we have a 
few (not too slow) test files in the test suite it's easier to see when 
/ why something fails


if it doesn't at your end we need to define 'how to install the right 
(circuit)tikz stuff' and 'from where'


(btw, does it all work ok in mkiv? after all, that hasn't changed for a 
while)


Hans


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
-%D \module
%D   [   file=m-tikz,
%Dversion=2021.07.12,
%D  title=\CONTEXT\ Extra Modules,
%D   subtitle=TIKZ support,
%D author=Hans Hagen,
%D   date=\currentdate,
%D  copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

%D A fixed variant of the t-tikz module distributed with tikz. For
%D practical reasons per 2021 we split the module for \MKIV\ and
%D \LMTX. (Maybe some day I'll optimize TIKZ a bit.)

\ifdefined\pdflastxpos \else
\unprotect

\frozen\overloaded\protected\def\pdflastxpos{\numexpr\clf_lastxpos\relax}

\frozen\overloaded\protected\def\pdflastypos{\numexpr\clf_lastypos\relax}
\protect
\fi

\permanent\protected\def\starttikzinput
  {\pushoverloadmode
   \pushcatcodetable
   \setcatcodetable\texcatcodes
   \unprotect
   \catcode`\@=11
   \catcode`\|=12
   \catcode`\!=12
   \autoparagraphmode\zerocount}

\permanent\protected\def\stoptikzinput
  {\autoparagraphmode\plusone
   \protect
   \popcatcodetable
   \popoverloadmode}

\permanent\protected\def\tikzinputfile#1%
  {\starttikzinput
   \input{#1}\relax
   \stoptikzinput}

\tikzinputfile{t-pgf.tex}
\tikzinputfile{t-pgffor.tex}
\tikzinputfile{tikz.code.tex}

\permanent\protected\def\tikzerrormessage#1#2#3%
  {\writestatus{#1}{#2}}

% For now we need

Re: [NTG-context] [DKIM] Re: [DKIM] circuitikz module seems broken

2021-12-03 Thread Hans Hagen via ntg-context

On 12/3/2021 3:47 PM, Aditya Mahajan via ntg-context wrote:

On Fri, 3 Dec 2021, Hans Hagen via ntg-context wrote:


On 12/3/2021 10:49 AM, Hans Hagen via ntg-context wrote:


I’ve been struggeling with the circuitikz module since my upgrade to
LMTX.

btw, We can have more 'catches' in the loader (t) module if needed. In
any case, also check if things work with mkiv.


I tested the example on mkiv, I got error that dipchip and fliflop JK are not defined. 
The file compiles if I comment those out. But in LMTX, I also get a "missing 
semicolon" error. There is also this warning, which may have something to do with 
what is going wrong:

system  > module wrapping error in 'tikz'

The error appears to be related to keyword arguments. The following example 
works:

 \usemodule[circuitikz]
 \starttext
 \startcircuitikz
 \draw (0,2) to[I] (2,2) ;
 \stopcircuitikz
 \stoptext

But this does not:

 \usemodule[circuitikz]
 \starttext
 \startcircuitikz
 \draw (0,2) to[I=1] (2,2) ;
 \stopcircuitikz
 \stoptext

can you test the attached ... this works here

\usemodule[circuitikz]
% \usemodule[tikz]

\starttext

\starttikzpicture
\draw (0,2) -- (2,2) ;
\stoptikzpicture

\startcircuitikz
\draw (0,2) to[I=1] (2,2) ;
\stopcircuitikz

\stoptext



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
-%D \module
%D   [   file=m-circuitikz,
%Dversion=2021.12.03,
%D  title=\CONTEXT\ Extra Modules,
%D   subtitle=CURCUITIKZ support,
%D author=Hans Hagen,
%D   date=\currentdate,
%D  copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

%D A fixed variant of the t-curcuitikz module distributed with tikz. This one
%D is for \LMTX.

\usemodule[m][tikz]

\startmodule[circuitikz]

\def\pgfcircversion {1.4.4}
\def\pgfcircversiondate {2021/10/31}

\usetikzlibrary[calc]
\usetikzlibrary[arrows.meta, bending]
\usetikzlibrary[fpu] % may be needed for use fpu reciprocal (v1.0.1)

\tikzinputfile{pgfcirc.defines.tex}
\tikzinputfile{pgfcircutils.tex}
\tikzinputfile{pgfcircpath.tex}

\tikzinputfile{pgfcircshapes.tex}
\tikzinputfile{pgfcircmonopoles.tex}
\tikzinputfile{pgfcircbipoles.tex}
\tikzinputfile{pgfcirctripoles.tex}
\tikzinputfile{pgfcircquadpoles.tex}
\tikzinputfile{pgfcircmultipoles.tex}

\tikzinputfile{pgfcirclabel.tex}
\tikzinputfile{pgfcircvoltage.tex}
\tikzinputfile{pgfcirccurrent.tex}
\tikzinputfile{pgfcircflow.tex}

% defaults

\setupmodule
  [current=european,
   voltage=european,
   resistor=american,
   inductor=cute,
   logic=american,
   siunitx=true,
   arrowmos=false]

% can be done nicer ... todo

\processaction
  [\currentmoduleparameter{voltage}]
  [european=>\ctikzset{voltage=european},
   american=>\ctikzset{voltage=american}]

\processaction
  [\currentmoduleparameter{current}]
  [european=>\ctikzset{ current=european},
   american=>\ctikzset{ current=american}]

\processaction
  [\currentmoduleparameter{label}]
  [straight=>\ctikzset{label/align = straight},
   align=>\ctikzset{label/align = rotate},
   smart=>\ctikzset{label/align = smart}]

\processaction
  [\currentmoduleparameter{resistor}]
  [european=>\ctikzset{ resistor=european},
   american=>\ctikzset{ resistor=american}]

\processaction
  [\currentmoduleparameter{inductor}]
  [european=>\ctikzset{ inductor=european},
   american=>\ctikzset{ inductor=american},
   cute=>\ctikzset{ inductor=cute}]

\processaction
  [\currentmoduleparameter{diode}]
  [full=>\ctikzset{ diode=full},
   empty=>\ctikzset{ diode=empty}]

\processaction
  [\currentmoduleparameter{logic}]
  [european=>\ctikzset{ logic ports=european},
   american=>\ctikzset{ logic ports=american}]

% hm, we have units built in and in mkii one can load the units module
% ... always been so ...

\processaction
  [\currentmoduleparameter{siunitx}]
  [true=>\def\SI#1#2{#1\,#2}
 \def\ampere{\rm{A}}
 \def\volt  {\rm{V}}
 \def\ohm   {\Omega}
 \def\siemens   {\rm{S}}
 \def\farad {\rm{F}}
 \def\henry {\rm{H}}
 \def\second{\rm{s}}
 \def\coulomb   {\rm{C}}
 \def\siemens   {\rm{S}}
 \def\radians   {\rm{rad}}
 \def\milli {\rm{m}}
 \def\micro {\mu}
 \def\nano  {\rm{n}}
 \def\pico  {\rm{p}}
 \def\kilo  {\rm{k}}
 \def\mega  {\rm{M}}
 \def\giga  {\rm{G}}
 \def\tera  {\rm{T}}]

\unprotect

\

Re: [NTG-context] some ConTeXt distribution's Fonts don't work

2021-10-24 Thread Wolfgang Schuster via ntg-context

Luis Montgomery via ntg-context schrieb am 22.10.2021 um 21:13:

Apparently, almfixed and kurier fonts no longer load as before.


The ALM Fixed font can't be used because there is no typescript file
to use it in a document.

The Kurier fonts have an existing typescript file but it can't be used 
because a) it refers to the font files in Type1 format which are shipped 
with ConTeXt but the metric files (*.afm) are missing and b) there are 
no typeface definition (\definetypeface) to load the typescripts.


Attached are new typescript files for ALM Fixed and Kurier, you can use 
both of them to test if everything works as expected.


Wolfgang


%D \module
%D   [   file=type-imp-kurier,
%Dversion=2021.10.24,
%D  title=\CONTEXT\ Typescript Macros,
%D   subtitle=Kurier,
%D author=Hans Hagen,
%D   date=\currentdate,
%D  copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\starttypescriptcollection [kurier]

\starttypescript [\s!sans] [kurier-light,kurier,kurier-medium]
\definefontsynonym [Kurier-Light][\s!file:kurierlightregular]  
[\s!features=\s!default]
\definefontsynonym [Kurier-LightItalic]  [\s!file:kurierlightitalic]   
[\s!features=\s!default]
\definefontsynonym [Kurier-Regular]  [\s!file:kurierregular]   
[\s!features=\s!default]
\definefontsynonym [Kurier-Italic]   [\s!file:kurieritalic]
[\s!features=\s!default]
\definefontsynonym [Kurier-Medium]   [\s!file:kuriermediumregular] 
[\s!features=\s!default]
\definefontsynonym [Kurier-MediumItalic] [\s!file:kuriermediumitalic]  
[\s!features=\s!default]
\definefontsynonym [Kurier-Bold] [\s!file:kurierbold]  
[\s!features=\s!default]
\definefontsynonym [Kurier-BoldItalic]   [\s!file:kurierbolditalic]
[\s!features=\s!default]
\definefontsynonym [Kurier-Heavy][\s!file:kurierheavyregular]  
[\s!features=\s!default]
\definefontsynonym [Kurier-HeavyItalic]  [\s!file:kurierheavyitalic]   
[\s!features=\s!default]
\stoptypescript

\starttypescript [\s!sans] [kurier-lightcond,kurier-cond,kurier-mediumcond]
\definefontsynonym [Kurier-CondLight]
[\s!file:kuriercondlightregular]  [\s!features=\s!default]
\definefontsynonym [Kurier-CondLightItalic]  
[\s!file:kuriercondlightitalic]   [\s!features=\s!default]
\definefontsynonym [Kurier-CondRegular]  
[\s!file:kuriercondregular]   [\s!features=\s!default]
\definefontsynonym [Kurier-CondItalic]   [\s!file:kurierconditalic] 
   [\s!features=\s!default]
\definefontsynonym [Kurier-CondMedium]   
[\s!file:kuriercondmediumregular] [\s!features=\s!default]
\definefontsynonym [Kurier-CondMediumItalic] 
[\s!file:kuriercondmediumitalic]  [\s!features=\s!default]
\definefontsynonym [Kurier-CondBold] [\s!file:kuriercondbold]   
   [\s!features=\s!default]
\definefontsynonym [Kurier-CondBoldItalic]   
[\s!file:kuriercondbolditalic][\s!features=\s!default]
\definefontsynonym [Kurier-CondHeavy]
[\s!file:kuriercondheavyregular]  [\s!features=\s!default]
\definefontsynonym [Kurier-CondHeavyItalic]  
[\s!file:kuriercondheavyitalic]   [\s!features=\s!default]
\stoptypescript

\starttypescript [\s!sans] [kurier-light]
\setups[\s!font:\s!fallback:\s!sans]
\definefontsynonym [\s!Sans]   [Kurier-Light]
\definefontsynonym [\s!SansItalic] [Kurier-LightItalic]
\definefontsynonym [\s!SansBold]   [Kurier-Medium]
\definefontsynonym [\s!SansBoldItalic] [Kurier-MediumItalic]
\stoptypescript

\starttypescript [\s!sans] [kurier]
\setups[\s!font:\s!fallback:\s!sans]
\definefontsynonym [\s!Sans]   [Kurier-Regular]
\definefontsynonym [\s!SansItalic] [Kurier-Italic]
\definefontsynonym [\s!SansBold]   [Kurier-Bold]
\definefontsynonym [\s!SansBoldItalic] [Kurier-BoldItalic]
\stoptypescript

\starttypescript [\s!sans] [kurier-medium]
\setups[\s!font:\s!fallback:\s!sans]
\definefontsynonym [\s!Sans]   [Kurier-Medium]
\definefontsynonym [\s!SansItalic] [Kurier-MediumItalic]
\definefontsynonym [\s!SansBold]   [Kurier-Heavy]
\definefontsynonym [\s!SansBoldItalic] [Kurier-HeavyItalic]
\stoptypescript

\starttypescript [\s!sans] [kurier-lightcond]
\setups[\s!font:\s!fallback:\s!sans]
\definefontsynonym [\s!Sans]   [Kurier-CondLight]
\definefontsynonym [\s!SansItalic] [Kurier-CondLightItalic]
\definefontsynonym [\s!SansBold]   [Kurier-CondMedium]
\definefontsynonym [\s!SansBoldItalic] [Kurier-CondMediumItalic]
\stoptypescript

\start

Re: [NTG-context] ligature exceptions

2021-07-28 Thread Hans Hagen via ntg-context
 head = 
replace(head,wordstart,prevend,prevfinal,hasspace,overload)
end
prevfinal = false
root = false
end
mode = "word"
end
elseif mode == "word" then
if punc then
if root then
local final = root.final
if final then
head = 
replace(head,wordstart,wordend,final,hasspace,overload)
elseif prevfinal then
head = 
replace(head,wordstart,prevend,prevfinal,hasspace,overload)
end
prevfinal = false
root = false
end
mode = "punc"
end
else
mode = punc and "punc" or "word"
end
if root then
root = root[char]
if root then
wordend = current
end
else
if prevfinal then
head = 
replace(head,wordstart,prevend,prevfinal,hasspace,overload)
prevfinal = false
end
root = tree[char]
if root then
wordstart = current
wordend   = current
prevend   = false
hasspace  = false
end
end
else
root= false
end
else
tree = false
end
current = getnext(current)
elseif root then
local final = root.final
if mode == "word" and id == glue_code then
local s = getsubtype(current)
if s == spaceskip_code or s == xspaceskip_code then
local r = root[32] -- maybe more types
if r then
if not prevend then
local f = root.final
if f then
prevend   = wordend
prevfinal = f
end
end
wordend  = current
root = r
hasspace = true
goto moveon
end
end
end
if final then
head, current = 
replace(head,wordstart,wordend,final,hasspace,overload)
elseif prevfinal then
head, current = 
replace(head,wordstart,prevend,prevfinal,hasspace,overload)
end
prevfinal = false
root = false
  ::moveon::
current = getnext(current)
else
current = getnext(current)
end
end
if root then
local final = root.final
if final then
head = replace(head,wordstart,wordend,final,hasspace,overload)
elseif prevfinal then
head = replace(head,wordstart,prevend,prevfinal,hasspace,overload)
end
end
return head
end

local enabled = false

function replacements.set(n)
if n == v_reset then
n = unsetvalue
else
n = lists[n].attribute
if not enabled then
enableaction("processors","languages.replacements.handler")
if trace_replacements then
report_replacement("enabling replacement handler")
end
enabled = true
end
end
texsetattribute(a_replacements,n)
end

-- interface

implement {
name  = "setreplacements",
actions   = replacements.set,
arguments = "string"
}

implement {
name  = "addreplacements",
actions   = replacements.add,
arguments = "3 strings",
}

implement {
name  = "addreplacementslist",
actions   = replacements.addlist,
arguments = "2 strings",
}
%D \module
%D   [   file=lang-rep,
%Dversion=2013.04.28,
%D  title=\CONTEXT\ Language Macros,
%D   subtitle=Substitution,
%D author=Hans Hagen,
%D   date=\currentdate,
%D  copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

%D As I needed an example of messing with nodes for 

[NTG-context] date formatting

2021-07-18 Thread Hans van der Meer

From Wikipedia:

In English-language  
outside North America (mostly in Anglophone Europe and some countries in 
Australasia), full dates are written as 7 December 1941 (or 7th December 1941) 
and spoken as "the seventh of December, nineteen forty-one" (exceedingly common 
usage of "the" and "of"), with the occasional [my emphasis] usage of December 
7, 1941 ("December the seventh, nineteen forty-one"). In common with most 
continental European usage, however, all-numeric dates are invariably ordered 
dd/mm/.

From this I infer that \language[en] or \language[en-gb] should format dates 
normally in day-month-year order, reserving mont-day-year for \language[us] 
i.e. language[en-us].

But in ConTeXt both \language[en] and \language[en-gb] produce the us ordering 
for \currentdate. I would be pleased if ConTeXt could be changed to the above 
mentioned normal behaviour for english. That is [en] and [en-gb] produce the 
day-month-year order and that [us] and [en-us] month-day-year.

dr. Hans van der Meer


___
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] Missing symb-imp-was.mkiv ?

2021-07-10 Thread Hans Hagen

On 7/10/2021 8:24 AM, Ramkumar KB wrote:

Hello,

I am trying to follow the steps described here for using \usesymbols 
<https://wiki.contextgarden.net/Command/usesymbols>[was] and details 
described here -
https://wiki.contextgarden.net/Symbols/was 
<https://wiki.contextgarden.net/Symbols/was>


Looks like the file `symb-imp-was.mkiv` is missing from the path -

\tex\texmf-context\tex\context\base\mkiv

Thank you for any tips or pointers.
The wiki page actually mentiones jmn symbols but these are by (the late) 
Januz so that should be corrected.


Anyway, the wasy font symbol setup was never converted to mkiv so 
attached is a draft.


Up to you to complete it. From CTAN, download the type one package and 
put the afm and pfb files under (e.g.) texmf-fonts/fonts/data/wasy (no 
need for subdirs) and run "mtxrun --generate" to update the file database.


You can look in the afm files to see what names are provided.

It looks like the files were updated in 2020 (taco is mentiones). Rhaban 
made the mkii file so you can consult him. I advice to stick to the 
regular symbols not the weirdly composed ones.


You can patch the file and send me the result. You can 'run the file' in 
order to get the overview. You should see at least most symbols.


So ... work to do ...

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
-
%D \module
%D   [   file=symb-was,
%Dversion=2005.10.15,
%D  title=\CONTEXT\ Symbol Libraries,
%D   subtitle=Roland Waldi's Symbols (wasy-2),
%D author=Henning Hraban Ramm,
%D   date=\currentdate,
%D  copyright={Public Domain}]
%C
%C This module is in the public domain.

%D Converted to \MKIV\ by Hans but not yet complete.

\unprotect

\definefontsynonym [WaldiSymbol] [wasy10]
\definefontsynonym [WaldiSymbolBold] [wasyb10]

% \def\wasy@over#1#2{{\setbox0\hbox{$#2$}\hbox to 
\wd0{\hss$#1$\hss}\kern-\wd0\box0}}

\def\WaldiSymbol  {\getnamedglyphdirect{WaldiSymbol}} % #1
\def\WaldiSymbol#1{\getglyph{WaldiSymbol}{\fontchar{#1}}}

% general symbols

\startsymbolset [wasy general]
\definesymbol [male][\WaldiSymbol{male}]
\definesymbol [female]  [\WaldiSymbol{female}]
\definesymbol [currency][\WaldiSymbol{currency}]
\definesymbol [cent][\WaldiSymbol{cent}]
\definesymbol [lozenge] [\WaldiSymbol{lozenge}]
\definesymbol [kreuz]   [\WaldiSymbol{kreuz}]
\definesymbol [smiley]  [\WaldiSymbol{smiley}]
\definesymbol [blacksmiley] [\WaldiSymbol{blacksmil}]
\definesymbol [frownie] [\WaldiSymbol{frownie}]
\definesymbol [sun] [\WaldiSymbol{sun}]
\definesymbol [checked] [\WaldiSymbol{checked}]
\definesymbol [brokenvert]  [\WaldiSymbol{brokenver}]
\definesymbol [diameter][\WaldiSymbol{diameter}]
\definesymbol [invdiameter] [\WaldiSymbol{invdiamet}]
\definesymbol [phone]   [\WaldiSymbol{phone}]
\definesymbol [recorder][\WaldiSymbol{recorder}]
\definesymbol [clock]   [\WaldiSymbol{clock}]
\definesymbol [permil]  [\WaldiSymbol{permil}]
\definesymbol [bell][\WaldiSymbol{bell}]
\definesymbol [ataribox][\WaldiSymbol{ataribox}]
\definesymbol [pointer] [\WaldiSymbol{pointer}]
\definesymbol [lightning]   [\WaldiSymbol{lightning}]
\definesymbol [agemO]   [\WaldiSymbol{agemO}]
\stopsymbolset

\startsymbolset [wasy music]
\definesymbol [eighthnote]  [\WaldiSymbol{eighthnote}]
\definesymbol [quarternote] [\WaldiSymbol{quarternote}]
\definesymbol [halfnote][\WaldiSymbol{halfnote}]
\definesymbol [fullnote][\WaldiSymbol{fullnote}]
\definesymbol [twonotes][\WaldiSymbol{twonotes}]
\stopsymbolset

\startsymbolset [wasy astronomy]
\definesymbol [ascnode] [\WaldiSymbol{ascnode}]
\definesymbol [descnode][\WaldiSymbol{descnode}]
\definesymbol [astrosun][\WaldiSymbol{astrosun}]
\definesymbol [sun] [\WaldiSymbol{sun}]
\definesymbol [newmoon] [\WaldiSymbol{newmoon}]
\definesymbol [fullmoon][\WaldiSymbol{fullmoon}]
\definesymbol [rightmoon]   [\WaldiSymbol{rightmoon}]
\definesymbol [leftmoon][\WaldiSymbol{leftmoon}]
\definesymbol [vernal]  [\WaldiSymbol{vernal}]
\definesymbol [mercury] [\WaldiSymbol{mercury}]
\definesymbol [mars][\WaldiSymbol{mars}]
\definesymbol [saturn]  [\WaldiSymbol{saturn}]
\definesymbol [neptune] [\WaldiSymbol{neptune}]
\definesymbol [earth]   [\WaldiSymbol{earth}]
\definesymbol [venus]   [\WaldiSymbol{venus}]
\definesymbol [jupiter] [\WaldiSymbol{jupiter}]
\definesymbol [uranus]  [\WaldiSym

Re: [NTG-context] Hand Style Sketching in Metapost

2021-05-20 Thread Aditya Mahajan
On Thu, 20 May 2021, Jeroen wrote:

> I have the following working example with hatching. This works fine, but
> when I uncomment the sketching commands, no figure is rendered. Is the
> mp-sketch macro still working?

Seems to be working here with LMTX ver. 2021.04.29. See attached.

Aditya

hatch.pdf
Description: Adobe PDF document


hatch.tex
Description: TeX document
%D \module
%D   [   file=mp-sketch.mp
%Dversion=2021.05.13
%D  title=\CONTEXT\ \METAPOST\ graphics,
%D   subtitle=Sketch drawing,
%D author=Aditya Mahajan,
%D   date=\currentdate,
%D  copyright={Aditya Mahajan}]

%D This metapost module is inspired by a TeX.SE question:
%D http://tex.stackexchange.com/q/39296/323
%D
%D I thought that it would be fun to implement a similar feature in MetaPost.
%D
%D To use this package in MetaPost:
%D
%D \starttyping
%Dinput mp-sketch;
%D
%Dbeginfig(1)
%D  sketchypaths; % Make draw and fill sketchy
%D  ...
%D  naturalizepaths; % Restore the value of draw and fill
%D  ...
%Dendfig
%D \stoptyping
%D
%D The code is heavily inspired by Hans Hagen's Metafun macros.
%D
%D The macro \type{sketchypaths} is modeled after \type{visualizepaths} from
%D \filename{mp-tool}.

def sketchypaths =
let draw = sketchdraw ;
let fill = sketchfill ;
enddef ;

%D Check if \filename{mp-tool} is loaded
if not known context_tool :
  let normaldraw = draw;
  let normalfill = fill;

  def naturalizepaths =
  let fill = normalfill ;
  let draw = normaldraw ;
  enddef ;
fi

%D The variable \type{sketch_amount} determines the amount of randomness in the
%D drawing
numeric sketch_amount; sketch_amount := 0.75bp;

%D The variable \type{sketch_passes} determines the number of times the path
%D is drawn
numeric sketch_passes; sketch_passes := 1;

%D Based on \type{randomized}. Assumes p is path:
numeric sketch_segments; sketch_segments := 20;

primarydef p sketchrandomized s = (
if path p :
for t = 0 step 1/sketch_segments until 1-1/sketch_segments : 
((point   (t*arclength(p)) on p) 
randomshifted s) .. controls
((postcontrol (t*arclength(p)) on p) 
randomshifted s) and
((precontrol  ((t+1/sketch_segments)*arclength(p)) on p) 
randomshifted s) ..
endfor
if cycle p :
cycle
else :
((point arclength(p) on p) randomshifted s)
fi
else :
p
fi
) enddef ;


%D The macro \type{sketchdraw} draws the randomized path. The 
%D \type{expr} ... \type{text} trick is copied from the definition of 
%D \type{drawarrow}
def sketchdraw expr p =
   do_sketchdraw(p)
enddef;

def do_sketchdraw(expr p) text t =
  if (path p) :
  for i = 1 upto max(1,sketch_passes) :
normaldraw p 
   sketchrandomized sketch_amount 
   withtransparency ("multiply", 1/max(1,sketch_passes))
   t ;
  endfor;
  else :
  normaldraw p t;
  fi
enddef;

%D The macro \type{sketchfill} randomizes the path before filling it.
def sketchfill expr p =
  do_sketchfill(p)
enddef ;

def do_sketchfill(expr p) text t =
  if (path p) :
  for i = 1 upto max(1,sketch_passes) :
normalfill p 
   randomized sketch_amount 
   withtransparency ("multiply", 1/max(1,sketch_passes))
   t ;
  endfor;
  else :
  normalfill p t;
  fi
enddef;

endinput;

% Modified example from
% http://tex.loria.fr/prod-graph/zoonekynd/metapost/metapost.html

beginfig(1)
  pair A,B,C,O;
  A=(0,0); B=(3cm,0); C=(1cm,2cm);

  O - 1/2[B,C] = whatever * (B-C) rotated 90;
  O - 1/2[A,B] = whatever * (A-B) rotated 90;

  sketchypaths;
  sketch_amount := 5bp;
  draw A--B--C--cycle;

  draw O withpen pencircle scaled 4bp;

  sketch_amount := 2bp;
  draw fullcircle scaled 2abs(O-A) shifted O;
endfig
___
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] Fuzzy lines

2021-05-13 Thread Aditya Mahajan
On Thu, 13 May 2021, Henning Hraban Ramm wrote:

> 
> > Am 13.05.2021 um 18:36 schrieb Aditya Mahajan :
> > 
> >> Now I want to draw that path several times.
> >> 
> >> If I understand it right, I can’t put that into "sketchdraw" because that 
> >> leaves the end open for path additions like "withcolor".
> > 
> > A slightly different approach is needed. See attached. I also added a bit a 
> > error protection in case someone sets sketch_passes to be negative by 
> > mistake. 
> 
> Thank you so much!

Here is a different effect ... more of a trembling hand drawing than a sketch. 
You can play around with sketch_amount to see some variation. 

In this, rather than using the default randomized path (which randomizes the 
points of a path), I split the path into 20 segments, and randomize each 
segment. 

Aditya%D \module
%D   [   file=mp-sketch.mp
%Dversion=2021.05.13
%D  title=\CONTEXT\ \METAPOST\ graphics,
%D   subtitle=Sketch drawing,
%D author=Aditya Mahajan,
%D   date=\currentdate,
%D  copyright={Aditya Mahajan}]

%D This metapost module is inspired by a TeX.SE question:
%D http://tex.stackexchange.com/q/39296/323
%D
%D I thought that it would be fun to implement a similar feature in MetaPost.
%D
%D To use this package in MetaPost:
%D
%D \starttyping
%Dinput mp-sketch;
%D
%Dbeginfig(1)
%D  sketchypaths; % Make draw and fill sketchy
%D  ...
%D  naturalizepaths; % Restore the value of draw and fill
%D  ...
%Dendfig
%D \stoptyping
%D
%D The code is heavily inspired by Hans Hagen's Metafun macros.
%D
%D The macro \type{sketchypaths} is modeled after \type{visualizepaths} from
%D \filename{mp-tool}.

def sketchypaths =
let draw = sketchdraw ;
let fill = sketchfill ;
enddef ;

%D Check if \filename{mp-tool} is loaded
if not known context_tool :
  let normaldraw = draw;
  let normalfill = fill;

  def naturalizepaths =
  let fill = normalfill ;
  let draw = normaldraw ;
  enddef ;
fi

%D The variable \type{sketch_amount} determines the amount of randomness in the
%D drawing
numeric sketch_amount; sketch_amount := 0.75bp;

%D The variable \type{sketch_passes} determines the number of times the path
%D is drawn
numeric sketch_passes; sketch_passes := 1;

%D Based on \type{randomized}. Assumes p is path:
numeric sketch_segments; sketch_segments := 20;

primarydef p sketchrandomized s = (
if path p :
for t = 0 step 1/sketch_segments until 1-1/sketch_segments : 
((point   (t*arclength(p)) on p) 
randomshifted s) .. controls
((postcontrol (t*arclength(p)) on p) 
randomshifted s) and
((precontrol  ((t+1/sketch_segments)*arclength(p)) on p) 
randomshifted s) ..
endfor
if cycle p :
cycle
else :
((point arclength(p) on p) randomshifted s)
fi
else :
p
fi
) enddef ;


%D The macro \type{sketchdraw} draws the randomized path. The 
%D \type{expr} ... \type{text} trick is copied from the definition of 
%D \type{drawarrow}
def sketchdraw expr p =
   do_sketchdraw(p)
enddef;

def do_sketchdraw(expr p) text t =
  if (path p) :
  for i = 1 upto max(1,sketch_passes) :
normaldraw p 
   sketchrandomized sketch_amount 
   withtransparency ("multiply", 1/max(1,sketch_passes))
   t ;
  endfor;
  else :
  normaldraw p t;
  fi
enddef;

%D The macro \type{sketchfill} randomizes the path before filling it.
def sketchfill expr p =
  do_sketchfill(p)
enddef ;

def do_sketchfill(expr p) text t =
  if (path p) :
  for i = 1 upto max(1,sketch_passes) :
normalfill p 
   randomized sketch_amount 
   withtransparency ("multiply", 1/max(1,sketch_passes))
   t ;
  endfor;
  else :
  normalfill p t;
  fi
enddef;

endinput;

% Modified example from
% http://tex.loria.fr/prod-graph/zoonekynd/metapost/metapost.html

beginfig(1)
  pair A,B,C,O;
  A=(0,0); B=(3cm,0); C=(1cm,2cm);

  O - 1/2[B,C] = whatever * (B-C) rotated 90;
  O - 1/2[A,B] = whatever * (A-B) rotated 90;

  sketchypaths;
  sketch_amount := 5bp;
  draw A--B--C--cycle;

  draw O withpen pencircle scaled 4bp;

  sketch_amount := 2bp;
  draw fullcircle scaled 2abs(O-A) shifted O;
endfig


test.tex
Description: TeX document


test.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] Fuzzy lines

2021-05-13 Thread Aditya Mahajan
On Thu, 13 May 2021, Henning Hraban Ramm wrote:

> 
> > Am 11.05.2021 um 18:02 schrieb Aditya Mahajan :
> > 
> > Look at this old code on how hide such code behind a macro to have a clean 
> > interface:
> > 
> > https://github.com/adityam/mp-sketch/blob/master/mp-sketch.mp
> 
> Hi Aditya,
> I’m trying to include my additions into your code, but it doesn’t work.
> 
> 
> numeric sketch_amount; sketch_amount := 3bp;
> numeric sketch_passes; sketch_passes := 5;
> 
> def sketchdraw expr p =
>   do_sketchdraw(p if (path p): randomized sketch_amount fi)
> enddef;
> 
> def do_sketchdraw(expr p) text t =
> normaldraw p t ;
> enddef;
> 
> 
> Now I want to draw that path several times.
> 
> If I understand it right, I can’t put that into "sketchdraw" because that 
> leaves the end open for path additions like "withcolor".
> 
> But it also doesn’t work in "do_sketchdraw"; I thought it might like this:

A slightly different approach is needed. See attached. I also added a bit a 
error protection in case someone sets sketch_passes to be negative by mistake. 

It may be interesting to rewrite these macros using the new key-value interface 
for metapost, so that something like this works:

\sketchdraw[amount=3bp, passes=5, transparency=yes] fullsquare scaled 1cm 
withcolor red;

test.pdf
Description: Adobe PDF document


test.tex
Description: TeX document
%D \module
%D   [   file=mp-sketch.mp
%Dversion=2021.05.13
%D      title=\CONTEXT\ \METAPOST\ graphics,
%D   subtitle=Sketch drawing,
%D author=Aditya Mahajan,
%D   date=\currentdate,
%D  copyright={Aditya Mahajan}]

%D This metapost module is inspired by a TeX.SE question:
%D http://tex.stackexchange.com/q/39296/323
%D
%D I thought that it would be fun to implement a similar feature in MetaPost.
%D
%D To use this package in MetaPost:
%D
%D \starttyping
%Dinput mp-sketch;
%D
%Dbeginfig(1)
%D  sketchypaths; % Make draw and fill sketchy
%D  ...
%D  naturalizepaths; % Restore the value of draw and fill
%D  ...
%Dendfig
%D \stoptyping
%D
%D The code is heavily inspired by Hans Hagen's Metafun macros.
%D
%D The macro \type{sketchypaths} is modeled after \type{visualizepaths} from
%D \filename{mp-tool}.

def sketchypaths =
let draw = sketchdraw ;
let fill = sketchfill ;
enddef ;

%D Check if \filename{mp-tool} is loaded
if not known context_tool :
  let normaldraw = draw;
  let normalfill = fill;

  def naturalizepaths =
  let fill = normalfill ;
  let draw = normaldraw ;
  enddef ;
fi

%D The variable \type{sketch_amount} determines the amount of randomness in the
%D drawing
numeric sketch_amount; sketch_amount := 3bp;

%D The variable \type{sketch_passes} determines the number of times the path
%D is drawn
numeric sketch_passes; sketch_passes := 1;

%D The macro \type{sketchdraw} draws the randomized path. The 
%D \type{expr} ... \type{text} trick is copied from the definition of 
%D \type{drawarrow}
def sketchdraw expr p =
   do_sketchdraw(p)
enddef;

def do_sketchdraw(expr p) text t =
  if (path p) :
  for i = 1 upto max(1,sketch_passes) :
normaldraw p 
   randomized sketch_amount 
   withtransparency ("multiply", 1/max(1,sketch_passes))
   t ;
  endfor;
  else :
  normaldraw p t;
  fi
enddef;

%D The macro \type{sketchfill} randomizes the path before filling it.
def sketchfill expr p =
  do_sketchfill(p)
enddef ;

def do_sketchfill(expr p) text t =
  if (path p) :
  for i = 1 upto max(1,sketch_passes) :
normalfill p 
   randomized sketch_amount 
   withtransparency ("multiply", 1/max(1,sketch_passes))
   t ;
  endfor;
  else :
  normalfill p t;
  fi
enddef;

endinput;

% Modified example from
% http://tex.loria.fr/prod-graph/zoonekynd/metapost/metapost.html

beginfig(1)
  pair A,B,C,O;
  A=(0,0); B=(3cm,0); C=(1cm,2cm);

  O - 1/2[B,C] = whatever * (B-C) rotated 90;
  O - 1/2[A,B] = whatever * (A-B) rotated 90;

  sketchypaths;
  sketch_amount := 5bp;
  draw A--B--C--cycle;

  draw O withpen pencircle scaled 4bp;

  sketch_amount := 2bp;
  draw fullcircle scaled 2abs(O-A) shifted O;
endfig
___
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] printing the current date

2021-01-27 Thread Wolfgang Schuster

Hans Hagen schrieb am 27.01.2021 um 22:31:

On 1/27/2021 6:28 PM, Peter Münster wrote:

On Sun, Jan 10 2021, Peter Münster wrote:


\currentdate% same as \date, but I would expect the day of today...


Should I fill a bug-report on the tracker?
Perhaps also for the missing space after \date[]?


Reporting here is faster. Can (lazy me) Wolfgang confirm the issue?



1. Wrong date

The \date command has wrong/weird grouping which makes global changes 
for the day, month and year.


\permanent\tolerant\protected\def\date[#1]#*[#2]%
  {\dontleavehmode
   \ifparameter#1\or
 \begingroup
 \letdummyparameter\c!d\normalday
 \letdummyparameter\c!m\normalmonth
 \letdummyparameter\c!y\normalyear
 \getdummyparameters[#1]%
 \normalexpanded
   {\endgroup
\normalday  \number\directdummyparameter\c!d\relax
\normalmonth\number\directdummyparameter\c!m\relax
\normalyear \number\directdummyparameter\c!y\relax}%
   \fi
   ...}


2. Missing space

When not all optional arguments are used the space after the last given 
argument is gobbled. This was normal behavior for a long time until you 
changed the code in MkIV to keep them.



\tolerant\def\foo[#1]#*[#2]%
  {[#1][#2]}

\starttext

a \foo [1] b

a \foo [1] [2] b

\stoptext


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] printing the current date

2021-01-27 Thread Hans Hagen

On 1/27/2021 6:28 PM, Peter Münster wrote:

On Sun, Jan 10 2021, Peter Münster wrote:


\currentdate% same as \date, but I would expect the day of today...


Should I fill a bug-report on the tracker?
Perhaps also for the missing space after \date[]?

Reporting here is faster. Can (lazy me) Wolfgang confirm the issue?

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
___


Re: [NTG-context] printing the current date

2021-01-27 Thread Peter Münster
On Sun, Jan 10 2021, Peter Münster wrote:

> \currentdate% same as \date, but I would expect the day of today...

Should I fill a bug-report on the tracker?
Perhaps also for the missing space after \date[]?

TIA,
-- 
   Peter
___
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] LMTX/MkIV difference in date handling

2021-01-14 Thread Henning Hraban Ramm
ConTeXt  ver: 2021.01.11 17:27 LMTX  fmt: 2021.1.11

The following works in MkIV, but not in LMTX:


\def\Jahr{\currentdate[year]}

\settaggedmetadata[
rights={© \Jahr{} Me}
]

\starttext
\strut
\stoptext


The error message is:

 1 \def\Jahr{\currentdate[year]}
 2 
 3 \settaggedmetadata[
 4 >>   rights={© \Jahr{} Me}
 5 ]
 6 
 7 \starttext
 8 \strut
 9 \stoptext
10 


You've closed more groups than you opened. Such booboos are generally harmless,
so keep going.




Hraban
___
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] printing the current date

2021-01-10 Thread Fabrice L


> Le 10 janv. 2021 à 13:23, Peter Münster  a écrit :
> 
> Hi,
> 
> I would expect, that \currentdate prints the current date, but it does
> not:
> 
> --8<---cut here---start->8---
> \starttext
> \date[d=1]% first day of this month, ok
> 
> \date% again first day, last parameters are used, this is ok
> 
> \currentdate% same as \date, but I would expect the day of today...
> \stoptext
> --8<---cut here---end--->8---
> 
> How could I print the current date please?

For exemple:

 \date[][weekday,day,month,year] and \currenttime[h,{\,:\,},m] 

F.

> 
> TIA for any hints,
> -- 
>   Peter
> ___
> 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] printing the current date

2021-01-10 Thread Peter Münster
Hi,

I would expect, that \currentdate prints the current date, but it does
not:

--8<---cut here---start->8---
\starttext
\date[d=1]% first day of this month, ok

\date% again first day, last parameters are used, this is ok

\currentdate% same as \date, but I would expect the day of today...
\stoptext
--8<---cut here---end--->8---

How could I print the current date please?

TIA for any hints,
-- 
   Peter
___
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] \setupuserpagenumber not working as expected

2020-09-06 Thread Jan Willem Flamma
Dear Wolfgang, Thank you for taking the time to go through the example and indicating these improvements. I will definitely evaluate and start applying this to my own code. Kind regards,Jan WillemFrom: Wolfgang SchusterSent: Friday, 4 September 2020 10:47To: mailing list for ConTeXt users; Jan Willem FlammaSubject: Re: [NTG-context] \setupuserpagenumber not working as expected Jan Willem Flamma schrieb am 03.09.2020 um 10:29:> Dear Julian,> > I use something similar using a main product file, an environment file > that contain the styling and several components that build up the > frontmatter, the manual and the appendices.> > Below my setup where I start the roman numbering on the table of > contents page (page 5 or v in roman)> > Once the bodymatter starts the pagenumber is set  to the arabic 1 (see > below in the main product file)> > You should be able to copy and adapt to your needs. There are lot of things which can be improved in your example. 1. Pass the filename of the component/product to \startcomponent and not some dummy name (or just use *), this allows you to print the filename with \currentcomponent or \currentproduct 2. Use \setvariables or \setupdocument to set the document title, revision etc. 3. Use \startsectionblockenvironment to move setups from the document content into the environment file. 4. Use pagestate=start to increase the page counter with \startstandardmakeup. 5. Set search path for figures (\copypages use the figure mechanism) with \setupexternalfigure[location=...]. Below is a modified (but untested) version of your sample document. Wolfgang   begin product\startproduct product \environment env-WA % \setvariables%   [document]%   [ manual={Course Manual},%  title={Title},%    subtitleone={Subtitle 1},%    subtitletwo={Subtitle 2},%  revnumber={Revision number}] \setupdocument   [ manual={Course Manual},  title={Title},    subtitleone={Subtitle 1},    subtitletwo={Subtitle 2},  revnumber={Revision number}] \startfrontmatter    \component fm-frontpage   \component fm-titlepage   \component fm-tableofcontents \stopfrontmatter \startbodymatter    \component co-01   \component co-02 \stopbodymatter \startappendices    \component co-ap-01   \component co-ap-02 \stopappendices \startbackmatter    \copypages[app1.pdf][n=4] \stopbackmatter \stopproduct end product  begin environment\startenvironment env-WA \setuppagenumbering   [alternative=doublesided,  location=right]   \defineconversionset   [frontpart:pagenumber] [] [romannumerals] \setupexternalfigures   [directory={External PDF}] \startsectionblockenvironment [frontpart]    \setupbackgrounds [leftpage] [setups=pagenumber:left]    \setupbackgrounds [rightpage] [setups=pagenumber:right] \stopsectionblockenvironment \startsectionblockenvironment [bodypart]    \setupbackgrounds [leftpage] [setups=pagenumber:left]    \setupbackgrounds [rightpage] [setups=pagenumber:right]    \setuppagenumber [number=1] \stopsectionblockenvironment \startsectionblockenvironment [appendix]    \setupbackgrounds [leftpage] [setups=pagenumber:left]    \setupbackgrounds [rightpage] [setups=pagenumber:right] \stopsectionblockenvironment \startsectionblockenvironment [backpart]    \setuppagenumber[state=stop] \stopsectionblockenvironment \stopenvironment end environment  begin component\startcomponent fm-frontpage \product product \startstandardmakeup [top=,pagestate=start,align=middle,color=Modu_Blue] % \dontleavehmode\externalfigure[frontpage-logo.png][width=12cm] \framed   [height=5cm,width=broad,frame=off]   {\externalfigure[frontpage-logo.png][width=12cm]} \blank[6*big] {\bfc \documentvariable{manual}} \blank[4*big] {\tfc \documentvariable{title}} \blank[2*big] {\tfc \documentvariable{subtitleone}} \blank[2*big] {\tfc \documentvariable{subtitletwo}} \stopstandardmakeup \stopcomponent end component  begin component\startcomponent fm-titlepage \product product \startstandardmakeup [top=,pagestate=start,align=middle,color=Modu_Blue] {\tfb \documentvariable{manual}} \blank[2*big] {\tfb \documentvariable{title}} \blank[2*big] {\tfb \documentvariable{subtitleone}} \blank[2*big] {\tfb \documentvariable{subtitletwo}} \blank[10*big] {\tfb \documentvariable{revnumber}} \blank {\tfb \currentdate[month,year]} \blank[10*big] {\tfb Written by:} \blank {\tfb Company name} \blank {\tfb City, Country} \stopstandardmakeup \stopcomponent end component  begin component\startcomponent fm-tableofcontents \product product \starttitle [title=Table of Contents] \placecontent \stoptitle \stopcomponent end component 
___
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 / htt

Re: [NTG-context] \setupuserpagenumber not working as expected

2020-09-04 Thread Wolfgang Schuster

Jan Willem Flamma schrieb am 03.09.2020 um 10:29:

Dear Julian,

I use something similar using a main product file, an environment file 
that contain the styling and several components that build up the 
frontmatter, the manual and the appendices.


Below my setup where I start the roman numbering on the table of 
contents page (page 5 or v in roman)


Once the bodymatter starts the pagenumber is set  to the arabic 1 (see 
below in the main product file)


You should be able to copy and adapt to your needs.


There are lot of things which can be improved in your example.

1. Pass the filename of the component/product to \startcomponent and not 
some dummy name (or just use *), this allows you to print the filename 
with \currentcomponent or \currentproduct


2. Use \setvariables or \setupdocument to set the document title, 
revision etc.


3. Use \startsectionblockenvironment to move setups from the document 
content into the environment file.


4. Use pagestate=start to increase the page counter with 
\startstandardmakeup.


5. Set search path for figures (\copypages use the figure mechanism) 
with \setupexternalfigure[location=...].


Below is a modified (but untested) version of your sample document.

Wolfgang


 begin product
\startproduct product

\environment env-WA

% \setvariables
%   [document]
%   [ manual={Course Manual},
%  title={Title},
%subtitleone={Subtitle 1},
%subtitletwo={Subtitle 2},
%  revnumber={Revision number}]

\setupdocument
  [ manual={Course Manual},
 title={Title},
   subtitleone={Subtitle 1},
   subtitletwo={Subtitle 2},
 revnumber={Revision number}]

\startfrontmatter

  \component fm-frontpage
  \component fm-titlepage
  \component fm-tableofcontents

\stopfrontmatter

\startbodymatter

  \component co-01
  \component co-02

\stopbodymatter

\startappendices

  \component co-ap-01
  \component co-ap-02

\stopappendices

\startbackmatter

  \copypages[app1.pdf][n=4]

\stopbackmatter

\stopproduct
 end product

 begin environment
\startenvironment env-WA

\setuppagenumbering
  [alternative=doublesided, 

   location=right] 



\defineconversionset
  [frontpart:pagenumber] [] [romannumerals]

\setupexternalfigures
  [directory={External PDF}]

\startsectionblockenvironment [frontpart]

  \setupbackgrounds
[leftpage]
[setups=pagenumber:left]

  \setupbackgrounds
[rightpage]
[setups=pagenumber:right]

\stopsectionblockenvironment

\startsectionblockenvironment [bodypart]

  \setupbackgrounds
[leftpage]
[setups=pagenumber:left]

  \setupbackgrounds
[rightpage]
[setups=pagenumber:right]

  \setuppagenumber
[number=1]

\stopsectionblockenvironment

\startsectionblockenvironment [appendix]

  \setupbackgrounds
[leftpage]
[setups=pagenumber:left]

  \setupbackgrounds
[rightpage]
[setups=pagenumber:right]

\stopsectionblockenvironment

\startsectionblockenvironment [backpart]

  \setuppagenumber[state=stop]

\stopsectionblockenvironment

\stopenvironment
 end environment

 begin component
\startcomponent fm-frontpage

\product product

\startstandardmakeup [top=,pagestate=start,align=middle,color=Modu_Blue]

% \dontleavehmode\externalfigure[frontpage-logo.png][width=12cm]

\framed
  [height=5cm,width=broad,frame=off]
  {\externalfigure[frontpage-logo.png][width=12cm]}

\blank[6*big]

{\bfc \documentvariable{manual}}

\blank[4*big]

{\tfc \documentvariable{title}}

\blank[2*big]

{\tfc \documentvariable{subtitleone}}

\blank[2*big]

{\tfc \documentvariable{subtitletwo}}

\stopstandardmakeup

\stopcomponent
 end component

 begin component
\startcomponent fm-titlepage

\product product

\startstandardmakeup [top=,pagestate=start,align=middle,color=Modu_Blue]

{\tfb \documentvariable{manual}}

\blank[2*big]

{\tfb \documentvariable{title}}

\blank[2*big]

{\tfb \documentvariable{subtitleone}}

\blank[2*big]

{\tfb \documentvariable{subtitletwo}}

\blank[10*big]

{\tfb \documentvariable{revnumber}}

\blank

{\tfb \currentdate[month,year]}

\blank[10*big]

{\tfb Written by:}

\blank

{\tfb Company name}

\blank

{\tfb City, Country}

\stopstandardmakeup

\stopcomponent
 end component

 begin component
\startcomponent fm-tableofcontents

\product product

\starttitle [title=Table of Contents]

\placecontent

\stoptitle

\stopcomponent
 end component
___
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] \setupuserpagenumber not working as expected

2020-09-04 Thread Jan Willem Flamma
Credits to Pragma who helped me to set this up a few years ago. From: jbfSent: Friday, 4 September 2020 00:20To: Jan Willem FlammaCc: ntg >> mailing list for ConTeXt usersSubject: Re: [NTG-context] \setupuserpagenumber not working as expected Thanks Jan, that is an extensive bit of work below! Might take me a while to digest, but I'll explore it carefully.JulianOn 3/9/20 6:29 pm, Jan Willem Flamma wrote:Dear Julian, I use something similar using a main product file, an environment file that contain the styling and several components that build up the frontmatter, the manual and the appendices.  Below my setup where I start the roman numbering on the table of contents page (page 5 or v in roman) Once the bodymatter starts the pagenumber is set  to the arabic 1 (see below in the main product file) You should be able to copy and adapt to your needs. Kind regards,Jan Willem Flamma   The main product file==\environment env-WA \startproduct currentproduct % Document definitions\define\MyManual{Course Manual}\define\MyTitle{Title}\define\MySubtitleOne{Subtitle 1}\define\MySubtitleTwo{Subtitle 2}\define\MyRevnumber{Revision number} % Load frontmatter files\startfrontmatter    \component fm-frontpage    \component fm-titlepage    \component fm-tableofcontents\stopfrontmatter % Load bodymatter file\startbodymatter\setupbackgrounds    [leftpage]    [setups=pagenumber:left]\setupbackgrounds    [rightpage]    [setups=pagenumber:right]\setuppagenumber[number=1]    \component co-01    \component co-02\stopbodymatter % Load backmatter files\startbackmatter\setupbackgrounds   [leftpage]   [setups=pagenumber:left]\setupbackgrounds   [rightpage]   [setups=pagenumber:right]\startappendices   \component co-ap-01   \component co-ap-02\stopappendices\stopbackmatter % Load external PDF documents\setuppagenumber[state=stop]\copypages[External PDF/app1.pdf][n=4] \stopproduct=   The env-WA.tex file (below is about pagenumbering only)=% Start chapter on right (odd) page, pagenumber = bottom right\setuppagenumbering    [alternative=doublesided,  location=right]    % Pagenumbering style\definestructureconversionset    [frontpart:pagenumber][][romannumerals]\definestructureconversionset    [bodypart:pagenumber] [][numbers]\definestructureconversionset    [appendix:pagenumber] [][numbers]=   The fm-frontpage.tex file\startcomponent currentcomponent \product product % Front page layout\startstandardmakeup % Place logo centered on page\framed[height=5cm,width=broad,frame=off]{\externalfigure[frontpage-logo.png][width=12cm]} % Place course titles\blank[6*big]\color[Modu_Blue]{\midaligned{\bfc \MyManual}} \blank[4*big]\color[Modu_Blue]{\midaligned{\tfc \MyTitle}} \blank[2*big]\color[Modu_Blue]{\midaligned{\tfc \MySubtitleOne}} \blank[2*big]\color[Modu_Blue]{\midaligned{\tfc \MySubtitleTwo}} \vfill \stopstandardmakeup \stopcomponent   The fm-titlepage.tex file\startcomponent currentcomponent \product product \startstandardmakeup \color[Modu_Blue]{\midaligned{\tfb \MyManual}}    \blank[2*big]    \color[Modu_Blue]{\midaligned{\tfb \MyTitle}}    \blank[2*big]    \color[Modu_Blue]{\midaligned{\tfb \MySubtitleOne}}    \blank[2*big]    \color[Modu_Blue]{\midaligned{\tfb \MySubtitleTwo}} \blank[10*big] \color[Modu_Blue]{\midaligned{\tfb \MyRevnumber}}    \blank    \midaligned{\color[Modu_Blue]{\tfb \currentdate[month,year]}} \blank[10*big] \midaligned{\color[Modu_Blue]{\tfb Written by:}}    \blank    \midaligned{\color[Modu_Blue]{\tfb Company name}}    \blank    \midaligned{\color[Modu_Blue]{\tfb City, Country}} \vfill \stopstandardmakeup \stopcomponent The fm-tableofcontents.tex file\startcomponent currentcomponent \product product \setupbackgrounds   [leftpage]   [setups=pagenumber:left]\setupbackgrounds   [rightpage]   [setups=pagenumber:right] % This is where I want the roman numbering to start\setuppagenumber[number=5] \starttitle[title=Table of Contents]\placecontent\stoptitle \stopcomponent  From: jbfSent: Thursday, 3 September 2020 06:05To: mailing list for ConTeXt usersSubject: [NTG-context] \setupuserpagenumber not working as expected Am seeking to have frontmatter pages in roman numerals and from Chapter 1 onwards in arabic numerals. I have achieved something of the kind, but page 1 (arabic) is appearing on the last page of the frontmatter and not the first page of Chapter 1. I do not know why this is happening. My setup for page numbering is as follows (something I found somewhere - wiki? elsewhere? Not sure. I didn't make it up!):\definestructureconversionset[frontpart:pagenumber][][romannumerals]\definestructureconversionset[bodypart:pagenumber] [][numbers]\startsectionblockenvironment[frontpart]\setupuserpagenumber[

Re: [NTG-context] \setupuserpagenumber not working as expected

2020-09-03 Thread jbf
Thanks Jan, that is an extensive bit of work below! Might take me a 
while to digest, but I'll explore it carefully.


Julian

On 3/9/20 6:29 pm, Jan Willem Flamma wrote:


Dear Julian,

I use something similar using a main product file, an environment file 
that contain the styling and several components that build up the 
frontmatter, the manual and the appendices.


Below my setup where I start the roman numbering on the table of 
contents page (page 5 or v in roman)


Once the bodymatter starts the pagenumber is set  to the arabic 1 (see 
below in the main product file)


You should be able to copy and adapt to your needs.

Kind regards,

Jan Willem Flamma

*The main product file*

==

\environment env-WA

\startproduct currentproduct

% Document definitions

\define\MyManual{Course Manual}

\define\MyTitle{Title}

\define\MySubtitleOne{Subtitle 1}

\define\MySubtitleTwo{Subtitle 2}

\define\MyRevnumber{Revision number}

% Load frontmatter files

\startfrontmatter

\component fm-frontpage

\component fm-titlepage

\component fm-tableofcontents

\stopfrontmatter

% Load bodymatter file

\startbodymatter

\setupbackgrounds

[leftpage]

[setups=pagenumber:left]

\setupbackgrounds

[rightpage]

[setups=pagenumber:right]

\setuppagenumber[number=1]

\component co-01

\component co-02

\stopbodymatter

% Load backmatter files

\startbackmatter

\setupbackgrounds

[leftpage]

[setups=pagenumber:left]

\setupbackgrounds

[rightpage]

[setups=pagenumber:right]

\startappendices

\component co-ap-01

\component co-ap-02

\stopappendices

\stopbackmatter

% Load external PDF documents

\setuppagenumber[state=stop]

\copypages[External PDF/app1.pdf][n=4]

\stopproduct

=

*The env-WA.tex file (below is about pagenumbering only)*

=

% Start chapter on right (odd) page, pagenumber = bottom right

\setuppagenumbering

[alternative=doublesided,

 location=right]

% Pagenumbering style

\definestructureconversionset

[frontpart:pagenumber][][romannumerals]

\definestructureconversionset

[bodypart:pagenumber] [][numbers]

\definestructureconversionset

[appendix:pagenumber] [][numbers]

=

*The fm-frontpage.tex file*



\startcomponent currentcomponent

\product product

% Front page layout

\startstandardmakeup

% Place logo centered on page

\framed[height=5cm,width=broad,frame=off]

{\externalfigure[frontpage-logo.png][width=12cm]}

% Place course titles

\blank[6*big]

\color[Modu_Blue]{\midaligned{\bfc \MyManual}}

\blank[4*big]

\color[Modu_Blue]{\midaligned{\tfc \MyTitle}}

\blank[2*big]

\color[Modu_Blue]{\midaligned{\tfc \MySubtitleOne}}

\blank[2*big]

\color[Modu_Blue]{\midaligned{\tfc \MySubtitleTwo}}

\vfill

\stopstandardmakeup

\stopcomponent



*The fm-titlepage.tex file*



\startcomponent currentcomponent

\product product

\startstandardmakeup

\color[Modu_Blue]{\midaligned{\tfb \MyManual}}

\blank[2*big]

\color[Modu_Blue]{\midaligned{\tfb \MyTitle}}

\blank[2*big]

\color[Modu_Blue]{\midaligned{\tfb \MySubtitleOne}}

\blank[2*big]

\color[Modu_Blue]{\midaligned{\tfb \MySubtitleTwo}}

\blank[10*big]

\color[Modu_Blue]{\midaligned{\tfb \MyRevnumber}}

\blank

\midaligned{\color[Modu_Blue]{\tfb \currentdate[month,year]}}

\blank[10*big]

\midaligned{\color[Modu_Blue]{\tfb Written by:}}

\blank

\midaligned{\color[Modu_Blue]{\tfb Company name}}

\blank

\midaligned{\color[Modu_Blue]{\tfb City, Country}}

\vfill

\stopstandardmakeup

\stopcomponent



*The fm-tableofcontents.tex file*



\startcomponent currentcomponent

\product product

\setupbackgrounds

[leftpage]

[setups=pagenumber:left]

\setupbackgrounds

[rightpage]

[setups=pagenumber:right]

% This is where I want the roman numbering to start

\setuppagenumber[number=5]

\starttitle[title=Table of Contents]

\placecontent

\stoptitle

\stopcomponent



*From: *jbf <mailto:roma83...@gmail.com>
*Sent: *Thursday, 3 September 2020 06:05
*To: *mailing list for ConTeXt users <mailto:ntg-context@ntg.nl>
*Subject: *[NTG-context] \setupuserpagenumber not working as expected

Am seeking to have frontmatter pages in roman numerals and from 
Chapter 1 onwards in arabic numerals. I have achieved something of the 
kind, but page 1 (arabic) is appearing on the last page of the 
frontmatter and not the first page of Chapter 1. I do not know why 
this is happening. My setup for page numbering is as follows 
(something I found somewhere - wiki? elsewhere? Not sure. I didn't 
make it up!):


\definestructureconversionset[frontpart:pagenumber][][romannumerals]
\definestructureconversionset[bodypart:pagenumber] [][numbers]
\startsectionblockenvironment[frontpart]
\setupuserpagenumber[numberconversion=romannumerals]
\setuplist[chapter][pageconversionset=pagenumber]
\setuppagenumber[number=1]
\stopsectionblockenvironment

\startsectionblockenvironment[bodypart]
\setuppagenumber[number=1]
\stopsectionblockenvironment

T

Re: [NTG-context] \setupuserpagenumber not working as expected

2020-09-03 Thread Jan Willem Flamma
Dear Julian, I use something similar using a main product file, an environment file that contain the styling and several components that build up the frontmatter, the manual and the appendices.  Below my setup where I start the roman numbering on the table of contents page (page 5 or v in roman) Once the bodymatter starts the pagenumber is set  to the arabic 1 (see below in the main product file) You should be able to copy and adapt to your needs. Kind regards,Jan Willem Flamma   The main product file==\environment env-WA \startproduct currentproduct % Document definitions\define\MyManual{Course Manual}\define\MyTitle{Title}\define\MySubtitleOne{Subtitle 1}\define\MySubtitleTwo{Subtitle 2}\define\MyRevnumber{Revision number} % Load frontmatter files\startfrontmatter    \component fm-frontpage    \component fm-titlepage    \component fm-tableofcontents\stopfrontmatter % Load bodymatter file\startbodymatter\setupbackgrounds    [leftpage]    [setups=pagenumber:left]\setupbackgrounds    [rightpage]    [setups=pagenumber:right]\setuppagenumber[number=1]    \component co-01    \component co-02\stopbodymatter % Load backmatter files\startbackmatter\setupbackgrounds   [leftpage]   [setups=pagenumber:left]\setupbackgrounds   [rightpage]   [setups=pagenumber:right]\startappendices   \component co-ap-01   \component co-ap-02\stopappendices\stopbackmatter % Load external PDF documents\setuppagenumber[state=stop]\copypages[External PDF/app1.pdf][n=4] \stopproduct=   The env-WA.tex file (below is about pagenumbering only)=% Start chapter on right (odd) page, pagenumber = bottom right\setuppagenumbering    [alternative=doublesided,  location=right]    % Pagenumbering style\definestructureconversionset    [frontpart:pagenumber][][romannumerals]\definestructureconversionset    [bodypart:pagenumber] [][numbers]\definestructureconversionset    [appendix:pagenumber] [][numbers]=   The fm-frontpage.tex file\startcomponent currentcomponent \product product % Front page layout\startstandardmakeup % Place logo centered on page \framed[height=5cm,width=broad,frame=off] {\externalfigure[frontpage-logo.png][width=12cm]} % Place course titles\blank[6*big]\color[Modu_Blue]{\midaligned{\bfc \MyManual}} \blank[4*big]\color[Modu_Blue]{\midaligned{\tfc \MyTitle}} \blank[2*big]\color[Modu_Blue]{\midaligned{\tfc \MySubtitleOne}} \blank[2*big]\color[Modu_Blue]{\midaligned{\tfc \MySubtitleTwo}} \vfill \stopstandardmakeup \stopcomponent   The fm-titlepage.tex file\startcomponent currentcomponent \product product \startstandardmakeup \color[Modu_Blue]{\midaligned{\tfb \MyManual}}    \blank[2*big]    \color[Modu_Blue]{\midaligned{\tfb \MyTitle}}    \blank[2*big]    \color[Modu_Blue]{\midaligned{\tfb \MySubtitleOne}}    \blank[2*big]    \color[Modu_Blue]{\midaligned{\tfb \MySubtitleTwo}} \blank[10*big] \color[Modu_Blue]{\midaligned{\tfb \MyRevnumber}}    \blank    \midaligned{\color[Modu_Blue]{\tfb \currentdate[month,year]}} \blank[10*big] \midaligned{\color[Modu_Blue]{\tfb Written by:}}    \blank    \midaligned{\color[Modu_Blue]{\tfb Company name}}    \blank    \midaligned{\color[Modu_Blue]{\tfb City, Country}} \vfill \stopstandardmakeup \stopcomponent The fm-tableofcontents.tex file\startcomponent currentcomponent \product product \setupbackgrounds   [leftpage]   [setups=pagenumber:left]\setupbackgrounds   [rightpage]   [setups=pagenumber:right] % This is where I want the roman numbering to start\setuppagenumber[number=5] \starttitle[title=Table of Contents]\placecontent\stoptitle \stopcomponent  From: jbfSent: Thursday, 3 September 2020 06:05To: mailing list for ConTeXt usersSubject: [NTG-context] \setupuserpagenumber not working as expected Am seeking to have frontmatter pages in roman numerals and from Chapter 1 onwards in arabic numerals. I have achieved something of the kind, but page 1 (arabic) is appearing on the last page of the frontmatter and not the first page of Chapter 1. I do not know why this is happening. My setup for page numbering is as follows (something I found somewhere - wiki? elsewhere? Not sure. I didn't make it up!):\definestructureconversionset[frontpart:pagenumber][][romannumerals]\definestructureconversionset[bodypart:pagenumber] [][numbers]\startsectionblockenvironment[frontpart]\setupuserpagenumber[numberconversion=romannumerals]\setuplist[chapter][pageconversionset=pagenumber]\setuppagenumber[number=1]\stopsectionblockenvironment\startsectionblockenvironment[bodypart]\setuppagenumber[number=1]\stopsectionblockenvironmentThe frontmatter is some 16 pages worth (ends on a verso page but that verso carries the arabic number 1 instead of page xvi which it should be, since the final paragraph on that page ends

Re: [NTG-context] explain please

2020-06-24 Thread Hans van der Meer
\\currentdate 
Neat solution, worked without a hitch. Now I have to remember this for future 
use ...

dr. Hans van der Meer


> On 24 Jun 2020, at 21:10, Hans Hagen  wrote:
> 
> On 6/24/2020 9:00 PM, Hans van der Meer wrote:
>> How can the crash in the minimal example here be explained? And is there a 
>> solution to avoid this and make the crash going away "without having to jump 
>> through special hoops"?
> because \currentdate is a macro thatv does some magic ... it's nor fully 
> expandable
> 
> so, lua sees \currentdate == \c as first escaped character coming in and 
> that's invalid (\\currentdate would work)
> 
> just try
> 
> print("\come on") in pure lua
> 
> 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
___


Re: [NTG-context] explain please

2020-06-24 Thread Hans Hagen

On 6/24/2020 9:00 PM, Hans van der Meer wrote:
How can the crash in the minimal example here be explained? And is there 
a solution to avoid this and make the crash going away "without having 
to jump through special hoops"?
because \currentdate is a macro thatv does some magic ... it's nor fully 
expandable


so, lua sees \currentdate == \c as first escaped character coming in and 
that's invalid (\\currentdate would work)


just try

print("\come on") in pure lua

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
___


[NTG-context] ConTeXt doesn't recognize source on network drive?

2020-05-11 Thread context

Hello,

after I've updated ConTeXt to the latest version, a new problem appeared 
- see the steps:


(Note that "X:" is a network drive mapped as "\\192.168.112.xxx\px" - if 
it was of importance.)



X:\Users\MMi\Akce\Stechovice-I-etapa.RDS\Projekt.RDS\P.Prac\SO_251\TZ>set 
path=d:\Ctx-Beta\tex\texmf-mswin\bin;%PATH%


X:\Users\MMi\Akce\Stechovice-I-etapa.RDS\Projekt.RDS\P.Prac\SO_251\TZ>findfile 
context.exe

d:\Ctx-Beta\tex\texmf-mswin\bin\context.exe

X:\Users\MMi\Akce\Stechovice-I-etapa.RDS\Projekt.RDS\P.Prac\SO_251\TZ>context.exe 
x:\Users\MMi\Akce\Stechovice-I-etapa.RDS\Projekt.RDS\P.Prac\SO_251\TZ\14-001-TZ.mkiv


resolvers   | formats | executing runner 'run luatex format': 
d:/Ctx-Beta/tex/texmf-mswin/bin/luatex --jobname="14-001-TZ" 
--fmt=d:/Ctx-Beta/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/format

-c:texmfbinpath="d:/Ctx-Beta/tex/texmf-mswin/bin"
This is LuaTeX, Version 1.13.0 (TeX Live 2020/W32TeX)
 system commands enabled.
open source > level 1, order 1, name 
'd:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/cont-yes.mkiv'

system  >
system  > ConTeXt  ver: 2020.05.08 20:46 MKIV beta  fmt: 
2020.5.11  int: english/english

system  >
system  > 'cont-new.mkiv' loaded
open source > level 2, order 2, name 
'd:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv'

system  > beware: some patches loaded from cont-new.mkiv
close source> level 2, order 2, name 
'd:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv'
system  > files > jobname '14-001-TZ', input 
'x:\\Users\\MMi\\Akce\\Stechovice-I-etapa.RDS\\Projekt.RDS\\P.Prac\\SO_251\\TZ\\14-001-TZ.mkiv', 
result '14-001-TZ'

fonts   > latin modern fonts are not preloaded
languages   > language 'en' is active

tex error   > tex error on line 8 in file 
d:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/cont-yes.mkiv: ! I 
can't find file 
`x://Users/MMi/Akce/Stechovice-I-etapa.RDS/Projekt.RDS/P.Prac/SO_251/TZ/14-001-TZ.mkiv'.


l.8 }

l.97 \getvalue{clf_processjob}
 % from cont-run.lua

 1 %D \module
 2 %D   [   file=cont-yes,
 3 %D    version=2012.06.01,
 4 %D  title=\CONTEXT\ Miscellaneous Macros,
 5 %D   subtitle=Startup Stub,
 6 %D author=Hans Hagen,
 7 %D   date=\currentdate,
 8 >>  %D  copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
 9 %C
10 %C This module is part of the \CONTEXT\ macro||package and is
11 %C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12 %C details.
13
14 % At some point I will reconsider the \starttext .. \stoptext
15 % wraping as we can assume proper styling. It's a left-over from
16 % mkii that we need to get rid of.
17
18 % now moved to cont-run.lua

mtx-context | fatal error: return code: 1


So:

1. "ConTeXt  ver: 2020.05.08 20:46 MKIV beta  fmt: 2020.5.11" should be 
the newest, OK.


2. The new probles seems to be: "I can't find file `x://Users...
  ^^-- Why 
this replacement of "\"?


Best regards,

Lukas
___
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] Short weekday option for date command

2020-04-08 Thread Adam Reviczky
Thank you Wolfgang!

Adam

On Wed, Apr 8, 2020 at 9:11 PM Wolfgang Schuster <
wolfgang.schuster.li...@gmail.com> wrote:

> Adam Reviczky schrieb am 08.04.2020 um 21:53:
> > Thank you Hans and Wolfgang,
> >
> > I have updated the wiki (https://wiki.contextgarden.net/Command/date)
> > with the new dayshort/daylong options, but I seem to get an empty value
> > for every day after day 7, see example:
> >
> > \starttext
> > \date[d=7,m=4,y=2008][{\dayshort\normalday},{,~},day,~,month,~,year] \par
> > \date[d=8,m=4,y=2008][{\dayshort\normalday},{,~},day,~,month,~,year]
> > \stoptext
> >
> > This gives me (note "sun" is missing in the second line):
> >
> > sat, 7 April 2008
> > , 8 April 2008
> >
> > Am I using the options correctly?
>
> No, the \daylong and \dayshort expect a number between 1 and 7 and
> result in a label for the requested day of the week but it's not meant
> to be used in \currentdate.
>
> > Still using luatex and not luametatex.
>
> To get the short names with \currentdate you have to append ":mnem" to
> the weekday, w, WEEKDAY or W keywords.
>
> \starttext
>
> \startlines
> \date[d=7,m=4,y=2008][weekday,{,~},day,~,month,~,year]
> \date[d=7,m=4,y=2008][weekday:mnem,{,~},day,~,month,~,year]
> \date[d=8,m=4,y=2008][weekday,{,~},day,~,month,~,year]
> \date[d=8,m=4,y=2008][weekday:mnem,{,~},day,~,month,~,year]
> \stoplines
>
> \stoptext
>
> 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] Short weekday option for date command

2020-04-08 Thread Wolfgang Schuster

Adam Reviczky schrieb am 08.04.2020 um 21:53:

Thank you Hans and Wolfgang,

I have updated the wiki (https://wiki.contextgarden.net/Command/date) 
with the new dayshort/daylong options, but I seem to get an empty value 
for every day after day 7, see example:


\starttext
\date[d=7,m=4,y=2008][{\dayshort\normalday},{,~},day,~,month,~,year] \par
\date[d=8,m=4,y=2008][{\dayshort\normalday},{,~},day,~,month,~,year]
\stoptext

This gives me (note "sun" is missing in the second line):

sat, 7 April 2008
, 8 April 2008

Am I using the options correctly?


No, the \daylong and \dayshort expect a number between 1 and 7 and 
result in a label for the requested day of the week but it's not meant

to be used in \currentdate.


Still using luatex and not luametatex.


To get the short names with \currentdate you have to append ":mnem" to 
the weekday, w, WEEKDAY or W keywords.


\starttext

\startlines
\date[d=7,m=4,y=2008][weekday,{,~},day,~,month,~,year]
\date[d=7,m=4,y=2008][weekday:mnem,{,~},day,~,month,~,year]
\date[d=8,m=4,y=2008][weekday,{,~},day,~,month,~,year]
\date[d=8,m=4,y=2008][weekday:mnem,{,~},day,~,month,~,year]
\stoplines

\stoptext

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] splitted xtable with repeating headers and placetable

2020-04-04 Thread Geert Dobbels
Hello,

Code below shows some behaviour I cannot explain (csv file attached):

- If I run the code below as is, I get what I want, except that the
header line of the table does not repeat at the top of each page.
- Changing "split=yes" to "split=repeat" in the setupxtable gives me
repeating headers, but the table starts at the second page, leaving the
first page with only the text line and all the rest as blank spaces.
- Placing the table in a float by activating the 3 commented lines gives
me an error ("extra } or forgotten endgroup") pointing to the external
figure in my page header overlay.  Replacing the \placefigure. in
the page header by ordinary text makes the error go away, but is no
solution, since I need the company logo picture there, and even then
with no error, the headers do not repeat.
- With the table in a float, I manage to get repeating headers when I
change to "split=yes" and "headers=repeat" in the \setupxtable, but I
still get the abovementioned error as soon as I want to put my figure
back in the page header..

Any suggestions ?

Geert




\usemodule[handlecsv]

\opencsvfile{systaprov2.csv}

\setuppapersize[A4, landscape]

\setuplayout[location=middle, width=27.5cm, height=18cm,
backspace=1cm,header=4cm]

\setuppagenumbering[state=stop]

\setupcaptions[location=none]

\setupbackgrounds[header][text][background={Logos}, state=repeat]

\setupnumbering [location=]

\setupframed[offset=none]

\defineoverlay

[Logos][{

\framed[width=\textwidth,

height=3cm,

align=right,

strut=no,

offset=none,

frame=on,

frameoffset=0.1cm,

corner=round,

radius=0.15cm,

framecolor=darkgray,

background=color,

backgroundcolor=gray,

framecorner=round,

frameradius=0.15cm,

rulethickness=0.05cm]{

\framed[width=0.280\textwidth,

height=3cm,

align=right,

frame=off]

{\placefigure[force][]{none}{\externalfigure[somepic.png][height=1.9cm]} }

\framed[width=0.430\textwidth,

height=3cm,

align=middle,

frame=off]

{\crlf\tfa \crlf \bf Technical Report}

\framed[width=0.370\textwidth,

height=3cm,

align=middle,

frame=off]

{\tfx \crlf Annex T.2.3. \crlf \tfx Date of issue: \crlf \currentdate
\crlf page \pagenumber of \lastpage}

}

}]

%\setupfloat[table][default={force,split}]

\setupxtable[offset=0cm,

frame=off,

bottomframe=on,

framecolor=gray,

option=stretch,

split=yes,

header=repeat,

align=middle]

\setupxtable[head][background=color,

backgroundcolor=gray,

topframe=on,

bottomframe=on,

framecolor=black,

foregroundcolor=blue]

\setupxtable[left][align=right]

\starttext

Some lines of text. This text must come just before the table, but only
on the first page of the table

\startbuffer[loop]

\startxrow

\startxcell[left] \cA \stopxcell

\startxcell[left] \cB \stopxcell

\startxcell[left] \cC \stopxcell

\startxcell[left] \cD \stopxcell

\startxcell \cE \stopxcell

\startxcell[left] \cF \stopxcell

\startxcell \cG \stopxcell

\startxcell \cH \stopxcell

\doifdefined{cI}{\startxcell \cI \stopxcell}

\doifdefined{cJ}{\startxcell \cJ \stopxcell}

\doifdefined{cK}{\startxcell [left] \cK \stopxcell}

\stopxrow

\stopbuffer

%\startplacetable[]

\startxtable

\startxtablehead[head]

\doloopif{\lineno}{<}{2}{\getbuffer[loop]}

\stopxtablehead

\startxtablebody

\doloopif{\lineno}{>}{1}{\getbuffer[loop]}

\stopxtablebody

\stopxtable

%\stopplacetable

\stoptext

Nº;Subject;Dirno;Tano; Date;Corr;VAVE; Stage; Remark
ab;asdfa a fasddf  qgt qhq tr hq qhqhr ;EFERT;21-54-322-32-;12/12/20;ERTF; all;1;b
sg;afae a t hyj wy  thjqh jqtj  ;7GSD;25-65-89-45; -; 2018/1832; all; N/A;
ab;asdfa a fasddf  qgt qhq tr hq qhqhr ;EFERT;21-54-322-32-;12/12/20;ERTF; all;1;b
sg;afae a t hyj wy  thjqh jqtj  ;7GSD;25-65-89-45; -; 2018/1832; all; N/A;
ab;asdfa a fasddf  qgt qhq tr hq qhqhr ;EFERT;21-54-322-32-;12/12/20;ERTF; all;1;b
sg;afae a t hyj wy  thjqh jqtj  ;7GSD;25-65-89-45; -; 2018/1832; all; N/A;
ab;asdfa a fasddf  qgt qhq tr hq qhqhr ;EFERT;21-54-322-32-;12/12/20;ERTF; all;1;b
sg;afae a t hyj wy  thjqh jqtj  ;7GSD;25-65-89-45; -; 2018/1832; all; N/A;
ab;asdfa a fasddf  qgt qhq tr hq qhqhr ;EFERT;21-54-322-32-;12/12/20;ERTF; all;1;b
sg;afae a t hyj wy  thjqh jqtj  ;7GSD;25-65-89-45; -; 2018/1832; all; N/A;
ab;asdfa a fasddf  qgt qhq tr hq qhqhr ;EFERT;21-54-322-32-;12/12/20;ERTF; all;1;b
sg;afae a t hyj wy  thjqh jqtj  ;7GSD;25-65-89-45; -; 2018/1832; all; N/A;
ab;asdfa a fasddf  qgt qhq tr hq qhqhr ;EFERT;21-54-322-32-;12/12/20;ERTF; all;1;b
sg;afae a t hyj wy  thjqh jqtj  ;7GSD;25-65-89-45; -; 2018/1832; all; N/A;
ab;asdfa a fasddf  qgt qhq tr hq qhqhr ;EFERT;21-54-322-32-;12/12/20;ERTF; all;1;b
sg;afae a t hyj wy  thjqh jqtj  ;7GSD;25-65-89-45; -; 2018/1832; all; N/A;
ab;asdfa a fasddf  qgt qhq tr hq qhqhr ;EFERT;21-54-322-32-;12/12/20;ERTF; all;1;b
sg;afae a t hyj wy  thjqh jqtj  ;7GSD;25-65-89-45; -; 2018/1832; all; N/A;
ab;asdfa a fasddf  qgt qhq tr hq qhqhr ;EFERT;21-54-322-32-;12/12/20;ERTF; all;1;b
sg;afae a t hyj wy  thjqh jqtj  ;7GSD;25-

Re: [NTG-context] passing variables/data between context and lua

2019-10-06 Thread Wolfgang Schuster

Rudolf Bahr schrieb am 06.10.2019 um 07:11:

Hello Wolfgang,
what exactly does the command
"\setvariable{martin}{set}{\directsetup{martin}}"?
Let's start with a simple example where I set a values with the 
\setvariables command.


\setvariables
  [metadata]
  [author=Rudolf Bahr,
   date=\currentdate]

\starttext

\getvariable{metadata}{author}\par
\getvariable{metadata}{date}

\stoptext

The main point of the command is that you can choose whatever name you 
want for the keys to store the values.


Instead a using a list of values to store in a key-value-method you can 
also pass values to single keys with the \setvariable command, e.g. 
\setvariable{metatdata}{author}{Rudolf Bahr}.


While it is true that you're free to choose the name for the keys there 
are two keys with a special meaning, these two keys are "reset" and 
"set". The value of the "reset" key is used before the values in 
\setvariables are stored while "set" is used after the values are stored.

I don't understand it. Has it something to do with "Command/datasetvariable"?
No, this is a different mechanism to save values between different 
ConTeXt runs which allows one to access values before they are set.

Especially what does "\directsetup"?
When you access the content of a setups-environment you can use the 
\setups command (with a trailing s) to pass a list of setups or the 
\setup command, both commands allow you to use braces or brackets as 
delimiters for the argument. The \directsetup skips the check for the 
argument form and allows only braces as delimiter.


\startsetups[example-1]
    \startparagraph
    First example!
    \stopparagraph
\stopsetups

\startsetups[example-2]
    \startparagraph
    Second example!
    \stopparagraph
\stopsetups

\starttext

\setups[example-1,example-2]

\blank

\setups{example-1,example-2}

\blank

\setup[example-1]
\setup[example-2]

\blank

\setup{example-1}
\setup{example-2}

\blank

\directsetup{example-1}
\directsetup{example-2}

\stoptext

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] Fwd: Meptapost Drawing not showing-up in Context Letter Style

2019-03-12 Thread Jeroen
Eventually, these two options worked. Firstly changing \setupbackgrounds

% BEGIN MP LOGO SETUP

\startuseMPgraphic{mpglogo}
  path p;
  p := (0,0)--(100,0)--(100,100)--(0,100)--cycle;

  path q;
  q := p cornered 30pt;
  draw q withcolor black withpen pencircle scaled 7pt;
\stopuseMPgraphic

\definelayer
  [logo]
  [repeat=no]

\setlayer
  [logo]
  [hoffset=160mm,voffset=17mm]
  {\scale[width=25mm,height=25mm]{\useMPgraphic{mpglogo}}}

\setupbackgrounds[paper][background=logo]

% END MP LOGO SETUP, BEGIN LETTER SETUP

\usemodule
  [letter]
  [style=dinb]

\setupletterlayer
  [reference]
  [list={name,phone,email,date}]

\setupletterlayer
  [address]
  [y=55mm]

\setupletterdescription
  [enclosure]
  [location=top,
  leftmargin=0.5em,
  symbol=#1,]

\usesymbols
  [mvs]

\definesymbol
  [1]
  [{\symbol[martinvogel 2][PointingHand]}]

\setupletter
  [toname={John Doe},
   toaddress={201, Main Street\\23124 London\\United Kingdom},
   fromname={Jansen NV},
   fromaddress={Waalhaven 2200\\2842 KL Rotterdam},
   name={Piet jansen},
   phone={+31(010)4234 4232},
   email={peter.jan...@gmail.com},
   date={\currentdate},
   signature={Pete},]

% END LETTER SETUP, START LETTER

\startletter
  [subject={Outstanding Invoices},
   opening={Dear Sir,},
   closing={Kind Regards,},
   enclosure={list:Commercial Invoice,Accounts Statement},]

\dorecurse{3}{\input knuth \par}

\stopletter


Alternatively, adjusting \setupletterlayer


\usemodule
  [letter]
  [style=dinb]

% BEGIN MP LOGO SETUP

\startuseMPgraphic{mpglogo}
  path p;
  p := (0,0)--(100,0)--(100,100)--(0,100)--cycle;

  path q;
  q := p cornered 30pt;
  draw q withcolor black withpen pencircle scaled 7pt;
\stopuseMPgraphic

\startsetups[letter:layer:lettermain]
  \scale
[width=25mm,height=25mm]
{\useMPgraphic{mpglogo}}
\stopsetups

\setupletterlayer
  [lettermain]
  [alternative=setups,
   x=160mm,
   y=17mm]

% END MP LOGO SETUP, BEGIN LETTER SETUP

\setupletterlayer
  [reference]
  [list={name,phone,email,date}]

\setupletterlayer
  [address]
  [y=55mm]

\setupletterdescription
  [enclosure]
  [location=top,
   leftmargin=0.5em,
   symbol=#1,]

\usesymbols
  [mvs]
\definesymbol

  [1]
  [{\symbol[martinvogel 2][PointingHand]}]

\setupletter
  [toname={John Doe},
   toaddress={201, Main Street\\23124 London\\United Kingdom},
   fromname={Jansen NV},
   fromaddress={Waalhaven 2200\\2842 KL Rotterdam},
   name={Piet jansen},
   phone={+31(010)4234 4232},
   email={peter.jan...@gmail.com},
   date={\currentdate},
   signature={Pete},]

% END LETTER SETUP, START LETTER

\startletter
  [subject={Outstanding Invoices},
   opening={Dear Sir,},
   closing={Kind Regards,},
   enclosure={list:Commercial Invoice,Accounts Statement},]

\dorecurse
  {3}
  {\input knuth \par}

\stopletter

-- Forwarded message -
From: Wolfgang Schuster 
Date: ma 11 mrt. 2019 om 20:55
Subject: Re: [NTG-context] Meptapost Drawing not showing-up in Context
Letter Style
To: mailing list for ConTeXt users , Context NTG <
context...@gmail.com>


Context NTG schrieb am 10.03.19 um 16:59:
> I am trying to get a metapost drawing as logo added to right upper
> corner of a DIN B style letterhead, but it does not show up, just the
> letter itself. Is there anything to change to the layers for the MP toe
> reveal itself?

The letter module uses local settings for the page background to place
all the layer for the header, footer etc. and your own background setup
is overloaded by the module.


What you can do in this case is to use the predefined but unused
lettermain layer to place your logo in the background.


\usemodule[letter][style=dinb]

\startuseMPgraphic{mpglogo}
   path p;
   p := (0,0)--(100,0)--(100,100)--(0,100)--cycle ;
   path q;
   q := p cornered 30pt;
   draw q withcolor black withpen pencircle scaled 7pt ;
\stopuseMPgraphic

\startsetups[letter:layer:lettermain]
   \scale[width=25mm,height=25mm]{\useMPgraphic{mpglogo}}
\stopsetups

\setupletterlayer
   [lettermain]
   [alternative=setups,
x=160mm,
y=17mm]

\startletter
\dorecurse{3}{\input knuth \par}
\stopletter


Another way to place content in the background is to use the “paper” (or
“text”) background which isn’t used by the letter module and your
settings won’t be overloaded.

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] Meptapost Drawing not showing-up in Context Letter Style

2019-03-10 Thread Context NTG
I am trying to get a metapost drawing as logo added to right upper corner
of a DIN B style letterhead, but it does not show up, just the letter
itself. Is there anything to change to the layers for the MP toe reveal
itself?

Thanks, Jeroen

% BEGIN MP LOGO SETUP
\startuseMPgraphic{mpglogo}
  path p;
  p := (0,0)--(100,0)--(100,100)--(0,100)--cycle;

  path q;
  q := p cornered 30pt;
  draw q withcolor black withpen pencircle scaled 7pt;
\stopuseMPgraphic
\definelayer
  [logo]
  [repeat=no]
\setlayer
  [logo]
  [hoffset=160mm,voffset=17mm]
  {\scale[width=25mm,height=25mm]{\useMPgraphic{mpglogo}}}

\setupbackgrounds[page][background=logo]
% END MP LOGO SETUP, BEGIN LETTER SETUP
\usemodule[letter][style=dinb]
\setupletterlayer
  [reference]
  [list={name,phone,email,date}]

\setupletterlayer
  [address]
  [y=55mm]

\setupletterdescription
  [enclosure]
  [location=top,
  leftmargin=0.5em,
  symbol=#1,]
\usesymbols[mvs]
\definesymbol[1][{\symbol[martinvogel 2][PointingHand]}]
\setupletter
  [toname={John Doe},
  toaddress={201, Main Street\\23124 London\\United Kingdom},
  fromname={Jansen NV},
  fromaddress={Waalhaven 2200\\2842 KL Rotterdam},
  name={Piet jansen},
  phone={+31(010)4234 4232},
  email={peter.jan...@gmail.com},
  date={\currentdate},

signature={\externalfigure[autograph][height=4\lineheight]\\\correspondenceparameter{name}},]
% END LETTER SETUP, START LETTER

\startletter
  [subject={Outstanding Invoices},
  opening={Dear Sir,},
  closing={Kind Regards,},
  enclosure={list:Commercial Invoice,Accounts Statement},]
\dorecurse{3}{\input knuth \par}
\stopletter
___
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] expansion inside PDF annotations

2019-03-07 Thread Pablo Rodriguez
On 3/6/19 10:34 PM, Wolfgang Schuster wrote:
> Pablo Rodriguez schrieb am 05.03.19 um 17:44:
>> [...]
>>  \attachment
>>  [http://pragma-ade.com/general/manuals/xtables-mkiv.pdf]
>>  [author={Attached on \currentdate},
>>   title={Attached on \currentdate}]
>>
>> How can I get \currentdate expanded in the PDF annotation?
> 
> Can you try \rawdate[] (the argument is mandatory).

Many thanks for your reply, Wolfgang.

This works fine, but I’m afraid this is a workaround (I mean, I cannot
even add the the \currentime [not to mention other commands]).

Full expansion would be extremely useful with all features that are
enabled by \setupinteraction.

I reported this issue before:
https://mailman.ntg.nl/pipermail/ntg-context/2017/089035.html.

Sorry, I don’t know whether this is real full expansion or prerolling.
This is the way Hans names both directives for bookmarks and PDF
document information:

\enabledirectives[interaction.identity.preroll]
\enabledirectives[references.bookmarks.preroll]

In any case, I think there is a good use for commands inside interactive
contents in ConTeXt.

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] expansion inside PDF annotations

2019-03-06 Thread Wolfgang Schuster

Pablo Rodriguez schrieb am 05.03.19 um 17:44:

Dear list,

I have the following sample:

 \setupinteraction[state=start]
 \starttext
 \startTEXpage[offset=1em]
 Attached on \currentdate.
 \attachment
 [http://pragma-ade.com/general/manuals/xtables-mkiv.pdf]
 [author={Attached on \currentdate},
  title={Attached on \currentdate}]
 \stopTEXpage
 \stoptext

How can I get \currentdate expanded in the PDF annotation?


Can you try \rawdate[] (the argument is mandatory).

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] issue with \startattachment...\stopattachment

2019-03-05 Thread Wolfgang Schuster

Pablo Rodriguez schrieb am 05.03.19 um 20:57:

Dear list,

I have the following sample:

 \setupinteraction[state=start]
 \starttext
 \startTEXpage[offset=1em]
 \startattachment
 [http://pragma-ade.com/general/manuals/xtables-mkiv.pdf]
 Attached file.
 \stopattachment
 Attached on \currentdate.
 \stopTEXpage
 \stoptext

I have a question: shouldn’t be “Attached file.” typeset on the main text?


No because

\startattachment
...
\stopattachment

is the same as

\startbuffer[...]
...
\stopbuffer

\attachment[buffer=...]

where you combine the buffer and \attachment in a single construct.

This does also mean the argument you pass to \startattachment is wrong.

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] issue with \startattachment...\stopattachment

2019-03-05 Thread Pablo Rodriguez
Dear list,

I have the following sample:

\setupinteraction[state=start]
\starttext
\startTEXpage[offset=1em]
\startattachment
[http://pragma-ade.com/general/manuals/xtables-mkiv.pdf]
Attached file.
\stopattachment
Attached on \currentdate.
\stopTEXpage
\stoptext

I have a question: shouldn’t be “Attached file.” typeset on the main text?

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
___


[NTG-context] expansion inside PDF annotations

2019-03-05 Thread Pablo Rodriguez
Dear list,

I have the following sample:

\setupinteraction[state=start]
\starttext
\startTEXpage[offset=1em]
Attached on \currentdate.
\attachment
[http://pragma-ade.com/general/manuals/xtables-mkiv.pdf]
[author={Attached on \currentdate},
 title={Attached on \currentdate}]
\stopTEXpage
\stoptext

How can I get \currentdate expanded in the PDF annotation?

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] Issue with the latest beta of context standalone

2019-01-27 Thread Otared Kavian


> On 27 Jan 2019, at 16:55, Hans Hagen  wrote:
> 
> […]
> put this in cont-new.mkiv  (after \unprotect)
> 
> \def\syst_converters_check_date
>  {\edef\temp{\systemparameter\c!d}\scratchcounterone 
> \ifx\temp\empty\normalday  \else\temp\fi
>   \edef\temp{\systemparameter\c!m}\scratchcountertwo 
> \ifx\temp\empty\normalmonth\else\temp\fi
> \edef\temp{\systemparameter\c!y}\scratchcounterthree\ifx\temp\empty\normalyear
>  \else\temp\fi}

Hi Hans,

Thanks for your attention.
Unfortunately this does not seem to solve the problem after remaking the 
formats. The following example

\mainlanguage[nl]

\starttext
\currentdate
\stoptext

gives 2019 maart 27.

Best regards: OK
___
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] Issue with the latest beta of context standalone

2019-01-27 Thread Otared Kavian
Hi Hans,

I can confirm that with version 2019.01.25 20:06, when the main language is set 
to fr, the \date command does not work correctly.
However setting
\mainlanguage[en]
gives the correct behavior of \date, in english, in the example file sent by 
Fabrice.

Also this minimal example gives a wrong date:

\mainlanguage[fr]
 \starttext
  \currentdate
 \stoptext

gives 27 mars 2019 (with two months in advance… :-)
\mainlanguage[en]
or any other language, gives the same error (March 27, 2019).

Best regards: OK

> On 27 Jan 2019, at 13:17, Fabrice Couvreur  
> wrote:
> 
> Hi,
> I just updated context standalone and if I compile the following file, the 
> date does not appear anymore.
> Thank you
> Fabrice
> 
>   \mainlanguage[fr]
> 
>   \setupbackgrounds
> [header]
> [text]
> [frame=off,
>  topframe=off,
>  bottomframe=on,
>  framecolor=,
>  rulethickness=1pt]
> 
>   \defineframed
>[headerframed]
>[frame=off,
> height=fit,
> width=fit]
> 
>\startsetups [headertext]
> \setupheadertexts
> [{
> \startframed [headerframed] [foregroundstyle=bold]
> \getvariable{headertext}{title} 
> n\high{o}\,\getvariable{headertext}{number}
> \stopframed
> }]
> 
> \setupheadertexts
> [{
> \startframed [headerframed] [align=flushleft,foregroundstyle=\ssx]
> \getvariable{headertext}{location}\\
> \getvariable{headertext}{time}
> \stopframed
> }]
> [{
> \startframed [headerframed] 
> [align=flushright,foregroundstyle=\ssx]
> Lycée LA SALLE\\
> 
> \date[d=\getvariable{headertext}{day},m=\getvariable{headertext}{month},y=\getvariable{headertext}{year}]
> \stopframed
> }]
> 
>   \stopsetups
> 
>   \setvariable{headertext}{set}{\directsetup{headertext}}
> 
>   \setvariables
>   [headertext]
>   [title={Interrogation écrite},
>number={6},
>day={29},
>month={01},
>year={2019},
>location={Seconde GTE},
>time={55 minutes}]
> 
>\starttext
>  \input 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
> ___

___
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] inmargin produces underfull hbox

2018-09-07 Thread Wolfgang Schuster
You can get of the warning by changing the alignment for the \margindata 
entries.


\setupmarginframed
  [inmargin]
  [align={flushright,broad}]

\starttext

Overfull\inmargin{abc}

\stoptext


You can produce the same message with the following example.

\starttext

\vbox
  {\hsize\leftmarginwidth
   \setupalign[flushright]
   \bf abc}

\stoptext


Wolfgang


Hans van der Meer schrieb am 07.09.18 um 13:02:

This minimal example:
\starttext
\currentdate-\currenttime\quad\ConTeXt-version=\contextversion\blank
Testing \ConTeXt macro\ \tex{inmargin}
\blank
Some text to fill the body of the text.\par
\inmargin{\hbox{abc}}
Some text to fill the body of the text\par
\stoptext

produces an underfull hbox:

Underfull \hbox (badness 1210) in paragraph at lines 6--6
 [][][]

the same happens with the line: \inmargin{abc}
Underfull \hbox (badness 1210) in paragraph at lines 6--6
 []<9: lmroman12-bold @ 12.0pt> abc[]

addition of \hfil or \hss doesn’t help.

My conclusion: this is somewhere located in \inmargin. It would be 
nice if this can be resolved, because in procession some 500 
\inmargin’s the log is cluttered with all these messages.


dr. Hans van der Meer




___
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] inmargin produces underfull hbox

2018-09-07 Thread Hans van der Meer
This minimal example:
\starttext
\currentdate-\currenttime\quad\ConTeXt-version=\contextversion\blank
Testing \ConTeXt macro\ \tex{inmargin}
\blank
Some text to fill the body of the text.\par
\inmargin{\hbox{abc}}
Some text to fill the body of the text\par
\stoptext

produces an underfull hbox:

Underfull \hbox (badness 1210) in paragraph at lines 6--6
 [][][]

the same happens with the line: \inmargin{abc}
Underfull \hbox (badness 1210) in paragraph at lines 6--6
 []<9: lmroman12-bold @ 12.0pt> abc[]

addition of \hfil or \hss doesn’t help.

My conclusion: this is somewhere located in \inmargin. It would be nice if this 
can be resolved, because in procession some 500 \inmargin’s the log is 
cluttered with all these messages.

dr. Hans van der Meer


___
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] Use of context in lua (was: date calculated with currentdate plus n days)

2018-08-14 Thread Jan U. Hasecke
On 14.08.2018 16:58, Pablo Rodriguez wrote:
> I rewrote your sample as (xtables are the only tables I know in ConTeXt):
> 
> \starttext
> \startlua
> context.startxtable()
> context.startxrow()
>  context.startxcell()
>   context("Note 1")
>  context.stopxcell()
>  context.startxcell()
>   context("Note 2")
>  context.stopxcell()
> context.stopxrow()
> context.startxrow()
>  context.startxcell()
>   context("Note 3")
>  context.stopxcell()
>  context.startxcell()
>   context("Note 4")
>  context.stopxcell()
> context.stopxrow()
> context.stopxtable()
> \stoplua
> \stoptext

Seeing this example I wonder if there is already an example taking a
csv-file and creating a table based on its content. I guess building
blocks are readfile, loops and setting the stop sign (; oder ,).

As I know a bit of Python, at least, I might be able to search for the
building blocks in the doku. ;-)

juh
___
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] date calculated with currentdate plus n days

2018-08-14 Thread Pablo Rodriguez
On 08/14/2018 09:24 AM, Henri Menke wrote:
> On 14/08/18 17:29, Pablo Rodriguez wrote:
>> [...]
>> Where are those context.* Lua commands documented?
>>
>> I want to generate an xtable using Lua code, but I don’t know where to read.
> 
> They aren't documented because they are just the context commands.  You 
> can read more about how it works in 
> http://www.pragma-ade.nl/general/manuals/cld-mkiv.pdf

Many thanks for your reply, Henri.

I remember paging through the manual, it’s included in the distribution.

I rewrote your sample as (xtables are the only tables I know in ConTeXt):

\starttext
\startlua
context.startxtable()
context.startxrow()
 context.startxcell()
  context("Note 1")
 context.stopxcell()
 context.startxcell()
  context("Note 2")
 context.stopxcell()
context.stopxrow()
context.startxrow()
 context.startxcell()
  context("Note 3")
 context.stopxcell()
 context.startxcell()
  context("Note 4")
 context.stopxcell()
context.stopxrow()
context.stopxtable()
\stoplua
\stoptext

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] date calculated with currentdate plus n days

2018-08-14 Thread Henri Menke



On 14/08/18 17:29, Pablo Rodriguez wrote:

On 08/14/2018 01:46 AM, Henri Menke wrote:

On top of that I recommend to use context.date to get the correct
formatting according to the current language options:

\def\duedate{\ctxlua{
local t = os.date('*t', os.time()+ 10 * 24 * 3600)
context.date{ d = t.day, m = t.month, y = t.year }
}}


Many thanks for your reply, Henri.

Where are those context.* Lua commands documented?

I want to generate an xtable using Lua code, but I don’t know where to read.


They aren't documented because they are just the context commands.  You 
can read more about how it works in 
http://www.pragma-ade.nl/general/manuals/cld-mkiv.pdf


Here a little sample with an xtable:

\starttext

\startluacode
local function duedate()
local t = os.date('*t', os.time()+ 10 * 24 * 3600)
context.date{ d = t.day, m = t.month, y = t.year }
end

context.startxtable{frame = "off"}
   context.NC() context("Note") context.NC() context("Date") context.NR()
   context.NC() context("Hand in before") context.NC() duedate() 
context.NR()

context.stopxtable()
\stopluacode

\stoptext



Many thanks for your help,

Pablo


___
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] date calculated with currentdate plus n days

2018-08-13 Thread Pablo Rodriguez
On 08/14/2018 01:46 AM, Henri Menke wrote:
> On top of that I recommend to use context.date to get the correct 
> formatting according to the current language options:
> 
> \def\duedate{\ctxlua{
>local t = os.date('*t', os.time()+ 10 * 24 * 3600)
>context.date{ d = t.day, m = t.month, y = t.year }
> }}

Many thanks for your reply, Henri.

Where are those context.* Lua commands documented?

I want to generate an xtable using Lua code, but I don’t know where to read.

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] date calculated with currentdate plus n days

2018-08-13 Thread Henri Menke
On top of that I recommend to use context.date to get the correct 
formatting according to the current language options:


\starttext

\def\duedate{\ctxlua{
  local t = os.date('*t', os.time()+ 10 * 24 * 3600)
  context.date{ d = t.day, m = t.month, y = t.year }
}}

\duedate

\stoptext

On 14/08/18 05:37, Jan U. Hasecke wrote:

On 13.08.2018 17:57, Pablo Rodriguez wrote:


if you don’t mind using Lua, here you have it:

 \starttext
 \def\duedate{\cldcontext{os.date('\letterpercent d/\letterpercent
 m/\letterpercent Y', os.time()+ 10 * 24 * 3600)}}

 \duedate
 \stoptext

Just in case it helps,


Thanks!

I thought it should be possible with lua, but I found no entry point to
use lua in context by defining new commands.

juh



___
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] date calculated with currentdate plus n days

2018-08-13 Thread Jan U. Hasecke
On 13.08.2018 17:57, Pablo Rodriguez wrote:

> if you don’t mind using Lua, here you have it:
> 
> \starttext
> \def\duedate{\cldcontext{os.date('\letterpercent d/\letterpercent
> m/\letterpercent Y', os.time()+ 10 * 24 * 3600)}}
> 
> \duedate
> \stoptext
> 
> Just in case it helps,

Thanks!

I thought it should be possible with lua, but I found no entry point to
use lua in context by defining new commands.

juh



___
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] date calculated with currentdate plus n days

2018-08-13 Thread Pablo Rodriguez
On 08/13/2018 05:19 PM, Jan U. Hasecke wrote:
> Hi all,
> 
> I want to insert a due date for payments in my invoice and I would like
> to calculate it from \currentdate. Something like
> 
> define \duedate = \currentdate plus 10 days
> 
> Is this possible?

Hi Jan-Ulrich,

if you don’t mind using Lua, here you have it:

\starttext
\def\duedate{\cldcontext{os.date('\letterpercent d/\letterpercent
m/\letterpercent Y', os.time()+ 10 * 24 * 3600)}}

\duedate
\stoptext

Just in case it helps,

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
___

[NTG-context] date calculated with currentdate plus n days

2018-08-13 Thread Jan U. Hasecke
Hi all,

I want to insert a due date for payments in my invoice and I would like
to calculate it from \currentdate. Something like

define \duedate = \currentdate plus 10 days

Is this possible?

juh
___
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] letter: How to customize reference line?

2018-06-25 Thread Wolfgang Schuster

Hi Paul,

you have to use the \setupletterlayer command to change the entries in 
the reference line.


\usemodule[letter]

\setupletter
  [name={Joe User}]

\setupletterlayer
  [reference]
  [list={name,date}]

\startletter
...
\stopletter


If you don’t get a title for your entry you can add it with the 
\setuplettertext command.


\setuplettertext[de][mobile=Mobilfunknummer]


Wolfgang


Paul Menzel <mailto:pmenzel+ntg-cont...@molgen.mpg.de>
24. Juni 2018 um 15:40
Dear ConTeXt folks,


I am trying to customize the reference line in a letter.

```
$ context --version

mtx-context | ConTeXt Process Management 1.01
mtx-context |
mtx-context | main context file: 
/usr/share/texmf/tex/context/base/mkiv/context.mkiv

mtx-context | current version: 2017.05.15 21:48
```

The example from Wolfgang’s `correspondence.pdf` [1] doesn’t work for me.

```
\setupletter
  [name={Joe User},
   date=\currentdate]

\setupletter
  [list={name,date}]
```

Only the date is shown in the reference line.

The solution from chapter 9 also does not work. Still only the date is 
shown.


```
\setupletter
  [name={Joe User},
   date=\currentdate]

\setupletterstyle[reference][list={name,date}]
```

Do I need to create a new customized reference line to add other 
fields next to the date to the reference line?



Kind regards,

Paul


[1]: https://bitbucket.org/wolfs/correspondence/downloads/
___
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] letter: How to customize reference line?

2018-06-25 Thread Paul Menzel

Dear ConTeXt folks,


I am trying to customize the reference line in a letter.

```
$ context --version

mtx-context | ConTeXt Process Management 1.01
mtx-context |
mtx-context | main context file: 
/usr/share/texmf/tex/context/base/mkiv/context.mkiv

mtx-context | current version: 2017.05.15 21:48
```

The example from Wolfgang’s `correspondence.pdf` [1] doesn’t work for me.

```
\setupletter
  [name={Joe User},
   date=\currentdate]

\setupletter
  [list={name,date}]
```

Only the date is shown in the reference line.

The solution from chapter 9 also does not work. Still only the date is 
shown.


```
\setupletter
  [name={Joe User},
   date=\currentdate]

\setupletterstyle[reference][list={name,date}]
```

Do I need to create a new customized reference line to add other fields 
next to the date to the reference line?



Kind regards,

Paul


[1]: https://bitbucket.org/wolfs/correspondence/downloads/
\usemodule[letter][extension=optimize]

\mainlanguage[de]

\setupletterstyle
  [option]
  [whitespace=line,
   optimize=yes,
   ]

\setupletter
  [toname={Vodafone Kabel Deutschland GmbH},
   toaddress={Kundenservice\\99116 Erfurt}]

\setupletter
  [fromname={Hanna Musterfrau},
   fromaddress={Irgendwostr. 18\\9 Nirgendwo}]

\setupletter
  [name={Joe User},
   date=\currentdate]

\setupletterstyle[reference][list={name,date}]

\starttext

\setupletter
  [subject={Reason},
   opening={Sehr geehrte Damen und Herren,},
   closing={Freundliche Grüße},
   signature={Paul Menzel}]

\startletter\relax
\dorecurse{4}{\input ward\par}
\stopletter

\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] problem with character entities in XML processing

2018-04-19 Thread Hans van der Meer
Indeed. I should have known better. Temporary attack of brain weakness, I 
suppose. For those who want to see for themselves, the minimal example below 
will do.

dr. Hans van der Meer

% test character entity.
\startxmlsetups demo:entity
\xmlsetsetup{#1}{root}{demo:entity:*}
\stopxmlsetups
\xmlregisterdocumentsetup{demo}{demo:entity}
\startxmlsetups demo:entity:root
\blank Start test:\crlf
flushing: \xmlflush{#1}\crlf
End test\blank
\stopxmlsetups
\startbuffer[demo]

amp = & and #38 = &
\stopbuffer
\starttext
\currentdate-\currenttime\quad\ConTeXt-version=\contextversion\blank
{\bf Testing use of character entities}\blank
These should produce the same result: \type{&} and \type{&} and indeed 
they do.\blank
\xmlprocessbuffer{demo}{demo}{}\blank
\stoptext



> On 19 Apr 2018, at 14:44, Hans Hagen  wrote:
> 
> On 4/19/2018 10:53 AM, Hans van der Meer wrote:
>> The following use of character entities & aborts in ConTeXt. That is of 
>> course because the # is seen as a parameter. Changing this to &\#xxx; or 
>> &\letterhash xxx; typesets & as is, but that is not the intention, 
>> because an ampersand should appear. So, how do I proceed here?
>> Minimal example:
>> % test character entity failure.
>> \startxmlsetups demo:entity
>> \xmlsetsetup{#1}{root}{demo:entity:*}
>> \stopxmlsetups
>> \xmlregisterdocumentsetup{demo}{demo:entity}
>> \startxmlsetups demo:entity:root
>> \blank Start test:\crlf
>> root:  = "&"\crlf
>> root:  = "&\letterhash 038;”\crlf % &\#038; produces the same
>> End test\blank
>> \stopxmlsetups
> 
> you are tex mode there so & == &
> 
> 
>> \startbuffer[demo]
>> 
>> \stopbuffer
>> \starttext
>> \currentdate-\currenttime\quad\ConTeXt-version=\contextversion\blank
>> {\bf Testing use of character entities}\blank
>> These should produce the same result: \type{&} and \type{&}\blank
>> \xmlprocessbuffer{demo}{demo}{}\blank
>> \stoptext
>> dr. Hans van der Meer
>> ___
>> 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
>> ___
> 
> 
> -- 
> 
> -
>  Hans Hagen | PRAGMA ADE
>  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>   tel: 038 477 53 69 | www.pragma-ade.nl <http://www.pragma-ade.nl/> | 
> www.pragma-pod.nl <http://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
___

Re: [NTG-context] goto reference

2018-04-19 Thread Taco Hoekwater
Hi Hans (van der Meer),

Not sure if the next would be useful to you, but I want to mention anyway
that you can open a local external pdf file to a specific destination, 
using a syntax like this:

  \goto{localfile.pdf::externalreference}

Where “externalreference” is a defined destination in the external
pdf. Since my own generated pdfs tend to have special “page-” 
destinations, I can usually access my own external files with:

   \goto{myfile.pdf::page-5}

I believe this was intended to be used with \usereferences in mkii,
but it works just fine without the \usereferences call in mkiv. Mkiv
does not do any checking on the target validity, though.

This generates a /GoToR link instead of /URI, and that also means
that AR does not open the document in your browser (which is wildly 
annoying) :)

Looking at the lua code in lpdf-ano, it hints that it should be possible
to feed an actual page number in, but if that is true, then I have no idea
what the syntax should be … or it could be a case of NIY?


A quick and dirty way to create external page destinations is:

  \setupinteraction[state=start]
  \setuplayout[top=1sp,topdistance=1sp]
  \setuptoptexts[{\contentreference[page-\the\pageno]{}}]

Hope this helps,

Taco



> On 19 Apr 2018, at 10:55, Hans van der Meer  wrote:
> 
> Thanks, for verifying the behaviour. A pity it does not work as I hoped for, 
> but it is not disastrous, of course :-)
> 
> dr. Hans van der Meer
> 
> 
>> On 19 Apr 2018, at 10:12, Otared Kavian  wrote:
>> 
>> Hi,
>> 
>> I tested your example (after giving some local paths…) and the behaviour as 
>> follows:
>> (1) The full URL path with http:// opens the file at the desired page
>> (2) The full ftp:// local path opens my file at page 1
>> (3) The local path file:// to afile sitting in the same directory does not 
>> work at all.
>> 
>> I just saw that John Grasty gave an explanation from the specifications of 
>> Adobe: maybe that is the reason.
>> 
>> Best regards: OK
>> 
>>> On 19 Apr 2018, at 09:37, Hans van der Meer  wrote:
>>> 
>>> The goto to the internet as given by Wolfgang works here too, but other 
>>> configurations do not. Please ascertain my observations from the test given 
>>> below. You should replace the absolute path by your own, of course. Three 
>>> cases are programmed:
>>> (1) Wolfgang’s
>>> (2) full path ftp:// access opens file but at last page opened
>>> (3) local path does not open and brings up an Alert
>>> Run from TeXShop and also directly in Preview and Adobe Reader with the 
>>> same results.
>>> 
>>> Thanks in advance.
>>> 
>>> dr. Hans van der Meer
>>> 
>>> 
>>> \starttext
>>> \currentdate-\currenttime\quad\ConTeXt-version=\contextversion\blank
>>> Testing directly from \ConTeXt:\blank
>>> \setupinteraction[state=start,color=blue,style=italic]
>>> \goto{Beginners manual called with http:// opens in browser as 
>>> expected}[url(http://pragma-ade.com/general/manuals/mp-cb-en.pdf\letterhash 
>>> page=50)]\blank
>>> file test.pdf sits in the current directory.\blank
>>> \goto{click test.pdf page10 with ftp:///Users/... (full path given) opens 
>>> at last page opened not at page 10 in Apple's 
>>> Preview}[url(file:///Users/hansm/TeX/Test-tex/gotopdf/test.pdf\letterhash 
>>> page=10)]{\quad\bf Put your own path here!}\blank
>>> \goto{click test.pdf page10 with ftp://test.pdf (local path)) does not 
>>> open}[url(file://test.pdf\letterhash page=10)]\blank
>>> \stoptext
>>> 
>>> 
>>>> On 19 Apr 2018, at 02:07, Otared Kavian  wrote:
>>>> 
>>>> Hi,
>>>> 
>>>> On my Mac, running MacOS High Sierra 10.13.5 Beta, the example given by 
>>>> Wolfgang works fine: clicking on the link created by ConTeXt, from within 
>>>> TeXShop, Safari opens that document on the desired page, that is the 
>>>> physical page 58.
>>>> 
>>>> Best regards: OK
>>>> 
>>>>> On 18 Apr 2018, at 23:04, Hans van der Meer  wrote:
>>>>> 
>>>>> Thanks. But this seems not to work on my Macintosh. Not in Preview, not 
>>>>> in Adobe Reader. 
>>>>> Typesetting resulted in valid-url.pdf#page=55 but the document opens at 
>>>>> the last page remebered by the application. Are there other Macintosh 
>>>>> users who can confirm this is not working on those machines or should I 
>>>>> do something else?
>>>>> 
>>>>> dr. Hans van der Meer
>>

Re: [NTG-context] goto reference

2018-04-19 Thread Hans van der Meer
Thanks, for verifying the behaviour. A pity it does not work as I hoped for, 
but it is not disastrous, of course :-)

dr. Hans van der Meer


> On 19 Apr 2018, at 10:12, Otared Kavian  wrote:
> 
> Hi,
> 
> I tested your example (after giving some local paths…) and the behaviour as 
> follows:
> (1) The full URL path with http:// opens the file at the desired page
> (2) The full ftp:// local path opens my file at page 1
> (3) The local path file:// to afile sitting in the same directory does not 
> work at all.
> 
> I just saw that John Grasty gave an explanation from the specifications of 
> Adobe: maybe that is the reason.
> 
> Best regards: OK
> 
>> On 19 Apr 2018, at 09:37, Hans van der Meer > <mailto:havdm...@ziggo.nl>> wrote:
>> 
>> The goto to the internet as given by Wolfgang works here too, but other 
>> configurations do not. Please ascertain my observations from the test given 
>> below. You should replace the absolute path by your own, of course. Three 
>> cases are programmed:
>> (1) Wolfgang’s
>> (2) full path ftp:// access opens file but at last page opened
>> (3) local path does not open and brings up an Alert
>> Run from TeXShop and also directly in Preview and Adobe Reader with the same 
>> results.
>> 
>> Thanks in advance.
>> 
>> dr. Hans van der Meer
>> 
>> 
>> \starttext
>> \currentdate-\currenttime\quad\ConTeXt-version=\contextversion\blank
>> Testing directly from \ConTeXt:\blank
>> \setupinteraction[state=start,color=blue,style=italic]
>> \goto{Beginners manual called with http:// opens in browser as 
>> expected}[url(http://pragma-ade.com/general/manuals/mp-cb-en.pdf\letterhash 
>> <http://pragma-ade.com/general/manuals/mp-cb-en.pdf/letterhash> 
>> page=50)]\blank
>> file test.pdf sits in the current directory.\blank
>> \goto{click test.pdf page10 with ftp:///Users/ <ftp://users/>... (full path 
>> given) opens at last page opened not at page 10 in Apple's 
>> Preview}[url(file:///Users/hansm/TeX/Test-tex/gotopdf/test.pdf\letterhash 
>>  
>> page=10)]{\quad\bf Put your own path here!}\blank
>> \goto{click test.pdf page10 with ftp://test.pdf <ftp://test.pdf/> (local 
>> path)) does not open}[url(file://test.pdf\letterhash 
>>  page=10)]\blank
>> \stoptext
>> 
>> 
>>> On 19 Apr 2018, at 02:07, Otared Kavian >> <mailto:ota...@gmail.com>> wrote:
>>> 
>>> Hi,
>>> 
>>> On my Mac, running MacOS High Sierra 10.13.5 Beta, the example given by 
>>> Wolfgang works fine: clicking on the link created by ConTeXt, from within 
>>> TeXShop, Safari opens that document on the desired page, that is the 
>>> physical page 58.
>>> 
>>> Best regards: OK
>>> 
>>>> On 18 Apr 2018, at 23:04, Hans van der Meer >>> <mailto:havdm...@ziggo.nl>> wrote:
>>>> 
>>>> Thanks. But this seems not to work on my Macintosh. Not in Preview, not in 
>>>> Adobe Reader. 
>>>> Typesetting resulted in valid-url.pdf#page=55 but the document opens at 
>>>> the last page remebered by the application. Are there other Macintosh 
>>>> users who can confirm this is not working on those machines or should I do 
>>>> something else?
>>>> 
>>>> dr. Hans van der Meer
>>>> 
>>>> 
>>>>> On 18 Apr 2018, at 21:58, Wolfgang Schuster >>>> <mailto:schuster.wolfg...@gmail.com>> wrote:
>>>>> 
>>>>> For documents on the web you can add #page= to the url.
>>>>> 
>>>>> \setupinteraction[state=start]
>>>>> 
>>>>> \starttext
>>>>> \goto{Beginners 
>>>>> manual}[url(http://pragma-ade.com/general/manuals/mp-cb-en.pdf\letterhash 
>>>>> <http://pragma-ade.com/general/manuals/mp-cb-en.pdf/letterhash> page=58)]
>>>>> \stoptext
>>>>> 
>>>>> Wolfgang
>>>>>> Hans van der Meer <mailto:havdm...@ziggo.nl> 18. April 2018 um 21:12
>>>>>> I have the following question about referencing.
>>>>>> 
>>>>>> With \goto{typeset_the_text}[url(file://a_file_location_to_goto 
>>>>>> .pdf)] I can open a pdf from inside the 
>>>>>> document that has been typeset. It would, however, be nice if I could 
>>>>>> further specify on which page of the pdf to open. Is this possible? Or 
>>>>>> is this a wish not to be fulfilled?
>>>>>

[NTG-context] problem with character entities in XML processing

2018-04-19 Thread Hans van der Meer
The following use of character entities & aborts in ConTeXt. That is of course because the # is seen as a parameter. Changing this to &\#xxx; or &\letterhash xxx; typesets & as is, but that is not the intention, because an ampersand should appear. So, how do I proceed here?Minimal example:% test character entity failure.\startxmlsetups demo:entity	\xmlsetsetup{#1}{root}{demo:entity:*}\stopxmlsetups\xmlregisterdocumentsetup{demo}{demo:entity}\startxmlsetups demo:entity:root	\blank Start test:\crlf	root:  = "&"\crlf	root:  = "&\letterhash 038;”\crlf % &\#038; produces the same	End test\blank\stopxmlsetups\startbuffer[demo]\stopbuffer\starttext\currentdate-\currenttime\quad\ConTeXt-version=\contextversion\blank{\bf Testing use of character entities}\blankThese should produce the same result: \type{&} and \type{&}\blank\xmlprocessbuffer{demo}{demo}{}\blank\stoptext

xml-entity.pdf
Description: Adobe PDF document

dr. Hans van der Meer

___
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] goto reference

2018-04-19 Thread Otared Kavian
Hi,

I tested your example (after giving some local paths…) and the behaviour as 
follows:
(1) The full URL path with http:// opens the file at the desired page
(2) The full ftp:// local path opens my file at page 1
(3) The local path file:// to afile sitting in the same directory does not work 
at all.

I just saw that John Grasty gave an explanation from the specifications of 
Adobe: maybe that is the reason.

Best regards: OK

> On 19 Apr 2018, at 09:37, Hans van der Meer  wrote:
> 
> The goto to the internet as given by Wolfgang works here too, but other 
> configurations do not. Please ascertain my observations from the test given 
> below. You should replace the absolute path by your own, of course. Three 
> cases are programmed:
> (1) Wolfgang’s
> (2) full path ftp:// access opens file but at last page opened
> (3) local path does not open and brings up an Alert
> Run from TeXShop and also directly in Preview and Adobe Reader with the same 
> results.
> 
> Thanks in advance.
> 
> dr. Hans van der Meer
> 
> 
> \starttext
> \currentdate-\currenttime\quad\ConTeXt-version=\contextversion\blank
> Testing directly from \ConTeXt:\blank
> \setupinteraction[state=start,color=blue,style=italic]
> \goto{Beginners manual called with http:// opens in browser as 
> expected}[url(http://pragma-ade.com/general/manuals/mp-cb-en.pdf\letterhash 
> <http://pragma-ade.com/general/manuals/mp-cb-en.pdf/letterhash> 
> page=50)]\blank
> file test.pdf sits in the current directory.\blank
> \goto{click test.pdf page10 with ftp:///Users/ <ftp://users/>... (full path 
> given) opens at last page opened not at page 10 in Apple's 
> Preview}[url(file:///Users/hansm/TeX/Test-tex/gotopdf/test.pdf\letterhash 
>  
> page=10)]{\quad\bf Put your own path here!}\blank
> \goto{click test.pdf page10 with ftp://test.pdf <ftp://test.pdf/> (local 
> path)) does not open}[url(file://test.pdf\letterhash 
>  page=10)]\blank
> \stoptext
> 
> 
>> On 19 Apr 2018, at 02:07, Otared Kavian > <mailto:ota...@gmail.com>> wrote:
>> 
>> Hi,
>> 
>> On my Mac, running MacOS High Sierra 10.13.5 Beta, the example given by 
>> Wolfgang works fine: clicking on the link created by ConTeXt, from within 
>> TeXShop, Safari opens that document on the desired page, that is the 
>> physical page 58.
>> 
>> Best regards: OK
>> 
>>> On 18 Apr 2018, at 23:04, Hans van der Meer >> <mailto:havdm...@ziggo.nl>> wrote:
>>> 
>>> Thanks. But this seems not to work on my Macintosh. Not in Preview, not in 
>>> Adobe Reader. 
>>> Typesetting resulted in valid-url.pdf#page=55 but the document opens at the 
>>> last page remebered by the application. Are there other Macintosh users who 
>>> can confirm this is not working on those machines or should I do something 
>>> else?
>>> 
>>> dr. Hans van der Meer
>>> 
>>> 
>>>> On 18 Apr 2018, at 21:58, Wolfgang Schuster >>> <mailto:schuster.wolfg...@gmail.com>> wrote:
>>>> 
>>>> For documents on the web you can add #page= to the url.
>>>> 
>>>> \setupinteraction[state=start]
>>>> 
>>>> \starttext
>>>> \goto{Beginners 
>>>> manual}[url(http://pragma-ade.com/general/manuals/mp-cb-en.pdf\letterhash 
>>>> <http://pragma-ade.com/general/manuals/mp-cb-en.pdf/letterhash> page=58)]
>>>> \stoptext
>>>> 
>>>> Wolfgang
>>>>> Hans van der Meer <mailto:havdm...@ziggo.nl> 18. April 2018 um 21:12
>>>>> I have the following question about referencing.
>>>>> 
>>>>> With \goto{typeset_the_text}[url(file://a_file_location_to_goto 
>>>>> .pdf)] I can open a pdf from inside the 
>>>>> document that has been typeset. It would, however, be nice if I could 
>>>>> further specify on which page of the pdf to open. Is this possible? Or is 
>>>>> this a wish not to be fulfilled?
>>>>> 
>>>>> dr. Hans van der Meer
>>>>> 
>>>>> 
>>>>> ___
>>>>> If your question is of interest to others as well, please add an entry to 
>>>>> the Wiki!
>>>>> 
>>>>> maillist : ntg-context@ntg.nl <mailto:ntg-context@ntg.nl> / 
>>>>> http://www.ntg.nl/mailman/listinfo/ntg-context 
>>>>> <http://www.ntg.nl/mailman/listinfo/ntg-context>
>>>>> webpage : http://www.pragma-ade.nl <http://www.pr

Re: [NTG-context] goto reference

2018-04-19 Thread John Grasty
Hello all,

Adobe seems to indicate (at least with Adobe Reader/Acrobat) that this isn't 
possible:

"If you use URLs containing local hard drive addresses (c:\folder\), you cannot 
link to page numbers or set destinations."

[https://helpx.adobe.com/acrobat/kb/link-html-pdf-page-acrobat.html]

Sorry to not be of more help,
John Grasty

> On 19 Apr 2018, at 09:37, Hans van der Meer  wrote:
> 
> The goto to the internet as given by Wolfgang works here too, but other 
> configurations do not. Please ascertain my observations from the test given 
> below. You should replace the absolute path by your own, of course. Three 
> cases are programmed:
> (1) Wolfgang’s
> (2) full path ftp:// access opens file but at last page opened
> (3) local path does not open and brings up an Alert
> Run from TeXShop and also directly in Preview and Adobe Reader with the same 
> results.
> 
> Thanks in advance.
> 
> dr. Hans van der Meer
> 
> 
> \starttext
> \currentdate-\currenttime\quad\ConTeXt-version=\contextversion\blank
> Testing directly from \ConTeXt:\blank
> \setupinteraction[state=start,color=blue,style=italic]
> \goto{Beginners manual called with http:// opens in browser as 
> expected}[url(http://pragma-ade.com/general/manuals/mp-cb-en.pdf\letterhash 
> page=50)]\blank
> file test.pdf sits in the current directory.\blank
> \goto{click test.pdf page10 with ftp:///Users/... (full path given) opens at 
> last page opened not at page 10 in Apple's 
> Preview}[url(file:///Users/hansm/TeX/Test-tex/gotopdf/test.pdf\letterhash 
> page=10)]{\quad\bf Put your own path here!}\blank
> \goto{click test.pdf page10 with ftp://test.pdf (local path)) does not 
> open}[url(file://test.pdf\letterhash page=10)]\blank
> \stoptext
> 
> 
>> On 19 Apr 2018, at 02:07, Otared Kavian  wrote:
>> 
>> Hi,
>> 
>> On my Mac, running MacOS High Sierra 10.13.5 Beta, the example given by 
>> Wolfgang works fine: clicking on the link created by ConTeXt, from within 
>> TeXShop, Safari opens that document on the desired page, that is the 
>> physical page 58.
>> 
>> Best regards: OK
>> 
>>> On 18 Apr 2018, at 23:04, Hans van der Meer  wrote:
>>> 
>>> Thanks. But this seems not to work on my Macintosh. Not in Preview, not in 
>>> Adobe Reader. 
>>> Typesetting resulted in valid-url.pdf#page=55 but the document opens at the 
>>> last page remebered by the application. Are there other Macintosh users who 
>>> can confirm this is not working on those machines or should I do something 
>>> else?
>>> 
>>> dr. Hans van der Meer
>>> 
>>> 
>>>> On 18 Apr 2018, at 21:58, Wolfgang Schuster  
>>>> wrote:
>>>> 
>>>> For documents on the web you can add #page= to the url.
>>>> 
>>>> \setupinteraction[state=start]
>>>> 
>>>> \starttext
>>>> \goto{Beginners 
>>>> manual}[url(http://pragma-ade.com/general/manuals/mp-cb-en.pdf\letterhash 
>>>> page=58)]
>>>> \stoptext
>>>> 
>>>> Wolfgang
>>>>> Hans van der Meer 18. April 2018 um 21:12
>>>>> I have the following question about referencing.
>>>>> 
>>>>> With \goto{typeset_the_text}[url(file://a_file_location_to_goto.pdf)] I 
>>>>> can open a pdf from inside the document that has been typeset. It would, 
>>>>> however, be nice if I could further specify on which page of the pdf to 
>>>>> open. Is this possible? Or is this a wish not to be fulfilled?
>>>>> 
>>>>> dr. Hans van der Meer
>>>>> 
>>>>> 
>>>>> ___
>>>>> 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 
>>>

Re: [NTG-context] goto reference

2018-04-19 Thread Hans van der Meer
The goto to the internet as given by Wolfgang works here too, but other 
configurations do not. Please ascertain my observations from the test given 
below. You should replace the absolute path by your own, of course. Three cases 
are programmed:
(1) Wolfgang’s
(2) full path ftp:// access opens file but at last page opened
(3) local path does not open and brings up an Alert
Run from TeXShop and also directly in Preview and Adobe Reader with the same 
results.

Thanks in advance.

dr. Hans van der Meer


\starttext
\currentdate-\currenttime\quad\ConTeXt-version=\contextversion\blank
Testing directly from \ConTeXt:\blank
\setupinteraction[state=start,color=blue,style=italic]
\goto{Beginners manual called with http:// opens in browser as 
expected}[url(http://pragma-ade.com/general/manuals/mp-cb-en.pdf\letterhash 
page=50)]\blank
file test.pdf sits in the current directory.\blank
\goto{click test.pdf page10 with ftp:///Users/... (full path given) opens at 
last page opened not at page 10 in Apple's 
Preview}[url(file:///Users/hansm/TeX/Test-tex/gotopdf/test.pdf\letterhash 
page=10)]{\quad\bf Put your own path here!}\blank
\goto{click test.pdf page10 with ftp://test.pdf (local path)) does not 
open}[url(file://test.pdf\letterhash page=10)]\blank
\stoptext


> On 19 Apr 2018, at 02:07, Otared Kavian  wrote:
> 
> Hi,
> 
> On my Mac, running MacOS High Sierra 10.13.5 Beta, the example given by 
> Wolfgang works fine: clicking on the link created by ConTeXt, from within 
> TeXShop, Safari opens that document on the desired page, that is the physical 
> page 58.
> 
> Best regards: OK
> 
>> On 18 Apr 2018, at 23:04, Hans van der Meer > <mailto:havdm...@ziggo.nl>> wrote:
>> 
>> Thanks. But this seems not to work on my Macintosh. Not in Preview, not in 
>> Adobe Reader. 
>> Typesetting resulted in valid-url.pdf#page=55 but the document opens at the 
>> last page remebered by the application. Are there other Macintosh users who 
>> can confirm this is not working on those machines or should I do something 
>> else?
>> 
>> dr. Hans van der Meer
>> 
>> 
>>> On 18 Apr 2018, at 21:58, Wolfgang Schuster >> <mailto:schuster.wolfg...@gmail.com>> wrote:
>>> 
>>> For documents on the web you can add #page= to the url.
>>> 
>>> \setupinteraction[state=start]
>>> 
>>> \starttext
>>> \goto{Beginners 
>>> manual}[url(http://pragma-ade.com/general/manuals/mp-cb-en.pdf\letterhash 
>>> <http://pragma-ade.com/general/manuals/mp-cb-en.pdf/letterhash> page=58)]
>>> \stoptext
>>> 
>>> Wolfgang
>>>> Hans van der Meer <mailto:havdm...@ziggo.nl> 18. April 2018 um 21:12
>>>> I have the following question about referencing.
>>>> 
>>>> With \goto{typeset_the_text}[url(file://a_file_location_to_goto 
>>>> .pdf)] I can open a pdf from inside the 
>>>> document that has been typeset. It would, however, be nice if I could 
>>>> further specify on which page of the  pdf to open. Is this possible? Or is 
>>>> this a wish not to be fulfilled?
>>>> 
>>>> dr. Hans van der Meer
>>>> 
>>>> 
>>>> ___
>>>> If your question is of interest to others as well, please add an entry to 
>>>> the Wiki!
>>>> 
>>>> maillist : ntg-context@ntg.nl <mailto:ntg-context@ntg.nl> / 
>>>> http://www.ntg.nl/mailman/listinfo/ntg-context 
>>>> <http://www.ntg.nl/mailman/listinfo/ntg-context>
>>>> webpage : http://www.pragma-ade.nl <http://www.pragma-ade.nl/> / 
>>>> http://context.aanhet.net <http://context.aanhet.net/>
>>>> archive : https://bitbucket.org/phg/context-mirror/commits/ 
>>>> <https://bitbucket.org/phg/context-mirror/commits/>
>>>> wiki : http://contextgarden.net <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 <mailto:ntg-context@ntg.nl> / 
>>> http://www.ntg.nl/mailman/listinfo/ntg-context 
>>> <http://www.ntg.nl/mailman/listinfo/ntg-context>
>>> webpage  : http://www.pragma-ade.nl <http://www.pragma-ade.nl/> / 
>>> http://context.aanhet.net <http://context.aanhet.net/>
>>> archiv

Re: [NTG-context] \basegrid ignores color

2018-03-22 Thread Henri Menke
Bump!

I attached the updated core file to make it easier for you.

On Wed, 2018-03-21 at 09:51 +1300, Henri Menke wrote:
> Dear devs,
> 
> The \basegrid macro ignores its color option.  That's kind of obvious because
> as
> I look at the code I don't see the color being communicated to Metapost at any
> point.  When you're at it, could you please also add a rulethickness
> parameters?
>  Thanks!
> 
> Reproducible in TL2018 pertest and latest beta.  MWE is below (as always).
> 
> Cheers, Henri
> 
> ---
> 
> \starttext
> 
> \basegrid[color=red]
> 
> \color[red]{\basegrid}
> 
> \stoptext
> %D \module
%D   [   file=meta-grd,
%Dversion=2012.06.28,
%D  title=\METAPOST\ Graphics,
%D   subtitle=grids,
%D author=Hans Hagen,
%D   date=\currentdate,
%D  copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\writestatus{loading}{MetaPost Graphics / Grids}

%D This used to be a \TEX\ method, and a rather old one too. We keep it around but
%D in a more modern way.
%D
%D \startbuffer
%D \basegrid
%D   [nx=8,ny=5,
%Ddx=.5,dy=.25,
%Dunit=cm,scale=2,factor=1,
%Doffset=1ex,xstep=2,ystep=1,
%Dalign=middle,style=\tt\tx]
%D \stopbuffer
%D
%D \typebuffer
%D
%D \placefigure
%D   {An example of a grid.}
%D   {\getbuffer}

\startuseMPgraphic{grid}{nx,ny,dx,dy,factor,scale,xstep,ystep,xoffset,yoffset,align,rulecolor,rulethickness}
begingroup ;

save nx, ny, dx, dy, wd, ht, xstep, ystep, xoffset, yoffset, align, xalign, yalign, rulecolor, rulethickness ;

numeric nx  ; nx  := \MPvar{nx} ;
numeric ny  ; ny  := \MPvar{ny} ;
numeric dx  ; dx  := \MPvar{factor} * \MPvar{scale} * \MPvar{dx} ;
numeric dy  ; dy  := \MPvar{factor} * \MPvar{scale} * \MPvar{dy} ;
numeric wd  ; wd  := nx * dx ;
numeric ht  ; ht  := ny * dy ;
numeric xstep   ; xstep   := \MPvar{xstep} ;
numeric ystep   ; ystep   := \MPvar{ystep} ;
numeric xoffset ; xoffset := \MPvar{xoffset} ;
numeric yoffset ; yoffset := \MPvar{yoffset} ;
numeric align   ; align   := \MPvar{align} ;
color rulecolor ; rulecolor := \MPvar{rulecolor} ;
numeric rulethickness ; rulethickness := \MPvar{rulethickness} ;
numeric xalign  ; xalign  := 0 ;
numeric yalign  ; yalign  := 0 ;

if align = 1 :
xalign := dx/2 ;
yalign := dy/2 ;
fi ;

for i=0 step dx until wd :
draw (i,0) -- (i,ht)
withpen pencircle scaled rulethickness
withcolor rulecolor ;
endfor ;
for i=0 step dy until ht :
draw (0,i) -- (wd,i)
withpen pencircle scaled rulethickness
withcolor rulecolor ;
endfor ;

if xstep > 0 :
for i=1 step xstep until nx :
draw thetextext.bot(decimal i,(i*dx-xalign,-xoffset));
endfor ;
fi ;
if ystep > 0 :
for i=1 step ystep until ny :
draw thetextext.lft(decimal i,(-yoffset,i*dy-yalign)) ;
endfor ;
fi ;

endgroup ;
\stopuseMPgraphic

\unprotect

\unexpanded\def\basegrid
  {\dosingleempty\typo_grid_base}

\def\typo_grid_base[#1]%
  {\hbox\bgroup
   \getdummyparameters
 [\c!nx=10,\c!ny=10,\c!dx=.5,\c!dy=.5,\c!xstep=0,\c!ystep=0,
  \c!unit=\s!cm,\c!scale=1,\c!factor=1,
  \c!offset=.25ex,\c!xoffset=\directdummyparameter\c!offset,\c!yoffset=\directdummyparameter\c!offset,
  \c!align=,
  \c!rulecolor=\s!black,
  \c!rulethickness=\linewidth,
  #1]%
   \usedummystyleandcolor\c!style\c!color
   \edef\p_align{\directdummyparameter\c!align}%
   \ifx\p_align\v!middle
  \let\p_align\!!plusone
   \else
  \let\p_align\!!zerocount
   \fi
   \useMPgraphic
{grid}%
{nx=\directdummyparameter\c!nx,%
 ny=\directdummyparameter\c!ny,%
 dx=\directdummyparameter\c!dx\directdummyparameter\c!unit,%
 dy=\directdummyparameter\c!dy\directdummyparameter\c!unit,%
 factor=\directdummyparameter\c!factor,%
 scale=\directdummyparameter\c!scale,%
 xstep=\directdummyparameter\c!xstep,%
 ystep=\directdummyparameter\c!ystep,%
 xoffset=\directdummyparameter\c!xoffset,%
 yoffset=\directdummyparameter\c!yoffset,%
 align=\p_align,%
 rulecolor=\directdummyparameter\c!rulecolor,%
 rulethickness=\directdummyparameter\c!rulethickness,%
}%
  \egroup}

\let\grid\basegrid

\protect \endinput
\loadmarkfile{meta-grd}
\starttext
\basegrid[rulecolor=gray,rulethickness=.1pt]
\stoptext
___
If your question is of interest to others as well, please add an entry

Re: [NTG-context] Problem with \definemathmatrix

2018-01-17 Thread Aditya Mahajan

On Wed, 17 Jan 2018, Fabrice Couvreur wrote:


Hello,
This macro that is not mine worked very well. I just tested the following
file and there is a problem.


Otared has already answered your question but ...


\math{M^3=\startpmatrix
  \NC 2 \NC 3 \NC 6  \NC 4 \NC 2 \NC 7  \NC 3  \NC 1 \NR
  \NC 3 \NC 0 \NC 1  \NC 1 \NC 2 \NC 3  \NC 6  \NC 4 \NR
  \NC 6 \NC 1 \NC 4  \NC 4 \NC 4 \NC 9  \NC 10 \NC 6 \NR
  \NC 4 \NC 1 \NC 4  \NC 4 \NC 5 \NC 8  \NC 8  \NC 3 \NR
  \NC 2 \NC 2 \NC 4  \NC 5 \NC 2 \NC 7  \NC 3  \NC 1 \NR
  \NC 7 \NC 3 \NC 9  \NC 8 \NC 7 \NC 8  \NC 10 \NC 3 \NR
  \NC 3 \NC 6 \NC 10 \NC 8 \NC 3 \NC 10 \NC 4  \NC 1 \NR
  \NC 1 \NC 4 \NC 6  \NC 3 \NC 1 \NC 3  \NC 1  \NC 0 \NR

\stoppmatrix}


If you type a lot of such matrices, you might find the attached module 
interesting. Using it you can use matlab-like syntax for writing matrices:


\usemodule[simplematrix]
\definesimplematrix[MATRIX][fence=parenthesis, align=middle]

\starttext
$\MATRIX{1,2,3,4;5,6,7,8;9,10,11,12}$
\stoptext

Aditya%D \module
%D   [ file=t-simplematrix,
%D  version=2014.02.18,
%Dtitle=\CONTEXT\ User Module,
%D subtitle=Simple matrix,
%D   author=Aditya Mahajan,
%D date=\currentdate,
%Dcopyright=Aditya Mahajan,
%Demail=adityam  ieee  org,
%D  license=Simplified BSD License]

\writestatus{loading}{Simple matrix (ver: 2014.02.18)}

\startmodule[simplematrix]

\unprotect

\definenamespace
  [simplematrix]
  [   \c!type=module,
  \c!name=simplematrix,
   \c!command=\v!yes,
setup=\v!list,
\s!parent=simplematrix,
  ]

\setupsimplematrix
  [
\c!distance=\emwidth,
\c!mathstyle=,
fence=bracket,
\c!align=
  ]

\appendtoks
  \setevalue{\currentsimplematrix}{\usesimplematrix[\currentsimplematrix]}
\to \everydefinesimplematrix

\newtoks\simplematrixtoks

\define[1]\simplematrix_row
{\processcommalist[#1]\simplematrix_col
 \appendtoks \NR \to \simplematrixtoks}

\define[1]\simplematrix_col
{\appendtoks \NC #1 \to \simplematrixtoks}

\unexpanded\def\usesimplematrix
{\dodoubleargument\usesimplematrix_indeed}

\def\simplematrix_left

{\edef\p_left{\namedmathfenceparameter{\simplematrixparameter{fence}}\c!left}%
 \normalleft\ifx\p_left\empty.\else\Udelimiter\plusfour\fam\p_left\relax\fi
 \,}

\def\simplematrix_right

{\edef\p_right{\namedmathfenceparameter{\simplematrixparameter{fence}}\c!right}%
 \,
 
\normalright\ifx\p_right\empty.\else\Udelimiter\plusfive\fam\p_right\relax\fi}
 

\def\usesimplematrix_indeed[#name][#options]#matrix%
{\begingroup
 \edef\currentsimplematrix{#name}%
 \setupsimplematrix[#name][#options]%
 \simplematrixtoks\emptytoks
 \startusemathstyleparameter\simplematrixparameter
 \appendtoks 
   \bgroup
   \startmathmatrix
[
  \c!distance=\simplematrixparameter\c!distance,
  \c!left=\simplematrix_left,
  \c!right=\simplematrix_right,
  \c!align=\simplematrixparameter\c!align,
]
\to \simplematrixtoks
 \processlist[];\simplematrix_row[#matrix]%
 \appendtoks \stopmathmatrix \egroup \to \simplematrixtoks
 \the\simplematrixtoks
 \stopusemathstyleparameter
 \endgroup}

\protect

\stopmodule
___
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] MS Office Chinese fonts in ConTeXt

2017-08-27 Thread Hans Hagen

Hi,

Attached is a better alternative (just replace the file in the 
distribution).


\usetypescriptfile[mscore]

\setupbodyfont [mschinese,12pt]
\usebodyfont   [mschinese-light,12pt]

\definebodyfontenvironment[24pt]
\definebodyfontenvironment[18pt]

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
-
%D \module
%D   [   file=type-imp-mscore,
%Dversion=2007.07.30,
%D  title=\CONTEXT\ Typescript Macros,
%D   subtitle=Microsoft Core Fonts,
%D author=Hans Hagen,
%D   date=\currentdate,
%D  copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\starttypescriptcollection[mscore]

% .ttf not really needed but we want to force the originals

\starttypescript [\s!serif] [mscoretimes] [\s!name]
\setups[\s!font:\s!fallback:\s!serif]
\definefontsynonym [\s!Serif]   [\s!file:times.ttf]   
[\s!features=\s!default]
\definefontsynonym [\s!SerifBold]   [\s!file:timesbd.ttf] 
[\s!features=\s!default]
\definefontsynonym [\s!SerifItalic] [\s!file:timesi.ttf]  
[\s!features=\s!default]
\definefontsynonym [\s!SerifBoldItalic] [\s!file:timesbi.ttf] 
[\s!features=\s!default]
\stoptypescript

\starttypescript [\s!sans] [mscorearial] [\s!name]
\setups[\s!font:\s!fallback:\s!sans]
\definefontsynonym [\s!Sans]   [\s!file:arial.ttf]   
[\s!features=\s!default]
\definefontsynonym [\s!SansBold]   [\s!file:arialbd.ttf] 
[\s!features=\s!default]
\definefontsynonym [\s!SansItalic] [\s!file:ariali.ttf]  
[\s!features=\s!default]
\definefontsynonym [\s!SansBoldItalic] [\s!file:arialbi.ttf] 
[\s!features=\s!default]
\stoptypescript

\starttypescript [\s!sans] [mscorearialnarrow] [\s!name]
\setups[\s!font:\s!fallback:\s!sans]
\definefontsynonym [\s!Sans]   [\s!file:arialn.ttf]   
[\s!features=\s!default]
\definefontsynonym [\s!SansBold]   [\s!file:arialnb.ttf]  
[\s!features=\s!default]
\definefontsynonym [\s!SansItalic] [\s!file:arialni.ttf]  
[\s!features=\s!default]
\definefontsynonym [\s!SansBoldItalic] [\s!file:arialnbi.ttf] 
[\s!features=\s!default]
\stoptypescript

\starttypescript [\s!mono] [mscorecourier] [\s!name]
\setups[\s!font:\s!fallback:\s!mono]
\definefontsynonym [\s!Mono]   [\s!file:cour.ttf]   
[\s!features=\s!none]
\definefontsynonym [\s!MonoBold]   [\s!file:courbd.ttf] 
[\s!features=\s!none]
\definefontsynonym [\s!MonoItalic] [\s!file:couri.ttf]  
[\s!features=\s!none]
\definefontsynonym [\s!MonoBoldItalic] [\s!file:courbi.ttf] 
[\s!features=\s!none]
\stoptypescript

\starttypescript [\s!sans] [mscoreverdana] [\s!name]
\setups[\s!font:\s!fallback:\s!sans]
\definefontsynonym [\s!Sans]   [\s!file:verdana.ttf]  
[\s!features=\s!default]
\definefontsynonym [\s!SansBold]   [\s!file:verdanab.ttf] 
[\s!features=\s!default]
\definefontsynonym [\s!SansItalic] [\s!file:verdanai.ttf] 
[\s!features=\s!default]
\definefontsynonym [\s!SansBoldItalic] [\s!file:verdanaz.ttf] 
[\s!features=\s!default]
\stoptypescript

\starttypescript[mscore]
\definetypeface [\typescriptone] [\s!rm] [\s!serif] [mscoretimes]   
[\s!default]
\definetypeface [\typescriptone] [\s!ss] [\s!sans]  [mscorearial]   
[\s!default] [\s!rscale=0.860]
\definetypeface [\typescriptone] [\s!tt] [\s!mono]  [mscorecourier] 
[\s!default] [\s!rscale=1.065]
\definetypeface [\typescriptone] [\s!mm] [\s!math]  [times] 
[\s!default] [\s!rscale=1.020]
\stoptypescript

\starttypescript[mscorenarrow,mscore-narrow]
\definetypeface [\typescriptone] [\s!rm] [\s!serif] [mscoretimes]   
[\s!default]
\definetypeface [\typescriptone] [\s!ss] [\s!sans]  [mscorearialnarrow] 
[\s!default] [\s!rscale=0.860]
\definetypeface [\typescriptone] [\s!tt] [\s!mono]  [mscorecourier] 
[\s!default] [\s!rscale=1.065]
\definetypeface [\typescriptone] [\s!mm] [\s!math]  [times] 
[\s!default] [\s!rscale=1.020]
\stoptypescript

  % \starttypescript[mscoress]
  % \definetypeface [mscoress] [\s!ss] [\s!sans]  [mscorearial]   
[\s!default]
  % \definetypeface [mscoress] [\s!rm] [\s!serif] [mscoretimes]   
[\s!default] [rscale=1.160]
  % \definetypeface [mscoress] [\s!tt] [\s!mono]  [mscorecourier] 
[\s!default] [rscale=1.240]
  % \definetypeface [mscoress] [\s!mm] [\s!math]  [times] 
[\s!default] [rs

Re: [NTG-context] \language[is] not working

2017-04-13 Thread Florian Grammel
At first sight this seemed to work fine: the scheme is switched and the 
resulting hyphenations are mostly correct. But the patterns are in a way not 
complete. 

\hyphenatedword with context ver: 2017.04.08 12:09 MKIV beta  fmt: 2017.4.9 (or 
TL16’s) gives:

Önundur hét maður. Hann var Ófeigs-son burlu-fóts Ívars-sonar beytils. 
„Önundur“ var bróðir Guð-bjargar, móður Guð-brands kúlu, föður Ástu, 
móður Ólafs kon-ungs hins helga. Önundur var upp-lenskur að móð-urætt en 
föð-urkyn hans var mest um Roga-land og Hörða- land.

while polyglossia/babel on (xe)latex find most of the orthographically possible 
ones:

Ön-und-ur hét mað-ur. Hann var Ófeigs-son burlu-fóts Ívars-son-ar beytils. 
Ön-und-ur var bróð-ir Guð-bjarg-ar, móð-ur Guð-brands kúlu, föð-ur Ástu, móð-ur 
Ól-afs kon-ungs hins helga. Ön-und-ur var upp-lensk-ur að móð-urætt en 
föð-urkyn hans var mest um Roga-land og Hörða-land.


Any ideas?
Best regards,
Florian



> Den 30. mar. 2017 kl. 15.58 skrev Hans Hagen :
> 
> On 3/30/2017 3:13 PM, Florian Grammel wrote:
>> Adapting the example
>> from http://wiki.contextgarden.net/Command/language to use luatex (which
>> I’ll need). But I get the same result when using the original mkii.
> 
> Islandic is not defined as language
> 
> \installlanguage
>  [is]
>  [default=en,
>   patterns=is]
> 
> look into lang-def.mkiv for what more is needed (and in lang-txt.lua)
> 
> We can of course add that.
> 
> Hans
> 
>> Many thanks!
>> Florian.
>> 
>> 
>> \setuppapersize[A6, landscape]
>> 
>> \definefontfamily [mainface] [rm] [Palatino Linotype]
>> \setupbodyfont[mainface,10pt]
>> 
>> \setupwhitespace[big]  % blank line between paragraphs
>> 
>> \version[temporary]% show overful hboxes
>> 
>> \startcolumns[n=4, distance=3em]
>>  (English hyphenation)
>> 
>> Önundur hét maður. Hann var Ófeigsson burlufóts Ívarssonar beytils.
>> Önundur var bróðir Guðbjargar, móður Guðbrands kúlu, föður Ástu, móður
>> Ólafs konungs hins helga. Önundur var upplenskur að móðurætt en föðurkyn
>> hans var mest um Rogaland og Hörðaland.
>> 
>> \currentdate
>> 
>> \column
>> 
>>  \language[is] % or [icelandic]
>>  (Icelandic hyphenation)
>> 
>> Önundur hét maður. Hann var Ófeigsson burlufóts Ívarssonar beytils.
>> Önundur var bróðir Guðbjargar, móður Guðbrands kúlu, föður Ástu, móður
>> Ólafs konungs hins helga. Önundur var upplenskur að móðurætt en föðurkyn
>> hans var mest um Rogaland og Hörðaland.
>> 
>> \currentdate
>> 
>> 
>> \stopcolumns
>> 
>> \end
>> 
>> 



Florian Grammel

Copenhagen, Denmark

___
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] \language[is] not working

2017-03-30 Thread Hans Hagen

On 3/30/2017 3:13 PM, Florian Grammel wrote:

Adapting the example
from http://wiki.contextgarden.net/Command/language to use luatex (which
I’ll need). But I get the same result when using the original mkii.


Islandic is not defined as language

\installlanguage
  [is]
  [default=en,
   patterns=is]

look into lang-def.mkiv for what more is needed (and in lang-txt.lua)

We can of course add that.

Hans


Many thanks!
Florian.


\setuppapersize[A6, landscape]

\definefontfamily [mainface] [rm] [Palatino Linotype]
\setupbodyfont[mainface,10pt]

\setupwhitespace[big]  % blank line between paragraphs

\version[temporary]% show overful hboxes

\startcolumns[n=4, distance=3em]
  (English hyphenation)

Önundur hét maður. Hann var Ófeigsson burlufóts Ívarssonar beytils.
Önundur var bróðir Guðbjargar, móður Guðbrands kúlu, föður Ástu, móður
Ólafs konungs hins helga. Önundur var upplenskur að móðurætt en föðurkyn
hans var mest um Rogaland og Hörðaland.

\currentdate

\column

  \language[is] % or [icelandic]
  (Icelandic hyphenation)

Önundur hét maður. Hann var Ófeigsson burlufóts Ívarssonar beytils.
Önundur var bróðir Guðbjargar, móður Guðbrands kúlu, föður Ástu, móður
Ólafs konungs hins helga. Önundur var upplenskur að móðurætt en föðurkyn
hans var mest um Rogaland og Hörðaland.

\currentdate


\stopcolumns

\end



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




--

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

Re: [NTG-context] \language[is] not working

2017-03-30 Thread Florian Grammel
Adapting the example from http://wiki.contextgarden.net/Command/language 
<http://wiki.contextgarden.net/Command/language> to use luatex (which I’ll 
need). But I get the same result when using the original mkii.

Many thanks!
Florian.


\setuppapersize[A6, landscape]

\definefontfamily [mainface] [rm] [Palatino Linotype]
\setupbodyfont[mainface,10pt]

\setupwhitespace[big]  % blank line between paragraphs

\version[temporary]% show overful hboxes

\startcolumns[n=4, distance=3em]
  (English hyphenation)

Önundur hét maður. Hann var Ófeigsson burlufóts Ívarssonar beytils. Önundur var 
bróðir Guðbjargar, móður Guðbrands kúlu, föður Ástu, móður Ólafs konungs hins 
helga. Önundur var upplenskur að móðurætt en föðurkyn hans var mest um Rogaland 
og Hörðaland.

\currentdate

\column

  \language[is] % or [icelandic]
  (Icelandic hyphenation)

Önundur hét maður. Hann var Ófeigsson burlufóts Ívarssonar beytils. Önundur var 
bróðir Guðbjargar, móður Guðbrands kúlu, föður Ástu, móður Ólafs konungs hins 
helga. Önundur var upplenskur að móðurætt en föðurkyn hans var mest um Rogaland 
og Hörðaland.

\currentdate


\stopcolumns

\end

___
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] Interlining in a TwoColumns set

2016-08-12 Thread Jean-Pierre Delange

Dear List,

In order to help somebody who wants to improve a kind presentation of 
his own, I have set the sample below.

I am confronting to 2 issues :

1. In the second column it would be fine if one could play with the 
interlining. But where to put this command : 
\setupinterlinespace[line=2.8ex]}] which allow to define interlines 
inside the 2nd column ?


2. The Logo.svg picture (in /Images/Logo.svg within context repertory) 
doesn't print : 'state: unknown'; is it an issue caused by a layer 
definition ?


Thanks for your advices.
JP

% Select language

\mainlanguage[fr]

\language[fr]


% Setup PDF metadata

\setupinteraction

[state=start,

color=colour_link,

click=yes,

contrastcolor=colour_link,

focus=standard, % Clicking an inter-document hyperlink by default 
switches to "fit page" mode. Override.


openaction={FitWidth,ToggleViewer},

title={Anciens et Modernes},

style=normal,

subtitle={Anciens et Modernes},

author=Adeimantos ,

keyword={philosophy, history, political philosophy}]


% Turn off page numbering

\setuppagenumbering[location=]


% Normal A4 size paper

\setuppapersize[A4][A4]


% Setup margins

\setuplayout[

backspace=10mm,

width=190mm,

topspace=5mm,

header=0mm,

footer=5mm,

footerdistance=0mm,

bottomdistance=10mm,

height=280mm]

%\showframe


% For coloured output

\setupcolors[state=start]


% Font setup


% Font to use

\definefontfamily [main_font] [rm] [titillium] [features={default,quality}]

\definefontfamily [main_font] [mm] [TeX Gyre Pagella]

\setupbodyfont[main_font]


% URL macros and setups


% Usage: \href{http://www.someurl.com}{Text}

\def\href#1#2{\useURL[#2][{#2}][][{#1}]\goto{\url[#2]}[url(#1)]}

\def\ahref#1{\href{#1}{<#1>}}

\def\fullahref#1{\href{#1}{#1}}

\def\mailto#1{\useURL[#1][mailto:#1][][#1]\from[{#1}]}

\def\MailTo#1#2{\useURL[#1][mailto:#1][][#2]\from[{#1}]}


% Style

\setupurl

[color=none,

style=normal]


% Setup two columns

\defineparagraphs[TwoColumns][n=2, align={hz,hanging}]

\setupparagraphs[TwoColumns][1][width=200pt]


% Setup stretching tolerance...

\setuptolerance[verytolerant,stretch]


\setupcolors[state=start]


% The elements of the letterhead are defined as layers. This first layer

% contains the logo; you'll have to supply an image file yourself.

\definelayer[logo_layer]

\setlayer[logo_layer][preset=lefttop,y=.01\paperheight,x=.82\paperwidth]

{\externalfigure[Images/Logo.svg][][height=0.2\textwidth]}


% Activate all layers for this page...

\setupbackgrounds[page][background={logo_layer}]


% Start document body...

\starttext


% Header...

{\switchtobodyfont[40pt] Anciens et Modernes \crlf}

\blackrule[height=0.6mm,width=0.83\textwidth]


% Dateline...

{\bf Présentation}\crlf

\currentdate[dd,{~},m,{~},year]


% Headline...

\blank

\framed[align=middle,width=200mm,height=13mm,frame=off]

{

\bf \switchtobodyfont[15pt]

{\bf Philosophie politique.}

}


\startTwoColumns

\startlines

{\bf Contact Information}

Adeimantos

Le Manoir

F - 18190 Chavannes

adeiman...@free.fr


{\bf Édition}

Livres, articles


{\bf Dévelopement}

Prototype


{\bf Année de création}

2012


{\bf Financements privés}

\$0


\stoplines


\TwoColumns

\input tufte


\stopTwoColumns


\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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] \mainlanguage[pe]

2016-08-01 Thread Mohammad Hossein Bateni
Is there a trick to get over this issue?  Until a conversion mechanism like
what you suggested (\currentdate[persian->day,space,month,persian->month])
is implemented, can I somehow achieve a similar result, perhaps in a not so
clean way?

Can one reduce the result of \currentdate to a simple number by stripping
the additional stuff that is there?  Similarly, can I force \currentdate to
expand or is it a fundamental implementation limitation?

Can I access day, month and year values in Lua, to run some if statements,
etc.?  For instance, if it is the first day of April, change the font of
the document or something like that.

—MHB

On Thu, Jul 7, 2016 at 7:32 PM, Wolfgang Schuster <
schuster.wolfg...@gmail.com> wrote:

> Mohammad Hossein Bateni 
> 7. Juli 2016 um 16:31
> Thanks, Wolfgang!
>
> BTW why doesn't the following work?  it gives the 'missing number' error.
>
> % \mainlanguage[en]
> \romannumerals{\currentdate[day]}
>
> 1. The \currentdate command isn’t expandable and is therefore not expanded
> when you use it as argument for another command.
>
> 2. The \romannumerals commands expects a number as argument but
> \currentdate returns more than a simple number.
>
> 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://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] \mainlanguage[pe]

2016-07-07 Thread Wolfgang Schuster

Mohammad Hossein Bateni <mailto:bat...@gmail.com>
7. Juli 2016 um 16:31
Thanks, Wolfgang!

BTW why doesn't the following work?  it gives the 'missing number' error.

% \mainlanguage[en]
\romannumerals{\currentdate[day]}

1. The \currentdate command isn’t expandable and is therefore not 
expanded when you use it as argument for another command.


2. The \romannumerals commands expects a number as argument but 
\currentdate returns more than a simple number.


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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] \mainlanguage[pe]

2016-07-07 Thread Mohammad Hossein Bateni
Thanks, Wolfgang!

BTW why doesn't the following work?  it gives the 'missing number' error.

% \mainlanguage[en]
\romannumerals{\currentdate[day]}

On Thu, Jul 7, 2016 at 10:02 AM, Wolfgang Schuster <
schuster.wolfg...@gmail.com> wrote:

> Mohammad Hossein Bateni 
> 7. Juli 2016 um 10:53
> Wolfgang & Hans,
>
> In customizing the date, is there a way to use a number converter on day
> and year?  In particular, I'd like to apply persiandecimals conversion on
> them.
>
> You can only change the numbers for the day (see below, I used greek to
> demonstrate it) but it could be done better (e.g.
> \currentdate[persian->day,space,month,persian->month] with "->" as
> separator for the conversion and keyword).
>
> %% begin example
> \installlanguage[fa][state=start]
>
> \defineconversion[fa][day][α,β,γ,δ,ε,ζ,η,θ,ι,κ,λ,μ]
>
> \setupbodyfont[pagella]
>
> \starttext
>
> \currentdate[day]
>
> \language[fa]
>
> \currentdate[day]
>
> \stoptext
> %% end example
>
> (I have a similar question regarding \currentime.)
>
> Not possible at the moment.
>
> 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://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] \mainlanguage[pe]

2016-07-07 Thread Wolfgang Schuster

Mohammad Hossein Bateni <mailto:bat...@gmail.com>
7. Juli 2016 um 10:53
Wolfgang & Hans,

In customizing the date, is there a way to use a number converter on 
day and year?  In particular, I'd like to apply persiandecimals 
conversion on them.
You can only change the numbers for the day (see below, I used greek to 
demonstrate it) but it could be done better (e.g. 
\currentdate[persian->day,space,month,persian->month] with "->" as 
separator for the conversion and keyword).


%% begin example
\installlanguage[fa][state=start]

\defineconversion[fa][day][α,β,γ,δ,ε,ζ,η,θ,ι,κ,λ,μ]

\setupbodyfont[pagella]

\starttext

\currentdate[day]

\language[fa]

\currentdate[day]

\stoptext
%% end example

(I have a similar question regarding \currentime.)

Not possible at the moment.

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Garamond Premier Pro font goodies file

2016-05-03 Thread mf
Thank you Wolfgang,
now it works partially (see the first attachment): it uses different
optical sizes, but not always the right ones.

\definefontfamily [default] [rm] [GaramondPremierPro] [opticalsize=yes]
\setupbodyfont[default,12pt]
\starttext
\dostepwiserecurse {6} {22} {2} 
  {\switchtobodyfont[#1pt]
   \purefontname\font: \input ward
   \blank}
\stoptext

My garamondpremierpro.lfg is a modified version of ebgaramond.lfg.
While I was waiting for an answer to my mail, I made a modified version
of type-imp-ebgaramond.mkiv: type-imp-garamondpremierpro.mkiv (second
attachment).
Then I tried this:

\input type-imp-garamondpremierpro.mkiv
\setupbodyfont[GaramondPremierPro,12pt]
\starttext
\dostepwiserecurse {6} {22} {2} 
  {\switchtobodyfont[#1pt]
   \purefontname\font: \input ward
   \blank}
\stoptext

This works as expected (see third attachment): "GaramondPremierPro-
Capt" under 8.5pt, then "GaramondPremierPro" until 13pt, then
"GaramondPremierPro-Subh" until 21.5pt, then "GaramondPremierPro-Disp".

How can I make it work with \definefontfamily?
I prefer its simpler syntax to typescripts like "type-imp-
garamondpremierpro.mkiv".
I tried this:

\definefontfamily [default] [rm] [GaramondPremierPro]
[opticalsize=yes,goodies=GaramondPremierPro]
\setupbodyfont[default,12pt]
\starttext
\dostepwiserecurse {6} {22} {2} 
  {\switchtobodyfont[#1pt]
   \purefontname\font: \input ward
   \blank}
\stoptext

but it does not work as expected.
The file garamondpremierpro.lfg gets loaded, but its contents are
ignored when choosing the right optical size.

How can I tell ConTeXt to use the optical sizes defined in my goodies
file with \definefontfamily and without using type-imp-
garamondpremierpro.mkiv typescripts?

garamond-optical-sizes-ws.pdf
Description: Adobe PDF document
%D \module
%D   [   file=type-imp-ebgaramond,
%Dversion=2016.05.02,
%D  title=\CONTEXT\ Typescript Macros,
%D   subtitle=Garamond Premier Pro,
%D author=MF,
%D   date=\currentdate,
%D  copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\definefontfeature
  [garamond-premier-pro-normal]
  [default]
  [onum=yes,liga=yes]
%  [mode=node,ccmp=yes,calt=yes,
%   liga=yes,dlig=yes,hlig=yes,
%   kern=yes,mark=yes,mkmk=yes,
%   onum=yes,pnum=yes,salt=yes,
%   script=latn]

\definefontfeature
  [garamond-premier-pro-smallcaps]
  [garamond-premier-pro-normal]
  [smcp=yes,c2sc=yes]

\starttypescriptcollection[GaramondPremierPro]

\starttypescript [serif] [GaramondPremierPro]
\loadfontgoodies[garamondpremierpro]
\setups[font:fallback:serif]
\definefontsynonym [Serif]   [file:GaramondPremierPro-Regular] [features=garamond-premier-pro-normal]
\definefontsynonym [SerifItalic] [file:GaramondPremierPro-Italic]  [features=garamond-premier-pro-normal]
\definefontsynonym [SerifBold]   [file:GaramondPremierPro-Bold][features=garamond-premier-pro-normal]
\definefontsynonym [SerifBoldItalic][file:GaramondPremierPro-BoldItalic][features=garamond-premier-pro-normal]
\definefontsynonym [SerifCaps]   [Serif]   [features=garamond-premier-pro-smallcaps]
\stoptypescript

\starttypescript[GaramondPremierPro]
\definetypeface [GaramondPremierPro] [rm] [serif] [GaramondPremierPro] [default] [designsize=auto]
\definetypeface [GaramondPremierPro] [tt] [mono]  [dejavu] [default]
\definetypeface [GaramondPremierPro] [mm] [math]  [bonum]  [default]
\stoptypescript

\stoptypescriptcollection


garamond-optical-sizes-mf.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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

[NTG-context] Lost in letter module

2016-02-09 Thread Jan U. Hasecke
Hi all,

I am completely lost in the letter module.

I started with the tutorial "Correspondence with ConTEXt Version:
2010.08.27" but reference line does not show up at all.

So I read a little further:
http://wiki.contextgarden.net/Letter
And the PDFs that are linked under "Further information"

But I fear that I am now completely lost as some commands seems to be
old or deprecated or whatever, but they simply does not work. And there
are references to new commands in the text.

What I am trying to get is a letter with first and second page style,
where on the first page I need a special foot with accounting infos etc.

Including a background file (uncommented in the mwe) works fine.

I need a references line for customer id, invoice id and date just above
the subject.

I don't understand the setupletterlayer command as you can see in the
mwe where I use a negative value for x to push it to the right position.
I have no idea how x and y are working and what position is for.

The same is true for \setupletterframe.


I am using: Version beta-0.89.0 (TeX Live 2016/dev

Here is my mwe:

\mainlanguage[de]
\usemodule[letter]
\useletterstyle{dinb}
\setupletteroptions
  [%backgroundimage=/home/juh/Bilder/Diverses/Hintergrund.png,
   language=german]

\defineletterelement[layer][reference][rechnung]
{Kundennummer: \correspondenceparameter{kd} \|
Rechnungnummer: \correspondenceparameter{id}}

\setupletterlayer[reference]
 [ alternative=rechnung,
   style=\tfx\sans,y=10pt,
   x=-63mm,
   y=100mm,
   position=topleft]

\setupletterframe[reference][align=left]

\setupletter
  [toname={Mustermann GmbH\\Peter Mustermann},
  toaddress={Haubenweg 3\\12345 Musterstadt},
  signature={Jan Ulrich Hasecke},
  date=\currentdate,
  kd={077},
  id={2016002}]

\starttext
\startletter
  [opening={Sehr geehrte Damen und Herren},
closing={Mit freundlichen Grüßen},
  subject={Imagebroschüre Mustermann GmbH}]

Hiermit berechne ich Ihnen 100 € für Leistungen.

\stopletter
\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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

[NTG-context] can't find file `./1.tex'.

2015-11-14 Thread Context NTG
I installed in windows 7 x64 standatalone context from
http://standalone.contextgarden.net/setup/context-setup-mswin.zip
I installed it with first-setup.bat --version=current --modules=all
I added d:\context\tex\texmf-win64\bin in the PATH
I made a simple \starttext .. \stoptext file and run it in a command prompt
with:

context myfile.tex

Below is the output. Would somebody know what could cause this problem

Thanks
John



ConTeXt  ver: 2015.05.18 12:26 MKIV current  fmt: 2015.11.14  int:
english/english
system  > 'cont-new.mkiv' loaded
open source > 2 > 2 >
D:/0_System/software_portable/context/context0/tex/tex
mf-context/tex/context/base/cont-new.mkiv
close source> 2 > 2 >
D:/0_System/software_portable/context/context0/tex/tex
mf-context/tex/context/base/cont-new.mkiv
system  > files > jobname '1', input './1', result '1'
fonts   > latin modern fonts are not preloaded
languages   > language 'en' is active
tex error   > error on line 8 in file
D:/0_System/software_portable/context/
context0/tex/texmf-context/tex/context/base/cont-yes.mkiv: ! I can't find
file `
./1.tex'.
l.8 }
\clf_processjob ...uafunction \16>>clf_processjob
l.97 \getvalue{clf_processjob}
 % from cont-run.lua
 1 %D \module
 2 %D   [   file=cont-yes,
 3 %Dversion=2012.06.01,
 4 %D  title=\CONTEXT\ Miscellaneous Macros,
 5 %D   subtitle=Startup Stub,
 6 %D author=Hans Hagen,
 7 %D   date=\currentdate,
 8 >>  %D  copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
 9 %C
10 %C This module is part of the \CONTEXT\ macro||package and is
11 %C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12 %C details.
13
14 % At some point I will reconsider the \starttext .. \stoptext
15 % wraping as we can assume proper styling. It's a left-over from
16 % mkii that we need to get rid of.
17
18 % now moved to cont-run.lua
Please type another input file name:
___
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] superscripts "th" "nd" "rd" "st" on dates etc..

2015-09-05 Thread Wolfgang Schuster

Hans Hagen <mailto:pra...@wxs.nl>
27. August 2015 22:10
On 8/27/2015 1:21 AM, Wolfgang Schuster wrote:

Mojca Miklavec <mailto:mojca.miklavec.li...@gmail.com>
26. August 2015 19:36

In case that you were looking for an automated way to print the date,
here's one option:
\setuplanguage[en][date={weekday,{, },day:ord,{~},month,{,~},year}]
(And the documentation is somewhat wrong, I think it suggests to use
"day+" which doesn't work. But I should check the details again.)

The keyword to create ordinal numbers in a date has changed in MkIV.

Unfortunately I didn't manage to figure out how to do the superscript
automatically. Yes, it's 1\highordinalstr{st} like Alan mentioned, but
that only works in "manual mode".


core-con.lua : 1275 :

context.highordinalstr(converters.ordinal(whatordinal,currentlanguage))
Please revert this change and let the user choose between a ordinal in 
text size and raised small size.


\starttext

\currentdate[day:ord]

\currentdate[day:highord]

\stoptext

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] new beta

2015-07-10 Thread Hans Hagen

On 7/10/2015 7:13 PM, Pablo Rodriguez wrote:

On 07/10/2015 05:05 PM, Thomas A. Schmitz wrote:

On 07/09/2015 03:39 PM, Hans Hagen wrote:

Of course there will be bugs although the test suite runs without
crashing. I will use the new code on my machine but you can test it with:

\usemodule[newotf]

before \starttext (or in cont-loc.mkiv).


Hi Hans,

did the new font mechanism really make it into the beta you uploaded? I get

resolvers   > modules > 'newotf' is not found

with

version: 2015.07.10 00:05


Hi Hans and Thomas

the module seems to be missing also in beta from 2015.07.09 15:23.

In beta from 2015.07.10 00:05 cont-loc.mkiv seems to be gone.


that one is not in the distribution ... you can create it

cont-new.mkiv : in distribution (patch file)
cont-loc.mkiv : local file (persistent, not replaced)
cont-exp.mkiv : experimental code (on my machine)

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-
%D \module
%D   [   file=m-newotf,
%Dversion=2015.07.08,
%D  title=\CONTEXT\ Extra Modules,
%D   subtitle=Experimental OTF Loader,
%D author=Hans Hagen,
%D   date=\currentdate,
%D  copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

%D This module will go away as soon as we use the new loader code by default.
%D That will happen after extensive testing. Generic support will happen after
%D that.

\unprotect

\startluacode
local files = {
"font-otr", "font-cff", "font-ttf", "font-dsp", "font-oup",
"font-otl", "font-ots", "font-oto", "font-otd", "font-otc",
"font-osd", "font-map", "font-fbk", "font-gds",
}

logs.report("fonts")
if tex.modes.atpragma then
logs.report("fonts","replacing font loader code by experimental code 
(at pragma)")
logs.report("fonts")
for i=1,#files do require(file.join("t:/sources",files[i])) end
else
logs.report("fonts","replacing font loader code by experimental code")
logs.report("fonts")
for i=1,#files do require(files[i]) end
end
\stopluacode

\protect \endinput
___
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

[NTG-context] language mode with XML

2015-05-16 Thread Pablo Rodriguez
Dear list,

I have the following sample:

\startbuffer[demo]

Document Title
Text from paragraph.
Document Title
Text from paragraph.

\stopbuffer

\startxmlsetups xml:initialize
 \xmlsetsetup{#1}{doc|h1|p}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:initialize}

\startxmlsetups xml:doc
   \mainlanguage[\xmlatt{#1}{lang}]
   \title{\currentdate} % to display language
   \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:h1
   \section{\xmlflush{#1}}
\stopxmlsetups

\startxmlsetups xml:p
   \xmlflush{#1}
\stopxmlsetups

\setupindenting[yes, always, big]

\startmode[**es]
\setupheads[indentnext=yes]
\stopmode

\starttext
\xmlprocessbuffer{main}{demo}{}
\stoptext

Is there no other way to make indentation after headings work than to
include it inside xml:doc?

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] wrong vertical spacing in latest beta

2015-04-16 Thread Hans Hagen

On 4/16/2015 10:20 PM, Pablo Rodriguez wrote:

On 04/16/2015 09:51 PM, Hans Hagen wrote:

On 4/16/2015 6:50 PM, Pablo Rodriguez wrote:

[...]
I’m afraid it might be a bug.


hm, more likely a fix (prevdepth or so)

\startbuffer[a]
  \ruledvbox{x\tfa \setupinterlinespace \strut \ConTeXt \par
\strut x\par}\blank
  \ruledvbox{x\tfxx\setupinterlinespace \strut Author   \par
\strut x\par}\blank
  \ruledvbox{x\tfxx\setupinterlinespace \strut \currentdate \par
\strut x\par}\blank
  \ruledvbox{x\tf  \setupinterlinespace \strut url  \par
\strut x\par}\blank
\stopbuffer

\startbuffer[b]
  \ruledvbox{x\tfa \setupinterlinespace\ConTeXt \par
x\par}\blank
  \ruledvbox{x\tfxx\setupinterlinespaceAuthor   \par
x\par}\blank
  \ruledvbox{x\tfxx\setupinterlinespace\currentdate \par
x\par}\blank
  \ruledvbox{x\tf  \setupinterlinespaceurl  \par
x\par}\blank
\stopbuffer

\starttext
  \showstruts
  \getbuffer[a]
  \page
  \getbuffer[b]
\stoptext

you can use use \begstrut ... \endstrut in such local situations


Many thanks for your help, Hans.

I have seen strut in the past, but I’m afraid that I don’t know what it
may be or what I can use it for (besides your sample).


tex has no built-in concept of lineheight and depth only of distance

so, if you want consistency you need to make sure the first line has 
height and the last line depth


for normal running text this goes ok (thanks to baselineskip being the 
sum of wanted height and depth)


but ... as soon as you start boxing you need to make sure you enforce 
the proper ht and dp is needed


\begstrut ... \endstrut

can be used for that

most mechanisnm in context deal with this themselves (for instance 
framed and tables .. tables would look horrible otherwise)


(try \showstruts before \starttext so see where \struts are used)

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] wrong vertical spacing in latest beta

2015-04-16 Thread Pablo Rodriguez
On 04/16/2015 09:51 PM, Hans Hagen wrote:
> On 4/16/2015 6:50 PM, Pablo Rodriguez wrote:
>> [...]
>> I’m afraid it might be a bug.
> 
> hm, more likely a fix (prevdepth or so)
> 
> \startbuffer[a]
>  \ruledvbox{x\tfa \setupinterlinespace \strut \ConTeXt \par 
> \strut x\par}\blank
>  \ruledvbox{x\tfxx\setupinterlinespace \strut Author   \par 
> \strut x\par}\blank
>  \ruledvbox{x\tfxx\setupinterlinespace \strut \currentdate \par 
> \strut x\par}\blank
>  \ruledvbox{x\tf  \setupinterlinespace \strut url  \par 
> \strut x\par}\blank
> \stopbuffer
> 
> \startbuffer[b]
>  \ruledvbox{x\tfa \setupinterlinespace\ConTeXt \par 
> x\par}\blank
>  \ruledvbox{x\tfxx\setupinterlinespaceAuthor   \par 
> x\par}\blank
>  \ruledvbox{x\tfxx\setupinterlinespace\currentdate \par 
> x\par}\blank
>  \ruledvbox{x\tf  \setupinterlinespaceurl  \par 
> x\par}\blank
> \stopbuffer
> 
> \starttext
>  \showstruts
>  \getbuffer[a]
>  \page
>  \getbuffer[b]
> \stoptext
> 
> you can use use \begstrut ... \endstrut in such local situations

Many thanks for your help, Hans.

I have seen strut in the past, but I’m afraid that I don’t know what it
may be or what I can use it for (besides your sample).

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] wrong vertical spacing in latest beta

2015-04-16 Thread Hans Hagen

On 4/16/2015 6:50 PM, Pablo Rodriguez wrote:

Hans,

this sample:

 \showgrid
 \setupbodyfont[30pt]
 \starttext
 {\tfa\setupinterlinespace \ConTeXt\par}\\
 {\tfxx\setupinterlinespace Author\par}\\
 {\tfxx\setupinterlinespace\currentdate\par}\\
 {\tf\setupinterlinespace url\par}
 \stoptext

With either latest beta or beta from  2015.03.25 22:13, last line in the
sample is on grid line number 3.

With stable beta from TL14 (2014.05.21 22:04), last line from sample is
after grid line 6.

I’m afraid it might be a bug.


hm, more likely a fix (prevdepth or so)

\startbuffer[a]
\ruledvbox{x\tfa \setupinterlinespace \strut \ConTeXt \par 
\strut x\par}\blank
\ruledvbox{x\tfxx\setupinterlinespace \strut Author   \par 
\strut x\par}\blank
\ruledvbox{x\tfxx\setupinterlinespace \strut \currentdate \par 
\strut x\par}\blank
\ruledvbox{x\tf  \setupinterlinespace \strut url  \par 
\strut x\par}\blank

\stopbuffer

\startbuffer[b]
\ruledvbox{x\tfa \setupinterlinespace\ConTeXt \par 
x\par}\blank
\ruledvbox{x\tfxx\setupinterlinespaceAuthor   \par 
x\par}\blank
\ruledvbox{x\tfxx\setupinterlinespace\currentdate \par 
x\par}\blank
\ruledvbox{x\tf  \setupinterlinespaceurl  \par 
x\par}\blank

\stopbuffer

\starttext
\showstruts
\getbuffer[a]
\page
\getbuffer[b]
\stoptext

you can use use \begstrut ... \endstrut in such local situations

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

[NTG-context] wrong vertical spacing in latest beta

2015-04-16 Thread Pablo Rodriguez
Hans,

this sample:

\showgrid
\setupbodyfont[30pt]
\starttext
{\tfa\setupinterlinespace \ConTeXt\par}\\
{\tfxx\setupinterlinespace Author\par}\\
{\tfxx\setupinterlinespace\currentdate\par}\\
{\tf\setupinterlinespace url\par}
\stoptext

With either latest beta or beta from  2015.03.25 22:13, last line in the
sample is on grid line number 3.

With stable beta from TL14 (2014.05.21 22:04), last line from sample is
after grid line 6.

I’m afraid it might be a bug.

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Loading modules

2014-12-23 Thread Wolfgang Schuster

> Am 23.12.2014 um 14:29 schrieb j. van den hoff :
> 
> uups. I was to quick with my answer: in the meantime I did reset my $PATH 
> variable in order to use
> the texlive-context version again. so adding the  
> \enabledirectives[modules.permitunprefixed] and recompiling
> the document did not proof anything (stupid error...). so I have now retried 
> with the current standalone
> `context' and -- alas! -- the `undefined control sequence' error does not go 
> away. do be specifc:
> 
> -- document and module reside in the same directory
> 
> -- the module is residing in file `t-title.tex' and defines (upon others) 
> `\doctitle'
> 
> -- the document loads the module with `\usemodule[title]' (which is now 
> preceded by `\enabledirectives[modules.permitunprefixed]')
>   and then uses `\doctitle' which triggers the error.
> 
> -- right now, the standalone `context' binary is at the very top of $PATH.
> 
> any ideas?

The ConTeXt suite includes a title module (when you install the  third party 
modules)
which is loaded instead of your own title module. The following example shows 
how
you can use the module in your document.


\usemodule[title]

\starttext

\placetitle
  [author=Ben Lee User,
title=How to write a \tex{placetitle} command,
 date=\currentdate\space\currenttime]

\dorecurse{6}
  {\startparagraph
   \input tufte\par
   \stopparagraph}

\stoptext


When you want to use your module instead of the third party module rename
it from t-title.tex to p-title.tex.

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

[NTG-context] Strange bug with overviewpage module.

2014-12-19 Thread Aditya Mahajan

Hi,

Some time ago, Hans had helped me to write an 'overviewpage' module, that 
makes it easy to show a overview of the important slides at the end of a 
presentation. I have tweaked this module slightly to be able to save an 
arbitrary page by using


\saveoverviewpage{reference}

and reuse the page by

\useoverviewpage{reference}

An example is:

\usemodule[overviewpage]
\setuppapersize[S4]

\setupframedtext[rulethickness=3pt]

\starttext

\startframedtext
  \input ward
\stopframedtext
\saveoverviewpage{ward}
\page

\input tufte
\page

\scale[width=0.5\textwidth]{\useoverviewpage{ward}}

\stoptext


However, when I save a page that contains a framed box (as in the above 
example), the box looses its right frame when it is displayed again (see 
page 3 of the attached pdf). It appears that the left edge is twice as 
thick.


Any idea why this is happening and how I can avoid this?

Thanks,
Aditya

test.pdf
Description: Adobe PDF document
%D \module
%D   [ file=t-overviewpage,
%D  version=2013.08.31,
%Dtitle=\CONTEXT\ User Module,
%D subtitle=Page Overviews,
%D   author=Aditya Mahajan and Hans Hagen,
%D date=\currentdate,
%Dcopyright=Aditya Mahajan,
%Demail=adityam  ieee  org,
%D  license=Simplified BSD License]

\writestatus{loading}{Overview Page (ver: 2013.08.31)}

\startmodule [overviewpage]

\unprotect

\setupmodule
  [\c!level=]

\installnamespace{overviewpage}

\initializeboxstack{\overviewpage}

\newconditional\c_overviewpage_state

\unexpanded\def\enablesaveoverviewpage
  {\global\settrue\c_overviewpage_state}

\unexpanded\def\saveoverviewpage#1%
  {\enablesaveoverviewpage
   \setevalue{\overviewpage:page:#1}{\the\realpageno}}

\unexpanded\def\useoverviewpage#1%
  {\writestatus{overviewpage}{using page #1 
(\getvalue{\overviewpage:page:#1})}%
   
\expanded{\foundbox{\overviewpage}{\getvalue{\overviewpage:page:#1

\unexpanded\def\overviewpage_save_page#1%
  {\ifconditional\c_overviewpage_state
 \setbox\nextbox\hbox{#1}%
 \setbox\scratchbox\copy\nextbox
 \cleanupbox\scratchbox % remove nodes that should not be seen in the 
backend twice
 \writestatus{overviewpage}{saving overviewpage \the\realpageno}%
 \savebox{\overviewpage}{\the\realpageno}{\box\scratchbox}%
 \global\setfalse\c_overviewpage_state
 \page_shipouts_normal{\box\nextbox}%
   \else
 \page_shipouts_normal{#1}%
   \fi}

\appendtoks
\doif {\headparameter{option:overviewpage}} \v!yes \enablesaveoverviewpage
\to \everyheadsynchronization

\installshipoutmethod{overviewpage}\overviewpage_save_page

\unexpanded\def\overviewpage_setup_head#1%
  {\setuphead[#1][option:overviewpage=\v!yes]}

\appendtoks
\processcommacommand
  [\moduleparameter{overviewpage}\c!level]
  \overviewpage_setup_head
\to \everysetupmodule


\the\everysetupmodule

\setuppaper
  [\c!method=overviewpage]

\definelistalternative
  [overviewpage]
  [\c!renderingsetup=\??listrenderings:overview]

\setuplistalternative
  [overviewpage]
  [\c!before=\dontleavehmode,
   \c!after=\hskip\zeropoint\relax,
 % \c!width=\ctxlua{moduledata.overviewpage.calculatedwidth(\listlength)}]
   
\c!width=\ctxlua{moduledata.overviewpage.calculatedwidth(structures.lists.size())}]

\startsetups[\??listrenderings:overview]
\doifboxelse{\overviewpage}{\structurelistrealpagenumber}
   {\listalternativeparameter\c!before
\startcurrentlistentrywrapper
  \scale
[\c!width=\listalternativeparameter\c!width]
{\foundbox{\overviewpage}{\structurelistrealpagenumber}}%
\stopcurrentlistentrywrapper
\listalternativeparameter\c!after}
   {}%
\stopsetups

\definemakeup
  [overviewpage]
  [\c!align=\v!middle]

\definelayout
  [overviewpage]
  [\v!page]

\startluacode
moduledata  = moduledata  or { }
moduledata.overviewpage = moduledata.overviewpage or { }

function moduledata.overviewpage.calculatedwidth(pages)
context("%f\\textwidth",1/math.ceil(math.sqrt(pages)))
end
\stopluacode

% Ideally, we would like to simply use the definition below. 
% However, the `before` and `after` keys are not used with 
`\placecombinedlist`. 
% Therefore we use a more manual solution.
%
\definecombinedlist
[overviewpage]
[\moduleparameter{overviewpage}\c!level]
[
  %\c!before=\startoverviewpagemakeup,
  %\c!after=\stopoverviewpagemakeup,
  \c!criterium=\v!all,
  \c!alternative=overviewpage,
]

\unexpanded\def\placeoverviewpage
  {\dosingleargument\doplaceoverviewpage}

\def\doplaceoverviewpage[#1]%
  {\startoverviewpagemakeup
  \placecombinedlist[overviewpage][#1]
   \stopoverviewpagemakeup}

\protect

\stopmodule
___
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/

Re: [NTG-context] bug in latest beta?

2014-12-10 Thread Pablo Rodriguez
On 12/10/2014 08:14 PM, Hans Hagen wrote:
> On 12/10/2014 7:51 PM, Pablo Rodriguez wrote:
>> Hans,
>>
>> after updating to latest beta I get an error when compiling the sample
>> bellow with beta from 2014.12.09 13:03:
>>
>> \setupitaliccorrection[global,always]
>> \definefontfamily[mainface][serif][TeX Gyre Pagella]
>> \setupbodyfont[mainface,15pt]
>>
>> \def\ConTeXt{Con\-\TeX{}t}
>>
>> \starttext
>> \itc The Book on \ConTeXt
>>     \medskip
>> \tfa\setupinterlinespace[2.6ex] {\sc The Author}
>> \par
>> \currentdate
>> \stoptext
>>
>> Beta from 2014.11.26 21:43 compiles it without problems.
>>
>> Is this a bug or am I missing something?
> 
> It's a bug (I updated some discretionary related code so ther might be a 
> few more border cases not handled well). I'll make a new beta.

Many thanks for the fast fix, Hans.


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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] bug in latest beta?

2014-12-10 Thread Hans Hagen

On 12/10/2014 7:51 PM, Pablo Rodriguez wrote:

Hans,

after updating to latest beta I get an error when compiling the sample
bellow with beta from 2014.12.09 13:03:

\setupitaliccorrection[global,always]
\definefontfamily[mainface][serif][TeX Gyre Pagella]
\setupbodyfont[mainface,15pt]

\def\ConTeXt{Con\-\TeX{}t}

\starttext
\itc The Book on \ConTeXt
\medskip
\tfa\setupinterlinespace[2.6ex] {\sc The Author}
\par
\currentdate
\stoptext

Beta from 2014.11.26 21:43 compiles it without problems.

Is this a bug or am I missing something?


It's a bug (I updated some discretionary related code so ther might be a 
few more border cases not handled well). I'll make a new beta.


Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

  1   2   3   4   5   >