Re: [NTG-context] extra lines in PDF annotations

2023-03-14 Thread Pablo Rodriguez via ntg-context
On 3/13/23 22:32, Hans Hagen via ntg-context wrote:
>> [...]
>> I hope EOLs are fine now.
> dunno ... no full example so ...
Sorry, Hans, the full example reads:

  \startbuffer[text]
  
  
  
  \stopbuffer

  \savebuffer[text][sample-text.xml, prefix=no]

  \setupinteraction[state=start]

  \startxmlsetups xml:text
\xmlsetsetup{\xmldocument}
  {pre}
  {xml:copy:html}
  \stopxmlsetups

  \xmlregistersetup{xml:text}

  \startxmlsetups xml:copy:html
\xmltobuffer{#1}{.}{text}
\comment[location=inmargin,buffer=text]{}
  \stopxmlsetups

  \setuppapersize[A9]

  \starttext
\section{one\xmlprocessbuffer{main}{text}{}}

\section{two\xmlprocessfile{main}{sample-text.xml}{}}
  \stoptext

It requires that the source is saved with CRLF line endings (so that
\savebuffer will save that way too), otherwise both \comment will be
exactly the same.

I hope it is clearer now.

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] 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] new hash for buffer (as file)

2022-09-22 Thread Max Chernoff via ntg-context
Hi Pablo,

> I mean, to get hash of the file attached to the document, I need to save
> the buffer for "context(utilities.sha2.hash256(io.loaddata(buffer)))".
> 
> But I don’t need to save the buffer to attach it to the PDF document.
> 
> My question is how to define \shabufferfile to avoid \savebuffer (only
> required to get the hash).

The SHA calculation isn't working properly because of a weird newline
issue. Try this:

   \setupinteraction[state=start]
   \setupinteractionscreen[option={attachment}]
   
   \startbuffer[test]
   just a test
   and another one
   \stopbuffer
   
   \starttext
   \startluacode
   require("util-sha")
   
   function sha256(str)
   return utilities.sha2.hash256(
   str:gsub(string.char(0x0D), string.char(0x0A))
   )
   end
   \stopluacode
   
   \def\shabuffer#1%
   {\cldcontext{sha256(buffers.raw("#1"))}}
   
   \def\shafile#1%
   {\cldcontext{sha256(io.loaddata("#1"))}}
   
   \shabuffer{test}
   
   \savebuffer[test][temporary-αβγ, prefix=no]
   
   \shafile{temporary-αβγ}
   
   \attachment[buffer=test, name=\shabuffer{test}, method=hidden]
   \stoptext
   
You can remove the "\savebuffer" and the "\shafile"; I just kept that in to
show that the two hashes are now the same.

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


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

2022-09-22 Thread Pablo Rodriguez via ntg-context
Dear list,

playing with buffer contents, I have the following file:

  \setupinteraction[state=start]
  \setupinteractionscreen[option={attachment}]

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

  \starttext
  \ctxlua{require("util-sha")}

  \def\shabuffer#1%
{\cldcontext{utilities.sha2.hash256(buffers.raw("#1"))}}

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

  \def\shabufferfile#1%
{\cldcontext{utilities.sha2.hash256(buffers.raw("#1"))}}

  \shabuffer{test}

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

  \shafile{temporary-αβγ}

  \attachment[buffer=test, name=\shabufferfile{test}, method=hidden]
  \stoptext

I mean, to get hash of the file attached to the document, I need to save
the buffer for "context(utilities.sha2.hash256(io.loaddata(buffer)))".

But I don’t need to save the buffer to attach it to the PDF document.

My question is how to define \shabufferfile to avoid \savebuffer (only
required to get the hash).

