[NTG-context] Re: QR Code (Henning Hraban Ramm)

2024-04-29 Thread Benjamin Buchmuller
Hi Hraban,

Downgrading zint to 2.12.0 worked for me. Many thanks!

In case someone is experiencing similar issues, I ran:

brew remove zint
curl 
https://raw.githubusercontent.com/Homebrew/homebrew-core/962d789d26c9d8f760affe272689f21388f7d3e2/Formula/z/zint.rb
 > zint.rb
brew install zint.rb
zint --version (should be 2.12.0)

[follow the instructions to symlink zint to 
tex/texmf-osx-64/bin/lib/luametatex/zint]

mtxrun --generate


___
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: QR Code

2024-04-28 Thread Benjamin Buchmuller
Catching up on an earlier thread by Ursula and Hraban,

I'm also experienceing problems with \usemodule[zint] while \usemodule[t-zint] 
works fine. 

Running on macOS (ConTeXt  ver: 2024.04.01 08:59 LMTX  fmt: 2024.4.28).

The issue seems somewhat unrelated to ConTeXt on first glance (??) if this is 
helpful. My code stopped working after I updated the OS (to Sonoma) and my 
homebrew cellar (to zint 2.13.0) while keeping a ConTeXt version from 2022 
which compiled the barcodes perfectly fine before these updates. This being 
said, the newer ConTeXt version doesn't resolve the issue.

Observations:

1) Zint (and Inkscape) is in my PATH and correctly sym-linked as specified in 
the wiki (~/tex/texmf-osx-64/bin/lib/luametatex/zint/libzint.so 
). However, the library was (still) not fount after mtxrun 
--generate

[This seems an odd, but unrelated problem]

2) So, I hardcoded libfile in libs-impzint.lmt to

local libfile = "/usr/local/Cellar/zint/2.13.0/lib/libzint.dylib"

