Function: org-latex-guess-inputenc

org-latex-guess-inputenc is a byte-compiled function defined in ox-latex.el.gz.

Signature

(org-latex-guess-inputenc HEADER)

Documentation

Set the coding system in inputenc to what the buffer is.

HEADER is the LaTeX header string. This function only applies when specified inputenc option is "AUTO".

Return the new header, as a string.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ox-latex.el.gz
(defun org-latex-guess-inputenc (header)
  "Set the coding system in inputenc to what the buffer is.

HEADER is the LaTeX header string.  This function only applies
when specified inputenc option is \"AUTO\".

Return the new header, as a string."
  (let* ((cs (or (ignore-errors
		   (latexenc-coding-system-to-inputenc
		    (or org-export-coding-system buffer-file-coding-system)))
		 "utf8")))
    (if (not cs) header
      ;; First translate if that is requested.
      (setq cs (or (cdr (assoc cs org-latex-inputenc-alist)) cs))
      ;; Then find the \usepackage statement and replace the option.
      (replace-regexp-in-string "\\\\usepackage\\[\\(AUTO\\)\\]{inputenc}"
				cs header t nil 1))))