emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] New exporter documentation?


From: Thomas S. Dye
Subject: Re: [O] New exporter documentation?
Date: Thu, 17 Jan 2013 22:02:00 -1000

Aloha James,

James Harkins <address@hidden> writes:

> I apologize in advance for what is likely to be a dumb question, but
> I'm struggling to find documentation of the new exporter. Google
> pointed to [1], but this is documentation for developers of new
> backends. I only want to use the existing backends, and I want to
> understand how the new _exporter_ is different from the old__.
>
> Specific question: Is there an easy way to use a given LaTeX template
> (.cls and .bib)? (I also found [2] but "easy" is not how I would
> describe that.)

Not a dumb question. The Org mode community is working to move the new
exporter out of contrib/. The documentation at this point is the source
code, several of Nicolas Goaziou's posts to the mailing list, and some
"not easy" experiments that you've found.

The answer to your specific question is, yes, this works in the same way
as the old exporter. The following set up is one that I'm using for an
article prepared for PLOS-One. See the variable org-e-latex-classes for
how to use a LaTeX cls file. See the \bibliographystyle{} command for
how to specify a particular .bib file. I run the editing-setup code
block when I first enter the buffer. The export-setup-plos-one code
block needs to be tangled so there is an init-plos.el file in the same
folder as the Org mode file. If you change the name of the tangled file,
then this needs to be changed also in the variable
org-export-async-init-file in the editing-setup source code block.
Beware! The asynchronous export is habit forming :)

