[NTG-context] Re: Sorry for once more asking, i am at Work

2024-02-20 Thread Gavin via ntg-context
Hi Uschi,

I think there are two separate issues. The first is possible trouble with the 
install from the ConTeXt garden. (Maybe this is related to “startup error : no 
format file given, quitting.”) The second is that you call PdfLaTeX to typeset 
your document, even though I know that is not what you intend.

Since you have TeX Live, I recommend you get the ConTeXt in TeX Live working 
first, then decide if you need the latest ConTeXt from the garden.

> On Feb 20, 2024, at 7:21 AM, Pablo Rodriguez via ntg-context 
>  wrote:
> 
> The engine you are using is pdfTeX (from TeX Live 2023). In ConTeXt
> terms, this is almost ancient (»uralt«).

Just to clarify, TeX Live 2023 has a perfectly good, rather up-to-date version 
of ConTeXt. I’m using it to typeset books and papers with all sorts of MetaFun 
craziness. However, if I attempt to typeset one of these ConTeXt documents 
using PdfLaTeX, I get exactly the same error and log file that you get.

I don’t know how you are calling PdfLaTeX to typeset your document, 
context-test.tex, but that is what you are doing. Until you get that 
straightened out, it won’t matter what version of ConTeXt you have installed.

Gavin

___
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: Sorry for once more asking, i am at Work

2024-02-19 Thread Gavin via ntg-context
Hi Uschi,

The log file is certainly helpful. It tells me two things. First, you have TeX 
Live 2023 installed. TeX Live 2023 has a good version of ConTeXt. Unless you 
need specific, newer ConTeXt features, you can use the ConTeXt version in TeX 
Live that you already have.

Second, when you tried to typeset your file, context-test.tex, your computer 
attempted to use pdftex rather than ConTeXt. To figure out why it did that, we 
need to know how you are doing the typesetting. Do you use a command on the 
command line? Are use using an editor that has a “typeset” button? Something in 
that part of the process needs to be changed so the typesetting uses ConTeXt 
rather than pdftex.

Gavin


