Function: org-cite-csl-finalizer

org-cite-csl-finalizer is a byte-compiled function defined in oc-csl.el.gz.

Signature

(org-cite-csl-finalizer OUTPUT KEYS FILES STYLE BACKEND INFO)

Documentation

Add "hanging" package if missing from LaTeX output.

OUTPUT is the export document, as a string. INFO is the export state, as a property list.

Source Code

;; Defined in /usr/src/emacs/lisp/org/oc-csl.el.gz
(defun org-cite-csl-finalizer (output _keys _files _style _backend info)
  "Add \"hanging\" package if missing from LaTeX output.
OUTPUT is the export document, as a string.  INFO is the export state, as a
property list."
  (org-cite-csl--barf-without-citeproc)
  (if (not (eq 'latex (org-cite-csl--output-format info)))
      output
    (with-temp-buffer
      (save-excursion (insert output))
      (when (search-forward "\\begin{document}" nil t)
        (goto-char (match-beginning 0))
        ;; 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.
        (let ((re (rx "\\usepackage" (opt "[" (*? nonl) "]") "{hanging}")))
          (unless (re-search-backward re nil t)
            (insert "\\usepackage[notquote]{hanging}\n"))))
      (buffer-string))))