ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Procházka Lukáš Ing. - Pontex s. r. o." <LPr@pontex.cz>
To: ConTeXt <ntg-context@ntg.nl>
Subject: Figures and Lua (continuing "Number of pages by Lua of a figure to be inserted?" somehow)
Date: Fri, 12 Apr 2013 14:47:25 +0200	[thread overview]
Message-ID: <op.wvfhtbvxtpjj8f@lpr> (raw)

[-- Attachment #1: Type: text/plain, Size: 1689 bytes --]

Hello,

I tried to make a "more minimal" example.

Still we have:

files:

./t3.mkiv
./T/Kn.pdf

and code:

----
\startluacode
   test = function(fn)
     local fig = figures.push{name = fn}
       if figures.identify().status.status ~= 0 then
         figures.check()
       end
     figures.pop()

     return fn .. ": " .. (fig.used.pages or "?") .. "\\par"
   end
\stopluacode

\starttext
   AAA

   \startluacode
     context(test("T/Kn.pdf")) -- Found - OK
     context(test("Kn.pdf")) -- Not found - OK
   \stopluacode

   \setupexternalfigures[directory=T]

   \startluacode
     context(test("Kn.pdf")) -- Not found (or unknown number of pages) - UNEXPECTED - why? ("3rd call")
   \stopluacode

   \externalfigure[Kn.pdf][scale=625] % Found - OK
\stoptext
----

The 3rd call of 'test()' seems to not locate 'Kn.pdf' although the path was altered by preceding \setupexternalfigures.

How to modify the 'test()' to work properly even in the 3rd case?

NB:
Sorry for repeating the topic "in another coat" - it may not be so interesting for listeners of this mailing list.
But the goal is to add figures and PDF files into the document automatically.
One of the tasks is to detect number of pages of the figure.
The code above is a core cut out; it should work (or: if this part wouldn't work, neither would the rest) even in the 3rd case.

Any help to make the piece of code work would be appreciated.

Best regards,

Lukas


-- 
Ing. Lukáš Procházka [mailto:LPr@pontex.cz]
Pontex s. r. o.      [mailto:pontex@pontex.cz] [http://www.pontex.cz]
Bezová 1658
147 14 Praha 4

Tel: +420 244 062 238
Fax: +420 244 461 038

[-- Attachment #2: t3.zip --]
[-- Type: application/zip, Size: 20306 bytes --]

[-- Attachment #3: t3.mkiv --]
[-- Type: application/octet-stream, Size: 620 bytes --]

\startluacode
  test = function(fn)
    local fig = figures.push{name = fn}
      if figures.identify().status.status ~= 0 then
        figures.check()
      end
    figures.pop()

    return fn .. ": " .. (fig.used.pages or "?") .. "\\par"
  end
\stopluacode

\starttext
  AAA

  \startluacode
    context(test("T/Kn.pdf")) -- Found - OK
    context(test("Kn.pdf")) -- Not found - OK
  \stopluacode

  \setupexternalfigures[directory=T]

  \startluacode
    context(test("Kn.pdf")) -- Not found - UNEXPECTED - why?
  \stopluacode

  \externalfigure[Kn.pdf][scale=625] % Found - OK
\stoptext

[-- Attachment #4: t3.pdf --]
[-- Type: application/pdf, Size: 12686 bytes --]

[-- Attachment #5: Kn.pdf --]
[-- Type: application/pdf, Size: 17996 bytes --]

[-- Attachment #6: Type: text/plain, Size: 485 bytes --]

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

             reply	other threads:[~2013-04-12 12:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-12 12:47 Procházka Lukáš Ing. - Pontex s. r. o. [this message]
2013-04-15 15:21 ` Aditya Mahajan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=op.wvfhtbvxtpjj8f@lpr \
    --to=lpr@pontex.cz \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).