[OS X TeX] A Textures Query (yet, again)

Donal Day dbd at virginia.edu
Fri Sep 16 18:22:54 CEST 2005

Ross Moore wrote:

> Hello Jack,
> On 16/09/2005, at 3:15 AM, Jack Kuipers wrote:
>>> I have a large TEXTURES file which when typeset produces all
>>> 400+ pages including 100++  figures which comprise my Quaternion  Book.
>>> All of these output pdf.pages were furnished to and used by  
>>> Princeton University Press
>>> as camera-ready for the publication of the book (5 years ago).  
>>> These original Textures (LaTeX)
>>> files were produced on my Macintosh Computers: OS 7x (or earlier),  
>>> 8x, to 9.2.2. And all the figures
>>> are, of course, embedded within the Textures software either as  
>>> pict or eps or somesuch.
>>> HOWEVER, I am now committed to using MacOSX (currently Panther)  and 
>>> TeXShop 1.5.3e --- and
>>> have become rather nimble in doing all the NEW stuff with figures,  
>>> pictures, tables, etal.  Moreover,
>>> I'm even now lusting to upgrade to Tiger. BUT.....
>>> THEM UNDER TeXShop 1.5.3e or later?
> I went through this exercise recently for a book, authored by a  
> colleague,
> that needed revision after 7 years (or so).
>>> HOW, first of all,  to get all of the figures back out of TEXTURES  
>>> ----
>>> and then to get them all properly converted (say, using  
>>> GraphicConverter batch) is the primary issue;
>>>  I can do ONE figure (at a time) --- but 100++ figures??? I might  
>>> not survive it.
>>> ANY suggestions would be so very much welcomed. Thank you in  
>>> advance, and
> Firstly, you need all of the figures in separate .eps or .pdf files.
> Others have commented on how to achieve this, depending on how the
> graphics were originally stored for use with Textures.
> Secondly, what I always advocate is to have a separate macro-name for
> each image. This macro-name should be chosen to indicate the contents
> of the image, as it relates to the material of the book.
> The macro is used in the body of the book manuscript, and expands to
> a command to place the image.
> For example, in my case I had macros such as:
>   \def\DiophantusScan{\leavevmode
>     \hbox{\scaledEPSF 20.41pc by 32.79pc (Bachet.ps scaled 1200)}}
>   \def\AnnalsPageC{\leavevmode
>     \hbox{\scaledEPSF 33.21pc by 52.28pc (Deformation.ps scaled 707)}}
>   \def\Muse{\leavevmode\noindent
>     \hbox{\scaledEPSF 15.73pc by 27.44pc (Muse.ps scaled 1400)}}
>   \def\Lycee{\leavevmode\noindent
>     \hbox{\scaledEPSF 16.06pc by 21.83pc (Lycee.ps scaled 1400)}}
> Now to update to TeXShop, *all* that was needed was to redefine the
>  \scaledEPSF  macro used here.
> Here's the revised coding that I devised for this:
> \graphicspath{{FermatImages/}}
> \def\pssuffix{ps}%
> \def\epssuffix{eps}%
> \makeatletter
> \def\scaledEPSF #1 by #2 (#3.#4 scaled #5){\bgroup
> \dimen0=#5pt \divide\dimen0 by 1000\relax
> \edef\thescale{\expandafter\removePT@\the\dimen0}%
> \def\thesuffix{#4}%
> \ifx\thesuffix\pssuffix
>    \def\thename{#3}%
> \else
>   \ifx\thesuffix\epssuffix
>     \def\thename{#3}%
>    \else
>     \def\thename{#3-#4}%
> \fi\fi
> % \typeout{ *** processing image: \thename *** }%
> \edef\next{\egroup
>    \noexpand\includegraphics[scale=\thescale]%
> %   \noexpand\includegraphics[width=#1,height=#2,scale=\thescale]%
>    {\thename}}\next
> }
> \makeatother
> This does a little bit of parsing on the filename, before constructing
> an  \includegraphics  command that will work when processing either with
>  pdfTeX  or  with  TeX+Ghostscript  mode.
> Only the  scale-factor  is actually needed, since the supplied width
> and height were needed just with Textures' own picture-handling methods.
> With all of these picture-inclusion macros collected into a single  
> \input
> file, it was quite short work to get everything working properly in  
> TeXShop.
> Of course it wasn't quite as smooth sailing as I've indicated.
> Some images needed to be renamed, and there were a few other edits  
> required.
> But overall these "special cases" were small in number, and easily  
> identified.
> There was no need to go searching through \include'd files to find where
> changes may be needed.
> Your situation may not be quite so easy to handle as mine ---  
> fortunately
> I had anticipated such a possible need years back, with the 1st edition
> of the book, so had chosen to use the individual macro-names for each  
> image.
> Even with 100+ images, the time spent collecting together the image  
> inclusion
> commands into a single file, and assigning unique macro names, should be
> worthwhile --- especially if you anticipate further editions in years  
> to come.
> After having done this, you will be able to see what kind of things  
> need to
> be changed, to alter the low-level image-inclusion macros. It may be  
> that
> several macros need altered expansions, not just one (as in my case).
> Hope this helps,
>     Ross Moore

I have not followed this thread closely but I have used the following 
awk script (written by a former postdoc) to successfully strip 
postscript figures from postscript files. It occasionally balks and 
suffers from giving the figures the file name (including directory tree) 
of the embedded figure as included.

Nonetheless, it should prove useful.

Invoke at the command line via  (I store it as ~/bin/extract_figures) 
"~/bin/extract_figures filename" where "filename" is the name of the 
file that has all the figures you want to extract. I always create a new 
folder for the originial file and all the separate files that are extracted.

Just paste the lines below into a file using your favorite editor, make 
executable (chmod + x ) and off you go.

Donal Day

+++++++++++++++++++ cut and paste the lines below+++++++++++++++++

#!/sw/bin/awk -f

/^%%BeginDocument/ {
  if(current_file!="") {
    print "";
    print "Warning - possibly a plot within a plot";
  printf"Extracting %-50s",current_file;

/^%%EndDocument/ {
  if(current_size<=1024) printf" Size=  %4dchar\n",current_size;
  if(current_size>1024 && current_size<1048576)
    printf" Size= %5.1fK\n",current_size/1024;
    printf" Size=%6.1fM\n",current_size/1048576;

current_file!="" {
  print $0 > current_file;

------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
          & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/

More information about the macostex-archives mailing list