wdbibtex.WdBibTeX#
- class wdbibtex.WdBibTeX(file, copy_suffix='_bib', workdir='.tmp')[source]#
BibTeX toolkit for MS Word.
WdBibTeX is a MS Word wrapper for BibTeX citation conversion. WdBibTeX extracts LaTeX and BibTeX commands from a Word file, and copies them to dummy .tex file in working directory. By building LaTeX project with old-style LaTeX+BibTeX process, WdBibTeX obtain BibTeX-processed bibliography texts and citation numbers. Finally, WdBibTeX replaces original LaTeX and BibTeX commands in Word file with BibTeX-processed bibliography textx and citation numbers.
- Parameters:
- filestr or path object
Target word file with .docx extension.
- copy_suffixstr, default ‘_bib’
Appended text to a copied word file. WdBibTeX operates the copied file for safety.
- workdirstr or path object, default ‘.tmp’
Working directory of latex process. The working directory will be removed by WdBibTeX.clear().
Examples
>>> from wdbibtex import WdBibTeX >>> wd = WdBibTeX('sample.docx') >>> wd.build() >>> wd.close()
Attributes
[Read only] Returns original word file.
[Read only] Returns operating word file.
[Read only] Returns LaTeX working directory.
Methods
build
([bib, bst])Build word file with latex citations.
clear
()Clear auxiliary files on working directory.
close
([clear])Close word file and word application.
Export current docx file to pdf.
find_all
(key)Find all keys from word file.
open
()Open copied word document.
Read preamble contents if exists.
replace_all
(key, val)Replace all keys in document with value.
Update all table of contents in the document.