ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <schuster.wolfgang@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: TEXpage filename
Date: Thu, 2 May 2013 08:44:12 +0200	[thread overview]
Message-ID: <9C89B551-F3D9-400A-8C73-2EE08FD3EE3A@gmail.com> (raw)
In-Reply-To: <32A90BEC-D99D-424B-9E1F-87887A13D31F@gmail.com>


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
___________________________________________________________________________________


  reply	other threads:[~2013-05-02  6:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-01 10:16 Alan BRASLAU
2013-05-01 14:16 ` Sietse Brouwer
2013-05-01 21:11   ` Alan BRASLAU
2013-05-01 21:02 ` Wolfgang Schuster
2013-05-02  6:44   ` Wolfgang Schuster [this message]
2013-05-04 11:50     ` Alan Bowen
2013-05-04 16:00       ` Wolfgang Schuster
2013-05-05 12:27         ` Alan Bowen
2013-05-05 12:39           ` Thomas A. Schmitz
2013-05-08 12:00             ` Alan Bowen

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=9C89B551-F3D9-400A-8C73-2EE08FD3EE3A@gmail.com \
    --to=schuster.wolfgang@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

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

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