Can I inline a org file inside another org file? - emacs

In latex we can split a big document(paper.tex) into several tex files(abstract.tex,intro.tex ...) which can be inserted inline using \input{paper.tex}.
Is there a similar facility in org-mode?

Just use the include command i.e.
#+INCLUDE abstract.org
#+INCLUDE intro.org
This will inline abstract.org and intro.org in the current org file. See also the org-mode documentation on include files.

Without test, but I think you can just simply add the latex command \input{paper.tex} in any place of .org file you want. It will render the .tex file to final file.
PS: other option: Include-files which are mentioned in the comment.

Related

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?
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}

export from Emacs in rtf using current font-lock?

I'd like to export my latex files (and maybe other files) as rtf files, so that the syntax highlighting will be kept (that is - keep it 'plain text' with colors).
I tried using Org-mode to convert to HTML (thinking later to copy it into LibreOffice and hope for good results), but I couldn't make Org export it with the correct colors.
Is there a way to export buffer to rtf using the current font-lock ?
I think you're looking for M-x htmlfontify-buffer.
You can also take a look at http://www.emacswiki.org/emacs/Htmlize

Adding latex preamable to an Rmd file?

I'd like to include some latex code in my .Rmd file so that when I do:
knit('file.Rmd')
pandoc('file.md', format='latex')
then the .tex file is processed with
\usepackage{mathpazo}
in the preamble of the latex file? Is this possible, by adding the preamble text somehow dierctly into the .Rmd file, similar to what can be done with embedded configs:
https://github.com/yihui/knitr-examples/blob/master/088-pandoc-embedded.Rmd
(lines 5--13).
Or do I have to create some extra templates in my homedir for pandoc to find?
Thanks, Stephen

In org-mode, how do I include other .org files from a (main) .org file?

I want to place some customization codes in a separate file, and include it from other files later. For example, file config.org has a single line #+MATHJAX: align:"left" mathml:t. How do I include it in another .org file abc.org so that the net-effect is exactly same as I write that #+MATHJAX line directly in abc.org?
Use #+setupfile: /path/to/config.org documented here.
The #+INCLUDE directive can include another file with export options (but it cannot affect the configuration of the enclosing file, since it is only for export purposes). Use it like:
#+INCLUDE: "/path/to/config.org"

Microsoft Word to Org-mode

I am trying to put the Microsoft Word document in emacs using org-mode. I have copied the Word Document and pasted in emacs. I like to achieve the headings like 7.1.2.4 in org-mode format.
and then link the TOC to appropriate headings. How I can do that? Any suggestions? Any programming language like Perl has done it?
Thanks.
There is ODT2ORG (https://bitbucket.org/josemaria.alkala/odt2org/wiki/Home) which lets you import odt files in org-mode.
Use Openoffice/Libreoffice to produce an .odt from your .doc.
Use odt2org to get an .org.
About the headings: I am not entirely sure I understand you.
there is org-toc.el included in org-mode that provides a seperate buffer with a TOC of your current document (like in Reftex). All the entries there are already links to the individual headings. Also, an exported document will have a TOC included by default without your intervention.
Orgmode does not support automatically numbered headings (yet). However, if you want to export your document to html, docbook, latex, or pdf, your headings will appear numbered and nested (you can tweak the settings quite a lot).
I doubt that you will get your intended result purely automatically but it should work 70% automatically, especially if you have latex installed and simply want to have a good-looking pdf in the end. Convert doc to odt, convert odt to org, open and type "C-c C-e d".
Another option: Save as an HTML file, then use Pandoc to convert the HTML to an .org file.
I've converted loads of Word documents into Org files. It takes minutes to do it by hand.
If you want cross-references, use internal links (4.2 in the current manual).
The * and ** style headings are always likely to be there in Org. Think of the use case where exports are compiled from #+INCLUDEd files, or you have done a selective export using tags. Any kind of single sourcing technology isn't going to display the numbering.
There is a ruby gem which converts doc to md. With pandoc you can convert to org.
https://github.com/benbalter/word-to-markdown