Recent Changes - Search:

edit SideBar

FramemakerToLaTeX

We use Framemaker, a commercial tool from Adobe to edit the Ptolemy II Design Doc.

Conversion of Framemaker files to LaTeX

It seems that the most common Framemaker to LaTeX conversion tool is LaTeX to FrameMaker MML Translator at http://www.cs.stir.ac.uk/~kjt/software/framemaker/la_mml.html

I had the following problems with la_mml:

  • The files needed a little work to compile under a modern C compiler
  • The tool requires that your Frame files use a particular style. Error messages result if there are style elements in the mif file that are not present in the particular style. One possible solution would be to use la_temp style, import it into the style using dzbatcher, write out the MIF and then do substitution with a script.
  • I seem to remember that there was problems because in my version of Frame (6.0 from 2000), the MIF files had blocks of text in a different order than how the text appeared in the final document. This could be because Frame changed after the la_mml tool was created.

So, I started developing some scripts to convert Framemaker to XML to TeX.

Download

Limitations

  • You must have a working copy of Framemaker or else somehow have .xml versions of your Framemaker .fm files. Note that the .xml files are not MIF files. MIF files will not work because for me, the order of the text in the .mif file is different from the order in which the text appears in the printed version
  • These scripts worked for me for my particular files. You probably have different styles, so you will need to edit fmxml2tex and fmxml2bib
  • I found that sometimes the XML was somewhat illformed and that it was easier to fix the .xml files by hand before running fmxml2tex again. In particular, some of Framemaker .xml files had numbered list elements that started outside a numbered list.
  • The .xml file may contain multibyte character codes that play havoc with the scripts. I suspect that Framemaker is not properly encoding these charactor codes. The fmxml2tex script handles some of the translations, but you may need to add more. To do this, look at http://www.av8n.com/computer/utf/font-chart.html to find out which symbol corresponds with the multibyte character code. Then, look for the corresponding LaTeX code in http://www.artofproblemsolving.com/LaTeX/AoPS_L_GuideSym.php
  • I converted my Framemaker files to XML under Windows and then did the rest of the conversion under Mac OS X.
  • Your mileage may vary. Void where prohibited. Closed course, professional driver.

Usage

Since I have many files, I created separate directories for each file type. Since my Framemaker files are in ptIIdoc/doc/design/src, I did

cd ptII/doc/design/src
mkdir xml img tex

dzbatcher

I used dzbatcher to automatically generate .xml files from my .fm files. Download dzbatcher and install it. Under Windows, I installed it in C:/Program Files/dzbatcher.

Convert Framemaker .fm files to .xml

I created ptIIdoc/doc/design/src/fm2xml, which is based on an example in the dzbatcher docs:

#!/bin/sh
# $Id: fm2xml,v 1.1 2008/11/17 03:32:34 cxh Exp $
# Scripts to convert framemaker .fm to xml files
# Uses dzbatcher from http://www.datazone.com/english/overview/download.html
# Based on example from dzbatcher docs.

# Location of the file
dzbatcher=c:/Program\ Files/dzbatcher/bin/dzbatcher.exe

dzbscript=fm2xmlscript.$$
for i in $*
do
        xml="`basename $i .fm`.xml"
        echo "
        Open $i
        SaveAs -x $i $xml
        Close $i
"
>> $dzbscript
done

"$dzbatcher" -v $dzbscript

rm -f $dzbscript

So, given a file introduction.fm, run

cd ~/src/ptIIdoc/doc/design/src/xml
./fm2xml ../introduction.fm

This will create introduction.xml and any images will be created as introduction-NN.gif files. I moved my gif files into a separate directory called img/gif:

mkdir ../img/gif
mv *.gif ../img/gif

Conversion from gif to pdf

LaTeX has a hard time with gif files, so we convert to pdf.

The Imagemagick convert binary converts from .gif to .pdf. The script below, called convertall, converts all .gif files in the command line to .pdf files

#!/bin/sh
for file in $@
do
        pdf="`basename $file .gif`.pdf"
        convert $file $pdf
done

However, these conversions are not of print quality, so you will probably need to regenerate these files. It would be nice if dzbatcher would export the individual images has .pdf files, but I'm not sure how to do that.

In our example, run

cd ~/src/ptIIdoc/doc/design/src/img/gif
./convertall introduction-*.gif
mkdir ../pdf
mv *.gif ../pdf

Conversion from xml to tex

The script fmxml2tex will convert Framemaker .xml to LaTeX

cd ~/src/ptII/doc/design/src/tex
../fmxml2tex ../xml/*.xml

Half-hearted attempt at conversion of bibliographic entries

The script fmxml2bib will convert a Framemaker bibliography to a .bib file

cd ~/src/ptII/doc/design/src/tex
../fmxml2bib ../xml/references.tex > references.bib

This will create references.bib, which is a start on a BibTeX file.

Edit - History - Print - Recent Changes - Search
Page last modified on November 16, 2008, at 08:27 PM