Examples#

Examples are placed in the examples directory of WdBibTeX project. Target MS Word file is generated by executing docxgen.py in each examples directory.

One citation in ieeetr style#

Simple example is in examples/first directory. Firstly, execute docxgen.py to generate sample.docx. (This is because adding docx in download page is not preferred way to deliver.) If docxgen.py fails to generate sample.docx, copy&paste following text to the word file nad save as sample.docx.

This sample document is generated by WdBibTeX.

Some text with dummy citation \cite{enArticle1} will be converted to [1] by executing wdbibtex.
The list of bibliography is placed to the thebibliography command as follows:

\thebibliography

The generated sample.docx contains one citation key of \cite{enArticle1}. At the bottom of documents, another latex command of \thebibliography is placed. In examples/first, you can see bibliography file named library.bib. The BibTeX entry of enArticle1 is in library.bib.

Then, excecute following command with --bst ieeetr option (as no .bst file is placed in examples/first directory).

$ python -m wdbibtex sample.docx --bst ieeetr

You can see sample_bib.docx with the following BibTeX-converted contents:

This sample document is generated by WdBibTeX.

Some text with dummy citation[1] will be converted to [1].
The list of bibliography is placed to the thebibliography command as follows:

[1] I. Yamada, J. Yamada, S. Yamada, and S. Yamada, “Title1,” Japanese Journal, vol. 15, pp. 20-30, march 2019.

Citation style customization#

WdBibTeX support documentclass and cite package customization via preamble written in word file. The example is found in examples/custom. The following contents are automatically written in sample.docx by executing docxgen.py.

This sample document is generated by WdBibTeX.

WdBibTeX can (partially) parse preamble contents written between
"\+begin{preamble}" and "\+end{preamble}".
The preamble contents are removed in the latex-processed docx artifacts.
For citation package, some options are available to control citation style.
In this example, citation package is added with "superscript" option.
The "citeleft" and "citeright" is also modified.

Sample citation customization \cite{enArticle1}.
Multiple citations example \cite{enArticle2,enArticle3,enArticle4}.
The list of bibliography is placed to the thebibliography command as follows:

\begin{preamble}
\documentclass[10pt]{article}
\usepackage[superscript]{cite}
\renewcommand\citeleft{(}
\renewcommand\citeright{)}
\bibliographystyle{IEEEtran}
\end{preamble}
\thebibliography

After excecuting following command in examples/custom directory, you can see the superscripted citations in the sample_bib.docx. Note that the second citation is converted to (2-4) as the citation package is called in the preamble.

$ python -m wdbibtex sample.docx
_images/custom.png

Citation in IEEJtran style#

As the author also maintains IEEJtran.bst(https://github.com/ehki/jIEEEtran), which is BibTeX style files for Japanese Electrical Engineers, one example for Japanese bibliography is stated here. Although the point is LaTeX and BibTeX command selection, WdBibTeX automatically select proper command based on system locale.

One example for Japanese reference is located in examples/ieejtran. Note that IEEJtran.bst is already place in the sample directory and WdBibTeX uses the existing .bst file automatically. The following contents are automatically written in sample.docx by executing docxgen.py.

This sample document is generated by WdBibTeX.

Sample citation\cite{enArticle1}.
英語文献の引用例\cite{enArticle1}。
Multiple citations example\cite{enArticle2,enArticle3,enArticle4}.
複数文献の引用例\cite{enArticle2,enArticle3,enArticle4}。
Examples of Japanese reference\cite{jpArticle2,jpArticle3,jpArticle4}.
日本語文献の引用例\cite{jpArticle2,jpArticle3,jpArticle4}。
The list of bibliography is placed to the thebibliography command as follows:
文献リストは以下の通りとなる。

\thebibliography

Then, let’s excecute following command in examples/ieejtran directory.

$ python -m wdbibtex sample.docx

You can see sample_bib.docx with the following BibTeX-converted contents:

This sample document is generated by WdBibTeX.

Sample citation[1].
英語文献の引用例[1]。
Multiple citations example[2,3,4].
複数文献の引用例[2,3,4]。
Examples of Japanese reference[5,6].
日本語文献の引用例[5,6]。
The list of bibliography is placed to the thebibliography command as follows:
文献リストは以下の通りとなる。

[1] I. Yamada, J. Yamada, S. Yamada, S. Yamada: “Title1”, Japanese Journal, Vol.15, No.10, pp.20—30 (2019-3) (in Japanese)
[2] G. Yamada, R. Yamada: “Title2”, Japanese Journal, Vol.15, No.10, p.21 (2019-12) (in Japanese)
[3] G. Yamada, R. Yamada: “Title2 is true?”, IEEE Transactions on Pattern Analysis and Machine Intelligence (2018-11)
[4] H. Sato, J. Sasaki: “Article with language field”, IEEJ Sample Transactions (2010-3) (in Japanese)
[5] 山田 五郎・山田 六郎:「文献2」,日本語学会,Vol.15,No.10,p.21(2019-12)
[6] 山田 八郎・山田 六郎:「手法1と手法2,どちらが正しいのか?」,日本語の学会名,Vol.5,No.1,p.15(2010)

Some readers noticed that the inserted citation numbers and thebibliography texts did not overwrite the text style. So by setting the style of thebibliography and cite keys before WdBibTeX process, you can set indentation, text-size, font, superscript, etc. of the converted bibliography texts.