24

I'm converting a MS Word document into a LaTeX document. I have >100 references and would like to know the easiest way to convert all the inline citations from my MS Word document to my LaTeX document.

I've already generated by BibTeX library and can convert each citation individually by hand if necessary. Is there a way that I can convert all my MS Word inline citations to the \cite{author,date} LaTeX format so that when I copy and paste into LaTeX the citations are recognized automatically? Do you have any other suggestions?

6
  • 3
    Can you just use search and replace in your editor, i.e. [1] -> \cite{Einstein,1902}, or are the citations entered into Word in a way that makes this difficult? Jun 26, 2013 at 13:56
  • I think it could help to understand the problem if you paste an image of a page of the document. Apparently it is an issue of search/replace some simple regular expressions, isn't?
    – JLDiaz
    Jun 26, 2013 at 14:19
  • Welcome to TeX.SX! You can have a look on our starter guide to familiarize yourself further with our format. Jun 26, 2013 at 14:39
  • Ian, Your suggestion would still require I go and replace >100 things in my MS word document, I believe. This would be quite time consuming, but it may come to that. I'll look for a MS word inline citation format that uses {Author,date} and then replace all "{" with "\cite{". I might have to edit the citation style in Mendeley... I was just looking for a more elegant way of doing this. Thanks. Jun 26, 2013 at 14:41
  • 1
    How are the citations in the Word document? Are they fields or just plain text? I assume they are in various formats (in parentheses or not, lists or not.) Without a bit more detail on what they look like it's hard to tell what exactly you would need to do. But this is a job for search and replace plus some manual intervention I suspect. But you shouldn't need to do each on individually. You also need to make your BibTeX keys match the citations used.
    – Alan Munn
    Jun 26, 2013 at 14:56

5 Answers 5

7

This article by Karsten Jahn is probably the best and simplest solution I came across: https://www.k-jahn.de/2012/02/22/exporting-a-word-library-to-latexbibtex/ <- broken link

Took less than 5 minutes to convert the whole bibliography. It can be used with recent versions of MS Word. Only difference is that you should place the file in

C:\Users\[username]\AppData\Roaming\Microsoft\Bibliography\Style

And you have to insert this element on line 90, as Markus Hartmeier pointed out in the comments - otherwise it won't appear in the list:

<xsl:template match="b:StyleNameLocalized">
  <xsl:text>Bibtex Export</xsl:text> 
</xsl:template>
2
  • 1
    I tried it today for Office 16: The place of bibliography styles moved to %appdata%\Microsoft\Bibliography\Style and I had to adapt the xsl file: add the <xsl:when test="b:StyleNameLocalized"> group from any other style. Jul 14, 2016 at 19:01
  • Markus, could you please provide your modified style file here? I've just tried for about an hour to get the xsl file working with Office 365 but have failed. Thanks
    – Aralox
    Oct 11, 2016 at 1:43
5

You could have a look on the online service provided by Makino, Takaki
or, better, download the perl script from the same page.

It worked for me, sometimes using some sed editing as preprocessing.

Or, likely better, have a look to cb2BiB that seems to be much more powerful, but I discovered to late :(

5

I've just done this. There are two steps to take:

Convert your EndNote Library to BibTeX format, which can be done relatively easily in EndNote:

  1. Edit the BibTeX Export endnote style to change the output template. I'd rather use JabRef to make my citekeys to pick up the multiple AuthorYear exceptions, so you can delete the "Label" in "@article{|Label,|"
  2. Export the library by using File->Export to a .txt file with formatting provided by your custom BibTeX Export style.
  3. Change the extension to .bib and open in JabRef (I've had some encoding trouble by making a new library and trying to import). Change your citekey generation format to the default AuthorYear template if you've changed it.
  4. Generate citekeys using JabRef. Take note of the few citekeys that have an "a" appended to the end--these are the multiple AuthorYear exceptions that you might have to edit in text. If there aren't any, you're golden.

Now you just have to get all of the citations in your Word document to match:

  1. Edit the BibTeX Export endnote style to change the citation template to what you want in text (ie, \parencite{AuthorYear} for BibLaTeX or \cite{AuthorYear} for natbib and BibTeX). Change the Ambiguous Citations section to "Add a letter after the year"(2000a,2000b).
  2. Format bibliography in your Word document using your custom BibTeX export style. Make sure your AuthorYear exceptions are referencing the correct paper.

I reformatted a whole paper before I figured out that the default JabRef citekey generator was close enough to AuthorYear to make it work with an EndNote Style. Good luck!

0
4

I used a semi-automated approach. First, I had my referenced embedded in Word with Mendeley. You can sync your Mendeley library with Bibtex (Tools > Options > Bibtex). In my word document, I created a custom citation style which replaced each of the embedded citations with \cite{[Last name of first author][year]}. The default citation key in Mendeley is [Last name of first author][year], so Latex will recognize this as the proper citation. You will have to double check the citations if you have multiple papers from the same author in the same year, or if you have changed from the default citation key. In any case, this gets most of the work done for you.

So just use this style in Mendeley and copy-paste the text: http://csl.mendeley.com/styles/497312871/bibtex-2

3
  • Nice trick! Is your citation style available somewhere?
    – erwanp
    Jul 7, 2018 at 17:43
  • Please this link. I just edited the "BibTex generic citation style" in Mendeley csl.mendeley.com/styles/487896501/bibtex Jul 8, 2018 at 18:58
  • Is it just me, or does the bibliography that Mendel inserts into work miss the first author?
    – kmace
    Dec 30, 2020 at 2:53
1

I have created a python package for this: https://pypi.org/project/ref2tex/

it is open source, welcome to contibute https://github.com/sahraoui17/ref2tex

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .