# Including tex file in an org file

I have a tex file containing lots of standard settings such as packages to be included and various other options. How do I tell Org mode to use only the settings from that TeX file?

i.e. for all practical purposes, the org-document should only export to a tex file the part between \begin{document}...\end{document} whereas the other document settings such as what documentclass and packages to use are borrowed directly from the .tex file. By default Org creates the preamble like

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{amssymb}


..

which I don't want

• Is the export supposed to end up in that file? Or is the tex file supposed to be included in the output file? Not sure it can be done in any case, but we might as well get clarity on the desired outcome. – NickD Nov 20 '18 at 1:17

You need to add your own preamble to org-latex-classes and you also can exclude the default packages from beeing loaded (see the description of that variable).

The following works for me. Put

(add-to-list 'org-latex-classes
'("my-org-latex-class"
"\\documentclass[option1,option2]{myclass}
[NO-DEFAULT-PACKAGES]
[PACKAGES]
\\usepackage{mypackage1}
\\usepackage{mypackage2}"))


somewhere to your org config. Then an org-file like

 #+TITLE: test
#+AUTHOR: My name
#+LaTeX_CLASS: my-org-latex-class

* Introduction
Intro text


produces a tex-file without the default packages. If you are not using the package hyperref you also might want to set the variable org-latex-with-hyperref to nil.