GNU bug report logs - #50555
[BUG] Org Latex export doesn't handle src blocks correctly

Previous Next

Package: org-mode;

Reported by: Younes Ben El <younes.brovi <at> gmail.com>

Date: Sun, 12 Sep 2021 20:53:02 UTC

Severity: normal

Tags: moreinfo, patch

Done: Daniel Fleischer <danflscr <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Younes Ben El <younes.brovi <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [BUG] Org Latex export doesn't handle src blocks correctly
Date: Sun, 12 Sep 2021 21:25:55 +0100
[Message part 1 (text/plain, inline)]
When exporting from org to latex , src blocks are not handled correctly.
This happens when you specify a prog-language name after #+BEGIN_SRC
Which results to an extra *[]* in exported latex file thus when
compiling it to pdf , it won't display the code block.
- How it produces the code block in latex

\begin{minted}[]{lisp}
>   (defun Fib (n)
>     (if (< n 2) n (+ (Fib (- n 1)) (Fib (- n 2)))))
> \end{minted}


- how it should produce it in latex

>
> \begin{minted}{lisp}
>   (defun Fib (n)
>     (if (< n 2) n (+ (Fib (- n 1)) (Fib (- n 2)))))
> \end{minted}


This also happens when not using minted package to highlight code
blocks.
- *To produce this bug*, (optional) set (setq org-latex-listings 'minted)
open org file and add

> #+BEGIN_SRC shell
> echo test
> #+END_SRC

And run org-latex-export-to-pdf or org-latex-export-to-latex.
- *To Resolve this issue* , remove [] in tex file and it will compile to
pdf with code blocks and syntax highlighting (This requires manually
editing each time you export to latex). Second way is to no specify
prog-language after #+BEGIN_SRC however this doesn't show code
highlighting since minted requires defining a prog-language in order to
work.
- Technical Info

> Emacs  : GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version
> 3.24.27, cairo version 1.17.4)

 of 2021-03-26
Package: Org mode version 9.5 (9.5-b83ae59 @
/home/ybenel/.emacs.d/.local/straight/build-27.2/org/)

>
>
[Message part 2 (text/html, inline)]

This bug report was last modified 3 years and 232 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.