Re: [NTG-context] PDF viewer poll

2019-10-14 Thread Otared Kavian
> On 13 Oct 2019, at 12:43, Henning Hraban Ramm  wrote:
> 
> Hi, I’d like to update my list of (usable!) PDF viewers.
> Which one do you use? (Current version?)

Hi Hraban,

I am on MacOS and use the PDF viewer included in TeXShop (which is based on 
Preview.app of MacOS). For my presentations I use Adobe Acrobat Reader DC, but 
for readings on the screen the Preview.app of MacOS is just fine (one can also 
annotate a PDF file, but strangely when such files are used in ConTeXt the 
annotations disappear: so one has to transform them into a JPG then again into 
a PDF).

I use extensively synctex within TeXShop, and although there has been a split 
in the way synctex is implemented in ConTeXt and other TeX flavors, it works 
fine. When writing lecture notes and math exercises, having synctex is 
fundamental for me.

Best regards: OK
___
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] PDF viewer poll

2019-10-14 Thread Hamid,Idris
Hi Henning, all,

On Sun, 13 Oct 2019 04:43:14 -0600, Henning Hraban Ramm   
wrote:

> Hi, I’d like to update my list of (usable!) PDF viewers.
> Which one do you use? (Current version?)
> What are its pros and cons?
> Is it free (open source, freeware)?
> Does it work on Win/Lin/Mac?
> Does it have a localized interface? (I don’t care, but I work with  
> people who don’t understand a lot of English.)
> Can it handle comments, attachments?
> Can it handle forms with or without JavaScript?
> Does it support SyncTeX? (Who uses that anyway?)
> Does it update changed PDFs on its own (or does it even block  
> overwriting)?
> Which other features are essential for your choice?
>
> E.g. I’m working with:
> - Preview.app (Mac)
>   Default on MacOS, fast & easy. No JS, bad forms support, updates  
> "sometimes". Usable as a previewer, not as a PDF toolbox.
> - Adobe Reader DC (Mac)
>   I use it only to check forms or as reference. Unusable GUI.
> - Acrobat Pro 9 (Mac)
>   Was my workhorse, but works on MacOS Mojave only partly; slow &  
> crash-prone; no updates. Can check PDF/X<4 and convert colors.
> - PDF Studio Pro (on Mac & Linux)
>   Bought to replace AcroPro9; JS support broken; slow startup; no  
> updates. Can check PDF/X, A, UA and convert colors.
>   Ok with forms, but doesn’t support LiveCycle forms (deprecated, but  
> used by German boards).
> - Qpdfview (Linux)
>   Fast and easy; reliably updates.
> - PDF.js (Browser or Atom)
>   Is said to do SyncTeX (never tried). Easy, but slow. Updates.

On Windows:

For a ConTeXt workflow, sumatrapdf, for all the reasons mentioned by Hans  
and others. Works well with SyncTeX and Notepad++.

As a commercial replacement to Adobe Acroboat, nothing beats NitroPDF.  
Clean interface. Avoids most if not all of the problems mentioned by Hans.

University machine has Acrobat, so for pdf manipulation beyond the  
capabilities of sumatrapdf: mostly Acrobat at school and NitroPDF at home.

Best wishes
Idris
-- 
Idris Samawi Hamid, Professor
Department of Philosophy
Colorado State University
Fort Collins, CO 80512
___
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] PDF viewer poll

2019-10-14 Thread Henning Hraban Ramm
Thank you all for you valuable insights so far!
I’ll compile them to a wiki page and also complete the list in my upcoming book.

> Am 2019-10-14 um 11:17 schrieb Hans Hagen :
> 
> When developing pdf specific code (like last months) I do use acrobat reader 
> and an older acrobat x (which keeps telling me that it wants to be updated 
> but the update fails) ... both have their different issues. Acrobat X has 
> some validation on board and one can introspect the file (and fonts) to some 
> extend but in the end it's often still trial and error.

Do you know any other tools for PDF debugging? Those few I know of cost four to 
five figures or were plugins to very old versions of Acrobat.