> On Feb 19, 2024, at 5:06 AM, Ursula Hermann  
> wrote:
> 
> Dear List,
> I have done the new download at Work. After compiling is always the same:
> Command Line:   context.exe --synctex=-1 "context-test.tex"
> Startup Folder: 
> C:\Users\Hermann\Downloads\context-mswin\tex\texmf-context\tex\context\test\mkiv
> startup error : no format file given, quitting
> I wrote on Wednesday last week. I also did an download of cont- lmt and cont- 
> tmf. Don’t know if there is a mistake which is my fault?
> I don’t know, maybe important:
> The log file says:
> This is pdfTeX, Version 3.141592653-2.6-1.40.25 (TeX Live 2023) (preloaded 
> format=pdflatex 2024.2.6)  19 FEB 2024 12:41
> entering extended mode
> restricted \write18 enabled.
> %&-line parsing enabled.
> **context-test.tex
> (./context-test.tex
> LaTeX2e <2023-11-01> patch level 1
> L3 programming layer <2024-01-22>
> ! Undefined control sequence.
> l.1 \starttext
> ? ! Emergency stop.
> l.1
>End of file on the terminal!
> Here is how much of TeX's memory you used:
> 16 strings out of 474221
> 403 string characters out of 5750189
> 1922978 words of memory out of 500
> 22371 multiletter control sequences out of 15000+60
> 558069 words of font info for 36 fonts, out of 800 for 9000
> 1141 hyphenation exceptions out of 8191
> 12i,0n,13p,58b,8s stack positions out of 1i,1000n,2p,20b,20s
> !  ==> Fatal error occurred, no output PDF file produced!
> Uschi
>  Von: Ursula Hermann
> Gesendet: Mittwoch, 14. Februar 2024 14:16
> An: 'mailing list for ConTeXt users' 
> Betreff: AW: Sorry for once more asking, i am at Work
> Dear Hans,
> This was before you wrote, that you did an new  upload, but i saw it in the 
> installation. Because there were more files.
> Uschi
> Von: Ursula Hermann
> Gesendet: Mittwoch, 14. Februar 2024 13:42
> An: 'mailing list for ConTeXt users' 
> Betreff: Sorry for once more asking, i am at Work
> So after a new update on my Computer at Work, I did once more download the 
> installation. After compiling with context-mswin I got this file
> Command Line:   context.exe --synctex=-1 "context-test.tex"
> Startup Folder: 
> C:\Users\Hermann\Downloads\context-mswin\tex\texmf-context\tex\context\test\mkiv
> startup error : no format file given, quitting
> 
> ConTeXt Compilation Report (Pages: 0)
> Errors: 0   Warnings: 0   Bad Boxes: 0
> Did I something wrong?
> Uschi 
> ___
> 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
> ___


___
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: New upload doesn't work on macOS 10.13.6

2024-02-18 Thread Gavin via ntg-context
Hi Ralf

I keep TeX Live on my Mac. It’s a great fall-back when I have new version 
surprises with ConTeXt.

   tug.org/mactex/

TeX Live has a friendly installer. Updates are easy with TeX Live Utility. TeX 
Live has a version of ConTeXt from last May, and it’s quite a good version, in 
my opinion. (ConTeXt  ver: 2023.05.05 18:36 LMTX  fmt: 2023.12.18)

If you need any LaTeX stuff for some reason, it’s all there in TeX Live.

Gavin


> On Feb 18, 2024, at 1:01 PM, Ralf Heinrich Arning  wrote:
> 
> Hi list,
> 
> after having tried to update with the new upload, ConTEXt doesn't run 
> anymore. 
> 
> According to the output the new version requires a more recent system. I 
> still use macOS 10.13.6 (High Sierra).
> 
> This is what I get:
> 
> =
> context TestCode.tex
> dyld: lazy symbol binding failed: Symbol not found: chkstk_darwin
> Referenced from: 
> /Applications/TeX/context-osx-64/tex/texmf-osx-64/bin/context (which was 
> built for Mac OS X 12.7)
> Expected in: /usr/lib/libSystem.B.dylib
> 
> dyld: Symbol not found: chkstk_darwin
> Referenced from: 
> /Applications/TeX/context-osx-64/tex/texmf-osx-64/bin/context (which was 
> built for Mac OS X 12.7)
> Expected in: /usr/lib/libSystem.B.dylib
> 
> /bin/bash: line 2:  1569 Abort trap: 6   context TestCode.tex
> context TestCode.tex
> dyld: lazy symbol binding failed: Symbol not found: chkstk_darwin
> Referenced from: 
> /Applications/TeX/context-osx-64/tex/texmf-osx-64/bin/context (which was 
> built for Mac OS X 12.7)
> Expected in: /usr/lib/libSystem.B.dylib
> 
> dyld: Symbol not found: chkstk_darwin
> Referenced from: 
> /Applications/TeX/context-osx-64/tex/texmf-osx-64/bin/context (which was 
> built for Mac OS X 12.7)
> Expected in: /usr/lib/libSystem.B.dylib
> 
> /bin/bash: line 4:  1579 Abort trap: 6   context TestCode.tex
> ===
> 
> Trying to install again, I get:
> 
> 
> sh install.sh
> dyld: lazy symbol binding failed: Symbol not found: chkstk_darwin
> Referenced from: /Applications/TeX/context-osx-64/bin/mtxrun (which was built 
> for Mac OS X 12.7)
> Expected in: /usr/lib/libSystem.B.dylib
> 
> dyld: Symbol not found: chkstk_darwin
> Referenced from: /Applications/TeX/context-osx-64/bin/mtxrun (which was built 
> for Mac OS X 12.7)
> Expected in: /usr/lib/libSystem.B.dylib
> 
> install.sh: line 105:  1693 Abort trap: 6   $PWD/bin/mtxrun --script 
> ./bin/mtx-install.lua --update --server="$LMTXSERVER" 
> --instance="$LMTXINSTANCE" --platform="$PLATFORM" --erase 
> --extras="$LMTXEXTRAS"
> 
> ==
> 
> 
> What can I do?
> 
> Do I have to reinstall an older version? How can I do this?
> 
> Desperately,
> 
> Ralf
> ___
> 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
> ___

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

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


[NTG-context] Re: Why LuaMetaTex is so slow?

2024-01-18 Thread Gavin via ntg-context
Hi Shiv,

ConTeXt’s project structure has many benefits. One is speed. See 
https://wiki.contextgarden.net/Project_structure.

My books and long papers are products, each containing many components 
(chapters or sections). When I’m working, I have both the product and a 
component open. I frequently typeset the component as I’m working. This is very 
quick. I only typeset the entire product if I intend print or send it, or when 
I need to check some product-wide element like references. Components can be 
nested, so take this approach to whatever extreme you desire.

You can also use buffers if there are specific parts of your book (like 
diagrams) that demand significant processing. Buffers can save the typeset 
version of the contents. These will only be typeset again if you change the 
buffer contents (or if you are typesetting with a different version of 
ConTeXt.) See https://wiki.contextgarden.net/Command/typesetbuffer

My biggest book is about 200 pages. It takes 4 minutes to fully typeset on an 
M1 Mac. (I saw this time after downloading a new ConTeXt version.) This is 
mostly due to the 100+ complex TikZ diagrams. However, all of those diagrams 
are buffered, and when I’m working I only typeset the component. A typical 
chapter typesets in 1.6 seconds if I haven’t changed the diagrams. (I just did 
one to check.) That’s fast enough for me.

Hope that helps,
Gavin


> On Jan 18, 2024, at 10:24 AM, Shiv Shankar Dayal 
>  wrote:
> 
> I can process TeXBook in almost an instant using PDFTeX which is about 450+ 
> pages but my math book takes around 30 seconds averaging ~40 pages/second.
> 
> Why LuaMetaTeX is so slow? How can I speed it up?
> -- 
> Respect,
> Shiv Shankar Dayal
> ___
> 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
> ___

___
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: How to obtain older versions of LMTX?

2024-01-17 Thread Gavin via ntg-context
Hi Otared,

Yes, it contains LMTX. I am using TeX Live 2023 right now for a project, and it 
reports "ConTeXt  ver: 2023.05.05 18:36 LMTX”. 

Gavin

> On Jan 17, 2024, at 3:13 PM, Otared Kavian  wrote:
> 
> Hi Gavin,
> 
> Thanks for your reply. Does TeX Live contain LuaMetaTeX (LMTX)?
> That is because I need LMTX to typeset a presentation for which most of the 
> content is ready, but using features from LMTX…
> 
> Best regards: Otared
> 
> 
>> On 17 Jan 2024, at 23:01, Gavin via ntg-context  wrote:
>> 
>> Hi Otared
>> 
>> I use TeX Live as a convenient fall-back. I am also using MacOS ARM.
>> 
>> Gavin
>> 
>> 
>>> On Jan 17, 2024, at 2:52 PM, Otared Kavian  wrote:
>>> 
>>> Hi all,
>>> 
>>> In order to circumvent a bug in the latest versions (2023-09-26 and 
>>> 2024-01-08) of LMTX regarding math alignments, I am trying to get an older 
>>> version of LMTX (from before September 2023) for MacOS ARM. Does any one 
>>> know how to proceed?
>>> 
>>> Thanks in advance.
>>> Best regards: Otared
>>> ___
>>> 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
>>> ___
>> 
>> ___
>> 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
>> ___
> 
> Otared Kavian
> e-mail: ota...@gmail.com
> Phone: +33 6 88 26 70 95
> 
> 
> 
> 
> ___
> 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
> ___

___
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: How to obtain older versions of LMTX?

2024-01-17 Thread Gavin via ntg-context
Hi Otared

I use TeX Live as a convenient fall-back. I am also using MacOS ARM.

Gavin


> On Jan 17, 2024, at 2:52 PM, Otared Kavian  wrote:
> 
> Hi all,
> 
> In order to circumvent a bug in the latest versions (2023-09-26 and 
> 2024-01-08) of LMTX regarding math alignments, I am trying to get an older 
> version of LMTX (from before September 2023) for MacOS ARM. Does any one know 
> how to proceed?
> 
> Thanks in advance.
> Best regards: Otared
> ___
> 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
> ___

___
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: Do we have a geometry library for Metafun?

2024-01-13 Thread Gavin via ntg-context
Hi Shiv,

The author of tikz-euclide has another package, tikz-elements, which looks like 
it could be used to do all of these calculations for MetaFun.

The tikz-elements package, in spite of its name, appears to contain exactly one 
line of TikZ code. This line is in the very simple style file, 
tkz-elements.sty. Everything else is written in Lua. I think we could write a 
simple ConTeXt environment file that would replace tkz-elements.sty, making all 
of the tikz-elements package available for MetaFun rather than TikZ.

This would not give you the pretty drawing features of tikz-euclide, since 
those features really are written in TikZ. I do not know of a MetaPost package 
that does the same thing, but there might be one.

One pretty MetaPost drawing option is the byrne package by Sergey Slyusarev, 
which he used (with ConTeXt) to reproduce Oliver Byrne’s 1847 quirky edition on 
the first six books of Euclid’s “Elements”. All of the drawing is in MetaPost, 
and would work with MetaFun (I think). The LaTeX package is in TeX Live, and 
the ConTeXt version is at https://github.com/jemmybutton/byrne-euclid/.

Gavin


> On Jan 12, 2024, at 6:27 PM, Shiv Shankar Dayal  
> wrote:
> 
> 
> No library that I know of, but drawing tangents (and therefore, 
> perpendiculars) is straight-forward:
> 
>https://tex.stackexchange.com/a/108060/323
> 
> Circumcircle, orthocenter, etc... are you thinking of triangles or general 
> polynomails?
> 
> Triangles. I understand that most of it is very easy, but still a library 
> will help new users.
> Tikz has Tikz-Euclide and Asymptote has a Geometry package. A similar library 
> for Metafun
> will be very useful.
>  -- 
> Respect,
> Shiv Shankar Dayal
> ___
> 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
> ___

___
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: Do we have a geometry library for Metafun?

2024-01-12 Thread Gavin via ntg-context
Hi Shiv,

> Do we have a geometry library for common operations like finding tangents, 
> perpendiculars, circumcircle, orthocenters and such?

I don’t think we have anything like that specifically in the MetaFun world, but 
if there is a MetaPost package you like, you can use it with MetaFun. For 
example, the TeX Live installation includes both ConTeXt and 3dgeom.mp, so you 
should be able to use the 3dgeom package in MetaFun simply with "input 3dgeom" 
in your MetaPost code. (I did a quick check, successfully drawing a drawing a 
cube with 3dgeom. I have not tested it beyond than that.)

If there isn’t a MetaPost package for what you want, Lua may be useful for 
doing the calculations.

Gavin
___
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: Metapost docs

2024-01-11 Thread Gavin via ntg-context
Hi Shiv,

I am working with MetaPost in ConTeXt. Here are the resources I use, roughly in 
the order I search when trying to solve a problem.

- MetaFun Manual (http://www.pragma-ade.nl/general/manuals/metafun-p.pdf) This 
is most comprehensive and helpful source.
- MetaPost Manual (http://mirrors.ctan.org/systems/doc/metapost/mpman.pdf) This 
is not specific to ConTeXt, but it is very useful.
- The MetaFun page on the ConTeXt wiki 
(https://wiki.contextgarden.net/MetaFun_-_MetaPost_in_ConTeXt) Other pages in 
the wiki’s graphics area are also helpful. 
(https://wiki.contextgarden.net/Graphics) Searching the wiki for specific 
documentation on things like chemical structures is a little hit-or-miss, but 
often quite useful.
-The mailing list. I have the most luck with very specific questions that 
include a minimal working example. It should include the appropriate 
\starttext…\stoptext or \startMPpage…\stopMPpage, so that it can be typeset 
as-is.

If you want to do 3D, you may want to get Lua involved for calculations. I use

- Programming in LuaTeX page on the wiki 
(https://wiki.contextgarden.net/Programming_in_LuaTeX)
- Programming in Lua, 4th ed. 
by Roberto Ierusalimschy (https://www.amazon.com/gp/product/8590379868)

If you provide an example of what you hope to accomplish with MetaPost, we 
might have more specific recommendations. Below are two graphs that I made in 
TikZ, which I hope to convert to MetaPost (actually LMTX). These are from my 
chapter on elliptical orbits.

I hope that helps you get started.

Gavin



chapter07-t-b-8c929184fdcc9da93d1ffe5262fc9842.pdf
Description: Adobe PDF document


chapter07-t-b-613fffa20a4b3581222e7b521bef3ace.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 / 
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] Lua and inject.path to make a disconnected MetaPost path?

2024-01-08 Thread Gavin via ntg-context
Hello LuaMetaFun Fans,

Can I use mp.inject.path in Lua to create a disconnected path in MetaPost?

This is for my module that draws globes. I currently do something like this for 
drawing the continents. (This MWE has two triangular continents.)

\startluacode
  continents = {}
  continents[1] = {{0,0}, {-1,-1}, {-1,0}, cycle = true }
  continents[2] = {{0,1}, {1,0}, {1,-1}, cycle = true }
  function mp.getglobepath(continentnum)
mp.inject.path(continents[continentnum])
  end
\stopluacode

\startMPpage
  path p[], q ;
  p1 = (lua.mp.getglobepath(1) scaled 1cm) ;
  p2 = (lua.mp.getglobepath(2) scaled 1cm) ;
  q = p1 && p2 && cycle ;
  draw p1 withpen pencircle scaled 2pt withcolor .7 ;
  draw p2 withpen pencircle scaled 2pt withcolor .7 ;
  fill q withcolor 0.9 ;
  draw q withcolor red ;
\stopMPpage

The path q has both of the continents, disconnected.

I’d like to produce the two continents in Lua and pass them to MetaPost as a 
single disconnected path, using something like this: 

\startluacode
  continents = {
{0,0}, {-1,-1}, {-1,0}, — Change this to make a disconnected path!
{0,1}, {1,0}, {1,-1},
cycle = true }
  function mp.getglobepath()
mp.inject.path(continents)
  end
\stopluacode

\startMPpage
  path p ;
  p = (lua.mp.getglobepath() scaled 1cm) ;
  fill p withcolor 0.9 ;
  draw p withcolor red ;
\stopMPpage

If I can make the path p disconnected, this would allow me to make exactly the 
path I want in Lua, before passing it to MetaPost, rather than passing lots of 
paths and connecting them in MetaPost with the mysterious (to me) && or .

Thanks!
Gavin


___
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: MetaFun path joiners && and &&&& do not like single point paths

2023-12-31 Thread Gavin via ntg-context
Hi Hans and Mikael,

Thanks for your solutions. I’m happy to discard paths that have no area, so I 
used:

q = for i = 1 upto 3 :
  if (length(p[i]) > 1): p[i] && fi
endfor
cycle ;

This worked in the MWE, but it didn’t solve my problem in the globes module. 
Something else must be happening there. I’ll keep looking.

Gavin
___
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] MetaFun path joiners && and &&&& do not like single point paths

2023-12-30 Thread Gavin via ntg-context
Hi MetaFun fans,

Following a suggestion of Hans, I experimented with && and &&& and  for 
joining paths in MetaFun. The joiner &&& produces one long path, but && and 
 seem to produce a disconnected path which includes all the original paths. 
However, if one of the paths is a single point, then it connects it. MWE below.

I spotted this on my globes module, where we saw an extra line appear for a 
very specific orientation of the globe. I guessed that this orientation had an 
island right on the horizon, so that only one boundary point was visible, 
creating a singe point path for that island. I should probably fix my module so 
it doesn’t do that. However, it might be nice to have && and  deal with 
this situation gracefully.

Gavin


\startMPpage
 path p[], q ;
 p1 = fullcircle scaled 3cm ;
 p2 = fullcircle scaled 2cm shifted (3cm,0) ;
 p3 = (3cm,2cm) ;
 q = for i = 1 upto 3 :
p[i] &&
 endfor
 cycle ;
 draw p1 withpen pencircle scaled 2pt withcolor .7 ;
 draw p2 withpen pencircle scaled 2pt withcolor .7 ;
 draw p3 withpen pencircle scaled 2pt withcolor .7 ;
 draw q withcolor red ;
 eofill q withcolor 0.9 ;
 draw fullcircle scaled 6cm shifted (1.25cm,0) ;
\stopMPpage
___
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: Status of Asymptote

2023-12-30 Thread Gavin via ntg-context
Hi Shiv and Fabrice,

> On Dec 30, 2023, Shiv Shankar Dayal wrote:
> It would be nice to either support Metapost 3D or Asymptote.

> On Dec 6, 2021, Fabrice L wrote:
> I would be very interested to see an example of a Metafun drawing made with 
> the help of LuaTeX to speed up some calculations.

I made a module that draws 3D globes with MetaPost and Lua. This was my first 
step toward drawing general projections. If anyone would like to join this 
project, I’d love some help. The globes module is only about 300 lines of code, 
and most of the challenge was hiding paths and parts of paths that are on the 
back side of the globe. Anybody could get up to speed pretty quickly. (I am 
completely new to both MetaPost and Lua, so I tried to be very clear in my 
coding.)

My goal is a drawing process which starts with Lua tables containing data in 
arbitrary coordinates. The data could be any number of dimensions, and need not 
be rectangular. (For the globes the data is latitude and longitude points on 
the countries' boundaries.) The tables could be from an outside source (like 
the geographic data) or it could be calculated in Lua (for graphing functions 
or doing simulations).

Lua does all of the calculations to project this data down to two dimensional, 
rectangular coordinates. Lua then passes these two dimensional points, or paths 
made from them, to MetaPost. MetaPost uses the points and paths to draw dots, 
curves and areas, to place labels, etc. The only transformation performed by 
MetaPost is the final scaling for drawing everything on the page.

You can find the globe module on GitHub:

https://github.com/GavinPolhemus/luageo

I am relatively new to Git as well, so have patience if you start commenting or 
contributing there. I’ll learn fastest if there are collaborators!

Gavin
___
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: Seeking advice for module that draws globes

2023-12-19 Thread Gavin via ntg-context
Hi Hraban,

This was very helpful. I think I have everything organized according to TDS now.

> Have a look at
> https://wiki.contextgarden.net/Modules#Module_writing_guidelines
> … and please tell me, if you miss anything or find errors!

Regarding TDS, the wike page says:

> Sort these files into folders according to TDS (TeX directory structure) – 
> just have a look at the distribution to understand what goes where.

This was a dead end for me. I didn’t know where to look, or what to look for. I 
recommend adding these items, modified from your email:

> – Module code and data files go into tex/context/third/luageo
> – Documentation files go into doc/context/third/luageo

Those instructions were very easy to follow. Maybe you need to elaborate for 
more general cases, but that was everything I needed to know about TDS.

Pointing to a specific example, as you did in the email, is also helpful.

> Also look at the structure of other modules in the distribution, or e.g.
> https://codeberg.org/fiee/context-simpleslides


I haven’t learned to make wiki contributions myself yet. It is nearing the top 
of my to-do list.

Thanks!
Gavin
___
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: Seeking advice for module that draws globes

2023-12-18 Thread Gavin via ntg-context
Hi Hans,

> On Dec 18, 2023, at 3:12 AM, Hans Hagen via ntg-context  
> wrote:
> 
> about names:
> 
> how about
> 
> t-luageo.lmt
> t-luageo.mpxl
> 
> so that one knows what comes with the module (we do the same with s-* modules)

"t-luageo.lmt" is fine, but "t-luageo.mpxl" breaks the module. I think the line

\startMPdefinitions
   loadmodule "luageo" ;
\stopMPdefinitions

finds “mp-luageo” but not “t-luageo”. Changing the line to "loadmodule 
“t-luageo” does not work either.

> and you can add the example to the end of the module

Done.

> On Dec 18, 2023, at 3:08 AM, Hans Hagen via ntg-context  
> wrote:
> 
>> Also, we do have a strange artifact, at least when I run this code. There is 
>> a line running across Brazil:
>> 
> i'm not sure where that comes from (you can try &&&)


I will use &&& in my upcoming module, t-discoworld.

(Drawn with eofill, for maximum grooviness.)

Is there a place I can read about disconnected paths, , and &&&? These are 
totally unfamiliar to me.

Gavin___
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: Seeking advice for module that draws globes

2023-12-17 Thread Gavin via ntg-context
Hi Hans,

Thanks for all the suggestions! I am going through them carefully.

> - in mp you can do this
> 
> vardef theglobe(expr lat, lon) =
>for i = 1 upto lua.mp.makeglobe(lat, lon):
>(lua.mp.getglobepath(i)) 
>endfor
>cycle
> enddef ;

Does "" allow a disconnected path? I haven’t seen "" or a disconnected 
path before.

Also, we do have a strange artifact, at least when I run this code. There is a 
line running across Brazil:



I only got the line for (23,0), not for other latitude and longitude. I’m not 
sure what caused that. The code for cutting and mending paths that cross the 
horizon is tricky. I’m not sure how it will interact with "" and “cycle" 
connecting everything.

Gavin___
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] Seeking advice for module that draws globes

2023-12-17 Thread Gavin via ntg-context
Hello ConTeXters,

I wrote a little ConTeXt module for drawing globes. I would love some advice on 
how to improve it and share it. The code is quite short (about 250 lines). Most 
of the work is done by Lua, which reads the data files and calculates paths. 
These paths are passed to MetaFun, which draws the globe.

Below is an example document with the output. (I attached a small .png of the 
output for the mailing list. The output PDF has excessive detail.) The module 
(code and data) is on GitHub at https://github.com/GavinPolhemus/luageo.

\usemodule [luageo]
\startMPpage
GlobeDiameter = 10cm ;
fill fullcircle scaled GlobeDiameter withcolor .9white ;  % Fill a circle 
with the water color.
drawglobe(23, 0) scaled GlobeDiameter withcolor .75white ;% Draw the land, 
centered on the given latitude and longitude.
draw fullcircle scaled GlobeDiameter withcolor black ;% Add a border, 
if you want.
\stopMPpage



I am a novice at both Lua and MetaPost. I’m also new to Git and have never 
shared anything of substance with the ConTeXt community. (This barely counts as 
substantive, but I figure it’s best to start small.) I’m sure many of you could 
find opportunities for improvement with even a quick glance at the code. I 
welcome anything, from advice on performance to suggestions about the license. 
My most pressing questions are these:

1. How do I avoid redrawing diagrams with every typeset? The globe above takes 
about 0.7s, which is not bad, but it adds up in a book with many diagrams.

2. How do I organize this according to TDS for sharing? I know what TDS is and 
why it’s important, but that’s about it!

3. Should I be creating a namespace for this module, or launching a separate 
MetaFun instance? I have a general sense of what “namespace” and “instance” 
mean is this context, but I don’t know the consequences or the how-to.

I’d like to share this module, even though the potential demand is tiny, at 
best. I’m going through the Module Writing Guidelines 
(https://wiki.contextgarden.net/Modules#Module_writing_guidelines), but there 
is a lot that I don’t understand in those instructions. Questions 2 and 3 above 
relate to the instructions that are most mysterious to me. I think I can figure 
most of the others out.

I have been using ConTeXt for several years to write a high school physics 
textbook (along with the problem sets, tests, equations sheets, etc.). I wrote 
this module because I needed globes in some diagrams. I found an old MetaPost 
tool, mp-geo, that seemed to have the right ingredients, but I couldn’t get it 
to work, so I wrote my own tool using the data files from mp-geo. Hans and 
others on the list gave me valuable advice for these globes a couple years ago 
(and gave other valuable advice on all sorts of things before and since).

Many diagrams in my physics book use TikZ and pgfplots. I'd like to convert 
everything to MetaFun. I think the best way will be writing a few more modules 
for things like graphs (including polar and 3D plots), simple circuits, simple 
Feynman diagrams, etc. I’m hoping that these would be useful to the ConTeXt 
community. The luageo module has the basic design I’d like to use for the 
others: Lua for data handling and calculations, producing paths that are drawn 
by MetaFun. With some mentoring from the generous ConTeXt community, I’m hoping 
we can provide MetaFun alternatives to some of the TikZ libraries.

I have an alpha version of luagraph by Alan Braslau, which was helpful in 
designing luageo. Working on luagraph is my next project.

Gavin


___
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: Fractions

2023-12-10 Thread Gavin via ntg-context
Hello fraction fascinated friends,

> On Dec 10, 2023, at 5:24 AM, Henning Hraban Ramm  wrote:
> 
> Am 09.12.23 um 23:30 schrieb Mikael Sundqvist:
>> Hi,
>> On Sat, Dec 9, 2023 at 4:39 PM Wolfgang Schuster
>>  wrote:
>>> 
>>> Fabrice Couvreur schrieb am 09.12.2023 um 17:19:
>>> 
>>> Very clear !
>>> In typography for Mathematics books, what choice should we make for the 
>>> best possible result ?
>>> 
>>> A question better answered by Mikael or Aditya!
>> Thank you for your trust, Wolfgang. I am not sure I have something
>> valuable to say in addition to Adityas suggestion \frac{1/3} in inline
>> math. In any case, I attach a passage, with suggestions inspired by
>> Lansburgh's book (iin Swedish). Not sure the file size makes it
>> through to the list, though.
> 
> Thank you!
> 
> I usually only need simple inline fractions like 1/n, 1/2 or 3/8 in text.
> With these and \frac, the spacing below the numerator (depth) is too big, 
> while the denominator sticks too tightly to the fraction bar.
> (Of course I use regular numbers for fractions, not mediaeval.)
> 
> Usually I’d prefer “vulgar fractions”, but \vulgarfraction looks “horrible” 
> in comparison to the few usual fractions contained in fonts (like ½ & ¾).
> 
> I tried to use the OpenType fraction features to no avail.
> 
> So I’m still looking for “the best” solution for simple fractions inline.
> 
> Hraban

I also use fractions frequently, so I’ve tried a few things.

Some fonts have superior and inferior numbers that can be used to make small 
slash fractions. I’ve done this, but my method is not pretty. Hraban suggested 
using font features for this, but I haven’t learned how to do that. Any advice 
is welcome.

Example code below uses the Libertinus font, which has these superior and 
inferior numbers, to produce sample paragraph demonstrating a few options for 
fractions in text.

Gavin


\usetypescriptfile[libertinus]
\setupbodyfont [libertinus,11pt]%
\setupinterlinespace[line=3.1ex]

\define\fracone{\getnamedglyphdirect{libertinus}{onesuperior}} % 1
\define\fracthree{\getnamedglyphdirect{libertinus}{threesuperior}} % 3
\define\fracnine{\getnamedglyphdirect{libertinus}{ninesuperior}} % 9

\define\thirteenths{\textfraction\getnamedglyphdirect{libertinus}{oneinferior}\getnamedglyphdirect{libertinus}{threeinferior}}
 % /13

\define\onethirteenth{\text{\fracone\thirteenths}} % 1/13
\define\threethirteenths{\text{\fracthree\thirteenths}} % 3/13
\define\ninethirteenths{\text{\fracnine\thirteenths}} % 9/13

\starttext
Some small fractions are already available in many fonts, like \onehalf\ and 
\onethird. Others can be built using superior and inferior numbers in some 
fonts. This includes the fractions required to
find the normal and shearing stresses on an oblique plane defined by 
$l=\sqrt{\threethirteenths}$, $m=\sqrt{\onethirteenth}$, and 
$n=\sqrt{\ninethirteenths}$.
Of course, you could just find the normal and shearing stresses on an oblique 
plane defined by $l=\sqrt{3/13}$, $m=\sqrt{1/13}$, and $n=\sqrt{9/13}$.
Vulgar fractions are between these extremes.
Find the normal and shearing stresses on an oblique plane defined by 
$l=\sqrt{\vfrac{3}{13}}$, $m=\sqrt{\vfrac{1}{13}}$, and 
$n=\sqrt{\vfrac{9}{13}}$.
I included more text than strictly necessary in this example to demonstrate the 
effect on line spacing.
\stoptext
___
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
___


Re: [NTG-context] TikZ \shade broken

2023-06-26 Thread Gavin via ntg-context
Fixed in the latest. Thanks Hans!

> On Jun 19, 2023, at 5:57 AM, Gavin via ntg-context  wrote:
> 
> Hi Hans,
> 
>>> I am running into a problem with the \shade command... 
>>> tex error   > tex error on line 8 in file ./TikZtest.tex: Valid keyword 
>>> expected, likely 'direction'
>>>  \pgfsys@vertshading
>>> #1#2#3->{\pgf@parsefunc {#3}\pgfmathparse {#2}\setbox \pgfutil@tempboxa 
>>> =\hbox dir
>>> ...
>> luametatex doesn't have the dir keyword
>> 
>> (I could probably add it in a simplified form just for this purpose because 
>> the performance penalty is less now.)
> 
> If you have a chance to add a dir keyword, that would be great. Since the 
> keyword is used inside a TikZ macro, I don’t see any way I can work around it 
> in my document.
> 
> I am gradually converting my diagrams from TikZ to MetaFun, but with well 
> over a hundred diagrams in my current project, that’s going to take some time.
> 
> Thanks!
> Gavin
> 
> 
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
> ___

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

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


Re: [NTG-context] TikZ \shade broken

2023-06-19 Thread Gavin via ntg-context
Hi Hans,

>> I am running into a problem with the \shade command... 
>> tex error   > tex error on line 8 in file ./TikZtest.tex: Valid keyword 
>> expected, likely 'direction'
>>  \pgfsys@vertshading
>> #1#2#3->{\pgf@parsefunc {#3}\pgfmathparse {#2}\setbox \pgfutil@tempboxa 
>> =\hbox dir
>> ...
> luametatex doesn't have the dir keyword
> 
> (I could probably add it in a simplified form just for this purpose because 
> the performance penalty is less now.)

If you have a chance to add a dir keyword, that would be great. Since the 
keyword is used inside a TikZ macro, I don’t see any way I can work around it 
in my document.

I am gradually converting my diagrams from TikZ to MetaFun, but with well over 
a hundred diagrams in my current project, that’s going to take some time.

Thanks!
Gavin


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

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


[NTG-context] TikZ \shade broken

2023-06-17 Thread Gavin via ntg-context
Hi List,

First, a big thanks to Aditya for solving the missing pgfsys-luatex.def! That 
was a show-stopper on my Mac.

Now that I can use TikZ again, I am running into a problem with the \shade 
command. Below is a small working example from the TikZ manual [pp.39-41]. The 
first tikzpicture is the example. The second TikZ picture is similar, but 
without any shading.

\usemodule[tikz]
\starttext
\starttikzpicture  
\shade[top color=yellow,bottom color=black] (0,0) rectangle +(2,1);
\shade[left color=yellow,right color=black] (3,0) rectangle +(2,1);
\shadedraw[inner color=yellow,outer color=black,draw=yellow] (6,0) rectangle 
+(2,1);
\shade[ball color=green] (9,.5) circle (.5cm);
\stoptikzpicture
\starttikzpicture  
\draw[color=black] (0,0) rectangle +(2,1);
\fill[color=yellow] (3,0) rectangle +(2,1);
\filldraw[fill=black,draw =yellow] (6,0) rectangle +(2,1);
\fill[fill=green] (9,.5) circle (.5cm);
\stoptikzpicture
\stoptext
\stoptext

The second picture works. The first picture produces quite an error message 
(below). I’m using

ConTeXt  ver: 2023.06.01 09:42 LMTX  fmt: 2023.6.2

on an M1 Mac with Ventura 13.4

Any help would be greatly appreciated!

Gavin



tex error   > tex error on line 8 in file ./TikZtest.tex: Valid keyword 
expected, likely 'direction'

 \pgfsys@vertshading 
#1#2#3->{\pgf@parsefunc {#3}\pgfmathparse {#2}\setbox \pgfutil@tempboxa =\hbox 
dir 
TLT to\pgfmathresult pt{\vbox to\pgf@max {\vfil \pgfsys@invoke {/Sh sh}}\hfil 
}\pgf@process {\pgfpoint {#2}{\pgf@max }}\immediate \saveboxresource resources 
{/Shading 
 
...dafter \expandafter \def \expandafter \expandafter \expandafter \@@args 
\expandafter \expandafter \expandafter {\csname pgf@args\pgf@shadingname 
\endcsname }\expandafter \expandafter \expandafter \@temp \expandafter \@args 
\@@args 
\expandafter  ...
 \pgfutil@firstoftwo 
#1#2->#1
 
...r \expandafter \expandafter {\csname pgf@args\pgf@shadingname \endcsname 
}\expandafter \expandafter \expandafter \@temp \expandafter \@args \@@args 
\expandafter \pgfmath@smuggleone \csname \pgf@shadingxname \endcsname \endgroup 
}{}
\pgf@invokesh ...
 \pgfutil@secondoftwo 
#1#2->#2
 \pgfshadepath 
...e@cos }{0pt}{0pt}\pgfsys@transformcm {\pgf@sys@tonumber {\pgf@xc 
}}{0}{0}{\pgf@sys@tonumber {\pgf@yc }}{0pt}{0pt}\ifx \pgf@shade@extra@transform 
\pgfutil@empty \else \pgflowlevel {\pgf@shade@extra@transform }\fi 
\pgfuseshading {#1}
\pgfsys@endsc ...
...

 
\shade[top color=yellow,bottom color=black] (0,0) rectangle +(2,1);

1 % !TEX useAlternatePath
2 % !TEX useConTeXtSyncParser
3 
4 \usemodule[tikz]
5 
6 \starttext
7   \starttikzpicture  
8 >>  \shade[top color=yellow,bottom color=black] (0,0) rectangle +(2,1);
9 \shade[left color=yellow,right color=black] (3,0) rectangle +(2,1);
10 \shadedraw[inner color=yellow,outer color=black,draw=yellow] (6,0) 
rectangle +(2,1);
11 \shade[ball color=green] (9,.5) circle (.5cm);
12   \stoptikzpicture
13   \starttikzpicture  
14 \draw[color=black] (0,0) rectangle +(2,1);
15 \fill[color=yellow] (3,0) rectangle +(2,1);
16 \filldraw[fill=black,draw =yellow] (6,0) rectangle +(2,1);
17 \fill[fill=green] (9,.5) circle (.5cm);
18   \stoptikzpicture
You started a keyword but it seems to be an invalid one. The first character(s)
might give you a clue. You might want to quit unwanted lookahead with \relax.
mtx-context | fatal error: return code: 1

___
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] tikz + lmtx

2023-04-28 Thread Gavin via ntg-context
Hi fellow Tik-Z users,

Tik-Z, including circuitikz, is working for me after adding two files from Hans 
to a slightly older version of ConTeXt (ver: 2023.02.07 19:06 LMTX  fmt: 
2023.3.14). I do not know if these files are of any use with the current 
versions, but I am quoting a list email from January (including the files) just 
in case it helps anyone with the present problems.

Gavin


> Hi Hans, Fabrice, and List,
> 
> Now it is working for me. I had installed the new upload. I also needed to 
> put the two new files from Hans’ earlier email (m-tikz-pgfplots.tex and 
> m-tikz-pgfplotstable.tex) in the right spot 
> (tex/texmf-context/tex/context/modules/mkxl) and run "mtxrun --generate”. I’m 
> not sure if I was also supposed to put the third file from the earlier email 
> in this spot also, but I didn’t, and it works.
> 
> I am still getting some new errors in specific files, but I will spend some 
> time tracking down the source of those errors before starting a new thread. 
> That might be a while, because all of the things I need for my current work 
> are now working.
> 
> I’ve re-attached those two files from the earlier email from Hans so anyone 
> reading this doesn’t need to hunt for them.
> 
> Thanks for the fixes!
> 
> Gavin
> 
> 


m-tikz-pgfplots.tex
Description: Binary data


m-tikz-pgfplotstable.tex
Description: Binary data

___
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] Kaktovik numerals

2023-04-19 Thread Gavin via ntg-context
Hi Willi,

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

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

2) For the year conversion: 2023 = 5x20^2 + 1x20 + 3. (Your 0 should be my 1). 
This will give a three digit Kaktovik numeral. You have 4 digit Kaktovik 
numerals for 2023, with both a 0 and a 1.

Gavin


> On Apr 19, 2023, at 12:36 PM, Willi Egger via ntg-context 
>  wrote:
> 
> Hi all,
> 
> after playing around and watching YouTube the attached  composition is made…
> 
> Willi
> 
> 
>> On 18 Apr 2023, at 10:57, Henning Hraban Ramm via ntg-context 
>>  wrote:
>> 
>> I just came across this thread about the base-20 system of the Inuit people 
>> and the numerals invented for it in the 1990s:
>> https://mathstodon.xyz/@johncarlosbaez/110215432175491555
>> 
>> This makes simple calculations just beautiful.
>> 
>> Hraban
>> ___
>> If your question is of interest to others as well, please add an entry to 
>> the Wiki!
>> 
>> maillist : ntg-context@ntg.nl / 
>> https://www.ntg.nl/mailman/listinfo/ntg-context
>> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
>> archive  : https://bitbucket.org/phg/context-mirror/commits/
>> wiki : https://contextgarden.net
>> ___
> 
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
> ___

___
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] Nuclear reactions

2023-04-15 Thread Gavin via ntg-context
Hi List,

I am still interested in knowing if there is a good way to do nuclear reactions 
using \chemical. But I found something that works for my current needs:

\define[1]\Sr{\mathord{\rm Sr}__{38}^^{#1}}
\define[1]\Xe{\mathord{\rm Xe}__{54}^^{#1}}
\define[1]\U{\mathord{\rm U}__{92}^^{#1}}

\starttext
Reaction:
\startformula
  \U{235} + n \rightarrow \Sr{94} + \Xe{140} + 2n
\stopformula 
\stoptext

Since I will be writing many reactions with a dozen or so different atomic 
symbols, it makes sense to create a command for each atomic symbol that adds 
the correct atomic number and takes the mass number as an argument.

Hope someone else can benefit. I still getting used to ConTeXt's treatment of 
{…}, which does not appear to be TeX's way.

Gavin


> On Apr 15, 2023, at 11:19 AM, Gavin  wrote:
> 
> Hi list,
> 
> I’m writing nuclear reactions. When add prescripts to atomic symbols with two 
> letters, (Be, Sr, Xe, etc.) the prescripts split the atoms! (See output 
> below.) 
> 
> \starttext
> Text:   \lohi[left]{4}{10}Be.
> Reaction:
> \startformula
>  {\rm U}^^{235}__{92} + n \rightarrow {\rm Sr}^^{94}__{38} + {\rm 
> Xe}^^{140}__{54} + 2n
> \stopformula 
> \stoptext
> 
> I looked at \chemical and \molecule, but could not find a way to make 
> isotopes with those. Any ideas?
> 
> Gavin
> 
> 

___
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] Nuclear reactions

2023-04-15 Thread Gavin via ntg-context
Hi list,

I’m writing nuclear reactions. When add prescripts to atomic symbols with two 
letters, (Be, Sr, Xe, etc.) the prescripts split the atoms! (See output below.) 

\starttext
Text:   \lohi[left]{4}{10}Be.
Reaction:
\startformula
  {\rm U}^^{235}__{92} + n \rightarrow {\rm Sr}^^{94}__{38} + {\rm 
Xe}^^{140}__{54} + 2n
\stopformula 
\stoptext

I looked at \chemical and \molecule, but could not find a way to make isotopes 
with those. Any ideas?

Gavin



PastedGraphic-1.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 / 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] Feynman Diagrams

2023-04-12 Thread Gavin via ntg-context
Hi Aditya,

Thanks for the suggestions. I hadn’t thought to dig into the MetaPost produced 
when typesetting a LaTeX document.

> In principle, it should be easier to adapt the feynmp.mp (attached) code to 
> make it work with LMTX.

This sounds like a good summer project for me. I’ll be doing a lot of MetaPost 
this summer.

Gavin
___
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] Feynman Diagrams

2023-04-12 Thread Gavin via ntg-context
Hi Aditya,

> Have you tried using feynmp (the metapost macros) directly instead of the 
> LaTeX wrapper? Can you create an example that works with metapost but fails 
> in ConTeXt?

No, I’m not sure how to do that. I looked at the manual, and it has some 
examples where new styles are written in MetaPost, but every diagram is drawn 
with the LaTeX wrapper. I looked in the source files, and maybe feynmf.dtx has 
everything to produce documentation for the MetaPost macros, but if so, I’m not 
sure how to generate that documentation.

Can you point me to an example that works with metapost macros directly?

Gavin

___
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] Feynman Diagrams

2023-04-12 Thread Gavin via ntg-context
Hi Hans, Alan, Mikael, and other Feynman fans,

I do think Alan's node module could do a good job with this.

>  It would be nice to have a not too complicated syntax, but maybe just have 
> some of the
> "shapes" of paths available. So, which ones are actually needed?

I think the needed shapes are:
 - dashed or dotted paths already built into MetaPost
 - paths that are wiggly, zig-zag or coiled
 - optional arrows on the paths
 - optional dots or blobs at the connecting points

This is plenty for someone doing Standard Model physics. Model builders doing 
supersymmetric, walking-technicolor, bla-bla need more, of course, but I’d let 
them program their own shapes.

The package feynMP already has all of these paths, as well as double-line 
variants, coded in MetaPost. If I could use feynMP with ConTeXt, that’s what 
I’d do. It produces very nice diagrams.

Gavin
___
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] Feynman Diagrams

2023-04-11 Thread Gavin via ntg-context
Hi List,

I’m looking for a way to include Feynman diagrams in my ConTeXt documents. I’ve 
used feynMF/feynMP and TikZ-feynman with LaTeX in the past, but it doesn’t look 
like either works directly with ConTeXt. My diagrams are pretty basic (example 
below). Does anyone have a ConTeXt solution they like? If not, I’ll add it to 
my list of summer MetaPost projects.

Thanks!
Gavin



PastedGraphic-1.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 / 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] Spacing problem around decimal point

2023-03-28 Thread Gavin via ntg-context
Hi Hans, Jim, Bruce, et.al.

Han’s asked me

> can you pick up a binary from:
> 
> https://dl.contextgarden.net/build/luametatex/work/
> 
> and test it?

Maybe. I picked up the binary, but testing it is not quite as easy as it might 
be due to the MacOS security settings. I’ll see what I can do, but I know very 
little about Unix/Darwin.

Since this appears to be an issue across multiple platforms, I’d welcome anyone 
else checking the new binary. (Thanks, Günter!)

Best,
Gavin
___
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] \definemathfence broken in latest

2023-03-25 Thread Gavin via ntg-context
Hi List,

The command \definemathfence seems to not be working as it did in other recent 
LMTX. MWE:

\definemathfence[abs][bar][command=yes]

\starttext
\startformula
\abs{v} = \frac{1.32}{1.41} = 0.935
\stopformula
\stoptext

This causes an error, complaining that \abs is undefined. However, workes fine 
with

ConTeXt  ver: 2023.02.07 19:06 LMTX  fmt: 2023.3.14  int: english/english

Should I be doing this differently?

Gavin
___
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] Spacing problem around decimal point

2023-03-25 Thread Gavin via ntg-context
Hi List,

I’m getting strange spaces around some decimal points after a clean LMTX 
install. MWE:

\starttext
\startformula
v = \frac{1.32}{1.41} = 0.935
\stopformula
\stoptext

This produces the result attached below. The 1.32 looks fine, but the next two 
numbers have excess space around the decimal point. Adding the line

  \showmakeup[mathglue] %\mathspacingmode=1

to the preamble reveals that the second and third decimal points are being 
treated as binary operators. It’s very strang. Are others getting this?

Gavin




PastedGraphic-1.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 / 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] \unit parser ignoring case, in some cases.

