I've written my own LaTeX class file that deals with page layouts, title styles, subheading styles and uses fancyhdr so that each page has the section name and document title in the header, and so forth. (And I do the whole (add-to-list 'org-latex-classes '("my_class_name ..." as required.)

Doing this, I've managed to make a nice .org file which I use as the SETUPFILE for any document I want to export into a pdf via LaTeX.

This works perfectly fine, but I wonder if I can be a bit more ambitious, and move the entire class setup into an .org file that I can use, without calling my custom class (i.e. I will only use #+LaTeX_HEADER:\documentclass{article} or #+LaTeX_HEADER:\LoadClass{article} as the base class to modify).

This nice answer and this expanded procedure by @Melioratus is not quite what I would like to do - at the end of the day, the (non-standard) LaTeX class file still needs the svjour.cls file to be present (at least as far as I can tell). I basically want to do away with svjour.cls entirely, and re-write it as an org file (albeit in my case the code is much simpler).

As an example of the code from the template I would like to migrate to org is the block:

  \fancyhf{}% clear all header and footer fields
  % \fancyfoot[C]{\textbf{--~\thepage~--}} % except the center
  % {\footrulewidth}{0pt}%
\renewcommand{\sectionmark}[1]{\markboth{\thesection\quad #1}{}}
\fancyfoot[C]{-- ~\thepage ~ --}


Unfortunately, copying it into a LaTeX source block/ including it in several #+LaTeX_HEADERs doesn't work -- the title, subsection name variables don't seem to be passed properly.

  • 3
    My recommendation would be to NOT do that: Org mode does not know much LaTeX and the exporter is limited in what it can produce. So having your own class file and using #+LATEX_CLASS: is the way to go IMO.
    – NickD
    Jan 4 at 18:05
  • @NickD noted! I am just trying to see how far we can push the principle of keeping everything in emacs/org. Jan 4 at 18:18
  • What about having the exporter tangle a file, then include that file. Does that meet your requirements, or is that too 'external'?
    – mankoff
    Jan 5 at 17:11
  • @mankoff That sounds useful! Do you have an example in mind? Jan 6 at 11:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.