> On the commandline, when I need to check a pdf I sometimes use qpf (quite ok 
> but I always need to stepwise build the commandline using help as it's 
> somewhat complex). The other command line tool I use is mutool (mudraw) which 
> is different but also ok.

Need to look into those.


> Acrobat used to be ok upto version 6 (I even remember the msdos version to be 
> ok) but each version the user interface changed fo rthe worse  (very bad imo 
> and an indication that it's not meant for power usage as there one wants at 
> least an upward compatible interface) and it's slower compared to other 
> viewers (probably due to color management).

I agree. Adobe needlessly changed the interface with every release, and it 
didn’t get better.
There were different translation errors (at least in the German interface) in 
every version, and they never got fixed with the updates.
Updates were announced by the Updater, but never installed.
Don’t know about the speed – some functions like certificate lookup were always 
dead slow, and the display speed was mostly ok. (I should benchmark different 
viewers with my OpenStreetMap vector maps…)

I found Qoppa’s PDF Studio Pro a viable alternative to Acrobat Pro with a 
usable interface (default has ribbons, but you can switch it).
Their customer support is friendly, I hope they will also fix the problems I 
reported.

> === javascript ===
> Only acrobat offers that.

Not completely true. But there aren’t a lot of apps that support JS in PDF - 
for a reason: if you allow scripting, you create a lot of vulnerabilities that 
you can easily avoid leaving out this feature that "nobody" needs. It would 
have made sense to define a small and safe JS (or whatever scripting language) 
_subset_ from the start, but the early versions of Acrobat were completely 
"hackable", and they only much later thought about security (like in lots of 
other programs). PDF viruses existed.

> Basically javascript can be limited to (1) setting annotation properties, 
> like toggling layers or button renditions, and (2) some simple calculations 
> (for forms). Constructing pdf runtime using javascript is pretty braindead 
> (use html instead then).

D’accord.

> It is one of the puzzling areas to me: no problem in browsers and elsewhere 
> but not in open source pdf viewers. It's not the most complex stuff so it 
> probably indicates that no one cares much about these features.

I wouldn’t say "no problem", because JS causes security problems everywhere.

> === annotations ===
> 
> Some useful stuff was dropped: like native sound and movies (was very simple: 
> show a movie, play a sound, simple annotations). What seems to be natural to 
> html became complex and unuseable in pdf ... the media subsystem is 
> (obsolete) flash based, imo mostly driven by third party commercial pressure 
> / demand / whatever. Not future safe, if working at all: from simple to 
> complex to useless. 

If I remember correctly, Adobe first based the media subsystem on Apple’s 
Quicktime until Apple discontinued that on Windows and Adobe bought Macromedia, 
including Flash. 3D media was a short hype, nobody used it. Anyway, doesn’t 
matter. Nowadays PDF doesn’t have any working media subsystem.

> In a similar fashion forms (for some widgets bugs because features esp 
> default rendering, inheritance, etc and also some strange relation with 
> viewer settings, that change per version). It made me loose interest it those 
> things that once were promising.

I can understand that, but at least ConTeXt’s radiobuttons *have* bugs; the few 
viewers that support forms stumble over some parsing/nesting error. Adobe 
catches it apparently.

> (Some of the bad in pdf is a result from it being a container format for a 
> lot of things: documents, editing tools, printing, application stuff turned 
> annotation, etc.).

D’accord.


Herzliche Grüße,
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 : 

Re: [NTG-context] PDF viewer poll

2019-10-14 Thread Alan Braslau
On Sun, 13 Oct 2019 12:43:14 +0200
Henning Hraban Ramm  wrote:

> Hi, I’d like to update my list of (usable!) PDF viewers.
> Which one do you use? (Current version?)

On Mac OS, there is skim, which has better features than preview but uses the 
same Apple rendering engine (with all of its bugs).

zathura (many systems) can use either the mupdf or the poppler engine. Your 
choice.

