[NTG-context] running head for TOC
I have a very long Table of Contents (runs across five pages) and the author would like the running head on recto pages for this to be 'Table of Contents'. I am using the following to create the TOC head: \definehead [tochead] [title] \starttochead[title={Table of Contents}] \setupheader[state=start] \placecombinedlist[content] \stoptochead And I use the following to set up the headertexts for the book as a whole: \setupheadertexts [{\hfill\getmarking[chapter]\hfill}][] %recto pages [{\hfill\documentvariable{metadata:title}\hfill}][] %verso pages The problem is that I am unable to get 'Table of Contents' as a running head for the two recto pages where I need it. I realise I need to get 'tochead' recognised somehow for this. If I set up a separate \setupheadertexts [{\hfill\getmarking[tochead]\hfill}][] then I end up with 'Table of Contents as the running head on all recto pages, which I don't want. Can anyone suggest how can I get 'Table of Contents' as the running head just for the two recto pages of a five page TOC? Julian ___ 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] 3 questions about xtables after reading manuals
I've been trying out xtables and reading the manual, some things I can't find how to do (or if it's possible on xtables): 1. How to align whole columns. It seems I have to add [align=middle] to each cell I want to have centered in a raggedright aligned table. In tabulate you can use [|l|c|] to do this, is it possible in xtables? Seems weird if it's not. Or did I miss something? 2. I know how to use [option=stretch] to fill the textwidth, but can I make specific columns "tight", so they don't get stretched beyond their content? 3. When I use [option=tight] sometimes columns are narrowed so much as to break a line of 4 or 5 words. MWE: % \startplacetable[location=none] %\startxtable[align={middle,lohi},option=tight] % This makes the first column too narrow. Lines are not that long \startxtable[align={middle,lohi}] \startxtablehead[head] \startxrow \startxcell[align=right] \strong{Concepto}\crlf\small{Cifras en miles de pesos} \stopxcell \startxcell \strong{Dato} \stopxcell \stopxrow \stopxtablehead \startxtablebody[body] \startxrow \startxcell[align=right] Bono \stopxcell \startxcell Ordinario \stopxcell \stopxrow \startxrow \startxcell[align=right] Valor nominal \stopxcell \startxcell \$100\,000 \stopxcell \stopxrow \startxrow \startxcell[align=right] Tasa cupón - periodicidad anual \stopxcell \startxcell 12,50\,\letterpercent{} \stopxcell \stopxrow \startxrow \startxcell[align=right] Cupón \stopxcell \startxcell \$12\,500 \stopxcell \stopxrow \startxrow \startxcell[align=right] Vencimiento en años \stopxcell \startxcell 5 \stopxcell \stopxrow \startxrow \startxcell[align=right] Tasa de negociación (tasa de mercado) \stopxcell \startxcell 12,50\,\letterpercent{} \stopxcell \stopxrow \startxrow \startxcell[align=right] Precio de venta \stopxcell \startxcell \$100\,000 \stopxcell \stopxrow \startxrow \startxcell[align=right] Costos de transacción/ precio de venta \stopxcell \startxcell 0 \stopxcell \stopxrow \startxrow \startxcell[align=right] Fecha de emisión \stopxcell \startxcell 30-mar-X6 \stopxcell \stopxrow \stopxtablebody \stopxtable \stopplacetable Can I make this table to be "tight" but only so much as to allow "short lines" (i.e: lines that don't make the table go wider than textwidth). I can do it with manual width, but wondering if it's possible. Thank you . -- Andrés Conrado Montoya Andi Kú andresconr...@gmail.com http://sesentaycuatro.com http://messier87.com http://chiquitico.org Los fines no justifican los medios, porque la medida verdadera de nuestro carácter está dada por los medios que estamos dispuestos a utilizar, no por los fines que proclamamos. “You develop an instant global consciousness, a people orientation, an intense dissatisfaction with the state of the world, and a compulsion to do something about it. From out there on the moon, international politics look so petty. You want to grab a politician by the scruff of the neck and drag him a quarter of a million miles out and say, ‘Look at that, you son of a bitch.’” — Apollo 14 astronaut Edgar Mitchell ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] LMTX isn't typesetting math correctly with Pagella
On Sun, Jan 17, 2021 at 10:00 PM Hans Hagen wrote: > On 1/16/2021 12:33 AM, Hans Hagen wrote: > > On 1/15/2021 1:33 PM, Jack Hill wrote: > >> Hi, > >> > >> I've been having some trouble with ConTeXt not typesetting math > >> correctly when using the Pagella font (I do not know if the same issue > >> occurs with other fonts as I haven't tested them). > >> > >> If I compile with LMTX, the spacing between letters becomes very small > >> so that when I type "|f|", for example, the second "|" intersects the > >> f and looks rather ugly. However, compiling with the --luatex switch > >> fixes these issues and the math looks nice again. > >> > >> Can anybody else replicate this issue, and does anybody know why it is > >> happening? > >> > >> This the code I used to test: > >> > >> |\setupbodyfont[pagella] \starttext \startformula |f| = \sqrt{\int_0^1 > >> |f(t)|^2 \text{d}t} \stopformula \stoptext ||| > > I'll check it ... smells like some interference between newer and older > > corrections (these gyre fonts need some special treatment). > I uploaded lmtx. > > Here is the story about math: > > - there is traditional math, the 8 bit fonts (from Don Knuth) > - and there is opentype math (originating at Microsoft) > > the eight bit fonts are all modelled after the cmr fonts so they have > the same set of parameters, the same assumptions about family 2 and 3, > use the same width/height/depth trickery > > one thing is that they lie about the width: the italic correction is > subtracted from the width and the engine always adds it when a glyph is > dealt with but then removes in some cases afterwards > > in opentype we also have italic correction but that is applied in > specific cases; there the shapes have a real width > > (there are tricks to make fonts seen as opentype be treated as old > school which work ok for virtual constructs that only use those 8 bit > fonts but often fail for gyre fonts) > > now, the gust foundation fonts are a mix: they are opentype, have its > parameters and properties but have the wrong width and assume the italic > hackery > > the microsoft cambria font is the reference for opentype math (and to > some extend microsoft word also is) > > afaik xetex uses the old tex approach also for opentype so that is why > probably the old width approach works ok there but i never looked into > it; cambria is an opentype font but probably seldom used so side effects > will go unnoticed, also, texies often have no problem blaming microsoft, > even when they got it right; of course we have to admit that 'moving > forward wrt math fonts' didn't come from our community so we just have > to follow > > now, when we move on (with context + luametatex) to a variants font > scaling model, i need to adapt the math machinery to deal with that ... > this can have side effects as you noticed but these will be dealt with > (or fixed when something is wrong) > > in context we have font goodies that can handle this (widths, kerns etc) > and we do so for at least the 'f' which also has a strange left offset > ... i now adapted that to also serve the new (compact context font) > model and also make sure that the smaller sizes for mkiv are handled; we > can add more in those files, but that's also a (math) user effort > > to be decided is of we use the feature setting "mathkerns=yes" (this was > a directive but i made it just a feature) > > Now, ideally: > > \enableexperiments[fonts.compact] % for the definitions > > should give nearly similar results (but less mem usage, less fonts > loaded and possibly some performance gain) > > I also updated some test features: > > \definefontfeature[mathextra][staircase=yes,boundingbox=frame] > > as part of the general lmtx upgrading process. Only cambria (and lucida) > have these staircase kerns and e.g. pagella and friends have a few > defined in the font goodies but one has to do something liek this: > > > > \definefontfeature[mathextra][mathkerns=yes,staircase=yes,boundingbox=frame] > > more such tracers will be added in due time (and some old ones will go > away as they lost their purpose). > > Hans > > I got curious about those staircase kerns. Is there a simple example that shows their effect? I greped the source, but did not find anything where I could see a difference. /Mikael ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] lmtx
Hi, There's a new lmtx upload with a few fixes in publication lists (TS made some tests). For those who like fonts, there is an update of the punk font (the mkiv variants dates from 2008 which is ancient on a software timeline). You can run meta-imp-punk.mkxl to get an idea. There's also a typescript: type-imp-punk.mkxl one can create different versions and play with random variants and such. The question is: do we need more metapost font magic and infrastructure? For "pdf features that browsers implement fuzzy or not at all" lovers there is test \startalternate[text={A}] \dorecurse{10}{A } \startalternate[text={B}] \dorecurse{10}{B } \stopalternate \dorecurse{10}{A } \stopalternate test \par test \startalternate[text={e=mc^2}]!$e=mc^2$\stopalternate\par test \alternate{e=mc^2}{copy:}\nbsp$e=mc^2$\par which cheats on cut and paste (if you know where to click). (It actually will replace something more low level which is probably not used anyway.) 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] "Nicefracs" hidden in math-frc.mkiv
On 1/18/2021 5:17 PM, Andres Conrado Montoya wrote: Hello, list. I Was checking out math-frc.mkiv to learn stuff, and found out that at the end of that file, from line 673, there is a couple commented out macros to generate "nice fractions'', i.e.: ½ (as in the LaTeX package nicefrac). Why has this code been commented out? These are quite useful. because text fraction seldom look good in math when combined with other script sizes that are needed to complement the missing nice fractions 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] "Nicefracs" hidden in math-frc.mkiv
Hello, list. I Was checking out math-frc.mkiv to learn stuff, and found out that at the end of that file, from line 673, there is a couple commented out macros to generate "nice fractions'', i.e.: ½ (as in the LaTeX package nicefrac). Why has this code been commented out? These are quite useful. -- Andrés Conrado Montoya Andi Kú andresconr...@gmail.com http://sesentaycuatro.com http://messier87.com http://chiquitico.org Los fines no justifican los medios, porque la medida verdadera de nuestro carácter está dada por los medios que estamos dispuestos a utilizar, no por los fines que proclamamos. “You develop an instant global consciousness, a people orientation, an intense dissatisfaction with the state of the world, and a compulsion to do something about it. From out there on the moon, international politics look so petty. You want to grab a politician by the scruff of the neck and drag him a quarter of a million miles out and say, ‘Look at that, you son of a bitch.’” — Apollo 14 astronaut Edgar Mitchell ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Getting dimensions in Lua
To be wikified (by me, obviously). Thank you for such a great number of alternatives. Jairo :) El lun, 18 de ene. de 2021 a la(s) 04:45, Hans Hagen (j.ha...@xs4all.nl) escribió: > On 1/18/2021 1:58 AM, Jairo A. del Rio wrote: > > Hi, list. > > > > I want to get some dimensions in Lua. See, for instance > > > > \starttext > > > > \the\dimexpr\availablehsize\relax %say, 426pt > > > > \stoptext > > > > Is there an equivalent in ConTeXt for Lua, i.e. without passing values > > from TeX or, at least, using only Lua commands? Thank you in advance. > tex being tex, there is always a way ... > > 1: \number\dimexpr\availablehsize\relax > > 2: \startluacode > > token.set_macro(tex.ctxcatcodes,"temp","\\scratchdimen\\availablehsize") > token.expand_macro("temp") > context(tex.getdimen("scratchdimen")) > \stopluacode > > 3: \startluacode > > token.set_macro(tex.ctxcatcodes,"temp","\\scratchdimen\\availablehsize") > tex.runlocal("temp") > context(tex.getdimen("scratchdimen")) > \stopluacode > > 4: \startluacode > tex.print("\\scratchdimen\\availablehsize") > tex.pushlocal() > tex.poplocal() > context(tex.getdimen("scratchdimen")) > \stopluacode > > 5: \startluacode > tex.print("\\dimensiondef\\temp\\availablehsize") > tex.pushlocal() > tex.poplocal() > context(tex.getdimensionvalue("temp")) > \stopluacode > > \def\calculateavailablehsize{\dimensiondef\temp\availablehsize} > > 6: \startluacode > token.expand_macro("calculateavailablehsize") > context(tex.getdimensionvalue("temp")) > \stopluacode > > \newtoks\tcalculateavailablehsize > \tcalculateavailablehsize{\dimensiondef\temp\availablehsize} > > 7: \startluacode -- mkiv > tex.runtoks("tcalculateavailablehsize") > context(tex.getdimensionvalue("temp")) > \stopluacode > > i'm (still) considering a way to flag a macro to be an expression (or > value) but there are several variants possible but normally it takes a > while before i decide what makes most sense (as i need to apply it in > real code to see if it looks nice) > > 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] Getting dimensions in Lua
Woah, nice! I was trying to pass some values to MetaPost via Lua (usual laziness to learn macro languages). Thank you a lot, especially because I was looking at the wrong functions in the token namespace. I'll upload a more specific example soon while I polish some code. Very thankful. Jairo :) El lun, 18 de ene. de 2021 a la(s) 05:02, Taco Hoekwater (t...@bittext.nl) escribió: > > > > On 18 Jan 2021, at 10:45, Hans Hagen wrote: > > > > On 1/18/2021 1:58 AM, Jairo A. del Rio wrote: > >> Hi, list. > >> I want to get some dimensions in Lua. See, for instance > >> \starttext > >> \the\dimexpr\availablehsize\relax %say, 426pt > >> \stoptext > >> Is there an equivalent in ConTeXt for Lua, i.e. without passing values > from TeX or, at least, using only Lua commands? Thank you in advance. > > tex being tex, there is always a way ... > > There is also this option: > >% function returns scaled points >\startluacode >function availablehsize() > local l = tex.dimen.hsize - tex.skip.leftskip.width - > tex.skip.rightskip.width > if tex.count.hangafter<0 then > local h = tex.dimen.hangindent > if h>0 then l = l - h else l = l + h end > end > return l >end >\stopluacode > > But I suspect that there are multiple cases where this does not work > (like when used in horizontal mode, for example if the par setting changes > before the \par is seen, or when there is data in the local par node) > > Best wishes, > Taco > > — > Taco Hoekwater E: t...@bittext.nl > genderfluid (all pronouns) > > > > > > > > ___ 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] Getting dimensions in Lua
> On 18 Jan 2021, at 10:45, Hans Hagen wrote: > > On 1/18/2021 1:58 AM, Jairo A. del Rio wrote: >> Hi, list. >> I want to get some dimensions in Lua. See, for instance >> \starttext >> \the\dimexpr\availablehsize\relax %say, 426pt >> \stoptext >> Is there an equivalent in ConTeXt for Lua, i.e. without passing values from >> TeX or, at least, using only Lua commands? Thank you in advance. > tex being tex, there is always a way ... There is also this option: % function returns scaled points \startluacode function availablehsize() local l = tex.dimen.hsize - tex.skip.leftskip.width - tex.skip.rightskip.width if tex.count.hangafter<0 then local h = tex.dimen.hangindent if h>0 then l = l - h else l = l + h end end return l end \stopluacode But I suspect that there are multiple cases where this does not work (like when used in horizontal mode, for example if the par setting changes before the \par is seen, or when there is data in the local par node) Best wishes, Taco — Taco Hoekwater E: t...@bittext.nl genderfluid (all pronouns) ___ 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] Getting dimensions in Lua
On 1/18/2021 1:58 AM, Jairo A. del Rio wrote: Hi, list. I want to get some dimensions in Lua. See, for instance \starttext \the\dimexpr\availablehsize\relax %say, 426pt \stoptext Is there an equivalent in ConTeXt for Lua, i.e. without passing values from TeX or, at least, using only Lua commands? Thank you in advance. tex being tex, there is always a way ... 1: \number\dimexpr\availablehsize\relax 2: \startluacode token.set_macro(tex.ctxcatcodes,"temp","\\scratchdimen\\availablehsize") token.expand_macro("temp") context(tex.getdimen("scratchdimen")) \stopluacode 3: \startluacode token.set_macro(tex.ctxcatcodes,"temp","\\scratchdimen\\availablehsize") tex.runlocal("temp") context(tex.getdimen("scratchdimen")) \stopluacode 4: \startluacode tex.print("\\scratchdimen\\availablehsize") tex.pushlocal() tex.poplocal() context(tex.getdimen("scratchdimen")) \stopluacode 5: \startluacode tex.print("\\dimensiondef\\temp\\availablehsize") tex.pushlocal() tex.poplocal() context(tex.getdimensionvalue("temp")) \stopluacode \def\calculateavailablehsize{\dimensiondef\temp\availablehsize} 6: \startluacode token.expand_macro("calculateavailablehsize") context(tex.getdimensionvalue("temp")) \stopluacode \newtoks\tcalculateavailablehsize \tcalculateavailablehsize{\dimensiondef\temp\availablehsize} 7: \startluacode -- mkiv tex.runtoks("tcalculateavailablehsize") context(tex.getdimensionvalue("temp")) \stopluacode i'm (still) considering a way to flag a macro to be an expression (or value) but there are several variants possible but normally it takes a while before i decide what makes most sense (as i need to apply it in real code to see if it looks nice) 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] question about vardef variables
> On 17 Jan 2021, at 11:17, Damien Thiriet wrote: > > Hi, > > > I have some troubles with understanding metafun's macro mechanism. > > Given this MWE: > > \starttext > \startMPpage > > vardef Test (expr ab,cd)= > %numeric ab; > %numeric cd; > draw unitsquare scaled 10 xshifted ab; > draw unitsquare scaled 10 yshifted cd; > enddef; > > Test (50,100); > \stopMPpage > \stoptext > > Uncommenting the two declarations makes me run intro a silent error. I was > lucky enough yesterday to get an explicit error message with a more > complex macro. It made me figure out where my problems came from. > > So here are my two questions: > - Why shouldn't we tell metafun if expr is a path, a pair or so on? You were (attempting to) redefine the macro’s arguments, but they are read-only. A somewhat longer answer: the type of macro arguments in this case is “expr”. Metapost argument types are based solely on what the internal language parser needs to interpret the code; the language is not strongly typed. Also, during macro expansion, your code is replaced by: %numeric (READONLY TEMP VALUE 1); %numeric (READONLY TEMP VALUE 2); draw unitsquare scaled 10 xshifted (READONLY TEMP VALUE 1); draw unitsquare scaled 10 yshifted (READONLY TEMP VALUE 2); Best wishes, Taco — Taco Hoekwater E: t...@bittext.nl genderfluid (all pronouns) ___ 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 ___