Re: [NTG-context] Bibtex change short key
On Fri, Mar 26, 2010 at 4:10 PM, Hubertus wrote: > Dear Taco, >> Oh boy, I am sorry! My fault! The *correct* recipe is: run once, so the >> bbl exists, then delete the \setupbibtex line from your source, then >> edit the bbl, then recompile. > Thanks. This works now. I wrote a little python script now to save time and > thought maybe someone else might need it as well. It's better if it's in luatex . -- luigi ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Bibtex change short key
Dear Taco, > Oh boy, I am sorry! My fault! The *correct* recipe is: run once, so the > bbl exists, then delete the \setupbibtex line from your source, then > edit the bbl, then recompile. Thanks. This works now. I wrote a little python script now to save time and thought maybe someone else might need it as well. It works for me but it was just a quick shot. There was not much time to think about all possibilities, and may be the regular expressions need to be modified. I first need to get this thesis finished. So no guarantee. All the best Hubertus #!/usr/bin/python # -*- coding: utf-8 -*- import re import shutil fileName= 'filename.bbl'# Change here the filename fileNameOld = fileName + '-old' shutil.copyfile(fileName, fileNameOld) # Make a copy of the file f = open(fileNameOld) out = open(fileName, 'w') author = re.compile('a={+( [^}]* ) }', re.VERBOSE) # Find author author3 = re.compile('(\w{2,3})') # Get the first 3 letters year= re.compile('y=\d{2,} (\d{2,}\w?)', re.VERBOSE) # Get the year e.g. 09a shortRe = re.compile('(s=)(.*)\]') # Substitute the short key while True: tmp = [] # Array where from \startpulication[...] ... is saved line = f.readline() # Look for the start of a new publication if line.find('startpublication') >= 0: tmp.append(line) # Go the end of that publication \startpulication[...] while True: a = f.readline() tmp.append(a) if a.find(']') >= 0: break # Go through tmp to get the needed information short = '' for i in range(len(tmp)): a = tmp[i] if author.search(a): short = '' short = author3.findall(author.findall(a)[0])[0] if year.search(a): short += year.findall(a)[0] if shortRe.search(a): a = shortRe.sub(r'\1%s]', a) % short out.write(a) # If no entry in \startpulication[...] just write it again to the file else: out.write(line) # reached end of file if line == '': break f.close() out.close() ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Bibtex change short key
Hubertus wrote: Dear Taco, I use the excellent BibTex module with this setup: \setupbibtex[database=biblio,sort=author] \setuppublications[alternative=apa,refcommand=short,sorttype=bbl,criterium=cited] So if I have something like this @ARTICLE{Akimoto2005, author = {R. Akimoto and B. S. Li and K. Akita and T. Hasama}, ... } in my *.bib file, the \cite[Akimoto2005] results in [ALAH05]. Is there a way to get only the first author with three letters and the year ([Aki05]) in the citation? Patch the generated .bbl file by hand. after its initial creation, it will not be modified by context itself anymore. May be I should have tried it first, before editting about 200 entries as you suggested. As far as I can judge from the timestamp, at my system the bbl file is generatet every time I run texexec. Have I missed something? Oh boy, I am sorry! My fault! The *correct* recipe is: run once, so the bbl exists, then delete the \setupbibtex line from your source, then edit the bbl, then recompile. Feeling stupid, Taco ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Bibtex change short key
Dear Taco, > > I use the excellent BibTex module with this setup: > > \setupbibtex[database=biblio,sort=author] > > \setuppublications[alternative=apa,refcommand=short,sorttype=bbl,criterium=cited] > > So if I have something like this > > @ARTICLE{Akimoto2005, > > author = {R. Akimoto and B. S. Li and K. Akita and T. Hasama}, > > ... > > } > > in my *.bib file, the \cite[Akimoto2005] results in [ALAH05]. Is there a way > > to > > get only the first author with three letters and the year ([Aki05]) in the > > citation? > > Patch the generated .bbl file by hand. after its initial creation, it > will not be modified by context itself anymore. May be I should have tried it first, before editting about 200 entries as you suggested. As far as I can judge from the timestamp, at my system the bbl file is generatet every time I run texexec. Have I missed something? Thanks Hubertus ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Bibtex change short key
Hubertus wrote: Dear Mailinglist, I use the excellent BibTex module with this setup: \setupbibtex[database=biblio,sort=author] \setuppublications[alternative=apa,refcommand=short,sorttype=bbl,criterium=cited] So if I have something like this @ARTICLE{Akimoto2005, author = {R. Akimoto and B. S. Li and K. Akita and T. Hasama}, ... } in my *.bib file, the \cite[Akimoto2005] results in [ALAH05]. Is there a way to get only the first author with three letters and the year ([Aki05]) in the citation? Patch the generated .bbl file by hand. after its initial creation, it will not be modified by context itself anymore. Best wishes, Taco ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] Bibtex change short key
Dear Mailinglist, I use the excellent BibTex module with this setup: \setupbibtex[database=biblio,sort=author] \setuppublications[alternative=apa,refcommand=short,sorttype=bbl,criterium=cited] So if I have something like this @ARTICLE{Akimoto2005, author = {R. Akimoto and B. S. Li and K. Akita and T. Hasama}, ... } in my *.bib file, the \cite[Akimoto2005] results in [ALAH05]. Is there a way to get only the first author with three letters and the year ([Aki05]) in the citation? Help would be much appreciated. Thanks Hubertus ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___