mupdf-gl on MacOS doesn't need X11, but it has some annoying bugs that might 
get fixed ... someday.

But, as Hans says, it should not be too hard to build a mupdf-engine based 
lightweight viewer with lua integrated. Or why not add this to lua-bloat-tex as 
an output option? That way, one can interpret (xml) source files with on the 
fly rendering.

Alan
___
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] \ctxlua and \startluacode ... \stopluacode

2019-10-14 Thread Rudolf Bahr
On Mon, Oct 14, 2019 at 09:26:58PM +0200, Taco Hoekwater wrote:
> Hi,
> 
> > On 14 Oct 2019, at 21:08, Rudolf Bahr  wrote:
> > 
> > 
> > 2. But in the case of an not existing file (BBB.lua) the known error 
> > message comes up
> >   again:
> >   "token call, execute: [ctxlua]:8: /home/sam/context-tests/BBB.lua: No 
> > such file or 
> >directory".
> >This, of course, is true, but shouldn't be mentioned in an error message!
> 
> If you do not want the error message, don’t use assert(). You can just do 
> 
> f = io.open(...)
> If f then ... else ... end
> 
> Best wishes,
> Taco


Hi Taco!

Thank you again for your message!

My wish isn't to avoid error messages, if they are justified! In the case of my 
MWE
I want to have a decision in my \startluacode ... \stopluacode environment, 
whether
a certain file exists or not. With this decision I want to branch in my program 
and
with an error message I cannot do it.

Lua is a wonderfull programming language and I'm appreciative to get a way to 
exit
ConTeXt, run Lua code and enter the ConTeXt program at the same location again! 
On
the other side, in the last days I spent some time to eliminate errors in my
\startluacode ...\stopluacode program to change code which causes no error 
messages
in pure Lua.

Now to your suggestion not to use "assert ()". Indeed it's a solution! My 
program
works! I append again its output (again just for fun!). Did you really try it or
has it been just an idea? The MWE is now as follows:

===
\startluacode

userdata = userdata or {}

function userdata.file_exists (name)

   local name = name
   local f= io.open ( name, "r" )

   if f then
  f:close ()
  context ( name )
  context ( "  exists!" )
   else
  context ( name )
  context ( "  doesn't exist!" )
   end
end

\stopluacode


\starttext

