unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#50555: [BUG] Org Latex export doesn't handle src blocks correctly
@ 2021-09-12 20:25 Younes Ben El
  0 siblings, 0 replies; only message in thread
From: Younes Ben El @ 2021-09-12 20:25 UTC (permalink / raw)
  To: 50555

[-- Attachment #1: Type: text/plain, Size: 1440 bytes --]

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/)

>
>

[-- Attachment #2: Type: text/html, Size: 2627 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-12 20:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-12 20:25 bug#50555: [BUG] Org Latex export doesn't handle src blocks correctly Younes Ben El

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).