2023-03-14 Thread Gavin via ntg-context
On Mar 14, 2023, at 3:32 PM, Hans Hagen via ntg-context  
wrote:
> On 3/14/2023 7:14 PM, Alan Braslau via ntg-context wrote:
>> On Tue, 14 Mar 2023 12:03:23 -0600
>> Gavin  wrote:
>>> I’d really like one of the acceptable forms to be the form prescribed
>>> by Le Système international d'unités
> 
> Maybe the french title is one of the reasons for the USA not picking up on 
> these units? (So let me threaten once again to kick the "in" unit out of 
> context.)
> 
>> I believe that this point is essential,….

Alan and I will come up with a scheme that fastidiously follows the SI, and 
release it as a “North American localization.” That should leave everyone 
sufficiently puzzled, annoyed, or amused.

Signing off of this subject until 27 May. Thanks for all your help!

Gavin
___
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] \unit parser ignoring case, in some cases.

2023-03-14 Thread Gavin via ntg-context
On Mar 14, 2023, at 10:08 AM, Alan Braslau via ntg-context  
wrote:
> Right now, \unit{1 mm-1} and \unit{1 m m-1} give the same result:
> inverse millimeters (whereas the second should be m•m^{-1}…)
> 
> Alan

Alan,

I’d like to better understand how the \unit{} command works and why those 
choices were made. Some of the choices seem to be “asking for troubles,” but 
perhaps they are essential for some users.

I’m happy to have the unit command accept a variety of different forms for the 
unit, but I’d really like one of the acceptable forms to be the form prescribed 
by Le Système international d'unités, so that “m s” is a meter second and “ms” 
is a millisecond. However, I’m not sure if this goal conflicts with other 
important goals.

Would you like to explore \unit{} this summer to see if we can find a 
consistent solution? Perhaps we can produce a plan for \unit{} that does not 
conflict with other \unit{} features, or perhaps we can make a module that 
lacks some of the features of \unit{} but conforms to the SI for input as well 
as output. I would be happy with either.

I’d also like to work on the luagraph module this summer. I’m getting a lot 
better at MetaPost programming!

I can’t approach either issue in a comprehensive way until the summer, because 
I have a lot of content to produce for our physics class. This year we kept on 
schedule – for the first time ever! – and that means we will be studying a 
couple of topics that I haven’t prepared yet. 

Obviously, anyone else interested in \unit{} or luagraph would be welcome to 
join us, either remotely or here in sunny Fort Collins, Colorado. (School ends 
here on May 26.)

Gavin
___
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] \unit parser ignoring case, in some cases.

2023-03-14 Thread Gavin via ntg-context
I wrote 

> Perhaps we could use a \registershortcut command that does not get the 
> “lower" treatment.

without seeing that Hans had already read my mind and provided:

\registerunitshortcut
[unit]
[C=coulomb]

That should work great.

Thanks!
Gavin
___
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] \unit parser ignoring case, in some cases.

2023-03-14 Thread Gavin via ntg-context

Hi Alan, Hans, and List,

> On Mar 13, 2023, at 8:10 PM, Alan Braslau via ntg-context 
>  wrote:
> On Mon, 13 Mar 2023 15:55:50 -0600 Gavin via ntg-context  
> wrote:
>>> you can look at phys-dim and see plenty of short and long keys and
>>> making all case insensitive is asking for troubles  
>> 
>> Indeed, I would like to make NONE of them case insensitive. But
>> currently, when I register an upper case key (C=coulomb) it messes up
>> the lower case prefix (“cm" gets typeset as C•m). I was expecting the
>> parser to distinguish between the “C” and “c”, but it doesn’t. Is
>> that intended?
> 
> Indeed, \unit{} should allow (and presently does not) K, C, etc.

I agree. I added the following lines to phys-dim.lua, following line 461

C  = "coulomb",
K  = "kelvin",
N  = "newton",

This provided the desired capital shortcuts without compromising the lowercase 
prefixes. Hans, could we get those added to phys-dim.lua in the distribution? I 
would be happy to do a more comprehensive search for shortcuts to add, but 
those are the three I and my collaborators are using now.

Looking at why my \registerunit attempt failed, I found that when you register 
a unit, both your capitalization, and an all lowercase version are registered. 
Here is an example, where I register “ReTeM” but \unit{1 retem} also works.

\starttext

\registerunit[unit][ReTeM=myunit]
\setupunittext[myunit=reTeM]

\startformula
  \unit{1 ReTeM} = \unit{1 retem} \neq \unit{1 reteM}
\stopformula

\stoptext

The results are case sensitive, so \unit{1 reteM} does not work. The lowercase 
version is produced for all “long” units, but not for shortcuts. (See 
phys-dim.lua, lines 766-771 where the Lua string function “lower” is used.) 
Perhaps we could use a \registershortcut command that does not get the “lower" 
treatment. I will look into it some more.

Thanks!
Gavin


P.S. I think there is a spelling error in phys-dim.lua, lines 974-981.

local mapping = {
prefix   = "prefixes",
unit = "units",
operator = "operators",
suffixe  = "suffixes",
symbol   = "symbols",
packaged = "packaged",
}

The key “suffixe” should probably be “suffix”.

___
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] \unit parser ignoring case, in some cases.

2023-03-13 Thread Gavin via ntg-context


> On Mar 13, 2023, at 3:44 PM, Hans Hagen via ntg-context  
> wrote:
> 
> On 3/9/2023 2:04 PM, Gavin via ntg-context wrote:
>> \startformula
>>   \unit{3 meter} \qquad
>>   \unit{6 Meter} \qquad
>>   \unit{3 mEtEr} \qquad
>> \stopformula
>> Units with lowercase prefixes (c, k, n).
>> \startformula
>>   \unit{3cm} \qquad
>>   \unit{6kg} \qquad
>>   \unit{3ns} \qquad
>> \stopformula
>> Units with capital letters, called with names (coulomb, kelvin, newton).
>> \startformula
>>   \unit{3 coulomb} \qquad
>>   \unit{6 kelvin} \qquad
>>   \unit{3 newton} \qquad
>> \stopformula
> 
> you can look at phys-dim and see plenty of short and long keys and making all 
> case insensitive is asking for troubles

Indeed, I would like to make NONE of them case insensitive. But currently, when 
I register an upper case key (C=coulomb) it messes up the lower case prefix 
(“cm" gets typeset as C•m). I was expecting the parser to distinguish between 
the “C” and “c”, but it doesn’t. Is that intended?

Gavin
___
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] \unit parser ignoring case, in some cases.

2023-03-09 Thread Gavin via ntg-context
Hello list,

I continue to work with the \unit command, and found some behavior very 
surprising. When I try to register units with capital letter names, it breaks 
lowercase metric prefixes. For example, registering C=coulomb, K=kelvin and 
N=newton breaks metric units cm, kg, and ns. The file below demonstrates the 
behavior.

Obviously, I can use full names in my document. However, I would like the 
standard SI symbols, which are single capital letters, to work for me and my 
less TeX-savvy colaborators.

Thanks!
Gavin


\starttext

Units does not completely ignore case.

\startformula
  \unit{3 meter} \qquad
  \unit{6 Meter} \qquad
  \unit{3 mEtEr} \qquad
\stopformula

Units with lowercase prefixes (c, k, n).
\startformula
  \unit{3cm} \qquad
  \unit{6kg} \qquad
  \unit{3ns} \qquad
\stopformula

Units with capital letters, called with names (coulomb, kelvin, newton).
\startformula
  \unit{3 coulomb} \qquad
  \unit{6 kelvin} \qquad
  \unit{3 newton} \qquad
\stopformula

Units with capital letters, called with the capital letter (C, K, N) fail.
\startformula
  \unit{3 C} \qquad
  \unit{6 K} \qquad
  \unit{3 N} \qquad
\stopformula

Now I register some units with capital letter names: C=coulomb, K=kelvin, 
N=newton.

\registerunit[unit][
  C=coulomb,
  K=kelvin,
  N=newton]

Units called by capital letter (C, K, N) now work.
\startformula
  \unit{3 C} \qquad
  \unit{6 K} \qquad
  \unit{3 N} \qquad
\stopformula

However, units with lowercase prefixes (c, k, n) are broken.
\startformula
  \unit{3cm} \qquad
  \unit{6kg} \qquad
  \unit{3ns} \qquad
\stopformula

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

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


Re: [NTG-context] regular online meet-up

2023-02-08 Thread Gavin via ntg-context
Hi List,

I will attempt to join the online meet-up today. I'm in Fort Collins, Colorado, 
so you might notice some lag in my interactions. (And if I’m still in my 
pajamas, I have a good excuse.) I’d like to meet some other members of the 
ConTeXt community.

If there is time in the discussion, I’d love to hear some about what 
\mathboxanchored and friends are doing behind the scenes.  I am using it for 
angular momentum diagrams in formulas, as shown in the attachment below. I’ve 
written my own replacement for \connectboxanchors to get some of the 
connections, but for diagrams involving more than two symbols, it’s getting a 
little crazy. If I understood more about how the system works, I think I could 
integrate MetaPost code more elegantly to do the drawing. 

Looking forward to seeing you!
Gavin



AnchorsEverywhere.pdf
Description: Adobe PDF document


> On Feb 8, 2023, at 2:15 AM, Henning Hraban Ramm via ntg-context 
>  wrote:
> 
> Reminder: that’s in a few hours.
> See you later!
> 
> Am 03.02.23 um 08:19 schrieb Henning Hraban Ramm via ntg-context:
>> You’re invited to join on Wednesday, February 8th, 15:00 CET (UTC+1)
>> at https://lecture.senfcall.de/hen-rbr-rku-oke
>> (same, but shorter: https://v34h.de/ctxmtg)
>> ConTeXt users of all levels are welcome!
>> Next meeting will be on March 8th.
>> (Same blurb as every time:)
>> [Howto]
>> * No special software installation required; most modern browsers should 
>> work (WebRTC required).
>> * Open the above URL, accept the privacy statement,
>> * enter your name,
>> * click "join" (or "start" if you’re the first),
>> * click "with microphone", allow your browser to access it, check the audio.
>> * Your microphone is muted if you join. Activate microphone and/or camera 
>> with the buttons at the bottom.
>> * Minimize the default presentation with the "screen" button, bottom right.
>> * If you’d like to share your screen or upload a file, you can make yourself 
>> the presenter: Click on your user name, change the setting, then you’ll see 
>> the "screen sharing" button beside the camera button; also there’s now 
>> "manage presentations" behind the "plus" button.
>> Beware there is only one presenter at a time, so don’t kill someone else’s 
>> presentation.
>> [Technical hints]
>> * Sound is usually better if you use a headset (less noise for everyone).
>> * Connection problems are mostly due to low bandwidth or high latency on 
>> your side, e.g. with mobile connections.
>> * If audio/video doesn’t work for you, you can still use the text chat.
>> * Screen sharing needs a lot of bandwidth.
>> * BigBlueButton documentation applies: 
>> https://bigbluebutton.org/teachers/tutorials/
>> [Netiquette]
>> * Please use a name that we recognize from here. Some feel uncomfortable 
>> with anonymous lurkers.
>> * Mute your microphone while you’re not talking.
>> * It’s nice to show your face at least when you join.
>> * If there are connection problems, stop camera sharing.
>> * The room is set to “everyone’s a moderator“, I trust you...
>> See you, Hraban
>> ___
>> If your question is of interest to others as well, please add an entry to 
>> the Wiki!
>> maillist : ntg-context@ntg.nl / 
>> https://www.ntg.nl/mailman/listinfo/ntg-context
>> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
>> archive  : https://bitbucket.org/phg/context-mirror/commits/
>> wiki : https://contextgarden.net
>> ___
> 
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
> ___

___
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] Problem with latest version ?

2023-01-07 Thread Gavin via ntg-context
Hi Hans, Fabrice, and List,

Now it is working for me. I had installed the new upload. I also needed to put 
the two new files from Hans’ earlier email (m-tikz-pgfplots.tex and 
m-tikz-pgfplotstable.tex) in the right spot 
(tex/texmf-context/tex/context/modules/mkxl) and run "mtxrun --generate”. I’m 
not sure if I was also supposed to put the third file from the earlier email in 
this spot also, but I didn’t, and it works.

I am still getting some new errors in specific files, but I will spend some 
time tracking down the source of those errors before starting a new thread. 
That might be a while, because all of the things I need for my current work are 
now working.

I’ve re-attached those two files from the earlier email from Hans so anyone 
reading this doesn’t need to hunt for them.

Thanks for the fixes!

Gavin




m-tikz-pgfplots.tex
Description: Binary data


m-tikz-pgfplotstable.tex
Description: Binary data


> On Jan 6, 2023, at 9:09 AM, Fabrice Couvreur via ntg-context 
>  wrote:
> 
> Hi,
> From my side, after the last update, it works.
> Thank you Hans.
> Fabrice
> 
> Le ven. 6 janv. 2023 à 14:17, Gavin via ntg-context  a 
> écrit :
> Hi Hans,
> 
> > On Jan 5, 2023, at 5:49 AM, Hans Hagen via ntg-context  
> > wrote:
> > On 1/5/2023 11:40 AM, Gavin via ntg-context wrote:
> >> ...I can try with the latest LMTX later today. The test file works with 
> >> TeXLive 2022
> >> Gavin
> >> TEST FILE:
> >> \usemodule[tikz]
> >> \usemodule[pgfplots] % PGFPlots module for graphs
> >> \starttext
> >> \starttikzpicture
> >> \draw (0, 0) circle (3cm);
> >> \stoptikzpicture
> >> \starttikzpicture
> >>  \startaxis
> >>\addplot+[domain=0:360]
> >>{sin(x)};
> >>  \stopaxis
> >> \stoptikzpicture
> >> \stoptext
> > fixed in next upload (later today)
> 
> I downloaded yesterday's upload. It did not work for me. I did a clean instal.
> 
> ConTeXt  ver: 2023.01.04 11:35 LMTX  fmt: 2023.1.6  int: english/english
> ...
> tex error on line 14 in file ./TikZTest.tex: Control sequence expected 
> instead of undefined
>  
>\startaxis 
>  
>  \startaxis
> 
> 
> -Gavin
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
> ___
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
> ___

