Dave
Dave

Reputation: 8091

Embed contents of source file inside source block in an org mode document (latex)

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?

Upvotes: 1

Views: 298

Answers (1)

John Kitchin
John Kitchin

Reputation: 2433

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}

Upvotes: 1

Related Questions