Re: [NTG-context] Cannot access Lua function

2021-11-01 Thread Aditya Mahajan via ntg-context
On Sun, 31 Oct 2021, Hans Hagen via ntg-context wrote:

> in that case you probably need to hide more .. (when you process with 
> \nopdfcompression at the top you can look in the pdf, i.e. compression 
> is not encryption
> 
> one thing you can do is make a copy of lpdf-xmp.lmt and wipe all tricky 
> values and then use that to make a format
> 
> but if security is important, maybe better is to use "qpdf" to encrypt 
> the file (you can then also prevent editing for instance)

qpdf is also good at stripping metadata:

qpdf --empty --pages input.pdf -- output.pdf


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
___


Re: [NTG-context] SyncTeX setup

2021-11-01 Thread Hans Hagen via ntg-context

On 10/31/2021 11:31 AM, Henning Hraban Ramm via ntg-context wrote:

Hi,
has anyone a working SyncTeX setup with ConTeXt LMTX for anything else than 
TeXshop?

With LaTeX, it works for me with Skim (+ Atom/Textadept/TeXworks) and 
TeXstudio. And in TeXshop we got our own parser. But can we expect others to 
adapt to our “superior” SyncTeX format? (I don’t understand the format yet and 
can’t tell what’s the difference.)
There are two synctex formats, we support the second one (for as far as 
i can tell). There is no context synctex format (it's just less bloated 
and redundant than what an engine outputs). So, if an editor uses the 
old synctex format you're toast.


The nice thing about texshop is that it delegates interperting the 
synctex file to an external script (in this can mtx-synctex) which 
removed the dependency on a specific version of the library. After all, 
the editor (and viewer iif one goes two ways) only needs to know a 
position in the document of pdf. It's the macro package that needs to be 
in sync and this is one way to guarantee it. Another advantage is that 
we avoid the somewhat latex specific syntac parsing (probably making 
some assumptions about the way pages are constructed).


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] \doifinstring: strange characters on the output

2021-11-01 Thread Hans Hagen via ntg-context

On 10/31/2021 11:53 PM, Tomas Hala via ntg-context wrote:


I would like to ask what is the cause of this behavior and how to
use the \doifinstring to prevent the "fbf@" on the output.

btw, you can prevent it by using lmtx

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] \doifinstring: strange characters on the output

2021-11-01 Thread Hans Hagen via ntg-context

On 10/31/2021 11:53 PM, Tomas Hala via ntg-context wrote:

Hi all,

I noticed that \doifinstring produces quite strange output if a command
follows immediately (or with any amount of spaces) after the substring
I am searching for:

-MWE
\starttext
\def\xxx{asdf \bf Z:\bf asdf} % strange
\def\xxx{asdf \bf Z: \bf asdf}% strange
\def\xxx{asdf \bf Z:: \bf asdf}   % OK
\def\xxx{asdf \bf Z: text \bf asdf}   % OK
\def\xxx{asdf \bf Z:{} \bf asdf}  % OK

\doifinstring{Z:}{\xxx}{yes!}
\stoptext
--OUTPUT
fbf@yes!
fbf@yes!
yes!
yes!
yes!


If I insert another character, text or {} between them
(with or without spaces), all is ok.

I would like to ask what is the cause of this behavior and how to
use the \doifinstring to prevent the "fbf@" on the output.

partial expansion of a protected macro where one doesn't expect it

before i patch i let wolfgang check it

-
  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] check installed program using Lua

2021-11-01 Thread Hans Hagen via ntg-context

On 11/1/2021 2:26 PM, Pablo Rodriguez via ntg-context wrote:

Dear list,

is there a way if a program is installed on the computer using Lua.

I have the following sample:

   \starttext
   \startluacode
   filename = tex.jobname .. ".pdf"
   os.exec("dir " .. filename)
   \stopluacode
   \stoptext

Is there a way to wrap os.exec() in the sample so that it only runs if
"dir" is available?

I know that os.name would be an option here, but not in my real world
document.


\starttext
  \startluacode
if lfs.isfile(tex.jobname .. ".pdf") then
context("YES")
end
if lfs.isfile(file.addsuffix(environment.outputfilename,"pdf")) then
context("YES")
end
if #dir.glob(file.addsuffix(environment.outputfilename,"pdf")) > 0 then
context("YES")
end
  \stopluacode
\stoptext

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
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] check installed program using Lua

2021-11-01 Thread Taco Hoekwater via ntg-context


> On 1 Nov 2021, at 14:26, Pablo Rodriguez via ntg-context  
> wrote:
> 
> Dear list,
> 
> is there a way if a program is installed on the computer using Lua.
> 
> I have the following sample:
> 
>  \starttext
>  \startluacode
>  filename = tex.jobname .. ".pdf"
>  os.exec("dir " .. filename)
>  \stopluacode
>  \stoptext
> 
> Is there a way to wrap os.exec() in the sample so that it only runs if
> "dir" is available?

if os.which(‘dir’) then
  ...
end