___
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] MP figure continuation

2023-01-06 Thread Gavin via ntg-context
Hi Alex,

> Is there a way to "continue" an MP figure? Like keeping the axes, etc. and 
> just adding code to the figure?

Buffers might be what you want. From the MetaFun manual:

> Buffers can be used to stepwise build graphics. By putting code in multiple 
> buffers, you can selectively process this code. [p.124]

http://www.pragma-ade.nl/general/manuals/metafun-p.pdf

Hope that helps.

Gavin
___
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] Problem with latest version ?

2023-01-06 Thread Gavin via ntg-context
Hi Hans,

> On Jan 5, 2023, at 5:49 AM, Hans Hagen via ntg-context  
> wrote:
> On 1/5/2023 11:40 AM, Gavin via ntg-context wrote:
>> ...I can try with the latest LMTX later today. The test file works with 
>> TeXLive 2022
>> Gavin
>> TEST FILE:
>> \usemodule[tikz]
>> \usemodule[pgfplots] % PGFPlots module for graphs
>> \starttext
>> \starttikzpicture
>> \draw (0, 0) circle (3cm);
>> \stoptikzpicture
>> \starttikzpicture
>>  \startaxis
>>\addplot+[domain=0:360]
>>{sin(x)};
>>  \stopaxis
>> \stoptikzpicture
>> \stoptext
> fixed in next upload (later today)

I downloaded yesterday's upload. It did not work for me. I did a clean instal.

ConTeXt  ver: 2023.01.04 11:35 LMTX  fmt: 2023.1.6  int: english/english
...
tex error on line 14 in file ./TikZTest.tex: Control sequence expected instead 
of undefined
 
   \startaxis 
 
 \startaxis


-Gavin
___
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] Problem with latest version ?

2023-01-05 Thread Gavin via ntg-context
Hi Hans,

> On Jan 5, 2023, at 12:39 AM, Hans Hagen via ntg-context  
> wrote:
> 
> On 1/5/2023 2:40 AM, Gavin via ntg-context wrote:
>> Hi List,
>> I could not figure out the right spot for the files m-tikz-pgfplots.tex and 
>> m-tikz-pgfplotstable.tex. I don’t currently have files with those names 
>> anywhere, and files with similar names and contents appear in a couple 
>> different places. I had to put off sorting it out until I had some more time.
>> I was able to find the right place for m-tikz.mkxl, and it prevented an 
>> error at \usemodule[pgfplots], but I’d still get an error if I tried to use 
>> any command from the pgfplots.
> indeed they go alongside the m-tikz file ... did you run mtxrun --generate?

Now I put the files alongside and ran mtxrun —generate. It did not work. The 
test file and resulting error are below. I used ConTeXt  ver: 2022.12.29 14:32 
LMTX  fmt: 2022.12.29  int: english/english. I can try with the latest LMTX 
later today. The test file works with TeXLive 2022

Gavin


TEST FILE:

\usemodule[tikz]
\usemodule[pgfplots]% PGFPlots module for graphs

\starttext

\starttikzpicture
\draw (0, 0) circle (3cm);
\stoptikzpicture

\starttikzpicture
  \startaxis
\addplot+[domain=0:360]
{sin(x)};
  \stopaxis
\stoptikzpicture

\stoptext


ERROR:

tex error   > tex error on line 15 in file ./TikZTest.tex: Illegal unit of 
measure (pt inserted)

 

\relax 
 \pgfpl@@ 
#1->\advance \count 0 by-1\relax 
\ifnum \count 0=-1\relax \global \def \pgfplotslistselect@tmp {\def 
\pgfplotsretval {#1}}\fi 
 \pgfpl@@ 
\pgfpl@@ {blue,every mark/.append style={fill=blue!80!black},mark=*}
\pgfpl@@ {red,every mark/.append 
style={fill=red!80!black},mark=square*}\pgfpl@@ {brown!60!black,every 
mark/.append style={fill=brown!80!black},mark=otimes*}\pgfpl@@ {black,mark=star
 \pgfplotslistselect@ 
#1\of #2\to #3->\begingroup \count 0=#1\relax \long \def \pgfpl@@ 
##1{\advance \count 0 by-1\relax \ifnum \count 0=-1\relax \global \def 
\pgfplotslistselect@tmp {\def #3{##1}}\fi }#2
\endgroup \pgfplotslistselect@tmp 
 \pgfplots@getautoplotspec@ 
#1#2#3->\ifnum #2=0 \let \pgfplotsretval =\pgfutil@empty \else 
\pgfplotsmathmodint {#3}{#2}\pgfplotslistselect \pgfmathresult \of #1\to 
\pgfplotsretval 
\fi 
 \pgfplots@getautoplotspec 
...ternal error: expected 'L' or 'M', not 
'\pgfplots@cycle@multi@list@sequence '}\fi \fi \else \pgfplotslistsize 
\autoplotspeclist \to \c@pgf@countd \pgfplots@getautoplotspec@ 
{\autoplotspeclist }{\c@pgf@countd }{\pgfplots@listindex }
\let #1=\pgfp ...
 ...

 
\addplot+
[domain=0:360]

 5 \usemodule[pgfplots] % PGFPlots module for graphs
 6 
 7 \starttext
 8 
 9 \starttikzpicture
10  \draw (0, 0) circle (3cm);
11 \stoptikzpicture
12 
13 \starttikzpicture
14   \startaxis
15 >>  \addplot+[domain=0:360]
16 {sin(x)};
17   \stopaxis
18 \stoptikzpicture
19 
20 \stoptext

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

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


Re: [NTG-context] Problem with latest version ?

2023-01-04 Thread Gavin via ntg-context
Hi List,

I could not figure out the right spot for the files m-tikz-pgfplots.tex and 
m-tikz-pgfplotstable.tex. I don’t currently have files with those names 
anywhere, and files with similar names and contents appear in a couple 
different places. I had to put off sorting it out until I had some more time.

I was able to find the right place for m-tikz.mkxl, and it prevented an error 
at \usemodule[pgfplots], but I’d still get an error if I tried to use any 
command from the pgfplots.

Gavin


> On Jan 4, 2023, at 4:22 PM, Hans Hagen via ntg-context  
> wrote:
> 
> On 1/4/2023 7:05 PM, Henning Hraban Ramm via ntg-context wrote:
>> Am 04.01.23 um 19:00 schrieb Fabrice Couvreur via ntg-context:
>>> The problem seems to come from pgfplots ...
>> There was a message about the same by Gavin and an answer by Hans on 
>> 2022-12-30. Maybe the fix didn’t make it into the latest upload.
> no news from gavin so ... not added yet
> 
> 
> -
>  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
> ___

___
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] pgfplots module wrecks in latest

2022-12-29 Thread Gavin via ntg-context
Hi List,

The TikZ related module “pgfplots” is causing a fatal error in the latest 
ConTeXt. Here is a MWE:


\usemodule[tikz]
\usemodule[pgfplots]% PGFPlots module for graphs

\starttext

\starttikzpicture
\draw (0, 0) circle (3cm);
\stoptikzpicture

\stoptext


Without loading the pgfplots module, this draws a circle. With the 
\usemodule[pgfplots] line, this has the error below before doing anything.

I don’t know when this started happening, because I don’t use pgfplots often, 
but it was probably in the last couple months.

Thanks for all the great updates!

Gavin




tex error   > tex error on line 521 in file pgfplots.code.tex: Use of 
\pgfplots@command@to@string@@ doesn't match its definition

 
m
acro:colormap
 
\pgfplots@colormap@catcodemagic 
 \pgfplots@command@to@string 
#1#2->\expandafter \pgfplots@command@to@string@@ \meaning #1
\pgfplots@EOI {#2}
 

\pgfplots@command@to@string\pgfplots@colormap@catcodemagic\pgfplots@colormap@catcodemagic


If you say, e.g., '\def\a1{...}', then you must always put '1' after '\a',
since control sequence names are made up of letters only. The macro here has not
been followed by the required stuff, so I'm ignoring it.
___
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] Unconnected \mathboxanchored produces unexpected results

2022-12-22 Thread Gavin via ntg-context
Hi Hans,

> can you try the latest binary fron the farm (remake th eformat)

I haven’t done that before, so I don’t know. I’d certainly need a link, and I 
might need some guidance if I run into trouble. I’m happy to try.

Gavin
___
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] Unconnected \mathboxanchored produces unexpected results

2022-12-22 Thread Gavin via ntg-context
Hi Hans, MIkael and list,

I got an unexpected result when I asked for a \mathboxanchored, but then did 
not use it with a connector. I expected the \mathboxanchored contents to be 
typeset as usual, without a connector. Instead I got “ ::: c3” added into the 
formula (“c3” was the anchor’s tag).

MWE and unexpected output below.

Thanks,
Gavin


\starttext

\startboxanchoring[+]
\connectboxanchors[top][top][distance=1ex,arrow=no] {c1}{c2}
%\connectboxanchors[bottom] [bottom] [distance=1ex,arrow=no] {c2}{c3} % <-- I 
decided not to use this connector, producing unexpected results.
\startformula
\mathboxanchored[nucleus]{c1}{e}^{\dot\alpha}
\mathboxanchored[nucleus]{c2}{e}_{\mu}
\mathboxanchored[nucleus]{c3}{e}^{\beta} = \frac{1}{\sqrt{2}}
\bar\sigma^{\dot\alpha\beta}_{\mu}
\stopformula
\stopboxanchoring

\stoptext



anchors-002-copy.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 / 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] Accent wrecking \mathboxanchored

2022-12-22 Thread Gavin via ntg-context
Hi Hans, Mikael and list,

I’ve been testing the connectors, which work great with the latest upload. One 
problem I found: an accent in the \mathboxanchored causes a "Missing number, 
treated as zero” error and no output. MWE below.

Thanks for all of the improvements. I’m making all kinds of connections!
Gavin


\starttext

\startboxanchoring[+]
\connectboxanchors[top][top][distance=1ex,arrow=no] {c1}{c2}
\connectboxanchors[bottom] [bottom] [distance=1ex,arrow=no] {c2}{c3}
\startformula
\mathboxanchored[nucleus]{c1}{e}^{\dot\alpha}
%\mathboxanchored[nucleus]{c2}{e}_{\mu}% <-- This works, without 
accent
%\mathboxanchored[nucleus]{c2}{\bar{e}}_{\mu} % <-- This does not work, 
with accent
\bar{\mathboxanchored[nucleus]{c2}{e}}_{\mu} % <-- This works, but 
connector punches through accent
\mathboxanchored[nucleus]{c3}{e}^{\beta} = \frac{1}{\sqrt{2}}
\bar\sigma^{\dot\alpha\beta}_{\mu}
\stopformula
\stopboxanchoring

\stoptext

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

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


Re: [NTG-context] Mathematical MetaFun Mania

2022-12-21 Thread Gavin via ntg-context
Hi Alexandre and Hans,

I also get no connectors drawn when I typeset Hans’s example file, anchors-002, 
using, ConTeXt  ver: 2022.12.15 18:12 LMTX  fmt: 2022.12.21, on my M1 Mac. Same 
error regarding anch_box_arrows_draw.

The file works fine with ConTeXt  ver: 2022.12.07 20:24 LMTX  fmt: 2022.12.7, 
except for the new cross page feature.

Gavin


> On Dec 18, 2022, at 4:03 AM, Alexandre Christe via ntg-context 
>  wrote:
> 
> Hi Hans,
> 
> On osx-64 I'm not getting a single connector printed when compiling 
> anchor-002.tex. I've attached the log in case. Am I doing something wrong on 
> my end?
> 
> Le ven. 16 déc. 2022 à 17:56, Hans Hagen via ntg-context  
> a écrit :
> On 12/15/2022 10:54 PM, Otared Kavian via ntg-context wrote:
> > Hi Hans,
> > 
> > Thanks for the new release and the nice anchoring features.
> > 
> > I played a little bit with these, and noticed some issues: in the following 
> > example, linking the bottom bounds of the integral signs is fine (as long 
> > as numbers are put there), but for the upper bounds, the \infty and \pi/2 
> > are not accepted (nor is any letter or greek symbol), but if one replaces 
> > \infty and \pi/2 with numbers, then the link between the upper bounds is 
> > shown. (In this example the links are invading the text, but probably this 
> > is due to the fact that I just copied the Metapost snippet you sent to 
> > Gavin).
> you can pick up a binary with a safeguard from
> 
> https://build.contextgarden.net/#/waterfall?tags=c.luametatex
> 
> (or compile one yourself from work)
> 
> Hans
> 
> 
> -
>Hans Hagen | PRAGMA ADE
>Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
> tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -
> 
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
> ___
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
> ___

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

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


Re: [NTG-context] Mathematical MetaFun Mania

2022-12-15 Thread Gavin via ntg-context
Hi Hans and List,

>> 2) Can I tell \connectboxanchors to use my MetaPost code and pass key=value 
>> pairs like I do with \setMPpositiongraphic?
> see attached ... the 'cross pages' feature is in the upcoming

This indeed passes key=value pairs, but I cannot get it to pass mine. Is there 
some intermediate step? Your example has a key=value pair in \connectboxanchors 
and which is accessed in the MetaPost code. The pair, and MetaPost code are:

  rulethickness=1pt
  mpvard “rulethickness"

However, if I change the pair and MPcode to (see attached example for full code)

  myrulethickness=1pt
  mpvard “myrulethickness"

it doesn’t work. Similarly, you have a pair and MPcode that don’t match.

  rulecolor=darkgreen
  mpvars "linecolor"

This may be a historical fluke, but it suggests that there is some intermediate 
translation that I am missing. Any way I can name and pass by own key=value 
pairs?

Thanks!
Gavin



mpvarQuestion.tex
Description: Binary data
___
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] Mathematical MetaFun Mania

2022-12-14 Thread Gavin via ntg-context
Hello MetaFun Math Lovers,

I am using MetaFun to attach diagrams to formulas. Both the physics and the 
typesetting are going great! I attached a sample below, to give a taste of what 
I am trying to do. This page of actual calculations has examples of almost 
everything I need. It’s a lot, but it is all working. Right now the interface 
is terrible, but effective. Thanks to Hans and Mikael for many helpful hints!

I am still using \hpos and \setMPpositiongraphic, because I haven't figured out 
how to pass information from \mathboxanchored and \connectboxanchors to my 
MetaPost code. Here is the code for the connectors:

\startMPpositiongraphic{mypos:contract}
  path pa, pb, pab ; numeric na, nb ; string ta, tb, hand, product ;
  ta := mpvars("from") ;
  tb := mpvars("to") ;
  stemshiftfrom := (EmWidth/8)*mpvarn("startstem") ;
  stemshiftto   := (EmWidth/8)*mpvarn("stopstem") ;
  hand := mpvars("hand") ;
  product := mpvars("product") ;
  delta := mpvard("distance") ;
  na := positionpage(ta) ; % page number of a
  nb := positionpage(tb) ; % page number of b
  pa := positionbox(ta) ;  % box of a
  pb := positionbox(tb) ;  % box of b
  if hand = "right" :
 z1 = 0.5[llcorner pa,lrcorner pa] shifted (stemshiftfrom, -ExHeight/4) ;
 z2 = 0.5[llcorner pb,lrcorner pb] shifted (stemshiftto,   -ExHeight/4) ;
 y3 = min(y1,y2) - ExHeight/2 -delta; 
  else :
z1 = 0.5[ulcorner pa,urcorner pa] shifted (stemshiftfrom,  ExHeight/4) ;
z2 = 0.5[ulcorner pb,urcorner pb] shifted (stemshiftto,ExHeight/4) ;
y3 = max(y1,y2) + ExHeight/2 +delta; 
  fi ;
  if na = nb : % Check that positions are on the same page
pickup pencircle scaled 0.6pt ;
if product = "sym" :
  draw z1 -- (x1,y3+ExHeight/2) ;
  draw z2 -- (x2,y3+ExHeight/2) ;
  pickup pencircle scaled 1.2pt ;
  draw (x1-EmWidth/8,y3) -- (x2+EmWidth/8,y3) ;
else :
  pab := z1 -- (x1,y3) -- (x2,y3) -- z2{down} ;
  draw pab ;
fi ;
positioninregion ;
  fi ;
\stopMPpositiongraphic

A connector command might look something like this:

\setMPpositiongraphic{X-1}{mypos:contract}{to=X-2,product=sym,startstem=-2,stopstem=2,distance=0.5ex}

All of the key=value pairs in the last argument of \setMPpositiongraphic pop 
right up in my MetaPost code with mpvar(“key”). I haven’t been able to follow 
this with \mathboxanchored and \connectboxanchors. My two questions are:

1) Can I use \setMPpositiongraphic with \mathboxanchored? That would allow me 
to go straight to my MetaPost code without the \connectboxanchors interface

2) Can I tell \connectboxanchors to use my MetaPost code and pass key=value 
pairs like I do with \setMPpositiongraphic?

Thanks for any hints!
Gavin




hposQuestion.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 / 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] Is this possible to do the same

2022-12-12 Thread Gavin via ntg-context
Hi Uschi,

I use the MetaFun features of ConTeXt to cross out stuff.

% Cancel command for use in equations.
\startuniqueMPgraphic{cross out}
  picture cross;
  cross := image(draw (0,0)--(1,1); draw (0,1)--(1,0););
  draw cross xscaled \overlaywidth yscaled \overlayheight withpen pencircle 
scaled .8pt ;
\stopuniqueMPgraphic

\defineoverlay[canceloverlay][\uniqueMPgraphic{cross out}]

