Просмотр исходного кода

oc-csl: Define \citeprocitem for LaTeX export

* lisp/oc-csl.el (org-cite-csl-finalizer): In order for
citeproc-generated references to be treated the same as bib(la)tex
references by hyperref, we need to make use of \hyper@linkstart.
However, this requires \makeatletter and \makeatother, which can only be
used in the preamble.  To allow citeproc-el to use \hyper@linkstart, we
add a command definition in the preamble, \citeprocitem.
TEC 3 лет назад
Родитель
Сommit
818bec57eb
1 измененных файлов с 2 добавлено и 0 удалено
  1. 2 0
      lisp/oc-csl.el

+ 2 - 0
lisp/oc-csl.el

@@ -589,6 +589,8 @@ property list."
     (with-temp-buffer
       (save-excursion (insert output))
       (when (search-forward "\\begin{document}" nil t)
+        ;; Ensure that \citeprocitem is defined for citeproc-el
+        (insert "\\makeatletter\n\\newcommand{\\citeprocitem}[2]{\\hyper@linkstart{cite}{citeproc_bib_item_#1}#2\\hyper@linkend}\n\\makeatother\n\n")
         ;; Ensure there is a \usepackage{hanging} somewhere or add one.
         (goto-char (match-beginning 0))
         (let ((re (rx "\\usepackage" (opt "[" (*? nonl) "]") "{hanging}")))