But note that os.which() may be unreliable in various cases (like it will fail 
for shell/command interpreter builtins, in cron jobs, in special scripted 
environments, and may incorrectly succeed for disabled/forbidden commands), as 
it just runs through the PATH environment variable to check for executable file 
existence. 

Often times, it is better to just try to run the command to see if that 
produces satisfactory results.

Best wishes,
taco

— 
Taco Hoekwater  E: t...@bittext.nl
genderfluid (all pronouns)



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

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


[NTG-context] check installed program using Lua

2021-11-01 Thread Pablo Rodriguez via ntg-context
Dear list,

is there a way if a program is installed on the computer using Lua.

I have the following sample:

  \starttext
  \startluacode
  filename = tex.jobname .. ".pdf"
  os.exec("dir " .. filename)
  \stopluacode
  \stoptext

Is there a way to wrap os.exec() in the sample so that it only runs if
"dir" is available?

I know that os.name would be an option here, but not in my real world
document.

Many thanks for your help,

Pablo
--
http://www.ousia.tk
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


Re: [NTG-context] \externafigure and \at do not work together

2021-11-01 Thread Wolfgang Schuster via ntg-context

Otared Kavian via ntg-context schrieb am 31.10.2021 um 18:11:

Hi,

Your example has two issues, since you invoke \externalfigure before 
\starttext, and moreover you don’t use the place figure mechanism.
The following gives the result you want:

\setupinteraction[state=start]
\starttext
\startplacefigure[reference=clock]
\externalfigure[clock.jpg]
\stopplacefigure
In figure \at[clock] you see a clock
\page
In figure \at[clock] you see a clock.

Or better: in \in{Figure}[clock] you see a clock.
\stoptext


With \in you the value of the float counter while \at shows the page 
where the float is placed.



The original example passed a name to the optional argument of 
\externalfigure but when you do this you just access a named list of 
figure options, e.g. rotating the image by 90 degrees counter clockwise.


\setupexternalfigures[location={local,global,default}]

\defineexternalfigure[rotated][orientation=90]

\starttext
\externalfigure[hacker.jpg][rotated]
\stoptext

Wolfgang

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

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


Re: [NTG-context] Color profiles (was: Bloody PDF boxes)

2021-11-01 Thread Henning Hraban Ramm via ntg-context

> Am 01.11.2021 um 08:58 schrieb Henning Hraban Ramm via ntg-context 
> :
> 
> And it seems like GWG is in conflict with the PDF association, at least GWG’s 
> recommendations contradict PDF/X.

GWG doesn’t want to contradict but has a quality focus, see 
https://www.pdfa.org/further-quality-requirements-pdfx-plus/
(I attended a few workshops by the author Stephan Jaeggi in about 2005...)

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

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


Re: [NTG-context] Color profiles (was: Bloody PDF boxes)

2021-11-01 Thread Henning Hraban Ramm via ntg-context

> Am 01.11.2021 um 08:05 schrieb Floris van Manen via ntg-context 
> :
> 
> this document:
>> and also extendedhttps://wiki.contextgarden.net/PDFX  a bit.
> 
> contains a link to the Ghent Workshop that returns a 404
> 
> [here] -> http://www.gwg.org/recommended_ICC_profiles.phtm -> 404

Thank you. The information from 2008 was outdated anyway; GWG’s latest 
recommendations from 2015 don’t contain ICC profiles any more (maybe their 
settings for commercial applications do, didn’t check).

And it seems like GWG is in conflict with the PDF association, at least GWG’s 
recommendations contradict PDF/X.

I’ll try to reflect both...

From my personal experience:

– If you don’t exactly know what you’re doing, you should use sRGB as RGB 
working color space, because most cameras and scanners use it. Yes, parts of 
the color space are outside the printable range, that’s why GWG (used to) 
recommend ECI RGB.

– Don’t use CMYK images, since they’re bigger, and if they’re not in the same 
CMYK color space as the one used by the printshop, the conversion is more lossy 
than any RGB-CMYK conversion.
– You can use DeviceCMYK (i.e. without profile) for graphical elements, that’s 
what GWG recommends, but it’s against PDF/X-3+.

– Use the latest FOGRA (Coated/Uncoated) CMYK profile as output intent, at 
least that’s what German/European printshops use in offset and digital 
printing. If not, your printshop should tell you which profile they use.
– For printing in the USA, use a SWOP CMYK profile as output intent. (SWOP and 
Euroscale CMYK colors are visibly different!)
– I don’t know about printshops in other parts of the world.

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

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


Re: [NTG-context] Bloody PDF boxes and cr*p marks!

2021-11-01 Thread Floris van Manen via ntg-context



On 30/10/2021 21:21, Henning Hraban Ramm via ntg-context wrote:

this document:

and also extendedhttps://wiki.contextgarden.net/PDFX  a bit.


contains a link to the Ghent Workshop that returns a 404

Special thanks must go to the Ghent PDF Workgroup (GWG) for making a 
list of recommended profiles. Please have a look at the official 
documentation first (will take you only a minute). The origin of this 
document (and some more info) is located [here].


[here] -> http://www.gwg.org/recommended_ICC_profiles.phtm -> 404

.F
___
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
___