\define[1]\cancel{%
  \ifmmode
\mframed[background=canceloverlay, frame=off, offset=overlay]{{#1}}%
  \else%
\framed[background=canceloverlay, frame=off, offset=overlay]{{#1}}%
  \fi%
}

\starttext

\dots E.g.~$\cancel{x+ {-x}}$. Works in \cancel{text}, too.

\stoptext

I do not have all of the features of the “cancel” package, but it works for a 
simple cross out. Change the MetaPost code to a single slash, if that is what 
you want, by removing either one of the draw commands.

Hope that helps. If you need more features, I’d might be able to help you 
implement them.

Gavin


> On Dec 12, 2022, at 8:21 AM, Ursula Hermann via ntg-context 
>  wrote:
> 
> Dear List!
>  Sorry, but my pdf was too big.
> So I send a little picture. I would like to know, if there is a 
> modus in ConTeXt like the same in LaTeX. I found this on page 108,  Chapter 3 
> Math symbos LaTeX Compherensive list.
> Many thanks
> Uschi  
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
> ___


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

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


Re: [NTG-context] \hpos in math - Half solved

2022-12-07 Thread Gavin via ntg-context
Hi Hans and Mikael,

This is amazing! Mikael's example works for me. I will start using these tools 
in my project, and I’ll tell you how it goes. It might be a couple weeks, 
because the physics is also quite challenging.

Thank you!
Gavin


> On Dec 7, 2022, at 3:25 PM, Hans Hagen via ntg-context  
> wrote:
> 
> On 12/7/2022 1:42 PM, Gavin via ntg-context wrote:
>> Hi List,
>> I solved my original problem 2, allowing me to reuse the same \hpos labels 
>> in different equations without interference. I added an equation counter and 
>> set up my custom math version of \hpos to use the count as part of the label 
>> internally. I tried to do this with a regular ConTeXt counter, but had all 
>> sorts of mysterious, wrong behavior. When I switched to using a Lua counter, 
>> everything worked immediately. So, while there is nothing brilliant about 
>> this solution, I’ll share it for anyone who might want to do something 
>> similar in the future.
> attached an example by Mikael ... it should work with tonights update
> 
> 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
> -
> <221206-3.mkxl>___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
> ___

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

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


Re: [NTG-context] \hpos in math - Half solved

2022-12-07 Thread Gavin via ntg-context
Hi List,

I solved my original problem 2, allowing me to reuse the same \hpos labels in 
different equations without interference. I added an equation counter and set 
up my custom math version of \hpos to use the count as part of the label 
internally. I tried to do this with a regular ConTeXt counter, but had all 
sorts of mysterious, wrong behavior. When I switched to using a Lua counter, 
everything worked immediately. So, while there is nothing brilliant about this 
solution, I’ll share it for anyone who might want to do something similar in 
the future.

The code I added is below, with some comments. The complete example file is 
attached. The result is two equations.


hposQuestionEquations.pdf
Description: Adobe PDF document

Each equation was written using the same labels (X,Y,Z), but internally they 
have separate sets, (1:X and 2:X, etc.).

The moral of the story for me: Use more Lua.

Gavin


% Lua counts the spin formulas 
\ctxlua{sfnum = 0} % Count starts at zero
\def\sfID{\ctxlua{context(sfnum)}} % ConTeXt can call the count from Lua to use 
as an ID for each equation.

% Spin formulas increase the spin formula count and typeset the formula as 
usual.
\define\startspinformula{
  \ctxlua{sfnum = sfnum + 1}
  \startformula
}
\define\stopspinformula{\stopformula}

% My own \mpos uses the spin formula ID as part of the box label, then sets the 
contents as math.
\define[2]\mpos{\hpos{\sfID:#1}{$#2$}}

% Two commands for requesting contractions (the connections between spinors), 
using the spin formula ID.
\define[2]\contract{%
  \startpositionoverlay{graphics}%
\setMPpositiongraphic{\sfID:#1}{mypos:contract}{to=\sfID:#2}%
  \stoppositionoverlay%
}
\define[2]\contractbelow{%
  \startpositionoverlay{graphics}%
\setMPpositiongraphic{\sfID:#1}{mypos:contractbelow}{to=\sfID:#2}%
  \stoppositionoverlay%
}




hposQuestion.tex
Description: Binary data
___
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] \hpos in math

2022-12-06 Thread Gavin via ntg-context
Hi Hans,

> On Dec 6, 2022, at 2:15 AM, Hans Hagen via ntg-context  
> wrote:
> On 12/6/2022 12:39 AM, Gavin via ntg-context wrote:
>> 1) Is there a mathematics version of \hpos? The contents of \hpos are set as 
>> text, even when \hpos is in mathematics, so I wrote an \mpos macro that uses 
>> \hpos but sets the contents as display-style math. This isn’t great for 
>> spacing, and it does't adapt to different math styles. \framed has a math 
>> version, \mframed, that sets the contents in the appropriate math style. If 
>> anyone know a way to accomplish that with \hpos, I’d love to know.
> 
> there actually is a subsystem that keeps math as-is-it (styles and spacing 
> and such), see attached

I tried using \mathboxanchored, and was able to get the bottom two equations 
shown here. (The top equation uses \hpos, for comparison.)



mathboxanchored.pdf
Description: Adobe PDF document

There are two problems that I didn’t know how to fix.

1) The line connects to the box including the subscript or superscript, not 
just to the e.
2) I cannot make multiple connections to a single object, like the e^\mu in the 
center. If I try to connect top and bottom, I get no connections anywhere in 
the entire document.

The code for the formulas is:

\startformula
  % Each \connectboxanchors works alone, but both together make trouble:
\connectboxanchors[top][top]{X}{Y}
%\connectboxanchors[bottom][bottom]{Y}{Z}
  \mathboxanchored{X}{e}_\alpha \mathboxanchored{Y}{e}^\mu 
\mathboxanchored{Z}{e}_{\dot\beta}
= \textfrac{1}{\sqrt{2}}\sigma_{\alpha\dot\beta}^\mu
\stopformula

I added code to turn the arrow produced by \connectboxanchors into my 
contraction overlay, but that doesn’t affect these issues.

> in your example we need a way to anchor on just the 'e' right? or do you want 
> it on the e + super/subscript?

Yes, we only need to anchor to e. 

Thanks!
Gavin___
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] \hpos in math

2022-12-05 Thread Gavin via ntg-context
Hello List,

I am working on a project which combines graphics with formulas, like this:



hposQuestion.pdf
Description: Adobe PDF document


My code for creating this formula is attached. It works well, but I have a 
couple of questions that could make it work better.

1) Is there a mathematics version of \hpos? The contents of \hpos are set as 
text, even when \hpos is in mathematics, so I wrote an \mpos macro that uses 
\hpos but sets the contents as display-style math. This isn’t great for 
spacing, and it does't adapt to different math styles. \framed has a math 
version, \mframed, that sets the contents in the appropriate math style. If 
anyone know a way to accomplish that with \hpos, I’d love to know.

2) Is there a way to limit the scope of the \hpos labels to a single formula. 
This could turn into a book length project, with several formulas per page and 
several connections per formula. If every \hpos in the entire book needs a 
unique identifier, I could go mad. Under no circumstances will I connect one 
formula to another, so I’d like to be able to use something like 
\hpos{A}{…}…\hpos{B}{…} in each formula. Any suggestions?

I’ve got to say, LMTX is an absolutely amazing tool for this project, which 
includes complicated networks of connections above and below many formulas. The 
integration of TeX, MetaPost, and Lua makes this project tremendous fun.

Thanks!
Gavin

P.S. For the curious, I’m using a method for doing General Relativity based on 
spinors rather than tensors, following the methods of Penrose and Rindler in 
their 1985 books “Spinors and Space-time.” In the typesetting example above, 
the e_\alpha and e_{\dot\beta} are basis spinors (one left-handed, one 
right-handed). The e^\mu is the Infeld-van der Waerden symbol relating the spin 
basis to the coordinate basis. The connections are spinor index contractions. 
The formula above relates the components of the Infeld-van der Waerden symbol 
to the Pauli sigma matrices. This relationship only works in flat space, so 
this is an easy example! [Penrose and Rindler, vol 1 p. 125] 



hposQuestion.tex
Description: Binary data
___
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] TEXpage cropping math

2022-12-05 Thread Gavin via ntg-context
Hi Pablo and Mikael,

offset=none does exactly what I need. Thank you, both!

Gavin


> On Dec 5, 2022, at 11:40 AM, Pablo Rodriguez via ntg-context 
>  wrote:
> 
> On 12/5/22 13:42, Mikael Sundqvist via ntg-context wrote:
>> Hi,
>> 
>> One usually need an offset.
> 
> ... or even none (which seems to work in this case):
> 
>  \startTEXpage[offset=none]
>$E_1$
>  \stopTEXpage
> 
> Just in case it might help,
> 
> Pablo
> 
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
> ___

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

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


[NTG-context] TEXpage cropping math

2022-12-05 Thread Gavin via ntg-context
Hi List

I’m having trouble with \startTEXpage cropping off tops and bottoms of 
equations. For example.

\startTEXpage
  $E_1$
\stopTEXpage

Produces: 

TEXpage.pdf
Description: Adobe PDF document


Any suggestions?

Gavin___
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] What to do when ConTeXt not revealing the error details?

2022-10-30 Thread Gavin via ntg-context
Hi Joel,

I get this error frequently when I forget to stop an environment, for example a 
\startsection with no \stopsection or a \startplacefigure with no 
\stopplacefigure. This freqeuntly doesn’t cause an error because the engine is 
happily packing my entire book into a margin figure.

See if there something you should have stopped near the place where things go 
bad?

Good luck!
Gavin


> On Oct 30, 2022, at 7:46 PM, Joel via ntg-context  wrote:
> 
> I have a very large document that, when compiled, produces a PDF, but reports 
> the error "mtx-context | fatal error: return code: 1".
> 
> The PDF can open, but after about 100 pages in, the content starts appearing 
> all in the wrong place.
> 
> Usually when I compile, it says there is an error, and I just scroll up until 
> I find the details. I've scrolled through the output, and *.log file, but 
> cannot see anything that looks like an error.
> 
> It could be that just because the document is so long (about 1200 pages), I 
> can't find the error among the huge logs, but I looked through them all 
> carefully.
> 
> How can I isolate the error when ConTeXt isn't showing it? Is there some 
> setting for showing only errors, or revealing more details about an error?
> 
> --Joel
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
> ___

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

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


Re: [NTG-context] is something wrong with the mailing list?

2022-10-30 Thread Gavin via ntg-context
Hi Hraban,

It has been pretty quiet, but there were some posts on Oct 27. You could check 
the bottom of the web version to see if you have been missing activity.

https://mailman.ntg.nl/pipermail/ntg-context/2022/date.html 


Gavin


> On Oct 30, 2022, at 9:47 AM, Henning Hraban Ramm via ntg-context 
>  wrote:
> 
> Hi again,
> I didn’t get any mails from ntg-context between 2022-10-26, 01:52 and my 
> mails now. Was there no activity?
> 
> (Maybe I was switched off due to bounced mails, because my provider had left 
> outdate the ssl certificate of the mail server...)
> 
> Hraban
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
> ___

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

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


[NTG-context] Formula has excess vertical spacing when in two column itemize

2022-10-21 Thread Gavin via ntg-context
Hi List,

I am getting better at adjusting the space in enumerations, but I just put a 
formula inside an enumeration, and the formula’s vertical spacing became 
excessive. I’m not sure how the enumeration caused this problem.


\starttext

Evaluate the following derivatives.

\startitemize[n, columns, two, nowhite, after]

\item\hspace[big] $\frac{d}{dx} x^2$

This is where the solution should be. Text answers look fine, but formulas have 
too much space above, below and between lines\dots.

\item\hspace[big] $\frac{d}{dx}\left( x^3 + 2x \right)$

\item\hspace[big] $\frac{d}{dx}\left( x^{-2} \right)$

\item\hspace[big] $\frac{d}{dt}\left( 4t^4 - 3t^{\onehalf} \right) $

\item\hspace[big] $\frac{d}{dt}( 9 - 3t )$

\startformula\startmathalignment
\NC \frac{d}{dt}( 9 - 3t ) \NC= \frac{d}{dt} 9 - \frac{d}{dt} 3t \NR
\NC  \NC= 0 - 3\frac{d}{dt} t \NR
\NC  \NC= -3\cdot 1t^0 \NR
\NC  \NC= -3 \NR
\stopmathalignment\stopformula

\item\hspace[big] $\frac{d}{dp}\left( p^3 - 2p \right)$

\stopitemize

\stoptext


I’m also attaching a file with the above issue followed by the correct spacing 
in one-column for comparison.

I’m using LMTX (today’s upload, ver: 2022.10.21 21:13 LMTX  fmt: 2022.10.21) on 
an M1 Mac.

Any ideas?
Gavin



TwoColumnProblems.pdf
Description: Adobe PDF document


TwoColumnProblems.tex
Description: Binary data
___
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] Spacing in \unit - SOLVED

2022-10-21 Thread Gavin via ntg-context
Hans,

I made a small mistake in the phys-dim.mkxl file I sent you. I removed a % at 
the end of lines 469 and 485. Without the %, using alternative=text causes 
extra space before the unit. A corrected phys-dim.mkxl is attached.

Gavin



phys-dim.mkxl
Description: application/applefile
___
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] Spacing in \unit - SOLVED

2022-10-21 Thread Gavin via ntg-context
Hi Hans,

> I'll look into it (with Mikael as some relates to math) once you're done 
> playing and provide suggestions and tests.

I’m done playing. Below are tests and suggestions. Sorry it has taken so long 
for me to put this together.


Tests
I attached two test files. The first, units-spacing.tex, is for testing spacing 
for \unit used in text, inline math, and display math. The second, 
units-linebreaks.tex, tests line breaks when \unit. is used in text or in 
inline math. Line breaks were not my primary interest, but Max and Alan were 
quite interested. My proposed fixes for spacing also fix their concerns about 
line breaks.I tried to make these tests match the style of the Test Suite. They 
could be included there if they are useful.


Suggestions
I attached my my modified phys-dim.mkxl. All of my changes are commented and 
signed with -GP to make them easy to find. Below are comments on the five 
issues I addressed (not including line breaks). The first four of these are 
fixes.I don’t think any of these fixes are controversial or require new 
options. The fifth, regarding the space around the \times in scientific 
notation, might be an appropriate option, rather than a universal fix.


1. The \cdot in units should not have space around it.
These lines produce the \cdot between units, one is for the default \cdot, the 
other when the separator=cdot option is used. I’m not entirely sure why they 
are separate. Now, in math mode, the \cdot is changed to an ord. (ll. 392-393)

\protected\def\phys_units_separator
 
{\ifcsname\??unitseparator\unitparameter\c!separator\endcsname\lastnamedcs\else\ifmmode\mathord\cdot\else\cdot\fi\fi}
 % Made \cdot an "ord" in math mode -GP

\installunitsseparator\v!normal{\ifmmode\mathord\cdot\else\cdot\fi}  % Made 
\cdot an "ord" in math mode -GP


2. Space is needed between number and units
To get the thin space between the number and the units (ll.412-418)

\protected\def\phys_units_space
 {\ifmmode
\thinspace % let the atoms do the work. Right now atoms aren't doing the 
work, so I put in a \thinspace -GP
  \else
\unskip % weird, why is unskip needed

\ifcsname\??unitspace\unitparameter\c!space\endcsname\lastnamedcs\else\unitsmediumspace\fi
  \fi}


3. Space is needed after the units, before the next relation, binary operator, 
etc. Right now there seems to be no space added between the new dimension class 
and the relation and binary operator class. Until the space around the 
dimension class is fixed, The units should not be assigned to the dimension 
class, which means removing the code that sets units to this class. (ll. 
618-623)

\def\phys_units_start
 {\ifmmode
\dostarttagged\t!maction\t!unit
% \mathatom % I removed this because the correct spaces after dim haven't 
been set (e.g. dimbin, dimrel) -GP
%\s!leftclass  \mathdimensioncode
%\s!rightclass \mathdimensioncode
\bgroup
  \else
\dostarttagged\t!unit\empty
  \fi
  \let\phys_units_finish\phys_units_stop
  \let\phys_units_start\relax}


4. Remove hardcoded backspace before the solidus in units. (If this space 
should be tighter, it probably should be dealt with for every solidus, not just 
the solidus in \unit the unit command.) (ll.412-418)

\permanent\protected\def\unitsSOLIDUS
 {%\ifnum\c_phys_units_state=\plusone % suffix  % Removed three lines to 
eliminate backspace before / -GP
  %  \unitsbackspace
  %\fi
  {/}%
  }%\unitsbackspace}


5. I think the \times in scientific notation should not have extra space. 
Everyone who commented on the mailing list agreed. However, I’m not sure that 
this is a universal desire, so it might be good to add an options, like 
scispace=normal for the usual binop space around the \times and scispace=tight 
for no extra space around \times. The changed line in phys-dime.mkxl used to 
add space around the \times in text. Now, instead, it removes the space around 
the \times in math by making the \times an ord. (ll. 170-172)

\permanent\protected\def\digitstextbinop#1% assumes preceding
 {\ifmmode\mathord#1\else\nobreak#1\fi} % Removed space around binop (\times or 
\cdot) in \units -GP
 %{\ifmmode#1\else\fourperemspace\nobreak#1\fourperemspace\fi} % This is the 
old line with spaces -GP


Those are my five suggestions. Thanks for looking at spacing in \units!

Gavin




units-spacing.tex
Description: Binary data


units-linebreaks.tex
Description: Binary data


phys-dim.mkxl
Description: Binary data


___
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] synctex problem

2022-10-15 Thread Gavin via ntg-context
Hi Alan,

I have an almost identical set-up (M1, MacOS12.6, TexShop, useAlternatePath, 
useConTeXtSyncParser). One important difference, I use

sync method: SyncTeX (TeX ≥ 2010)

I’d recommend trying that. There are some other differences in my setup that 
probably are not important. At the beginning of my files (products and 
components)I only use the two lines

% !TEX useAlternatePath
% !TEX useConTeXtSyncParser

not the root and TS-program lines, but I don’t think that matters for your 
SynchTeX issue. Here is the engine I use for LMTX, just in case it has 
something helpful for you.

#!/bin/zsh
#
# This engine uses TeXShop's "Alternate Path", which is the variable "$3" below.
# Set the TeXShop's alternate path to your ConTeXt installation in
#  TeXShop's Preferences -> Engine -> Alternate Path
# Start ConTeXt source files with the lines:
#  % !TEX useAlternatePath
#  % !TEX useConTeXtSyncParser

export OSFONTDIR=/Library/Fonts/:/System/Library/Fonts:$HOME/Library/Fonts
export PATH="$3":$PATH
mtxrun --autogenerate --script context --synctex "$1”

I put that long comment in the engine because I share it with collaborators.

Hope that helps!

Gavin



> On Oct 15, 2022, at 12:00 PM, Alan Bowen via ntg-context  
> wrote:
> 
> At the top of a single source file, I have the lines:
> % !TEX root = prd_Aestimatio-0301.tex % the root file
>   % !TEX TS-program = ConTeXt2021
>   % !TEX useAlternatePath
>   % !TEX useConTeXtSyncParser
>\setupsynctex[state=start, method=max]
> 
> Syncing works well enough—though I can see no difference between method =min 
> and method=max, both highlight only a few words and not the entire text to be 
> synced, but perhaps my expectations are out of line.
> 
> When I have these lines at the top of a component file and typeset the 
> product file, I get a rootfile.synctex file, but syncing itself goes awry. 
> Nothing happens when I sync from the PDf file to the component file, and when 
> I sync from the component file to the product PDF, I get the correct page but 
> no highlighting.
> 
> I am using TeXShop ver. 5.03— 
>   sync method: Both Pdf Sync and Search
>   Alternative Path: 
> /Users/bowen1/Applications/LuaMetaTeX/tex/texmf-osx-arm64/bin
> 
> and  also the latest ConteXt (ver.  2022.10.15 10:37 LMTX)  under macOS 12.6 
> (Apple M1 Pro chip)
> 
> Note: the product file has only one  component file for now.
> 
> I suspect that I am missing something but am not sure where to look or what 
> to do now. Any guidance will be much appreciated.
> 
> Alan
> 
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
> ___

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

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


[NTG-context] \text{...} inside \sqrt is tiny

2022-10-13 Thread Gavin via ntg-context
Hi List,

When I use text inside a radical, the text is script-script size.

$\text{Radius} = \sqrt{\text{Area}/\pi}$

It should be normal size. Any ideas for a fix?

I stumbled on this issue when working with \units, but it is not specific to 
units.

Thanks!
Gavin
___
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] Spacing in \unit - SOLVED

2022-10-13 Thread Gavin via ntg-context
Hi Oli,

> Thank four your effort. I found out, that the following definition of a new 
> unit, i called it SI, results also in a correct spaceing in the math 
> environment:
> 
> \defineunit[SI][alternative=text]
> 
> It seems, that the option alternative=text solves the problem with no spaces 
> between value and unit in the math environment.

That is a terrific solution that doesn’t require any messing with 
phys-dim.mkxl. You do not need to define a new unit. I got your result using 
this line:

\setupunits[alternative=text]

This fixed the most significant problems with \unit in most situations. I’m 
still applying some of my solutions as well.

Thanks!
Gavin

___
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] Spacing in \unit - degrees

2022-10-12 Thread Gavin via ntg-context
Hi Alan

> On Oct 12, 2022, at 5:55 PM, Alan Braslau via ntg-context 
>  wrote:
> 
> \unit{135℃} adds a space after the digits 135.
> I do not believe that this is correct
> (for ℃ is *not* a "real" unit, unlike \unit{408.15 K} which *is* a real
> unit).

According to “Scientific Style and Format: The CSE Manual for Authors, Editors, 
and Publishers, 8th Ed.” by the Council of Science Editors:

> The symbol for degrees Celsius, ℃ (not simply C), is separated from the 
> number on its left by one space, whereas the degree symbol for a plane angle 
> (e.g. a 45° angle) and for longitude and latitude (e.g. 45°30’N) is not 
> separated from the numeral by a space. [§12.2.1.1 SI Rules, pp.169-170]

As a recovering string theorist, I cannot help but speculate that this rule 
extends to spherical coordinates in any number of dimensions. However, if you 
don’t want the space, you can use 135\unit{℃}, which does not add a space.

> Also,
> \unit{135°C} drops the "C". Is this a parsing bug?

It is not a parsing bug; it is a limitation. In general, units must be spelled 
out (newton, joule, etc.) which produces the correct SI symbol (N, J, etc.). 
Some units are also recognized by their symbols (m, s, kg,…). Celsius is 
recognized by the single character “℃” and by the name “celsius”, but not by 
the two character combination “°C”. Probably, the parser could be expanded to 
recognize the two character combination. That requires mucking around in 
phys-dim.lua, which I’m not going to touch.

Use \unit{135 celsius} if you want the space, and 135\unit{celsius} if you 
don’t. Or you can add your favorite abbreviations:

\registerunit[
  °C=°C,
  ]
\setupunittext[
  °C=℃,
  ]

Then use \unit{135°C} if you want the space and 135\unit{°C} if you don’t.

> Related,
> \unit{90°} does not seem to introduce a space, as indeed it should not.

