14

I need many lines in my org-export latex header.

#+LATEX_HEADER: \usepackage[main=british,polutonikogreek]{babel}
#+LATEX_HEADER: \usepackage{fontspec}
#+LATEX_HEADER: \usepackage{hanging}
#+LATEX_HEADER: \setmainfont{ebgaramond}[Contextuals=Alternate]
#+LATEX_HEADER: \newcount\instr \instr=1 % hide/show instructions
#+LATEX_HEADER: \babelhyphenation[british]{philo-sophy}

Is there an alternative to putting #+LATEX_HEADER in front of each?

2
  • Your problem is not related with the tile of the question.
    – Dox
    Jan 26, 2017 at 14:29
  • 2
    If you prefer, write all of the preamble in an external file, say header.tex, and then call it like #+latex_header: /path/to/header.tex.
    – Dox
    Jan 26, 2017 at 14:31

1 Answer 1

16

A possible solution is to write a file with the LaTeX preamble, like

%% This is the file MyTeXHeader.tex
\usepackage[main=british,polutonikogreek]{babel}
\usepackage{fontspec}
\usepackage{hanging}
\setmainfont{ebgaramond}[Contextuals=Alternate]
\newcount\instr \instr=1 % hide/show instructions
\babelhyphenation[british]{philo-sophy}

and then use a single call of #+latex_header in your org file

#+title: A shortcut in my LaTeX header
#+author: Stan Lee
#+latex_header: \input{/path/to/your/MyTeXHeader.tex}

* Introduction
  bla bla bla
3
  • 1
    I had to do #+latex_header: \input preamble
    – Toothrot
    Jan 29, 2017 at 19:35
  • @toothrot: I corrected the call of the file. Thx!
    – Dox
    Jan 30, 2017 at 6:33
  • This is very helpful, because you can easily play with the headerfile without reloading your .emacs every time plus you can comment out lines in the header file! Commenting out in the .emacs may or may not work with %, however, the usual ; inside the LaTeX header causes strange effects.
    – Keks Dose
    Aug 23, 2020 at 12:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.