[OS X TeX] converting crossref

Adam R. Maxwell amaxwell at mac.com
Mon Jul 23 22:23:00 EDT 2007


On Jul 23, 2007, at 11:07, Charilaos Skiadas wrote:

> On Jul 22, 2007, at 11:30 AM, Adam R. Maxwell wrote:
>
>>
>> On Jul 22, 2007, at 08:05, Charilaos Skiadas wrote:
>>
>>> On Jul 22, 2007, at 7:50 AM, Alex Hamann wrote:
>>>
>>>> Hi,
>>>>
>>>> I have a number of incollection entries in my bibliography which  
>>>> have been created with crossrefs.
>>>> Now I ran into the problem that jurabib.bst offers a certain  
>>>> formating options for incollection items which apparently do not  
>>>> work if there is a crossref (I am referring to the edby option).  
>>>> Is there an easy way to convert all the incollections with  
>>>> crossrefs to incollections without crossrefs? Just deleting the  
>>>> crossref field for all of them will not do it since that will  
>>>> cause the loss of the information from the parent item.
>>>>
>>>
>>> This sounds like something that a search and replace with regular  
>>> expressions should be able to do easily, but since I don't know  
>>> how the entries before and after the conversion should look like I  
>>> can't really offer more precise suggestions. Could you post some  
>>> "before" and "after" examples?
>>
>> You'd need to do it with AppleScript, since the child item only has  
>> a pointer (crossref) to its parent for certain fields.  So you can  
>> have
>>
>
> Ah, you are thinking of doing this from within BibDesk I guess.

Yes, since the OP cross-posted to bibdesk-users...

> That would certainly require AppleScript, and I personally can't  
> stand AppleScript.

I don't like AppleScript either, but I don't like interpreted  
languages in general :).  Have you tried appscript, which should give  
you a python/ruby bridge to AppleScriptable applications?

> But I was thinking more of a Ruby script that would read the bibtex  
> file, process it accordingly and rewrite it. It would need to be  
> smart enough to understand the various fields etc, not an easy task  
> at all, but possible (and with a bibtex file that has been saved  
> through bibdesk and follows the format that bibdesk imposes on  
> files, perhaps a bit simpler.
>
> Though the applescript way is easier for someone with some  
> applescript skills.

I'd argue that using AppleScript to drive BibDesk is the most reliable  
way to do this, since it's already parsed the fields for you, and you  
can use introspection to see if the value of a field is inherited.   
I'm biased, of course, but that seems easier than developing and  
testing code to parse BibTeX and do multiple find-replace operations.   
YMMV.

As a note to scripters, you can dumpster-dive some pretty useful code  
fragments from http://bibdesk.sourceforge.net/wiki/index.php/BibDesk_Applescripts 
  and the sample script included with BibDesk.

-- 
Adam

------------------------- Helpful Info -------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
List Reminders & Etiquette: http://www.esm.psu.edu/mac-tex/list/





More information about the MacOSX-TeX mailing list