Also related, using \unit for just the units, and not the number, is useful 
when they follow something that is not a number, like a vector: $ \vec v = 
(4.0, -3.2, 1.5)\unit{m/s} $. You frequently do not want a space in that 
situation.

Now that I’ve had this success messing with other people’s code, I’ve got your 
luagraph module on my mind.

Gavin
___
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] Spacing in \unit - SOLVED

2022-10-12 Thread Gavin via ntg-context
Hi Max and Rik

> On Oct 12, 2022, at 4:49 PM, Max Chernoff  wrote:
> 
> This new output looks *much* better than the old one, thanks! 

Thank you!

> My only comment is that the spacing around the multiplication sign looks
> a little too tight to me. The original spacing was probably too large,
> but I think that a little more space than you currently have would be
> better.

I haven’t adjusted the space directly. I just changed the \times and \cdot from 
class binom to class ord. I’m not going to tweak the space. I don’t even use 
this font. With proportional numbers in Libertinus, I think the \times looks 
great.



PastedGraphic-5.pdf
Description: Adobe PDF document


With tabular numbers, the \times looks a bit off center due to the extra space 
around the following 1.

>> If anyone wants my changes, either for their own use or to improve the
>> distributed phys-dim.mkxl, I’m happy to share.
> 
> Yes, can you please share that to the list?

See below for comments, and the full modified phys-dim.mkxl is attached

> Hi Rik,
> 
>> It does look like you have introduced additional space before the 
>> solidus. Was that intentional?
> 
> I believe that that is intentional. From the earlier email:
> 
>> removed an overzealous backspace before division symbols.
> 
> This new spacing looks much more even to me, especially around the
> exponents.

It was intentional. I didn’t add space. I removed a backspace in the \unit code.

Below I list all of my changes to the phys-dim.mkxl code, with some commentary. 
I have added comments in the code everywhere I made a change, and I signed the 
changes with -GP, so they are easy to find.

Thanks for your encouragement, because my high school physics students 
certainly do not give a s#!t.

I hope some people find this useful!

Gavin



This used to add space around the \times in text. Now, instead, it removes the 
space around the \times in math by making the \times an ord. (ll. 170-172)

\permanent\protected\def\digitstextbinop#1% assumes preceding
  {\ifmmode\mathord#1\else\nobreak#1\fi} % Removed space around binop (\times 
or \cdot) in \units -GP
  %{\ifmmode#1\else\fourperemspace\nobreak#1\fourperemspace\fi} % This is the 
old line with spaces -GP


These lines produce the \cdot between units, one is for the default \cdot, the 
other when the separator=cdot option is used. I’m not entirely sure why they 
are separate. Now, in math mode, the \cdot is changed to an ord. (ll. 392-393

\protected\def\phys_units_separator
  
{\ifcsname\??unitseparator\unitparameter\c!separator\endcsname\lastnamedcs\else\ifmmode\mathord\cdot\else\cdot\fi\fi}
 % Made \cdot an "ord" in math mode -GP

\installunitsseparator\v!normal{\ifmmode\mathord\cdot\else\cdot\fi}  % Made 
\cdot an "ord" in math mode -GP


To get the thin space between the number and the units (ll.412-418)

\protected\def\phys_units_space
  {\ifmmode
 \thinspace % let the atoms do the work. Right now atoms aren't doing the 
work, so I put in a \thinspace -GP
   \else
 \unskip % weird, why is unskip needed
 
\ifcsname\??unitspace\unitparameter\c!space\endcsname\lastnamedcs\else\unitsmediumspace\fi
   \fi}


This had a hardcoded backspace before the solidus. I think it looks better 
without. Even if this space should be tighter, it probably should be dealt with 
for every solidus, not just the solidus in \unit the unit command. (ll.412-418)

\permanent\protected\def\unitsSOLIDUS
  {%\ifnum\c_phys_units_state=\plusone % suffix  % Removed three lines to 
eliminate backspace before / -GP
   %  \unitsbackspace
   %\fi
   {/}%
   }%\unitsbackspace}


Finally, until the space around the dimension class is fixed, I’m just removing 
the code that sets units to this class. (ll. 618-623)

\def\phys_units_start
  {\ifmmode
 \dostarttagged\t!maction\t!unit
% \mathatom % I removed this because the correct spaces after dim haven't 
been set (e.g. dimbin, dimrel) -GP
%\s!leftclass  \mathdimensioncode
%\s!rightclass \mathdimensioncode
 \bgroup
   \else
 \dostarttagged\t!unit\empty
   \fi
   \let\phys_units_finish\phys_units_stop
   \let\phys_units_start\relax}




phys-dim.mkxl
Description: Binary data

___
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] Spacing in \unit - SOLVED

2022-10-12 Thread Gavin via ntg-context
Hi Max, Alan, Bruce, Hans, et.al

I solved my four issues with \unit spacing. In the process, I prevented 
unwanted line breaks and removed an overzealous backspace before division 
symbols. Below is a MWE that shows all of these issues, as well as pictures of 
the result with the unmodified phys-dim.mkxl and with my modified 
phys-dim.mkxl. The final result is exactly what I wanted.

If anyone wants my changes, either for their own use or to improve the 
distributed phys-dim.mkxl, I’m happy to share.

Thanks for all of your comments!
Gavin


MWE:

\setuppapersize[A5]

\starttext

The \type{\unit} command in text produces \unit{1.23e5 kg m^2/s^2}.

Inline math \type{$\unit$} produces $\unit{1.23e5 kg m^2/s^2}$.

Display math produces
\startformula
 \unit{1.23e5 kg m^2/s^2} + \unit{8.64e5 newton m} = \unit{987,000 joule}
\stopformula

Line breaking in math:

{\hsize=0pt $G = \unit{6.6743e-11 m3 kg-1 s-2}$}

\blank
Line breaking in text:

{\hsize=0pt \unit{6.6743e-11 m3 kg-1 s-2}}

\stoptext

Output with unmodified phys-dim.mkxl:


PastedGraphic-3.pdf
Description: Adobe PDF document


Output with my modified phys-dim.mkxl:


PastedGraphic-2.pdf
Description: Adobe PDF document




> On Oct 10, 2022, at 12:15 AM, Max Chernoff via ntg-context 
>  wrote:
> 
> Hi Alan,
> 
>> I would very strongly argue that the space between the number and the
>> following units be UNBREAKABLE. Perhaps a thin space (preference), but
>> most certainly non-breakable.
>> 
>> Similarly around the times in scientific notation.
>> 
>> I further cannot imagine that a line break be acceptable around a \cdot
>> in composite units.
>> 
>> This can possibly lead to overfill and underfill, something that I find
>> *infinitely* more acceptable then breaking numbers and units.
> 
> Yes, I agree completely here.
> 
>> I do not know or use the \units command. Maybe it uses unbreakable
>> spaces, maybe not. I would never use it unless it could be configured
>> to only use nonbreakable spaces. 
> 
> The current behaviour doesn't break the unit from the number, but it
> does split the scientific notation.
> 
> This test file:
> 
>   \starttext
>   \hsize=0pt Math: $G = \unit{6.6743e-11 m3 kg-1 s-2}$
> 
>   \hsize=0pt Text: \unit{6.6743e-11 m3 kg-1 s-2}
>   \stoptext
> 
> gives:
> 
>   Math:
>   퐺=
>   6.6743×
>   10–11m3⋅kg–1⋅s–2
>   Text:
>   6.6743
>   ×
>   10−11 m3⋅kg−1⋅s−2
> 
> which isn't great. In my opinion, the \unit command should be typeset in an
> \hbox (or similar) since I can't think of any circumstances where breaking
> it would be reasonable.
> 
> Thanks,
> -- Max
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
> ___

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

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


[NTG-context] Dimension atom in math? (was: Spacing in \unit)

2022-10-12 Thread Gavin via ntg-context
Hi List,

I am trying to improve the spacing produced by the \unit command. I have solved 
three of my four issues by modifying phys-dim.mkxl, but the fourth issue has me 
stumped. Consider this example:

\showmakeup[mathglue] \mathspacingmode=1

\starttext
\startformula
 \unit{1.23e5 kg m^2/s^2} + \unit{8.64e5 newton m} = \unit{987,000 joule}
\stopformula
\stoptext

There is no space between the units and the following + or =. The \showmakeup 
reveals that this is the space between a “dim” and a “bin” or a “dim” and a 
“rel”. I am guessing that “dim” refers to a new “dimension” atom class, and it 
appears that the table determining the spacing between atoms does not include 
space between this dimension class and the binary or relation classes. I don’t 
know that this is the problem, but this is my best guess.

If this is the problem, is there a way I can add this space to the necessary 
table? If this is not the problem, I’m open to any other insight or advice.

Thanks,
Gavin


> On Oct 8, 2022, at 11:59 AM, Gavin  wrote:
> 
> Hi list,
> 
> I made a small example with all of the issues I am trying to fix for the 
> \units command. The first formula below uses the \unit command, but produces 
> strange spacing. The second formula produces the desired spacing, without 
> using the \unit command.
> 
> \showmakeup[mathglue] %\mathspacingmode=1
> 
> \starttext
> \startformula
> \unit{1.23e5 kg m^2/s^2} + \unit{8.64e5 W s} = \unit{9.87e5 newton m}
> \stopformula
> \startformula
> 1.23\mathord\times10^5\,{\rm kg\mathord\cdot m^2/s^2} + 
> 8.64\mathord\times10^5\,{\rm W\mathord{\cdot}s} = 
> 9.87\mathord\times10^5\,{\rm N\mathord{\cdot}m}
> \stopformula
> \stoptext
> 
> I’m trying to fix four issues:
>  - No space between the number and the following units. Should be a thin 
> space.
>  - No space between the units and the following symbol (+ and = above). 
> Should be appropriate “bin" or “rel" space.
>  - Too much space around the \cdot in the units. Should be treated like an 
> “ord" when used to separate units.
>  - Too much space around the \times in the scientific notation. Should be 
> treated like an "ord" when used in scientific notation. (I'm not sure there 
> is consensus on this.)
> 
> Some of these seemed like things I could fix myself, so I dug into 
> phys-dim.mkxl to see what I could do. The good news is that I didn’t break 
> anything. The bad news is that nothing I did seemed to have any effect – 
> including deleting phys-dim.mkxl entirely! I double checked that I was 
> working on the same installation used for typesetting. Is the code used for 
> \unit now somewhere else?
> 
> These issues only occur in math mode, and \unit handles comma separators 
> correctly, unlike \digit.
> 
> I’d like to get some sort of temporary patch for at least some of these 
> issues, even if I need to write it myself. I use \unit everywhere in physics 
> problems sets for students and in keys that I share other teachers.
> 
> Any guidance is appreciated!
> 
> Gavin
> 
> P.S. I’m working on a more comprehensive test file, but its not ready yet.

___
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] Spacing in \unit

2022-10-08 Thread Gavin via ntg-context
Hi list,

I made a small example with all of the issues I am trying to fix for the \units 
command. The first formula below uses the \unit command, but produces strange 
spacing. The second formula produces the desired spacing, without using the 
\unit command.

\showmakeup[mathglue] %\mathspacingmode=1

\starttext
\startformula
 \unit{1.23e5 kg m^2/s^2} + \unit{8.64e5 W s} = \unit{9.87e5 newton m}
\stopformula
\startformula
 1.23\mathord\times10^5\,{\rm kg\mathord\cdot m^2/s^2} + 
8.64\mathord\times10^5\,{\rm W\mathord{\cdot}s} = 9.87\mathord\times10^5\,{\rm 
N\mathord{\cdot}m}
\stopformula
\stoptext

I’m trying to fix four issues:
  - No space between the number and the following units. Should be a thin space.
  - No space between the units and the following symbol (+ and = above). Should 
be appropriate “bin" or “rel" space.
  - Too much space around the \cdot in the units. Should be treated like an 
“ord" when used to separate units.
  - Too much space around the \times in the scientific notation. Should be 
treated like an "ord" when used in scientific notation. (I'm not sure there is 
consensus on this.)

Some of these seemed like things I could fix myself, so I dug into 
phys-dim.mkxl to see what I could do. The good news is that I didn’t break 
anything. The bad news is that nothing I did seemed to have any effect – 
including deleting phys-dim.mkxl entirely! I double checked that I was working 
on the same installation used for typesetting. Is the code used for \unit now 
somewhere else?

These issues only occur in math mode, and \unit handles comma separators 
correctly, unlike \digit.

I’d like to get some sort of temporary patch for at least some of these issues, 
even if I need to write it myself. I use \unit everywhere in physics problems 
sets for students and in keys that I share other teachers.

Any guidance is appreciated!

Gavin

P.S. I’m working on a more comprehensive test file, but its not ready yet.
___
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] Spacing issue with \digits in math mode

2022-10-04 Thread Gavin via ntg-context
Hi list,

I have been trying to understand the workings of the \unit command, which is 
producing strange spacing in math mode. In an effort to be more systematic, I 
began by investigating the related \digit command. \digit works well in text, 
but in math mode the comma separators produce unwanted space.

\digits {12,345.67} vs.\ $\digits {12,345.67}$

Below is a one page test document, derived from the code in phys-dim.mkxl.

I think a simple fix would be to treat the comma as “ord” inside a number, but 
I don’t know if that is easy or not. I’d also like the space removed from 
around the “x" in scientific notation, which might be accomplished the same way.

Thanks for all the work on spacing in math!

Gavin


\setuppapersize[A4]

\showmakeup[mathglue] %\mathspacingmode=1

\starttext

Digits in math mode have problems with comma separators.

\startbuffer
10 \setdigitmode {1} \setdigitorder{0} $\digits {12,345.67e89}$
20 \setdigitmode {2} \setdigitorder{0} $\digits {12,345.67e89}$
30 \setdigitmode {3} \setdigitorder{0} $\digits {12,345.67e89}$
40 \setdigitmode {4} \setdigitorder{0} $\digits {12,345.67e89}$
50 \setdigitmode {5} \setdigitorder{0} $\digits {12,345.67e89}$
60 \setdigitmode {6} \setdigitorder{0} $\digits {12,345.67e89}$
11 \setdigitmode {1} \setdigitorder{1} $\digits {12,345.67e89}$
21 \setdigitmode {2} \setdigitorder{1} $\digits {12,345.67e89}$
31 \setdigitmode {3} \setdigitorder{1} $\digits {12,345.67e89}$
41 \setdigitmode {4} \setdigitorder{1} $\digits {12,345.67e89}$
51 \setdigitmode {5} \setdigitorder{1} $\digits {12,345.67e89}$
61 \setdigitmode {6} \setdigitorder{1} $\digits {12,345.67e89}$
\stopbuffer

\typebuffer

This is typeset as:

\startlines \getbuffer \stoplines

In text, the \type{\digits} command works fine:
\setdigitmode {2}\setdigitorder{0}\digits{12,345.67e89}.
\blank

Suggestion: Within \type{\digits} (and probably \type{\units}) the comma could 
be an \quotation{ord} rather than a \quotation{pun}. This appears to be how the 
period is handled.
\blank

I personally think the space around the \quotation{$\times$} is excessive, 
especially when the number is in a formula.
\startformula
 \digits {12,345.67e89} + \digits {12,345.67e89}
\stopformula
I would like the \quotation{$\times$} to also be an \quotation{ord} when used 
for scientific notation.

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

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


Re: [NTG-context] Spacing in \unit

2022-09-25 Thread Gavin via ntg-context
Hi Hans,

I also just noticed that the space between the number and the unit is missing 
when I typeset with ConTeXt ver: 2022.09.11 20:44 LMTX fmt: 2022.9.25. This 
space was present in with the ConTeXt version I was using earlier, from a 
couple months ago. Thanks for putting it on the math todo list!

Gavin

(I sent the above message to Hans, but failed to cc the mailing list. Sorry if 
some of you get this twice.)

> On Sep 25, 2022, at 9:19 AM, Hans Hagen  wrote:
> 
> On 9/25/2022 3:30 PM, Gavin via ntg-context wrote:
>> Hello list,
>> I have a few questions about space produced by the unit command. Consider 
>> this MWE
>> \starttext
>> \unit{3.00e8 kg m/s}
>> $\unit{3.00e8 kg m/s}$
>> \stoptext
>> The dot between “kg” and “m” has different spacing depending on whether the 
>> \unit command is in text or math mode. I think that the tighter spacing in 
>> the first one, in text, is correct.
>> I personally would also like less space around the \times. To me, the number 
>> 3.00e8 should be typeset more like a single number, rather than like a 
>> product of 3.00 and 10^8. I am probably in the minority here. If \unit and 
>> \digit had an option for tighter spacing around the \times, I’d use it, but 
>> the current output with more space is probably what most people expect and 
>> want. Perhaps something like [scispace=tight].
> 
> that's for the math todo
> 
>> Finally, \unit does not play nicely with surrounding spaces. For example:
>> $2\pi\,\unit{3.00e8 kg m/s}$
>> causes a fatal error:
>> tex error   > tex error on line 9 in file ./Untitled.tex: Incompatible 
>> glue units (case 1)
> that's an interesting case for the engine (Mixing regular and mu skips and 
> so) ... we mighth finaly have a valid case for a primitive zero test
> 
> Hans
> 
> -
>  Hans Hagen | PRAGMA ADE
>  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -

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

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


[NTG-context] Spacing in \unit

2022-09-25 Thread Gavin via ntg-context
Hello list,

I have a few questions about space produced by the unit command. Consider this 
MWE

\starttext
\unit{3.00e8 kg m/s}

$\unit{3.00e8 kg m/s}$
\stoptext

The dot between “kg” and “m” has different spacing depending on whether the 
\unit command is in text or math mode. I think that the tighter spacing in the 
first one, in text, is correct.

I personally would also like less space around the \times. To me, the number 
3.00e8 should be typeset more like a single number, rather than like a product 
of 3.00 and 10^8. I am probably in the minority here. If \unit and \digit had 
an option for tighter spacing around the \times, I’d use it, but the current 
output with more space is probably what most people expect and want. Perhaps 
something like [scispace=tight].

Finally, \unit does not play nicely with surrounding spaces. For example:

$2\pi\,\unit{3.00e8 kg m/s}$

causes a fatal error:

tex error   > tex error on line 9 in file ./Untitled.tex: Incompatible glue 
units (case 1)

 \phys_units_direct 
#1->\begingroup \the \everyunits \ifdim \lastskip 
>\zeropoint \settrue \c_phys_units_dospace \removelastskip \fi 
\c_phys_digits_method \unitparameter \c!method \relax \ifmmode \else 
\dontleavehmode \fi \edef \currentunit {#1}\always\edef \unitlanguag
 
$2\pi\,\unit
{3.00e8 kg m/s}$

Using \thinspace produces the same fatal error.

Putting the 2\pi after the \unit{…} can also cause surprises.

$\unit{3.00e8 kg m/s}\times 2\pi$

produces a \times that is right up against the “s”.

I am very happy with all of the work done on spacing in math. I hope that my 
observations above are helpful in fine-tuning the excellent system.

Thanks!
Gavin

P.S. I am on as M1 Mac, using ConTeXt  ver: 2022.09.11 20:44 LMTX  fmt: 
2022.9.25  int: english/english.
___
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] MetaFun manual's "texvar" is not working for me

2022-05-21 Thread Gavin via ntg-context
Hello list,

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

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

Thanks!
Gavin


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

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

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

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


\starttext

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

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

\stoptext


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

Re: [NTG-context] New upload is DOA on my M1 Mac

2022-03-16 Thread Gavin via ntg-context
Hi List,

ConTeXt is running well after a fresh install. (context version: 2022.03.12 
17:56, I didn’t even need to mess with permissions.) I don’t know why the usual 
update procedure failed for me before. I look forward to checking out the new 
math spacing with Libertinus.

Sorry for the noise, and thanks to everyone who offered me help. 

Gavin
___
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 is DOA on my M1 Mac

2022-03-15 Thread Gavin via ntg-context
Hi Thomas,

> I can confirm that context version: 2022.03.12 17:56 is running fine on my 
> MacBook M1.

Thanks for that. I’ll troubleshoot my installation.

> And excuse my snark, but….

Snark excused.

Thanks!
Gavin
___
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 is DOA on my M1 Mac

2022-03-15 Thread Gavin via ntg-context
JP and Bruce,

Do either of you have the new upload working on an M1 Mac?

I appreciate the ideas, but I’m not entirely new to this. I’ve kept several 
different ConTeXt installations. I can run them from terminal or TeXShop. I’ve 
written TeXShop engines to switch between different installations and to use 
TeXShop’s alternative path. I’ve never had a problem like the one I am having 
with the new upload.

