Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems reading bibtex file with special characters and math in authors/titles #78

Open
ekstroem opened this issue Oct 15, 2020 · 0 comments

Comments

@ekstroem
Copy link

I'm trying to read in and format a BibTex file that contains a bunch of references. However, some of the entries are not parsed correctly when they are read in. I've browsed the repository, and it might be the same problem as #66 which in turn seems to point back to the bibtex package. So ... maybe it isn't a problem with RefManageR per se but I stumbled upon it using this package.

In my .bib file I have this entry

@ARTICLE{lind:etal:2009,
  author = {Casper Lindegaard and Dorte V{\aa}beng{\aa}rd and Mogens Christophersen and Claus Thorn Ekstr{\o}m and Julie Fjeldborg},
  year = 2009,
  title = {Evaluation of pain and inflammation associated with hot iron branding and microchip transponder injection in horses},
  journal = {American Journal of Veterinary Research},
  pages = {840--847}
}

RefManageR::ReadBib() reads in the file without any complaints, but if I print the entry then I see that some the LaTeX input has been messed up. In particular, the {\o} has been correctly parsed but the {\{aa} has not. Now, BibTeX can be a little ... rigid ... in its input, but using, say, V\aa bengaard doesn't help with anything.

> bib[62]
Lindegaard, Casper, Dorte V\aabeng\aard, Mogens Christophersen, Claus Thorn Ekstrøm, and Julie Fjeldborg (2009). “Evaluation of pain and
inflammation associated with hot iron branding and microchip transponder injection in horses”. In: _American Journal of Veterinary Research_, pp.
840-847.
Warning messages:
1: lind:etal:2009: unknown macro '\aabeng' 
2: lind:etal:2009: unknown macro '\aard' 

If I look at the stuff in the R object then I can see why the LaTeX commands might be messed up

> bib[62]$author
[1] "Casper Lindegaard"     "Dorte V\\aabeng\\aard" "Mogens Christophersen" "Claus Thorn Ekstrøm"   "Julie Fjeldborg"

Now for this entry

@ARTICLE{niel:hans:echw:etal:2003,
  author = {Eva-Maria D. Nielsen and Lars Hansen and S{\o}ren Echwald and
            Thomas Drivsholm and Knut Borch-Johnsen and
            Claus Thorn Ekstr{\o}m and  Torben Hansen and O. Pedersen},
  year = 2003,
  title = {Evidence for an association between the {Leu$^{162}$Val} polymorphism of the {PPAR$\alpha$} gene and decreasing fasting serum triglyceride levels in glucose subjects},
  journal = {Pharmacogenetics},
  volume = 13,
  pages = {417--423}
}

then I get

> bib[66]
Nielsen, Eva-Maria D, Lars Hansen, Søren Echwald, Thomas Drivsholm, Knut Borch-Johnsen, Claus Thorn Ekstrøm, Torben Hansen, and O. Pedersen (2003).
“Evidence for an association between the Leu $^162$Val polymorphism of the PPAR $\alpha$ gene and decreasing fasting serum triglyceride levels in
glucose subjects”. In: _Pharmacogenetics_ 13, pp. 417-423.
Warning message:
niel:hans:echw:etal:2003: unknown macro '\alpha' 

I think (?) that this might be a different error caused by a mess-up between latex backslashes and R string backslashes but I'm not sure. In any case the title seems to be read correctly

> bib[66]$title
[1] "Evidence for an association between the {Leu $^{162}$Val} \n           polymorphism of the {PPAR $\\alpha$} gene and decreasing fasting \n           serum triglyceride levels in glucose subjects"

Is there something that I can do to easily circumvent these issues? Besides digging deep into the source code?

Thank you for a nice package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant