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.wolfgang@gmail.com> wrote:

Am 01.05.2013 um 23:02 schrieb Wolfgang Schuster <schuster.wolfgang@gmail.com>:

>
> Am 01.05.2013 um 12:16 schrieb Alan BRASLAU <alan.braslau@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
___________________________________________________________________________________