本文使用 Zhihu On VSCode 创作并发布
需求
英文论文投稿一般要投 tex 格式,参考文献是 bib 格式,但是导师习惯在 docx 上修改,所以需要将带 bib 参考文件的 tex 格式转成 docx 格式
note:只想预览效果可以直接看图,不看内容
工具
- pandoc
pandoc 是一款免费的格式转换工具
操作方法
我们准备一个 tex 文件 untitled.tex 和一个 bib 文件 citations.bib ,它们位于同一层目录,文件内容放在本文末尾。
tex编译成pdf后是下面的效果
将 tex 文件转成 docx 文件,只要使用下面的命令,其中 output.docx 是输出文件
pandoc Untitled.tex -o output.docx --bibliography citations.bib
我们看一下output.docx的内容
可以看到,公示能正常转换,但是引用没有序号,参考链接也没有序号
另外我在这篇回答里看到使用 pandoc-crossref 转换,其操作为
pandoc Untitled.tex -o output.docx --filter pandoc-crossref --bibliography=citations.bib
这样做需要安装 pandoc-crossref, 和 pandoc-citeproc,mac下可以直接使用 brew 命令安装
附件
以下是untitled.tex的文件内容
documentclass{article}
begin{document}
This document is an example of BibTeX using in bibliography management. Three items
are cited: textit{The LaTeX Companion} book cite{latexcompanion}, the Einstein
journal paper cite{einstein}, and the Donald Knuth's website cite{knuthwebsite}.
The LaTeX related items are cite{latexcompanion,knuthwebsite}.
Here is a formula:
$$sum_{i=1}^{n} a_i = pi $$
medskip
bibliographystyle{unsrt}
bibliography{citations}
end{document}
以下是citations.bib文件内容
@article{einstein,
author = "Albert Einstein",
title = "{Zur Elektrodynamik bewegter K{"o}rper}. ({German})
[{On} the electrodynamics of moving bodies]",
journal = "Annalen der Physik",
volume = "322",
number = "10",
pages = "891--921",
year = "1905",
DOI = "http://dx.doi.org/10.1002/andp.19053221004"
}
@book{latexcompanion,
author = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
title = "The LaTeX Companion",
year = "1993",
publisher = "Addison-Wesley",
address = "Reading, Massachusetts"
}
@misc{knuthwebsite,
author = "Donald Knuth",
title = "Knuth: Computers and Typesetting",
url = "http://www-cs-faculty.stanford.edu/~{}uno/abcde.html"
}