I want to convert my latex template to an org-mode template.
I want to change where the \title{}
and the \author
commands are inserted in the tex-file. At the moment these commands gets inserted just before \begin{document}
, but I want to use these variables in my preamble to add the title to the header of each page. In my ~/.emacs.d/init.el
I have made a custom org-latex-classes
which looks like this.
I have tested the Latex-part of this problem and compiled the tex-file where I moved the \date
, \author
and \title
commands where I wanted and it worked like intended.
I have tried #+LATEX_HEADER_EXTRA: \title{some title} \author{me}
and removing the #+TITLE:
and #+AUTHOR
from the org-file. This has the effect that near \begin{document}
org-mode persist keeping the \title{}
and \author{}
but empty, but the one written in #+LATEX_HEADER_EXTRA
gets inserted where I wanted it to be.
(add-to-list 'org-latex-classes
'("myreport"
"\\documentclass{report}
\\usepackage{graphicx}
...
[NO-PACKAGES]
[NO-DEFAULT-PACKAGES]
[EXTRA]
;; Insert \date \author \title here
\\makeatletter
\\let\\newtitle\\@title
\\let\\newauthor\\@author
\\let\\newdate\\@date
\\makeatother
..."
("\\chapter{%s}" . "\\chapter*{%s}")
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}")
)))
I want the \date{}
, \author{}
and \title{}
to be inserted where the [EXTRA]
is placed instead of the bottom just before \begin{document}
I have looked around for answer to this question but found nothing, so if the question is already answered please show me where.