TeXShop and Terminal both have full disk access. Before I devote much more time 
trying to figure out what might be wrong with my set-up – where other 
installations work fine – I’d love to get confirmation that somebody got the 
new upload to work on an M1 Mac.

Gavin


> On Mar 13, 2022, at 5:53 PM, Bruce Horrocks  wrote:
> 
> 
> 
>> On 12 Mar 2022, at 19:55, Gavin via ntg-context  wrote:
>> 
>> Hi Hans,
>> 
>>> i uploaded a new installer / uopdates with mojca's bin
>> 
>> Thanks for putting that together. Unfortunately, same result:
>> 
>>  TeXShop produces no output in console
>>  "mtxrun —generate” produces "zsh: killed mtxrun --generate"
>> 
>> 
>> JP,
>> 
>> The control-open trick seemed like a good idea, but it didn’t change my 
>> results. TeXShop findes an old version from TeXLive, probably because it 
>> can’t use the new one. In Terminal I still get “permission denied."
> 
> The instance of mtxrun that TeXShop finds is entirely down to path settings 
> and/or TexShop preferences settings (in its 'engine' files) and nothing to do 
> with the security permissions.
> 
> Regarding the security permissions there is something else to check: go to 
> System Preferences -> Security & Privacy -> Privacy tab -> Full Disk Access.
> Make sure 'TeXShop.app' and 'Terminal.app' are both in the list.
> 
> If that still doesn't work then there is one more thing but it will be a 
> PITA. :-(
> 
> And that is to install Xcode and the Xcode developer tools. This then gives 
> you another Privacy entry in the left hand list called "Developer Tools" and, 
> above the apps list on the right, the description reads "Allow the apps below 
> to run software locally that does not meet the system's security policy." Add 
> Terminal.app here.
> 
> —
> Bruce Horrocks
> Hampshire, UK

___
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 is DOA on my M1 Mac

2022-03-12 Thread Gavin via ntg-context
Hi Hans,

> i uploaded a new installer / uopdates with mojca's bin

Thanks for putting that together. Unfortunately, same result:

TeXShop produces no output in console
"mtxrun —generate” produces "zsh: killed mtxrun --generate"


JP,

The control-open trick seemed like a good idea, but it didn’t change my 
results. TeXShop findes an old version from TeXLive, probably because it can’t 
use the new one. In Terminal I still get “permission denied."

Gavin
___
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 is DOA on my M1 Mac

2022-03-12 Thread Gavin via ntg-context
Hi Mojca,

I think my security settings are preventing me from using this luametatex file. 
When trying to update the installation, I got a window that says:

“luametatex” can’t be opened because Apple cannot check it for 
malicious software.

When I tried running mtxrun --generate, in Terminal, I got the response:

zsh: permission denied: mtxrun

I’m not sure how to get around this.

Gavin


> On Mar 12, 2022, at 8:31 AM, Mojca Miklavec via ntg-context 
>  wrote:
> 
> Hans,
> 
> I manually uploaded luametatex for arm64-darwin now.
> Not that I actually checked anything.
> 
> Gavin, are you willing to try the binary from
>https://dl.contextgarden.net/build/luametatex/arm64-darwin/
> ?
> 
> Mojca
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

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

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


Re: [NTG-context] New upload is DOA on my M1 Mac

2022-03-12 Thread Gavin via ntg-context
Hi Mojca,

> Gavin, are you willing to try the binary from
>https://dl.contextgarden.net/build/luametatex/arm64-darwin/
> ?

I am willing to try. I downloaded the luametatex file at that address, but I’m 
not sure what to do with it. Do I just replace the luametatex in my 
installation, or should I install usining my usual procedure and then replace?

Gavin

___
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] New upload is DOA on my M1 Mac

2022-03-12 Thread Gavin via ntg-context
Hi List,

I just installed the new upload on my M1 mac using my usual procedure, which is 
to update the modules and then run sh ./install.sh (details here: 
https://wiki.contextgarden.net/Modules#ConTeXt_LMTX, simplified method).

Afterwords, a hello world context document produced no effect, not even a 
single entry in the console, when using TeXShop. Using the command line to run 
mtxrun --generate. All I got from the effort was:

zsh: killed mtxrun --generate

I’m not sure what that means, but it isn’t promising. I restored my previous 
ConTeXt installation any everything is fine again.

If anyone else has the new upload working on an M1 Mac, or can confirm that it 
isn’t working, I’d like to hear about it.

Thanks!
Gavin
___
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] Suggestions for more math classes?

2022-02-16 Thread Gavin via ntg-context
Hi Mikael,

A while back you asked the list about math class ideas.

> Q1: Do you have any further suggestions on new classes (or comments on
> these)? It might be good to think about situations where you have felt
> that you need to insert manual spaces such as \, or \! to obtain a
> better result.

Three things came to mind:

1) Units, where I use:
 \, to separate units from the number
 \rm to get the text font
 \!\cdot\!  to get something like kg•m/s

2) Digits, where I use {,} to get a thousands separator

3) Chemical equations, which seem to be in their own strange world right now

Thanks for working on CoTeXt math!

Gavin
___
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] Solved! Itemize columns with MPgraphics: another vertical spacing puzzle

2022-01-14 Thread Gavin via ntg-context
Thanks, Hans!

That works, and it makes sense. Playing with frames always pays, indeed.

-Gavin


