literate-programming-tutorials/epj/epj-template.org
2018-12-16 16:37:14 -07:00

306 lines
9.4 KiB
Org Mode

# -*- mode: org; org-confirm-babel-evaluate: nil; org-babel-noweb-wrap-start: "«"; org-babel-noweb-wrap-end: "»"; -*-
#+TITLE: Title Goes Here
#+SUBTITLE: Subtitle Goes Here
* Authors
#+NAME: authors-table
| Author | Email | Institution-ID |
|-----------------+----------------------+----------------|
| Mai Deah | mai.deah@example.edu | 1 |
| Arthur Secondus | | 1 |
| E. Tal | | 2 |
* Institutions
#+NAME: institutions-table
| Institution-ID | Institution |
|----------------+------------------------------------------------------------------------------------------------------------------|
| 1 | New Discoveries Lab, Department of Something-or-Ruther, University of Some-Sort, Some-Sort, Some-Sort-of-Country |
| 2 | Golden Opportunities Lab, Department of Obscure Studies, Ancient College, Olde-Locale, Stodgy-Land |
* Abstract
* PACS
#+NAME: pacs-codes-table
| PACS-KEY | PACS-KEY-Description-Text |
|------------+----------------------------|
| PACS-key01 | Text Describing PACS-key01 |
| PACS-key02 | Text Describing PACS-key02 |
* Introduction
* Latex Template :noexport:
#+NAME: european-physical-journal-latex-template
#+BEGIN_SRC latex :eval never :noweb yes
%%%%%%%%%%%%%%%%%%%%%%% file template.tex %%%%%%%%%%%%%%%%%%%%%%%%%
%
% This is a template file for The European Physical Journal
%
% Copy it to a new file with a new name and use it as the basis
% for your article
%
%%%%%%%%%%%%%%%%%%%%%%%% Springer-Verlag %%%%%%%%%%%%%%%%%%%%%%%%%%
%
\begin{filecontents}{leer.eps}
%!PS-Adobe-2.0 EPSF-2.0
%%CreationDate: Mon Jul 13 16:51:17 1992
%%DocumentFonts: (atend)
%%Pages: 0 1
%%BoundingBox: 72 31 601 342
%%EndComments
gsave
72 31 moveto
72 342 lineto
601 342 lineto
601 31 lineto
72 31 lineto
showpage
grestore
%%Trailer
%%DocumentFonts: Helvetica
\end{filecontents}
%
\documentclass[epj]{svjour}
% Remove option referee for final version
%
% Remove any % below to load the required packages
%\usepackage{latexsym}
\usepackage{graphics}
% etc
%
\begin{document}
%
\title{«get-title-text()»}
\subtitle{«get-subtitle-text()»}
\author{«epj-authors-latex()»% etc
% \thanks is optional - remove next line if not needed
\thanks{\emph{Present address:} Insert the address here if needed}%
} % Do not remove
%
\offprints{} % Insert a name or remove this line
%
\institute{«epj-institutions-latex()»}
%
\date{Received: date / Revised version: date}
% The correct dates will be entered by Springer
%
\abstract{
«get-abstract-text()»
%
\PACS{
«epj-pacs-codes-latex()»
} % end of PACS codes
} %end of abstract
%
\maketitle
%
\section{Introduction}
\label{intro}
«get-introduction-text()»
\section{Section title}
\label{sec:1}
and \cite{RefJ}
\subsection{Subsection title}
\label{sec:2}
as required. Don't forget to give each section
and subsection a unique label (see Sect.~\ref{sec:1}).
%
% For one-column wide figures use
\begin{figure}
% Use the relevant command for your figure-insertion program
% to insert the figure file.
% For example, with the option graphics use
\resizebox{0.75\textwidth}{!}{%
\includegraphics{leer.eps}
}
% If not, use
%\vspace{5cm} % Give the correct figure height in cm
\caption{Please write your figure caption here}
\label{fig:1} % Give a unique label
\end{figure}
%
% For two-column wide figures use
\begin{figure*}
% Use the relevant command for your figure-insertion program
% to insert the figure file. See example above.
% If not, use
\vspace*{5cm} % Give the correct figure height in cm
\caption{Please write your figure caption here}
\label{fig:2} % Give a unique label
\end{figure*}
%
% For tables use
\begin{table}
\caption{Please write your table caption here}
\label{tab:1} % Give a unique label
% For LaTeX tables use
\begin{tabular}{lll}
\hline\noalign{\smallskip}
first & second & third \\
\noalign{\smallskip}\hline\noalign{\smallskip}
number & number & number \\
number & number & number \\
\noalign{\smallskip}\hline
\end{tabular}
% Or use
\vspace*{5cm} % with the correct table height
\end{table}
%
% BibTeX users please use
% \bibliographystyle{}
% \bibliography{}
%
% Non-BibTeX users please use
\begin{thebibliography}{}
%
% and use \bibitem to create references.
%
\bibitem{RefJ}
% Format for Journal Reference
Author, Journal \textbf{Volume}, (year) page numbers.
% Format for books
\bibitem{RefB}
Author, \textit{Book title} (Publisher, place year) page numbers
% etc
\end{thebibliography}
\end{document}
% end of file template.tex
#+END_SRC
** Latex Output
#+BEGIN_SRC latex :noweb yes :eval never :tangle yes
«european-physical-journal-latex-template»
#+END_SRC
** Template Utility Code
*** get-title-text
#+NAME: get-title-text
#+BEGIN_SRC elisp
(format "%s" (car (plist-get (org-export-get-environment) ':title)))
#+END_SRC
#+RESULTS: get-title-text
: Title Goes Here
*** get-subtitle-text
#+NAME: get-subtitle-text
#+BEGIN_SRC elisp :results replace :var keyword="subtitle" :var delimiter=" "
(mapconcat 'car (org-element-map
(org-element-parse-buffer)
'(keyword)
(lambda (x) (if (string= (upcase keyword) (org-element-property :key x))
(list (org-element-property :value x)) )
)
) delimiter)
#+END_SRC
#+RESULTS: get-subtitle-text
: Subtitle Goes Here
*** get-introduction-text
#+NAME: get-introduction-text
#+BEGIN_SRC elisp :results latex replace :var keyword="introduction" :var deliminator="\\par\n"
(mapconcat 'identity(org-element-map (org-element-map
(org-element-parse-buffer)
'(headline)
(lambda (hl) (if (string= (upcase keyword) (upcase (org-element-property :raw-value hl)))
hl)
)
nil t)
'(paragraph)
(lambda (p)
(format "%s" (replace-regexp-in-string (rx (or (: bos (* (any " \t\n")))
(: (* (any " \t\n")) eos)))
""
(buffer-substring-no-properties (org-element-property :contents-begin p) (org-element-property :contents-end p))))
)
nil nil)
deliminator)
#+END_SRC
*** get-abstract-text
#+NAME: get-abstract-text
#+BEGIN_SRC elisp :results replace :var keyword="abstract"
(org-element-map (org-element-map
(org-element-parse-buffer)
'(headline)
(lambda (hl) (if (string= (upcase keyword) (upcase (org-element-property :raw-value hl)))
hl)
)
nil t)
'(paragraph)
(lambda (p)
(format "%s" (replace-regexp-in-string (rx (or (: bos (* (any " \t\n")))
(: (* (any " \t\n")) eos)))
""
(buffer-substring-no-properties (org-element-property :contents-begin p) (org-element-property :contents-end p))))
)
nil t)
#+END_SRC
*** epj-pacs-codes-latex
#+NAME: epj-pacs-codes-latex
#+BEGIN_SRC elisp :var pacs_codes=pacs-codes-table :results latex replace :var join_delim=" \\and\n"
(mapconcat 'identity (mapcar (lambda (x) (format " {%s}{%s}" (car x) (nth 1 x))) pacs_codes) join_delim)
#+END_SRC
#+RESULTS: epj-pacs-codes-latex
#+BEGIN_EXPORT latex
{PACS-key01}{Text Describing PACS-key01} \and
{PACS-key02}{Text Describing PACS-key02}
#+END_EXPORT
*** epj-authors-latex
#+NAME: epj-authors-latex
#+BEGIN_SRC elisp :var authors=authors-table :results latex replace :var join_delim=" \\and "
(mapconcat 'identity (mapcar (lambda (x) (format "%s\\inst{%s}" (car x) (nth 2 x))) authors) join_delim)
#+END_SRC
#+RESULTS: epj-authors-latex
#+BEGIN_EXPORT latex
Mai Deah\inst{1} \and Arthur Secondus\inst{1} \and E. Tal\inst{2}
#+END_EXPORT
*** epj-institutions-latex
#+NAME: epj-institutions-latex
#+BEGIN_SRC elisp :var institutions=institutions-table :results latex replace :var join_delim=" \\and "
(mapconcat 'identity (mapcar (lambda (x) (format "%s" (nth 1 x))) institutions) join_delim)
#+END_SRC
#+RESULTS: epj-institutions-latex
#+BEGIN_EXPORT latex
New Discoveries Lab, Department of Something-or-Ruther, University of Some-Sort, Some-Sort, Some-Sort-of-Country \and Golden Opportunities Lab, Department of Obscure Studies, Ancient College, Olde-Locale, Stodgy-Land
#+END_EXPORT
* Common Export Settings :noexport:
#+OPTIONS: ':nil *:t -:t ::t <:t H:7 \n:nil ^:{} arch:headline
#+OPTIONS: author:t broken-links:nil c:nil creator:nil
#+OPTIONS: d:(not "LOGBOOK") date:t e:t email:nil f:t inline:t num:nil
#+OPTIONS: p:nil pri:nil prop:nil stat:t tags:t tasks:t tex:t
#+OPTIONS: timestamp:t title:t toc:nil todo:t |:t
#+SELECT_TAGS: export
#+EXCLUDE_TAGS: noexport
# For Display when file is exported with org-ruby
#+EXPORT_SELECT_TAGS: export
#+EXPORT_EXCLUDE_TAGS: noexport