🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text
Article #2819

Re: Bibliographic callouts in FrameMaker

#2819
From: Mark Lawrence
Date: Mon, 13 May 1991 18:28
258 lines
9766 bytes
In article <724@rufus.UUCP> ebm@ibm.com writes:
>Can anyone suggest a way to do bibliographic callouts (and the associated
>bibliography) in FrameMaker?  Perhaps someone's written a postprocessing
>tool that picks through the FrameMaker file looking for particular tags...
>kind of 'bib' like?

# From: jipping@cs.hope.edu (Mike Jipping)
# Subject: SUMMARY: Frame and Bibliographies
# Organization: Hope College Dept of CS
# Date: Tue, 5 Mar 91 12:47:13 GMT
# 
# Some time ago, I posted an item asking about how Frame worked with
# bibliographic databases.  I posted my own thoughts in the form of a Perl
# script that tried to make BibTeX work with Frame.
# 
# I got several replies, and several "post a summary please" responses.
# 
# The summary is easy:  This integration apparently has not been done and
# most of the respondents voiced feelings from apathy to aggravation to
# anger about it.  For one person, this was the reason he DID NOT choose
# Frame as his document preparation tool.  This response from John
# McInerney pretty much sums it up:
# 
# > I think the lack of a bibliographic database in Frame is a big hole and makes
# > it almost unusable in an academic environment.  I'm trying to do my
# > dissertation in Frame and references are a real bear right now.
# 
# One person -- Tim Shimmeall -- suggested that one use a Frame document as
# a bibliographic database.  He suggests:
# 
# > There's a much simpler solution.  Any frame document can act as a
# > bibliographic database for any other frame document, since
# > crossreferences to other documents are possible. This doesn't give you
# > "refer" level functionality ... but it will give you "bibtex" level 
# > functionality ...
# 
# Now, I have my doubts about the generality or flexibility of this scheme
# as a bibliographic tool -- what about searching or sorting for example --
# but I think it's a real interesting idea.
# 
# So that's it!  My Perl script seems to be working for me, so I'm going to
# pursue this in the absence of any better solution.  By the way, I use a
# system called "Bibcard" to enter/search/manipulate the BibTeX databases.
# It's an X-windows/OpenWindows tools that works quite well.


#!/usr/contrib/bin/perl -- # -*-Perl-*-
#
#  bibfilter, version 1.0.
#
#  A Perl script that takes a Frame MIF file, generates a list of references
#  that are cited in the MIF file, and substitutes the citations in the 
#  text with citations from the reference list.  
#
#  This is based in BibTeX.  Original citations in the MIF file take the
#  form "\cite{citation}", where "citation" is the citation key from the 
#  BibTeX database.
#
#  Invocation:  bibfilter <options> miffilename
#    miffilename MUST end in ".mif"
#    <options> are:  -d <bibliography data bases> -- specifies what data 
#                            to use (default: "misc")
#                    -p <pathname> -- specifies where the BibTeX data bases
#                            can be found.  This is normally set through the
#                            "TEXBIB" environment variable (default: whatever
#                            "TEXBIB" is set to).
#                    -s <bibstyle> -- this determine the style of reference 
#                            and the substituted citations (default: alpha).
#  Examples:
#    bibfilter paper.mif  
#       --> this takes the defaults, and generates the file "paper.ref" with 
#           the references list.
#    bibfilter -d parallel,metrics,X paper.mif 
#       --> This uses the list "parallel,metrics,X" as the list of databases 
#           that BibTeX should use.  Again, "paper.ref" is generated.
#    bibfilter -d parallel,X -s acm -p /home/zephyr/jipping paper.mif
#       --> This specifies "parallel,X" as the databases to use, specifies
#           that the "acm" style be used to generate references, and that
#           the databases are in "/home/zephyr/jipping".
#
#  This is a first approximation. No warranty of any kind is given.  Send
#  bugs and corrections to "jipping@cs.hope.edu" and I'll get to them
#  sometime :-)
#  
#  Mike Jipping, Hope College
#    18 February 1991,  first writing

#----------------------------------------------------------------------
# "To_Aux" is step 1 -- read the "mif" file and generate an "aux" file.
# The "aux" file is a fake, and contains only BibTeX information.

sub to_aux {
    $miffile = join(".", @_, "mif");
    open(mif, "<$miffile") || die "can't open $miffile: $!";
    $auxfile = join(".", @_, "aux");
    open(aux, ">$auxfile") || die "can't open $auxfile: $!";

    printf(aux "\\bibstyle{%s}\n", $bibstyle);
    printf(aux "\\bibdata{%s}\n",  $bibdata);
    while (<mif>) {
	chop;
	while (/\\cite{(\S+)}/) {
	    printf(aux "\\citation{%s}\n", $1);
	    s/\\cite{(\S+)}//;
	}
    }
    close(mif);
    close(aux);
}

#----------------------------------------------------------------------
# "To_Bbl" goes from the "aux" file to the "bbl" file by invoking BibTeX.

sub to_bbl {
    system "bibtex @_";
}

#----------------------------------------------------------------------
# "To_Refs" generates the ".ref" file from the "bbl" file.

