emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] How to display babel src block language on exported PDF code blo


From: John Kitchin
Subject: Re: [O] How to display babel src block language on exported PDF code block?
Date: Thu, 5 Apr 2018 20:32:23 -0700

I have done soemthing like this before:

(setq org-latex-minted-options
           '(("frame" "lines")
             ("fontsize" "\\scriptsize")))

;; custom code block format to indicate input variables
(defun my-src-block (src-block contents info)
  (cond
   ((eq (elt (plist-get info :back-end) 2) 'latex)
    (concat
     "\\begin{tcolorbox}
"
     (format
      (concat
       (when (org-element-property :name src-block)
(format "src block name: %s\\\\" (org-element-property :name src-block)))
       "language: %s")
      (org-element-property :language src-block))
     (org-latex-src-block src-block contents info)
"
\\end{tcolorbox}"))))

;; custom exporter
(org-export-define-derived-backend 'my-latex 'latex
  :translate-alist '((src-block . my-src-block)))

(org-export-to-file 'my-latex "manuscript.tex" nil nil nil nil nil)
(ox-manuscript-latex-pdf-process "manuscript.tex")

John

-----------------------------------
Professor John Kitchin 
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803

On Thu, Apr 5, 2018 at 7:01 PM, stardiviner <address@hidden> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

By default org-mode export to PDF file does not have language indicator on code block.
How to setup to add a language string on exported PDF code block like this HTML https://stardiviner.github.io/ ?
- --
[ stardiviner ] don't need to convince with trends.
       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3

-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAlrG1RIACgkQG13xyVro
msP0UQf/aPrlTV1ZreOrTmKuqo9rA28u/vtX266EtmOFOwB/y50pazkT5YdFLHKW
HUGyFFrWxBtTTCA9KW6/OJ49AB6kXoHSdj98jyCkRroroaT9mqtWdY9Xi8DRogqA
SCWOjjybOSEGlWsmu1gwXs0yNgqQijJR03JbMZoTcuDFctdFSk4XnnebfLiN20Ix
56fdVBMRotTFv6CCcvYZncyCp1POJQ6JtlwP3GDQufrgPy2uxZJGHUzPx9BUj4Bg
TDERPlDVjSZckc6uP6tIhzGm1PqklG34E770r3By66yeLEMaW1B6QX3IPrJ4oh7w
yhfty2UfsLQfiKyykqnt6+0SHM9IHg==
=cLnk
-----END PGP SIGNATURE-----



reply via email to

[Prev in Thread] Current Thread [Next in Thread]