1
votes

In pseudo-code I'd like to do the following in my org-mode file:

#+BEGIN_src python
[[./a_python_script_whose_contents_i_want_in_my_document.py]]
#+END_src

i.e. have the entire contents of a separate file be embedded in my org-mode document when I export it to latex.

How do I embed the contents of a separate file within an org-mode document, and have that content be formatted as source code when exporting?

1

1 Answers

1
votes

There is no way to do that in org-mode with a source block that I know of. This will give you what you want if you have minted setup:

\inputminted{python}{your-script.py}

or if you use lsting

\lstinputlisting[language=Python]{source_filename.py}