emacs-orgmode
[Top][All Lists]
Advanced

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

[O] org-mode -> latex


From: Sharon Kimble
Subject: [O] org-mode -> latex
Date: Sun, 10 Apr 2016 11:58:09 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.92 (gnu/linux)

For a long time I've wanted to write in org-mode and export it to latex,
but I've never been successful until now. So here is a yasnippet that
allows you to do it -

--8<---------------cut here---------------start------------->8---
# -*- mode: snippet -*-
# name: org2latex
# key: org2latex
# --
#+TITLE: foobar
#+LaTeX_HEADER: \usepackage[utf8]{inputenc}
#+LaTeX_HEADER: \usepackage[T1]{fontenc} 
#+LaTeX_HEADER: \usepackage{palatino}
#+LaTeX_HEADER: \usepackage{fixltx2e}
#+latex_header: 
\usepackage[backend=biber,style=philosophy-modern,doi=true,hyperref=true,backref=true,backrefstyle=two,date=year,maxcitenames=3]{biblatex}
#+LATEX_HEADER: \addbibresource{~/foo/foo/foo.bib}
#+LATEX_HEADER: \usepackage{makeidx}
#+latex_header: \makeindex
#+latex_header: \usepackage[acronym]{glossaries}
#+latex_header: \makeglossaries
#+latex_header: \usepackage[unhide]{todo}
#+latex_header: \usepackage{everypage}
#+latex_header: \usepackage{draftwatermark}
#+latex_header: \usepackage{hyperref}
#+latex_header: 
\hypersetup{colorlinks,linkcolor={red},citecolor={magenta},urlcolor={blue}}
# #+options: num:nil

#+OPTIONS: toc:2

\clearpage
\renewcommand{\thesection}{}
\renewcommand{\thesubsection}{}
\renewcommand{\thesubsubsection}{}

\input{foo.glos}
\input{foo.acro}

/foo/ Your main text goes here /foo/

'glos' is your glossary file, and 'acro' is your acronyms file, and 'bib' is 
your biblatex references.

'foo.glos' ;; needs to be a proper latex glossary file
'foo.acro' ;; needs to be a proper latex acronym file
'foo.bib' ;; needs to be a proper latex bib file, I'm using 'JabRef' for it.

This file will accept a 'cite:foo' for biblatex references, and also 
'\gls{foo}' for glossary and
acronym entries, and '\index{foo}' for index entries.

You *must* give the complete path of your 'foo.bib' file as it sets up where 
every other file can be
found.

This works with a complete setup of 'TexLive 2015'. 

\todo{This is how your 'TODO' items should appear}


\clearpage

\addcontentsline{toc}{chapter}{Glossary}

\printglossaries


\clearpage

\addcontentsline{toc}{chapter}{References}


\printbibliography



\clearpage

\addcontentsline{toc}{chapter}{Index}

\printindex

\todos

\end{document}
--8<---------------cut here---------------end--------------->8---

If you don't like something, then comment it out and do a rebuild to see
if your modification works.

To use -
a - 'C-c C-e l l' to get a latex tex file
b - Then use your favourite tex command to build it into a PDF file. I
use my 'pdfbuild' file which I've uploaded to my blog "A taste of linux".

The above template will give you a nice PDF file with a table of
contents, every page with a watermark on saying 'DRAFT', the ability to
put '\todo{comments}' in to show you what needs to be done at that
point. And if you've set them up, a bibliography, glossary and acronyms
and an index.

As they say in Parliament "I commend it to the house." :)

And I hope its useful for you?

Sharon.
-- 
A taste of linux = http://www.sharons.org.uk
TGmeds = http://www.tgmeds.org.uk
Debian 8.4, fluxbox 1.3.7, emacs 25.0.92

Attachment: signature.asc
Description: PGP signature


reply via email to

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