\def\lookupfile#1%
{\ctxlua{userdata.file_exists([==[#1]==])}}

\lookupfile{/home/sam/context-tests/AAA.lua}% "AAA.lua" intentionally does 
exist

\par

\lookupfile{/home/sam/context-tests/BBB.lua}% "BBB.lua" intentionally 
doesn't exist

\stoptext
===

R. Ierusalimschy encourages the use of "assert()". But it is apparantly better 
not to
use it under certain circumstances as in \startluacode ... \stopluacode as I've 
learnt
now.
Can I avoid therefore Hans' prefix resolvers code?

Best wishes,
Rudolf


is-file.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] how to do adaptation

2019-10-14 Thread Wolfgang Schuster

Susanne G. Loeber schrieb am 14.10.2019 um 15:16:

Hi,
I am looking for ways to adapt the layout and content of texts while
using ConTeXt. Put simple: show part of a text and sort these parts
based on data from the user and the author (.dat file). The biggest
problem is not knowing which part of the text will be first and how
many parts will be shown.

Can you ask a separate question for each individual problem.

So far, I am trying to get a hang of \setupdocument
(https://wiki.contextgarden.net/Project_structure), \startmode
(https://wiki.contextgarden.net/Modes), \definecolor
(https://wiki.contextgarden.net/Color) and \defineparagraphs
(https://wiki.contextgarden.net/Command/defineparagraphs)

I hope there are more ways to create adaptation.

I would also like to know whether certain combination don't work
together. For example, I cannot seem to get \doifmodeelse to work
inside a \defineparagraphs environment.

When you enable or disable a mode the state is local to the current group,
e.g. the state at the begin of a environment will be the same at the end
and changes in the environment are local to it. In most document this isn't
a problem because you enable/disable a mode at the begin of the document
and use the state at the whole document.

In your case you want the changed state to remain after the environment
has ended, to do this you have to use \globalenablemode[...] and
\globaldisablemode[...].

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] \ctxlua and \startluacode ... \stopluacode

2019-10-14 Thread Taco Hoekwater
Hi,

> On 14 Oct 2019, at 21:08, Rudolf Bahr  wrote:
> 
> 
> 2. But in the case of an not existing file (BBB.lua) the known error message 
> comes up
>   again:
>   "token call, execute: [ctxlua]:8: /home/sam/context-tests/BBB.lua: No such 
> file or 
>directory".
>This, of course, is true, but shouldn't be mentioned in an error message!

If you do not want the error message, don’t use assert(). You can just do 

f = io.open(...)
If f then ... else ... end

Best wishes,
Taco
___
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] \ctxlua and \startluacode ... \stopluacode

2019-10-14 Thread Rudolf Bahr
On Mon, Oct 14, 2019 at 07:19:53PM +0200, Hans Hagen wrote:
> On 10/14/2019 6:50 PM, Rudolf Bahr wrote:
 
> > THis MWE must be faulty, but where is the error?
> > 
> > 
> > 
> > \startluacode
> > 
> > userdata = userdata or {}
> > 
> > function userdata.file_exists (name)
> > 
> > local name = name
> > local f= assert ( io.open ( name, "r" ))
> > 
> > if f then
> >f:close ()
> >context ( name )
> >context ( "  exists!" )
> > else
> >context ( name )
> >context ( "  doesn't exist!" )
> > end
> > end
> > 
> > \stopluacode
> > 
> > 
> > \starttext
> > 
> > \def\lookupfile#1%
> > {\ctxlua{userdata.file_exists([==[#1]==])}}
> > 
> > \lookupfile{"$HOME/context-tests/AAA.lua"}  % "AAA.lua" intentionally does  
> >   exist
> > \lookupfile{"$HOME/context-tests/BBB.lua"}  % "BBB.lua" intentionally 
> > doesn't exist
> > 
> > \stoptext
> > 
> > 
> > 
> > It makes no difference in commenting out the first or the second 
> > "\lookupfile" command.
> > The error message eventually is always nearly the same:
> > 
> > token call, execute: [ctxlua]:8: "$HOME/context-tests/AAA.lua": No such 
> > file or directory
> > token call, execute: [ctxlua]:8: "$HOME/context-tests/BBB.lua": No such 
> > file or directory


Joseph, Taco and Hans, I thank you very much for your quick answers!
I shall try Hans' interesting suggestion on prefix resolvers after I've studied 
it,
for which I certainly need some time!

But before doing so I've a comment:
Your answers, Joseph, Taco and Hans, could  lead to the impression, that giving 
up
"double quotes as part of file names" and/or "$HOME" in the MWE would be the 
solution.
And indeed, not using "double quotes" and "expanding $HOME" by hand partly 
brings success:

1. In the case of an existing file (AAA.lua) the MWE works without error 
message!
   I will append the output-pdf-file here (just for fun!).

2. But in the case of an not existing file (BBB.lua) the known error message 
comes up
   again:
   "token call, execute: [ctxlua]:8: /home/sam/context-tests/BBB.lua: No such 
file or 
directory".
This, of course, is true, but shouldn't be mentioned in an error message!

Within \startluacode ... \stopluacode it seems one has to abandon the normal 
lua world,
at least partly. Are there other "special features"?

Rudolf


is-file.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] my own fault (was: Re: LMTX: Linux and Windows)

2019-10-14 Thread Pablo Rodriguez
On 10/12/19 2:28 PM, Pablo Rodriguez wrote:
> [...]
> Using beta from 2019.10.10 in Windows, LMTX doesn’t find vplayer9.swf
> (https://mirrors.ctan.org/macros/latex/contrib/media9/players/VPlayer9.swf),
> altough it is in the same directory as the ConTeXt source file being
> compiled.
>
> Does anyone know what I might be missing? Could anyone confirm this issue?
I discovered that I was actually compiling another file form another
directory.

It was totally my fault. Sorry for the noise,

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] \ctxlua and \startluacode ... \stopluacode

2019-10-14 Thread Hans Hagen

On 10/14/2019 6:50 PM, Rudolf Bahr wrote:


Dear List!

THis MWE must be faulty, but where is the error?



\startluacode

userdata = userdata or {}

function userdata.file_exists (name)

local name = name
local f= assert ( io.open ( name, "r" ))

if f then
   f:close ()
   context ( name )
   context ( "  exists!" )
else
   context ( name )
   context ( "  doesn't exist!" )
end

end


\stopluacode


\starttext

\def\lookupfile#1%
{\ctxlua{userdata.file_exists([==[#1]==])}}

\lookupfile{"$HOME/context-tests/AAA.lua"}% "AAA.lua" intentionally does
exist
\lookupfile{"$HOME/context-tests/BBB.lua"}% "BBB.lua" intentionally doesn't 
exist

\stoptext



It makes no difference in commenting out the first or the second "\lookupfile" 
command.
The error message eventually is always nearly the same:

token call, execute: [ctxlua]:8: "$HOME/context-tests/AAA.lua": No such file or 
directory
token call, execute: [ctxlua]:8: "$HOME/context-tests/BBB.lua": No such file or 
directory
You're in a tex environment, so no $HOME expansion. You can use the 
prefix resolvers:


\startluacode
function userdata.file_exists(name)
local name = name and resolvers.resolve(name)
if name and lfs.isfile(name) then
context("file %a exists",name)
else
context("file %a doesn't exist",name)
end
end
\stopluacode

\starttext

  % \def\lookupfile#1{\ctxlua{userdata.file_exists([==[#1]==])}}

\def\lookupfile{\ctxlua{userdata.file_exists(tokens.scanners.string())}}

\lookupfile{home:context-tests/AAA.lua}{xx}
\lookupfile{home:context-tests/BBB.lua}{xx}

\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] PDF viewer poll

2019-10-14 Thread Greedwolf DSS
Henning Hraban Ramm  writes:

pdf-tools in Emacs is well.
___
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] \ctxlua and \startluacode ... \stopluacode

2019-10-14 Thread Taco Hoekwater
Hi,

> On 14 Oct 2019, at 18:51, Rudolf Bahr  wrote:
> 
> 
> Dear List!
> 
> THis MWE must be faulty, but where is the error?
> 
> ===
> \lookupfile{"$HOME/context-tests/AAA.lua"}% "AAA.lua" intentionally does  
>   exist
 
$HOME is an actual literal here, since io.open() does not call out to a shell?

Taco
___
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] RE : \ctxlua and \startluacode ... \stopluacode

2019-10-14 Thread Joseph
I suspect the double quotes are part of file names, hence files cannot be 
found. Perhaps try remove them in macro argument.
Hope this helps

De : Rudolf Bahr
Envoyé le :lundi 14 octobre 2019 18:50
À : ntg-context@ntg.nl
Objet :[NTG-context] \ctxlua and \startluacode ... \stopluacode


Dear List!

THis MWE must be faulty, but where is the error?



\startluacode

userdata = userdata or {}

function userdata.file_exists (name)

   local name = name
   local f= assert ( io.open ( name, "r" ))

   if f then
  f:close ()
  context ( name )
  context ( "  exists!" )
   else
  context ( name )
  context ( "  doesn't exist!" )
   end
   
end

\stopluacode


\starttext

\def\lookupfile#1%
{\ctxlua{userdata.file_exists([==[#1]==])}}

\lookupfile{"$HOME/context-tests/AAA.lua"}  % "AAA.lua" intentionally does  
  exist
\lookupfile{"$HOME/context-tests/BBB.lua"}  % "BBB.lua" intentionally 
doesn't exist

\stoptext



It makes no difference in commenting out the first or the second "\lookupfile" 
command.
The error message eventually is always nearly the same:

token call, execute: [ctxlua]:8: "$HOME/context-tests/AAA.lua": No such file or 
directory
token call, execute: [ctxlua]:8: "$HOME/context-tests/BBB.lua": No such file or 
directory

I'm using:
LuaMetaTeX, Version 2.00.0 
ConTeXt  ver: 2019.10.10 18:15 MKIV beta  fmt: 2019.10.12  int: english/english

Please, any ideas?

Regards,
Rudolf

___
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] \ctxlua and \startluacode ... \stopluacode

2019-10-14 Thread Rudolf Bahr

Dear List!

THis MWE must be faulty, but where is the error?



\startluacode

userdata = userdata or {}

function userdata.file_exists (name)

   local name = name
   local f= assert ( io.open ( name, "r" ))

   if f then
  f:close ()
  context ( name )
  context ( "  exists!" )
   else
  context ( name )
  context ( "  doesn't exist!" )
   end
   
end

\stopluacode


\starttext

\def\lookupfile#1%
{\ctxlua{userdata.file_exists([==[#1]==])}}

\lookupfile{"$HOME/context-tests/AAA.lua"}  % "AAA.lua" intentionally does  
  exist
\lookupfile{"$HOME/context-tests/BBB.lua"}  % "BBB.lua" intentionally 
doesn't exist

\stoptext



It makes no difference in commenting out the first or the second "\lookupfile" 
command.
The error message eventually is always nearly the same:

token call, execute: [ctxlua]:8: "$HOME/context-tests/AAA.lua": No such file or 
directory
token call, execute: [ctxlua]:8: "$HOME/context-tests/BBB.lua": No such file or 
directory

I'm using:
LuaMetaTeX, Version 2.00.0 
ConTeXt  ver: 2019.10.10 18:15 MKIV beta  fmt: 2019.10.12  int: english/english

Please, any ideas?

Regards,
Rudolf

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

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


[NTG-context] how to do adaptation

2019-10-14 Thread Susanne G. Loeber
Hi,
I am looking for ways to adapt the layout and content of texts while
using ConTeXt. Put simple: show part of a text and sort these parts
based on data from the user and the author (.dat file). The biggest
problem is not knowing which part of the text will be first and how
many parts will be shown.

So far, I am trying to get a hang of \setupdocument
(https://wiki.contextgarden.net/Project_structure), \startmode
(https://wiki.contextgarden.net/Modes), \definecolor
(https://wiki.contextgarden.net/Color) and \defineparagraphs
(https://wiki.contextgarden.net/Command/defineparagraphs)

I hope there are more ways to create adaptation.

I would also like to know whether certain combination don't work
together. For example, I cannot seem to get \doifmodeelse to work
inside a \defineparagraphs environment.

\defineparagraphs[BLpar][n=2, frame=on]
\setupparagraphs [BLpar][1][width=\dimexpr.3\textwidth]

\starttext

% Working
\enablemode[asg]

\doifmodeelse{asg} {\par First sentence} {\par Second sentence}
\disablemode[asg]
\doifmodeelse{asg} {\par First sentence} {\par Second sentence}
\doifnotmode{asg} {\par Third sentence}

% Not working
\enablemode[one]

\startBLpar
\doifmodeelse{one} {First sentence} {Second sentence} \disablemode[one]
\BLpar
% \disablemode[one] %% not helping
TOP1 paragraphs
\stopBLpar
% \disablemode[one] %% needed to make the example work

\startBLpar
\doifmodeelse{one} {First sentence} {Second sentence}
\BLpar
TOP2 paragraphs
\stopBLpar

\startBLpar
\doifnotmode{one} {Third sentence}
\BLpar
TOP3 paragraphs
\stopBLpar

\stoptext


Kind regards,
Susanne G. Loeber
___
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] PDF viewer poll

2019-10-14 Thread Hans Hagen

On 10/13/2019 12:43 PM, Henning Hraban Ramm wrote:

Hi, I’d like to update my list of (usable!) PDF viewers.
Which one do you use? (Current version?)
What are its pros and cons?
Is it free (open source, freeware)?
Does it work on Win/Lin/Mac?
Does it have a localized interface? (I don’t care, but I work with people who 
don’t understand a lot of English.)
Can it handle comments, attachments?
Can it handle forms with or without JavaScript?
Does it support SyncTeX? (Who uses that anyway?)
Does it update changed PDFs on its own (or does it even block overwriting)?
Which other features are essential for your choice?

E.g. I’m working with:
- Preview.app (Mac)
   Default on MacOS, fast & easy. No JS, bad forms support, updates 
"sometimes". Usable as a previewer, not as a PDF toolbox.
- Adobe Reader DC (Mac)
   I use it only to check forms or as reference. Unusable GUI.
- Acrobat Pro 9 (Mac)
   Was my workhorse, but works on MacOS Mojave only partly; slow & crash-prone; no 
updates. Can check PDF/X<4 and convert colors.
- PDF Studio Pro (on Mac & Linux)
   Bought to replace AcroPro9; JS support broken; slow startup; no updates. Can 
check PDF/X, A, UA and convert colors.
   Ok with forms, but doesn’t support LiveCycle forms (deprecated, but used by 
German boards).
- Qpdfview (Linux)
   Fast and easy; reliably updates.
- PDF.js (Browser or Atom)
   Is said to do SyncTeX (never tried). Easy, but slow. Updates.

=== viewing ===

99% of the time i use the mupdf based sumatrappdf (which has not been 
updated for a while, not that it seems to matter much)


I also occasionally use the gui that comes with mupdf but it is limited 
(no bookview for instance; if that was there + printing I'd use it more 
often) ... mupdf started simple but I think it also grew in a weird 
direction (large codebase, some reflow I think, a strange epub 
substandard support, etc .. all pretty useless to me and I'm not sure 
how optional it it ... so no longer as lightweight as it could be ...)


When developing pdf specific code (like last months) I do use acrobat 
reader and an older acrobat x (which keeps telling me that it wants to 
be updated but the update fails) ... both have their different issues. 
Acrobat X has some validation on board and one can introspect the file 
(and fonts) to some extend but in the end it's often still trial and error.


It's no problem keeping sumatrapdf open when processing a file, it even 
goes to the same spot (if possible). Acrobat is cumbersome (I can 
understand why it was the case when mem was low as some caching happens.)


(When browsing and opening a pdf chrome uses the built-in, firefox the 
reader and edge the build in. Last time I checked edge was the best in 
that.)


I have okular installed but I think what i installed is too old by now. 
When it comes to for instance cut and paste (testing) I think open 
source viewers never catched on (and there has been plenty of time to do 
it). I sometimes suspect build-in fixes (heuristics) for situations but 
i might be wrong in that. Ok, it's volunteers work, so no complaints; 
and I can use mupdf quite well.


=== checking ===

On the commandline, when I need to check a pdf I sometimes use qpf 
(quite ok but I always need to stepwise build the commandline using help 
as it's somewhat complex). The other command line tool I use is mutool 
(mudraw) which is different but also ok.


=== verdict ===

In general I think that mupdf has the best viewer code, and qpdf the 
best commandline stuff (no viewing code). Acrobat used to be ok upto 
version 6 (I even remember the msdos version to be ok) but each version 
the user interface changed fo rthe worse  (very bad imo and an 
indication that it's not meant for power usage as there one wants at 
least an upward compatible interface) and it's slower compared to other 
viewers (probably due to color management). With acrobat moving to the 
cloud and with all these sharing and validation and security stuff built 
it became kind of unuseable for every day use. It demonstrates that one 
cannot easilly mix a commercial product with a general 'standadized' 
format vor document distribution (I'm not even sure if there has been a 
long term agenda involved). I'm not going to lock into some subscription 
model for something that i hardly use (Do they really expect people to 
subscribe when their employer is not paying for it? If one retires then 
...). I have no problem paying for something but it has to be in 
proportion (and on the average everything pdf has cost us more than in 
brought in).


=== synctex ===

I don't use it myself. I think that it being a library that has to be 
linked in is a bad design decision: it could have been a call to an 
external program that gets the filename + page and position and then 
returns the source file and line. That way it would a future proof 
system with no dependencies. There could a way better feedback then too. 
(Context already ships a script that does that.) Not all 

Re: [NTG-context] PDF viewer poll

2019-10-14 Thread Taco Hoekwater

Hi,

> On 13 Oct 2019, at 12:43, Henning Hraban Ramm  wrote:
> 
> Hi, I’d like to update my list of (usable!) PDF viewers.
> Which one do you use? (Current version?)

Preview.App (Mac) — since it is fast and the MacOS default. But it does
  not handle anything well except the actual page display. 

  Auto-refreshes, but only if the pdf update is finished when you switch 
  back to the preview window. If the pdf is still being updated then, it 
  produces an error and refuses to update any more after that. That is 
  really annoying, which is why I am trying to switch to:

mupdf-gl — trying to get used to that, but it is not an actual application
  according to MacOS, so it only works from the command-line in Terminal.
  Not sure about features, but it is fast. I should create a wrapper app
  script so I can use it more often.

  Refreshes with Cmd-R (and SIGHUP, since 1.15), but not automatically. 
  mostly keyboard-driven, which works fine for me but may be a negative 
  for other users.

Acrobat Reader DC — but only if I really have to because of 
forms/js/attachments/etc.
  I do not object to commercial software, but I think the newer Adobe Apps are 
  horrible in use. The last one with a ‘sane’ interface was version 9.0 or so.

I only really care about (speed of) page display; I normally don’t need the 
interactive stuff. I never use synctex since most of my docs are quite short. 
No idea what pdf view supports it (and does it not need editor support as well?
no idea what editors support it, either).

Best wishes,
Taco
___
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] PDF viewer poll

2019-10-14 Thread denis.maier
SumtraPDF on Windows
Easy, fast, quite basic. (I take this as an advantage)
Interface is localized.
Forms: don't know
Free
Synctex: Don't need it at the moment, but the documentation says it should be 
supported
Updates automatically

Hope this helps,
Denis



-Ursprüngliche Nachricht-
Von: ntg-context  Im Auftrag von Henning Hraban Ramm
Gesendet: Sonntag, 13. Oktober 2019 12:43
An: mailing list for ConTeXt users 
Betreff: [NTG-context] PDF viewer poll

Hi, I’d like to update my list of (usable!) PDF viewers.
Which one do you use? (Current version?) What are its pros and cons?
Is it free (open source, freeware)?
Does it work on Win/Lin/Mac?
Does it have a localized interface? (I don’t care, but I work with people who 
don’t understand a lot of English.) Can it handle comments, attachments?
Can it handle forms with or without JavaScript?
Does it support SyncTeX? (Who uses that anyway?) Does it update changed PDFs on 
its own (or does it even block overwriting)?
Which other features are essential for your choice?

E.g. I’m working with:
- Preview.app (Mac)
  Default on MacOS, fast & easy. No JS, bad forms support, updates "sometimes". 
Usable as a previewer, not as a PDF toolbox.
- Adobe Reader DC (Mac)
  I use it only to check forms or as reference. Unusable GUI.
- Acrobat Pro 9 (Mac)
  Was my workhorse, but works on MacOS Mojave only partly; slow & crash-prone; 
no updates. Can check PDF/X<4 and convert colors.
- PDF Studio Pro (on Mac & Linux)
  Bought to replace AcroPro9; JS support broken; slow startup; no updates. Can 
check PDF/X, A, UA and convert colors.
  Ok with forms, but doesn’t support LiveCycle forms (deprecated, but used by 
German boards).
- Qpdfview (Linux)
  Fast and easy; reliably updates.
- PDF.js (Browser or Atom)
  Is said to do SyncTeX (never tried). Easy, but slow. Updates.


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

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