How can I use following template in an org mode on latex. This will help me understand the org mode latex. Kindly explain the changes you make in the template so that I understand the org mode better (Teach me fishing!) Regards

\usepackage{blindtext} % just for the example
% create sample csv file
1,Sebastian,12.12.2012,XYZ road,XYZ city
2,Rose,12.12.2013,XYZ road,abc city
% load data
      \textbf{Date of birth}\newline\mydate&%
\newcommand{\mydate}{December 26, 1997}
\newcommand{\myaddress}{26 Washington Ave., Manhattan, New York.\newline United States of America}
% Define a command that fetches data for the row with the ID
% given in the argument
% fetch the first matching row
% Lookup the required values from this row

% fetch data for Id=2


\blinddocument % just for the example

1 Answer 1


I have only tested this in versions pre-8.0.
I would highly recommend to read the org-mode manual for LaTeX exporting capabilities. It is very good: org-export-latex.

org-mode for Emacs has the optional LaTeX customization by using this:

#+LaTeX_HEADER: \newcommand\myaddress{...}

You can put as many header information lines as you please which in turn can build your custom LaTeX file on the fly.

#+LaTeX_HEADER: \newcommand\myaddress{...}
#+LaTeX_HEADER: \newcommand\myauthor{...}

Note that you can also use the above command to add packages.


Choosing the class for your org-file determines the packages that is used by a certain setup in your .emacs file.
To choose the org-class you do:

#+LaTeX_CLASS: article

To change the settings of the org-class article you add this to your .emacs file (example):

(add-to-list 'org-export-latex-classes
          ("\\chapter{%s}" . "\\chapter*{%s}")
          ("\\section{%s}" . "\\section*{%s}")
          ("\\subsection{%s}" . "\\subsection*{%s}")       
          ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
          ("\\paragraph{%s}" . "\\paragraph*{%s}")
          ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))

You can also do:

(add-to-list 'org-export-latex-classes
           ("\\chapter{%s}" . "\\chapter*{%s}")
           ("\\section{%s}" . "\\section*{%s}")
           ("\\subsection{%s}" . "\\subsection*{%s}")       
           ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
           ("\\paragraph{%s}" . "\\paragraph*{%s}")
           ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))

which will let you do:

#+LaTeX_CLASS: article

Default packages for all classes

For customization of the default packages you use, you can do something like:

;; Default LaTeX export packages
(add-to-list 'org-export-latex-packages-alist '("" "amsmath"))

which will add the amsmath package to all your classes.

You can test with this small document and the above settings:

#+OPTIONS: TeX:t LaTeX:t
#+LaTeX_CLASS: article
#+LaTeX_HEADER: \usepackage{biblatex}
#+LaTeX_HEADER: \newcommand\myaddress{...}

* Hello
Hello to you
** Next time

* Not again

Which will give you something like this:

% Created 2013-12-18 Wed 10:42

\date{18 December 2013}


  • Is direct conversion to pdf and printing the pdf so generated is possible or I have to go through the cycle org--> latex--> pdf manually?
    – Vaibhav
    Commented Dec 18, 2013 at 10:05
  • 3
    Sure that is possible: C-c C-e press l processes to LaTeX file, C-c C-e press p processes to LaTeX file and produces the pdf as well.
    – nickpapior
    Commented Dec 18, 2013 at 10:11
  • The template I provided is a bit complex. Moreover the csv file that is being used is kept seperately. Kindly explain/ help convert the present template in org mode
    – Vaibhav
    Commented Dec 21, 2013 at 9:33
  • 1
    @user34083 by principle I will not help convert your entire template. However, if you have any specific problems with it you should ask another question.
    – nickpapior
    Commented Dec 21, 2013 at 10:20
  • @zeroth Could you please annotate whether your description is based on the new exporter (orgmode version >/= 8.0) or the old exporter (orgmode version < 8.0)?
    – Keks Dose
    Commented Jan 3, 2014 at 17:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .