Automatically replace Philippe by {\relax Ph}ilippe

In styles which abbreviate the first name, it may be appropriate to use Ph instead of P as the initial for Philippe. In bibtex, this can be achieved by writing {\relax Ph}ilippe instead of Philippe and so < pre >{\relax Ph}< pre >ilippe (without the spaces in the tags) in the Zotero field works fine.

It would be nice if this could be done automatically and I guess the postscript functionality of BBT (see https://retorque.re/zotero-better-bibtex/exporting/scripting/ ) may allow for such automation. I tried

if (Translator.BetterBibTeX) {
for (const creator of zotero.creators) {
creator.firstName = creator.firstName
.replace(/Philippe/g, '< pre >\relax Ph</ pre >ilppe')
}
tex.addCreators();
}
However, that does not work. I guess, I misunderstand how to deal with creators (or with Javascript …). Can anyone give me any pointers how to write such a script? Thanks!
Sign In or Register to comment.