Re: [NTG-context] new hash for buffer (as file)

2022-09-25 Thread Max Chernoff via ntg-context

Hi Pablo,

> But now I don’t understand is the following issue: if the saved file
> contains "\r\n", why does basic Notepad the new lines?
> 
> "\r\n" are the chars to get new lines in Windows. Or what am I missing here?

I'm not too sure what you're asking here, but Notepad was somewhat-
recently updated to handle both CRLF and LF line endings:

   https://devblogs.microsoft.com/commandline/extended-eol-in-notepad/
   
But I do agree that the line ending handling seems a little odd. I find it
surprising that the buffers internally use CR line endings since no systems
in the past 20 years use that. 

Also, you should probably check to make sure that the results of the
file don't depend on the current code page on Windows. Try writing out a
buffer from ConTeXt with the following contents:

   АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя
   
First, run "chcp 65001" before running "context" and record the size of the
file written. Then, run "chcp 1251" and run "context" again. Hopefully the
file size doesn't change; but if it does, then that means that the binary
content of any file written will depend on the system's default code page,
which would complicate making reproducible hashes.
   
-- 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
___


Re: [NTG-context] new hash for buffer (as file)

2022-09-25 Thread Pablo Rodriguez via ntg-context
On 9/23/22 17:06, Pablo Rodriguez via ntg-context wrote:
> On 9/23/22 06:01, Max Chernoff via ntg-context wrote:
>> […]
>>return utilities.sha2.hash256(
>>str:gsub(string.char(0x0D), string.char(0x0A))
>>)
> […]
> this works perfectly fine with Linux "str:gsub('\r','\n')", but I can’t
> make it work in Windows.

Hi again Max,

this seems to solve the issue in Windows too:

  \startbuffer[test]
  just a test
  and another one
  \stopbuffer

  \starttext
  \startluacode
  require("util-sha")

  function sha256(str)
if os.name == "windows" then
  return utilities.sha2.hash256(str:gsub("\r", "\r\n"))
else
  return utilities.sha2.hash256(str:gsub("\r", "\n"))
end
  end
  \stopluacode

  \def\shabuffer#1%
{\cldcontext{sha256(buffers.raw("#1"))}}

  \def\shafile#1%
{\cldcontext{utilities.sha2.hash256(io.loaddata("#1"))}}

  \shabuffer{test}

  \savebuffer[test][temporary-αβγ, prefix=no]

  \shafile{temporary-αβγ}

  \stoptext

But now I don’t understand is the following issue: if the saved file
contains "\r\n", why does basic Notepad the new lines?

"\r\n" are the chars to get new lines in Windows. Or what am I missing here?

Many thanks for your help,

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

maillist : ntg-context@ntg.nl / 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] PDF viewer

2022-09-25 Thread Pablo Rodriguez via ntg-context
On 9/25/22 17:24, juh via ntg-context wrote:
> Am Thu, Sep 22, 2022 at 06:47:50PM -0600 schrieb Max Chernoff via ntg-context:
>> I think that pdf.js (the Firefox PDF viewer) meets most of these
>> requirements. There are a few requirements that it doesn't meet, but
>> it's open source and written in JavaScript, so we should be able to add
>> anything that's missing.
>
> I found a nasty bug in firefox.
>
> https://mailman.ntg.nl/pipermail/ntg-context/2022/105212.html
>
> https://bugzilla.mozilla.org/show_bug.cgi?id=1781022

As Jonathan Kew explained, TeX Gyre Heros is also poorly displayed with
Acrobat. The issue may be trickier than we thought (since fixing Firefox
with Heros+LMTX is only part of the issue).

Just as a personal note, I tend to avoid using Heros with LMTX, since
resulting PDF documents may be displayed (poorly on screen) with Acrobat.

I wonder whether this is related to common code for both Acrobat and
Firefox (originally comming from
https://lists.nongnu.org/archive/html/freetype-devel/2013-05/msg0.html).

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

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


Re: [NTG-context] Spacing in \unit

2022-09-25 Thread Bruce Horrocks via ntg-context


> On 25 Sep 2022, at 14:30, 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].

I too would prefer less space around the times e.g. \starttext 3.00×10\high{8} 
\stoptext is fine (except for the 8 which is nicer in \unit).

—
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 / 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 Hans Hagen via ntg-context

On 9/25/2022 5:29 PM, Gavin via ntg-context wrote:

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!
i can probably clean up the code a bit in lmtx ... units are not that 
(rapidly) evolving and much is rather old code so best collect all 
issues and make a test file that mikael and i can use (as wer then do 
math and text at the same time)


maybe we also need to add units (are there new ones anyway?)

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 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
___


Re: [NTG-context] PDF viewer

2022-09-25 Thread juh via ntg-context
Am Thu, Sep 22, 2022 at 06:47:50PM -0600 schrieb Max Chernoff via ntg-context:
> I think that pdf.js (the Firefox PDF viewer) meets most of these
> requirements. There are a few requirements that it doesn't meet, but
> it's open source and written in JavaScript, so we should be able to add
> anything that's missing.
> 

I found a nasty bug in firefox.

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

https://bugzilla.mozilla.org/show_bug.cgi?id=1781022

juh



signature.asc
Description: PGP signature
___
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 Hans Hagen via ntg-context

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] Is there an "align with item on facing page" option?

2022-09-25 Thread Bruce Horrocks via ntg-context
Is there a way to align text with an item on the facing page?

I'm typesetting author biographies for a book and I'm doing two per page. The 
author's name appears on a line of its own in \tfa size and then the bio text 
follows. Ideally I'd like their names aligned so that all four (on a two page 
spread) appear nicely symmetrical.

Currently I'm using \godown[\dimexpr80mm-\pagetotal] (for A5 pages) between 
each pair which works nicely in that if the first biography is too long it 
overlaps and I know to edit it to be shorter.

However, if the second biography is a little long, it pushes the first back up 
the page a little - maybe only one line - and then it no longer aligns with the 
the one on the facing page. If I could somehow tell ConTeXt to vertically align 
the author names then that might do the job?

I've tried using two frames above each other with fixed min and maxheight but 
then I can't get the author's thumbnail picture to place properly and have the 
text wrap around it.

Any thoughts?
—
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 / 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] line numbering for \setuptyping

2022-09-25 Thread Pablo Rodriguez via ntg-context
On 9/24/22 19:56, Pablo Rodriguez via ntg-context wrote:
> [...]
> Which \setuplinenumbering is applied to typing fragments?
>
> Just in case my question isn’t clear: how can I get "step=3" in the
> sample above?

Hi there,

I reply this question myself: "step" is a key in "\setuptyping"
("\setuplinenumbering[typing]" won’t work here).

Other options for line numbering are configured with
"\setuplinenumbering[typing]".

Just in case it might help for future reference,

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
___