4

I would like to generate cited references and bibliography using biber and xelatex through org mode, but have not figured out how to do so.

I have to use xelatex because I am working with Chinese articles.

Sample Document:

#+TITLE: How to Automate Footnote Citations in Org-Mode
#+AUTHOR: Sati Bodhi

* Cite Test

This is a statement with a footnote reference. [fn:2a55720f42c74dd:This is the footnote with a citation that is supposed to be formatted in Chicago-fullnote style. cite:Rogersbecoming1995。]


bibliography:thesis.bib
bibliographystyle:chicago-notes

Bibtex Entry:

@book{Rogersbecoming1995,
  title = {On Becoming a Person: A Therapist's View of Psychotherapy},
  author = {Rogers, Carl R.},
  year = {1995},
  publisher = {{Houghton Mifflin}},
  address = {{Boston, New York}},
  abstract = {Collection of essays by American psychotherapist Carl Rogers written between 1951 and 1961, in which he put forth his ideas about self-esteem, flexibility, respect for self, and acceptance of others.},
  isbn = {9780395755310},
  keywords = {Client-centered psychotherapy},
  language = {eng},
  place = {;}
}

Configuration:

(setq org-latex-classes
      '(("article"
         "
%\\documentclass[12pt,a4paper]{article}
\\documentclass[12pt,a4paper]{ctexart}

\\usepackage{xeCJK}
\\usepackage{zhnumber} % package for Chinese formatting of date time (use /zhtoday)
%\\usepackage[yyyymmdd]{datetime} % set date time to numeric

% For Generation of Citations and Bibliography
\\usepackage[backend=biber]{biblatex-chicago}

% Set Font.
\\setsansfont{Times New Roman}
\\setmainfont{Calibri} % Set serifed font to Calibri. Originally set to 'Times New Roman', but it cannot display certain characters such as ①②③.
\\setCJKmainfont{Songti TC}
\\setCJKsansfont{Kaiti TC} % Set Chinese font. NOTE: Remember to append CJK before of the font class. CJK HAS to be there for the font to show.
\\setCJKmonofont{PingFang TC}

% Set title font.
\\renewcommand{\\maketitlehooka}{\\sffamily}

% Set quotation font.
\\usepackage{etoolbox}
\\newCJKfontfamily\\quotefont{Kaiti TC}
\\AtBeginEnvironment{quote}{\\quotefont\\normalsize}

% Tweak default settings.
\\renewcommand{\\baselinestretch}{1.2} % Set line width.
%\\renewcommand{\\contentsname}{\\hfill\\bfseries\\Large 目\\hspace{0.5cm} 次\\hfill} % Translate content page title to Chinese.
%\\renewcommand{\\cftaftertoctitle}{\\hfill} % Center contents title.

% For text-boxes

\\usepackage{mdframed}
\\BeforeBeginEnvironment{minted}{\\begin{mdframed}}
\\AfterEndEnvironment{minted}{\\end{mdframed}}

% For tables

\\usepackage{float}
\\restylefloat{table}

% [FIXME] ox-latex 的設計不良導致 hypersetup 必須在這裡插入
\\usepackage{hyperref}
\\hypersetup{
  colorlinks=true, %把紅框框移掉改用字體顏色不同來顯示連結
  linkcolor=[rgb]{0,0.37,0.53},
  citecolor=[rgb]{0,0.47,0.68},
  filecolor=[rgb]{0,0.37,0.53},
  urlcolor=[rgb]{0,0.37,0.53},
  pagebackref=true,
  linktoc=all,}
"
         ("\\section{%s}" . "\\section*{%s}")
         ("\\subsection{%s}" . "\\subsection*{%s}")
         ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
         ("\\paragraph{%s}" . "\\paragraph*{%s}")
         ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
        ))

(setq org-latex-with-hyperref t)

(setq org-latex-default-packages-alist
      '(("" "hyperref" nil)
        ("" "graphicx" t)
        ("" "longtable" nil)
        ("" "wrapfig" nil)
        ("" "rotating" nil)
        ("normalem" "ulem" t)
        ("" "amsmath" t)
        ("" "textcomp" t)))

;; Use XeLaTeX to export PDF in Org-mode
(setq org-latex-pdf-process
      '("xelatex -interaction nonstopmode -output-directory %o %f"
        "xelatex -interaction nonstopmode -output-directory %o %f"
        "xelatex -interaction nonstopmode -output-directory %o %f"))

(require 'ox-latex)
(setq org-latex-inputenc-alist '(("utf8" . "utf8x")))

;; Use XeLaTeX to compile in Latex-mode

(setq tex-compile-commands '(("xelatex %r")))
(setq tex-command "xelatex")
(setq-default TeX-engine 'xetex)

Generated Bibliography and Footnote:

Bibliography

Footnote


Update:

I've found my own solution. Because I cannot award myself the bounty, I would like to seek an explanation as to why the bibliography and style had to be hard-coded this way and whether, given the current working solution, there can be a more flexible way of dealing with this. The best answer would be awarded the bounty.

Note:

The format used to specify the bibliography data source and its citation style in the question above was one offered by org-ref.

1 Answer 1

2

I've found my own solution. Here are the changes I've made to the source and configuration code that made this work.

Source:

#+TITLE: How to Automate Footnote Citations in Org-Mode
#+AUTHOR: Sati Bodhi

#+BEGIN_abstract
This is the abstract.
#+END_abstract

* Cite Test

This is a statement with a footnote reference. [fn:2a55720f42c74dd:This is the footnote with a citation that is supposed to be formatted in Chicago-fullnote style. [[cite:Rogersbecoming1995][121-127]]。]


#+LATEX: \printbibliography

Configuration:

% For Generation of Citations and Bibliography
\\usepackage[notes, isbn=false, backend=biber]{biblatex-chicago}
\\bibliography{/Users/satibodhi/Creation/notes/bibliography/thesis}
(setq org-latex-pdf-process
      '("xelatex -interaction nonstopmode -output-directory %o %f"
        "biber --output-directory %o $(basename %f .tex)"
        "xelatex -interaction nonstopmode -output-directory %o %f"
        "xelatex -interaction nonstopmode -output-directory %o %f"))

Results:

enter image description here enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.