** Editing setup
#+name: editing-setup
#+header: :noweb yes
#+header: :results silent
#+begin_src emacs-lis p
  (require 'org-e-latex)
  (setq org-export-in-background t)
  (setq org-export-async-debug t)
  (setq org-export-async-init-file (expand-file-name "init-plos.el"))
  (setq org-entities-user nil)
  (add-to-list 'org-entities-user '("space" "\\ " nil " " " " " " "–"))
  (add-to-list 'org-entities-user '("amacron" "\\={a}" nil "&#0257" "a" "a" 
"ā"))
  (add-to-list 'org-entities-user '("emacron" "\\={e}" nil "&#0275" "e" "e" 
"ē"))
  (add-to-list 'org-entities-user '("imacron" "\\={\\i}" nil "&#0299" "i" "i" 
"ī"))
  (add-to-list 'org-entities-user '("omacron" "\\={o}" nil "&#0333" "o" "o" 
"ō"))
  (add-to-list 'org-entities-user '("umacron" "\\={u}" nil "&#0363" "u" "u" 
"ū"))
  (add-to-list 'org-entities-user '("Amacron" "\\={A}" nil "&#0256" "A" "A" 
"Ā"))
  (add-to-list 'org-entities-user '("Emacron" "\\={E}" nil "&#0274" "E" "E" 
"Ē"))
  (add-to-list 'org-entities-user '("Imacron" "\\={I}" nil "&#0298" "I" "I" 
"Ī"))
  (add-to-list 'org-entities-user '("Omacron" "\\={O}" nil "&#0332" "O" "O" 
"Ō"))
  (add-to-list 'org-entities-user '("Umacron" "\\={U}" nil "&#0362" "U" "U" 
"Ū"))
  (define-key org-mode-map (kbd "C-c e") 'org-export-dispatch)
  <<define-cite-link>>
#+end_src

** Export setup for PLOS-One
#+name: export-setup-plos-one
#+header: :noweb yes
#+header: :results silent
#+header: :tangle init-plos.el
#+begin_src emacs-lisp
  (setq load-path (cons "~/.emacs.d/src/org-mode/lisp" load-path))
  (setq load-path (cons "~/.emacs.d/src/org-mode/contrib/lisp" load-path))
  (require 'org-e-latex)
  (org-babel-lob-ingest "~/org/td-lob.org")
  (setq org-confirm-babel-evaluate nil)
  (org-babel-do-load-languages
   'org-babel-load-languages
   '((R . t)
     (dot . t)
     (emacs-lisp . t)
     (latex . t)
     (org . t)
     (sh . t)))
  (setq org-entities-user nil)
  (add-to-list 'org-entities-user '("space" "\\ " nil " " " " " " "–"))
  (add-to-list 'org-entities-user '("amacron" "\\={a}" nil "&#0257" "a" "a" 
"ā"))
  (add-to-list 'org-entities-user '("emacron" "\\={e}" nil "&#0275" "e" "e" 
"ē"))
  (add-to-list 'org-entities-user '("imacron" "\\={\\i}" nil "&#0299" "i" "i" 
"ī"))
  (add-to-list 'org-entities-user '("omacron" "\\={o}" nil "&#0333" "o" "o" 
"ō"))
  (add-to-list 'org-entities-user '("umacron" "\\={u}" nil "&#0363" "u" "u" 
"ū"))
  (add-to-list 'org-entities-user '("Amacron" "\\={A}" nil "&#0256" "A" "A" 
"Ā"))
  (add-to-list 'org-entities-user '("Emacron" "\\={E}" nil "&#0274" "E" "E" 
"Ē"))
  (add-to-list 'org-entities-user '("Imacron" "\\={I}" nil "&#0298" "I" "I" 
"Ī"))
  (add-to-list 'org-entities-user '("Omacron" "\\={O}" nil "&#0332" "O" "O" 
"Ō"))
  (add-to-list 'org-entities-user '("Umacron" "\\={U}" nil "&#0362" "U" "U" 
"Ū"))
  (setq org-export-latex-packages-alist nil)
  (add-to-list 'org-export-latex-packages-alist '("" "setspace"))
  (add-to-list 'org-export-latex-packages-alist '("" "amsmath"))
  (add-to-list 'org-export-latex-packages-alist '("" "amssymb"))
  (add-to-list 'org-export-latex-packages-alist '("" "graphicx"))
  (add-to-list 'org-export-latex-packages-alist '("" "cite"))
  (add-to-list 'org-export-latex-packages-alist '("" "color"))
  (add-to-list 'org-export-latex-packages-alist '("" "setspace"))
  (add-to-list 'org-export-latex-packages-alist 
'("labelfont=bf,labelsep=period,justification=raggedright" "caption"))
  (setq org-e-latex-pdf-process '("latexmk -pdf %f"))
  (setq org-e-latex-tables-booktabs nil)
  (setq org-e-latex-title-command nil)
  (setq org-export-latex-hyperref-format "\\ref{%s}")
  (setq org-e-latex-remove-logfiles nil)
  (setq org-e-latex-toc-command "\\tableofcontents\n\n")
  (setq org-e-latex-classes nil)
  (add-to-list 'org-e-latex-classes
               '("plos-article"
                 "\\documentclass[10pt]{article}
[NO-DEFAULT-PACKAGES]
[PACKAGES]
[EXTRA]
\\doublespacing
% Text layout
\\topmargin 0.0cm
\\oddsidemargin 0.5cm
\\evensidemargin 0.5cm
\\textwidth 16cm 
\\textheight 21cm
\\bibliographystyle{plos2009}
\\makeatletter
address@hidden
\\makeatother
\\pagestyle{myheadings}
%% ** EDIT HERE **


%% ** EDIT HERE **
%% PLEASE INCLUDE ALL MACROS BELOW
\\newcommand{\\texttwosuperior}{$^{2}$}
\\newcommand{\\textpm}{$\\pm$}
\\newcommand{\\rc}{$^{14}C$}
%% END MACROS SECTION"
                 ("\\section{%s}" . "\\section*{%s}")
                 ("\\subsection{%s}" . "\\subsection*{%s}")
                 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
                 ("\\paragraph{%s}" . "\\paragraph*{%s}")
                 ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
  <<ngz-nbsp>>
  <<tsd-textpm>>
  <<define-cite-link>>
#+end_src

Hope this helps,

Tom

-- 
Thomas S. Dye
http://www.tsdye.com



reply via email to

[Prev in Thread] Current Thread [Next in Thread]