From tomnor at gmx.de Fri Feb 25 13:00:23 2011 From: tomnor at gmx.de (tomnor at gmx.de) Date: Fri, 25 Feb 2011 19:00:23 +0100 Subject: [Alexandria-list] Export to bibtex Message-ID: <20110225180023.239080@gmx.net> Hi, exporting books in bibtex-format creates a unique label for each book to use as a referrer in Latex. The label is created based on authors forename - a little bit inconvenient to remember. Example: @BOOK{Thomas1, author = "Thomas Pfeiffer and Andreas Wenk", title = "PostgreSQL 8.4", publisher = "Galileo Press GmbH", year = 2009 } In my Latex-Code I have now to use {Thomas1} in my \cite-commands. I didn't find any possibility to change this behavior to create the label based on at least one of the authors lastnames. Does anyone have an idea to solve this item? Thanks in advance Tom -- GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit gratis Handy-Flat! http://portal.gmx.net/de/go/dsl From cathal.alexandria at gnostai.org Fri Feb 25 16:26:06 2011 From: cathal.alexandria at gnostai.org (Cathal Mc Ginley) Date: Fri, 25 Feb 2011 21:26:06 +0000 Subject: [Alexandria-list] Export to bibtex In-Reply-To: <20110225180023.239080@gmx.net> References: <20110225180023.239080@gmx.net> Message-ID: <20110225212606.53930d32@jadzia> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Unfortunately, Alexandria doesn't keep a specific record of "author surnames" for books, and trying to determine automatically which part of a name is the surname would end up with frustrating errors and inaccuracies. (See the last question & answer here - http://alexandria.rubyforge.org/svn/trunk/alexandria/doc/FAQ - - for why Alexandria doesn't attempt this.) A fairly simple way around this would be for me to write a simple program (supplementary to Alexandria) which just keeps a link to your Alexandria books alongside custom citation names. I've attached a sketch of what the program could look like. You would run it just for exporting to BibTeX. I've been looking for a small task to start on for getting back into working on Alexandria, so I'll go ahead and try to write this tool over the next few days. Hopefully it will be useful for you. - Cathal. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: GnuPT 2.6.2.1 by EQUIPMENTE.DE iEYEARECAAYFAk1oHm4ACgkQfMAUnRdb+8ocKwCgmvxmG3bxO4POYUCSUJeGUDyC tDkAn02sf5kj0Vi3dV+ZrwurTw6DJnOc =1/la -----END PGP SIGNATURE----- -------------- next part -------------- A non-text attachment was scrubbed... Name: BibTex_Export_sketch.png Type: image/png Size: 33123 bytes Desc: not available URL: From tomnor at gmx.de Sun Feb 27 13:48:51 2011 From: tomnor at gmx.de (tomnor at gmx.de) Date: Sun, 27 Feb 2011 19:48:51 +0100 Subject: [Alexandria-list] Export to bibtex In-Reply-To: <20110225212606.53930d32@jadzia> References: <20110225180023.239080@gmx.net> <20110225212606.53930d32@jadzia> Message-ID: <20110227184851.124360@gmx.net> Hi Cathal, thanks for your reply. I'm not sure that your suggestion would be a solution for me: I have a lot of books in my database and a manual relabeling would not be worth the outcome. Could you give me a hint, in which rb-file I will find the algorithm defining the label? I would try to change this to not to use the first part of a name as label but the last part. In my case this would lead to many labels with a better name than now. Not a 100%-solution, but a better one. Best regards Tom -- GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit gratis Handy-Flat! http://portal.gmx.net/de/go/dsl From cathal.alexandria at gnostai.org Sun Feb 27 18:16:26 2011 From: cathal.alexandria at gnostai.org (Cathal Mc Ginley) Date: Sun, 27 Feb 2011 23:16:26 +0000 Subject: [Alexandria-list] Export to bibtex In-Reply-To: <20110227184851.124360@gmx.net> References: <20110225180023.239080@gmx.net> <20110225212606.53930d32@jadzia> <20110227184851.124360@gmx.net> Message-ID: <20110227231626.636b506b@jadzia> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Sun, 27 Feb 2011 19:48:51 +0100 tomnor at gmx.de wrote: > Hi Cathal, > thanks for your reply. I'm not sure that your suggestion would be a > solution for me: I have a lot of books in my database and a manual > relabeling would not be worth the outcome. Oh well. I've started so I'll finish. It'll be useful practice for Palatina anyway. (Also, with heuristic citation-name guessing code, it might still be quick and useful for others.) > Could you give me a hint, in which rb-file I will find the algorithm > defining the label? /usr/lib/ruby/1.8/alexandria/export_library.rb > I would try to change this to not to use the first part of a name as > label but the last part. Look in the method to_bibtex, around line 490. Change: k = (book.authors[0] or "Anonymous").split[0] to: k = (book.authors[0] or "Anonymous").split.last (I've tested this and it seems to work as you describe.) Cheers, - Cathal. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: GnuPT 2.6.2.1 by EQUIPMENTE.DE iEYEARECAAYFAk1q20oACgkQfMAUnRdb+8onagCggLvslmjpnEOXgy/Q1F5zByfk 8S4An3Cbfh+g/kwwweSaAiOY7OHYBZA3 =wyTH -----END PGP SIGNATURE-----