> On Jan 14, 2022, at 3:18 PM, Hans Hagen  wrote:
> 
> On 1/14/2022 8:10 PM, Gavin via ntg-context wrote:
>> Hi List,
>> I solved this problem, but the solution is a bit mysterious to me. I was 
>> trying to solve another problem – removing the small space underneath the 
>> graphic in the framed box. I did this by adding boffset=-\strutdepth to the 
>> framed command. That not only got rid of the space inside the frame, it also 
>> removed the excess space between the rows in the itemize columns!
>> I don’t know why this fix solved both problems, but I’m happy with the 
>> result. Now I can use options for the choices – like packed and joinedup – 
>> with consistent results for any number of columns. I’ve put the fixed code 
>> and output below, for anyone who is interested.
>> Even when I’m a bit confused, I’m glad to be working with ConTeXt rather 
>> than any other system!
> 
> % your hack:
> 
> \define[1]\mycolordot{\def\mycolor{#1}\framed[location=top,offset=0pt,boffset=-\strutdepth,xframe=off]{\useMPgraphic{name}}}
> 
> % but ... you just don't want struts
> 
> \define[1]\mycolordot{\def\mycolor{#1}\framed[location=top,offset=0pt,strut=no,frame=off]{\useMPgraphic{name}}}
> 
> % and no offset but also no invisible frame
> 
> \define[1]\mycolordot{\def\mycolor{#1}\framed[location=top,offset=overlay,frame=off]{\useMPgraphic{name}}}
> 
> playing with framed for a while alway spays back
> 
> 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] Solved! Itemize columns with MPgraphics: another vertical spacing puzzle

2022-01-14 Thread Gavin via ntg-context
Hi List,

I solved this problem, but the solution is a bit mysterious to me. I was trying 
to solve another problem – removing the small space underneath the graphic in 
the framed box. I did this by adding boffset=-\strutdepth to the framed 
command. That not only got rid of the space inside the frame, it also removed 
the excess space between the rows in the itemize columns!

I don’t know why this fix solved both problems, but I’m happy with the result. 
Now I can use options for the choices – like packed and joinedup – with 
consistent results for any number of columns. I’ve put the fixed code and 
output below, for anyone who is interested.

Even when I’m a bit confused, I’m glad to be working with ConTeXt rather than 
any other system!

Best,
Gavin


\starttext

\defineitemgroup[questions]
\setupquestions [1] [n]
\define\question{\item}

\defineitemgroup[choices]
\setupchoices [each] [A,columns] [left=(, right=), width=1.7em, stopper=,]
\define\choice{\item}

\def\mycolor{.625red}

\startuseMPgraphic{name}
  fill fullcircle scaled 40pt withcolor \mycolor;
\stopuseMPgraphic

\define[1]\mycolordot{\def\mycolor{#1}\framed[location=top,offset=0pt,boffset=-\strutdepth,frame=off]{\useMPgraphic{name}}}

Here are a few great looking multiple choice questions about colors.
\startquestions
\question What is your favorite color?
\startchoices[columns,four]
  \choice \mycolordot{.625red}
  \choice \mycolordot{.625blue}
  \choice \mycolordot{.625green}
  \choice \mycolordot{.625magenta}
\stopchoices

\question What is your least favorite color?
\startchoices[columns]
  \choice \mycolordot{.625red}
  \choice \mycolordot{.625blue}
  \choice \mycolordot{.625green}
  \choice \mycolordot{.625magenta}
\stopchoices

\question Toward which colors do you feel indifferent?
\startchoices[one]
  \choice \mycolordot{.625red}
  \choice \mycolordot{.625blue}
  \choice \mycolordot{.625green}
  \choice \mycolordot{.625magenta}
\stopchoices
\stopquestions

That's it for questions about colors!

\stoptext



PastedGraphic-2.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
___


[NTG-context] Itemize columns with MPgraphics: another vertical spacing puzzle

2022-01-14 Thread Gavin via ntg-context
Hi List,

I need to itemize graphics when I use those graphics as the choices in a 
multiple choice question. When I do that in columns, I am getting excess space 
below the graphics. See example code and output below. Any suggestions for how 
I get rid of this space?

I’m not sure if this is related to the itemize column spacing in my previous 
comment.

Thanks, again!
Gavin


\starttext

\defineitemgroup[choices]
\setupchoices [each] [A,joinedup] [left=(, right=), width=1.7em, stopper=,]
\define\choice{\item}

\def\mycolor{.625red}

\startuseMPgraphic{name}
  fill fullcircle scaled 40pt withcolor \mycolor;
\stopuseMPgraphic

\define[1]\mycolordot{\def\mycolor{#1}\framed[location=top,offset=0pt,frame=off]{\useMPgraphic{name}}}

What is your favorite color? (There is too much space after these choices.)
\startchoices[columns,four]
  \choice \mycolordot{.625red}
  \choice \mycolordot{.625blue}
  \choice \mycolordot{.625green}
  \choice \mycolordot{.625magenta}
\stopchoices

A ruledhboxs show the extra space is in the itemize, but not in the item 
contents.

\ruledhbox{\startchoices[columns, four]
  \choice \ruledhbox{\mycolordot{.625red}}
  \choice \mycolordot{.625blue}
  \choice \mycolordot{.625green}
  \choice \mycolordot{.625magenta}
\stopchoices}

Putting a ruledhbox around the first item shows that each item has extra space 
that is not part of the item contents. (The ruledhbox also messes with the 
horizontal alignment, but I don't care about that.)
\startchoices[columns]
  \ruledhbox{\choice \mycolordot{.625red}}
  \choice \mycolordot{.625blue}
  \choice \mycolordot{.625green}
  \choice \mycolordot{.625magenta}
\stopchoices

The extra space is not present without columns.
\startchoices
  \choice \mycolordot{.625red}
  \choice \mycolordot{.625blue}
  \choice \mycolordot{.625green}
  \choice \mycolordot{.625magenta}
\stopchoices

\ruledhbox{My favorite color is:\def\mycolor{.625blue}
\framed[location=top,offset=0pt,frame=on] {\useMPgraphic{name}}}

\stoptext



PastedGraphic-1.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] Spacing issue in itemize

2022-01-14 Thread Gavin via ntg-context
Hi Hans, Aditya, and all,

Let me add another case to this discussion. For multiple choice questions, it 
is nice to have the columns option. However, this produces somewhat 
inconsistent results. In the code below, without Aditya's tweak, there is space 
before the choices in the first two cases, which use columns, but not the last. 
Aditya’s  tweak makes them more consistent.

Adding [columns, one] to the last \startchoices makes the results consistent. 
When doing that, I noticed that the spacing between column rows is slightly 
larger than the spacing between items without columns. So, I am happy using 
[columns, one] as a solution for multiple choice problems, just somewhat 
surprised by the difference.

Gavin


\starttext

%\unprotect
%\c_strc_itemgroups_spacing_mode\plusone
%\protect

\defineitemgroup[questions]
\setupquestions [1] [n]
\define\question{\item}

\defineitemgroup[choices]
\setupchoices [each] [A] [left=(, right=), width=1.7em, stopper=,]
\define\choice{\item}

Here are a few great looking multiple choice questions about colors.
\startquestions
\question What is your favorite color?
\startchoices[columns,four]
  \item Red
  \item Blue
  \item Green
  \item Magenta
\stopitemize
\question What is your least favorite color?
\startchoices[columns]
  \item Red
  \item Blue
  \item Green
  \item Magenta
\stopitemize
\question Toward which colors do you feel indifferent?
\startchoices
  \item Red
  \item Blue
  \item Green
  \item Magenta
\stopitemize
\stopquestions
That's it for questions about colors!

\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] MetaFun: textext.origin, thelabel.origin not positioned on baseline

2022-01-13 Thread Gavin via ntg-context
Hello again List,

Now I’m making diagrams using MetaFun. The MetaFun manual describes an “origin” 
option for positioning textext’s and label’s on the baseline. However, this 
dose not appear to be happening with the code in the manual (below). In fact, 
the diagram in the manual dose not show the textext’s and label’s on the 
baseline. This is on page 144 of metafun-p.pdf.

Maybe I misunderstand what is supposed to be happening here.

Thanks!
Gavin


\startMPcode
  picture p ; p :=  \MPbetex {1}  ;
  picture q ; q :=  textext.origin( \MPstring{2}) ;
  picture r ; r := thelabel.origin("\MPtext  {3}",origin) ;
  for i=p, boundingbox p : draw i withcolor .625red; endfor ;
  for i=q, boundingbox q : draw i withcolor .625yellow ; endfor ;
  for i=r, boundingbox r : draw i withcolor .625white  ; endfor ;
  currentpicture := currentpicture scaled 2 ;
  draw origin
withpen pencircle scaled 5.0mm withcolor white ;
  draw origin
withpen pencircle scaled 2.5mm withcolor black ;
  draw boundingbox currentpicture
withpen pencircle scaled .1mm
dashed evenly ;
\stopMPcode

___
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] Spacing issue in itemize

2022-01-13 Thread Gavin via ntg-context
Thank you again, Aditya!

I changed my documents so I use three levels of question, which solved the 
problem.

My code might be more readable if the different levels had different names 
(question, part, subpart), rather than nested questions in questions. This was 
my original intention. I was certainly surprised by the result.

Now I’m moving on to the problem set's diagrams with MetaFun.

Gavin


> On Jan 13, 2022, at 10:15 AM, Aditya Mahajan via ntg-context 
>  wrote:
> 
> On Thu, 13 Jan 2022, Gavin via ntg-context wrote:
> 
>> Hi list,
>> 
>> When I define an items group, it seems to mess up the spacing for a nested 
>> item group. See example below. Any ideas?
>> 
>> I’m typesetting with
>> 
>>  > ConTeXt  ver: 2022.01.06 19:51 LMTX  fmt: 2022.1.9  int: 
>> english/english
>> 
>> on an M1 Mac.
>> 
>> Thanks!
>> Gavin
>> 
>> 
>> \usemodule[visual]
>> 
>> \defineitemgroup[questions]
>> \setupquestions [each] [n]
>> 
>> \starttext
>> This numbered list uses my item group \quotation{questions.} The itemize 
>> inside is missing space above item (a).
>> \startquestions
>>  \item \fakewords{15}{20}
>>\startitemize[a][left=(,stopper=,right=)]
>>  \item \fakewords{10}{15}
>>  \item \fakewords{10}{15}
>>\stopitemize
>>  \item \fakewords{10}{15}
>> \stopquestions
>> 
>> This numbered list uses itemize. The itemize inside has the expected space 
>> above item (a).
>> \startitemize[n]
>>  \item \fakewords{15}{20}
>>\startitemize[a][left=(,stopper=,right=)]
>>  \item \fakewords{10}{15}
>>  \item \fakewords{10}{15}
>>\stopitemize
>>  \item \fakewords{10}{15}
>> \stopitemize
>> 
>> \stoptext
> 
> This is by design. This is what is happening:
> 
> \usemodule[visual]
> 
> \defineitemgroup[questions]
> 
> \starttext
> This numbered list uses my item group \quotation{questions.} The itemize 
> inside is missing space above item (a).
> \startquestions[n][inbetween={AAA}]
>  \item \fakewords{15}{20}
>\startitemize[a][left=(,stopper=,right=),before={BBB}]
>  \item \fakewords{10}{15}
>  \item \fakewords{10}{15}
>\stopitemize
>  \item \fakewords{10}{15}
> \stopquestions
> 
> This numbered list uses itemize. The itemize inside has the expected space 
> above item (a).
> \startitemize[n][inbetween={AAA}]
>  \item \fakewords{15}{20}
>\startitemize[a][left=(,stopper=,right=),before={BBB}]
>  \item \fakewords{10}{15}
>  \item \fakewords{10}{15}
>\stopitemize
>  \item \fakewords{10}{15}
> \stopitemize
> 
> \stoptext
> 
> Note that in the first case, the inbetween does not get inserted at the start 
> of the nested itemization (because, ConTeXt doesn't think that they are 
> nested as the names are different). But the before key of the nested 
> itemization doesn't get inserted in both cases because ConTeXt thinks that 
> the itemization is nested!
> 
> You can change this behavior by using:
> 
> \unprotect
> \c_strc_itemgroups_spacing_mode\plusone
> \protect
> 
> in which case both outputs are similar. 
> 
> @Hans: Does it make sense to add a setups key to \setupitemize to keep such 
> changes local?
> 
> Aditya
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

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

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


[NTG-context] Spacing issue in itemize

2022-01-13 Thread Gavin via ntg-context
Hi list,

When I define an items group, it seems to mess up the spacing for a nested item 
group. See example below. Any ideas?

I’m typesetting with

> ConTeXt  ver: 2022.01.06 19:51 LMTX  fmt: 2022.1.9  int: 
english/english

on an M1 Mac.

Thanks!
Gavin


\usemodule[visual]

\defineitemgroup[questions]
\setupquestions [each] [n]

\starttext
This numbered list uses my item group \quotation{questions.} The itemize inside 
is missing space above item (a).
\startquestions
  \item \fakewords{15}{20}
\startitemize[a][left=(,stopper=,right=)]
  \item \fakewords{10}{15}
  \item \fakewords{10}{15}
\stopitemize
  \item \fakewords{10}{15}
\stopquestions

This numbered list uses itemize. The itemize inside has the expected space 
above item (a).
\startitemize[n]
  \item \fakewords{15}{20}
\startitemize[a][left=(,stopper=,right=)]
  \item \fakewords{10}{15}
  \item \fakewords{10}{15}
\stopitemize
  \item \fakewords{10}{15}
\stopitemize

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

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


Re: [NTG-context] \sub conflict with my def

2022-01-13 Thread Gavin via ntg-context
Thanks, Hans! Appending to \everymathematics is a powerful trick, which I will 
not overuse.

-Gavin

> On Jan 12, 2022, at 12:14 PM, Hans Hagen  wrote:
> 
> On 1/12/2022 7:34 PM, Gavin via ntg-context wrote:
>> Hi List,
>> I am converting problem sets from LaTeX to ConTeXt and ran into a puzzling 
>> problem. I define \sub to produce subscript text in math mode. (See 
>> definition below.) This worked for my ConTeXt book, but fails in the problem 
>> sets because in ConTeXt \sub is a special item command, and I use itemize to 
>> number problems.
>> Obviously, I can rename my \sub command, but it is already used in hundreds 
>> of problems and solutions that I am converting. Is there a way to get my 
>> \sub to work in an itemize? I only need it in math mode. I will never use 
>> \sub for its ConTeXt itemizing purpose.
> 
> \appendtoks
>\define[1]\sub{_{\text{\rm\tf#1}}}%
> \to \everymathematics
> 
> or nicer:
> 
> \define[1]\MyMathSub{_{\text{\rm\tf#1}}}
> 
> \appendtoks
>\let\sub\MyMathSub
> \to \everymathematics
> 
> 
>> Thanks!
>> Gavin
>> \define[1]\sub{_{\text{\rm\tf#1}}}
>> \starttext
>> $E\sub{final}$ is the final energy, but not in an itemize:
>> \startitemize
>> \item $E_{\text{\rm final}}$ is the final energy.
>> \item $E\sub{final}$ is a mess.
>> \stopitemize
>> \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
>> ___
> 
> 
> -- 
> 
> -
>  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] \sub conflict with my def

2022-01-12 Thread Gavin via ntg-context
Hi List,

I am converting problem sets from LaTeX to ConTeXt and ran into a puzzling 
problem. I define \sub to produce subscript text in math mode. (See definition 
below.) This worked for my ConTeXt book, but fails in the problem sets because 
in ConTeXt \sub is a special item command, and I use itemize to number problems.

Obviously, I can rename my \sub command, but it is already used in hundreds of 
problems and solutions that I am converting. Is there a way to get my \sub to 
work in an itemize? I only need it in math mode. I will never use \sub for its 
ConTeXt itemizing purpose.

Thanks!
Gavin


\define[1]\sub{_{\text{\rm\tf#1}}}

\starttext

$E\sub{final}$ is the final energy, but not in an itemize:

\startitemize
\item $E_{\text{\rm final}}$ is the final energy.
\item $E\sub{final}$ is a mess.
\stopitemize

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

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


Re: [NTG-context] Conditional text appearing in a fixed vertical space

2022-01-12 Thread Gavin via ntg-context
Thanks Fabrice and Aditya!

With three completely different approaches, I learned three times more than I 
was expecting. This has been a great help. I will probably use the framedtext 
method, but I learned something from each.

Gavin


> On Jan 11, 2022, at 4:44 PM, Aditya Mahajan  wrote:
> 
> On Tue, 11 Jan 2022, Gavin via ntg-context wrote:
> 
>> Hello List,
>> 
>> I am making problem sets for a physics class. Solutions use the style 
>> defined in the example below, and only appear if the “solution” mode is 
>> enabled. I am struggling to get a vertical space for the solution which is 
>> the same whether or not the solution is printed. Different problems require 
>> different amounts of space, so this should be an argument or key-value.
> 
> This is how I would do it: piggyback on framedtext. Note that framedtext 
> doesn't break across pages. So, if you have long answers, a different 
> mechanism is needed. 
> 
> \definemode[solution][no]
> 
> \doifmodeelse{solution}
>  {\defineframedtext[solution][empty=no]}
>  {\defineframedtext[solution][empty=yes]}
> 
> % Doesn't work. Why?
> % 
> \expanded{\defineframedtext[solution][empty=\doifmodeelse{solution}{no}{yes}]}
> 
> \setupframedtext
>  [solution]
>  [
>spacebefore=medium,
>spaceafter=medium,
>width=broad,
>foregroundstyle=\rm\it,
>loffset=2em,
>roffset=2em,
>indentnext=no,
>  ]
> 
> 
> \starttext
> 
> Sample question. Always show answer.
> 
> \startsolution[height=1in, empty=no]
>  Alotta wood!
> \stopsolution
> 
> 
> How much wood? 
> 
> \startsolution[height=1in]
>  Alotta wood!
> \stopsolution
> 
> You don't need to specify the height:
> 
> \startsolution
>  \input ward
> \stopsolution
> 
> No more questions.
> \stoptext

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

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


Re: [NTG-context] Conditional text appearing in a fixed vertical space

2022-01-11 Thread Gavin via ntg-context
Thanks Hans! This is great. I made a slight change to add an additional 
feature. By moving the “mysolution” definition out of \startmode[solution], I 
can now use mysolution in either mode. I’d use this if I want to give my 
solution to one of the problems, as an example, on the handout.

-Gavin


% \enablemode[solution]

% Define "mysolution” for use independent of solution mode.
\definenarrower[mysolution]
  [before=\blank\it,
   after=\blank]

% If in solution mode, define "solution" to use "mysolution"
\startmode[solution]
   \tolerant\protected\def\startsolution[#1]%
 {\startmysolution}
   \protected\def\stopsolution
 {\stopmysolution}
\stopmode

% If NOT in solution mode, define "solution" to produce a blank space
\startnotmode[solution]
   \tolerant\protected\def\startsolution[#1]%
 {\doifelsenothing{#1}{\blank[1in]}{\blank[#1]}
  \gobbleuntil\stopsolution}
   \protected\def\stopsolution
 {}
\stopnotmode


\starttext

How many roads?
  \startsolution
42 roads.
  \stopsolution

How much wood?
  \startsolution[1.5in]
Alotta wood!
  \stopsolution

No more questions.

\stoptext


> On Jan 11, 2022, at 1:13 PM, Hans Hagen  wrote:
> 
> On 1/11/2022 8:50 PM, Gavin via ntg-context wrote:
>> Hello List,
>> I am making problem sets for a physics class. Solutions use the style 
>> defined in the example below, and only appear if the “solution” mode is 
>> enabled. I am struggling to get a vertical space for the solution which is 
>> the same whether or not the solution is printed. Different problems require 
>> different amounts of space, so this should be an argument or key-value.
>> In the example below, the first solution has the desired behavior. The 
>> second solution has the syntax I’d like, but it doesn’t make the space 
>> without a solution.
>> Any ideas would be welcome! I am still pretty new to ConTeXt, so I struggle 
>> mixing things like the plain tex \vbox and ConTeXt \start…\stop concepts.
>> Thanks,
>> Gavin
>> \definemode[solution][yes] % yes to enable solutions, no to disable
>> \definebuffer  [solution] % Captures solution in a buffer that isn't used
>> \startmode[solution] % If in solution mode, redefine 
>> \startsolution...\stopsolution
>> \definedelimitedtext[solution][ % Solution italic and indented
>>   spacebefore=medium,
>>   spaceafter=medium,
>>   style=\rm\it,
>>   leftmargin=standard, % Indents block on the left
>>   rightmargin=yes, % Indents block on the right
>>   indentnext=no,
>>   before=\vbox to 1in\bgroup,
>>   after=\egroup,
>> ]
>> \stopmode
>> \starttext
>> How many roads? (The 1-inch space below appears whether or not it contains a 
>> solution.)
>> \vbox to 1in{%
>>   \startsolution
>> 42 roads.
>>   \stopsolution
>> }
>> How much wood? (I would like to define solution so this to behaves like the 
>> previous question.)
>> \startsolution[1in]
>>   Alotta wood!
>> \stopsolution
>> No more questions.
>> \stoptext
> a mix between big and low level
> 
> % \enablemode[solution]
> 
> \startmode[solution] % If in solution mode, redefine 
> \startsolution...\stopsolution
> 
>\definenarrower
>  [mysolution]
>  [before=\blank,
>   after=\blank]
> 
>\tolerant\protected\def\startsolution[#1]%
>  {\startmysolution
>   \it}
> 
>\protected\def\stopsolution
>  {\stopmysolution}
> 
> \stopmode
> 
> \startnotmode[solution] % If in solution mode, redefine 
> \startsolution...\stopsolution
> 
>\tolerant\protected\def\startsolution[#1]%
>  {\doifelsenothing{#1}{\blank[2.5cm]}{\blank[#1]}
>   \gobbleuntil\stopsolution}
> 
>\protected\def\stopsolution
>  {}
> 
> \stopnotmode
> 
> \starttext
> 
> How many roads? (The 1-inch space below appears whether or not it contains a 
> solution.)
> 
> \startsolution
>42 roads.
> \stopsolution
> 
> How much wood? (I would like to define solution so this to behaves like the 
> previous question.)
> 
> \startsolution[1in]
>Alotta wood!
> \stopsolution
> 
> No more questions.
> \stoptext
> 
> much nicer is to use the blocks mechanism (but i need to check if we can do 
> the 2in there)
> 
> 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] Conditional text appearing in a fixed vertical space

2022-01-11 Thread Gavin via ntg-context
Hello List,

I am making problem sets for a physics class. Solutions use the style defined 
in the example below, and only appear if the “solution” mode is enabled. I am 
struggling to get a vertical space for the solution which is the same whether 
or not the solution is printed. Different problems require different amounts of 
space, so this should be an argument or key-value.

In the example below, the first solution has the desired behavior. The second 
solution has the syntax I’d like, but it doesn’t make the space without a 
solution.

Any ideas would be welcome! I am still pretty new to ConTeXt, so I struggle 
mixing things like the plain tex \vbox and ConTeXt \start…\stop concepts.

Thanks,
Gavin




\definemode[solution][yes] % yes to enable solutions, no to disable

\definebuffer  [solution] % Captures solution in a buffer that isn't used

\startmode[solution] % If in solution mode, redefine 
\startsolution...\stopsolution
\definedelimitedtext[solution][ % Solution italic and indented
  spacebefore=medium,
  spaceafter=medium,
  style=\rm\it,
  leftmargin=standard, % Indents block on the left
  rightmargin=yes, % Indents block on the right
  indentnext=no,
  before=\vbox to 1in\bgroup,
  after=\egroup,
]
\stopmode

\starttext

How many roads? (The 1-inch space below appears whether or not it contains a 
solution.)

\vbox to 1in{%
  \startsolution
42 roads.
  \stopsolution
}

How much wood? (I would like to define solution so this to behaves like the 
previous question.)
\startsolution[1in]
  Alotta wood!
\stopsolution

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

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


Re: [NTG-context] tikzplot displacement result

2021-12-12 Thread Gavin via ntg-context
Hi Jan-Erik,

Use the \addplot command when you use pgfplots. The manual, pgfplots.pdf, is 
quite good.

\setupbodyfont[10pt]
\enableregime[utf]
\usemodule[tikz]
\usemodule[pgfplots]
\usetikzlibrary[arrows]
\setuppagenumbering[location=]
\starttext
\definecolor[ffvvqq][r=1.,g=0.,b=0.]
\startTEXpage
\starttikzpicture[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\startaxis
[
x=1.0cm,y=1.0cm,
axis lines=middle,
ymajorgrids=true,
xmajorgrids=true,
xmin=-3.2488079448294145,
xmax=34.87398305791419,
ymin=-7.496155590728956,
ymax=11.53265632858922,
xtick={-3.0,-2.0,...,34.0},
ytick={-7.0,-6.0,...,11.0},]
%\clip(-3.2488079448294145,-7.496155590728956) rectangle 
(34.87398305791419,11.53265632858922);
\addplot[line 
width=2.pt,color=ffvvqq,smooth,samples=100,domain=-3.2488079448294145:34.87398305791419]{x+3}
 node[below right, pos= 0.1]{$h$};
\stopaxis
\stoptikzpicture
\stopTEXpage
\stoptext

I removed the clip command because it is causing a problem and is unnecessary. 
I don’t know what you are trying to do with the node{$h$}, but I made it a 
label on the plot.

The metafun graph module would also work for this plot, but it pgfplots is more 
mature. I recommend using pgfplots unless you are already skilled with metapost.

Hope that gets you going in the right direction.

Gavin



> On Dec 12, 2021, at 3:13 AM, Jan-Erik Hägglöf via ntg-context 
>  wrote:
> 
> HI!
> 
> I’m trying to fit the funktion in the right place in this plot but it seems 
> to get displaced.
> 
> What is wrong with the code?
> 
> Is there a way to do this in Metafun?
> 
> Thanks in advance
> 
> Sincerely 
> 
> Jan-Erik
> 
> 
> 
> \setupbodyfont[10pt]
> \enableregime[utf]
> \usemodule[tikz]
> \usemodule[pgfplots]
> \usetikzlibrary[arrows]
> \setuppagenumbering[location=]
> \starttext
> \definecolor[ffvvqq][r=1.,g=0.,b=0.]
> \startTEXpage
> \starttikzpicture[line cap=round,line join=round,>=triangle 
> 45,x=1.0cm,y=1.0cm]
> \startaxis
> [
> x=1.0cm,y=1.0cm,
> axis lines=middle,
> ymajorgrids=true,
> xmajorgrids=true,
> xmin=-3.2488079448294145,
> xmax=34.87398305791419,
> ymin=-7.496155590728956,
> ymax=11.53265632858922,
> xtick={-3.0,-2.0,...,34.0},
> ytick={-7.0,-6.0,...,11.0},]
> \clip(-3.2488079448294145,-7.496155590728956) rectangle 
> (34.87398305791419,11.53265632858922);
> \draw[line 
> width=2.pt,color=ffvvqq,smooth,samples=100,domain=-3.2488079448294145:34.87398305791419]
>  plot(\x,{(\x)+3});
> \draw[color=ffvvqq] (-3.5583519743388714,-0.7831230981304516) node {$h$};
> \stopaxis
> \stoptikzpicture
> \stopTEXpage
> \stoptext
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

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

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


Re: [NTG-context] Status of Asymptote

2021-12-06 Thread Gavin via ntg-context
Hi Alex,

I don’t know the status of Asymptote. I am using TikZ and pgfplots for 3D, with 
satisfactory results (example below). However, it is slow, so use the buffer 
mechanism to prevent redrawing with every run.

TIkZ/pgfplots is the best short term solution for diagrams I need right now. I 
am concerned that TikZ will eventually not work with ConTeXt, so for a long 
term solution I am trying to make diagrams with Metapost, using Lua to do the 
heavy computational work. This is not easy, but the diagrams are super fast, 
and I think they will always work.

Hope that helps.

Gavin




chapter07-t-b-1970d2b3267b0f295617c8a8d3f078eb.pdf
Description: Adobe PDF document



> On Dec 6, 2021, at 1:43 AM, Alexandre Christe via ntg-context 
>  wrote:
> 
> Dear all,
> 
> I'd like to know what is the status of Asymptote in Context. To my knowledge, 
> metapost/metafun only support 2D (except with the additional libraries from 
> Roegel, which would have to be cleaned up a bit).
> 
> Otherwise, what shall be used for 3D drawings in Context? TikZ? Something 
> else?
> 
> Thanks in advance.
> 
> Alex
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

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

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


[NTG-context] Solved: Making metafun pictures fainter

2021-10-12 Thread Gavin via ntg-context
Hi List,

Thanks, Hans, for your suggestion. In the end, I decided that I actually liked 
the silhouettes better than a faint version of the whole picture. Silhouettes 
clearly show the motion, but are far less visually distracting. In the figure 
below, the projectile motion’s are clear, including the cow’s constant angular 
velocity, but the final state still pops out.


Gracht.pdf
Description: Adobe PDF document

I used “redecorated" to get the pictures with light, solid grays. Below is code 
for producing just the ball, if anyone wants to see the details. It includes a 
simple “shadow" macro that produces a shadow of any picture with an adjustable 
gray.

I’m having lots of metafun!
Gavin


\startMPinclusions
  picture ball;
  ball := image(
fill fullcircle scaled 1cm
  withshademethod "circular"
  withshadecenter (.25,.25)
  withshadecolors (.8white, black);
draw fullcircle scaled 1cm withpen pencircle scaled 0.8pt ;);
  vardef shadow(expr p, t) = 
draw redecorated (draw p) withcolor t[background,0.8background];
  enddef; 
\stopMPinclusions

\startMPpage
  pair p;
  for i=0 upto 10:
p := (i*cm/10, -((i-7.33)**2)*cm/7);
shadow(ball shifted p, (i+1)/10) ;
  endfor
  draw ball shifted(1.1cm, -1.92cm) ;
\stopMPpage


> On Oct 11, 2021, at 2:53 AM, Hans Hagen  wrote:
> 
> On 10/11/2021 6:30 AM, Gavin via ntg-context wrote:
>> Hi List,
>> I made good progress producing fainter pictures in metafun. Here is a 
>> uniformly accelerated cow in the style of my book.
>> I abandoned transparency, since I actually don’t want to see through 
>> anything. I am using uncolored to get the fade. It works great with a 
>> picture that is made with fill and draw, but it doesn’t work with shading. 
>> The example below has a flat disk and a round ball. The disk looks fine, but 
>> the shaded ball is not surviving the application of inverted / uncolored.
>> \startMPinclusions
>>   picture disk, ball;
>>   disk := image(
>> fill fullcircle scaled 1cm withcolor .4white;
>> draw fullcircle scaled 1cm withpen pencircle scaled 0.8pt ;);
>>   ball := image(
>> fill fullcircle scaled 1cm
>>   withshademethod "circular"
>>   withshadecenter (.25,.25)
>>   withshadecolors (.8white, black);
>> draw fullcircle scaled 1cm withpen pencircle scaled 0.8pt ;);
>> \stopMPinclusions
>> \startMPpage
>>draw inverted (disk uncolored .1white) ;
>>draw inverted (disk uncolored .2white) shifted (0.25cm,0) ;
>>draw inverted (disk uncolored .5white) shifted (1cm,0) ;
>>draw disk shifted (2.25cm,0) ;
>>draw inverted (ball uncolored .1white) shifted (0, -2cm) ;
>>draw inverted (ball uncolored .2white) shifted (0.25cm, -2cm) ;
>>draw inverted (ball uncolored .5white) shifted (1cm, -2cm) ;
>>draw ball shifted (2.25cm, -2cm) ;
>> \stopMPpage
>> Same result in LMTX and MkIV. (ConTeXt  ver: 2021.09.17 10:01 LMTX  fmt: 
>> 2021.9.21  int: english/english)
>> I’m pretty happy with this uncolored trick, and will be even happier if I 
>> can get it to work with the shadings.
>> Any suggestions?
> \startMPpage
>fill fullcircle scaled 10cm
>shifted (3cm,0)
>withcolor white ;
>fill fullcircle scaled 10cm
>shifted (3cm,0)
>withcolor black
>withtransparency (1,.25) ;
> 
>fill fullcircle scaled 5cm
>shifted (3cm,0)
>withcolor .25[red,white] ;
> \stopMPpage
> 
> 
> -
>  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] Solved: Making metafun pictures fainter

2021-10-12 Thread Gavin via ntg-context
Hi List,Thanks, Hans, for your suggestion. In the end, I decided that I actually liked the silhouettes better than a faint version of the whole picture. Silhouettes clearly show the motion, but are far less visually distracting. In the figure below, the projectile motion’s are clear, including the cow’s constant angular velocity, but the final state still pops out.

Gracht.pdf
Description: Adobe PDF document
I used “redecorated" to get the pictures with light, solid grays. Below is code for producing just the ball, if anyone wants to see the details. It includes a simple “shadow" macro that produces a shadow of any picture with an adjustable gray.I’m having lots of metafun!Gavin\startMPinclusions  picture ball;  ball := image(    fill fullcircle scaled 1cm  withshademethod "circular"  withshadecenter (.25,.25)  withshadecolors (.8white, black);    draw fullcircle scaled 1cm withpen pencircle scaled 0.8pt ;);  vardef shadow(expr p, t) =     draw redecorated (draw p) withcolor t[background,0.8background];  enddef; \stopMPinclusions\startMPpage  pair p;  for i=0 upto 10:    p := (i*cm/10, -((i-7.33)**2)*cm/7);    shadow(ball shifted p, (i+1)/10) ;  endfor  draw ball shifted(1.1cm, -1.92cm) ;\stopMPpage___
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] Making metafun pictures fainter (shading, uncolored clash)

2021-10-10 Thread Gavin via ntg-context
Hi List,

I made good progress producing fainter pictures in metafun. Here is a uniformly 
accelerated cow in the style of my book.



PastedGraphic-2.pdf
Description: Adobe PDF document


I abandoned transparency, since I actually don’t want to see through anything. 
I am using uncolored to get the fade. It works great with a picture that is 
made with fill and draw, but it doesn’t work with shading. The example below 
has a flat disk and a round ball. The disk looks fine, but the shaded ball is 
not surviving the application of inverted / uncolored.


\startMPinclusions
  picture disk, ball;
  disk := image(
fill fullcircle scaled 1cm withcolor .4white;
draw fullcircle scaled 1cm withpen pencircle scaled 0.8pt ;);
  ball := image(
fill fullcircle scaled 1cm
  withshademethod "circular"
  withshadecenter (.25,.25)
  withshadecolors (.8white, black);
draw fullcircle scaled 1cm withpen pencircle scaled 0.8pt ;);
\stopMPinclusions

\startMPpage
   draw inverted (disk uncolored .1white) ;
   draw inverted (disk uncolored .2white) shifted (0.25cm,0) ;
   draw inverted (disk uncolored .5white) shifted (1cm,0) ;
   draw disk shifted (2.25cm,0) ;

   draw inverted (ball uncolored .1white) shifted (0, -2cm) ;
   draw inverted (ball uncolored .2white) shifted (0.25cm, -2cm) ;
   draw inverted (ball uncolored .5white) shifted (1cm, -2cm) ;
   draw ball shifted (2.25cm, -2cm) ;
\stopMPpage



Gracht.pdf
Description: Adobe PDF document


Same result in LMTX and MkIV. (ConTeXt  ver: 2021.09.17 10:01 LMTX  fmt: 
2021.9.21  int: english/english)

I’m pretty happy with this uncolored trick, and will be even happier if I can 
get it to work with the shadings.

Any suggestions?

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


  1   2   >