Angus Leeming wrote: > > How do I best deal with BibTeX entries such as > Stamenovi\'{c} > or > L\"{o}hner > > so that I can have pretty names in the citation dialog? \'c and \"o are also possible. > So, my question becomes: > Is this the best way to do this and, if so, what goes in someFunc()? i tried it with a translate vector: ( \'{c} , ç , \"{o} , ö , ... ) the i-th character is the original one and the i+1 the translated. i is 0,1,2,3... attached is a small sample for java, because i have no idea of c++ ... java bibtex "Vo\{ss} und S\\\"ohne" gives the output Vo\{ss} und S\"ohne is converted to Voß und Söhne Herbert -- http://www.educat.hu-berlin.de/~voss/lyx/
public class bibtex { String[] charTranslate = { "\"a","ä", // orig chars without backslash "\"A","Ä", "\"o","ö", "\"{o}","ö", "\"O","Ö", // i is orig and i+1 is translate "\"{O}","Ö", "\"u","ü", "\"U","ü", "ss","ß", "{ss}","ß", }; char Slash = '\\'; public bibtex (String name) { System.out.println( name+" is converted to "+translate(name)); } public String translate (String name) { int l=0, index; int i = name.indexOf(Slash); // first slash if (i<0) return name; // no special characters String name2 = name.substring(0,i); // all until slash name = name.substring(i); // the rest do { index=0; while ((name.indexOf(charTranslate[index])!=1) && (index < charTranslate.length-2)) index+=2; if (index < charTranslate.length-1) { // chars found??? l = charTranslate[index].length(); // length of special chars name2 = name2+charTranslate[++index]; // the translated chars name = name.substring(l+1); // delete special characters } else { // no translate mode name2 = name2+"\\"; // add backslash while unknown chars name = name.substring(1); // delete backslash } i = name.indexOf(Slash); // next backslash? if (i>0) { name2 = name2+name.substring(0,i); name = name.substring(i); // delete first characters } else return name2+name; } while (true); } public static void main (String [] args) { bibtex dummy = new bibtex(args[0]); } }