3

使用 pandoc 我试图.tex通过组合 a.md和一个文件来生成一个.bib文件。在生成的乳胶文件中,Pandoc 已经将内联参考以及参考书目中的完整参考格式化为纯文本。但是,我喜欢在\cite\bibitem格式。

例子.md

---
title: Plain Text Workflow
author: Dennis Tenen, Grant Wythoff
date: January 20, 2014
bibliography: example.bib
---

# Section 1

Some sentence that needs citation [@fyfe_digital_2011 argues that too].

# Bibliography

例子.bib

@article{fyfe_digital_2011,
    title = {Digital Pedagogy Unplugged},
    volume = {5},
    url = {http://digitalhumanities.org/dhq/vol/5/3/000106/000106.html},
    number = {3},
    urldate = {2013-09-28},
    author = {Fyfe, Paul},
    year = {2011},
    file = {fyfe_digital_pedagogy_unplugged_2011.pdf}
}

潘多克命令

pandoc example.md -t latex -s -S --filter pandoc-citeproc -o example.tex

example.tex(摘录)

Some sentence that needs citation (Fyfe 2011 argues that too).

\section*{Bibliography}\label{bibliography}
\addcontentsline{toc}{section}{Bibliography}

Fyfe, Paul. 2011. ``Digital Pedagogy Unplugged'' 5 (3).
\url{http://digitalhumanities.org/dhq/vol/5/3/000106/000106.html}.

但是,我想要的是这个(基本上是.bblbibtex生成的文件中的内容):

Some sentence that needs citation \citep[ argues that  too]{fyfe_digital_2011}.

\begin{thebibliography}{1}
\providecommand{\natexlab}[1]{#1}
\providecommand{\url}[1]{\texttt{#1}}
\expandafter\ifx\csname urlstyle\endcsname\relax
  \providecommand{\doi}[1]{doi: #1}\else
  \providecommand{\doi}{doi: \begingroup \urlstyle{rm}\Url}\fi

\bibitem[Fyfe(2011)]{fyfe_digital_2011}
Paul Fyfe.
\newblock Digital pedagogy unplugged.
\newblock 5\penalty0 (3), 2011.
\newblock URL
  \url{http://digitalhumanities.org/dhq/vol/5/3/000106/000106.html}.

\end{thebibliography}

我知道我可以使用 运行 pandoc --natbib --bibliography=example.bib,然后使用 pdflatex 和 bibtex 进行编译,然后使用\input{example.bbl}. 但是有没有办法用 pandoc 正确地做到这一点,而无需在两者之间使用 bibtex(手动或管道)?

顺便说一句,当 pandoc 直接用 生成pdf时,它是如何在内部进行的--filter pandoc-citeproc?如果它也只是使用这些预先格式化的纯文本引用,我会非常失望。因为看起来在乳胶模板的序言中定义的各个样式在这种情况下并不适用。

4

1 回答 1

2

1)你不能。无论是你

  • 让 pandoc 为您生成参考和参考书目(pandoc-citeproc见第 2 点)或
  • 让它为 natbib ( --natbib) 或 biblatex ( --biblatex) 格式化它们,但您必须依赖外部 bibtex 文件(或其他兼容格式)。然后,您将需要bibtexbiber格式化您的引文。

2)pandoc-citeproc依赖 csl 样式。您可以在此处此处找到一些,您可以在此处轻松自定义它们。在 YAML 标题栏中使用--csl=或使用一行将其传递给您的 pandoc 命令。csl:Pandoc 在 中查找文件~/.csl,如果它不存在或与 Markdown 文件位于同一目录中,则必须提供完整路径。

于 2015-05-07T07:35:17.963 回答