An approach would be the following one. If I’m not totally wrong,
"savebuffer"
(https://github.com/contextgarden/context/blob/main/tex/context/base/mkxl/buff-ini.lmt#L559)
may be just replacing new lines with "\n" in the original buffer
(https://github.com/contextgarden/context/blob/main/tex/context/base/mkxl/buff-ini.lmt#L576).

The function string.replacenewlines() is defined at
https://github.com/contextgarden/context/blob/main/tex/context/base/mkiv/util-str.lua#L1475.

If I’m not totally wrong about savebuffer replacing newlines with "\n",
I wonder how to create a temporary buffer with such a replacement, so
that it could be hashed later.

I hope my question is clear.

Many thanks in advance 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] Clipping multiple PDFs

2022-08-22 Thread Jethro Djan via ntg-context

Thanks for the solution Pablo. It works well.

I wanted to add more pdfs (which also has many pages) and found it was easier 
for me to reason in the lua side of things. This is what I have at the moment:

\starttext
\startluacode
  local function doc(fil)
return fil..[[.pdf]]
  end

  local function disppdf(fname)
n = 1 
repeat 
  context.externalfigure({fname},{
page = n,
width = "200mm",
scale = "950"
  })
  n = n + 1
until n == context(context.noffigurepages)
  end

  local pdffiles = {"ass1", "ass2", "ass3", "ass4", "ass5", "ass6", "ass7", 
"ass8"}
  for index=1,#pdffiles do 
local f = doc(pdffiles[index])
context.getfiguredimensions({f})
disppdf(pdffiles[index])
  end
\stopluacode
\stoptext

I didn’t know how to get an array (or indexed table or whatever you call it) in 
ConTeXt/Tex. My problem is now with context(context.noffigurepages). It doesn’t 
produce an integer so n is being compared to nil. Am I calling it wrong? All I 
want to do is call \noffigurepages from the lua side. Is there something I am 
missing?

Jethro

> On 21 Aug 2022, at 4:41 PM, Pablo Rodriguez via ntg-context 
>  wrote:
> 
> On 8/18/22 02:13, jethro Reuel via ntg-context wrote:
>> Hello,
>> 
>> I am trying to put multiple PDF’s that were typeset differently into
>> one document without modifying the individual files themselves.
>> [...]
>> The problem is the original page numbers show and I’d prefer that it
>> did not. So I thought maybe I could clip all the page numbers from
>> every page (since they are all in the same position across all the
>> pages) but I don’t know how to do this with the \clip command. Any
>> ideas? I already tried using \input but it gives some weird output in
>> some places. It doesn’t have to use this method as long as it does
>> what I need it to do.
> 
> Hi Jethro,
> 
> it works using \clip with \externalfigure inside a loop (\dorecurse).
> 
> With \getfiguredimensions you get the number of pages of each PDF
> document (\noffigurepages).
> 
> The following source both generates the source PDF document and the
> imposed result with clipped pages (just to see a sample of the commands
> mentioned above):
> 
>  \startbuffer[newbuff]
>  \setuppapersize[A3]
>  \setupbodyfont[sans, 1200pt]
>  \starttext
>  \dorecurse{8}
>  {\startmakeup[page][pagestate=start, align=center, style=\bf]
>\recurselevel
>   \stopmakeup}
>  \stoptext
>  \stopbuffer
>  \startmode[*first]
>  \savebuffer[newbuff][source_page.tex, prefix=no]
>  \executesystemcommand{context --purgeall source_page.tex}
>  \stopmode
>  \setuplayout[page]
>  \setuppapersize[A6][A4]
>  \setuppaper[nx=2, ny=2]
>  \setuparranging [XY]
>  \starttext
>  \startnotmode[*first]
>  \def\Doc{source_page.pdf}
>  \getfiguredimensions[\Doc]
>  \dorecurse{\noffigurepages}
>{\clip[hoffset=96mm, voffset=136mm, width=105mm, height=148mm]
>{\externalfigure[\Doc][page=\recurselevel]}}
>  \stopnotmode
>  \stoptext
> 
> 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
___


Re: [NTG-context] Clipping multiple PDFs

2022-08-22 Thread Jethro Djan via ntg-context

Thanks for the solution Pablo. It works well.

I wanted to add more pdfs (which also has many pages) and found it was easier 
for me to reason in the lua side of things. This is what I have at the moment:

\starttext
\startluacode
  local function doc(fil)
return fil..[[.pdf]]
  end

  local function disppdf(fname)
n = 1 
repeat 
  context.externalfigure({fname},{
page = n,
width = "200mm",
scale = "950"
  })
  n = n + 1
until n == context(context.noffigurepages)
  end

  local pdffiles = {"ass1", "ass2", "ass3", "ass4", "ass5", "ass6", "ass7", 
"ass8"}
  for index=1,#pdffiles do 
local f = doc(pdffiles[index])
context.getfiguredimensions({f})
disppdf(pdffiles[index])
  end
\stopluacode
\stoptext

I didn’t know how to get an array (or indexed table or whatever you call it) in 
ConTeXt/Tex. My problem is now with context(context.noffigurepages). Am I 
calling it wrong? All I want to do is call \noffigurepages from the lua side. 
Is there something I am missing?

Jethro

> On 21 Aug 2022, at 4:41 PM, Pablo Rodriguez via ntg-context 
>  wrote:
> 
> On 8/18/22 02:13, jethro Reuel via ntg-context wrote:
>> Hello,
>> 
>> I am trying to put multiple PDF’s that were typeset differently into
>> one document without modifying the individual files themselves.
>> [...]
>> The problem is the original page numbers show and I’d prefer that it
>> did not. So I thought maybe I could clip all the page numbers from
>> every page (since they are all in the same position across all the
>> pages) but I don’t know how to do this with the \clip command. Any
>> ideas? I already tried using \input but it gives some weird output in
>> some places. It doesn’t have to use this method as long as it does
>> what I need it to do.
> 
> Hi Jethro,
> 
> it works using \clip with \externalfigure inside a loop (\dorecurse).
> 
> With \getfiguredimensions you get the number of pages of each PDF
> document (\noffigurepages).
> 
> The following source both generates the source PDF document and the
> imposed result with clipped pages (just to see a sample of the commands
> mentioned above):
> 
>  \startbuffer[newbuff]
>  \setuppapersize[A3]
>  \setupbodyfont[sans, 1200pt]
>  \starttext
>  \dorecurse{8}
>  {\startmakeup[page][pagestate=start, align=center, style=\bf]
>\recurselevel
>   \stopmakeup}
>  \stoptext
>  \stopbuffer
>  \startmode[*first]
>  \savebuffer[newbuff][source_page.tex, prefix=no]
>  \executesystemcommand{context --purgeall source_page.tex}
>  \stopmode
>  \setuplayout[page]
>  \setuppapersize[A6][A4]
>  \setuppaper[nx=2, ny=2]
>  \setuparranging [XY]
>  \starttext
>  \startnotmode[*first]
>  \def\Doc{source_page.pdf}
>  \getfiguredimensions[\Doc]
>  \dorecurse{\noffigurepages}
>{\clip[hoffset=96mm, voffset=136mm, width=105mm, height=148mm]
>{\externalfigure[\Doc][page=\recurselevel]}}
>  \stopnotmode
>  \stoptext
> 
> 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
___


Re: [NTG-context] Clipping multiple PDFs

2022-08-22 Thread Jethro Djan via ntg-context
Thanks for the solution Pablo. It works well.

I wanted to add more pdfs (which also has many pages) and found it was
easier for me to reason in the lua side of things. This is what I have
at the moment:

\starttext
\startluacode
  local function doc(fil)
return fil..[[.pdf]]
  end

  local function disppdf(fname)
n = 1
repeat
  context.externalfigure({fname},{
page = n,
width = "200mm",
scale = "950"
  })
  n = n + 1
until n == context(context.noffigurepages)
  end

  local pdffiles = {"ass1", "ass2", "ass3", "ass4", "ass5", "ass6", "ass7",
"ass8"}
  for index=1,#pdffiles do
local f = doc(pdffiles[index])
context.getfiguredimensions({f})
disppdf(pdffiles[index])
  end
\stopluacode
\stoptext

I didn’t know how to get an array (or indexed table or whatever you call
it) in ConTeXt/Tex. My problem is now with context(context.noffigurepages).
Am I calling it wrong? All I want to do is call \noffigurepages from the
lua side. Is there something I am missing?

Jethro

On 21 Aug 2022, at 4:41 PM, Pablo Rodriguez via ntg-context <
ntg-context@ntg.nl> wrote:

On 8/18/22 02:13, jethro Reuel via ntg-context wrote:

Hello,

I am trying to put multiple PDF’s that were typeset differently into
one document without modifying the individual files themselves.
[...]
The problem is the original page numbers show and I’d prefer that it
did not. So I thought maybe I could clip all the page numbers from
every page (since they are all in the same position across all the
pages) but I don’t know how to do this with the \clip command. Any
ideas? I already tried using \input but it gives some weird output in
some places. It doesn’t have to use this method as long as it does
what I need it to do.


Hi Jethro,

it works using \clip with \externalfigure inside a loop (\dorecurse).

With \getfiguredimensions you get the number of pages of each PDF
document (\noffigurepages).

The following source both generates the source PDF document and the
imposed result with clipped pages (just to see a sample of the commands
mentioned above):

 \startbuffer[newbuff]
 \setuppapersize[A3]
 \setupbodyfont[sans, 1200pt]
 \starttext
 \dorecurse{8}
 {\startmakeup[page][pagestate=start, align=center, style=\bf]
   \recurselevel
  \stopmakeup}
 \stoptext
 \stopbuffer
 \startmode[*first]
 \savebuffer[newbuff][source_page.tex, prefix=no]
 \executesystemcommand{context --purgeall source_page.tex}
 \stopmode
 \setuplayout[page]
 \setuppapersize[A6][A4]
 \setuppaper[nx=2, ny=2]
 \setuparranging [XY]
 \starttext
 \startnotmode[*first]
 \def\Doc{source_page.pdf}
 \getfiguredimensions[\Doc]
 \dorecurse{\noffigurepages}
   {\clip[hoffset=96mm, voffset=136mm, width=105mm, height=148mm]
   {\externalfigure[\Doc][page=\recurselevel]}}
 \stopnotmode
 \stoptext

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
___


Re: [NTG-context] Clipping multiple PDFs

2022-08-21 Thread Pablo Rodriguez via ntg-context
On 8/18/22 02:13, jethro Reuel via ntg-context wrote:
> Hello,
>
> I am trying to put multiple PDF’s that were typeset differently into
> one document without modifying the individual files themselves.
> [...]
> The problem is the original page numbers show and I’d prefer that it
> did not. So I thought maybe I could clip all the page numbers from
> every page (since they are all in the same position across all the
> pages) but I don’t know how to do this with the \clip command. Any
> ideas? I already tried using \input but it gives some weird output in
> some places. It doesn’t have to use this method as long as it does
> what I need it to do.

Hi Jethro,

it works using \clip with \externalfigure inside a loop (\dorecurse).

With \getfiguredimensions you get the number of pages of each PDF
document (\noffigurepages).

The following source both generates the source PDF document and the
imposed result with clipped pages (just to see a sample of the commands
mentioned above):

  \startbuffer[newbuff]
  \setuppapersize[A3]
  \setupbodyfont[sans, 1200pt]
  \starttext
  \dorecurse{8}
  {\startmakeup[page][pagestate=start, align=center, style=\bf]
\recurselevel
   \stopmakeup}
  \stoptext
  \stopbuffer
  \startmode[*first]
  \savebuffer[newbuff][source_page.tex, prefix=no]
  \executesystemcommand{context --purgeall source_page.tex}
  \stopmode
  \setuplayout[page]
  \setuppapersize[A6][A4]
  \setuppaper[nx=2, ny=2]
  \setuparranging [XY]
  \starttext
  \startnotmode[*first]
  \def\Doc{source_page.pdf}
  \getfiguredimensions[\Doc]
  \dorecurse{\noffigurepages}
{\clip[hoffset=96mm, voffset=136mm, width=105mm, height=148mm]
{\externalfigure[\Doc][page=\recurselevel]}}
  \stopnotmode
  \stoptext

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
___


Re: [NTG-context] \rotate[rotation=270] adds extra vertical space

2021-10-22 Thread Hans Hagen via ntg-context

On 10/21/2021 6:34 PM, Pablo Rodriguez via ntg-context wrote:

Dear list,

I have the following imposition sample:

   \startbuffer[newbuff]
   \showframe\showgrid
   \setuppapersize[A3, landscape]
   \setuplayout[width=middle]
   \starttext
   \dorecurse{4}{\null\page}
   \stoptext
   \stopbuffer
   \startmode[*first]
   \savebuffer[newbuff][A3page.tex, prefix=no]
   \executesystemcommand{context --purgeall A3page.tex}
   \stopmode
   \showframe
   \setuplayout[page]
   \setuppapersize[A5][A4, landscape]
   \setuparranging [2UP]
   \setupinteractionscreen[option={landscape, paper}]
   \starttext
   \doiffile{A3page.pdf}
   {\def\Doc{A3page.pdf}
   \getfiguredimensions[\Doc]
   \dorecurse{\noffigurepages}
 {\ifodd\recurselevel
   \rotate[rotation=90]
 {\externalfigure[\Doc][page=\recurselevel, width=\textheight]}
 \else\rotate[rotation=270]
 {\externalfigure[\Doc][page=\recurselevel, width=\textheight]}
 \fi}}
   \stoptext

I’m afraid that if rotation values are 270 or 180, the imposed page has
an extra vertical space before.

nicer demo:

\showframe

\starttext
\topskip4cm
\dostepwiserecurse{0}{360}{10}{

\ruledhbox{\rotate[rotation=#1]{\blackrule[width=\textheight,height=\textwidth,depth=0cm,color=darkred]}}
}
\dostepwiserecurse{0}{360}{10}{

\ruledhbox{\rotate[rotation=#1,location=high]{\blackrule[width=\textheight,height=\textwidth,depth=0cm,color=darkgreen]}}
}
\dostepwiserecurse{0}{360}{10}{

\ruledhbox{\rotate[rotation=#1,location=fit]{\blackrule[width=\textheight,height=\textwidth,depth=0cm,color=darkblue]}}
}
\dostepwiserecurse{0}{360}{10}{

\ruledhbox{\rotate[rotation=#1,location=middle]{\blackrule[width=\textheight,height=\textwidth,depth=0cm,color=darkcyan]}}
}
\dostepwiserecurse{0}{360}{10}{

\ruledhbox{\rotate[rotation=#1,location=depth]{\blackrule[width=\textheight,height=\textwidth,depth=0cm,color=darkmagenta]}}
}
\dostepwiserecurse{0}{360}{10}{

\ruledhbox{\rotate[rotation=#1,location=broad]{\blackrule[width=\textheight,height=\textwidth,depth=0cm,color=darkyellow]}}
}
\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
___


[NTG-context] \rotate[rotation=270] adds extra vertical space

2021-10-21 Thread Pablo Rodriguez via ntg-context
Dear list,

I have the following imposition sample:

  \startbuffer[newbuff]
  \showframe\showgrid
  \setuppapersize[A3, landscape]
  \setuplayout[width=middle]
  \starttext
  \dorecurse{4}{\null\page}
  \stoptext
  \stopbuffer
  \startmode[*first]
  \savebuffer[newbuff][A3page.tex, prefix=no]
  \executesystemcommand{context --purgeall A3page.tex}
  \stopmode
  \showframe
  \setuplayout[page]
  \setuppapersize[A5][A4, landscape]
  \setuparranging [2UP]
  \setupinteractionscreen[option={landscape, paper}]
  \starttext
  \doiffile{A3page.pdf}
  {\def\Doc{A3page.pdf}
  \getfiguredimensions[\Doc]
  \dorecurse{\noffigurepages}
{\ifodd\recurselevel
  \rotate[rotation=90]
{\externalfigure[\Doc][page=\recurselevel, width=\textheight]}
\else\rotate[rotation=270]
{\externalfigure[\Doc][page=\recurselevel, width=\textheight]}
\fi}}
  \stoptext

I’m afraid that if rotation values are 270 or 180, the imposed page has
an extra vertical space before.

I think this might be a bug. Or I don’t know what I might be missing.

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
___


[NTG-context] Rotating pages

2021-08-07 Thread Jeroen via ntg-context
For the following document, the last 3 pages are landscape, but I would
like to have the pdf-ed rotated so they are in the pdf document portrait,
ie rotated 90 degree to the left but leave the page as how they are now. Is
there an easy way to achieve this?





\startbuffer[apx]

\setuppapersize[
  A4,landscape]

\setuppagenumbering[
  location={footer,center}]

\setbreakpoints[compound]

\starttext

\startsection[title={MyTitle},ref={apx}]

  \dorecurse{10}{\input zapf\par}

\stopsection

\stoptext

\stopbuffer

  \savebuffer[list=apx, file=apx.tex]

  \starttext
  \startbodymatter
  \dorecurse{10}{\input zapf\par}
  \typesetfile[\jobname-apx.tex][--purgeall][object=no, width=0pt]
  \stopbodymatter
  \startappendices
  \getfiguredimensions[\jobname-apx.pdf]
  \dorecurse{\noffigurepages}
  {\startTEXpage
\externalfigure[\jobname-apx.pdf][page=\recurselevel]
   \stopTEXpage}
  \stopappendices
  \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] Code document and simpleslides and create in one go the document with simpleslides added

2021-08-06 Thread Jeroen via ntg-context
>
>
> One final question on this one. As per latest comments this works great,
> but is there a way so the presentation pages in the appendix are made-up
> landscape as they are now, but are rotated 90 degrees so they are created
> in the pdf document as the first two pages.




\startbuffer[slides]
\setuptolerance[
  horizontal,
  tolerant,
  stretch]

\setuppapersize[
  A4,landscape]

\setuplayout[
  width=middle,
  backspace=35mm,
  cutspace=35mm,
  height=middle,
  topspace=5mm,
  bottomspace=20mm]

\setuppagenumbering[
  location={footer,center}]

\setuphead
  [section]
  [page={yes}]

\usetypescript[pagella]
\setupbodyfont[pagella,18pt]
\setupbodyfontenvironment[
  28pt][  % For body
  d=36pt, % For title
  a=12pt, % For author & date
  ]
\setuptype[style=medium]
\setuptyping[typing][bodyfont=16pt]

\setupwhitespace[medium]

\setbreakpoints[compound]

\setuphead[chapter][style=\bfd]
\setuphead[section][style=\bfc]
\setuphead[subsection][style=\bfb]
\setuphead[subsubsection][style=\bf]

\setupitemize[autointro] % prevent orphan list intro
\setupitemize[indentnext=no]

\starttext

\startsection[title={MySlideTitle},ref={myref1}]

Body text

\startitemize
\item Item 1
\item Item 2
\stopitemize

\stopsection

\startsection[title={MySlideTitle},ref={myref2}]

Body text

\startitemize
\item Item 1
\item Item 2
\stopitemize

\stopsection

\stoptext\starttext
text

\stoptext
\stopbuffer

  \savebuffer[list=slides, file=slides.tex]

  \starttext
  \startbodymatter
  \dorecurse{10}{\input zapf\par}
  \typesetfile[\jobname-slides.tex][--purgeall][object=no, width=0pt]
  \stopbodymatter
  \startappendices
  \getfiguredimensions[\jobname-slides.pdf]
  \dorecurse{\noffigurepages}
  {\startTEXpage
\externalfigure[\jobname-slides.pdf][page=\recurselevel]
   \stopTEXpage}
  \stopappendices
  \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] Code document and simpleslides and create in one go the document with simpleslides added

2021-08-01 Thread Pablo Rodriguez via ntg-context
On 7/31/21 10:23 PM, Jeroen via ntg-context wrote:
> [...]
>   \savebuffer[list=slides, file=\jobname_slides.tex, prefix=no]

Sorry, Jeroen, this was my fault.

A simpler approach to the command above reads:

  \savebuffer[list=slides, file=slides.tex]

But then you have to invoke the file as

  \typesetfile[\jobname-slides.tex][--purgeall][object=no, width=0pt]

and the output file would read:

  \getfiguredimensions[\jobname-slides.pdf]
  \dorecurse{\noffigurepages}
  {\startTEXpage
\externalfigure[\jobname-slides.pdf][page=\recurselevel]
   \stopTEXpage}

I mean, you get hyphen instead of underscore.

I hope it may 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] Code document and simpleslides and create in one go the document with simpleslides added

2021-07-31 Thread Jeroen via ntg-context
I worked around it, instead of simpleslides just use larger fonts to with
regular pages

\startbuffer[slides]
\setuptolerance[
  horizontal,
  tolerant,
  stretch]

\setuppapersize[
  A4,landscape]

\setuplayout[
  width=middle,
  backspace=35mm,
  cutspace=35mm,
  height=middle,
  topspace=5mm,
  bottomspace=20mm]

\setuppagenumbering[
  location={footer,center}]

\setuphead
  [section]
  [page={yes}]

\usetypescript[pagella]
\setupbodyfont[pagella,18pt]
\setupbodyfontenvironment[
  28pt][  % For body
  d=36pt, % For title
  a=12pt, % For author & date
  ]
\setuptype[style=medium]
\setuptyping[typing][bodyfont=16pt]

\setupwhitespace[medium]

\setbreakpoints[compound]

\setuphead[chapter][style=\bfd]
\setuphead[section][style=\bfc]
\setuphead[subsection][style=\bfb]
\setuphead[subsubsection][style=\bf]

\setupitemize[autointro] % prevent orphan list intro
\setupitemize[indentnext=no]

\starttext

\startsection[title={MySlideTitle},ref={myref1}]

Body text

\startitemize
\item Item 1
\item Item 2
\stopitemize

\stopsection

\startsection[title={MySlideTitle},ref={myref2}]

Body text

\stopsection

\stoptext\starttext
text

\stoptext
\stopbuffer

  \savebuffer[list=slides, file=\jobname_slides.tex, prefix=no]

  \starttext
  \startbodymatter
  \dorecurse{25}{\input zapf\par}
  \typesetfile[\jobname_slides.tex][--purgeall][object=no, width=0pt]
  \stopbodymatter
  \startappendices
  \getfiguredimensions[\jobname_slides.pdf]
  \dorecurse{\noffigurepages}
  {\startTEXpage
\externalfigure[\jobname_slides.pdf][page=\recurselevel]
   \stopTEXpage}
  \stopappendices
  \stoptext

Op za 31 jul. 2021 om 16:22 schreef Thomas A. Schmitz via ntg-context <
ntg-context@ntg.nl>:

>
> On 7/31/21 4:06 PM, Pablo Rodriguez via ntg-context wrote:
> > BTW, I cannot get simpleslides working with LMTX.
>
>
> I had to make some slight adjustments but have been to lazy to upload a
> new and improved version. One reason being that I can't remember my
> username and password for the modules section of the garden... I'll have
> to ask Taco to reset it for me.
>
> Thomas
>
> ___
> 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] Code document and simpleslides and create in one go the document with simpleslides added

2021-07-31 Thread Pablo Rodriguez via ntg-context
On 7/31/21 3:27 PM, Jeroen via ntg-context wrote:
> Is there an easy way to write a Context document and also code
> simpleslides in the same document so that the simpleslides are
> automatically added to the document as for example an appendix? Ie
> one tex document with Context code, perhaps with some \input and
> something like a two-pass job.
Hi Jeroen,

not sure this might help you (I’m not sure you intend a single source
file, in addition to a single PDF document), but here you have:

  \startbuffer[slides]
  \setuppapersize[CD]
  \setupbodyfont[60pt]
  \starttext
  \dorecurse{25}
  {\startmakeup[standard][pagestate=start, style={\ss\bf}, align=center]
  Slide \pagenumber
  \stopmakeup}
  \stoptext
  \stopbuffer

  \savebuffer[list=slides, file=\jobname_slides.tex, prefix=no]

  \starttext
  \startbodymatter
  \dorecurse{25}{\input zapf\par}
  \typesetfile[\jobname_slides.tex][--purgeall][object=no, width=0pt]
  \stopbodymatter
  \startappendices
  \getfiguredimensions[\jobname_slides.pdf]
  \dorecurse{\noffigurepages}
  {\startTEXpage
\externalfigure[\jobname_slides.pdf][page=\recurselevel]
   \stopTEXpage}
  \stopappendices
  \stoptext

BTW, I cannot get simpleslides working with LMTX.

> I was thinking if the simpleslides could be saved as a number of png
> images and then with the recurse add them to the document with
> placefigure.
\externalfigure is your friend here and there is no need to convert the
slides to PNG (see above).

Just in case it may 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] Typing within doifmode leads to error

2021-03-20 Thread Aditya Mahajan
On Sun, 21 Mar 2021, Hans Hagen wrote:

> On 3/20/2021 10:03 PM, Aditya Mahajan wrote:
> > On Sat, 20 Mar 2021, Hans Hagen wrote:
> > 
> > > > 
> > > > I wonder if we could have an environment, say \startluatemplate ...
> > > > \stopluatemplate, which is evaluated on the fly rather than when loading
> > > > a
> > > > file.
> > > 
> > > define 'evaluated on the fly'
> > 
> > Consider the following example:
> > 
> > \enablemode[A]
> > \starttext
> > \startluatemplate
> >
> >\starttyping
> >A and not B
> >\stoptyping
> >
> >\starttyping
> >not (A and not B)
> >\stoptyping
> >
> > \stopluatemplate
> > \stoptext
> > 
> > What I am thinking is that \startluatemplate ... \stopluatemplate grabs the
> > content (like a buffer) and then processes it using the mkix conversion
> > mechanism. Thus, in terms of output, it should be equivalent to:
> > 
> > \enablemode[A]
> > \starttext
> > \startbuffer[luatemplate]
> >
> >\starttyping
> >A and not B
> >\stoptyping
> >
> >\starttyping
> >not (A and not B)
> >\stoptyping
> >
> > \stopbuffer
> > \savebuffer[file={\jobname-luatemplate.mkix}, list={luatemplate}]
> > \input \jobname-luatemplate.mkix
> > \stoptext
> > 
> > but without the need to save to an external file.
> this is just for the mode right? in that case we can also can provide
> 
> 

:-)

I don't use templates too often, so I don't have other examples in mind where 
the \startluatemplate ... \stopluatemplate might be needed. So, just adding 
tex.enablemode at the lua will also work. We can see if another use case comes 
up in the future!

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] Typing within doifmode leads to error

2021-03-20 Thread Hans Hagen

On 3/20/2021 10:03 PM, Aditya Mahajan wrote:

On Sat, 20 Mar 2021, Hans Hagen wrote:



I wonder if we could have an environment, say \startluatemplate ...
\stopluatemplate, which is evaluated on the fly rather than when loading a
file.


define 'evaluated on the fly'


Consider the following example:

\enablemode[A]
\starttext
\startluatemplate
   
   \starttyping
   A and not B
   \stoptyping
   
   \starttyping
   not (A and not B)
   \stoptyping
   
\stopluatemplate
\stoptext

What I am thinking is that \startluatemplate ... \stopluatemplate grabs the 
content (like a buffer) and then processes it using the mkix conversion 
mechanism. Thus, in terms of output, it should be equivalent to:

\enablemode[A]
\starttext
\startbuffer[luatemplate]
   
   \starttyping
   A and not B
   \stoptyping
   
   \starttyping
   not (A and not B)
   \stoptyping
   
\stopbuffer
\savebuffer[file={\jobname-luatemplate.mkix}, list={luatemplate}]
\input \jobname-luatemplate.mkix
\stoptext

but without the need to save to an external file.

this is just for the mode right? in that case we can also can provide



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] Typing within doifmode leads to error

2021-03-20 Thread Aditya Mahajan
On Sat, 20 Mar 2021, Hans Hagen wrote:

> > 
> > I wonder if we could have an environment, say \startluatemplate ...
> > \stopluatemplate, which is evaluated on the fly rather than when loading a
> > file.
> 
> define 'evaluated on the fly'

Consider the following example:

\enablemode[A]
\starttext
\startluatemplate
  
  \starttyping
  A and not B
  \stoptyping
  
  \starttyping
  not (A and not B)
  \stoptyping
  
\stopluatemplate
\stoptext

What I am thinking is that \startluatemplate ... \stopluatemplate grabs the 
content (like a buffer) and then processes it using the mkix conversion 
mechanism. Thus, in terms of output, it should be equivalent to:

\enablemode[A]
\starttext
\startbuffer[luatemplate]
  
  \starttyping
  A and not B
  \stoptyping
  
  \starttyping
  not (A and not B)
  \stoptyping
  
\stopbuffer
\savebuffer[file={\jobname-luatemplate.mkix}, list={luatemplate}]
\input \jobname-luatemplate.mkix
\stoptext

but without the need to save to an external file. 

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] drop shadows with metapost/ metafun

2021-01-02 Thread Henning Hraban Ramm


> Am 29.12.2020 um 22:56 schrieb Garulfo :
> 
> Which process would you advice to add « drop shadows » to any kind of metafun 
> / metapost figures like:
> picture p;
> p := textext("MetaPost is fun!") shifted (10cm,10cm);
> 
> 
> My current understanding of the required steps :
> 
> 
> 1- fill p with the shadow color
> 
> 2- write it to an external metapost file (with savebuffer ?) ready for png 
> export (outputformat := "png »;)
> 
> 3- with lua, os.execute, and imagemagick prepare the shadow
>   - extent the png file with a transparent background, to have room for 
> blurring 
>   - blur it
> 
> 4- import this png in context / Metapost (externalfigure), and center it with 
> p figure
> 
> 5- shift it according to the desired shadows distance and angle
> 
> 6- apply the initial bounding box of p to the shadow, draw the shadow, draw 
> the p picture 
> 
> 
> Actually, all this seems long and tedious, and contrasts with the already 
> existing links between MetaPost / MetaFun and cairo + libpng.

I don’t know if that helps, but I’m using a stack of transparent objects to 
simulate drop shadows:
https://wiki.contextgarden.net/Drop_shadows

No pixel images required. But I’d like to have a real text shadow instead of 
that box shadow.


Happy New Year!
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] drop shadows with metapost/ metafun

2020-12-31 Thread Aditya Mahajan
On Tue, 29 Dec 2020, Garulfo wrote:

> Which process would you advice to add « drop shadows » to any kind of metafun 
> / metapost figures like:
> picture p;
> p := textext("MetaPost is fun!") shifted (10cm,10cm);
> 
> My current understanding of the required steps :
> 
> 
> 1- fill p with the shadow color
> 
> 2- write it to an external metapost file (with savebuffer ?) ready for png 
> export (outputformat := "png »;)
> 
> 3- with lua, os.execute, and imagemagick prepare the shadow
>   - extent the png file with a transparent background, to have room for 
> blurring 
>   - blur it
> 
> 4- import this png in context / Metapost (externalfigure), and center it with 
> p figure
> 
> 5- shift it according to the desired shadows distance and angle
> 
> 6- apply the initial bounding box of p to the shadow, draw the shadow, draw 
> the p picture 
> 
> 
> Actually, all this seems long and tedious, and contrasts with the already 
> existing links between MetaPost / MetaFun and cairo + libpng.

There was a drops module by Peter Rolf, which provides exactly these features:

https://mailman.ntg.nl/pipermail/ntg-context/2016/084242.html

It is not part of modules.contextgarden.net and the url in the previous post is 
no longer valid. 

I am CC:ing Peter and perhaps he can point to the updated location for the 
module. 

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
___


[NTG-context] drop shadows with metapost/ metafun

2020-12-29 Thread Garulfo
Which process would you advice to add « drop shadows » to any kind of metafun / 
metapost figures like:
picture p;
p := textext("MetaPost is fun!") shifted (10cm,10cm);

My current understanding of the required steps :


1- fill p with the shadow color

2- write it to an external metapost file (with savebuffer ?) ready for png 
export (outputformat := "png »;)

3- with lua, os.execute, and imagemagick prepare the shadow
  - extent the png file with a transparent background, to have room for 
blurring 
  - blur it

4- import this png in context / Metapost (externalfigure), and center it with p 
figure

5- shift it according to the desired shadows distance and angle

6- apply the initial bounding box of p to the shadow, draw the shadow, draw the 
p picture 


Actually, all this seems long and tedious, and contrasts with the already 
existing links between MetaPost / MetaFun and cairo + libpng.

Thanks again for your help.___
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] wrong 2TOPSIDE?

2020-08-27 Thread Pablo Rodriguez
Dear list,

I have the following sample:

\startmode[*first]
\startbuffer[abcde]
  \setuppapersize[A5, landscape]
  \setupbodyfont[100pt]
\starttext
  \dorecurse{158}{%
\startmakeup[page][style=\bf\ss, align=center, pagestatus=start]
\recurselevel
\stopmakeup}
\stoptext
\stopbuffer
 \savebuffer[abcde][singular.tex]

 \executesystemcommand{context --purgeall
--result=\jobname-singular.pdf  \jobname-singular.tex}

 \ctxlua{os.remove(tex.jobname.."-singular.tex")}
\stopmode

\startnotmode[*first]
  \setuppapersize[A5, landscape][A4]
  \setuparranging[2TOPSIDE]
  \setuplayout[page]
  \setupinteractionscreen[option={portrait,paper}]
  \starttext
  \insertpages[\jobname-singular.pdf][width=0pt]
\stopnotmode

\stoptext

I would say that last page (number 158 on #81) is misplaced. I think it
should be on #80.

Could anyone confirm this?

I’m also experiencing issues (I don’t get the first 11 imposed pages),
because I have to use:

 \executesystemcommand{context --purgeall
--result=\jobname-singular.pdf  --environment=\jobname-singular.tex
\jobname-singular.xml}

Is there a fix for this?

I’m reporting this right now, but I won’t be reaching a computer until
next Wednesday. (I know I’m going to forget, if I don’t write this now.)

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] Filter module for R

2020-06-15 Thread Aditya Mahajan

On Mon, 15 Jun 2020, Aditya Mahajan wrote:


On Sun, 14 Jun 2020, Fabrice L wrote:


Hi,

Following a question about the broken R module (R the statistical 
software), Aditya suggested me the filter module (thanks to him). I’m about 
to distribute a set of course notes to colleagues, and I need to deal with 
details now. I have one problem and two questions.


1) the filter collect R code between \startR / \stopR and submit this code 
to R. As it can be seen in the following minimal example, when a label 
contains an accented character (« Fréquence » in my example), the pdf 
graphic does not contains the « é ». Strangely, the snippet of code (which 
is saved locally as « test2-temp-R-0.tmp » (for test2.tex)) when submitted 
with the same command as the filtercommand, works correctly; that means the 
same file works when submitted to R outside of ConTeXt. I have no idea how 
to solve this.


Are you running the exact same command as the `filtercommand`. If so, I don't 
know why running the `filtercommand` through context vs directly typing it on 
the terminal should behave differently. The filter module effectively just 
runs os.execute("filtercommand"). I don't use R so I am unable to debug 
further.


I can reproduce this output side the filter module. If I directly run os.execute(...) 
from a lua session, the output is correct but running it through context gives the wrong 
output. I am guessing this is something to do with locale. I notice that the output of 
os.execute("locale") from context is different from that from my shell. But I 
don't know why locale should affect UTF characters in R. Perhaps someone with more 
knowledge of R can comment on that.

\starttext

\startluacode
  lfs.mkdir("output/")
\stopluacode

\startbuffer[code]
   pdf("output/MyHistogram.pdf",5,5)
   X <- rnorm(200,mean=10,sd=2)
   hist(X, col =  "red3" ,  xlab="Score QI" , main="", ylab="fréquence")
\stopbuffer

\savebuffer[prefix=no, list=code, file={output/code.r}]

\startluacode
  print(">>>>", "RUNNING R CMD")
  os.execute("R CMD BATCH --no-timing --save --restore output/code.r 
output/out")
\stopluacode

\externalfigure[RPlots/MyHistogram.pdf][width=.5\textwidth]

\stoptext

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] startMPpage..stopMPpage written to a separate PDF?

2020-04-06 Thread Wolfgang Schuster

Gerben Wierda schrieb am 05.04.2020 um 12:27:




On 5 Apr 2020, at 11:34, Hans Hagen  wrote:

On 4/5/2020 12:29 AM, Gerben Wierda wrote:

I have a series of startMPpage—stopMPpage pairs (with MP code inbetween). These 
now become separate pages in a single PDF. But I need them to become separate 
PDF’s each during my ConTeXt run, with a name of my own choosing. Is this 
possible? I guess this will be problematic, but one can hope (maybe some very 
low level TeX trickery)...

no (i would probably cook up something but it's not worth the trouble and it 
would add lots of ugly code deep down) but


Yes, I was thinking about some low level open/writeout stuff in TeX but was 
scared to try.

Still, a \startMPfile{pdffilename}..\stopMPfile (instead of page) would have 
been great...


Something like this:

\starttext

\startbuffer[square]
\startMPpage
draw fullsquare scaled 10 withcolor red ;
\stopMPpage
\stopbuffer

\typesetbufferonly[square]

\startbuffer[circle]
\startMPpage
draw fullcircle scaled 10 withcolor green ;
\stopMPpage
\stopbuffer

\typesetbuffer[circle]

\startbuffer[triangle]
\startMPpage
draw fulltriangle scaled 10 withcolor blue ;
\stopMPpage
\stopbuffer

\savebuffer[list=triangle,prefix=no,file=triangle.tex]

\typesetfile[triangle.tex][]

\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] repeat a page inside a document

2020-02-07 Thread Pablo Rodriguez
On 2/6/20 10:26 PM, Wolfgang Schuster wrote:
> On Thu, 6 Feb 2020 22:04:47 +0100 Pablo Rodriguez wrote:
>> [...]
>> At least, creating and removing empty files with Lua would be more
>> portable. And not having to use an external file would be better.
>
> Your example is still very confusing and I have no idea
> what you're trying to achieve. They way to go depends also
> what you try to achieve, when you need an exact copy of
> the first page the above is the way to go.

Sorry again for the poor explanation, Wolfgang.

I must recognize that I need this as a workaround to avoid crap at work
(and that is all I’m allowed to explain there).

I need an exact copy of the first page in the documents that only
contain a single page. Sorry, I cannot provide a minimal sample (only an
explanation [and I’m not sure it would be minimal]).

What I discovered after my previous message is that both
"\savebuffer[whatever][αβδ.γεζ]" and
"\ctxlua{os.remove([[\jobname]].."-αβδ.γεζ")}" are portable ways of
creating and removing empty files.

> Another way is to use a make file (or a ctx-file for ConTeXt)
> to add a image of the first page to your document afterwards.

I’m not sure I’m getting this: do you mean something similar to
\typesetbuffer?

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] Bug with jobs.file.run?

2019-08-25 Thread Aditya Mahajan

On Sun, 25 Aug 2019, Aditya Mahajan wrote:


Hi,

I use jobs.file.run in t-filter to cache the results so that the external 
filters are only run if the content has changed. For some reason, this is 
not working but I cannot figure out why? Repeating the same steps as 
t-filter manually works, but something goes wrong when I use the t-filter 
interface.


I have narrowed this down to an example that does not use the filter 
module. It seems that something goes wrong when the first argument of the 
job.files.run contains a hyphen. Here is an example:


\enabletrackers[graphic.runfile]

\starttext

\startbuffer[test]
  print("Output from lua")
\stopbuffer

\savebuffer[list={test}, file={test.lua}, prefix=no]
\ctxlua{job.files.run("test.lua",
  "lua test.lua > test-output.tex")}
\ReadFile{test-output.tex}

\savebuffer[list={test}, file={test-manual.lua}, prefix=no]
\ctxlua{job.files.run("test-manual.lua",
  "lua test-manual.lua > test-manual-output.tex")}
\ReadFile{test-manual-output.tex}

\stoptext

Compiling this using `context test.tex | grep run` gives:

graphics> run > processing file, no changes in 'test.lua', not processed
graphics> run > processing file, changes in 'test-manual.lua', 
processing forced

If I readd the definition of jobs.file.run from grph-fil.lua (see attached 
file), then the filename with hyphen also works correctly.


Compiling that with `context --mode=fix test.tex | grep run` gives

graphics> run > processing file, no changes in 'test.lua', not processed
graphics> run > processing file, no changes in 'test-manual.lua', not 
processed

Not sure why that is the case.

Aditya

test-3.tex
Description: test.tex
___
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] Parallel output of source data

2018-07-03 Thread Procházka Lukáš Ing .

Hello Wolfgang,

On Tue, 03 Jul 2018 09:07:23 +0200, Wolfgang Schuster 
 wrote:


Hi Lukas,

when you create the buffer with the grabbufferdata-command you already set
the delimiter for the environment with the third argument, in the
example below
this is the \stopcontentexport command.

To have different start/stop-commands for your environment means you have
to change all names in the implementation of the contentxport-environment.

%%
\unexpanded\def\bH{}

\def\dobH[#1]%
{...
 \grabbufferdata[...][bH][eH]}

\def\eH
   {}
%%


thank you for the explanation! - Much clearer for me how buffers work!

Best regards,

Lukas



Wolfgang

Procházka Lukáš Ing. <mailto:l...@pontex.cz>
3. Juli 2018 um 08:52
Hello,

I tried to \let shortcuts for \startcontentexport and
\stopcontentexport, but Ctx run fails.

I guess this is a basic misunderstanding, but - why?


\unexpanded\def\startcontentexport{\dosingleempty\dostartcontentexport}

\def\dostartcontentexport[#1]%
{\iffirstargument
  \edef\contentexportfile{#1}%
  \else
  \let\contentexportfile\empty
  \fi
  \grabbufferdata[contentexport][startcontentexport][stopcontentexport]
}

\def\stopcontentexport{%

\doifsomething{\contentexportfile}{\savebuffer[list=contentexport,prefix=no,file=\contentexportfile]}%

  \getbufferdata[contentexport]
}

\let\bX=\startcontentexport % < Use of these two "shortcuts" is
not possible,
\let\eX=\stopcontentexport  % < I'm getting : ! TeX capacity
exceeded, sorry [input stack size=1]

\starttext

  A

  \startcontentexport[t~.out.mkiv]
Hello!
\startitemize
\item Item
\stopitemize
  \stopcontentexport

  B

  \bX[t2~.out.mkiv]
Ahoj
  \eX

\stoptext


HSo how to define "shortcuts" properly?

Best regards,

Lukas



--
Ing. Lukáš Procházka | mailto:l...@pontex.cz
Pontex s. r. o.  | mailto:pon...@pontex.cz | http://www.pontex.cz | 
IDDS:nrpt3sn
Bezová 1658
147 14 Praha 4

Mob.: +420 702 033 396

___
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] Parallel output of source data

2018-07-03 Thread Hans Hagen

On 7/3/2018 8:52 AM, Procházka Lukáš Ing. wrote:

Hello,

I tried to \let shortcuts for \startcontentexport and 
\stopcontentexport, but Ctx run fails.


I guess this is a basic misunderstanding, but - why?


\unexpanded\def\startcontentexport{\dosingleempty\dostartcontentexport}

\def\dostartcontentexport[#1]%
{\iffirstargument
   \edef\contentexportfile{#1}%
   \else
   \let\contentexportfile\empty
   \fi
   \grabbufferdata[contentexport][startcontentexport][stopcontentexport]
}

\def\stopcontentexport{%
   
\doifsomething{\contentexportfile}{\savebuffer[list=contentexport,prefix=no,file=\contentexportfile]}% 


   \getbufferdata[contentexport]
}

\let\bX=\startcontentexport % < Use of these two "shortcuts" is not 
possible,
\let\eX=\stopcontentexport  % < I'm getting : ! TeX capacity 
exceeded, sorry [input stack size=1]


\starttext

   A

   \startcontentexport[t~.out.mkiv]
     Hello!
     \startitemize
     \item Item
     \stopitemize
   \stopcontentexport

   B

   \bX[t2~.out.mkiv]
     Ahoj
   \eX

\stoptext


HSo how to define "shortcuts" properly?

impossible ... just define an extra grabbuffer


what has this to do with parallel texts

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] Parallel output of source data

2018-07-03 Thread Wolfgang Schuster

Hi Lukas,

when you create the buffer with the grabbufferdata-command you already set
the delimiter for the environment with the third argument, in the 
example below

this is the \stopcontentexport command.

To have different start/stop-commands for your environment means you have
to change all names in the implementation of the contentxport-environment.

%%
\unexpanded\def\bH{}

\def\dobH[#1]%
   {...
\grabbufferdata[...][bH][eH]}

\def\eH
  {}
%%

Wolfgang

Procházka Lukáš Ing. <mailto:l...@pontex.cz>
3. Juli 2018 um 08:52
Hello,

I tried to \let shortcuts for \startcontentexport and 
\stopcontentexport, but Ctx run fails.


I guess this is a basic misunderstanding, but - why?


\unexpanded\def\startcontentexport{\dosingleempty\dostartcontentexport}

\def\dostartcontentexport[#1]%
{\iffirstargument
  \edef\contentexportfile{#1}%
  \else
  \let\contentexportfile\empty
  \fi
  \grabbufferdata[contentexport][startcontentexport][stopcontentexport]
}

\def\stopcontentexport{%
  
\doifsomething{\contentexportfile}{\savebuffer[list=contentexport,prefix=no,file=\contentexportfile]}% 


  \getbufferdata[contentexport]
}

\let\bX=\startcontentexport % < Use of these two "shortcuts" is 
not possible,
\let\eX=\stopcontentexport  % < I'm getting : ! TeX capacity 
exceeded, sorry [input stack size=1]


\starttext

  A

  \startcontentexport[t~.out.mkiv]
Hello!
\startitemize
\item Item
\stopitemize
  \stopcontentexport

  B

  \bX[t2~.out.mkiv]
Ahoj
  \eX

\stoptext


HSo how to define "shortcuts" properly?

Best regards,

Lukas


___
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] Parallel output of source data

2018-07-03 Thread Procházka Lukáš Ing .

Hello,

I tried to \let shortcuts for \startcontentexport and \stopcontentexport, but 
Ctx run fails.

I guess this is a basic misunderstanding, but - why?


\unexpanded\def\startcontentexport{\dosingleempty\dostartcontentexport}

\def\dostartcontentexport[#1]%
{\iffirstargument
  \edef\contentexportfile{#1}%
  \else
  \let\contentexportfile\empty
  \fi
  \grabbufferdata[contentexport][startcontentexport][stopcontentexport]
}

\def\stopcontentexport{%
  
\doifsomething{\contentexportfile}{\savebuffer[list=contentexport,prefix=no,file=\contentexportfile]}%
  \getbufferdata[contentexport]
}

\let\bX=\startcontentexport % < Use of these two "shortcuts" is not 
possible,
\let\eX=\stopcontentexport  % < I'm getting : ! TeX capacity exceeded, 
sorry [input stack size=1]

\starttext

  A

  \startcontentexport[t~.out.mkiv]
Hello!
\startitemize
\item Item
\stopitemize
  \stopcontentexport

  B

  \bX[t2~.out.mkiv]
Ahoj
  \eX

\stoptext


HSo how to define "shortcuts" properly?

Best regards,

Lukas


--
Ing. Lukáš Procházka | mailto:l...@pontex.cz
Pontex s. r. o.  | mailto:pon...@pontex.cz | http://www.pontex.cz | 
IDDS:nrpt3sn
Bezová 1658
147 14 Praha 4

Mob.: +420 702 033 396

t.mkiv
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 / 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] Problem with Filter Module in latent context beta

2018-04-17 Thread Aditya Mahajan

On Tue, 17 Apr 2018, Aditya Mahajan wrote:


On Tue, 17 Apr 2018, Hans Hagen wrote:


On 4/17/2018 12:01 AM, Aditya Mahajan wrote:
All features of the filter and vim modules work with the latest beta, 
except for one final bug: leading spaces are stripped from the buffer.


\starttext

\startbuffer[test]
     Leading spaces
\stopbuffer

\savebuffer[file=test-temp.tmp, prefix=no, list=test]

\stoptext

The leading spaces are stripped before the buffer is saved to the file 
temp.tmp. Is it possible for the leading space NOT to be stripped? (If 
not, I'll just document this as a feature :-).


\samplefile{ward}
\startnarrower
   \samplefile{ward}
   \startbuffer[test]
   Leading spaces
 And some more
   \stopbuffer
   \typebuffer[test]
\stopnarrower
\samplefile{ward}

\startbuffer[test]
   Leading spaces
   And some more
\stopbuffer
\typebuffer[test]

it is actually a feature to align the left edge relative to the least 
indented so that we can use them inside other constructs


Now, as you're not afraid of low level code:

\unprotect

\unexpanded\def\StartAditya
 {\buff_pickup
   {Aditya}%
   {StartAditya}%
   {StopAditya}%
   {}%
   {\savebuffer[file=test-temp.tmp,prefix=no,list=Aditya]}%
   \zerocount}


This is perfect as I am already using `\grabbufferdata` in my code. I can 
easily adapt it to use `\buff_pickup` instead. Thanks!.


Does what you want but of course it's sort of ugly for a module to do that. 
What we can do is this which is still ugly but picking up verbatim is 
always ugly:


\def\buff_start_indeed#1#2#3#4%
 {\edef\p_strip{\namedbufferparameter{#1}\c!strip}%

\normalexpanded{\buff_pickup{#2}{#3}{#4}{}{\buff_stop{#4}}\ifx\p_strip\v!no\zerocount\else\plusone\fi}}

\protect


I want this to be configurable at runtime and the vim module already has code 
that enables `strip=yes` and `strip=no` options (I do this via a function in 
vim so that it works with both mkii and mkiv; although I don't think that 
anyone uses the mkii module any longer).


I added `strip=yes` option to the filter module, which is now the default 
option. See "Stripping leading whitespace" in the module documentation 
(https://github.com/adityam/filter). This is a MkIV only feature and I 
will not implement it in MkII.


I also made `strip=yes` to be the default in t-vim (to be consistent with 
t-filter). In t-vim, the `strip` option works with both mkii and mkiv.


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] Problem with Filter Module in latent context beta

2018-04-17 Thread Aditya Mahajan

On Tue, 17 Apr 2018, Hans Hagen wrote:


On 4/17/2018 12:01 AM, Aditya Mahajan wrote:
All features of the filter and vim modules work with the latest beta, 
except for one final bug: leading spaces are stripped from the buffer.


\starttext

\startbuffer[test]
     Leading spaces
\stopbuffer

\savebuffer[file=test-temp.tmp, prefix=no, list=test]

\stoptext

The leading spaces are stripped before the buffer is saved to the file 
temp.tmp. Is it possible for the leading space NOT to be stripped? (If 
not, I'll just document this as a feature :-).


\samplefile{ward}
\startnarrower
   \samplefile{ward}
   \startbuffer[test]
   Leading spaces
 And some more
   \stopbuffer
   \typebuffer[test]
\stopnarrower
\samplefile{ward}

\startbuffer[test]
   Leading spaces
   And some more
\stopbuffer
\typebuffer[test]

it is actually a feature to align the left edge relative to the least 
indented so that we can use them inside other constructs


Now, as you're not afraid of low level code:

\unprotect

\unexpanded\def\StartAditya
 {\buff_pickup
   {Aditya}%
   {StartAditya}%
   {StopAditya}%
   {}%
   {\savebuffer[file=test-temp.tmp,prefix=no,list=Aditya]}%
   \zerocount}


This is perfect as I am already using `\grabbufferdata` in my code. I can 
easily adapt it to use `\buff_pickup` instead. Thanks!.


Does what you want but of course it's sort of ugly for a module to do that. 
What we can do is this which is still ugly but picking up verbatim is 
always ugly:


\def\buff_start_indeed#1#2#3#4%
 {\edef\p_strip{\namedbufferparameter{#1}\c!strip}%

\normalexpanded{\buff_pickup{#2}{#3}{#4}{}{\buff_stop{#4}}\ifx\p_strip\v!no\zerocount\else\plusone\fi}}

\protect


I want this to be configurable at runtime and the vim module already has 
code that enables `strip=yes` and `strip=no` options (I do this via a 
function in vim so that it works with both mkii and mkiv; although I don't 
think that anyone uses the mkii module any longer).


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] Problem with Filter Module in latent context beta

2018-04-17 Thread Hans Hagen

On 4/17/2018 12:01 AM, Aditya Mahajan wrote:
All features of the filter and vim modules work with the latest beta, 
except for one final bug: leading spaces are stripped from the buffer.


\starttext

\startbuffer[test]
     Leading spaces
\stopbuffer

\savebuffer[file=test-temp.tmp, prefix=no, list=test]

\stoptext

The leading spaces are stripped before the buffer is saved to the file 
temp.tmp. Is it possible for the leading space NOT to be stripped? (If 
not, I'll just document this as a feature :-).


\samplefile{ward}
\startnarrower
\samplefile{ward}
\startbuffer[test]
Leading spaces
  And some more
\stopbuffer
\typebuffer[test]
\stopnarrower
\samplefile{ward}

\startbuffer[test]
Leading spaces
And some more
\stopbuffer
\typebuffer[test]

it is actually a feature to align the left edge relative to the least 
indented so that we can use them inside other constructs


Now, as you're not afraid of low level code:

\unprotect

\unexpanded\def\StartAditya
  {\buff_pickup
{Aditya}%
{StartAditya}%
{StopAditya}%
{}%
{\savebuffer[file=test-temp.tmp,prefix=no,list=Aditya]}%
\zerocount}

\unexpanded\def\StopAditya
  {}

\protect

\StartAditya
Leading spaces
And some more
\StopAditya

(1)

\typebuffer[Aditya]

(2)

\typefile{test-temp.tmp}

Does what you want but of course it's sort of ugly for a module to do 
that. What we can do is this which is still ugly but picking up verbatim 
is always ugly:


\unprotect

\def\buff_start_indeed#1#2#3#4%
  {\edef\p_strip{\namedbufferparameter{#1}\c!strip}%

\normalexpanded{\buff_pickup{#2}{#3}{#4}{}{\buff_stop{#4}}\ifx\p_strip\v!no\zerocount\else\plusone\fi}}

\protect

\definebuffer[Aditya][strip=no]

\startAditya
Leading spaces
And some more
And even more
\stopAditya

\typeAditya

But then we need Wolfgang to double check if this extension has side 
effects elsewhere.


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] Problem with Filter Module in latent context beta

2018-04-16 Thread Aditya Mahajan
All features of the filter and vim modules work with the latest 
beta, except for one final bug: leading spaces are stripped from the 
buffer.


\starttext

\startbuffer[test]
Leading spaces
\stopbuffer

\savebuffer[file=test-temp.tmp, prefix=no, list=test]

\stoptext

The leading spaces are stripped before the buffer is saved to the file 
temp.tmp. Is it possible for the leading space NOT to be stripped? (If 
not, I'll just document this as a feature :-).


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
___

[NTG-context] \savebuffer to merge of save contents

2017-03-21 Thread Jaroslav Hajtmar
Hello ConTeXist.

Is there any possibility or modifications that will allow to savebuffer to 
work, so that will add (merge) the buffer contents into a file (Which content 
of the previous buffer)?

For inspiration, it is possible use a solution that wrote before year ago 
Wolfgang for Lukas Prochazka – ie 
https://mailman.ntg.nl/pipermail/ntg-context/2016/087657.html


Thanx
Jaroslav Hajtmar


Here is source code of Wolfgangs solution:


\unexpanded\def\startcontentexport
   {\dosingleempty\dostartcontentexport}

\def\dostartcontentexport[#1]%
   {\iffirstargument
  \edef\contentexportfile{#1}%
\else
  \let\contentexportfile\empty
\fi
\grabbufferdata[contentexport][startcontentexport][stopcontentexport]}

\def\stopcontentexport

{\doifsomething{\contentexportfile}{\savebuffer[list=contentexport,prefix=no,file=\contentexportfile]}%
\getbufferdata[contentexport]}

\starttext

A

\startcontentexport[Test.mkiv]
   Basic content …
   \startitemize
 \item Item
   \stopitemize
\stopcontentexport

B

\startcontentexport[Test.mkiv]
   Add this text into Test.mkiv file
   \startitemize
 \item Item
   \stopitemize
\stopcontentexport

C

\startcontentexport[Test.mkiv]
  And this text add into Test.mkiv file too.
   \startitemize
 \item Item
   \stopitemize
\stopcontentexport

\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] Parallel output of source data

2016-12-04 Thread Procházka Lukáš Ing .

Great, that's it! Thank you.

Best regards,

Lukas


On Fri, 02 Dec 2016 20:04:56 +0100, Wolfgang Schuster 
<schuster.wolfg...@gmail.com> wrote:


Procházka Lukáš Ing. <mailto:l...@pontex.cz>
2. Dezember 2016 um 08:10
Hello,

is there a way to let ConTeXt to flush the input stream in parallel
into an output buffer, like:


\starttext

A

\startoutput{Test.mkiv}
  Hello!
  \startitemize
\item Item
  \stopitemize
\stopoutput

B

\stoptext


which would produce:

 Test.mkiv
  Hello!
  \startitemize
\item Item
  \stopitemize


You can use a buffer to store content and save it in a external file.

\unexpanded\def\startcontentexport
   {\dosingleempty\dostartcontentexport}

\def\dostartcontentexport[#1]%
   {\iffirstargument
  \edef\contentexportfile{#1}%
\else
  \let\contentexportfile\empty
\fi
\grabbufferdata[contentexport][startcontentexport][stopcontentexport]}

\def\stopcontentexport
{\doifsomething{\contentexportfile}{\savebuffer[list=contentexport,prefix=no,file=\contentexportfile]}%
\getbufferdata[contentexport]}

\starttext

A

\startcontentexport[Test.mkiv]
   Hello!
   \startitemize
 \item Item
   \stopitemize
\stopcontentexport

B

\stoptext

Wolfgang




--
Ing. Lukáš Procházka | mailto:l...@pontex.cz
Pontex s. r. o.  | mailto:pon...@pontex.cz | http://www.pontex.cz | 
IDDS:nrpt3sn
Bezová 1658
147 14 Praha 4

Tel: +420 241 096 751 (+420 720 951 172)
Fax: +420 244 461 038

___
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] Parallel output of source data

2016-12-02 Thread Wolfgang Schuster

Procházka Lukáš Ing. <mailto:l...@pontex.cz>
2. Dezember 2016 um 08:10
Hello,

is there a way to let ConTeXt to flush the input stream in parallel 
into an output buffer, like:



\starttext

A

\startoutput{Test.mkiv}
  Hello!
  \startitemize
\item Item
  \stopitemize
\stopoutput

B

\stoptext


which would produce:

 Test.mkiv
  Hello!
  \startitemize
\item Item
  \stopitemize


You can use a buffer to store content and save it in a external file.

\unexpanded\def\startcontentexport
  {\dosingleempty\dostartcontentexport}

\def\dostartcontentexport[#1]%
  {\iffirstargument
 \edef\contentexportfile{#1}%
   \else
 \let\contentexportfile\empty
   \fi
   \grabbufferdata[contentexport][startcontentexport][stopcontentexport]}

\def\stopcontentexport
  
{\doifsomething{\contentexportfile}{\savebuffer[list=contentexport,prefix=no,file=\contentexportfile]}%

   \getbufferdata[contentexport]}

\starttext

A

\startcontentexport[Test.mkiv]
  Hello!
  \startitemize
\item Item
  \stopitemize
\stopcontentexport

B

\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] Extract only certain part of document (via modes)?

2016-11-10 Thread Wolfgang Schuster

Hans Hagen <mailto:pra...@wxs.nl>
10. November 2016 um 17:27


search for 'blocks' ...

\defineblock
...
\hideblocks
\keepblocks
\useblocks
\processblocks
\selectblocks

This doesn’t solve the problem because he want a document which
contains *only* certain blocks and nothing else, a solution for this
is a commands (\saveblocks) which saves the content of a block
in a external file (like \savebuffer does).

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] Extract only certain part of document (via modes)?

2016-11-06 Thread Mikael P. Sundqvist
On Sun, Nov 6, 2016 at 3:03 PM, Wolfgang Schuster
<schuster.wolfg...@gmail.com> wrote:
> Mikael P. Sundqvist
> 6. November 2016 um 12:51
> Dear list, and in particular Hans,
>
> I asked the same question on stackexchange before today
> (http://tex.stackexchange.com/q/337738/52406), and got the answer that
> what I want to do might not be possible.
>
> In my large document I have exercises (typeset with \startexercise
> \stopexercise, defined as an enumeration). Is it possible to use modes
> (or any other trick) to be able to compile the same file and get only
> the exercises. For example,
>
> context file.tex
>
> should give the full document, while
>
> context --mode=exercises file.tex
>
> should give only all the exercises (or just everything "in one mode")?
>
> You can put each exercise in a block and ask Hans to add a \saveblocks
> commands
> which writes the content of all exercise blocks to a external file (like
> \savebuffer lets
> you save the content of a buffer in a external file).
>
>
> \defineblock[exercise]
> \keepblocks [exercise]
>
> \defineenumeration[exercise][text=Exercise]
>
> %\doifmode{exercises}{\saveblocks[exercise][exercises.tex]}
>
> \starttext
>
> \beginexercise
> \startexercise
> This is the first exercise.
> \stopexercise
> \endexercise
>
> \beginexercise
> \startexercise
> This is the second exercise.
> \stopexercise
> \endexercise
>
> \stoptext
>
>
> The content of this saved file can then be read by another file
> to get a document which contains only the exercises.
>
>
> \defineenumeration[exercise][text=Exercise]
>
> \starttext
>
> \doiffileelse{exercise}
>   {\input{exercises}}
>   {{\tttf Exercise file doesn’t exist.}}
>
> \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
> ___

Thank you for the answer, I think that would be nice to have. Hans, do
you mind adding such a feature? Or do you have any other idea on the
problem as is?

/Mikael
___
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] Extract only certain part of document (via modes)?

2016-11-06 Thread Wolfgang Schuster

Mikael P. Sundqvist <mailto:mic...@gmail.com>
6. November 2016 um 12:51
Dear list, and in particular Hans,

I asked the same question on stackexchange before today
(http://tex.stackexchange.com/q/337738/52406), and got the answer that
what I want to do might not be possible.

In my large document I have exercises (typeset with \startexercise
\stopexercise, defined as an enumeration). Is it possible to use modes
(or any other trick) to be able to compile the same file and get only
the exercises. For example,

context file.tex

should give the full document, while

context --mode=exercises file.tex

should give only all the exercises (or just everything "in one mode")?
You can put each exercise in a block and ask Hans to add a \saveblocks 
commands
which writes the content of all exercise blocks to a external file (like 
\savebuffer lets

you save the content of a buffer in a external file).


\defineblock[exercise]
\keepblocks [exercise]

\defineenumeration[exercise][text=Exercise]

%\doifmode{exercises}{\saveblocks[exercise][exercises.tex]}

\starttext

\beginexercise
\startexercise
This is the first exercise.
\stopexercise
\endexercise

\beginexercise
\startexercise
This is the second exercise.
\stopexercise
\endexercise

\stoptext


The content of this saved file can then be read by another file
to get a document which contains only the exercises.


\defineenumeration[exercise][text=Exercise]

\starttext

\doiffileelse{exercise}
  {\input{exercises}}
  {{\tttf Exercise file doesn’t exist.}}

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

[NTG-context] two questions on imposition

2016-10-04 Thread Pablo Rodriguez
Dear list,

I have the following sample:

\setuppapersize[A6,landscape]
\setupbodyfont[pagella, 12.1pt]
\starttext
\input knuth
\stoptext

I don’t get it imposed four times on a single A4 sheet:

\showframe
\setuppapersize [A6][A4, landscape]
\setuppaper[nx=2,ny=2]
\setuparranging [XY]
\setuplayout
  [backspace=0pt,
topspace=0pt,
  header=0pt,
  footer=0pt]
\starttext
\filterpages[knuth-card.pdf][1,1,1,1]
\stoptext

What am I missing here? Imposition is clearly wrong.

The second question is how can I do the whole process in a single file
using buffers.

\savebuffer might be the way to save the buffer, but how can I typeset
it to load the pages later with \filterpages?

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Perhaps missing braces in buff-ini.mkiv?

2016-09-06 Thread Hans Hagen

On 9/6/2016 8:45 PM, Henri Menke wrote:

On 09/06/2016 10:36 AM, Hans Hagen wrote:

On 9/6/2016 9:05 AM, Henri Menke wrote:

Bump

On 08/09/2016 10:54 AM, Henri Menke wrote:

Dear list,

it seems as if there are braces missing in the definition of \buff_save around 
#2.

\def\buff_save[#1][#2]%
  {...
{\setupcurrentsavebuffer[\c!list={#1},\c!file=#2]}%
  ...}

I think they are missing, because it makes the following work, even though 
arguments and key-value arguments shouldn't be mixed up.

\startbuffer[hash]
foo
\stopbuffer
\savebuffer[hash][hello.txt,prefix=no]
\starttext
\stoptext

I think you should either make a third argument for a key-value list or just 
make the second argument the key-value list.  Then users could input 
\savebuffer[hash][file=hello.txt,prefix=no].


the first argument can be a key/value list in which case the second one is 
ignored

\savebuffer[list=hash,file=hello.txt,prefix=no]


I'd still recommend adding braces around this #2.  Imagine a user does this

\savebuffer[hash][my,file,name,with,commas.txt]


such behaviour is true for all kind of things, normally a user will then 
add the { }


also, using commas in filenames is not that clever

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Perhaps missing braces in buff-ini.mkiv?

2016-09-06 Thread Henri Menke
On 09/06/2016 10:36 AM, Hans Hagen wrote:
> On 9/6/2016 9:05 AM, Henri Menke wrote:
>> Bump
>>
>> On 08/09/2016 10:54 AM, Henri Menke wrote:
>>> Dear list,
>>>
>>> it seems as if there are braces missing in the definition of \buff_save 
>>> around #2.
>>>
>>> \def\buff_save[#1][#2]%
>>>   {...
>>> {\setupcurrentsavebuffer[\c!list={#1},\c!file=#2]}%
>>>   ...}
>>>
>>> I think they are missing, because it makes the following work, even though 
>>> arguments and key-value arguments shouldn't be mixed up.
>>>
>>> \startbuffer[hash]
>>> foo
>>> \stopbuffer
>>> \savebuffer[hash][hello.txt,prefix=no]
>>> \starttext
>>> \stoptext
>>>
>>> I think you should either make a third argument for a key-value list or 
>>> just make the second argument the key-value list.  Then users could input 
>>> \savebuffer[hash][file=hello.txt,prefix=no].
> 
> the first argument can be a key/value list in which case the second one is 
> ignored
> 
> \savebuffer[list=hash,file=hello.txt,prefix=no]

I'd still recommend adding braces around this #2.  Imagine a user does this

\savebuffer[hash][my,file,name,with,commas.txt]

Cheers, Henri

> 
> 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://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Perhaps missing braces in buff-ini.mkiv?

2016-09-06 Thread Hans Hagen

On 9/6/2016 9:05 AM, Henri Menke wrote:

Bump

On 08/09/2016 10:54 AM, Henri Menke wrote:

Dear list,

it seems as if there are braces missing in the definition of \buff_save around 
#2.

\def\buff_save[#1][#2]%
  {...
{\setupcurrentsavebuffer[\c!list={#1},\c!file=#2]}%
  ...}

I think they are missing, because it makes the following work, even though 
arguments and key-value arguments shouldn't be mixed up.

\startbuffer[hash]
foo
\stopbuffer
\savebuffer[hash][hello.txt,prefix=no]
\starttext
\stoptext

I think you should either make a third argument for a key-value list or just 
make the second argument the key-value list.  Then users could input 
\savebuffer[hash][file=hello.txt,prefix=no].


the first argument can be a key/value list in which case the second one 
is ignored


\savebuffer[list=hash,file=hello.txt,prefix=no]

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Perhaps missing braces in buff-ini.mkiv?

2016-09-06 Thread Henri Menke
Bump

On 08/09/2016 10:54 AM, Henri Menke wrote:
> Dear list,
> 
> it seems as if there are braces missing in the definition of \buff_save 
> around #2.
> 
> \def\buff_save[#1][#2]%
>   {...
> {\setupcurrentsavebuffer[\c!list={#1},\c!file=#2]}%
>   ...}
> 
> I think they are missing, because it makes the following work, even though 
> arguments and key-value arguments shouldn't be mixed up.
> 
> \startbuffer[hash]
> foo
> \stopbuffer
> \savebuffer[hash][hello.txt,prefix=no]
> \starttext
> \stoptext
> 
> I think you should either make a third argument for a key-value list or just 
> make the second argument the key-value list.  Then users could input 
> \savebuffer[hash][file=hello.txt,prefix=no].
> 
> Cheers, Henri
> 

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

[NTG-context] Perhaps missing braces in buff-ini.mkiv?

2016-08-09 Thread Henri Menke
Dear list,

it seems as if there are braces missing in the definition of \buff_save around 
#2.

\def\buff_save[#1][#2]%
  {...
{\setupcurrentsavebuffer[\c!list={#1},\c!file=#2]}%
  ...}

I think they are missing, because it makes the following work, even though 
arguments and key-value arguments shouldn't be mixed up.

\startbuffer[hash]
foo
\stopbuffer
\savebuffer[hash][hello.txt,prefix=no]
\starttext
\stoptext

I think you should either make a third argument for a key-value list or just 
make the second argument the key-value list.  Then users could input 
\savebuffer[hash][file=hello.txt,prefix=no].

Cheers, Henri
___
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
___

[NTG-context] buffers writing CR only instead of proper newlines (LF)

2015-05-02 Thread Mojca Miklavec
Hi,

The gnuplot module recently stopped working because the buffers now
seem to write out the CR (0x0d) instead of the LF character for
newlines.

Here's a minimal example as shamelessly stolen from the module:

\long\def\startXheader
  {\def\stopXheader{\ifx\savebuffer\undefined \else \savebuffer[x-header]\fi}%
   \dostartbuffer[x-header][startXheader][stopXheader]}
\def\resetXheader
  {\immediate\openout\scratchwrite=\jobname-x-header.tmp
   \immediate\closeout\scratchwrite}
\resetXheader

\starttext
\startXheader
hello
bachotex
\stopXheader
\stoptext

The problem is that I end up with a file with what vim shows as
hello^Mbachotex (^M = character 0x0d / CR).

This works properly in TL 2014.

Any hints greatly appreciated.

Thank you very much,
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] \completepublications in component creates wrong hyperlinks

2013-08-06 Thread Hans Hagen

On 8/6/2013 12:10 AM, Marco Patzer wrote:

Hi,

if a \completepublications call is used in a component, the
hyperlink, which is supposed to link to the bibliography, instead
links to a (probably non-existing) pdf file named after the
component.

\startbuffer [sample]
   @BOOK{Eijkhout1991,
 title = {\TeX\ by Topic. A \TeX nician's Reference},
 publisher = {Addison-Wesley},
 year  = {1991},
 author= {Victor Eijkhout},
 address   = {London},
 keywords  = {general},
   }
\stopbuffer
\savebuffer [list=sample, file=bibliography.bib, prefix=no]

\startbuffer [component]
   \startcomponent *
 \completepublications [criterium=text]
   \stopcomponent
\stopbuffer
\savebuffer [list=component, file=bib-component.tex, prefix=no]

\setupinteraction [state=start]
\setupbibtex [database=bibliography]
\starttext
   Some text. \cite [Eijkhout1991]

   %% creates a hyperlink to bib-component.pdf
   \component bib-component

   %% this one works
   %% \completepublications [criterium=text]
\stoptext


it's a bit more general ... i changed something in the beta and the next 
seems to work now


\startbuffer [component]
\startcomponent *
((set reference\textreference[check]{check}))
\stopcomponent
\stopbuffer

\savebuffer[list=component,file=test-component.tex,prefix=no]

\setupinteraction [state=start]

\starttext

there: \in[check]

  % \start
\component test-component
  % \stop

there: \in[check]
\page
there: \in[check]

\stoptext

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] \completepublications in component creates wrong hyperlinks

2013-08-05 Thread Marco Patzer
Hi,

if a \completepublications call is used in a component, the
hyperlink, which is supposed to link to the bibliography, instead
links to a (probably non-existing) pdf file named after the
component.

\startbuffer [sample]
  @BOOK{Eijkhout1991,
title = {\TeX\ by Topic. A \TeX nician's Reference},
publisher = {Addison-Wesley},
year  = {1991},
author= {Victor Eijkhout},
address   = {London},
keywords  = {general},
  }
\stopbuffer
\savebuffer [list=sample, file=bibliography.bib, prefix=no]

\startbuffer [component]
  \startcomponent *
\completepublications [criterium=text]
  \stopcomponent
\stopbuffer
\savebuffer [list=component, file=bib-component.tex, prefix=no]

\setupinteraction [state=start]
\setupbibtex [database=bibliography]
\starttext
  Some text. \cite [Eijkhout1991]

  %% creates a hyperlink to bib-component.pdf
  \component bib-component

  %% this one works
  %% \completepublications [criterium=text]
\stoptext

Marco


signature.asc
Description: Digital signature
___
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
___

Re: [NTG-context] documents inside documents

2013-06-25 Thread Wolfgang Schuster

Am 25.06.2013 um 22:25 schrieb Pablo Rodríguez oi...@web.de:

 On 25/06/13 21:55, Wolfgang Schuster wrote:
 Am 25.06.2013 um 21:31 schrieb Pablo Rodríguez oi...@web.de:
 Dear list,
 
 I need for a document explaining some ConTeXt features, to be able to
 include a document inside (a page that includes the feature).
 
 I know I can create another document and then insert the pages, but it
 would be much easier for me to be able to have the code inside the main
 the document.
 
 Is there a standard way to do it with ConTeXt?
 
 http://www.ntg.nl/pipermail/ntg-context/2013/072963.html
 
 Many thanks for your fast reply, Wolfgang.
 
 I'm afraid I cannot get it working with the sample file I provided. I do
 need to be able to get a complete document, not a TEXpage.
 
 Is that possible?

\startbuffer[extract:before]

  \mainlanguage[en]
  \setuplanguage[en][patterns={en,agr}]
  \definepapersize[mine][width=6in,height=2in]
  \setuppapersize[mine]
  \usemodule[simplefonts]
  \setmainfont[Theano Didot]
  \definelinenote[contxt]
  \setupnote[contxt][paragraph=yes, inbetween=\hskip1.5em]
  
\setupnotation[contxt][numbercommand=,alternative=serried,distance=1em,compress=yes,compressseparator=]

\stopbuffer

% \startbuffer[extract:after]
%   % empty
% \stopbuffer

\def\startextract
  {\dosingleempty\dostartextract}

\def\dostartextract[#1]%
  {\edef\extractfilename{#1}%
   \grabbufferdata[extract:content][startextract][stopextract]}

\def\stopextract
  {\doifsomething\extractfilename
 
{\savebuffer[list={extract:before,extract:content,extract:after},file=\extractfilename.tex,prefix=no]%
  \typesetfile[\extractfilename][]}}

\starttext

\startextract[dummy]
\startlinenumbering
οὐκ οἶσθ᾽\contxt{οἶσθ᾽: οἶσθα, 2nd sg.,
οἶσδα} ὅτι πολλῶν ἐτῶν\contxt{πολλῶν
ἐτῶν: for…; gen. time within} Ἀγάθων ἐνθάδε
οὐκ ἐπιδεδήμηκεν\contxt{ἐπιδεδήμηκεν: pf.
ἐπιδήμέω}, ἀφ᾽ οὗ\contxt{ἀφ᾽ οὗ: since;
“from which (time)”} δ᾽ ἐγὼ Σωκράτει
συνδιατρίβω\contxt{συνδιατρίβω: I have been
spending; pres. but pf. progressive in translation} καὶ
ἐπιμελὲς πεποίημαι\contxt{ἐπιμελὲς
πεποίημαι: I have made it my business; “have made it my
care,” pf.}
\stoplinenumbering
\stopextract

\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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] documents inside documents

2013-06-25 Thread Peter Münster
On Tue, Jun 25 2013, Pablo Rodríguez wrote:

 http://www.ntg.nl/pipermail/ntg-context/2013/072963.html

 I'm afraid I cannot get it working with the sample file I provided.

Hi,

Why not?

This works here:

--8---cut here---start-8---
\startbuffer[sample-document]
  \mainlanguage[en]
  \setuplanguage[en][patterns={en,agr}]
  \definepapersize[mine][width=6in,height=2in]
  \setuppapersize[mine]
  \usemodule[simplefonts]
  \setmainfont[Theano Didot]
  \definelinenote[contxt]
  \setupnote[contxt][paragraph=yes, inbetween=\hskip1.5em]
  
\setupnotation[contxt][numbercommand=,alternative=serried,distance=1em,compress=yes,compressseparator=]
  \starttext
  \startlinenumbering
  οὐκ οἶσθ᾽\contxt{οἶσθ᾽: οἶσθα, 2nd sg.,
  οἶσδα} ὅτι πολλῶν ἐτῶν\contxt{πολλῶν
  ἐτῶν: for…; gen. time within} Ἀγάθων ἐνθάδε
  οὐκ ἐπιδεδήμηκεν\contxt{ἐπιδεδήμηκεν: pf.
  ἐπιδήμέω}, ἀφ᾽ οὗ\contxt{ἀφ᾽ οὗ: since;
  “from which (time)”} δ᾽ ἐγὼ Σωκράτει
  συνδιατρίβω\contxt{συνδιατρίβω: I have been
  spending; pres. but pf. progressive in translation} καὶ
  ἐπιμελὲς πεποίημαι\contxt{ἐπιμελὲς
  πεποίημαι: I have made it my business; “have made it my
  care,” pf.}
  \stoplinenumbering
  \stoptext
\stopbuffer
\savebuffer[list=sample-document, file=sample-document.tex, prefix=no]
\starttext
bla bla bla
\typesetfile[sample-document.tex][width=10cm, frame=on]
bla bla bla
\stoptext
--8---cut here---end---8---

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

Re: [NTG-context] TEXpage filename

2013-05-04 Thread Alan Bowen
Wolfgang—

Can this be extended so as to allow the extraction of the individual
component files (as PDFs with their component names) when processing a
product file?

Alan



On Thu, May 2, 2013 at 2:44 AM, Wolfgang Schuster 
schuster.wolfg...@gmail.com wrote:


 Am 01.05.2013 um 23:02 schrieb Wolfgang Schuster 
 schuster.wolfg...@gmail.com:

 
  Am 01.05.2013 um 12:16 schrieb Alan BRASLAU alan.bras...@cea.fr:
 
  Hello,
 
  In the production of (scientific) articles for journal submissions,
  one is often expected to supply the figures as separate files.
 
  One workflow can be through the use of \startTEXpage\stopTEXpage
  followed by an external extraction of single pdf pages to separate
  files.
 
  However, is it possible or would it be possible to directly output to a
  named file, as in:
   \startTEXpage{figure1.pdf}
   \stopTEXpage
  or perhaps
   \startTEXpage [file=figure1.pdf]
   \stopTEXpage
  ? (I could not find an answer looking at the source.)
 
  One could then (optionally) reinclude the figure in a review copy of
  the full text through the use of \externalfigure [figure1]
 
  You can put each graphic in a separate document and tell context to
  create a pdf with the \typesetfile command.

 \startbuffer[extract:before]
   \startTEXpage
 \stopbuffer

 \startbuffer[extract:after]
   \stopTEXpage
 \stopbuffer

 \def\startextract
   {\dosingleempty\dostartextract}

 \def\dostartextract[#1]%
   {\edef\extractfilename{#1}%
\grabbufferdata[extract:content][startextract][stopextract]}

 \def\stopextract
   {\doifsomething\extractfilename

  
 {\savebuffer[list={extract:before,extract:content,extract:after},file=\extractfilename.tex,prefix=no]%
   \typesetfile[\extractfilename][]}}

 \starttext

 \startplacefigure[title={External file}]
   \startextract[extract-1]
   \blackrule[width=4cm,height=4cm,color=orange]
   \stopextract
 \stopplacefigure

 \stoptext

  Creating a new environment which does all of this itself isn’t hard
  because most of the stuff which is needed can be seen in the example
  below.
 
  % the external file
 
  \startbuffer[figure-1]
  \startTEXpage
  \blackrule[width=4cm,height=4cm,color=blue]
  \stopTEXpage
  \stopbuffer
 
  \savebuffer[list=figure-1,file=figure-1.tex,prefix=no]
 
  % process the external file at runtime
 
  \starttext
  \placefigure{External file}{\typesetfile[figure-1]}

 The second argument for \typesetfile is needed to get this working:

 \placefigure{External file}{\typesetfile[figure-1][]}

 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://tex.aanhet.net
 archive  : http://foundry.supelec.fr/projects/contextrev/
 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] TEXpage filename

2013-05-02 Thread Wolfgang Schuster

Am 01.05.2013 um 23:02 schrieb Wolfgang Schuster schuster.wolfg...@gmail.com:

 
 Am 01.05.2013 um 12:16 schrieb Alan BRASLAU alan.bras...@cea.fr:
 
 Hello,
 
 In the production of (scientific) articles for journal submissions,
 one is often expected to supply the figures as separate files.
 
 One workflow can be through the use of \startTEXpage\stopTEXpage
 followed by an external extraction of single pdf pages to separate
 files.
 
 However, is it possible or would it be possible to directly output to a
 named file, as in:
  \startTEXpage{figure1.pdf}
  \stopTEXpage
 or perhaps
  \startTEXpage [file=figure1.pdf]
  \stopTEXpage
 ? (I could not find an answer looking at the source.)
 
 One could then (optionally) reinclude the figure in a review copy of
 the full text through the use of \externalfigure [figure1]
 
 You can put each graphic in a separate document and tell context to
 create a pdf with the \typesetfile command.

\startbuffer[extract:before]
  \startTEXpage
\stopbuffer

\startbuffer[extract:after]
  \stopTEXpage
\stopbuffer

\def\startextract
  {\dosingleempty\dostartextract}

\def\dostartextract[#1]%
  {\edef\extractfilename{#1}%
   \grabbufferdata[extract:content][startextract][stopextract]}

\def\stopextract
  {\doifsomething\extractfilename
 
{\savebuffer[list={extract:before,extract:content,extract:after},file=\extractfilename.tex,prefix=no]%
  \typesetfile[\extractfilename][]}}

\starttext

\startplacefigure[title={External file}]
  \startextract[extract-1]
  \blackrule[width=4cm,height=4cm,color=orange]
  \stopextract
\stopplacefigure

\stoptext

 Creating a new environment which does all of this itself isn’t hard
 because most of the stuff which is needed can be seen in the example
 below.
 
 % the external file
 
 \startbuffer[figure-1]
 \startTEXpage
 \blackrule[width=4cm,height=4cm,color=blue]
 \stopTEXpage
 \stopbuffer
 
 \savebuffer[list=figure-1,file=figure-1.tex,prefix=no]
 
 % process the external file at runtime
 
 \starttext
 \placefigure{External file}{\typesetfile[figure-1]}

The second argument for \typesetfile is needed to get this working:

\placefigure{External file}{\typesetfile[figure-1][]}

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] TEXpage filename

2013-05-01 Thread Wolfgang Schuster

Am 01.05.2013 um 12:16 schrieb Alan BRASLAU alan.bras...@cea.fr:

 Hello,
 
 In the production of (scientific) articles for journal submissions,
 one is often expected to supply the figures as separate files.
 
 One workflow can be through the use of \startTEXpage\stopTEXpage
 followed by an external extraction of single pdf pages to separate
 files.
 
 However, is it possible or would it be possible to directly output to a
 named file, as in:
   \startTEXpage{figure1.pdf}
   \stopTEXpage
 or perhaps
   \startTEXpage [file=figure1.pdf]
   \stopTEXpage
 ? (I could not find an answer looking at the source.)
 
 One could then (optionally) reinclude the figure in a review copy of
 the full text through the use of \externalfigure [figure1]

You can put each graphic in a separate document and tell context to
create a pdf with the \typesetfile command.

Creating a new environment which does all of this itself isn’t hard
because most of the stuff which is needed can be seen in the example
below.

% the external file

\startbuffer[figure-1]
\startTEXpage
\blackrule[width=4cm,height=4cm,color=blue]
\stopTEXpage
\stopbuffer

\savebuffer[list=figure-1,file=figure-1.tex,prefix=no]

% process the external file at runtime

\starttext
\placefigure{External file}{\typesetfile[figure-1]}
\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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Search path for external figures changed

2013-02-15 Thread Marco Patzer
On 2013–02–15 Hans Hagen wrote:

 location={global,local}

It still doesn't work for me. Here is a complete example:

\startbuffer [foo]
beginfig(1);
  fill unitsquare scaled 2cm withcolor red;
endfig;
\stopbuffer

\luacode{lfs.mkdirgraphics}

\savebuffer
  [list=foo,
   file=graphics/foo.mp,
   prefix=no]

\setupexternalfigures
  [directory=graphics,
   location={global,local}]

\startMPrun
  %% works
  %% input graphics/foo;

  %% fails
  input foo;
\stopMPrun

\starttext
  \externalfigure [mprun.1]
\stoptext


Marco


signature.asc
Description: Digital signature
___
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
___

Re: [NTG-context] t-vim failed

2013-01-06 Thread 土卜皿
2013/1/5 Wolfgang Schuster wolfgang.schus...@gmail.com


 Am 05.01.2013 um 15:08 schrieb 土卜皿 pengcz.n...@gmail.com:

  hi, all
 I wanted to use t-vim modules, but I got the following error when
  compiling the file:
  \usemodule[vim]
  \definevimtyping[C][syntax=C]
  \starttext
  \startitemize
   \item A hello world example in C
 \startC
   #includestdio.h
   int main()
   {
 printf(Hello World)
   }
 \stopC
  \stopitemize
  \stoptext
 
  the errors as follows:
  fontspreloading latin modern fonts (second stage)
  fontstypescripts  unknown: library 'loc'
 
 {/software/spring-mvc/context-MIV/tex/texmf/fonts/map/dvips/lm/lm-math.map}{/software/spring-mvc/context-MIV/tex/texmf/fonts/map/dvips/lm/lm-rm.map}
  fontsfallback modern rm 12pt is loaded
  setuperror in line 12, namespace 289, key temp-C-0
  (vim-test-temp-C-0.vimout)
 
  can anyone help me? thanks

 The message comes from a bug in the recent change of the \savebuffer
 command.

 It’s easy to fix and I sent one to the dev list, it should be fixed with
 the next beta from Hans.

 What should I do to find whether Hans release the next beta before
installing?

Thanks!

BEST REGARDS

PengCZ


 ___
 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

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

Re: [NTG-context] t-vim failed

2013-01-06 Thread 土卜皿
Hi, all
   Sorry, I really hoped that I did not ask the previous question!
   I found the list in
http://minimals.contextgarden.net/current/context/

BEST REGARDS
PengCZ


2013/1/7 土卜皿 pengcz.n...@gmail.com




 2013/1/5 Wolfgang Schuster wolfgang.schus...@gmail.com


 Am 05.01.2013 um 15:08 schrieb 土卜皿 pengcz.n...@gmail.com:

  hi, all
 I wanted to use t-vim modules, but I got the following error when
  compiling the file:
  \usemodule[vim]
  \definevimtyping[C][syntax=C]
  \starttext
  \startitemize
   \item A hello world example in C
 \startC
   #includestdio.h
   int main()
   {
 printf(Hello World)
   }
 \stopC
  \stopitemize
  \stoptext
 
  the errors as follows:
  fontspreloading latin modern fonts (second stage)
  fontstypescripts  unknown: library 'loc'
 
 {/software/spring-mvc/context-MIV/tex/texmf/fonts/map/dvips/lm/lm-math.map}{/software/spring-mvc/context-MIV/tex/texmf/fonts/map/dvips/lm/lm-rm.map}
  fontsfallback modern rm 12pt is loaded
  setuperror in line 12, namespace 289, key temp-C-0
  (vim-test-temp-C-0.vimout)
 
  can anyone help me? thanks

 The message comes from a bug in the recent change of the \savebuffer
 command.

 It’s easy to fix and I sent one to the dev list, it should be fixed with
 the next beta from Hans.

 What should I do to find whether Hans release the next beta before
 installing?

 Thanks!

 BEST REGARDS

 PengCZ


 ___
 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

 ___



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

Re: [NTG-context] t-vim failed

2013-01-05 Thread Wolfgang Schuster

Am 05.01.2013 um 15:08 schrieb 土卜皿 pengcz.n...@gmail.com:

 hi, all
I wanted to use t-vim modules, but I got the following error when
 compiling the file:
 \usemodule[vim]
 \definevimtyping[C][syntax=C]
 \starttext
 \startitemize
  \item A hello world example in C
\startC
  #includestdio.h
  int main()
  {
printf(Hello World)
  }
\stopC
 \stopitemize
 \stoptext
 
 the errors as follows:
 fontspreloading latin modern fonts (second stage)
 fontstypescripts  unknown: library 'loc'
 {/software/spring-mvc/context-MIV/tex/texmf/fonts/map/dvips/lm/lm-math.map}{/software/spring-mvc/context-MIV/tex/texmf/fonts/map/dvips/lm/lm-rm.map}
 fontsfallback modern rm 12pt is loaded
 setuperror in line 12, namespace 289, key temp-C-0
 (vim-test-temp-C-0.vimout)
 
 can anyone help me? thanks

The message comes from a bug in the recent change of the \savebuffer command.

It’s easy to fix and I sent one to the dev list, it should be fixed with the 
next beta from Hans.

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] \savebuffer

2013-01-02 Thread Wolfgang Schuster

Am 31.12.2012 um 19:02 schrieb Hans Hagen pra...@wxs.nl:

 On 12/29/2012 6:29 PM, Wolfgang Schuster wrote:
 Hi Hans,
 
 can you add a \savebuffer variant which works like the first version of the 
 command where
 
   \savebuffer[buffername][filename]
 
 saved the buffer as filename and not as \jobname-filename.tmp like it 
 currently does.
 
 
 Instead of a new command a key-val-version of \savebuffer would do the job 
 as well, e.g.
 
   \savebuffer[list=buffername,file=filename,prefix=no]
 
 or something similar.
 
 next beta:
 
 \starttext
 
 \startbuffer[test]
 crap
 \stopbuffer
 
 \savebuffer[test][whatever]
 
 \savebuffer[list=test,file=something,prefix=no]
 
 \stoptext

Which file extension would this use, “tmp” as the current \savebuffer command 
or a requested with is applied with the filename (e.g. “file=myfile.tex”) or a 
extension key (e.g. “extension=tex”).

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] \savebuffer

2013-01-02 Thread Hans Hagen

On 1/2/2013 9:15 AM, Wolfgang Schuster wrote:


Which file extension would this use, “tmp” as the current \savebuffer command 
or a requested with is applied with the filename (e.g. “file=myfile.tex”) or a 
extension key (e.g. “extension=tex”).


with prefix=no it uses the given filename (so no suffix if not given)

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] \savebuffer

2013-01-02 Thread Sietse Brouwer
 Which file extension would this use, “tmp” as the current \savebuffer
 command or a requested with is applied with the filename (e.g.
 “file=myfile.tex”) or a extension key (e.g. “extension=tex”).


 with prefix=no it uses the given filename (so no suffix if not given)

`prefix=no` doesn't really hint at that. What about `prefix=,suffix=`
(default: `prefix=\jobname,suffix=.tmp`)?

Cheers, and a happy new year to all,
Sietse


On Wed, Jan 2, 2013 at 10:20 AM, Hans Hagen pra...@wxs.nl wrote:
 On 1/2/2013 9:15 AM, Wolfgang Schuster wrote:

 Which file extension would this use, “tmp” as the current \savebuffer
 command or a requested with is applied with the filename (e.g.
 “file=myfile.tex”) or a extension key (e.g. “extension=tex”).


 with prefix=no it uses the given filename (so no suffix if not given)


 -
   Hans Hagen | PRAGMA ADE
   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
  | 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://tex.aanhet.net
 archive  : http://foundry.supelec.fr/projects/contextrev/
 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] \savebuffer

2012-12-31 Thread Hans Hagen

On 12/29/2012 6:29 PM, Wolfgang Schuster wrote:

Hi Hans,

can you add a \savebuffer variant which works like the first version of the 
command where

   \savebuffer[buffername][filename]

saved the buffer as filename and not as \jobname-filename.tmp like it 
currently does.


Instead of a new command a key-val-version of \savebuffer would do the job as 
well, e.g.

   \savebuffer[list=buffername,file=filename,prefix=no]

or something similar.


next beta:

\starttext

\startbuffer[test]
crap
\stopbuffer

\savebuffer[test][whatever]

\savebuffer[list=test,file=something,prefix=no]

\stoptext

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] \savebuffer

2012-12-29 Thread Wolfgang Schuster
Hi Hans,

can you add a \savebuffer variant which works like the first version of the 
command where

  \savebuffer[buffername][filename]

saved the buffer as filename and not as \jobname-filename.tmp like it 
currently does.


Instead of a new command a key-val-version of \savebuffer would do the job as 
well, e.g.

  \savebuffer[list=buffername,file=filename,prefix=no]

or something similar.

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] Centring rotated float

2012-01-23 Thread Marco
I  discovered  some problems  centring  a  float which  is
rotated using externalfigure.  Without rotation everything
is fine. However, when the orientation option is provided,
the  frame  doesn't match  the  figure  any more  and  the
centring gets  lost. Using the dedicated  rotation command
works. Example:

\starttext

\startbuffer [fig]
\useMPlibrary [dum]
\starttext
\startTEXpage
\externalfigure [placeholder] [width=10cm, height=4cm]
\stopTEXpage
\stoptext
\stopbuffer
\savebuffer [fig] [fig]
\executesystemcommand{context --purge \jobname-fig.tmp}

\startplacefigure [title={Centred, but not rotated}]
\externalfigure [\jobname-fig]
\stopplacefigure

\page

\startplacefigure [title=Not centred and wrong frame location]
\externalfigure [\jobname-fig] [orientation=90, frame=on]
\stopplacefigure

\page

\startplacefigure [title=Why is this one placed on the left?]
\externalfigure [\jobname-fig] [orientation=89, frame=on]
\stopplacefigure

\page

\startplacefigure [title=Still not centred and wrong frame location]
\midaligned{\externalfigure [\jobname-fig] [orientation=90, frame=on]}
\stopplacefigure

\page

\startplacefigure [title=This one works]
\rotate[rotation=90]{\externalfigure [\jobname-fig]}
\stopplacefigure

\stoptext

Is this a bug?

Used version:
context 2011.11.29 23:11

Doesn't compile at all using:
context 2012.01.16 18:33

Marco


rotate.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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] gnuplot module does not work

2012-01-13 Thread Mojca Miklavec
On Fri, Jan 13, 2012 at 14:35, zs wrote:
 Hello,

 it seem like gnuplot module does not work with recent ConTeXt Standalone.

Thank you very much for the report.

 --- error message 

 ! Undefined control sequence.

 system           tex  error on line 110 in file pokus_min.tex: Undefined 
 control sequence ...


 l.110 \runMPgraphicstrue

This one seems easy to fix - just comment out \runMPgraphicstrue in
t-gnuplot.tex. But I have other problems with buffers after trying
that. (See the topic buffer broken? from two days ago.)

I'm using 2012.01.12 15:48 and it bails out in the same way:

! Extra }, or forgotten \endgroup.

system   tex  error on line 14 in file gptest.tex: Extra },
or forgotten  ...

 4
 5  \startGNUPLOTscript[aaa]
 6  plot [0:5] -
 7  0   1
 8  1   2
 9  2   5
10  3   10
11  4   17
12  5   26
13  e
14\stopGNUPLOTscript
15
16  \useGNUPLOTgraphic[aaa]
17
18  \stoptext
19


\stopGNUPLOTscript -\egroup
 \ifx \savebuffer \undefined \else \savebuffer [...
\buff_finish ...oup \buff_stop {stopGNUPLOTscript}
  \endgroup
l.14  \stopGNUPLOTscript

?

Mojca


 --- example -

 \usemodule[gnuplot]

 \starttext

 \startGNUPLOTscript[aaa]
 plot [0:5] -
 0       1
 1       2
 2       5
 3       10
 4       17
 5       26
 e
 \stopGNUPLOTscript

 \useGNUPLOTgraphic[aaa]

 \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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

[NTG-context] Export (table cell alignment)

2011-12-09 Thread Andreas Harder
Hi Hans,

I’ve stumbled upon another export problem, concerning (natural) tables. The 
first table exports fine but in the second table the first column is ignored. 

\startbuffer[css]
document  { display: block }
table { display: table ; width: 100% }
tablerow  { display: table-row }
tablecell { display: table-cell ; border-style: solid ; padding: 1ex }
tablecell[align=flushright] { display: table-cell ; text-align: right  }
tablecell[align=flushleft]  { display: table-cell ; text-align: left   }
tablecell[align=middle] { display: table-cell ; text-align: center }
\stopbuffer  \savebuffer[css]

\setupbackend[export=yes,xhtml=yes,css={\jobname-css.tmp}]

\starttext

\startbuffer
\bTR\bTD flush right \eTD\bTD ~  \eTD\bTD ~~ \eTD\eTR
\bTR\bTD ~ ~ \eTD\bTD flush left \eTD\bTD ~~ \eTD\eTR
\bTR\bTD ~ ~ \eTD\bTD ~  \eTD\bTD middle \eTD\eTR
\stopbuffer

\bTABLE[width=broad] \getbuffer \eTABLE % OK

\bTABLE[width=broad]
\setupTABLE [c] [1] [align=flushright]
\setupTABLE [c] [2] [align=flushleft]
\setupTABLE [c] [3] [align=middle]
\getbuffer % not OK!
\eTABLE

\stoptext


Best wishes
Andreas
___
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
___


Re: [NTG-context] Export (table cell alignment)

2011-12-09 Thread Hans Hagen

On 9-12-2011 21:58, Andreas Harder wrote:

Hi Hans,

I’ve stumbled upon another export problem, concerning (natural) tables. The 
first table exports fine but in the second table the first column is ignored.

\startbuffer[css]
document  { display: block }
table { display: table ; width: 100% }
tablerow  { display: table-row }
tablecell { display: table-cell ; border-style: solid ; padding: 1ex }
tablecell[align=flushright] { display: table-cell ; text-align: right  }
tablecell[align=flushleft]  { display: table-cell ; text-align: left   }
tablecell[align=middle] { display: table-cell ; text-align: center }
\stopbuffer  \savebuffer[css]

\setupbackend[export=yes,xhtml=yes,css={\jobname-css.tmp}]

\starttext

\startbuffer
\bTR\bTD flush right \eTD\bTD ~  \eTD\bTD ~~ \eTD\eTR
\bTR\bTD ~ ~ \eTD\bTD flush left \eTD\bTD ~~ \eTD\eTR
\bTR\bTD ~ ~ \eTD\bTD ~  \eTD\bTD middle \eTD\eTR
\stopbuffer

\bTABLE[width=broad] \getbuffer \eTABLE % OK

\bTABLE[width=broad]
\setupTABLE [c] [1] [align=flushright]
\setupTABLE [c] [2] [align=flushleft]
\setupTABLE [c] [3] [align=middle]
\getbuffer % not OK!
\eTABLE

\stoptext


tricky but fixed

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Export (table cell alignment)

2011-12-09 Thread Andreas Harder

On 10.12.2011, at 00:28, Hans Hagen wrote:

 On 9-12-2011 21:58, Andreas Harder wrote:
 Hi Hans,
 
 I’ve stumbled upon another export problem, concerning (natural) tables. The 
 first table exports fine but in the second table the first column is ignored.
 
 \startbuffer[css]
 document  { display: block }
 table { display: table ; width: 100% }
 tablerow  { display: table-row }
 tablecell { display: table-cell ; border-style: solid ; padding: 1ex }
 tablecell[align=flushright] { display: table-cell ; text-align: right  }
 tablecell[align=flushleft]  { display: table-cell ; text-align: left   }
 tablecell[align=middle] { display: table-cell ; text-align: center }
 \stopbuffer  \savebuffer[css]
 
 \setupbackend[export=yes,xhtml=yes,css={\jobname-css.tmp}]
 
 \starttext
 
 \startbuffer
 \bTR\bTD flush right \eTD\bTD ~  \eTD\bTD ~~ \eTD\eTR
 \bTR\bTD ~ ~ \eTD\bTD flush left \eTD\bTD ~~ \eTD\eTR
 \bTR\bTD ~ ~ \eTD\bTD ~  \eTD\bTD middle \eTD\eTR
 \stopbuffer
 
 \bTABLE[width=broad] \getbuffer \eTABLE % OK
 
 \bTABLE[width=broad]
 \setupTABLE [c] [1] [align=flushright]
 \setupTABLE [c] [2] [align=flushleft]
 \setupTABLE [c] [3] [align=middle]
 \getbuffer % not OK!
 \eTABLE
 
 \stoptext
 
 tricky but fixed

Thank you!

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


[NTG-context] Italic correction spoils XHTML-output

2011-10-31 Thread Andreas Harder
Hi all,

I spotted an curious side effect while using italic correction together with 
the export feature. The XHTML-export has unwanted spaces while the PDF is fine.

\startbuffer[css]
highlight[detail=emph] { font-style: italic }
\stopbuffer
\savebuffer[css][test.css] % - do not work!

\setupbackend[export=yes,xhtml=yes,css={test.css}]

\definefontfeature[default][default][itlc=yes]

\setupitaliccorrection[always] % not OK
% \setupitaliccorrection[always,global] % OK

\definehighlight[emph][style=\it]

\starttext
  \emph{example} % highlight detail=emphex am ple/highlight
\spottiest


Regards
Andreas

PS. By composing this example I noticed that \savebuffer do nothing.
___
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
___


Re: [NTG-context] Italic correction spoils XHTML-output

2011-10-31 Thread Aditya Mahajan

PS. By composing this example I noticed that \savebuffer do nothing.


Unless something has changed recently, \savebuffer[buffer-list][filename] 
concatenates all the buffers in `buffer-list` and saves them to the file 
`\jobname-filename.tmp`.


In the filter module, I work around this limitation by using
\ctxlua{os.copy(...)}. Ideally, one should be able to use 
\ctxlua{os.rename(...)} but os.rename does not work on Windows.


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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] t-vim: additional space in \inlineX{}

2011-09-20 Thread Aditya Mahajan

On Wed, 21 Sep 2011, Romain Diss wrote:


I tried the t-vim module today and I had a line-break problem with \inlineX. I
found the thread started by Peter Münster (last week). So I downloaded the
last context beta and this problem is gone.

But I got another problem : there is an unwanted additional space at the
begining of the \inlineX content.

See this minimal example (copy paste from Peter Münster mail):

\usemodule[vim]
\definevimtyping[C][syntax=c]
\starttext
bla \inlineC{void func(void)} bla
\stoptext


\ReadFile introduces a spurious space when reading the file! Here is a 
minimal example (compare the output of \ReadFile and \input):


\startbuffer[test]
{\bf bold}
\stopbuffer

\savebuffer[test][test]
\starttext
»{\bf bold}«
\endlinechar\minusone %to prevent line break after reading file
»\ReadFile{\jobname-test.tmp}«
»\input\jobname-test.tmp\relax«
\stoptext

t-vim uses \ReadFile internally and hence inherits the bug.

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Definition of lualetterbackslash

2011-08-22 Thread Aditya Mahajan

On Mon, 22 Aug 2011, Hans Hagen wrote:


On 22-8-2011 09:15, Aditya Mahajan wrote:

Hi

Consider the following example:

\startluacode
print(lualetterbackslash:, [=[\\include]=])
\stopluacode

\def\lualetterbackslash{\letterbackslash}
\startluacode
print(letterbackslash:, [=[\\include]=])
\stopluacode

\bye

gives

lualetterbackslash: \\include
letterbackslash: \include

I find the second alternative better. Why is \lualetterbackslash defined
differently from \letterbackslash?


to avoid problems with \n, \t and such


Ah, I see.


btw, best use context.include then as it provides you better tracing


Well, \include is a lilypond command that must be written to an external 
file, something like this:


\startluacode
lilypond_preamble = [[
\\include lilypond-book-preamble.py
other settings that will be substituted at run-time
]]

buffers.assign(preamble, lilypond_preamble)
\stopluacode

\startbuffer[content]
content of lilypond file
\stopbuffer

\savebuffer[preamble,content][temp-file]

\bye

I'll probably just use

\appendtoks
  \def\/{\letterbackslash}
\to\everyluacode

and then \/include. Other than using the magic single letter commands, I 
don't see an easy way of getting a \ in a lua string inside luacode :(


- \noexpand\include fails unless I define \include
- \letterbackslash include gives \ include
- \letterbackslash{}include gives \{}include

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Lilypond

2011-08-21 Thread Aditya Mahajan

On Sun, 21 Aug 2011, Henning Hraban Ramm wrote:


Current version doesn’t work at all:
- it writes the buffer with doubled filename and extension parts, i.e. from 
foo.tex foo-foo-temp-lilypond.tmp.tmp, but looks for 
foo-temp-lilypond.tmp.


The \savebuffer command has changed!!!

\starttext
\startbuffer[abc]
test
\stopbuffer

\savebuffer[abc][name.ext]
\stoptext

now creates a file \jobname-name.ext, rather than name.ext.

I'll provide a work around.


- even if I rename the buffer file, LilyPond isn’t run.

t-filter current filter : lilypond
t-filter base file : test1-temp-lilypond
t-filter input file : test1-temp-lilypond.tmp
t-filter output file :
t-filter command :


With the latest version, I also get this. Strange.

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Lilypond

2011-08-21 Thread Hans Hagen

On 22-8-2011 00:14, Aditya Mahajan wrote:

On Sun, 21 Aug 2011, Henning Hraban Ramm wrote:


Current version doesn’t work at all:
- it writes the buffer with doubled filename and extension parts, i.e.
from foo.tex foo-foo-temp-lilypond.tmp.tmp, but looks for
foo-temp-lilypond.tmp.


The \savebuffer command has changed!!!


well, you wanted a jobname as prefix -)

(in mkii that only happens with the \protectbuffers flag is set, in mkiv 
always)


Just tell me what you expect

Hans


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Lilypond

2011-08-21 Thread Aditya Mahajan

On Mon, 22 Aug 2011, Hans Hagen wrote:


On 22-8-2011 00:14, Aditya Mahajan wrote:

On Sun, 21 Aug 2011, Henning Hraban Ramm wrote:


Current version doesn’t work at all:
- it writes the buffer with doubled filename and extension parts, i.e.
from foo.tex foo-foo-temp-lilypond.tmp.tmp, but looks for
foo-temp-lilypond.tmp.


The \savebuffer command has changed!!!


well, you wanted a jobname as prefix -)


In MkII, not MkIV :)

(in mkii that only happens with the \protectbuffers flag is set, in mkiv 
always)


Just tell me what you expect


My preference is for \savebuffer[...][filename] to write contents in 
filename. No funny prefix or suffix.


If you have to add prefix and suffixes, please make it configurable (like 
\bufferprefix and \f!temporaryfilenameextension in MkII). With the current 
MkIV implementation, I cannot directly write the buffer to a file in 
another directory. Of course, I can work around using file.move, but that 
is adding one extra step.


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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] How well do ConTeXt (lua)module for other users?

2011-07-19 Thread Wolfgang Schuster

Am 19.07.2011 um 14:27 schrieb Jaroslav Hajtmar:

 Hello ConTeXist.
 
 I have done the module (for context), which is entirely written in Lua 
 (ConTeXt definitions are done through Lua too).
 
 I wonder how it can be loaded into ConTeXt file. Have I to use the beginning 
 of the file:
 \startluacode
  dofile (my-module.lua)
 \stopluacode
 
 to loading the module? I would like to use \usemodule [my-module.lua], but 
 there is a problem, that code must be inside \startluacode ... \stopluacode 
 environment.
 But when I put my luacode into \startluacode ... \stopluacode into 
 my-module.mkiv file, then I have a problem with catcodes inside strings 
 defining by  [[  ... ]].
 
 Or must be module consists of two separate files (my-module.lua and 
 my-module.mkiv)? Must I to load the Lua module file (my-module.lua)  into 
 ConTeXt module file (my-module.mkiv) by command \ctxlua{dofile(my-module.lua 
 );} and then load module file (my-module.mkiv) into my user file by command 
 \usemodule[my-module]?
 
 Is there something like \useluamodule[] or  
 \usemodule[anyluaswitch][modulefile] ???
 
 How to proceed in these cases? I find it inappropriate to divide the module 
 into two separate files.

Use \usemodule:

example
\startbuffer[test]
function test(argument)
context.quotation(argument)
end

interfaces.definecommand {
name = test,
arguments = {
{ content, string },
},
macro = test,
}
\stopbuffer

\savebuffer[test][p-test.lua]

\usemodule[test]

\starttext
\test{Hello}
\stoptext
/example

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] How well do ConTeXt (lua)module for other users?

2011-07-19 Thread Jaroslav Hajtmar

Great ... that's exactly what I needed ... Thanks very much Wolfgang.
It can be somewhere on similar techniques to read more? Just links to 
some sample files to the dissected ...


Thanks a lot
Jaroslav



Dne 19.7.2011 14:39, Wolfgang Schuster napsal(a):

Am 19.07.2011 um 14:27 schrieb Jaroslav Hajtmar:

   

  Hello ConTeXist.
  
  I have done the module (for context), which is entirely written in Lua (ConTeXt definitions are done through Lua too).
  
  I wonder how it can be loaded into ConTeXt file. Have I to use the beginning of the file:

  \startluacode
dofile (my-module.lua)
  \stopluacode
  
  to loading the module? I would like to use \usemodule [my-module.lua], but there is a problem, that code must be inside \startluacode ... \stopluacode environment.

  But when I put my luacode into \startluacode ... \stopluacode into 
my-module.mkiv file, then I have a problem with catcodes inside strings defining 
by  [[  ... ]].
  
  Or must be module consists of two separate files (my-module.lua and my-module.mkiv)? Must I to load the Lua module file (my-module.lua)  into ConTeXt module file (my-module.mkiv) by command \ctxlua{dofile(my-module.lua );} and then load module file (my-module.mkiv) into my user file by command \usemodule[my-module]?
  
  Is there something like \useluamodule[] or  \usemodule[anyluaswitch][modulefile] ???
  
  How to proceed in these cases? I find it inappropriate to divide the module into two separate files.
 

Use \usemodule:

example
\startbuffer[test]
function test(argument)
 context.quotation(argument)
end

interfaces.definecommand {
 name = test,
 arguments = {
 { content, string },
 },
 macro = test,
}
\stopbuffer

\savebuffer[test][p-test.lua]

\usemodule[test]

\starttext
\test{Hello}
\stoptext
/example

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] Typo in buff-ini.lua

2011-04-16 Thread Aditya Mahajan

Hi Hans,

In buff-ini.lua, line 73 should be

  return concat(t,separator or \n) -- AM: was \r

Otherwise, the following gives a wrong output:

\startbuffer[one]
This is one
\stopbuffer

\startbuffer[two]
This is two
\stopbuffer

\ctxcommand{savebuffer({one, two}, test.tmp)}

\end

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] TeX-figures

2011-01-30 Thread Peter Münster
Vnpenguin vnpeng...@vnoss.org writes:

 I'm trying TeX-figures (Section 13.5 of ConTeX manual). Here is my test

Hello,

In the new manual it's section 16.5.


 \stopbuffer
 \externalfigure[mytable.tmp][width=0.8\textwidth]

In mkiv, the buffer is not saved in a file. You need to do this
explicitly:

\stopbuffer
\savebuffer[mytable][mytable.tmp]
\externalfigure[mytable.tmp][width=0.8\textwidth]


There is also \typesetbuffer:

\starttext
\startbuffer[mytable]
\startTEXpage
bla bla bla
\stopTEXpage
\stopbuffer
\typesetbuffer[mytable][width=0.8\textwidth]
\stoptext

I'll update section 16.5 accordingly.

Cheers,
-- 
   Peter
___
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
___


[NTG-context] problem with digit in buffer name

2011-01-30 Thread Peter Münster
Hello,

I get ! I can't find file `virtual://viafile.1'. with the following
example:

\starttext
\startbuffer[mytable1]
bla
\stopbuffer
\savebuffer[mytable1][mytable.tmp]
\externalfigure[mytable.tmp][width=0.8\textwidth]
\stoptext

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


Re: [NTG-context] TeX-figures

2011-01-30 Thread Vnpenguin
On Sun, Jan 30, 2011 at 11:43, Peter Münster pmli...@free.fr wrote:
 Vnpenguin vnpeng...@vnoss.org writes:

 I'm trying TeX-figures (Section 13.5 of ConTeX manual). Here is my test

 Hello,

 In the new manual it's section 16.5.


 \stopbuffer
 \externalfigure[mytable.tmp][width=0.8\textwidth]

 In mkiv, the buffer is not saved in a file. You need to do this
 explicitly:

 \stopbuffer
 \savebuffer[mytable][mytable.tmp]
 \externalfigure[mytable.tmp][width=0.8\textwidth]

Thank you, this method works ok for me.

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


Re: [NTG-context] problem with digit in buffer name

2011-01-30 Thread Vnpenguin
On Sun, Jan 30, 2011 at 11:46, Peter Münster pmli...@free.fr wrote:
 Hello,

 I get ! I can't find file `virtual://viafile.1'. with the following
 example:

 \starttext
 \startbuffer[mytable1]
 bla
 \stopbuffer
 \savebuffer[mytable1][mytable.tmp]
 \externalfigure[mytable.tmp][width=0.8\textwidth]
 \stoptext

I have same error. But when I modify (mytable instead of mytable1)

\startbuffer[mytable]
...
\savebuffer[mytable][mytable.tmp]

So it works :)
Hans, can you have a look at please!

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


Re: [NTG-context] TeX-figures

2011-01-30 Thread Wolfgang Schuster

Am 30.01.2011 um 11:43 schrieb Peter Münster:

 In mkiv, the buffer is not saved in a file. You need to do this
 explicitly:
 
 \stopbuffer
 \savebuffer[mytable][mytable.tmp]
 \externalfigure[mytable.tmp][width=0.8\textwidth]

In MkIV this should be possible

\externalfigure[mytable.buffer]

where you don’t have to save buffer but it seems to be broken.

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] TeX-figures

2011-01-30 Thread Peter Münster
Steffen Wolfrum cont...@st.estfiles.de writes:

 [...]
 
 \getbuffer

 Works great for me ...

Sure, but it's really not the same ;)

Compare:

\starttext
\startbuffer
\startTEXpage[width=5cm]
\input tufte
\stopTEXpage
\stopbuffer
\getbuffer

\startbuffer[testbuf]
\input tufte
\stopbuffer
\savebuffer[testbuf][testbuf.tmp]
\externalfigure[testbuf.tmp][width=5cm]
\stoptext

Cheers,
-- 
   Peter
___
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
___


Re: [NTG-context] TeX-figures

2011-01-30 Thread Vnpenguin
On Sun, Jan 30, 2011 at 12:27, Wolfgang Schuster
schuster.wolfg...@googlemail.com wrote:

 Am 30.01.2011 um 11:43 schrieb Peter Münster:

 In mkiv, the buffer is not saved in a file. You need to do this
 explicitly:

 \stopbuffer
 \savebuffer[mytable][mytable.tmp]
 \externalfigure[mytable.tmp][width=0.8\textwidth]

 In MkIV this should be possible

 \externalfigure[mytable.buffer]

 where you don’t have to save buffer but it seems to be broken.


Yes, it's broken. I don't like \savebuffer but I have no choice for now.
___
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
___


Re: [NTG-context] TeX-figures

2011-01-30 Thread Hans Hagen

On 30-1-2011 1:10, Peter Münster wrote:

Steffen Wolfrumcont...@st.estfiles.de  writes:


[...]

\getbuffer

Works great for me ...


Sure, but it's really not the same ;)

Compare:

\starttext
\startbuffer
\startTEXpage[width=5cm]
\input tufte
\stopTEXpage
\stopbuffer
\getbuffer

\startbuffer[testbuf]
\input tufte
\stopbuffer
\savebuffer[testbuf][testbuf.tmp]
\externalfigure[testbuf.tmp][width=5cm]
\stoptext


\starttext

\startbuffer[testbuf]
\input tufte
\stopbuffer

\externalfigure[testbuf][type=buffer,width=5cm]

\externalfigure[testbuf.buffer][width=5cm]

\stoptext

in mkiv .tmp makes no sense any more as we have no tmp files


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] \bufferprefix in MKIV

2011-01-26 Thread Wolfgang Schuster

Am 26.01.2011 um 17:46 schrieb Mojca Miklavec:

 Dear Hans,
 
 one of the latest versions of MKIV breaks the following code:
\edef\GNUPLOTfile  {\bufferprefix gnuplot-\GNUPLOTnumber}%
 since \bufferprefix is not defined any more. Is there any reason for
 that? In particular ...

MkIV stores the buffer content in memory and therefore no external
file was generated which needed a protected name with \bufferprefix.

When you save a buffer with \savebuffer[…] context adds \jobname
as prefix to the file, therefore you can use \jobname in \GNUPLOTfile.

You should also take a look into Adityas filter module.

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Bad interaction between new interpretation of underscore and modules

2011-01-14 Thread Wolfgang Schuster

Am 14.01.2011 um 10:15 schrieb Mathieu Boespflug:

 Thank you for the solution, Wolfgang.  But it seems rather painful to
 have to replace every occurrence of _ in my definitions module with
 the very verbose \normalsubscript just because it's a module. The new
 default catcode for _ introduces extra difficulty when defining math
 macros. Would it be possible to at least have a macro to revert to the
 old behaviour? Also, I'm still stumped as to why modules make any
 difference here. I would have expected this problem to also show up if
 the definitions were made inline at the top of the source file for the
 document.

When you write a module you put \unprotect and \protect at the begin and
end of the file because they make @, !, ? and _ to a normal letter like abc
which can be used in macros. When you load a file with \usemodule or
\environment this isn’t necessary because context adds already calls
both commands when the file is opened and closed for reading and this
mechanism is used even if you aren’t aware of this.

PS  For \environment this is only true when you use it in a document
with \starttext or when you write it before \startproduct, \startcomponent etc.

PPS  You can abuse \nonknuthmode to make your module to work

\startbuffer[definitions]
\pushcatcodes\nonknuthmode % \startnonknuthmode
\def\lambdax{\lambda_x}
\popcatcodes   % \stopnonknuthmode
\stopbuffer

\savebuffer[definitions][p-definitions.tex]

\startbuffer[more]
\def\morex{\more_x}
\stopbuffer

\savebuffer[more][p-more.tex]

\usemodule[definitions,more]

\starttext
blah $\lambdax$ blah. \morex
\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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Bad interaction between new interpretation of underscore and modules

2011-01-14 Thread Mathieu Boespflug
Hi Wolfgang,

thank you for the explanation and the solution.

Best,

Mathieu

On Fri, Jan 14, 2011 at 10:32 AM, Wolfgang Schuster
schuster.wolfg...@googlemail.com wrote:

 Am 14.01.2011 um 10:15 schrieb Mathieu Boespflug:

 Thank you for the solution, Wolfgang.  But it seems rather painful to
 have to replace every occurrence of _ in my definitions module with
 the very verbose \normalsubscript just because it's a module. The new
 default catcode for _ introduces extra difficulty when defining math
 macros. Would it be possible to at least have a macro to revert to the
 old behaviour? Also, I'm still stumped as to why modules make any
 difference here. I would have expected this problem to also show up if
 the definitions were made inline at the top of the source file for the
 document.

 When you write a module you put \unprotect and \protect at the begin and
 end of the file because they make @, !, ? and _ to a normal letter like abc
 which can be used in macros. When you load a file with \usemodule or
 \environment this isn’t necessary because context adds already calls
 both commands when the file is opened and closed for reading and this
 mechanism is used even if you aren’t aware of this.

 PS  For \environment this is only true when you use it in a document
 with \starttext or when you write it before \startproduct, \startcomponent 
 etc.

 PPS  You can abuse \nonknuthmode to make your module to work

 \startbuffer[definitions]
 \pushcatcodes\nonknuthmode % \startnonknuthmode
 \def\lambdax{\lambda_x}
 \popcatcodes               % \stopnonknuthmode
 \stopbuffer

 \savebuffer[definitions][p-definitions.tex]

 \startbuffer[more]
 \def\morex{\more_x}
 \stopbuffer

 \savebuffer[more][p-more.tex]

 \usemodule[definitions,more]

 \starttext
 blah $\lambdax$ blah. \morex
 \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://tex.aanhet.net
 archive  : http://foundry.supelec.fr/projects/contextrev/
 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Replacing a piece of a paper

2011-01-12 Thread Procházka Lukáš Ing . - Pontex s . r . o .

Hello,

thanks to all for the answers, Peter's solution is closest to that I need. My 
code now is:

---
\setuppapersize[A1,landscape]
\setuplayout[page]
\setuppositioning
  [state=overlay,
   yoffset=-12pt % Why?
  ]

\starttext
  \startpositioning
\position(0,0){\rotate[rotation=90]{\externalfigure[TvNK]}}

\position(630mm,297mm){\framed[frame=off,offset=overlay,background=color,backgroundcolor=white]
  {\externalfigure[_R]}}
  \stoppositioning
\stoptext
---

I'd still have two questions:

- Is it possible to determine the size of the PDF being inserted (in my case the 
TvNK, which is A1)? I'd need to know this because depending on this, I'd need to 
\setuppapersize[size-of-PDF-to-be-inserted,landscape].

- Is it possible to move the origin for \positioning to the right bottom corner? It's 
not fatal to know it, as having the PDF size known, I can evaluate 630mm = width.of.A1 
- width.of.A4 and 297 = height.of.A1 - height.of.A4;  I'm just curious.

Best regards,

Lukas


On Tue, 11 Jan 2011 21:32:12 +0100, Peter Münster pmli...@free.fr wrote:


Not necessary, context can produce such files for you.

Example, using positioning macros, that shows also a problem with
vertical offset:

--8---cut here---start-8---
% Produce A2-example:
\startbuffer[a2]
\setuppapersize[A2]
\setuplayout[page]
\setupbackgrounds[page][background=color, backgroundcolor=blue]
\starttext
\input tufte
\stoptext
\stopbuffer
\savebuffer[a2][a2-page.tex]
\executesystemcommand{context a2-page}

% Produce A4-example:
\startbuffer[a4]
\setuppapersize[A4]
\setuplayout[page]
\starttext
\input tufte
\stoptext
\stopbuffer
\savebuffer[a4][a4-page.tex]
\executesystemcommand{context a4-page}

% Do the job:
\setuppapersize[A2]
\setuplayout[page]
\setuppositioning[state=overlay,
  yoffset=-12pt%%% Why is this offset needed???
]
\starttext
\startpositioning
  \position(0,0){\externalfigure[a2-page]}
  \position(0,0){\framed[frame=off, offset=overlay, background=color,
  backgroundcolor=white]{\externalfigure[a4-page]}}
\stoppositioning
\stoptext
--8---cut here---end---8---




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

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

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


[NTG-context] undesired offset with \position (was: Re: Replacing a piece of a paper)

2011-01-11 Thread Peter Münster
Procházka Lukáš Ing. - Pontex s. r. o. l...@pontex.cz writes:

 Would it be possible to provide a small example of such processing an
 arbitrary file?

Yes.


 I can send a sample A2 or A1 PDF, and also a replacing A4, if necessary.

Not necessary, context can produce such files for you.

Example, using positioning macros, that shows also a problem with
vertical offset:

--8---cut here---start-8---
% Produce A2-example:
\startbuffer[a2]
\setuppapersize[A2]
\setuplayout[page]
\setupbackgrounds[page][background=color, backgroundcolor=blue]
\starttext
\input tufte
\stoptext
\stopbuffer
\savebuffer[a2][a2-page.tex]
\executesystemcommand{context a2-page}

% Produce A4-example:
\startbuffer[a4]
\setuppapersize[A4]
\setuplayout[page]
\starttext
\input tufte
\stoptext
\stopbuffer
\savebuffer[a4][a4-page.tex]
\executesystemcommand{context a4-page}

% Do the job:
\setuppapersize[A2]
\setuplayout[page]
\setuppositioning[state=overlay,
  yoffset=-12pt%%% Why is this offset needed???
]
\starttext
\startpositioning
  \position(0,0){\externalfigure[a2-page]}
  \position(0,0){\framed[frame=off, offset=overlay, background=color,
  backgroundcolor=white]{\externalfigure[a4-page]}}
\stoppositioning
\stoptext
--8---cut here---end---8---

-- 
Peter Münster

Contact information: http://pmrb.free.fr/contact/
___
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
___


Re: [NTG-context] Handling EMBED tag in Tex

2011-01-06 Thread Wolfgang Schuster

Am 06.01.2011 um 04:42 schrieb Anand Raj:

 Hi,
 
 I have embed tags in my xhtml can i render it in my pdf. 
 
 How should I form the .tex file to handle this?
 
 embed type='image/svg+xml' align='middle' width='200' height='200' 
 src='/javascript/d.svg' 
 script='initPicture(-.5,5,-.5,5);path([[0,0],[1,4],[4,4],[3,0],[0,0]]);text([2.5,4],44,above);text([3.5,2],44,right);stroke=red;fontfill=red;line([1,0],[1,4]);text([1,2],?,right);'
  /

Write the whole block to a external file and read import it them with 
\externalfigure.

\startxmlsetups xml:embed
   \setbuffer[embed]\xmlflush{#1}\endbuffer
   \savebuffer[embed][embed.svg]
   \externalfigure[embed.svg]
\stopxmlsetups

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Handling EMBED tag in Tex

2011-01-06 Thread Hans Hagen

On 6-1-2011 9:02, Wolfgang Schuster wrote:


Am 06.01.2011 um 04:42 schrieb Anand Raj:


Hi,

I have embed tags in my xhtml can i render it in my pdf.

How should I form the .tex file to handle this?

embed type='image/svg+xml' align='middle' width='200' height='200' src='/javascript/d.svg' 
script='initPicture(-.5,5,-.5,5);path([[0,0],[1,4],[4,4],[3,0],[0,0]]);text([2.5,4],44,above);text([3.5,2],44,right);stroke=red;fontfill=red;line([1,0],[1,4]);text([1,2],?,right);'
 /


Write the whole block to a external file and read import it them with 
\externalfigure.

\startxmlsetups xml:embed
\setbuffer[embed]\xmlflush{#1}\endbuffer
\savebuffer[embed][embed.svg]
\externalfigure[embed.svg]
\stopxmlsetups


remind me to make a \xmltofile some time

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Handling EMBED tag in Tex

2011-01-06 Thread Anand Raj
Yes. the svg content is not stored in the embed.svg.

can you make it?

Thanks

On Thu, Jan 6, 2011 at 5:28 PM, Hans Hagen pra...@wxs.nl wrote:

 On 6-1-2011 9:02, Wolfgang Schuster wrote:


 Am 06.01.2011 um 04:42 schrieb Anand Raj:

  Hi,

 I have embed tags in my xhtml can i render it in my pdf.

 How should I form the .tex file to handle this?

 embed type='image/svg+xml' align='middle' width='200' height='200'
 src='/javascript/d.svg'
 script='initPicture(-.5,5,-.5,5);path([[0,0],[1,4],[4,4],[3,0],[0,0]]);text([2.5,4],44,above);text([3.5,2],44,right);stroke=red;fontfill=red;line([1,0],[1,4]);text([1,2],?,right);'
 /


 Write the whole block to a external file and read import it them with
 \externalfigure.

 \startxmlsetups xml:embed
\setbuffer[embed]\xmlflush{#1}\endbuffer
\savebuffer[embed][embed.svg]
\externalfigure[embed.svg]
 \stopxmlsetups


 remind me to make a \xmltofile some time

 -
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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://tex.aanhet.net
 archive  : http://foundry.supelec.fr/projects/contextrev/
 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] FiXme-module

2010-11-08 Thread Wolfgang Schuster

Am 05.11.2010 um 13:12 schrieb Andreas Harder:

 Hi Wolfgang,
 
 I've played a bit with your FiXme-module. First of all, thanks for the work! 
 But I ran into following issues.
 
 1. Something is going wrong if I allow interaction. So the text is marked as 
 a link, but one can't jump to the right location.

Works for me, maybe a bug in context which is now solved.

 2. Instead of margin notes I would like to use PDF annotations, so I tried:
 \setupfixme
  [before={\startcomment[FiXme]},
   after=\stopcomment]
 This gives an error.

comments are defined as buffers and buffers can’t be used in before/after keys 
but i can add a „location=comment“ to the module.

 3. Is it possible to save the FiXme-list in a external text file? Something 
 like \savebuffer[expanded list of fixmes][list.txt]

Do you want a separate file for each entry or one file with all entries?

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] FiXme-module

2010-11-08 Thread Andreas Harder

Am 08.11.2010 um 20:16 schrieb Wolfgang Schuster:

 
 Am 05.11.2010 um 13:12 schrieb Andreas Harder:
 
 Hi Wolfgang,
 
 I've played a bit with your FiXme-module. First of all, thanks for the work! 
 But I ran into following issues.
 
 1. Something is going wrong if I allow interaction. So the text is marked as 
 a link, but one can't jump to the right location.
 
 Works for me, maybe a bug in context which is now solved.

Hmm, I'm using the latest beta. I checked some documents and it works there but 
fails in something simple like
\setupinteraction[state=start]
\starttext
\placelist[chapter][interaction=all]
\dorecurse{5}{\chapter{Chapter} }
\stoptext
But anyway it has nothing to do with your module.

 2. Instead of margin notes I would like to use PDF annotations, so I tried:
 \setupfixme
 [before={\startcomment[FiXme]},
  after=\stopcomment]
 This gives an error.
 
 comments are defined as buffers and buffers can’t be used in before/after 
 keys but i can add a „location=comment“ to the module.

That would be nice, but would't alternative=comment“ more appropriate?

 3. Is it possible to save the FiXme-list in a external text file? Something 
 like \savebuffer[expanded list of fixmes][list.txt]
 
 Do you want a separate file for each entry or one file with all entries?

I thought of one file with all entries. 

My first idea was to write something like:
\startTODO
* \currentcomponent
** TODO fix that, fix this
** DONE fix that, fix this
\stopTODO
Write all TODO environments in a single file and use Emacs Org-mode to navigate 
through the list.

Best regards
Andreas
___
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
___


[NTG-context] FiXme-module

2010-11-05 Thread Andreas Harder
Hi Wolfgang,

I've played a bit with your FiXme-module. First of all, thanks for the work! 
But I ran into following issues.

1. Something is going wrong if I allow interaction. So the text is marked as a 
link, but one can't jump to the right location.

2. Instead of margin notes I would like to use PDF annotations, so I tried:
\setupfixme
  [before={\startcomment[FiXme]},
   after=\stopcomment]
This gives an error.

3. Is it possible to save the FiXme-list in a external text file? Something 
like \savebuffer[expanded list of fixmes][list.txt]

\usemodule[fixme]

% \setupfixme % - error
%   [before={\startcomment[FiXme]},
%after=\stopcomment]

\setupinteraction[state=start]
\setuplist[fixme][interaction=all]

\starttext
\fixme{To be done …}
\input knuth
\fixme{To be done …}
\input tufte
\fixme{To be done …}
\page
\placelist[fixme]
\stoptext

Best regards
Andreas
___
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
___


[NTG-context] Questions regarding the bibliography

2010-09-22 Thread Marco
Hi,

I've a bunch of questions regarding the bibliography. I didn't find much
useful information somewhere, neither in the wiki, the manual or in
bibmod-doc.pdf. If my questions are answered elsewhere feel free to point me
to the right direction.

1) Why are there redundant keys in the publication list:
\startpublication [
  k=ram,
  t=book,
  a=Ramez Elmasri, % BTW: How to input many authors in this place?
  y=1981,  % not taken into account
  u=http://foo.bar.com
]
\author {Ramez}[R.]{}{Elmasri} % Is it OK to leave out the first bracket?
\pubyear {2007}
\biburl {http://foo.bar.com}
\stoppublication

I checked that the »y=1981« is not taken into account, in fact I can remove it
without problems, if I remove \pubyear it doesn't work. What's »y=...« for?
Same goes for \author vs. a=... Why two locations for the author and url...?

2) What about not valid entries? \biburl for example is not a valid BibTeX
entry type, it's neither required, nor optional. Can I provide it without
running into problems? Providing for example \country leads to problems with
the year. But \biburl is not used in the style, \country is.

3) During testing I forgot to say \usemodule[bib] and it worked well. Is this
line not needed any more?

4) How to specify the \edition entry? Use the attached file for testing. If I
specify \edition {5} I get »5 edition« using the setup
\setuppublications[alternative=num]. That's wrong, either 5th edition or
edition 5. When I use \setuppublications[alternative=ams] I get 5th ed. That's
correct. For this reason I cannot enter \edition {5th}. The correct input
should be independent from the style used.

5) How to specify online sources? BibTeX has no proper data type for this. But
BibLaTeX has the type »online« with the special field urldate (for the access
date). Maybe there's a corresponding functionality in ConTeXt.


Thanks in advance.

Regards
Marco
\startbuffer[mukk]
\startpublication
  [k=fundamentals,
   y=1981,
   t=book]
\title {Fundamentals of Database Systems}
\author {Ramez}[R.]{}{Elmasri}
\author {Shamkant B.}[S.\,B.]{}{Navathe}
\pubyear {2007}
\pubname {Addison Wesley}
\edition {5}
\city {Boston}
\stoppublication

\startpublication
  [k=garden,
   t=misc, % What to use here?
   u=http://wiki.contextgarden.net % What is this line for?
  ]
\title {\ConTeXt-Garden}
\biburl {http://wiki.contextgarden.net}
\stoppublication
\stopbuffer
\savebuffer[mukk][\jobname.bbl]

\setuppublications [alternative=ams]
% \setuppublications [alternative=num] % Look for edition

\starttext
As you can see in \cite[fundamentals] or in \cite[garden].

\placepublications
\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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] pdf file not found (final question)

2010-09-12 Thread Peter Münster
On Fri, Sep 10 2010, Peter Münster wrote:

 Can anybody reproduce the following problem (Taco can't ...):
 
 \startbuffer[pdf-pages]
   \starttext
 page 1 \page page 2
   \stoptext
 \stopbuffer
 \savebuffer[pdf-pages][pdf-pages.tex]
 \executesystemcommand{context pdf-pages; mkdir testdir;
   mv pdf-pages.pdf testdir/2*8.pdf}
 \starttext
 \setupexternalfigures[directory={./testdir}]
 \externalfigure[2*8][page=2]
 \stoptext
 
 - !LuaTeX error: PDF inclusion: required page 2 does not exist
 
 No problem with page=1.
 
 No problem with other name for pdf-file (for example pdftest.pdf
 instead of 2*8.pdf).
 
 No problem, if pdf-file is in current directory instead of testdir.

Hello,

After some further investigation, I've found that the reason for this problem
is a pdf file in my installation:
/opt/context/tex/texmf-local/tex/context/peter/samples/unten-21478.pdf

So please try o*w instead of 2*8, and you'll be able to reproduce the
problem!

But there is still a difference:
texmf-local:
  when using \externalfigure[2*8][page=1] on my installation, I get really
  the first page of 2*8.pdf and not the unten-21478.pdf.

texmf-context:
  when using \externalfigure[o*w][page=1] you'll get the cow.

So the question is:
- bug?
- or don't ever use * in a filename?

Cheers, Peter

-- 
Contact information: http://pmrb.free.fr/contact/


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


[NTG-context] pdf file not found

2010-09-10 Thread Peter Münster
Hello,

Can anybody reproduce the following problem (Taco can't ...):

\startbuffer[pdf-pages]
  \starttext
page 1 \page page 2
  \stoptext
\stopbuffer
\savebuffer[pdf-pages][pdf-pages.tex]
\executesystemcommand{context pdf-pages; mkdir testdir;
  mv pdf-pages.pdf testdir/2*8.pdf}
\starttext
\setupexternalfigures[directory={./testdir}]
\externalfigure[2*8][page=2]
\stoptext

- !LuaTeX error: PDF inclusion: required page 2 does not exist

No problem with page=1.

No problem with other name for pdf-file (for example pdftest.pdf
instead of 2*8.pdf).

No problem, if pdf-file is in current directory instead of testdir.

My system is latest minimals on linux-amd64.

Cheers, Peter

-- 
Contact information: http://pmrb.free.fr/contact/


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


  1   2   >