sub to_refs {
    $bblfile = join(".", @_, "bbl");
    open(bbl, "<$bblfile") || die "can't open $bblfile: $!";
    $reffile = join(".", @_, "ref");
    open(ref, ">$reffile") || die "can't open $reffile: $!";

    while (<bbl>) {
	s/\\begin{thebibliography}.*$//;
	s/\\end{thebibliography}.*$//;
	s/\\bibitem//;
	s/\{//;
	s/\}//;
	s/\\newblock //;
	print ref $_;
    }
    close(bbl);
    close(ref);
 }

#----------------------------------------------------------------------
# "Sub_Cites" substitutes citations from the "mif" file with actual 
# citations from the reference list.

sub sub_cites {
    $bblfile = join(".", @_, "bbl");
    open(bbl, "<$bblfile") || die "can't open $bblfile: $!";

    while (<bbl>) {
	if (/\\bibitem(\S+){(\S+)}/) {
	    $cites{$2} = $1;
	}
    }

    $miffile = join(".", @_, "mif");
    $oldmiffile = join($miffile, "", "123");
    rename($miffile, $oldmiffile);
    open(oldmif, "<$oldmiffile") || die "can't open $oldmiffile: $!";
    open(mif, ">$miffile") || die "can't open $miffile: $!";

    while (<oldmif>) {
	while (/\\cite{(\S+)}/) {
	    s/\\cite{\S+}/$cites{$1}/;
	}
	print mif $_;
    }

    close(oldmif);
    unlink(oldmif);
    close(mif);
}

#------------------------------------------------------------------
#  "Main" Section
#
#  First, set up the parameters. 

do 'getopt.pl' || die "can't get getopt.pl";

$bibstyle = "alpha";
$bibdata = "hci";
$bibpath = $ENV{"TEXBIB"};

&Getopt('sdp');
if ($opt_s) {$bibstyle = $opt_s;}
if ($opt_d) {$bibdata = $opt_d;}
if ($opt_p) {$ENV{"TEXBIB"} = $opt_p;}
$bibfile = shift;

$bibstub = substr($bibfile, 0, rindex($bibfile,"."));

# Now, generate all the files.

do to_aux($bibstub);
do to_bbl($bibstub);
do to_refs($bibstub);
do sub_cites($bibstub);

# Delete the intermediate files and go home.

unlink join(".", $bibstub, "aux");
unlink join(".", $bibstub, "bbl");
unlink join(".", $bibstub, "blg");

exit(0);

# From: Tommy Persson <tpe@IDA.LiU.SE>
# Date: Tue, 9 Apr 91 18:05:38 +0200
# Subject: Bibframe
# Reply-To: tpe@IDA.LiU.SE
# 
# If would be glad if the people trying to use my Bibframe system
# (available at smaug.cs.hope.edu (35.197.146.1) under
# /pub/bibframe.tar.Zsend) send me their email adress.  Then I can post
# all the latest bugfixes to you (there are two now).  If you are going
# to use the sunview version you are probably going to note some bugs.
# 
# Note that the version available at smaug is version 0.2 and it contains
# mapalike.  This was not in the version I mailed earlier to some persons.
# 
# Tommy Persson
# Linkoping University
# Department of Computer and Information Science
# Sweden
# tpe@ida.liu.se



# From: jipping@cs.hope.edu (Mike Jipping)
# Subject: Re: Bibframe
# Reply-To: jipping@cs.hope.edu
# Organization: Hope College Dept. of Computer Science
# References:  <1991Apr10.172040.20804@cs.hope.edu>
# Date: Thu, 11 Apr 91 18:40:07 GMT
# 
# > I would be glad if the people trying to use my Bibframe system
# > (available at smaug.cs.hope.edu (35.197.146.1) under
# > /pub/bibframe.tar.Z) send me their email adress.  Then I can post
# > all the latest bugfixes to you (there are two now).  If you are going
# > to use the sunview version you are probably going to note some bugs.
# > 
# > Note that the version available at smaug is version 0.2 and it contains
# > mapalike.  This was not in the version I mailed earlier to some persons.
# 
# The version on smaug has now been updated to include all the recent
# bugfixes (at least all the ones Tommy has sent me ;-).  So I believe it
# is the "current" release.
# 
# The two bug fixes were (1) a fix to the SunView macro definition for
# creating a citation key, and (2) a fix to a shellscript in "without
# Emacs" version that did not work if there was no Body paragraph in the
# document.  
# 
# Again, send bugfixes to the author, Tommy Persson, at tpe@ida.liu.se --
# NOT ME!
# 
-- 
mark@drd.com
mark@jnoc.go.jp  $B!J%^!<%/!&%i%l%s%9!K(B  Nihil novum sub solem
Technical Details
Message-ID: <1991May13.182802.1235@drd.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!samsung!raybed2!rayssd!jarsun1!drd!mark
References: <724@rufus.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!samsung!raybed2!rayssd!jarsun1!drd!mark
From: mark@drd.com (Mark Lawrence)
Newsgroups: comp.text
Subject: Re: Bibliographic callouts in FrameMaker
Message-ID: <1991May13.182802.1235@drd.com>
Date: 13 May 91 18:28:02 GMT
References: <724@rufus.UUCP>
Reply-To: mark@drd.com
Distribution: na
Organization: DRD Corporation
Lines: 258