I'm using the LaTeX package listings for exporting code blocks in org-mode to latex files.

I've defined a latex template with the =org-latex-classes= feature as described in https://so.nwalsh.com/2020/01/05-latex .

This works well for python code blocks, i.e.

#+begin_src python
import pandas as pd

However, org-mode uses the "shell" keyword to define "sh/bash" code block. The "shell" keyword is not defined for the LaTeX listings package (but "sh" and "bash" is). Thus, exporting org-mode "shell" code blocks does not work, i.e:

#+begin_src shell
conda install pandas -y

does not work.

Is there a workaround to either make listings accept the "shell" keyword, or org-mode to accept "sh"/"bash" as keywords?

  • 1
    You can say #+begin_src bash ... or #+begin_src sh... instead of shell. – NickD Oct 2 '20 at 16:25
  • Thank you, I understand now. – simenojensen Oct 2 '20 at 21:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.