3) Running the wiki example:

  \usemodule[m-zint]
   \starttext
   \barcode[alternative=isbnx, text=9783865419026, width=4cm]
   \barcode[alternative=qrcode, text={https://wiki.contextgarden.net}, 
   width=3cm]
   \barcode[alternative=maxicode, text={test}, width=3cm]
   \stoptext

* With \usemodule[m-zint], I correctly get:

zint --barcode=qrcode  
--output="zint-qrcode-495165e08dbc5ce650aaaf13caa2229f.eps" 
--input="zint-qrcode-495165e08dbc5ce650aaaf13caa2229f.tmp"
zint --barcode=maxicode  
--output="zint-maxicode-098f6bcd4621d373cade4e832627b4f6.eps" 
--input="zint-maxicode-098f6bcd4621d373cade4e832627b4f6.tmp"

[Barcodes show up as expected]

* With \usemodule[zint], no success:

optional> using library 
'/usr/local/Cellar/zint/2.13.0/lib/libzint.dylib'
zint> something went wrong: invalid result vector
zint> something went wrong: invalid result
zint> something went wrong: invalid result vector

Maybe this is helpful to pinpoint the issue?

Best


Ben
___
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: xmlpos values doubled

2023-11-21 Thread Benjamin Buchmuller
Hi list,

I came across this old thread as I was trying to use \xmlpos{#1} to 
"dynamically" create references such as \item[mystep:\xmlpos{#1}] to be 
referenced when other elements of this node are parsed at a later point. 

In fact, it seems that \xmlpos{#1} returns duplicate values. This might indeed 
be the intended meaning of \xmlpos{#1} as it seems related to the XML query 
foo/bar/index() which only looks up the position in the parent node. (I noticed 
that if I run this repeatedly, I get somehow different values from times to 
times. I can't say why.)

Anyways, I was wondering if there is a TeX command to access the absolute 
position of an element in the tree? Similar to foo/bar[rootposition()] (or 
foo/bar[order()]? – Can't make sense of the entry in the XML manual.)

Thank you for your help!


Benjamin


> Hi Ben,
> 
> I think that both \xmlpos and \xmldepth give weird results.
> 
> With this minimal sample:
> 
> \startbuffer[text]
> first level
> second level
> third level
> third level
> 
> second level
> third level
> third level
> 
> second level
> third level
> third level
> 
> 
> \stopbuffer
> 
> \startxmlsetups xml:text
> \xmlsetsetup{#1}{doc|s|ss}{xml:*}
> \stopxmlsetups
> 
> \xmlregistersetup{xml:text}
> 
> \startxmlsetups xml:doc
> \chapter{\xmlpos{#1}\letterat\xmldepth{#1}: \xmlflush{#1}}
> \stopxmlsetups
> 
> \startxmlsetups xml:s
> \section{\xmlpos{#1}\letterat\xmldepth{#1}: \xmlflush{#1}}
> \stopxmlsetups
> 
> \startxmlsetups xml:ss
> \subsection{\xmlpos{#1}\letterat\xmldepth{#1}: \xmlflush{#1}}
> \stopxmlsetups
> 
> \setuphead[chapter,section,subsection][before=,after=,]
> \starttext
> \xmlprocessbuffer{main}{text}{}
> \stoptext
> 
> \xmldepth shows values that I think are +1 than they should be.
> 
> \xmlpos counts in pairs and not in units (as you wrote, 2, 4, 6...).
> 
> Hans, could you check whether this is working as expected?
> 
> Sorry, but if this isn’t a bug, I have no idea of what I may be missing.
> 
> Pablo
> 
___
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] Low res output possible?

2023-08-21 Thread Benjamin Buchmuller
Hi Julian,

I had the same question a couple of days ago and I found a thread on the 
mailing list, which I'm reposting here. Although this worked for me, I found 
downsampling of the pdf with gs more convenient.

Hope this helps,


Benjamin

%

if not modules then modules = { } end modules ['grph-downsample'] = {
  version   = 1.101,
  comment   = "companion to grph-inc.mkiv",
  author= "Peter Münster", -- adapted to LMTX by Hraban
  copyright = "PRAGMA ADE / ConTeXt Development Team",
  license   = "see context related readme files"
}

assert(not figures.getinfo2)

figures.getinfo2 = function(name, page) -- [ [NTG-context] Pdf info with 
Lua/Ctx API ]
 if type(name) == "string" then
   name = { name = name, page = page }
 end

 if name.name then
   local data = figures.push(name)
   local info = figures.identify()

   if info.status.status ~= 0 then
 figures.check() -- !Counts pages here!
   end

   figures.pop()

   return --data
  info
 end
end


local format = string.format
-- figures.cachepaths.path = "cache" -- should be setup-option
local function sample_down(oldname, newname, resolution)
  print("DOWNSAMPLE sample_down " .. oldname .. " to " .. newname)
  local request = figures.current().request
  local width = request.width
  local height = request.height
  if resolution == "" then -- or (not width and not height) then
print(format("DOWNSAMPLE Nothing to do: %s, %s, %s dpi, %s x %s px", 
oldname, newname, resolution, width, height))
return
  end
  local TEXpt = 65536
  local inch = 72.27

  -- MkIV:
  -- local image = img.scan{filename = oldname}

  -- LMTX:
  local image = figures.getinfo(oldname,1)
  image = image.status.private

  local xy = image.xsize / image.ysize
  if (not width and not height) then
-- no size requested? use default width
width = 300 * TEXpt
  end
  if not width then
height = height / TEXpt
width = height * xy
  end
  if not height then
width = width / TEXpt
height = width / xy
  end
  width = math.floor(width)
  height = math.floor(height)
  print(format("DOWNSAMPLE image size %dx%dpx. requested %dx%d?", image.xsize, 
image.ysize, width, height))
  local xsize = math.floor(resolution * width / inch)
  local ysize = math.floor(resolution * height / inch)
  print(format("DOWNSAMPLE size %d x %d to %d x %d", image.xsize, image.ysize, 
xsize, ysize))
  if xsize < image.xsize or ysize < image.ysize then
local s = format("gm convert -resize %dx%d -resample %dx%d \"%s\" \"%s\"",
 xsize, ysize, resolution, resolution, oldname, newname)
print("DOWNSAMPLE Conversion: " .. s)
os.execute(s)
  else
print(format("DOWNSAMPLE Nothing to do: %s, %s, %s dpi, %d x %d px", 
oldname, newname, resolution, width, height))
print(format("DOWNSAMPLE xsize = %d, ysize = %d", xsize, ysize))
  end
end

local formats = {"png", "jpg", "gif"}

for _, s in ipairs(formats) do
  figures.converters[s] = figures.converters[s] or {}
  figures.converters[s]["lowres." .. s] = sample_down
end

local function sample_down_pdf(oldname, newname, resolution)
print("DOWNSAMPLE sample_down " .. oldname .. " to " .. newname)

-- MkIV:
-- local image = img.scan{filename = oldname}

-- LMTX:
local image = figures.getinfo(oldname,1)
image = image.status.private

local s = format("gs \
-o \"%s\" \
-sDEVICE=pdfwrite \
-dDownsampleColorImages=true \
-dDownsampleGrayImages=true \
-dDownsampleMonoImages=true \
-dColorImageResolution=%s \
-dGrayImageResolution=%s \
-dMonoImageResolution=%s \
-dColorImageDownsampleThreshold=1.0 \
-dGrayImageDownsampleThreshold=1.0 \
-dMonoImageDownsampleThreshold=1.0 \
\"%s\"",
oldname, resolution, resolution, resolution, newname)
   print("DOWNSAMPLE Conversion: " .. s)
  os.execute(s)
end

figures.converters["pdf"]["lowres." .. "pdf"] = sample_down_pdf

%

\loadluafile[grph-downsample]
\doifmodeelse{print}{%
\def\Resolution{300}
}{%
\def\Resolution{96}
}%
___
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: setupexternalfigures and resoĺution

2023-07-28 Thread Benjamin Buchmuller
This thread about downsampling external images on the fly is a really helpful 
feature! Thanks, Hraban for sharing the code!

I was wondering if it was possible to downscale also raster images embedded in 
pdf/svg files loaded via \externalfigure?

I found a ghostscript solution online 
(https://stackoverflow.com/questions/9497120/how-to-downsample-images-within-pdf-file)

gs \
-o downsampled.pdf \
-sDEVICE=pdfwrite \
-dDownsampleColorImages=true \
-dDownsampleGrayImages=true \
-dDownsampleMonoImages=true \
-dColorImageResolution=72 \
-dGrayImageResolution=72 \
-dMonoImageResolution=72 \
-dColorImageDownsampleThreshold=1.0 \
-dGrayImageDownsampleThreshold=1.0 \
-dMonoImageDownsampleThreshold=1.0 \
input.pdf

Now, I'm wondering how to adapt grph-downsample.lua to do this?

I've tried:

\setupexternalfigure[
resolution=\Resolution, conversion=lowres.pdf
]

And added to grph-downsample.lua

local function sample_down_pdf(oldname, newname, resolution)
print("DOWNSAMPLE sample_down " .. oldname .. " to " .. newname)

-- MkIV:
-- local image = img.scan{filename = oldname}

-- LMTX:
local image = figures.getinfo(oldname,1)
image = image.status.private

local s = format("gs \
-o \"%s\" \
-sDEVICE=pdfwrite \
-dDownsampleColorImages=true \
-dDownsampleGrayImages=true \
-dDownsampleMonoImages=true \
-dColorImageResolution=%s \
-dGrayImageResolution=%s \
-dMonoImageResolution=%s \
-dColorImageDownsampleThreshold=1.0 \
-dGrayImageDownsampleThreshold=1.0 \
-dMonoImageDownsampleThreshold=1.0 \
\"%s\"",
oldname, resolution, resolution, resolution, newname)
   print("DOWNSAMPLE Conversion: " .. s)
  os.execute(s)
end

figures.converters["pdf"]["lowres." .. "pdf"] = sample_down_pdf

But I must be missing something as the code doesn't seem to be called.

Any suggestions?

Thanks!


Ben

___
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] setupregister with realpage?

2022-09-23 Thread Benjamin Buchmuller via ntg-context
Thank you, Hans! This works, I get all the correct page references!

I didn't know about cont-new.mkxl to temporarily store "hacks". I assume the 
file is updated with each release? Is there a way to store local hacks, e.g., 
in texmf-local? I could not find "cont-loc" (maybe it's not a file).

For future reference, this is how I am using the hack:

\def\MyRegisterPageCommand#1{\currentregisterrealpage}

\setupregister[MyRegisterA][pagecommand=\MyRegisterPageCommand]
\setupregister[MyRegisterB][pagecommand=\MyRegisterPageCommand]

> On Sep 23, 2022, at 17:47, Hans Hagen  wrote:
> 
> On 9/23/2022 11:08 PM, Benjamin Buchmuller via ntg-context wrote:
>> Dear list,
>> \setuplist has the convenient option [pagenumber=realpage]
>> \setupregister has not (yet).
>> How can I get the realpagenumber instead of the userpagenumber for the 
>> register indices?
>> I tried
>> \def\MyPageCommand#1{\realpagenumber}
>> \setupregister[MyIndex][pagecommand=\MyPageCommand]
>> but this prints only the current (although real) page number.
> you can try with this in cont-new.mkxl
> 
> \pushoverloadmode \unprotect
> 
> \let\currentregisterrealpage\!!zerocount % todo: more general accessor
> 
> \permanent\protected\def\withregisterpagecommand#1#2#3#4%
>  {\ifcase#3\relax
> {\tt [entry\space not\space flushed]}%
>   \else
> \def\currentregisterpageindex{#2}%
> \def\currentregisterrealpage{#3}%
> \iflocation
> \strc_references_goto_internal{\applyprocessor{#1}{\registerparameter\c!pagecommand{#4}}}[internal(#2)]%
> \else
>   \applyprocessor{#1}{\registerparameter\c!pagecommand{#4}}%
> \fi
>   \fi}
> 
> \protect \popoverloadmode
> 
> which sets \currentregisterrealpage
> 
> -
>  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] setupregister with realpage?

2022-09-23 Thread Benjamin Buchmuller via ntg-context
Dear list,

\setuplist has the convenient option [pagenumber=realpage]

\setupregister has not (yet).

How can I get the realpagenumber instead of the userpagenumber for the register 
indices?

I tried

\def\MyPageCommand#1{\realpagenumber}

\setupregister[MyIndex][pagecommand=\MyPageCommand]

but this prints only the current (although real) page number.

Thank you!


Benjamin
___
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] Count (and limit) glyphs per line?

2022-07-18 Thread Benjamin Buchmuller via ntg-context
Dear Hans,

This is the friendly reminder you requested for the "crappyspecs" parbuilder as 
per your example in early July.

With 

ConTeXt  ver: 2022.07.06 21:42 LMTX  fmt: 2022.7.8

I get 

tex error > tex error on line 12 in file ./test-wrapping2.tex: Undefined 
control sequence \crappyspeccount

potentially as there is no crappyspec parbuilder yet?

\defineparbuilder [crappyspec] % implemented in the builder namespace 
\defineparbuilder [default] % implemented in the builder namespace
\setmainparbuilder[crappyspec]
\setuptolerance[verytolerant,stretch] \dontcomplain
\protected\def\CrappyTraced
{\par \strut \rlap \bgroup\infofont
(\enspace
max = \the\crappyspeccount \quad step = \the\crappyspecstep \quad hsize = 
\the\hsize \quad used = \the\crappyspecdimen \enspace
)
\egroup \par}
\starttext
\crappyspeccount60 \samplefile{tufte} \CrappyTraced \par
\crappyspeccount40 \samplefile{tufte} \CrappyTraced \par % \crappyspecstep 2pt 
\samplefile{tufte} \CrappyTraced \par
\samplefile{tufte} \CrappyTraced \startitemize
\startitem
\samplefile{tufte} \CrappyTraced
\stopitem
\startitem
\samplefile{ward} \CrappyTraced \stopitem
\stopitemize
\startnarrower[6*left,right] \samplefile{tufte} \CrappyTraced
\stopnarrower
\starthanging [distance=4em,n=2] {test} \samplefile{tufte} \CrappyTraced
\stophanging
\page % \stoptext \setuppapersize[landscape,letter]
\samplefile{knuth} \CrappyTraced \startitemize[width=5em]
\startitem
\samplefile{knuth} \CrappyTraced
\stopitem
\startitem
{\smallcaps \darkblue \samplefile{knuth}} \CrappyTraced \stopitem
\stopitemize
\crappyspeccount60 \startitemize[width=5em]
\startitem
\samplefile{knuth} \CrappyTraced
\stopitem
\startitem
{\smallcaps \darkgreen \samplefile{knuth}} \CrappyTraced \stopitem
\stopitemize
\page



Thank you once again for your help!


Benjamin

--

The problem with these thing is that there is more involved than just counting, 
like font features, hyphenation, current paragrph properties, etc. and you 
don't want interference with other features. You also want the paragraphs to 
look somewhat ok. Folks who enforce such demands on authors never wonder where 
the tools do do that come from (publishers and probably most designers are not 
interested in that anyway: thinking probably stops at the number '120').
Attached a proof of concept that gives an idea. No upload as first we need to 
do some wrapping up of math. Not that we needed something in the engine other 
than the linebreak helper to accept direct modes (no need to go back and forth 
then and i only want write this crap once). Could be a module although it's 
only some 70 lines of code in the end. Maybe it makes a nice (lmtx) demo for 
the ctx meeting too.
Here we work per paragraph not per line which looks better on the average. One 
could mess with parshapes but why bother.
(The todo in the name refers to the fact that it might do into a th elow level 
paragraph manual.)
(No more time now but we can add later; remind me if I forget.)

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
-

> On Jun 26, 2022, at 18:32, Max Chernoff  wrote:
> 
> On 2022-06-26 9:59 a.m., Benjamin Buchmuller wrote:
>> Hi Max,
>> Thank you so much for your help and pointing me to the documents; always a 
>> lot of things to learn in TeX!
> 
> No problem :)
> 
>> I'm afraid that including the hyphen width doesn't solve the issue yet. It 
>> seems to move the problem to other parts of the text.
> 
> Ah, too bad. My next step would have been to insert \penalty1's (prevent 
> breaks) at the potential breaks before/after the "selected" break, but Hans 
> provided a _much_ better solution that you should use instead.
> 
>> My guess is that one could equivalently have said "local max_length = 111", 
>> right?
> 
> Not really; the hyphen is added to the accumulated width, not the accumulated 
> character count.
> 
>> I made the following MWE (reproducible also online) to illustrate what I see:
> 
> My code assumes that each line has _roughly_ "max_length" characters before 
> it runs. These lines each only have ~60 characters, so I'm not entirely 
> surprised that there are issues. Just use Hans's solution, which is much less 
> of a total hack than this is :)
> 
>> * Running with hsize only makes the problem worse in itemizations, so I 
>> think localhsize is the way to go. My guess, localhsize is the width of the 
>> "text" part of a paragraph, for example, excluding the symbols in the 
>> itemization.

Re: [NTG-context] Count (and limit) glyphs per line?

2022-06-26 Thread Benjamin Buchmuller via ntg-context
I completely agree, Hans, that such specifications are often made without a 
second thought on them. And Max is probably right that they originated from the 
typewriter area. 

In a sense these "challenges" can be at least somewhat educational. I've 
learnt---also thanks to Max's suggestions---a fair amount on LMTX. So, I'm 
looking forward to see how the "crappyspec" parbuilder will finally look like.

Thank you very much for the demo, looks very impressive!

Best


Benjamin

___
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] Count (and limit) glyphs per line?

2022-06-26 Thread Benjamin Buchmuller via ntg-context
Hi Max, 

Thank you so much for your help and pointing me to the documents; always a lot 
of things to learn in TeX!

I'm afraid that including the hyphen width doesn't solve the issue yet. It 
seems to move the problem to other parts of the text. My guess is that one 
could equivalently have said "local max_length = 111", right?

I made the following MWE (reproducible also online) to illustrate what I see: 

* Here, instead of a breaking point, the trouble is caused by not being able to 
break it. This causes the next line to be underfull. (I get a lot of these, but 
also some with hyphenated breakpoints, in my own document. Maybe the insertion 
point of the penalty/breaking bonus needs to move up?) 

* Running with hsize only makes the problem worse in itemizations, so I think 
localhsize is the way to go. My guess, localhsize is the width of the "text" 
part of a paragraph, for example, excluding the symbols in the itemization.

(More thoughts below)

\startluacode
   local max_length = 112

   local glyph_id = node.id "glyph"
   local disc_id = node.id "disc"
   local glue_id = node.id "glue"

   function userdata.limiter(head)
   head = language.hyphenate(head)

   local hyphen = node.new "glyph"
   hyphen.char = language.prehyphenchar(0)
   hyphen.font = font.current()
   local width = hyphen.width
   node.free(hyphen)

   local chars = 0
   local n = head
   while n do
   if n.id == glyph_id or n.id == glue_id then
   chars = chars + 1
   width = width + n.width - (n.shrink or 0)
   end

   local localhsize = tex.dimen["textwidth"]
   
   if tex.dimen["localhsize"] > 0 then
   localhsize = tex.dimen["localhsize"]
   end

   if chars >= max_length or width > localhsize then
   local back_chars = 0
   local end_disc = nil

   while n do
   if n.id == glue_id then
   local penalty = node.new "penalty"
   penalty.penalty = -1
   node.insertbefore(head, n, penalty)
   break
   end

   if not end_disc and n.id == disc_id then
   end_disc = n
   end

   if end_disc and back_chars >= 5 then
   end_disc.penalty = -1
   break
   end

   if n.id == glyph_id then
   back_chars = back_chars + 1
   end

   n = n.prev
   end

   width = 0
   chars = 0
   end

   n = n.next
   end

   return head
   end

   nodes.tasks.appendaction(
   "processors",
   "before",
   "userdata.limiter"
   )
   \stopluacode

   \setuppapersize[A5]
   \showframe

   \starttext

This is text width:
   \ctxlua{context(tex.dimen["textwidth"])}
   
   This is hsize:
   \ctxlua{context(tex.dimen["hsize"])}
   
   This is localhsize:
   \ctxlua{context(tex.dimen["localhsize"])}

   \startitemize[width=5em]
   
   \item Thus, I came to the conclusion that the \hbox{de­signer} of a 
new system must not only be the implementer and first large--scale user; the 
de­ signer should also write the first user manual.

   \item \samplefile{knuth}

This is text width:
   \ctxlua{context(tex.dimen["textwidth"])}
   
   This is hsize:
   \ctxlua{context(tex.dimen["hsize"])}
   
   This is localhsize:
   \ctxlua{context(tex.dimen["localhsize"])}

   \stopitemize
   
   \stoptext

I'm wondering if I do understand the second while loop correctly:

* Once we find the node that exceeds either the character limit or the 
(local-)hsize (glyphs and glues summed, for disc we add hyphen.width, do we?), 
then we insert an incredibly good breaking point for a new line. And exit the 
loop.

* The other cases still seem a bit obscure to me, and I tried to trace where 
each of them might be triggered:

   if n.id == glue_id then
   local penalty = node.new "penalty"
   penalty.penalty = -1
   node.insertbefore(head, n, penalty)
   context.inrightmargin("glue")
   break
   end

   if not end_disc and n.id == disc_id then
   

Re: [NTG-context] Count (and limit) glyphs per line?

2022-06-25 Thread Benjamin Buchmuller via ntg-context
Dear list,

A brief follow-up for (1) itemizations [resolved; but question on ConTeXt hsize 
defaults] and (2) hyphenation [troubles].

(1) To deal with itemizations and other situation where texts are indented such 
as:

   \setuppapersize[landscape,letter]
   \showframe

   \starttext

   \samplefile{knuth}

   \ctxlua{context(tex.dimen["textwidth"])} % 37213340

   \ctxlua{context(tex.dimen["localhsize"])} % 0

   \startitemize[width=5em]

   \item \samplefile{knuth}

   \ctxlua{context(tex.dimen["textwidth"])} % 37213340

   \ctxlua{context(tex.dimen["localhsize"])} % 33283340

   \stopitemize
   
   \stoptext

The following part in the script must be adapted to the local horizontal size, 
I guess: 

if chars >= max_length or width > tex.hsize then

However, tex.localhsize (or tex.dimen["localhsize"]) is 0 when the document is 
initialized. (Maybe a more sensible default would be textwidth rather than 0?)

So, I added:

local localhsize = tex.dimen["textwidth"]
   
if tex.dimen["localhsize"] > 0 then
localhsize = tex.dimen["localhsize"]
end

if chars >= max_length or width > localhsize then

Maybe someone finds this useful in the future.

(2) I'm (now?) running into trouble with hyphenation. With the example above, I 
get

"
The separation of any of these four components would have hurt TEX 
significantly. If I had not partic­-
i-
pated fully in all these activities, literally hundreds of improvements would 
never have been made,
"

In my own document, I also get lines with only a single character or hboxed 
group. I assume, this is because the hyphen is not counted and pushes the 
remainder to a new line where the intended breakpoint again starts another one.

Unfortunately, I don't know what to change; I know a bit about "glyph" and 
"glue", but what is "disc" and would it help here?

Thank you!


Benjamin


> On Jun 25, 2022, at 11:38, Benjamin Buchmuller 
>  wrote:
> 
> Wow, that works like a charm! Thank you, Max! 
> 
> It's also a very insightful example of how to use and inject Lua code in the 
> TeX output routine. Do you mind if I add it to the wiki? (Probably under 
> "Wrapping".)
> 
> Many thanks again!
> 
> 
> Benjamin
> 
>> On Jun 24, 2022, at 01:44, Max Chernoff  wrote:
>> 
>>> I've been confronted with the following 'intriguing' formatting requirement 
>>> for a document:
>> 
>> "Intriguing" is definitely right here. I suspect these guidelines were made 
>> for typewriters and haven't been updated since.
>> 
>>> to limit the number of glyphs per line to 112. 
>> 
>> 112 characters per line sounds much too long anyways.
>> 
>> From "The Elements of Typographic Style":
>>> Anything from 45 to 75 characters is widely regarded as a satisfactory
>>> length of line for a single-column page set in a serifed text face
>>> in a text size. The 66-character line (counting both letters and
>>> spaces) is widely regarded as ideal. For multiple-column work, a
>>> better average is 40 to 50 characters.
>>> 
>>> If the type is well set and printed, lines of 85 or 90 characters
>>> will pose no problem in discontinuous texts, such as bibliographies,
>>> or, with generous leading, in footnotes. But even with generous
>>> leading, a line that averages more than 75 or so characters is likely
>>> to be too long for continuous reading.
>> 
>> If you use something like
>> 
>>   \setuplayout[width=80\averagecharwidth]
>> 
>> then your lines will for sure have fewer than 112 characters and will 
>> probably be more readable too.
>> 
>>> I'm nevertheless curious if there is a Lua/TeX solution to this "problem"?
>> 
>> Option 1: Use a monospaced font. Then 112 characters per line <=> page width 
>> = 112em.
>> 
>> Option 2: A hacky Lua solution
>> 
>>   \startluacode
>>   local max_length = 112
>> 
>>   local glyph_id = node.id "glyph"
>>   local disc_id = node.id "disc"
>>   local glue_id = node.id "glue"
>> 
>>   function userdata.limiter(head)
>>   language.hyphenate(head)
>> 
>>   local chars = 0
>>   local width = 0
>>   local n = head
>>   while n do
>>   if n.id == glyph_id or n.id == glue_id then
>>   chars = chars + 1
>&g

Re: [NTG-context] Count (and limit) glyphs per line?

2022-06-25 Thread Benjamin Buchmuller via ntg-context
Wow, that works like a charm! Thank you, Max! 

It's also a very insightful example of how to use and inject Lua code in the 
TeX output routine. Do you mind if I add it to the wiki? (Probably under 
"Wrapping".)

Many thanks again!


Benjamin

> On Jun 24, 2022, at 01:44, Max Chernoff  wrote:
> 
>> I've been confronted with the following 'intriguing' formatting requirement 
>> for a document:
> 
> "Intriguing" is definitely right here. I suspect these guidelines were made 
> for typewriters and haven't been updated since.
> 
>> to limit the number of glyphs per line to 112. 
> 
> 112 characters per line sounds much too long anyways.
> 
> From "The Elements of Typographic Style":
> > Anything from 45 to 75 characters is widely regarded as a satisfactory
> > length of line for a single-column page set in a serifed text face
> > in a text size. The 66-character line (counting both letters and
> > spaces) is widely regarded as ideal. For multiple-column work, a
> > better average is 40 to 50 characters.
> >
> > If the type is well set and printed, lines of 85 or 90 characters
> > will pose no problem in discontinuous texts, such as bibliographies,
> > or, with generous leading, in footnotes. But even with generous
> > leading, a line that averages more than 75 or so characters is likely
> > to be too long for continuous reading.
> 
> If you use something like
> 
>\setuplayout[width=80\averagecharwidth]
> 
> then your lines will for sure have fewer than 112 characters and will 
> probably be more readable too.
> 
>> I'm nevertheless curious if there is a Lua/TeX solution to this "problem"?
> 
> Option 1: Use a monospaced font. Then 112 characters per line <=> page width 
> = 112em.
> 
> Option 2: A hacky Lua solution
> 
>\startluacode
>local max_length = 112
> 
>local glyph_id = node.id "glyph"
>local disc_id = node.id "disc"
>local glue_id = node.id "glue"
> 
>function userdata.limiter(head)
>language.hyphenate(head)
> 
>local chars = 0
>local width = 0
>local n = head
>while n do
>if n.id == glyph_id or n.id == glue_id then
>chars = chars + 1
>width = width + n.width - (n.shrink or 0)
>end
> 
>if chars >= max_length or width > tex.hsize then
>local back_chars = 0
>local end_disc = nil
> 
>while n do
>if n.id == glue_id then
>local penalty = node.new "penalty"
>penalty.penalty = -1
>node.insertbefore(head, n, penalty)
>break
>end
> 
>if not end_disc and n.id == disc_id then
>end_disc = n
>end
> 
>if end_disc and back_chars >= 5 then
>end_disc.penalty = -1
>break
>end
> 
>if n.id == glyph_id then
>back_chars = back_chars + 1
>end
> 
>n = n.prev
>end
> 
>width = 0
>chars = 0
>end
> 
>n = n.next
>end
> 
>return head
>end
> 
>nodes.tasks.appendaction(
>"processors",
>"before",
>"userdata.limiter"
>)
>\stopluacode
> 
>\setuppapersize[landscape,letter]
>\showframe
> 
>\starttext
>\setupalign[flushleft]
> 
>\setupbodyfont[14pt]
>\samplefile{knuth}
> 
>\setupbodyfont[12pt]
>\samplefile{knuth}
> 
>\setupbodyfont[10pt]
>\samplefile{knuth}
> 
>\page
>\setupalign[normal]
> 
>\setupbodyfont[14pt]
>\samplefile{knuth}
> 
>\setupbodyfont[12pt]
>\samplefile{knuth}
> 
>\setupbodyfont[10pt]
>\samplefile{knuth}
>\stoptext
> 
> This code will ensure that no line ever exceeds "max_length" characters. It 
> uses a greedy algorithm instead of the standard TeX algorithm for line 
> breaking, but it still produces mostly decent results.
> 
> -- Max

___
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] Count (and limit) glyphs per line?

2022-06-23 Thread Benjamin Buchmuller via ntg-context
Dear list,

I've been confronted with the following 'intriguing' formatting requirement for 
a document:

"
• Type density:  Must be no more than 15 characters per linear inch (including 
characters and spaces).
• Line spacing: Must be no more than six lines per vertical inch.
"

While the line spacing resolves in ConTeXt to

\setupinterlinespace[line=\dimexpr(1in / 6)]

I was wondering if one can limit "type density" as the number of glyphs per 
inch in TeX too? I thought, it is more convenient to rephrase this request (for 
a 7 in textwidth) to limit the number of glyphs per line to 112. (Font must be 
sans or serif, of course ...)

I've tried

\setuplayout[width=112\averagecharwidth] 

which, however, results in ~120–130 characters and spaces per line. 
Pragmatically, I'm narrowing the text width to empirically match the 
requirement, but I'm nevertheless curious if there is a Lua/TeX solution to 
this "problem"?

Thank you!


Benjamin 
___
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] How to make \def accept block or buffer as part of (long) command argument

2022-01-02 Thread Benjamin Buchmuller via ntg-context
Uff, this is indeed deep tex. Thanks a lot for the example, Hans! I still need 
to learn a lot.

After a walk and a bit of fresh air, I found another (much easier) way around 
my problem. This works since I don't need to deal with #2 in any special way:

\tolerant\def\startMyCommand[#1]%
{
\startallbeautifulcontextcommands
% whatever #1 does
}

\tolerant\def\stopMyCommand%
{
\stopallbeautifulcontextcommands
}

Then one can do in the main files:

\startMyCommand

\beginMyBuffer
bla bla
\endMyBuffer

\stopMycommand

> On Jan 2, 2022, at 14:43, Hans Hagen  wrote:
> 
> On 1/2/2022 2:14 PM, Benjamin Buchmuller wrote:
>> Thanks, Hans, for the answer, but I'm not sure if I get the point.
>> While this is possible in ConTeXt:
>> \startsection[title={My Title}]
>> \beginMyBlock
>> bla bla
>> \endMyBlock
>> \stopsection
>> The following won't work (end of file error):
>> \startMyCommand[optional={Maybe}]
>> \beginMyBlock
>> bla bla
>> \endMyBlock
>> \stopMyCommand
>> I had hoped for a simple command/modifier like 
>> \pleaseacceptblocks\def\startMyCommand[#1]#2\stopMyCommand to have #2 work 
>> in a similar way.
>> But maybe, as Wolfgang stated here 
>> (https://www.mail-archive.com/ntg-context@ntg.nl/msg73956.html), buffers and 
>> blocks can't be used in commands. (To add: Even when passed as arguments 
>> during compilation?)
> 
> You can bet that WS is right.
> 
> You really have to go dirty tex for this kind of magic:
> 
> \defineblock[MyBlock]
> \keepblocks[MyBlock]
> 
> \starttext
> 
> \tolerant\def\startMyCommand[#1]%
>  {\begingroup
>   \setcatcodetable\notcatcodes
>   \dostartMyCommand[#1]}
> 
> \let\stopMyCommand\relax
> 
> \normalexpanded{\def\noexpand\dostartMyCommand[#1]#2\expandtoken\notcatcodes92
>  stopMyCommand}%
>  {\endgroup
>   % whatever #1 does
>   \setbuffer[foo]#2\endbuffer
>   \typebuffer[foo]
>   \getbuffer[foo]}
> 
> or
> 
> \normalexpanded{\def\noexpand\dostartMyCommand[#1]#2\retokenized\notcatcodes 
> {\stopMyCommand}}%
>  {\endgroup
>   % whatever #1 does
>   \setbuffer[foo]#2\endbuffer
>   \typebuffer[foo]
>   \getbuffer[foo]}
> 
> \startMyCommand[optional={Maybe}]
> 
> \beginMyBlock
> bla bla
> \endMyBlock
> 
> \stopMyCommand
> 
> \stoptext
> 
> and then of course further nesting mess ...
> 
> 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] How to make \def accept block or buffer as part of (long) command argument

2022-01-02 Thread Benjamin Buchmuller via ntg-context
Thanks, Hans, for the answer, but I'm not sure if I get the point.

While this is possible in ConTeXt:

\startsection[title={My Title}]

\beginMyBlock
bla bla
\endMyBlock

\stopsection

The following won't work (end of file error):

\startMyCommand[optional={Maybe}]

\beginMyBlock
bla bla
\endMyBlock

\stopMyCommand

I had hoped for a simple command/modifier like 
\pleaseacceptblocks\def\startMyCommand[#1]#2\stopMyCommand  to have #2 work in 
a similar way. 

But maybe, as Wolfgang stated here 
(https://www.mail-archive.com/ntg-context@ntg.nl/msg73956.html), buffers and 
blocks can't be used in commands. (To add: Even when passed as arguments during 
compilation?)

Many Thanks again!


Benjamin

> On Jan 2, 2022, at 12:19, Hans Hagen  wrote:
> 
> On 1/2/2022 11:47 AM, Benjamin Buchmuller via ntg-context wrote:
>> Hi list,
>> I'm playing around with blocks and buffers again, realizing that I cannot 
>> use them inbetween a \start...\stop that I defined myself. Apparently, they 
>> work between \startsection...\stopsection and the like, so I was wondering 
>> how I should define or expand #2 in the MWE below to make TeX happily accept 
>> these useful features?
> buffers are stored as-is so no catcode magic stored, contrary to macros
> 
> you can use \setbuffer but that doesn't solve the argument passing
> 
> however, you can nest buffers so you can make other \start\stop commands 
> buffers too and then do some at the start and (look for \defiebuffer) but it 
> quickly becomes messy i think
> 
> 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] How to make \def accept block or buffer as part of (long) command argument

2022-01-02 Thread Benjamin Buchmuller via ntg-context
Hi list,

I'm playing around with blocks and buffers again, realizing that I cannot use 
them inbetween a \start...\stop that I defined myself. Apparently, they work 
between \startsection...\stopsection and the like, so I was wondering how I 
should define or expand #2 in the MWE below to make TeX happily accept these 
useful features?

Thanks a lot


Benjamin


\starttext

\let\stopMyCommand\relax

\tolerant\protected\def\startMyCommand[#1]#2\stopMyCommand{

Optional argument #1

Content #2

}

\bf Here we test the command: Works \tf

\startMyCommand[is optional]
gets processed!
\stopMyCommand

\bf Here we test the block: Works \tf

\defineblock[MyBlock]

\beginMyBlock
Block for something else.
\endMyBlock

\useblocks[MyBlock][criterium=text]

\bf Here we test the block inside command: Fails \tf

% UNCOMMENT BELOW FAILS: tex error > runaway error: end of file encountered
%
% \startMyCommand[is optional]
% Still?
%
% \beginMyBlock
% Block for something else.
% \endMyBlock
% \stopMyCommand

\definebuffer[MyBuffer]

\bf Here we test the buffer: Works \tf

\startbuffer[MyBuffer]
Buffer for something else.
\stopbuffer

\getbuffer[MyBuffer]

\bf Here we test the buffer inside command: Fails \tf

% UNCOMMENT BELOW FAILS: tex error > runaway error: end of file encountered
%
% \startMyCommand[is optional]
% Still?
%
% \startbuffer[MyBuffer]
% Buffer for something else.
% \endbuffer
% \stopMyCommand

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


[NTG-context] Dangerous bends symbol in manfnt.afm accidentally chopped by LMTX?

2022-01-02 Thread Benjamin Buchmuller via ntg-context
Hi list,

using this example from the wiki, the dbend symbol appears cropped on the left 
side on my machine (ConTeXt  ver: 2021.12.10 11:41 LMTX  fmt: 2021.12.14), but 
not on the ConTeXt live server? Any possible reasons?

\definefontsynonym [bends] [file:manfnt.afm]

\startsymbolset [Dangerous Bends]
\definesymbol [dbend]   [\resolvedglyphdirect{bends}{n:char_7e}]
\definesymbol [lhdbend] [\resolvedglyphdirect{bends}{n:char_7f}]
\stopsymbolset

\setupsymbolset [Dangerous Bends]

\starttext
\symbol{dbend}\quad \symbol{lhdbend}
\stoptext

Thanks


Benjamin
___
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 \head inside \itemize

2021-12-23 Thread Benjamin Buchmuller via ntg-context
Thanks, Wolfgang, perfectly works! I added an example to the Wiki.

> On Dec 21, 2021, at 18:03, Wolfgang Schuster 
>  wrote:
> 
> Benjamin Buchmuller via ntg-context schrieb am 21.12.2021 um 14:04:
>> Not sure if this is the behavior to expect, but I would like to get 
>> formatted inline headers in itemize like:
> 
> The syntax for \starthead is
> 
> \starthead {...} ... \stophead
> 
> where the argument within the braces is mandatory.
> 
>> – Unformatted item.
>> – *Head One.* Something bla bla.
>> – *Head Two.* Other bla bla.
>> 
>> From:
>> 
>> \setupitemize[each][2, headintext]
>> % \setupitemize[each][headstyle={\groupedcommand{\bf}{.\space\tf}}]
>> \setupitemize[each][headcolor=red, headstyle=bold]
>> 
>> \startitemize
>> \item Unformatted item.
>> \head Head One \par Something bla bla.
>> \starthead Head Two \stophead Other bla bla. % Even worse: No inline any 
>> more.
>> \stopitemize
>> 
>> However, headstyle= and headcolor= seem to spill all over … Is it a feature 
>> or a bug?
> 
> No bug, just a user error. When you put the head text in the argument of 
> \starthead everything works as expected.
> 
> \starttext
> 
> \startitemize[headintext][headstyle=bold]
> \startitem Unformatted item. \stopitem
> \starthead {Head One.} Something bla bla. \stophead
> \starthead {Head Two.} Other bla bla. \stophead
> \stopitemize
> 
> \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] Problem with \head inside \itemize

2021-12-21 Thread Benjamin Buchmuller via ntg-context
Not sure if this is the behavior to expect, but I would like to get formatted 
inline headers in itemize like:

– Unformatted item.
– *Head One.* Something bla bla.
– *Head Two.* Other bla bla.

From:

\setupitemize[each][2, headintext]
% \setupitemize[each][headstyle={\groupedcommand{\bf}{.\space\tf}}]
\setupitemize[each][headcolor=red, headstyle=bold]

\startitemize
\item Unformatted item.
\head Head One \par Something bla bla.
\starthead Head Two \stophead Other bla bla. % Even worse: No inline any more.
\stopitemize

However, headstyle= and headcolor= seem to spill all over … Is it a feature or 
a bug?

Thanks


Benjamin
___
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] Title for tabulate

2021-12-16 Thread Benjamin Buchmuller via ntg-context
Yes, this works! Thanks!

I'll try to add a section on the Wiki. Is there a reason why the second 
approach works while the other doesn't?

> On Dec 16, 2021, at 12:46, Hans Hagen  wrote:
> 
> On 12/16/2021 11:39 AM, Benjamin Buchmuller wrote:
>> Thanks again, Hans, for all the different approaches, very instructive!
>> However, after playing around a bit, I do have a question that I can't work 
>> out:
>> \getdummyparameters[headtitle=,#1]
>> \ifempty{\dummyparameter{headtitle}}
> can you try
> 
> \ifcstok{\dummyparameter{headtitle}}\emptytoks
> 
> instead
> 
> -
>  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] Title for tabulate

2021-12-16 Thread Benjamin Buchmuller via ntg-context
Thanks again, Hans, for all the different approaches, very instructive!

However, after playing around a bit, I do have a question that I can't work 
out: 

\getdummyparameters[headtitle=,#1]

\ifempty{\dummyparameter{headtitle}}

will never be true? See below in context:

> On Dec 14, 2021, at 19:16, Hans Hagen  wrote:
> 
> On 12/14/2021 6:16 PM, Benjamin Buchmuller via ntg-context wrote:
>> Hi!
>> I'd like to follow up on a problem that Denis came across recently with the 
>> titles argument in tabulate. (It's more a solution than a question, but any 
>> hints to improve the answer are welcome.) I wanted to use this argument for 
>> an easy specification of, well, a title for a "recipe". The advantage is 
>> that all information is held together and it's easy to use for people who 
>> are not (too) familiar with ConTeXt.
>> So, in one file I can define all styles (which the end-user would not need 
>> to see):
>> \definetabulate[recipe][|l|l|p|l|]
>> \setuptabulate
>>  [recipe]
>>  [
>>  bodyfont=small,
>>  distance=medium,
>>  before={\blank[back, small]},
>>  header=text,
>>  headstyle=\bi, % this formats the "\BC" cells
>>  headcolor=red, % this formats the "\BC" cells
>>  ]
>> \starttext
>> And then use:
>> \startrecipe[title={Whatever mixture 1}]
>> \FL
>> \NC Absolute \BC Stock \NC Ingredient \NC Final \NR
>> \HL
>> \NC 1 \NR
>> \LL
>> \stoprecipe
>> \startrecipe[title={Whatever mixture 2}]
>> \FL
>> \BC Absolute \BC Stock \BC Ingredient \BC Final \NR
>> \HL
>> \NC 1 \NR
>> \LL
>> \stoprecipe
>> \stoptext
>> etc.
>> However, I cannot change the way the title is styled (or spaced from the 
>> table) unless I do "title={\bi Some text.}". However, blank commands are 
>> also stripped off at this place. (I also don't get a clue from the source if 
>> there is any argument to spike-in some formatting.)
>> So, if there is no easy way to access this one, we can work around:
>> \definetabulate[recipetab][|l|l|p|l|]
>> \setuptabulate
>>  [recipetab]
>>  [
>>  bodyfont=small,
>>  distance=medium,
>>  before={\blank[back, small]},
>>  % header=text, % THIS MUST NOT BE "text"
>>  headstyle=bold,
>>  headcolor=red,
>>  ]
>> \define\startrecipe{\dodoubleempty\dostartrecipe}
>> \long\def\dostartrecipe[#1][#2]#3\stoprecipe{%
>>  \iffirstargument
>>  {\bi #1}\blank[medium]
>>  \fi
>>  \ifsecondargument
>>  \startrecipetab[#2]
>>  #3
>>  \stoprecipetab
>>  \else
>>  \startrecipetab
>>  #3
>>  \stoprecipetab
>>  \fi
>> }
>> \startrecipe[Head 1]
>> \FL
>> \BC Absolute \BC Stock \BC Ingredient \BC Final \NR
>> \HL
>> \NC 1 \NR
>> \LL
>> \stoprecipe
>> \startrecipe[Head 2][headcolor=blue] % pass on arguments to tabulate
>> \FL
>> \BC Absolute \BC Stock \BC Ingredient \BC Final \NR
>> \HL
>> \NC 1 \NR
>> \LL
>> \stoprecipe
>> Small question though: Is there a ConTeXt way to "\long\def" or a simple way 
>> ("user interface") to filter a list of arguments for a specific key=val 
>> pair, e.g. to make a single optional argument with headertitle={Some 
>> header.}?
> context has no (need for) \long ... all is long (i mever saw a reason for 
> using it)
> 
> (1) use a proper head:
> 
> \definehead[RecipeHead][subsubsubsubsubsubject]
> \setuphead [RecipeHead][style=bolditalic,after={\blank[medium]}]
> 
> \definetabulate[recipetab][|l|l|p|l|]
> 
> \setuptabulate
>  [recipetab]
>  [bodyfont=small,
>   distance=medium,
>   before={\blank[back, small]},
>   headstyle=bold,
>   headcolor=red]
> 
> here's a one-step lmtx solution:
> 
> \let\stoprecipe\relax
> 
> \tolerant\protected\def\startrecipe[#1]#*[#2]#3\stoprecipe
>  {\ifcstok{#1}\emptytoks\else
> \RecipeHead{#1}
>   \fi
>   \ifcstok{#2}\emptytoks
> \startrecipetab#3\stoprecipetab
>   \else
> \startrecipetab[#2]#3\stoprecipetab
>   \fi}
> 
> or just
> 
> \tolerant\protected\def\startrecipe[#1]#*[#2]#3\stoprecipe
>  {\ifempty{#1}\else
> \RecipeHead{#1}
>   \fi
>   \ifempty{#2}%
> \startrecipetab#3\stoprecipetab
>   \else
> \startrecipetab[#2]#3\stoprecipetab
>   \fi}
> 
> 
> and here's one that does what you ask (in the core i'd try to avoid grabbing

Re: [NTG-context] Title for tabulate

2021-12-14 Thread Benjamin Buchmuller via ntg-context
Hi!

I'd like to follow up on a problem that Denis came across recently with the 
titles argument in tabulate. (It's more a solution than a question, but any 
hints to improve the answer are welcome.) I wanted to use this argument for an 
easy specification of, well, a title for a "recipe". The advantage is that all 
information is held together and it's easy to use for people who are not (too) 
familiar with ConTeXt.

So, in one file I can define all styles (which the end-user would not need to 
see):

\definetabulate[recipe][|l|l|p|l|]

\setuptabulate
[recipe]
[
bodyfont=small,
distance=medium,
before={\blank[back, small]},
header=text,
headstyle=\bi, % this formats the "\BC" cells
headcolor=red, % this formats the "\BC" cells
]


\starttext

And then use:

\startrecipe[title={Whatever mixture 1}]
\FL 
\NC Absolute \BC Stock \NC Ingredient \NC Final \NR 
\HL
\NC 1 \NR
\LL
\stoprecipe

\startrecipe[title={Whatever mixture 2}]
\FL 
\BC Absolute \BC Stock \BC Ingredient \BC Final \NR 
\HL
\NC 1 \NR
\LL
\stoprecipe

\stoptext

etc.

However, I cannot change the way the title is styled (or spaced from the table) 
unless I do "title={\bi Some text.}". However, blank commands are also stripped 
off at this place. (I also don't get a clue from the source if there is any 
argument to spike-in some formatting.) 

So, if there is no easy way to access this one, we can work around:

\definetabulate[recipetab][|l|l|p|l|]

\setuptabulate
[recipetab]
[
bodyfont=small,
distance=medium,
before={\blank[back, small]},
% header=text, % THIS MUST NOT BE "text"
headstyle=bold,
headcolor=red,
]

\define\startrecipe{\dodoubleempty\dostartrecipe}

\long\def\dostartrecipe[#1][#2]#3\stoprecipe{%
\iffirstargument
{\bi #1}\blank[medium]
\fi
\ifsecondargument
\startrecipetab[#2]
#3
\stoprecipetab
\else
\startrecipetab
#3
\stoprecipetab
\fi
}

\startrecipe[Head 1]
\FL
\BC Absolute \BC Stock \BC Ingredient \BC Final \NR 
\HL
\NC 1 \NR
\LL
\stoprecipe

\startrecipe[Head 2][headcolor=blue] % pass on arguments to tabulate
\FL
\BC Absolute \BC Stock \BC Ingredient \BC Final \NR 
\HL
\NC 1 \NR
\LL
\stoprecipe

Small question though: Is there a ConTeXt way to "\long\def" or a simple way 
("user interface") to filter a list of arguments for a specific key=val pair, 
e.g. to make a single optional argument with headertitle={Some header.}?

Best


Benjamin

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

2021-10-24 Thread Benjamin Buchmuller via ntg-context
Maybe 

\hfill author

?

> On 24. Oct 2021, at 04:12, kauśika cittūr  wrote:
> 
> Dear list,
> 
> In short, my question is: why does \wordright cause a line-break when the 
> line 
> preceding it breaks with hyphenation and does not otherwise? How to avoid it 
> (if at all possible)?
> 
> I have this delimitedtext instance called 'amnata' defined as below:
> 
> \definemeasure[amnatamargin][3cm]
> \definedelimitedtext
>  [amnata]
> \setupdelimitedtext
>  [amnata]
>  [
>left=,
>right=,
>leftmargin={\measure{amnatamargin}},
>rightmargin={\measure{amnatamargin}},
>  ]
> 
> I am using this to quote paragraph(s) of other authors. 
> Since, I also want to indicate where the quote is from, I use this as follows:
> 
> \startamnata
>  ⋮
> \wordright{author}
> \stopamnata
> 
> so that the author's name appears at the right-edge of the block.
> 
> When the penultimate line inside the block breaks without hyphenation, then 
> argument of \wordright is typeset as expected (i.e. in the same line).
> 
> On the other hand, when the penultimate line inside this block breaks with 
> hyphenation, the argument of \wordright is pushed to the next line even when 
> there is enough space for it on the same line.
> 
> Here is a sample illustrating this:
> 
> \startamnata
> A quote from another author : Suppose that thereisalongwordhere.
> \wordright{– author}
> \stopamnata
> 
> \startamnata
> A quote from another author : Here, the text does not cause 
> hyphenation in the first line.
> \wordright{– author}
> \stopamnata
> 
> [I have attached the output here as an image] 
> 
> How do I ensure that this does not happen, if that is possible at all? I 
> suppose this is expected behaviour but I am not able to understand why.
> 
> Thanks,
> kauśika
> 
___
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] Gradient fill in embedded pdf disappear in externalfigure (on regular pages)

2021-08-30 Thread Benjamin Buchmuller via ntg-context
How odd; Then it must be related to my viewer here ...

I was just surprised to literally see two different outcomes with the 
\startTEXpage and without. Maybe it has to do with some sort of "nesting" in 
the PDF that is not handled correctly at the PDF viewer's end. I'll test again 
on a different machine (and with the printing company) when I'm back to work.

Thanks for having looked into it!

> On Aug 30, 2021, at 10:50, Hans Hagen  wrote:
> 
> attached is what i get and i see the green shading here
> 
> 
> 
> -
>  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] Gradient fill in embedded pdf disappear in externalfigure (on regular pages)

2021-08-30 Thread Benjamin Buchmuller via ntg-context
(For the record on the list, I attach a small res screenshot to illustrate the 
matter, description below; My apologies for any inconvenience.)

On Aug 30, 2021, at 09:36, Benjamin Buchmuller  
wrote:

Sorry, I've been probably a bit unclear. The file to look at is "test.pdf" 
(first and second page).

This is a screenshot of what I see (attached):

* in the embedded png (as reference for how the original pdf looks like) the 
gradients are (no surprise) visible. Green to read for the ellipse and in the 
rod using a white-to-gray gradient.

* in the embedded pdf (what I would like to do eventually) both gradients 
disappear.

However, when I use \startTEXpage ... \stopTEXpage around the \externalfigure, 
everything looks and prints fine.



> On Aug 30, 2021, at 08:54, Hans Hagen  wrote:
> 
> On 8/30/2021 7:03 AM, Benjamin Buchmuller via ntg-context wrote:
>> Hello list,
>> I have noticed that some gradients get lost when embedding an external 
>> figure from a pdf (Preview and Acrobat DC and in printer), although the 
>> original pdf works fine for me.
> 
> you have to be a bit more precise in desribing what you expect because i 
> don't see it ... there's a pdf and lowres png .. these are different anyway, 
> the low res png has some anti aliasing
> 
> 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] Gradient fill in embedded pdf disappear in externalfigure (on regular pages)

2021-08-29 Thread Benjamin Buchmuller via ntg-context
Hello list,

I have noticed that some gradients get lost when embedding an external figure 
from a pdf (Preview and Acrobat DC and in printer), although the original pdf 
works fine for me.

It seems to occur with color-to-color gradients (but not all), but not with 
color-to-alpha ones.

While preparing a MWE, I further realized that I get the correct output when 
between \startTEXpage ... \stopTEXpage

\starttext

Embedded via \type{\externalfigure}

PNG

\externalfigure[drawing.png][width=72.631mm,height=21.702mm]

\blank[big]

PDF

\externalfigure[drawing.pdf]

\startTEXpage  % this "works"
Embedded via \type{\externalfigure} in \type{\startTEXpage ... \stopTEXpage}

PNG

\externalfigure[drawing.png][width=72.631mm,height=21.702mm]

\blank[big]

PDF

\externalfigure[drawing.pdf]
\stopTEXpage

\stoptext

Any hints what I would need to change in order to get the gradients also in 
non-TEX-page mode?

I attach the two original files and the output produced with this MWE.

Thanks!


Benjamin



drawing.pdf
Description: Adobe PDF 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] lmtx update/t-vim (again)

2021-08-23 Thread Benjamin Buchmuller via ntg-context
This is the setup I have been using, but I'm unsure if the problem could be 
related to the other problem I had. (Not scaled to a MWE, but short enough.) I 
figured the issue by removing some of the lines.

\usemodule[vim]

\definetextbackground[codebkg]
[
frame=on, 
framecolor=black,
background=,
location=paragraph,
]

\definevimtyping[vimR]
[
syntax=r,
space=off,
lines=split,
numbering=yes,
numberstep=5,
alternative=pscolor,
margin=.5em,
style={\switchtobodyfont[type,small]\setupinterlinespace},
before={\blank[white,small]\startcodebkg},  % a bit of extra space 
after={\stopcodebkg},
directory=vimout/,  % note: you must create this folder yourself!
]

\starttext

\startvimR
#!/usr/bin/env R
included_aa <- list(
  `6d1t` = 2:81,
  `6cnq` = 146:225,
  `6ccg` = 2:81,
  `4lg7` = 76:167,
  `3c2i` = 90:181) %>% enframe() %>% unnest(cols = "value") %>% 
  rename(protein = "name", aa_pos = "value") %>%
  mutate(chain = "A") %>% mutate(include_aa = TRUE)
\stopvimR

\stoptext

So, the first "i", "n" etc. come from "include_aa" after I remove the shebang 
statement. 

The lines with "#" and "$" (in other pieces not shown) cause the complaints.

I also realized that I get output for each vim block, but instead of a 
"vimout", I get a "pdf" (error) and a "log" (some attached) now.

Also, the blocks get recompiled with each run even if their content doesn't 
change which was the previous behavior.




xxx-temp-vimR-0-error.log
Description: Binary data


xxx-temp-vimR-0.log
Description: Binary data


xxx-temp-vimR-1.log
Description: Binary data


> On Aug 23, 2021, at 08:19, Hans Hagen  wrote:
> 
> On 8/23/2021 12:10 AM, Benjamin Buchmuller via ntg-context wrote:
>> Hi,
>> Thanks for having had a look into the t-vim.
>> At least the document compiles fine (I get a PDF), although multiple 
>> complaints from the lua end when I use "$" or "#" in my source, for example
>> #!/usr/bin/bash
>> etc. culminating in
>> Sorry, but I'm not programmed to handle this case;
>> I'll just pretend that you didn''t ask for it.
>> If you're in the wrong mode, you might be able to
>> return to the right one by typing 'I}' or 'I$' or 'I\par'.
>> Seems as if LMTX tried to interpret something literally here …
>> Further, I get a lot of
>> fonts   > beware: no fonts are loaded yet, using 'lm mono' in box
>> fonts   > checking > char i (U+00069) in font '' with id 0: missing
>> fonts   > checking > char n (U+0006E) in font '' with id 0: missing
>> warnings. Maybe some things need to be adjusted?
> THis normally means that you have someting before the \starttext that gets 
> typeset (here the word "in")
> 
> 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] lmtx update

2021-08-22 Thread Benjamin Buchmuller via ntg-context
Hi,

Here is another thing which worked previously for me:

ConTeXt  ver: 2021.07.30 00:57 LMTX  fmt: 2021.8.8  int: english/english

Now:

ConTeXt  ver: 2021.08.22 11:54 LMTX  fmt: 2021.8.22  int: english/english

Error:

lua error:

registered function call [396]: 
...eXt/tex/texmf-context/tex/context/base/mkxl/anch-pos.lmt:1286: attempt to 
call a nil value (upvalue 'texgetparstate')
stack traceback:
...eXt/tex/texmf-context/tex/context/base/mkxl/anch-pos.lmt:1286: in 
function <...eXt/tex/texmf-context/tex/context/base/mkxl/anch-pos.lmt:1262>
(...tail calls...)  

129 \NC \unit{0.88 angstrom}
130 \NC \unit{2.02 angstrom}
131 \NC \unit{2.03 angstrom}
132 \NC \unit{1.90 angstrom}
133 \NC \unit{4.99 angstrom} % rmsd #1/a:14-61 & backbone to 
#5/a:103-150 & backbone
134 \NC \unit{1.88 angstrom}
135 \NC \unit{5.20 angstrom} % rmsd #1/a:46-55 & backbone to 
#5/a:135-144 & backbone
136 \NC \NR
137 \HL
138 \stoptabulate

The difficulty here is that when I copy the "faulty" part (my table) to another 
document (including all relevant defs etc.) it just works fine. So, I think it 
must have to do something with the placement of the float on the page. 

Any hints what has changed?

Thanks!


Benjamin

> On Aug 20, 2021, at 12:00, ntg-context-requ...@ntg.nl wrote:
> 
> lmtx update

___
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 update/t-vim (again)

2021-08-22 Thread Benjamin Buchmuller via ntg-context
Hi,

Thanks for having had a look into the t-vim. 

At least the document compiles fine (I get a PDF), although multiple complaints 
from the lua end when I use "$" or "#" in my source, for example 

#!/usr/bin/bash 

etc. culminating in

Sorry, but I'm not programmed to handle this case;
I'll just pretend that you didn''t ask for it.
If you're in the wrong mode, you might be able to
return to the right one by typing 'I}' or 'I$' or 'I\par'.

Seems as if LMTX tried to interpret something literally here …

Further, I get a lot of 

fonts   > beware: no fonts are loaded yet, using 'lm mono' in box
fonts   > checking > char i (U+00069) in font '' with id 0: missing
fonts   > checking > char n (U+0006E) in font '' with id 0: missing

warnings. Maybe some things need to be adjusted?

(Second mail with another error in LMTX follows.)

Cheers


Benjamin

> On Aug 20, 2021, at 12:00, ntg-context-requ...@ntg.nl wrote:
> 
> Hi,
> 
> Here are the highlights of todays update:
> 
> - somewhat more compact tuc files, not for all documents, but it can 
> accumulate; also less memory used then; i could bring down an extreme 2000 
> page 5 column doc tuc file down to 5% -- it was 70 MB; for the luametatex 
> manual it reducec the tuc more than 30%; hard to tell if there will be an 
> associated performance hit, but i'm sure thomas will complain if that's the 
> case
> 
> - more mp-tex-lua interfacing upgraded plus extra preliminary chapter for 
> luametafun about extensions - for taco
> 
> - a slightly more compact cache files for fonts with many (pseudo) ligatures; 
> hopefully no side effects (nothing that can't be fixed fast if noted); quite 
> probably no performance hit and maybe even some room for optimization (not 
> done yet)
> 
> - a split in the cache directory for luametatex so that we can more easilly 
> experiment without interference (so, although the above works in mkiv it's 
> not enabled there currently)
> 
> - some minor things (also in the process of splitting the codebase)
> 
> - no real changes in / additions to the luametatex binary (we're in cosmetics 
> mode now)
> 
> 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] new upload/issue with t-vim?

2021-08-08 Thread Benjamin Buchmuller via ntg-context
I'm not sure if it's related to this latest:

ConTeXt  ver: 2021.08.07 22:53 LMTX  fmt: 2021.8.8  int: english/english

or a previous one, but with this one:

ConTeXt  ver: 2021.07.30 00:57 LMTX  fmt: 2021.8.8  int: english/english

My document compiled fine.

When I use the t-vim module (freshly installed again from the garden; but I 
also tried to replace some files from the GitHub, but not sure if I did it 
right …), I now get an error when I do something like

\usemodule[vim]

\definevimtyping[vimR]

\typevimRfile{path_to_file.R} % specifically: {../sourcecodes/myfile.R}

--

lua error > lua error on line 2 in file virtual://block.sourcecode.7:

token call, execute: 
...ConTeXt/tex/texmf-context/tex/context/base/mkiv/l-io.lua:70: bad argument #1 
to '?' (string expected, got nil)
stack traceback:
[C]: in ?
(...tail calls...)
...ConTeXt/tex/texmf-context/tex/context/base/mkiv/l-io.lua:70: in 
function 'io.loaddata'
...onTeXt/tex/texmf-context/tex/context/base/mkiv/l-md5.lua:91: in 
upvalue 'checksum'
...eXt/tex/texmf-context/tex/context/base/mkiv/grph-fil.lua:97: in 
field 'run'
[ctxlua]:1: in main chunk


--

Any clues? For the moment, I switched back to the older version as I have to 
get some work finished, which is why I can't dig deeper at the moment. If a MWE 
would help, I'll try to make one later this week.

Thanks


Benjamin
___
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] How to check if buffer or block has content

2021-08-03 Thread Benjamin Buchmuller via ntg-context
Wow, that's powerful!

I'll add the wiki entries later tonight. 

Thanks a lot!

> On Aug 3, 2021, at 17:02, Hans Hagen  wrote:
> 
> On 8/2/2021 8:54 PM, Benjamin Buchmuller via ntg-context wrote:
>> That's great, I wikified a Note for testing if a buffer exists or has 
>> content (using the \getbuffer[…] approach for the moment).
>> If I was asked, I'd opt for \doifelseemptybuffer (doifemptyelse?) since one 
>> could think of similar commands that test for empty "objects".
>> Is there an option for testing blocks? (I actually use blocks quite 
>> frequently …)
>> I just realized they are probably handled very differently during the 
>> typesetting. Basically I would just need to test if during the first run any 
>> of \beginBLOCK … \endBLOCK was invoked (but if one gets a test for some 
>> content in-between that's even better).
>> As an alternative solution, is there a way to add content to buffers? 
>> Unfortunately, I can't use \getbuffer[first,second], but 
>> \startbuffer[first][add=yes] … \stopbuffer would be nice.
> just for fun I made this:
> 
> \starttext
> 
> \startbuffer[test]
>test
> \stopbuffer
> 
> \startbuffer[oeps]
>oeps
> \stopbuffer
> 
> \typebuffer[test] \getbuffer[test]
> 
> \startbuffer[test = * + test]
>prepend
> \stopbuffer
> 
> \typebuffer[test] \getbuffer[test]
> 
> \startbuffer[test = test + *]
>append
> \stopbuffer
> 
> \typebuffer[test] \getbuffer[test]
> 
> \startbuffer[test = * +++ test]
>before
> \stopbuffer
> 
> \typebuffer[test] \getbuffer[test]
> 
> \startbuffer[test = test +++ *]
>after
> \stopbuffer
> 
> \typebuffer[test] \getbuffer[test]
> 
> \startbuffer[test = * + oeps + test + oeps + * ]
>DONE
> \stopbuffer
> 
> \typebuffer[test] \getbuffer[test]
> 
> \stoptext
> 
> which results in
> 
> test
> test
> prependtest
> prependtest
> prependtestappend
> prependtestappend
> before
> prependtestappend
> before
> prependtestappend
> before
> prependtestappend
> after
> before
> prependtestappend
> after
> DONEoepsbefore
> prependtestappend
> afteroepsDONE
> DONEoepsbefore
> prependtestappend
> afteroepsDONE
> 
> so basically one can combine buffers any way
> 
> +   : nothing in between
> ++  : space in between
> +++ : empty line in between
> 
> 
> -
>  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] How to check if buffer or block has content

2021-08-02 Thread Benjamin Buchmuller via ntg-context
That's great, I wikified a Note for testing if a buffer exists or has content 
(using the \getbuffer[…] approach for the moment). 

If I was asked, I'd opt for \doifelseemptybuffer (doifemptyelse?) since one 
could think of similar commands that test for empty "objects".

Is there an option for testing blocks? (I actually use blocks quite frequently 
…) 

I just realized they are probably handled very differently during the 
typesetting. Basically I would just need to test if during the first run any of 
\beginBLOCK … \endBLOCK was invoked (but if one gets a test for some content 
in-between that's even better).

As an alternative solution, is there a way to add content to buffers? 
Unfortunately, I can't use \getbuffer[first,second], but 
\startbuffer[first][add=yes] … \stopbuffer would be nice.

Thanks!


Benjamin

> On Aug 2, 2021, at 17:17, ntg-context-requ...@ntg.nl wrote:
> 
> \starttext
> 
> \startbuffer[test]
> test
> \stopbuffer
> 
> \doifelsebuffer{test} {YES} {NOP}
> 
> \permanent\protected\def\doifelsebuffercontent#1%
>  {\doifelse{\luaexpr{(string.strip(buffers.getcontent("#1")) ~= "" and 
> "yes")}}{yes}}
> 
> \startbuffer[test]
> \stopbuffer
> 
> \doifelsebuffercontent{test} {YES} {NOP}
> 
> \startbuffer[test]
> 
> \stopbuffer
> 
> \doifelsebuffercontent{test} {YES} {NOP}
> 
> \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
___


[NTG-context] How to check if buffer or block has content

2021-08-02 Thread Benjamin Buchmuller via ntg-context
Hi,

How can I check if a buffer or block has content (or is empty) before a 
\useblocks or \getbuffer statement?

I would like to typeset a headline only if the buffer/block has been used in a 
particular section and want to avoid headlines with empty sections.

Thanks!


Benjamin
___
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] Getting the local float reference within a float and reuse (?) it later (\somelocalfloat?)

2021-07-22 Thread Benjamin Buchmuller
Hi, 

Is there a more convenient way to get the current reference label (stably) from 
within a float? For example, I would like to make an "image credits" section at 
the end of a document, so I do something similar to:

\defineblock[credits]

\starttext

\section[sec:topic]{Topic}

\startplacefigure
[
title={Awesome figure. Image credits in \about[sec:credits].},
reference=fig:awesome,
]

\begincredits
\in{Figure}[fig:awesome] in \in{Section}[sec:topic] was not created by me.
\endcredits
\stopplacefigure

\section[sec:credits]{Appendix}

\useblocks[credits]

\stoptext

The block mechanism comes in really handy here, especially since I have more to 
show at the end than just the credits. However, each time I add another figure, 
I have to replace the references appropriately. So, I was wondering how about 
exploiting some pointers:

\begincredits
\somelocalfloat[figure][current] in Section \someheadnumber[section][current] 
was not created by me.
\endcredits
\processblocks[credits] % expected \someheadnumber to evaluate to 1?
\stopplacefigure

Yet, even if asked to be processed within the first section, \someheadnumber 
evaluates at the end to "2" (should be "1" in my opinion)? This is independent 
of calling it from within the float or the main text. I guess, my understanding 
of "processblocks" is wrong in this respect.

% \begincredits
% This is the call from the text \someheadnumber[section][current]
% \endcredits
%
% \processblocks[credits]

Further, \somelocalfloat doesn't show anything. What does it do?

Two probably not really urgent questions as I can live with putting the 
explicit names, but maybe there is an even better approach that comes in handy 
in more circumstances.

Thanks in advance!


Benjamin
___
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] Extract bib entries used in a document

2021-07-15 Thread Benjamin Buchmuller
I was wondering if there is a way to get the internal bibliography manager to 
write out a .bib (or XML or Lua table) containing only the entries used in a 
document? 

Somewhat similar to BibTeX 
(https://tex.stackexchange.com/questions/41821/creating-bib-file-containing-only-the-cited-references-of-a-bigger-bib-file).

I guess it must be internally created, but I don't see, at least from the 
manual, a command like 
\exportbtxdataset[default][way=bytext][used_references.bib].

Two use cases:

(1) Sharing a clean bib file with someone.

(2) Merging bib files from different sources based on the document. (Or even by 
chapter.)

Thanks for your reply.


Benjamin


___
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] Use \unit for value and uncertainty

2020-05-09 Thread Benjamin Buchmuller
I know this is quite an old thread, but here is a minimal parser (\units with 
an “s”) that wraps around \digits and \unit to produce an acceptable output. 

As I frequently need to write ranges (or measures of uncertainty), I find it 
convenient to able to type

\units{4.0 to 5.0 centi meter} 

than 

\digits{4.0}\,to\,\unit{5.0 centi meter}.

Also, the parser will take care of exponents and bracket them accordingly. :D

ranges: keyword “to”: 4.0 – 5.0 cm
SEM:keyword “se”: 4.5 ± 0.5 cm
SD: keyword “sd”: 4.5 (0.5) cm

If no keyword is present, the default behaviour is \unit{…}.

The code is not perfect (and the level of abstraction potentially not yet 
sufficient to make it part of the phys-dim.mkiv source), but maybe helpful.

\starttext

\startluacode
userdata = userdata or {}

function userdata.units(input)

tbl = string.explode(input)

if tbl[2] == "to" then
context.digits(tbl[1])
context.phys_units_space()
context("--")
context.phys_units_space()
context.unit(table.concat(tbl, " ", 3))
elseif tbl[2] == "se" then
local sx1 = string.split(tbl[1], "e")
local sx2 = string.split(tbl[3], "e")
if (sx1[2] == sx2[2]) and not (sx1[2] == nil) then
context("(")
context.digits(sx1[1])
context.phys_units_space()
context("±")
context.phys_units_space()
context.digits(sx2[1])
context(")")
context.digits("e" .. sx1[2])
context.phys_units_space()
context.unit(table.concat(tbl, " ", 4))
else
context.digits(tbl[1])
context.phys_units_space()
context("±")
context.phys_units_space()
context.unit(table.concat(tbl, " ", 3))
end
elseif tbl[2] == "sd" then
local sx1 = string.split(tbl[1], "e")
local sx2 = string.split(tbl[3], "e")
if (sx1[2] == sx2[2]) and not (sx1[2] == nil) then
context.digits(sx1[1])
context.phys_units_space()
context("(")
context.digits(sx2[1])
context(")")
context.digits("e" .. sx1[2])
context.phys_units_space()
context.unit(table.concat(tbl, " ", 4))
else
context.digits(tbl[1])
context.phys_units_space()
context("(")
context.digits(tbl[3])
context(")")
context.unit(table.concat(tbl, " ", 4))
end
else
context.unit(table.concat(tbl, " "))
end

end
\stopluacode

\def\units#1{\ctxlua{userdata.units("#1")}}

Car 1 drives \units{4 to 5.2 kilo meter per hour}.

Car 2 drives \units{30.1 to 40.5 kilo meter per hour}.

Car 3 drives \units{40.= to 50.= kilo meter per hour}.

The average speed was \units{35,000 se 5000 meter per hour}.

The average speed was \units{35e3 se 0.5e3 meter per hour}.

The average speed was \units{35.2e3 se 5e2 meter per hour}.

\stoptext

The average speed was \units{35.2 se 5e2 meter per hour}.

The average speed was \units{_3.2 sd 5 meter per hour}.
___
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] mkiv digits/units zero padding not working

2020-05-07 Thread Benjamin Buchmuller
Following up on the work-around, here is my improved code for xtable.

What doesn’t work is:

* alignment on the decimal separator takes place only in the first column with 
decimals (i.e. B), not on the  following one; this is independent of R1 having 
a decimal value in this column or not

* row spanning is now tricky since the width of the header column is taken for 
the first of the three rows spanned, which becomes even more complicated with 
option=stretch, I guess if I right align the second column and would phantomize 
the hsize of the header, this could work with a bit of optimization.

What I like about this approach however is that one could read the two 
arguments from a CSV file, which would save a lot of typing (and to manually 
specify the padding).

\def\mpm#1#2{
\doifsomethingelse{#2}{
\startxcell[align=left] \digits{#1} \stopxcell
\startxcell ± \stopxcell
\startxcell \digits{#2} \stopxcell
}{
\startxcell[align=left] \digits{#1} \stopxcell
\startxcell \stopxcell
\startxcell \digits{#2} \stopxcell
}
}

\startxtable[split=repeat, aligncharacter=yes, alignmentcharacter={.}]

\startxtablehead
\startxrow[topframe=on, foregroundstyle=bold]
\startxcell A \stopxcell
\startxcell[align=left, nx=3] Bla bla bla bla bla bla bla bla 
\stopxcell
\startxcell C \stopxcell
\stopxrow
\stopxtablehead

\startxtablebody
\startxrow[topframe=on]
\startxcell R1 \stopxcell
\mpm{12.3}{}%{1.5}
\startxcell one \stopxcell
\stopxrow

\startxrow
\startxcell R2 \stopxcell
\mpm{0.01}{0.023}
\startxcell two \stopxcell
\stopxrow

\startxrow
\startxcell R3 \stopxcell
\mpm{2.3}{0.1}
\startxcell three\stopxcell
\stopxrow

\stopxtablebody

\stopxtable 

> On 7 May 2020, at 21:22, Benjamin Buchmuller  
> wrote:
> 
> Hi Wolfgang,
> 
> you are (of course) right again. I realised that I wouldn’t get the expected 
> behaviour after checking the snippet isolated from my document’s context, 
> where it is embedded in a \startplacetable[…]{}{}. I’m still learning to get 
> the gist of the \doifs, the curly and square bracketed arguments and so on. 
> Thanks for the hint! 
> 
> Seems like I’m going to make three cells and span the header column for now, 
> though I guess it would be a nice feature to have the padding working in the 
> other cases.
> 
> I’ll write a feature request for no 4.
> 
> Thanks!
> 
> 
>> On 7 May 2020, at 20:00, Wolfgang Schuster 
>>  wrote:
>> 
>> Benjamin Buchmuller schrieb am 07.05.2020 um 19:41:
>>> Hi Wolfang,
>>> Thank you for your reply. I have indeed not explained my intended result 
>>> very clearly.
>>> 1.
>>> Primarily, I need to get the two values aligned at the digit separator of 
>>> the first and second number respectively and overall at the ± sign. I’m 
>>> working in an xtable, where I have entries such as
>>> \startxcell \mpm{14.0==}{_1.5==} \stopxcell
>>> \startxcell \mpm{_0.034}{_0.013} \stopxcell
>>> and defined
>>> \def\mpm#1#2{
>>> \ifsecondargument
>>> \digits{#1}\,±\,\digits{#2}%
>>> \else
>>> \digits{#1}%
>>> \fi
>>> }
>> 
>> Is there something missing in here because the \ifsecondargument check here 
>> makes non sense because the second argument is mandatory and not optional.
>> 
>> Is this what you want?
>> 
>> \define[2]\mpm
>> {\digits{#1}%
>>  \doifsomething{#2}{\,±\,\digits{#2}}}
>> 
>>> Since I was hoping that I could exploit the zeropadding of \digits to get 
>>> the format right. Indeed, it would save a lot of typing, if I wouldn’t have 
>>> to specify the padding manually and I vaguely recall that there is 
>>> somewhere a ConTeXt solution that can make such alignments, but I simply 
>>> can’t find it any more …
>> 
>> You can align number on the decimal point (comma) but this works only when 
>> you have only one number in a cell.
>> 
>> \starttext
>> 
>> \startxtable[aligncharacter=yes,alignmentcharacter=±]
>>   \startxrow
>>   \startxcell
>>   \digits {14.0} ± \digits {1.5}
>>   \stopxcell
>>   \stopxrow
>>   \startxrow
>>   \startxcell
>>   \digits {0.034} ± \digits {0.013}
>>   \stopxcell
>>   \stopxrow
&

[NTG-context] mkiv \digits{2.0=} zero padding feature request

2020-05-07 Thread Benjamin Buchmuller
Hi,


As Wolfgang has figured out, zero padding in \digits only works for trailing 
(and omitted) zeroes when immediately preceded by the decimal separator.

It would be nice if this would work even if there is a number preceding, so that

\digits{3.1=}x\crlf
\digits{3.==}x\crlf
\digits{3.14}x

would align at the decimal separator when right aligned. This is useful in some 
circumstances, where the number of significant digits varies between sources, 
so that one needs to typset for example 

\digits{3.1=}±\digits{0.5}\crlf
\digits{3.28}±\digits{0.12}


Thanks!


Benjamin
___
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] mkiv digits/units zero padding not working

2020-05-07 Thread Benjamin Buchmuller
Hi Wolfgang,

you are (of course) right again. I realised that I wouldn’t get the expected 
behaviour after checking the snippet isolated from my document’s context, where 
it is embedded in a \startplacetable[…]{}{}. I’m still learning to get the gist 
of the \doifs, the curly and square bracketed arguments and so on. Thanks for 
the hint! 

Seems like I’m going to make three cells and span the header column for now, 
though I guess it would be a nice feature to have the padding working in the 
other cases.

I’ll write a feature request for no 4.

Thanks!


> On 7 May 2020, at 20:00, Wolfgang Schuster 
>  wrote:
> 
> Benjamin Buchmuller schrieb am 07.05.2020 um 19:41:
>> Hi Wolfang,
>> Thank you for your reply. I have indeed not explained my intended result 
>> very clearly.
>> 1.
>> Primarily, I need to get the two values aligned at the digit separator of 
>> the first and second number respectively and overall at the ± sign. I’m 
>> working in an xtable, where I have entries such as
>> \startxcell \mpm{14.0==}{_1.5==} \stopxcell
>> \startxcell \mpm{_0.034}{_0.013} \stopxcell
>> and defined
>> \def\mpm#1#2{
>>  \ifsecondargument
>>  \digits{#1}\,±\,\digits{#2}%
>>  \else
>>  \digits{#1}%
>>  \fi
>> }
> 
> Is there something missing in here because the \ifsecondargument check here 
> makes non sense because the second argument is mandatory and not optional.
> 
> Is this what you want?
> 
> \define[2]\mpm
>  {\digits{#1}%
>   \doifsomething{#2}{\,±\,\digits{#2}}}
> 
>> Since I was hoping that I could exploit the zeropadding of \digits to get 
>> the format right. Indeed, it would save a lot of typing, if I wouldn’t have 
>> to specify the padding manually and I vaguely recall that there is somewhere 
>> a ConTeXt solution that can make such alignments, but I simply can’t find it 
>> any more …
> 
> You can align number on the decimal point (comma) but this works only when 
> you have only one number in a cell.
> 
> \starttext
> 
> \startxtable[aligncharacter=yes,alignmentcharacter=±]
>\startxrow
>\startxcell
>\digits {14.0} ± \digits {1.5}
>\stopxcell
>\stopxrow
>\startxrow
>\startxcell
>\digits {0.034} ± \digits {0.013}
>\stopxcell
>\stopxrow
> \stopxtable
> 
> \stoptext
> 
>> 2. + 3.
>> Absolutely right, this is my bad. I have badly mixed from Hans’ solution to 
>> a similar problem,
>> https://www.mail-archive.com/ntg-context@ntg.nl/msg00724.html
>> which was actually \def\zeroamount{-} and the example in the source, I 
>> didn’t read properly. Just skip that part. :)
> 
> The message is from 2003!
> 
>> 4.
>> Indeed,
>> \startxcell \mpm{14.==}{_1.5=} \stopxcell
>> \startxcell \mpm{_0.03}{_0.01} \stopxcell
>> aligns properly. But sometimes, I have the first digit specified, but not 
>> the second and unfortunately this doesn’t work
>> \startxcell \mpm{14.5=}{_1.5=} \stopxcell
>> \startxcell \mpm{_0.03}{_0.01} \stopxcell
>> because = is not immediately preceded by .
> 
> Can you write another mail with a request for this.
> 
> 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] mkiv digits/units zero padding not working

2020-05-07 Thread Benjamin Buchmuller
Hi Wolfang,

Thank you for your reply. I have indeed not explained my intended result very 
clearly. 

1. 

Primarily, I need to get the two values aligned at the digit separator of the 
first and second number respectively and overall at the ± sign. I’m working in 
an xtable, where I have entries such as

\startxcell \mpm{14.0==}{_1.5==} \stopxcell
\startxcell \mpm{_0.034}{_0.013} \stopxcell

and defined 

\def\mpm#1#2{
\ifsecondargument
\digits{#1}\,±\,\digits{#2}%
\else
\digits{#1}%
\fi
}

Since I was hoping that I could exploit the zeropadding of \digits to get the 
format right. Indeed, it would save a lot of typing, if I wouldn’t have to 
specify the padding manually and I vaguely recall that there is somewhere a 
ConTeXt solution that can make such alignments, but I simply can’t find it any 
more …

2. + 3.

Absolutely right, this is my bad. I have badly mixed from Hans’ solution to a 
similar problem, 

https://www.mail-archive.com/ntg-context@ntg.nl/msg00724.html

which was actually \def\zeroamount{-} and the example in the source, I didn’t 
read properly. Just skip that part. :)

4. 

Indeed, 

\startxcell \mpm{14.==}{_1.5=} \stopxcell
\startxcell \mpm{_0.03}{_0.01} \stopxcell

aligns properly. But sometimes, I have the first digit specified, but not the 
second and unfortunately this doesn’t work

\startxcell \mpm{14.5=}{_1.5=} \stopxcell
\startxcell \mpm{_0.03}{_0.01} \stopxcell

because = is not immediately preceded by .



> On 7 May 2020, at 18:21, Wolfgang Schuster 
>  wrote:
> 
> Benjamin Buchmuller schrieb am 07.05.2020 um 17:31:
>> Hi,
>> I’m trying to get
>> \digits{15.0=}±\digits{1.00}
>> \digits{_8.12}±\digits{0.34}
>> horizontally aligned as
>> 15.0 ±1.00
>>  8.12±0.34
>> But I get
>> 15.0±1.00
>>  8.12±0.34
>> instead.
>> From the source (phys-dim.mkiv), I can see that “=“ should expand to 
>> \hphantom{0}. (I think \zeropoint in the table is outdated, since 
>> \def\zeropoint\hphantom{0} does not solve the problem either.)
> 
> 1. Which table?
> 
> 2. This is not how \def works.
> 
> 3. When you redefine \zeropoint (which isn't a macro) you're going to break 
> everything.
> 
>> I can’t use tabulate or alignment in math mode for this problem 
>> unfortunately.
> 
> I looked at the code and the problem is = can only be used to insert space 
> for two digits (e.g. 100.==).
> 
> 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] mkiv digits/units zero padding not working

2020-05-07 Thread Benjamin Buchmuller
Hi,

I’m trying to get

\digits{15.0=}±\digits{1.00}

\digits{_8.12}±\digits{0.34}

horizontally aligned as

15.0 ±1.00
 8.12±0.34

But I get

15.0±1.00
 8.12±0.34

instead.

From the source (phys-dim.mkiv), I can see that “=“ should expand to 
\hphantom{0}. (I think \zeropoint in the table is outdated, since 
\def\zeropoint\hphantom{0} does not solve the problem either.)

I can’t use tabulate or alignment in math mode for this problem unfortunately.

Any hints would be very welcome.

Thanks


Benjamin
___
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] \placetable[location=split] reference ??

2020-05-07 Thread Benjamin Buchmuller
Okay, I found the solution myself: Need to specify \startxtable[split=repeat] 
or else. 

It’s actually a bit surprising that the value of the “outer” enivornment 
(placetable) depends on the settings in the inner one (xtable). I speculate 
this might be because the order of the tables might be different as soon as 
xtable tries to place them …

Cheers

\startplacetable[reference=tab1,title={A table},location=split]
\startxtable[split=repeat]
\startxrow
\startxcell hi \stopxcell
\stopxrow
\stopxtable
\stopplacetable


> On 22 Apr 2020, at 21:10, Benjamin Buchmuller  
> wrote:
> 
> Hi,
> 
> I would like to reference a table of the following structure. 
> 
> \starttext
> 
> \startplacetable[reference=tab1,title={A table},location=split]
> \startxtable
> \startxrow
> \startxcell hi \stopxcell
> \stopxrow
> \stopxtable
> \stopplacetable
> 
> In Table \in[tab1]
> 
> \stoptext
> 
> 
> It has [location=split], which I need this because xtable doesn’t like to be 
> placed without a split; and apparently neither does it accept the 
> \placetable[ref]{...} syntax. However, the reference is now no longer 
> detected.
> 
> I can see that the split table’s caption is about to become "Table 1.a.", 
> "Table 1.b" etc. and I appreciate that this is potentially a quite complex 
> mechanism anyways, but if there was any chance to  get a reference as “Table 
> 1”, I would be helped a lot.
> 
> On similar lines, is there a way to have “Table 1 (continued).” in the 
> caption?
> 
> Cheers
> 
> 
> Benjamin
> 
> 

___
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] Basic font question (Optima, but no bold, no italics). Standalone ConTeXt does not work. TeX Live 2019 works

2020-04-26 Thread Benjamin Buchmuller
The problem seems to be resolved. Thanks to everyone, especially Hans, Taco and 
Wolfgang for the fast fix (offlist)!

After updating to

ConTeXt  ver: 2020.01.30 14:13 MKIV beta  fmt: 2020.4.26

Helvetica Neue works with:
==

\starttypescript [sans] [helvet]
   \setups[font:fallback:sans]
   \definefontsynonym [Sans]   [file:Helvetica Neue.ttc(Helvetica 
Neue)] [features=default]
   \definefontsynonym [SansBold]   [file:Helvetica Neue.ttc(Helvetica Neue 
Bold)]   [features=default]
   \definefontsynonym [SansItalic] [file:Helvetica Neue.ttc(Helvetica Neue 
Italic)]  [features=default]
   \definefontsynonym [SansBoldItalic] [file:Helvetica Neue.ttc(Helvetica Neue 
Bold Italic)] [features=default]
\stoptypescript

\definetypeface [helvet] [ss] [sans] [helvet] [default] 

\setupbodyfont [helvet, 12pt]

Optima works with:
==

\starttypescript [sans] [optima]
  \setups[font:fallback:sans]
  \definefontsynonym [Sans]   [file:Optima.ttc(Optima Regular)] 
[features=default]
  \definefontsynonym [SansBold]   [file:Optima.ttc(Optima Bold)]   
[features=default]
  \definefontsynonym [SansItalic] [file:Optima.ttc(Optima Italic)]  
[features=default]
  \definefontsynonym [SansBoldItalic] [file:Optima.ttc(Optima Bold Italic)] 
[features=default]
\stoptypescript

\definetypeface [optima] [ss] [sans] [optima] [default]

\setupbodyfont [optima]

\starttext
\tf Upright,
\bf Bold,
\it Italic,
\bi Bolditalic
\stoptext

Note 1: mtxrun --script fonts --list --all --pattern=helvetica etc. might still 
not display all variants correctly in the first place.

Note 2: There are predefined typescripts for Mac OS in ConTeXt 
(type-imp-osx.mkiv) but the file needs a update/cleanup.

> On 24 Apr 2020, at 12:14, Benjamin Buchmuller  
> wrote:
> 
> Hi Hraban,
> 
> Thanks for the hint (and the proper fontfamily setup), I have forced reload 
> ten times now from various accounts; the issue persists unfortunately. 
> 
> This might confirm Taco‘s notion that there is some bug lmtx. I’m running 
> macOS Catalina too, but as it worked with the standalone of Dec/Jan three 
> days ago, I suspect it is not because of a new feature in the OS, but rather 
> an old feature in mtxrun or elsewhere having disappeared. 
> 
>> On 24. Apr 2020, at 11:35, Henning Hraban Ramm  wrote:
>> 
>> 
>> 
>>> Am 24.04.2020 um 11:13 schrieb Benjamin Buchmuller 
>>> :
>>> 
>>> Although this specific issue might have been solved meanwhile by the 
>>> helpful suggestions of Wolfang, Thomas and others, I would like to point 
>>> out that I have recently also encountered an odd behaviour of the mtxrun 
>>> fontloader in the standalone, in which not all typefaces are 
>>> available/properly identified.
>>> 
>>> (I’m sorry to hijack this thread if this is unrelated.)
>>> 
>>> Basically, when I load “Helvetica Neue”, I get instead of “regular/normal” 
>>> always “light/italic”.
>>> 
>>> I have switched to heros for the meantime, but potentially there is some 
>>> bug behind this. (My documents with the version from Dec/Jan worked fine.)
>>> 
>>> I recite my example from Wed:
>>> 
>>> ConTeXt  ver: 2020.01.30 14:13 MKIV beta  fmt: 2020.4.22 (LuaTeX 1.11.1)
>>> 
>>> and I’m running now into troubles with system font indexing:
>>> 
>>> mtxrun --script fonts --reload
>>> 
>>> locates fonts in macOS directories appropriately (*.afm fonts placed in 
>>> .../tex/texmf-fonts are not found, but at the moment I don’t care too 
>>> much), however it resolves only to a single font variant for *.ttc instead 
>>> of all variants:
>>> 
>>> mtxrun --script fonts --list --all --pattern=helvetica
>>> 
>>> helvetica helvetica
>>> helveticalightoblique /System/Library/Fonts/Helvetica.ttc   
>>>  6
>>> helveticalightoblique helvetica
>>> helveticalightoblique /System/Library/Fonts/Helvetica.ttc   
>>>  6
>>> helveticaneuedeskinterfaceheavy   helveticaneuedeskinterface   
>>> helveticaneuedeskinterfaceheavy   
>>> /System/Library/Fonts/HelveticaNeueDeskInterface.ttc   10
>>> helveticaneuethinitalic   helveticaneue
>>> helveticaneuethinitalic   /System/Library/Fonts/HelveticaNeue.ttc   
>>>  14
>> 
>> If the subfont is not listed, ConTeXt/mtxrun couldn’t find it and won’t find 
>> it regardless of your setup.
>> 
>> Try
>> mtxrun --script fonts --re

Re: [NTG-context] Basic font question (Optima, but no bold, no italics). Standalone ConTeXt does not work. TeX Live 2019 works

2020-04-24 Thread Benjamin Buchmuller
Hi Hraban,

Thanks for the hint (and the proper fontfamily setup), I have forced reload ten 
times now from various accounts; the issue persists unfortunately. 

This might confirm Taco‘s notion that there is some bug lmtx. I’m running macOS 
Catalina too, but as it worked with the standalone of Dec/Jan three days ago, I 
suspect it is not because of a new feature in the OS, but rather an old feature 
in mtxrun or elsewhere having disappeared. 

> On 24. Apr 2020, at 11:35, Henning Hraban Ramm  wrote:
> 
> 
> 
>> Am 24.04.2020 um 11:13 schrieb Benjamin Buchmuller 
>> :
>> 
>> Although this specific issue might have been solved meanwhile by the helpful 
>> suggestions of Wolfang, Thomas and others, I would like to point out that I 
>> have recently also encountered an odd behaviour of the mtxrun fontloader in 
>> the standalone, in which not all typefaces are available/properly identified.
>> 
>> (I’m sorry to hijack this thread if this is unrelated.)
>> 
>> Basically, when I load “Helvetica Neue”, I get instead of “regular/normal” 
>> always “light/italic”.
>> 
>> I have switched to heros for the meantime, but potentially there is some bug 
>> behind this. (My documents with the version from Dec/Jan worked fine.)
>> 
>> I recite my example from Wed:
>> 
>> ConTeXt  ver: 2020.01.30 14:13 MKIV beta  fmt: 2020.4.22 (LuaTeX 1.11.1)
>> 
>> and I’m running now into troubles with system font indexing:
>> 
>> mtxrun --script fonts --reload
>> 
>> locates fonts in macOS directories appropriately (*.afm fonts placed in 
>> .../tex/texmf-fonts are not found, but at the moment I don’t care too much), 
>> however it resolves only to a single font variant for *.ttc instead of all 
>> variants:
>> 
>> mtxrun --script fonts --list --all --pattern=helvetica
>> 
>> helvetica helvetica
>> helveticalightoblique /System/Library/Fonts/Helvetica.ttc
>> 6
>> helveticalightoblique helvetica
>> helveticalightoblique /System/Library/Fonts/Helvetica.ttc
>> 6
>> helveticaneuedeskinterfaceheavy   helveticaneuedeskinterface   
>> helveticaneuedeskinterfaceheavy   
>> /System/Library/Fonts/HelveticaNeueDeskInterface.ttc   10
>> helveticaneuethinitalic   helveticaneue
>> helveticaneuethinitalic   /System/Library/Fonts/HelveticaNeue.ttc
>> 14
> 
> If the subfont is not listed, ConTeXt/mtxrun couldn’t find it and won’t find 
> it regardless of your setup.
> 
> Try
> mtxrun --script fonts --reload --force
> maybe even twice or thrice and check again.
> (Unfortunately this is not reliable.)
> 
> I get the full list:
> 
> identifier   familyname   
> fontname   filename   
> subfont   instances
> 
> helveticahelvetica
> helvetica  
> /System/Library/Fonts/Helvetica.ttc1
> helveticaneueblack   helveticaneue
> helveticaneuecondensedblack
> /System/Library/Fonts/HelveticaNeue.ttc10
> helveticaneuedeskinterfaceextrabold  helveticaneuedeskinterface   
> helveticaneuedeskinterfaceheavy
> /System/Library/Fonts/HelveticaNeueDeskInterface.ttc   10
> helveticaneuedeskinterfaceextralight helveticaneuedeskinterface   
> helveticaneuedeskinterfacethin 
> /System/Library/Fonts/HelveticaNeueDeskInterface.ttc   8
> helveticaneuedeskinterfacemedium helveticaneuedeskinterface   
> helveticaneuedeskinterfacemediump4 
> /System/Library/Fonts/HelveticaNeueDeskInterface.ttc   5
> helveticaneuedeskinterfacemediumitalic   helveticaneuedeskinterface   
> helveticaneuedeskinterfacemediumitalicp4   
> /System/Library/Fonts/HelveticaNeueDeskInterface.ttc   6
> helveticaneuedeskinterfacenormal helveticaneuedeskinterface   
> helveticaneuedeskinterfaceregular  
> /System/Library/Fonts/HelveticaNeueDeskInterface.ttc   1
> helveticaneueextralight  helveticaneue
> helveticaneuethin  
> /System/Library/Fonts/HelveticaNeue.ttc13
> helveticaneuenormal  helveticaneue
> helveticaneue  
> /System/Library/Fonts/HelveticaNeue.ttc1
> helveticaneueregular helveticaneue
> helveti

Re: [NTG-context] Basic font question (Optima, but no bold, no italics). Standalone ConTeXt does not work. TeX Live 2019 works

2020-04-24 Thread Benjamin Buchmuller
Although this specific issue might have been solved meanwhile by the helpful 
suggestions of Wolfang, Thomas and others, I would like to point out that I 
have recently also encountered an odd behaviour of the mtxrun fontloader in the 
standalone, in which not all typefaces are available/properly identified.

(I’m sorry to hijack this thread if this is unrelated.)

Basically, when I load “Helvetica Neue”, I get instead of “regular/normal” 
always “light/italic”.

I have switched to heros for the meantime, but potentially there is some bug 
behind this. (My documents with the version from Dec/Jan worked fine.)

I recite my example from Wed:

ConTeXt  ver: 2020.01.30 14:13 MKIV beta  fmt: 2020.4.22 (LuaTeX 1.11.1)

and I’m running now into troubles with system font indexing:

mtxrun --script fonts --reload

locates fonts in macOS directories appropriately (*.afm fonts placed in 
.../tex/texmf-fonts are not found, but at the moment I don’t care too much), 
however it resolves only to a single font variant for *.ttc instead of all 
variants:

mtxrun --script fonts --list --all --pattern=helvetica

helvetica helvetica
helveticalightoblique /System/Library/Fonts/Helvetica.ttc   
 6
helveticalightoblique helvetica
helveticalightoblique /System/Library/Fonts/Helvetica.ttc   
 6
helveticaneuedeskinterfaceheavy   helveticaneuedeskinterface   
helveticaneuedeskinterfaceheavy   
/System/Library/Fonts/HelveticaNeueDeskInterface.ttc   10
helveticaneuethinitalic   helveticaneue
helveticaneuethinitalic   /System/Library/Fonts/HelveticaNeue.ttc   
 14

As a consequence, when I run

\definefontfamily[mainface][ss][Helvetica Neue]
\setupbodyfont[mainface, 12pt, sans]

I get the light oblique variant instead of the regular one. I have tried to fix 
this via a 

\definefontfamily[mainface][ss][Helvetica Neue][tf=style:normal]

but apparently I understand too little about this setup altogether …

Thanks already for any suggestions!



> On 24 Apr 2020, at 08:53, ntg-context-requ...@ntg.nl wrote:
> 
> Send ntg-context mailing list submissions to
>   ntg-context@ntg.nl
> 
> To subscribe or unsubscribe via the World Wide Web, visit
>   https://mailman.ntg.nl/mailman/listinfo/ntg-context
> or, via email, send a message with subject or body 'help' to
>   ntg-context-requ...@ntg.nl
> 
> You can reach the person managing the list at
>   ntg-context-ow...@ntg.nl
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of ntg-context digest..."
> Today's Topics:
> 
>   1. Re: Basic font question (Optima, but no bold, no italics).
>  Standalone ConTeXt does not work. TeX Live 2019 works
>  (Wolfgang Schuster)
> 
> From: Wolfgang Schuster 
> Subject: Re: [NTG-context] Basic font question (Optima, but no bold, no 
> italics). Standalone ConTeXt does not work. TeX Live 2019 works
> Date: 24 April 2020 at 08:53:52 CEST
> To: mailing list for ConTeXt users , Gerben Wierda 
> 
> 
> 
> Gerben Wierda schrieb am 24.04.2020 um 08:48:
>> With Arial:
>> 
>> \definefontfamily[mainface][rm][Arial]
>> \setupbodyfont[mainface,10pt]
>> 
>> 
>> 
>> with Optima:
>> 
>> \definefontfamily[mainface][rm][Optima]
>> \setupbodyfont[mainface,10pt]
>> 
>> 
>> It doesn’t matter if the font statements are before or after \starttext
>> 
>> Then I thought, let’s test some other things. I logged in as another user, 
>> and used ConTeXt from TeX Live 2019:
>> 
>> 
>> It seems to be that on my system, the standalone installed ConTeXt does not 
>> work with Optima, but the TeX Live installed one does.
> 
> Can you try this:
> 
> \definefontfamily [mainface] [rm] [Optima]
>   [it=optimaitalic,
>bf=optimabold,
>bi=optimabolditalic]
> 
> 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  : https://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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Hyphentation/Linebreak after x characters

2020-04-24 Thread Benjamin Buchmuller
Hi Rik,

thank you as well, this works also nicely. I’ve created a wiki page meanwhile 
for wrapping text containing both solutions and the post on SHA keys.

https://www.contextgarden.net/Wrapping

Cheers


Benjamin

> On 24 Apr 2020, at 00:45, Rik Kabel  wrote:
> 
> 
> 
> On 4/23/2020 17:50, Wolfgang Schuster wrote:
>> Benjamin Buchmuller schrieb am 23.04.2020 um 23:16: 
>>> Hi Rik, 
>>> 
>>> Thanks for the fast reply! Your example works indeed nicely. However, 
>>> within this solution my problem has shifted now (fully) towards breaking 
>>> after the same number of characters, which seems to work for your sample 
>>> string, but not for the sequences that I need to place. 
>>> 
>>> What I would like to achieve is something like: 
>>> 
>>> 5’-GATTGCTTACTCCTGGTTGG 
>>> TCTTACATTCTGTCGCCTC 
>>> CTACTAGAGCCGGCATATT 
>>> CTAGAAGGGCCGCCTTCATGTGG 
>>> etc. 
>>> 
>>> (There might be hyphens or not, this is not so much important to me.) 
>>> 
>>> But what I get is currently: 
>>> 
>>> 5'-GATTGCTTACTCCTG- 
>>> GTTGGTCTTACATTCT- 
>>> GTCGCCTCCTACTA- 
>>> GAGCCGGCATATTCTA- 
>>> GAAGGGCCGCCTTCATGTGGC- 
>>> etc. 
>>> 
>>> Which looks ragged with \tt. Certainly, this is because ConTeXt applies the 
>>> default hyphenation pattern. But I guess, there might be no “no language” 
>>> pattern or is there? Also, I agree, it’s a bit odd that nright/nleft seem 
>>> to make no difference towards the result. 
>> 
>> Hans posted a solution for a similar problem a few years ago [1] 
>> which can be adapted to your problem. 
>> 
>> \startluacode 
>> 
>>  local shared = { 
>>  start  = 1, 
>>  length = 1, 
>>  before = nil, 
>>  after  = nil, 
>>  left   = false, 
>>  right  = false, 
>>  } 
>> 
>>  local all = table.setmetatableindex({ }, function(t,k) 
>>  return shared 
>>  end) 
>> 
>>  languages.hyphenators.traditional.installmethod("dna", 
>>  function(dictionary,word,n) 
>>  return all 
>>  end 
>>  ) 
>> \stopluacode 
>> 
>> \definehyphenationfeatures 
>>   [dna] 
>>   [characters=all, 
>>alternative=dna] 
>> 
>> \starttext 
>> 
>> \startframedtext[width=6cm,style=mono] 
>>   \sethyphenationfeatures[dna] 
>>   \setuphyphenation[method=traditional] 
>>   GATTGCTTACTCCTGGTTGG% 
>>   TCTTACATTCTGTCGCCTC% 
>>   CTACTAGAGCCGGCATATT% 
>>   CTAGAAGGGCCGCCTTCATGTGG% 
>> \stopframedtext 
>> 
>> \stoptext 
>> 
>> [1] https://mailman.ntg.nl/pipermail/ntg-context/2017/089106.html 
>> 
>> Wolfgang 
>> 
> And without lua, just two lines of ConTeXt with a bit of TeX:
> 
> \define[1]\DNA{\handletokens #1\with\DNAspacer}
> \define[1]\DNAspacer{#1\hskip 2.3pt plus .1pt}
> \define[2]\mycommandc{
> \startxrow
> \startxcell o#1 \stopxcell
> \startxcell {\tt\WORD{\DNA{5'-#2}}}\stopxcell
> \stopxrow
> }
> \starttext
> \setupxtable[width=5cm]
> \startxtable
> \mycommandc{C}{gattgcttactcctggttggtcttacattctgtcgcctcctactagagccggcatattctagaagggccgccttcatgtggcctagggcaccatcgcgtacgagggcaatgagtttaccgctgcgaagtctctacgtcacggccaaccacagtcctgctcccaacgaaatttagacgctgtcgtgaaacctgaattcgaggataagccgcgtcatgaagagtctactg}
> \stopxtable
> \stoptext
> 
> Modify the skip as you see fit.
> 
> -- 
> Rik
> 

___
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] Hyphentation/Linebreak after x characters

2020-04-23 Thread Benjamin Buchmuller
Thanks Wolfgang, this works perfectly. I will add this hint tomorrow to the 
Wiki.

> On 23 Apr 2020, at 23:50, Wolfgang Schuster 
>  wrote:
> 
> Benjamin Buchmuller schrieb am 23.04.2020 um 23:16:
>> Hi Rik,
>> Thanks for the fast reply! Your example works indeed nicely. However, within 
>> this solution my problem has shifted now (fully) towards breaking after the 
>> same number of characters, which seems to work for your sample string, but 
>> not for the sequences that I need to place.
>> What I would like to achieve is something like:
>> 5’-GATTGCTTACTCCTGGTTGG
>> TCTTACATTCTGTCGCCTC
>> CTACTAGAGCCGGCATATT
>> CTAGAAGGGCCGCCTTCATGTGG
>> etc.
>> (There might be hyphens or not, this is not so much important to me.)
>> But what I get is currently:
>> 5'-GATTGCTTACTCCTG-
>> GTTGGTCTTACATTCT-
>> GTCGCCTCCTACTA-
>> GAGCCGGCATATTCTA-
>> GAAGGGCCGCCTTCATGTGGC-
>> etc.
>> Which looks ragged with \tt. Certainly, this is because ConTeXt applies the 
>> default hyphenation pattern. But I guess, there might be no “no language” 
>> pattern or is there? Also, I agree, it’s a bit odd that nright/nleft seem to 
>> make no difference towards the result.
> 
> Hans posted a solution for a similar problem a few years ago [1]
> which can be adapted to your problem.
> 
> \startluacode
> 
> local shared = {
> start  = 1,
> length = 1,
> before = nil,
> after  = nil,
> left   = false,
> right  = false,
> }
> 
> local all = table.setmetatableindex({ }, function(t,k)
> return shared
> end)
> 
> languages.hyphenators.traditional.installmethod("dna",
> function(dictionary,word,n)
> return all
> end
> )
> \stopluacode
> 
> \definehyphenationfeatures
>  [dna]
>  [characters=all,
>   alternative=dna]
> 
> \starttext
> 
> \startframedtext[width=6cm,style=mono]
>  \sethyphenationfeatures[dna]
>  \setuphyphenation[method=traditional]
>  GATTGCTTACTCCTGGTTGG%
>  TCTTACATTCTGTCGCCTC%
>  CTACTAGAGCCGGCATATT%
>  CTAGAAGGGCCGCCTTCATGTGG%
> \stopframedtext
> 
> \stoptext
> 
> [1] https://mailman.ntg.nl/pipermail/ntg-context/2017/089106.html
> 
> 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] Hyphentation/Linebreak after x characters

2020-04-23 Thread Benjamin Buchmuller
Hi Rik,

Thanks for the fast reply! Your example works indeed nicely. However, within 
this solution my problem has shifted now (fully) towards breaking after the 
same number of characters, which seems to work for your sample string, but not 
for the sequences that I need to place.

What I would like to achieve is something like:

5’-GATTGCTTACTCCTGGTTGG
TCTTACATTCTGTCGCCTC
CTACTAGAGCCGGCATATT
CTAGAAGGGCCGCCTTCATGTGG
etc.

(There might be hyphens or not, this is not so much important to me.)

But what I get is currently:

5'-GATTGCTTACTCCTG- 
GTTGGTCTTACATTCT- 
GTCGCCTCCTACTA- 
GAGCCGGCATATTCTA- 
GAAGGGCCGCCTTCATGTGGC- 
etc.

Which looks ragged with \tt. Certainly, this is because ConTeXt applies the 
default hyphenation pattern. But I guess, there might be no “no language” 
pattern or is there? Also, I agree, it’s a bit odd that nright/nleft seem to 
make no difference towards the result.

This is the MWE based on your solution:

\define[2]\mycommandc{
\startxrow
\startxcell o#1 \stopxcell
\startxcell \tt\WORD{5'-#2} \stopxcell
\stopxrow
}

\definebreakpoint[mybreaks][][nright=100,nleft=100,type=1]
\setbreakpoints[mybreaks]

\starttext

\setupxtable[width=5cm]
\startxtable
\mycommandc{C}{GATTGCTTACTCCTGGTTGGTCTTACATTCTGTCGCCTCCTACTAGAGCCGGCATATTCTAGAAGGGCCGCCTTCATGTGGCCTAGGGCACCATCGCGTACGAGGGCAATGAGTTTACCGCTGCGAAGTCTCTACGTCACGGCCAACCACAGTCCTGCTCCCAACGAAATTTAGACGCTGTCGTGAAACCTGAATTCGAGGATAAGCCGCGTCATGAAGAGTCTACTG}
\stopxtable

\stoptext

> On 23 Apr 2020, at 22:02, ntg-context-requ...@ntg.nl wrote:
> 
> Send ntg-context mailing list submissions to
>   ntg-context@ntg.nl
> 
> To subscribe or unsubscribe via the World Wide Web, visit
>   https://mailman.ntg.nl/mailman/listinfo/ntg-context
> or, via email, send a message with subject or body 'help' to
>   ntg-context-requ...@ntg.nl
> 
> You can reach the person managing the list at
>   ntg-context-ow...@ntg.nl
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of ntg-context digest..."
> Today's Topics:
> 
>   1. Re: Hyphentation/Linebreak after x characters inside \WORD?
>  (Rik Kabel)
> 
> From: Rik Kabel 
> Subject: Re: [NTG-context] Hyphentation/Linebreak after x characters inside 
> \WORD?
> Date: 23 April 2020 at 21:46:59 CEST
> To: ntg-context@ntg.nl, benjamin.buchmul...@gmail.com
> 
> 
> 
> 
> On 4/23/2020 15:01, Benjamin Buchmuller wrote:
>> Sorry, I have just realized that the problem might not be \WORD{} actually, 
>> so this one hyphenates:
>> 
>> \define[2]\mycommand{
>>  \startxrow
>>  \startxcell o#1 \stopxcell
>>  \startxcell \tt\WORD #2 \stopxcell
>>  \stopxrow
>>  }
>> 
>> Whereas these ones don’t: 
>> 
>> 
>> \define[2]\mycommand{
>>  \startxrow
>>  \startxcell o#1 \stopxcell
>>  \startxcell \tt\WORD #2-3' \stopxcell
>>  \stopxrow
>>  }
>> 
>> \define[2]\mycommand{
>>  \startxrow
>>  \startxcell o#1 \stopxcell
>>  \startxcell 5'-\tt\WORD #2 \stopxcell
>>  \stopxrow
>>  }
>> 
>> Assuming that this has to do with the presence of “-“ which will be the 
>> preferred breakpoint. So, I guess the questions boils down to how to define 
>> the second argument of
>> 
>> \definebreakpoint[mybreaks][][nright=12,nleft=12,type=1]
>> 
>> in this case or how to “deactivate” the default \setbreakpoints[compound]?
>> 
>> 
>> 
>>> On 23 Apr 2020, at 20:46, Benjamin Buchmuller 
>>> 
>>>  wrote:
>>> 
>>> Hi again,
>>> 
>>> I am reading a CSV file into ConTeXt which contains long DNA sequences (>> 
>>> 40 characters) to place in xtables. So far, this works fine. However, I 
>>> need to uppercase the entries and need to \tt them. When I do this inside 
>>> \WORD however, they don’t hyphenate any more.
>>> 
>>> I’m using:
>>> 
>>> \defineseparatedlist
>>> [mylist]
>>> [
>>> separator={,}, quotechar={"},
>>> command=\mycommand
>>> ]
>>> 
>>> \define[2]\mycommand{
>>> \startxrow
>>> \startxcell o#1 \stopxcell
>>> \startxcell 5’-{\tt\WORD{#2}}-3' \stopxcell
>>> \stopxrow
>>> }
>>> 
>>> Since I don’t have access to each entry, I cant place hyphenation marks 
>>> directly. Is there a way to tell ConTeXt to hyphenate after say, 12 
>>> characters?
>>> 
>>> Thanks for your help.
>>> 
>>> 
>>&

Re: [NTG-context] Hyphentation/Linebreak after x characters inside \WORD?

2020-04-23 Thread Benjamin Buchmuller
Sorry, I have just realized that the problem might not be \WORD{} actually, so 
this one hyphenates:

\define[2]\mycommand{
\startxrow
\startxcell o#1 \stopxcell
\startxcell \tt\WORD #2 \stopxcell
\stopxrow
}

Whereas these ones don’t: 


\define[2]\mycommand{
\startxrow
\startxcell o#1 \stopxcell
\startxcell \tt\WORD #2-3' \stopxcell
\stopxrow
}

\define[2]\mycommand{
\startxrow
\startxcell o#1 \stopxcell
\startxcell 5'-\tt\WORD #2 \stopxcell
\stopxrow
}

Assuming that this has to do with the presence of “-“ which will be the 
preferred breakpoint. So, I guess the questions boils down to how to define the 
second argument of

\definebreakpoint[mybreaks][][nright=12,nleft=12,type=1]

in this case or how to “deactivate” the default \setbreakpoints[compound]?


> On 23 Apr 2020, at 20:46, Benjamin Buchmuller  
> wrote:
> 
> Hi again,
> 
> I am reading a CSV file into ConTeXt which contains long DNA sequences (>> 40 
> characters) to place in xtables. So far, this works fine. However, I need to 
> uppercase the entries and need to \tt them. When I do this inside \WORD 
> however, they don’t hyphenate any more.
> 
> I’m using:
> 
> \defineseparatedlist
>   [mylist]
>   [
>   separator={,}, quotechar={"},
>   command=\mycommand
>   ]
> 
> \define[2]\mycommand{
>   \startxrow
>   \startxcell o#1 \stopxcell
>   \startxcell 5’-{\tt\WORD{#2}}-3' \stopxcell
>   \stopxrow
>   }
> 
> Since I don’t have access to each entry, I cant place hyphenation marks 
> directly. Is there a way to tell ConTeXt to hyphenate after say, 12 
> characters?
> 
> Thanks for your help.
> 
> 
> Benjamin

___
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] Hyphentation/Linebreak after x characters inside \WORD?

2020-04-23 Thread Benjamin Buchmuller
Hi again,

I am reading a CSV file into ConTeXt which contains long DNA sequences (>> 40 
characters) to place in xtables. So far, this works fine. However, I need to 
uppercase the entries and need to \tt them. When I do this inside \WORD 
however, they don’t hyphenate any more.

I’m using:

\defineseparatedlist
[mylist]
[
separator={,}, quotechar={"},
command=\mycommand
]

\define[2]\mycommand{
\startxrow
\startxcell o#1 \stopxcell
\startxcell 5’-{\tt\WORD{#2}}-3' \stopxcell
\stopxrow
}

Since I don’t have access to each entry, I cant place hyphenation marks 
directly. Is there a way to tell ConTeXt to hyphenate after say, 12 characters?

Thanks for your help.


Benjamin
___
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] mtxrun fontloader in recent standalone

2020-04-22 Thread Benjamin Buchmuller
I’ve just updated to the most recent standalone 

ConTeXt  ver: 2020.01.30 14:13 MKIV beta  fmt: 2020.4.22 (LuaTeX 1.11.1)

and I’m running now into troubles with system font indexing:

mtxrun --script fonts --reload

locates fonts in macOS directories appropriately (*.afm fonts placed in 
.../tex/texmf-fonts are not found, but at the moment I don’t care too much), 
however it resolves only to a single font variant for *.ttc instead of all 
variants:

mtxrun --script fonts --list --all --pattern=helvetica

helvetica helvetica
helveticalightoblique /System/Library/Fonts/Helvetica.ttc   
 6
helveticalightoblique helvetica
helveticalightoblique /System/Library/Fonts/Helvetica.ttc   
 6
helveticaneuedeskinterfaceheavy   helveticaneuedeskinterface   
helveticaneuedeskinterfaceheavy   
/System/Library/Fonts/HelveticaNeueDeskInterface.ttc   10
helveticaneuethinitalic   helveticaneue
helveticaneuethinitalic   /System/Library/Fonts/HelveticaNeue.ttc   
 14

As a consequence, when I run

\definefontfamily[mainface][ss][Helvetica Neue]
\setupbodyfont[mainface, 12pt, sans]

I get the light oblique variant instead of the regular one. I have tried to fix 
this via a 

\definefontfamily[mainface][ss][Helvetica Neue][tf=style:normal]

but apparently I understand too little about this setup altogether …

Thanks already for any suggestions!


Benjamin
___
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] \placetable[location=split] reference ??

2020-04-22 Thread Benjamin Buchmuller
Hi,

I would like to reference a table of the following structure. 

\starttext

\startplacetable[reference=tab1,title={A table},location=split]
\startxtable
\startxrow
\startxcell hi \stopxcell
\stopxrow
\stopxtable
\stopplacetable

In Table \in[tab1]

\stoptext


It has [location=split], which I need this because xtable doesn’t like to be 
placed without a split; and apparently neither does it accept the 
\placetable[ref]{...} syntax. However, the reference is now no longer detected.

I can see that the split table’s caption is about to become "Table 1.a.", 
"Table 1.b" etc. and I appreciate that this is potentially a quite complex 
mechanism anyways, but if there was any chance to  get a reference as “Table 
1”, I would be helped a lot.

On similar lines, is there a way to have “Table 1 (continued).” in the caption?

Cheers


Benjamin


___
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] \placenamedfloat and \setuphead[aftersection=...] broken?

2020-04-03 Thread Benjamin Buchmuller
Thank you, Wolfgang, this works; apparently, the chapter has to be set with 
\startchapter … \stopchapter and footnotes after \chapter won’t be flushed 
unless \startchapter \footnote{something} \stopchapter.

This makes sense to me. 

I guess, internally \head (e.g. \section, \chapter etc.) is simply not 
“converted" to \starthead ... \stophead before the next invocation of \head or 
the end of \stoptext?

Cheers


Benjamin

> On 2 Apr 2020, at 19:51, Wolfgang Schuster 
>  wrote:
> 
> Benjamin Buchmuller schrieb am 02.04.2020 um 19:29:
>> Potentially on the same lines, placing delayed element seems currently not 
>> to work properly (or the syntax has changed?).
>> I think these features of MkIV are very elegant and useful. I’m just 
>> wondering if they are/were temporarily not working (tried on 2019.12.27 
>> 16:34 MKIV beta and the Wiki’s ConTeXt online) or have been disabled/changed 
>> for some reason?
>> Thanks!
>> Benjamin
>> (1) palcenamedfloat
>> ---
>> This is the example from the Wiki:
>> [...]
>> (2) Footnotes at the end of each chapter
>> 
>> Also an example from the Wiki:
>> \startsetups
>>  chapter:after
>>  \ifcase\rawcountervalue[footnote]\relax
>>  \or
>>  \startsubject[title=Footnote]
>>  \placefootnotes
>>  \stopsubject
>>  \else
>>  \startsubject[title=Footnotes]
>>  \placefootnotes
>>  \stopsubject
>>  \fi
>> \stopsetups
>> \setupnotes[location=none]
>> \setupnotation[way=bychapter]
>> \setuphead[chapter][aftersection=\setups{chapter:after}]
> 
> Here is a slightly reformatted version of Hans code which works for me with 
> the latest ConTeXt version (I checked only LMTX).
> 
> \startsetups[chapter:after]
>  \ifcase\rawcountervalue[footnote]\relax
>%
>  \or
>\startsubject[title=Footnote]
>  \placefootnotes
>\stopsubject
>  \else
>\startsubject[title=Footnotes]
>  \placefootnotes
>\stopsubject
>  \fi
> \stopsetups
> 
> \setupnote [footnote] [location=none]
> \setupnotation [footnote] [way=bychapter]
> 
> \setuphead[chapter][aftersection=\setups{chapter:after}]
> 
> \starttext
> 
> \dorecurse{4}
>  {\startchapter[title={Number #1}]
>   A few notes\dorecurse{\numexpr#1-1\relax}{\footnote{Note #1.##1}}.
>   \stopchapter}
> 
> \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] \placenamedfloat and \setuphead[aftersection=...] broken?

2020-04-02 Thread Benjamin Buchmuller
Potentially on the same lines, placing delayed element seems currently not to 
work properly (or the syntax has changed?).

I think these features of MkIV are very elegant and useful. I’m just wondering 
if they are/were temporarily not working (tried on 2019.12.27 16:34 MKIV beta 
and the Wiki’s ConTeXt online) or have been disabled/changed for some reason?

Thanks!


Benjamin

(1) palcenamedfloat
---

This is the example from the Wiki:

\starttext


test 
\placefigure[somewhere:alpha][whatever]{alpha}{}

test 
\placefigure[somewhere:beta] [whatever]{beta}{}

test 
\placefigure[somewhere:gamma][whatever]{gamma}{}

test 
\placefigure[somewhere:delta][whatever]{delta}{}

test 
\placefigure{}{}


in 
\in{figure}[whatever]
 bla bla


\placenamedfloat[figure][*l*]



\placenamedfloat[figure][gamma]
\placenamedfloat[figure][beta]



\stoptext

(2) Footnotes at the end of each chapter


Also an example from the Wiki:

\startsetups
 chapter:after
 
\ifcase\rawcountervalue[footnote]\relax

 
\or

 
\startsubject[title=Footnote]

 
\placefootnotes

 
\stopsubject

 
\else

 
\startsubject[title=Footnotes]

 
\placefootnotes

 
\stopsubject

 
\fi
\stopsetups



\setupnotes[location=none]
\setupnotation[way=bychapter]



\setuphead[chapter][aftersection=\setups{chapter:after}]
___
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] \setupinteraction[style=...] supersedes manual text style for \note

2020-04-01 Thread Benjamin Buchmuller
For the following one, I’m not sure if this is the intended behaviour or not:

I want to set up the “notation” and “note” style manually, which works great 
unless I also call \setupinteraction[state=start,style=normal] (or any other 
style), regardless of calling it before or after setting up “notation” or 
“note”.

MWE (with an assortment of different note positions):

% \setupinteraction[state=start,style=normal] %% uncomment and manual style for 
\note[] is no longer respected

\setupnotes[textcolor=blue,textstyle=italic]
\setupnotation[endnote][headcolor=green,numberconversion=character]

\starttext
This is the footnote\footnote[one]{aha} and the reference\note[one].

This is the endnote\endnote[two]{oho} and the reference\note[endnote][two].

Let's look \in[one].

\startplacefigure[title={And in this float\endnote[three]{hmm} and the 
reference\note[three].}]

\externalfigure[cow]

\stopplacefigure

\page

And look here \in[two].

\placenotes[endnote]
\stoptext

Cheers


Benjamin
___
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] placelistofsynonyms without tabulate

2020-03-30 Thread Benjamin Buchmuller
Following Aditya’s recommendation on making a glossary with ConTeXt 
(https://tex.stackexchange.com/questions/152248/make-a-glossary-with-context) 
and have looked through several older and newer manuals under “abbreviations” 
and into the source. 

However, I cannot figure out if there is a simple way to define my own command 
to achieve the following:

\definesynonyms[glossary][glossaries][\fullgloss]%[#4]
% I wonder also what #4 is supposed to do?
\setupsynonyms[glossary][headstyle=bold]

\glossary[US]{United States}{The US is a country in the Americas.}
\glossary[UK]{United Kingdom}{The UK is a country in Europe.}

% CURRENT RESULT (guessing from what I understand from the source this is 
converted internally to):

\placelistofglossaries

\starttabulate[|||]
\NC {\bf United Kingdom} \NC The UK is a country in Europe. \NC \NR
\NC {\bf United States} \NC The US is a country in the Americas. \NC \NR
\stoptabulate

% DESIRED RESULT

\unexpanded\def\myglossary#1#2#3{{\bf #1}#2} % or similar

\placelistofglossaries[command=\myglossary]

{\bf United Kingdom.} The UK is a country in Europe. Nice would be even if 
this could be indented at some point, but tastes may vary on 
indention for sure.

{\bf United States.} The US is a country in the Americas.

% or using itemize etc.

I am aware that \placelistofsynonyms has a command=... option, but it doesn’t 
do anything for me. Also, the location=inmarigin option (which I suppose could 
be used to tweak the desired result in a way) stopped working in MKIV (?) and I 
can see in the source that it has a “fixed” assignment to location=left.

Any hints very welcome. :)
___
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] Changing default rule thickness (globally)

2020-03-25 Thread Benjamin Buchmuller
Hi!

I would like to change the rule thickness that is used by default in ConTeXt. 
However, from the  command documentation 
(http://www.pragma-ade.nl/general/qrcs/setup-en.pdf), I see that I would need 
to basically change this for

\basegrid[rulethickness=...]
\setupbar[rulethickness=...]
\setupchemical[rulethickness=...]
\setupeffect[rulethickness=...]
\setupfillinlines[rulethickness=...]
\setupfillinrules[rulethickness=...]
\setupframed[rulethickness=...]
\setuplinefillers[rulethickness=...]
\setupmarginrules[rulethickness=...]
\setupmixedcolumns[rulethickness=...]
\setupnote[rulethickness=...]
\setupparagraphs[rulethickness=...]
\setupsidebar[rulethickness=...]
\setuptables[rulethickness=...]
\setuptabulation[rulethickness=...]
\setuptextbackground[rulethickness=...]
\setuptextrules[rulethickness=...]
\setupthinrules[rulethickness=...]
\setupxtable[rulethickness=...]

(And for \setupbackgrounds for [top header text footer bottom].) I’m sure there 
is a more elegant way to do this. But how?

Cheers


Benjamin
___
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] \setupfooter[color=red]: red color spills with float over next page

2016-12-19 Thread Benjamin Buchmuller
Hi Hans,

the patch solves the issue. Thank you for the fast reply.

With regard to Pablo’s question: When I would not use crop in the MWE, 
apparently I would get the desired output indeed. However, in the situation I 
was using the command to produce a document, I would need to crop some parts of 
a figure. I should have been a little bit more clear on this, I guess.

Thanks again,


Benjamin
___
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] \setupfooter[color=red]: red color spills with float over next page

2016-12-18 Thread Benjamin Buchmuller
Hi Hans,

I finally managed to make a MWE. The issue is related to me using \clip{…} onto 
external figures I would like to crop in conjunction with a colored footer 
set-up:

\starttext

\setupfooter[color=red]

\setupfootertexts
[]
[]
[any text] % issue related to put something in footer ...
[]

\input knuth

\input knuth

\input knuth

% … and moving to the top of the next page

\startplacefigure
[
width=fit,
title={
\input bryson
},
]
\clip[height=7.0cm]{ % issue related to clip
\externalfigure[fig_4.jpg][height=7.0cm, width=\textwidth]
}
\stopplacefigure

\stoptext

Thank you for your help.


Benjamin
___
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] \setupfooter[color=red]: red color spills with float over next page

2016-12-04 Thread Benjamin Buchmuller
Hi Hans,

thank you for your help. I tried exactly as you suggested, which worked fine, 
but adopting for the case being with 
\setupfootertexts[\strut{\color[MyColor]{footers}}\strut][][][…same…] (further, 
footer texts change in the course of the document and call markings, page 
numbers etc.), I ended up with the same result as before. 

I will provide a minimal example as soon as possible next week. 

Cheers, Benjamin 

> On 4 Dec 2016, at 12:00, ntg-context-requ...@ntg.nl wrote:
> 
> Send ntg-context mailing list submissions to
>   ntg-context@ntg.nl
> 
> To subscribe or unsubscribe via the World Wide Web, visit
>   https://mailman.ntg.nl/mailman/listinfo/ntg-context
> or, via email, send a message with subject or body 'help' to
>   ntg-context-requ...@ntg.nl
> 
> You can reach the person managing the list at
>   ntg-context-ow...@ntg.nl
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of ntg-context digest..."
> Today's Topics:
> 
>   1. \setupfooter[color=red]: red color spills with float over
>  next page (Benjamin Buchmuller)
>   2. Re: \setupfooter[color=red]: red color spills with float over
>  next page (Hans Hagen)
> 
> From: Benjamin Buchmuller <benjamin.buchmul...@gmail.com>
> Subject: [NTG-context] \setupfooter[color=red]: red color spills with float 
> over next page
> Date: 4 December 2016 at 04:05:49 CET
> To: ntg-context@ntg.nl
> Reply-To: mailing list for ConTeXt users <ntg-context@ntg.nl>
> 
> 
> When I have
> 
> \setupfooter[color=red, style=bold] (same goes with \setupfooter[style=red])
> 
> and a
> 
> tex text text
> 
> % <<<< page breaks here after typesetting >>>>
> 
> \startplacefigure[
>   %location=force, % no matter what I do here
>   title={Caption.}
> ]
> … something …
> \stopplacefigure
> 
> other text
> 
> that is moved to the following page as first object, the entire page 
> including the figure’s rulers, caption, and the regular text prints in red 
> (but not bold!?) when I incorporate the file via \component … into my 
> project, but not when I typeset from within \startcomponent … \stopcomponent.
> 
> Since “bold” does not seem to float the same way, I guess it is related to 
> color handling at page breaks somehow.
> 
> I already tried to \setupfloats[before=\strut] to “force” black bodyfont 
> right before the figure (at least this is what I intended to do), but did not 
> work.
> 
> I’m sorry not to be able to provide a more elaborate minimal example 
> asserting the exact conditionals of this behaviour at the moment as I need to 
> hand in a report next week. Probably the footers have to go black this time.
> 
> Any suggestions?
> 
> Thank you for your help.
> 
> 
> Benjamin
> 
> 
> 
> From: Hans Hagen <pra...@wxs.nl>
> Subject: Re: [NTG-context] \setupfooter[color=red]: red color spills with 
> float over next page
> Date: 4 December 2016 at 11:42:19 CET
> To: ntg-context@ntg.nl
> Reply-To: mailing list for ConTeXt users <ntg-context@ntg.nl>
> 
> 
>> On 12/4/2016 4:05 AM, Benjamin Buchmuller wrote:
>> When I have
>> 
>> \setupfooter[color=red, style=bold] (same goes with \setupfooter[style=red])
>> 
>> and a
>> 
>> tex text text
>> 
>> % <<<< page breaks here after typesetting >>>>
>> 
>> \startplacefigure[
>>  %location=force, % no matter what I do here
>>  title={Caption.}
>> ]
>> … something …
>> \stopplacefigure
>> 
>> other text
>> 
>> that is moved to the following page as first object, the entire page 
>> including the figure’s rulers, caption, and the regular text prints in red 
>> (but not bold!?) when I incorporate the file via \component … into my 
>> project, but not when I typeset from within \startcomponent … \stopcomponent.
>> 
>> Since “bold” does not seem to float the same way, I guess it is related to 
>> color handling at page breaks somehow.
>> 
>> I already tried to \setupfloats[before=\strut] to “force” black bodyfont 
>> right before the figure (at least this is what I intended to do), but did 
>> not work.
>> 
>> I’m sorry not to be able to provide a more elaborate minimal example 
>> asserting the exact conditionals of this behaviour at the moment as I need 
>> to hand in a report next week. Probably the footers have to go black this 
>> time.
>> 
>> Any suggestions?
> 
> not many as i really need an example
> 
> you can try
> 
> \setupfootertexts[\strut{\red foo}\strut}
> 
> ins

[NTG-context] \setupfooter[color=red]: red color spills with float over next page

2016-12-03 Thread Benjamin Buchmuller
When I have

\setupfooter[color=red, style=bold] (same goes with \setupfooter[style=red])

and a

tex text text

%  page breaks here after typesetting 

\startplacefigure[
%location=force, % no matter what I do here
title={Caption.}
]
… something …
\stopplacefigure

other text

that is moved to the following page as first object, the entire page including 
the figure’s rulers, caption, and the regular text prints in red (but not 
bold!?) when I incorporate the file via \component … into my project, but not 
when I typeset from within \startcomponent … \stopcomponent.

Since “bold” does not seem to float the same way, I guess it is related to 
color handling at page breaks somehow.

I already tried to \setupfloats[before=\strut] to “force” black bodyfont right 
before the figure (at least this is what I intended to do), but did not work.

I’m sorry not to be able to provide a more elaborate minimal example asserting 
the exact conditionals of this behaviour at the moment as I need to hand in a 
report next week. Probably the footers have to go black this time.

Any suggestions?

Thank you for your help.


Benjamin
___
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] Another question about definerefereformat

2016-11-13 Thread Benjamin Buchmuller
Here is another question, I was wondering about. 

What is the ConTeXt’s way to provide the “right” (or “left”) argument when 
\definereferenceformat[text=…] is set?

Starting from this example:

\starttext

\definereferenceformat[infig][text={Figure }]

\startplacefigure[reference=fig:A]

Some figure.

\stopplacefigure

This is \infig[fig:A].

\stoptext

I would like to output “This is Figure 1 a.” Obviously I can type “This is 
\infig[fig:A]\,a.” to get the desired result; however it does not seem very 
“ConTeXt-ish” to me as “This is \in{Figure}{a}[fig:A].” is much more concise. 
Is there the possibility to have something like \infig[right=a][fig:A]?

Thanks again.


Benjamin




___
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] Setupreferencing[interaction=text] breaks referenceformat[text={…}]

2016-11-13 Thread Benjamin Buchmuller
Hi,

I’m not sure if this is the intended behaviour of the system, but I want to 
typeset “This is Figure 1.1 in Chapter A Good Story” in the attached minimal 
example. However, setting up the referencing interaction to text, this typesets 
“This is 1.1 in Chapter A Good Story”. The same holds true, when the reference 
format is not defined via \definereferenceformat, but also in 
\in{Figure}[fig:A].

Here is the minimal example:

\starttext

\setupreferencing[
left={},
right={},
interaction=text, % critical
]

\definereferenceformat[infig][text={Figure }]

\chapter[myreference]{A Good Story}

\startplacefigure[reference=fig:A]

Some figure.

\stopplacefigure

This is \infig[fig:A] in Chapter \about[myreference].

\stoptext

Thank you very much for your help.


Benjamin
___
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] “Case-insensitive” sorting for \placelistofsynonyms?

2014-05-29 Thread Benjamin Buchmuller
Hi list,

according to case-insensitive sorting for \placeregister[…][…, method=…], I 
tried to figure out how to achieve similar results for \placelistofsynonyms 
(has method-key too). 

I tried this modified minimal example (that originally was proposed by Hans 
here: http://www.ntg.nl/pipermail/ntg-context/2010/052950.html), but failed:

\setuplayout[topspace=1cm,height=middle]

\setupbodyfont[11pt]

\starttext

\definesynonyms[abbr][abbrs][\unabbr]

\def\Test#1{\vbox{{\bf#1}\blank\placelistofabbrs[criterium=all,language=cz,method={#1}]}\blank}

wanted result: oá öb Oč Öď Oo Öo oo öo Öq öř Oš oů \blank

\startcolumns[n=2]
 \Test{before} \Test{first} 
 \Test{default}\Test{after}\Test{last}
\stopcolumns

\page

wanted result: oá öb Oč Öď Oo Öo oo öo Öq öř Oš oů \blank

\startcolumns[n=3]
 \Test{mc,mm,uc} \Test{mc,zm,uc} \Test{mc,pm,uc}
 \Test{zc,mm,uc} \Test{zc,zm,uc} \Test{zc,pm,uc}
 \Test{pc,mm,uc} \Test{pc,zm,uc} \Test{pc,pm,uc}
\stopcolumns

\page

wanted result: oá öb Oč Öď Oo Öo oo öo Öq öř Oš oů \blank

\startcolumns[n=3]
 \Test{mm,mc,uc} \Test{zm,mc,uc} \Test{pm,mc,uc}
 \Test{mm,zc,uc} \Test{zm,zc,uc} \Test{pm,zc,uc}
 \Test{mm,pc,uc} \Test{zm,pc,uc} \Test{pm,pc,uc}
\stopcolumns

\page

\dorecurse {2} {
\page \recurselevel:
 \abbr{oá}{oáz}  \abbr{öb}{öbz}  \abbr{Oč}{Očz}  \abbr{Öď}{Öďz}
 \abbr{oo}{ooz}  \abbr{öo}{öoz}  \abbr{Oo}{Ooz}  \abbr{Öo}{Öoz}
 \abbr{Öq}{Öqz}  \abbr{öř}{öřz}  \abbr{Oš}{Ošz}  \abbr{oů}{oůz}
done
}

\stoptext

Is there yet another way to modify sorting behaviour?

Many thanks for your help!
___
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
___