org-mode-poster/src/org-mode-poster_poster.org

323 lines
10 KiB
Org Mode
Raw Normal View History

2018-04-02 10:57:06 +02:00
#+startup: beamer
#+TITLE: A scientific poster entirely written in org-mode
#+TITLE: using GNU emacs and the beamer library
* Preamble :ignore:
** General comments :ignore:
# ----------------------------------------------------------------------
# - Turn on synonyms by starting synosaurus-mode
# - Look up words using C-c sr
# - Turn on dictionary by starting flyspell-mode
# - Count words by section using org-wc-display
# ----------------------------------------------------------------------
** Specific comments for this manuscript :ignore:
# ----------------------------------------------------------------------
** org specific settings :ignore:
# ----------------------------------------------------------------------
#+OPTIONS: email:nil toc:nil num:nil author:nil date:t tex:t title:nil
#+STARTUP: align fold
#+SEQ_TODO: TODO(t) | DONE(d)
#+TAGS: figure(f) check(c) noexport(n) ignore(i)
#+LANGUAGE: en
#+EXCLUDE_TAGS: noexport TODO
#+DATE: {{{time(%Y-%m-%d %H:%M)}}}
# ----------------------------------------------------------------------
** Latex header :ignore:
# ----------------------------------------------------------------------
#+LATEX_CLASS: mybeamerposter
#+LATEX_HEADER: \setlength{\paperwidth}{36in}
#+LATEX_HEADER: \setlength{\paperheight}{48in}
#+LATEX_HEADER: \setlength{\textwidth}{0.98\paperwidth}
#+LATEX_HEADER: \setlength{\textheight}{0.98\paperheight}
#+LATEX_HEADER: \graphicspath{{../output/figures/}{../lib/}}
#+LATEX_HEADER: \usepackage[export]{adjustbox}
#+LATEX_HEADER: \usepackage{graphicx,caption}
2018-04-02 19:40:42 +02:00
#+LATEX_HEADER: \usepackage{minted}
2018-04-02 10:57:06 +02:00
#+LATEX_HEADER: \usepackage{eurosym}
2018-04-02 19:40:42 +02:00
#+LATEX_HEADER: \usepackage{listings}
2018-04-02 10:57:06 +02:00
#+LATEX_HEADER: \usepackage{textcomp}
#+LATEX_HEADER: \usepackage{bibentry}
2018-04-03 00:45:58 +02:00
#+LATEX_HEADER: \newcommand\sumin{\sum_{i=1}^{n}}
#+LATEX_HEADER: \newcommand{\Xoi}[1]{#1(i)}
#+LATEX_HEADER: \newcommand{\frakPQ}[2]{\frac{\Xoi{#1}}{\Xoi{#2}}}
#+LATEX_HEADER: \newcommand{\DKLPQ}[3]{D_{\mathrm{KL}}(#1 #3 #2)}
2018-04-02 10:57:06 +02:00
#+LATEX_HEADER: \date{}
# ----------------------------------------------------------------------
** Authors and affiliations :ignore:
# ----------------------------------------------------------------------
#+LATEX_HEADER: \author{
#+LATEX_HEADER: Philipp Homan$^{1}$,
#+LATEX_HEADER: \\
#+LATEX_HEADER: \normalsize{$^{1}$Department of Psychiatry,}
#+LATEX_HEADER: \normalsize{The Donald and Barbara Zucker}
#+LATEX_HEADER: \normalsize{School of Medicine at Northwell/Hofstra,}
2018-04-02 19:40:42 +02:00
#+LATEX_HEADER: \normalsize{Hempstead, NY}
2018-04-02 10:57:06 +02:00
#+LATEX_HEADER: }
# ----------------------------------------------------------------------
** Buffer-wide source code blocks :ignore:
# ----------------------------------------------------------------------
# Set elisp variables need for nice formatting We want no new lines in
# inline results and a paragraph size of 80 characters Important: this
# has to be evaluated witch C-c C-c in order to work in the current
# buffer
#+BEGIN_SRC emacs-lisp :exports none :results silent
2018-04-02 19:40:42 +02:00
; Nicer formatting for code
(setq org-latex-listings t)
(setq org-latex-listings 'minted)
'(org-export-latex-listings-langs (quote ((emacs-lisp "Lisp") (lisp "Lisp") (clojure "Lisp") (c "C") (cc "C++") (fortran "fortran") (perl "Perl") (cperl "Perl") (python "Python") (ruby "Ruby") (html "HTML") (xml "XML") (tex "TeX") (latex "TeX") (shell-script "bash") (gnuplot "Gnuplot") (ocaml "Caml") (caml "Caml") (sql "SQL") (sqlite "sql") (R-mode "R"))))
(setq org-latex-minted-options
'(("linenos=true")))
2018-04-02 10:57:06 +02:00
; set timestamp format
;(setq org-export-date-timestamp-format "%FT%T%z")
(require 'org-wc)
(flyspell-mode t)
;(evil-declare-change-repeat 'company-complete)
(setq synosaurus-choose-method 'popup)
(synosaurus-mode t)
(auto-complete-mode t)
;(ac-config-default)
;(add-to-list 'ac-modes 'org-mode)
(linum-mode t)
(whitespace-mode t)
(setq org-babel-inline-result-wrap "%s")
(setq org-export-with-broken-links "mark")
(setq fill-column 72)
(setq whitespace-line-column 72)
;(setq org-latex-caption-above '(table image))
(setq org-latex-caption-above nil)
(org-toggle-link-display)
; don't remove logfiles at export
(setq org-latex-remove-logfiles nil)
; Keybindings
; (global-set-key (kbd "<f7> c") "#+CAPTION: ")
(defun setfillcolumn72 ()
(interactive)
(setq fill-column 72)
)
(defun setfillcolumn42 ()
(interactive)
(setq fill-column 42)
)
(define-key org-mode-map (kbd "C-c c #") "#+CAPTION: ")
(define-key org-mode-map (kbd "C-c l #") "#+LATEX_HEADER: ")
(define-key org-mode-map (kbd "C-c f c 4 2") 'setfillcolumn42)
(define-key org-mode-map (kbd "C-c f c 7 2") 'setfillcolumn72)
(setq org-odt-category-map-alist
'(("__Figure__" "*Figure*" "value" "Figure" org-odt--enumerable-image-p)))
; let ess not ask for starting directory
(setq ess-ask-for-ess-directory nil)
;(setq org-latex-pdf-process '("latexmk -pdflatex='xelatex
;-output-directory=../output/tex/ -interaction nonstopmode' -pdf
;-bibtex -f %f"))
(setq org-latex-logfiles-extensions
(quote("bcf" "blg" "fdb_latexmk" "fls"
"figlist" "idx" "log" "nav" "out" "ptc"
"run.xml" "snm" "toc" "vrb" "xdv")))
; deactivate link resolving
(setq org-activate-links nil)
#+END_SRC
#
#
#
# ----------------------------------------------------------------------
** End preamble :ignore:
# ----------------------------------------------------------------------
* The poster
:PROPERTIES:
:BEGIN:
:BEAMER_env: fullframe
:END:
** Code :ignore:
# Babel code can go here to populate the poster with dynamic output from
# statistical calculations
** Left column :BMCOL:
:PROPERTIES:
2018-04-02 19:40:42 +02:00
:BEAMER_col: 0.45
2018-04-02 10:57:06 +02:00
:BEAMER_opt: [t]
:END:
*** Background :B_block:
:PROPERTIES:
:BEAMER_env: block
:END:
- Org-mode is not only useful for producing blog posts and even
2018-04-02 19:40:42 +02:00
scientific manuscripts; it is also perfectly suitable to make
decent looking scientific posters
2018-04-02 10:57:06 +02:00
- We combine a relatively simple custom \LaTeX style file and common
org-mode syntax
2018-04-02 19:40:42 +02:00
- The nice thing about org-mode is that we can populate the poster with
code, graphs and numbers from inline code in languages such as R,
python, Matlab and even shell scripting
- Inline code would look like this, which will produce a graph
(Fig. [[figcode1]]):
2018-04-02 10:57:06 +02:00
2018-04-02 19:40:42 +02:00
**** Block
2018-04-02 10:57:06 +02:00
:PROPERTIES:
2018-04-02 19:40:42 +02:00
:BEAMER_col: 0.48
:BEAMER_opt: [T]
2018-04-02 10:57:06 +02:00
:END:
2018-04-02 19:40:42 +02:00
#+NAME: code1
#+BEGIN_SRC R :session :export both :results output graphics :file 3.png
x <- rnorm(100, 0, 1)
hist(x, col="gray")
#+END_SRC
#+RESULTS: code1
[[file:3.png]]
#+NAME: figcode1
#+CAPTION: This is the output.
[[file:3.png]]
2018-04-02 10:57:06 +02:00
2018-04-03 00:45:58 +02:00
*** Inline code and tables :B_block:
2018-04-02 10:57:06 +02:00
:PROPERTIES:
:BEAMER_env: block
:END:
2018-04-02 19:40:42 +02:00
- In addition to inline code, we can also produce tables
- Tables are very powerful in org-mode, they even include spreadsheet
capabilities
- Some code to process the vector from above to make a table out of its
summary could look like this, which would result in a little table
(Table [[tabcode2]]) :
**** Block
:PROPERTIES:
:BEAMER_col: 0.48
:BEAMER_opt: [T]
:END:
#+NAME: code2
#+BEGIN_SRC R :session :exports both :results value :colnames yes :cache yes
m <- round(mean(x), 2)
s <- round(sd(x), 2)
data.frame(Mean=m, SD=s)
#+END_SRC
\vspace{2cm}
#+CAPTION: A table.
#+NAME: tabcode2
#+RESULTS[31e41e0f8cc2db2fb601af81fe4f5e218ea48f57]: code2
|-------+------|
| Mean | SD |
|-------+------|
| -0.07 | 0.97 |
|-------+------|
2018-04-02 10:57:06 +02:00
** Right column :BMCOL:
:PROPERTIES:
2018-04-02 19:40:42 +02:00
:BEAMER_col: 0.45
2018-04-02 10:57:06 +02:00
:BEAMER_opt: [t]
:END:
2018-04-03 00:45:58 +02:00
*** Graphics :B_block:
2018-04-02 10:57:06 +02:00
:PROPERTIES:
:BEAMER_env: block
:END:
2018-04-02 19:40:42 +02:00
- Of course we can also include graphics
- Here, we use shell scripting to grab an image with curl from the
internet (Fig. [[figcode3]]):
2018-04-02 10:57:06 +02:00
2018-04-02 19:40:42 +02:00
**** Block
:PROPERTIES:
:BEAMER_col: 0.78
:BEAMER_opt: [T]
:END:
2018-04-02 10:57:06 +02:00
2018-04-02 21:25:40 +02:00
\footnotesize
2018-04-02 19:40:42 +02:00
#+NAME: code3
2018-04-02 21:25:40 +02:00
#+BEGIN_SRC bash :exports both :file emacs.png
2018-04-02 19:40:42 +02:00
curl -0 https://www.gnu.org/software/emacs/images/emacs.png
#+END_SRC
\normalsize
\vspace{2cm}
#+ATTR_LATEX: :width 0.2\textwidth :options page=9
#+NAME: figcode3
#+CAPTION: This is the downloaded image.
#+RESULTS: code3
[[file:emacs.png]]
2018-04-03 00:45:58 +02:00
*** Math :B_block:
:PROPERTIES:
:BEAMER_env: block
:END:
- We can easily include math:
**** Block
:PROPERTIES:
:BEAMER_col: 0.78
:BEAMER_opt: [T]
:END:
The Kullback-Leibler (KL) divergence measures the difference between two
probability distributions (i.e., the loss of information when one
distribution is used to approximate another). The KL divergence is thus
defined as
\begin{align}
\label{eq:KL}
\DKLPQ{P}{Q}{\|} = \sumin \Xoi{P} \log \frakPQ{P}{Q}
\end{align}
with $P$ and $Q$ being two probability distribution functions and $n$
the number of sample points. Since $\DKLPQ{P}{Q}{\|}$ is not equal to
$\DKLPQ{Q}{P}{\|}$, a symmetric variation of the KL divergence can be
derived as follows:
\begin{align}
\label{eq:KL2}
\DKLPQ{P}{Q}{,} = \sumin \Big(\Xoi{P} \log \frakPQ{P}{Q} + \Xoi{Q} \log \frakPQ{Q}{P} \Big).
\end{align}
*** Columns :B_block:
2018-04-02 10:57:06 +02:00
:PROPERTIES:
:BEAMER_env: block
:END:
**** Left
:PROPERTIES:
:BEAMER_col: 0.48
:BEAMER_opt: [T]
:END:
\captionsetup{justification=justified,width=.8\linewidth}
#+NAME: figge
2018-04-02 19:40:42 +02:00
#+CAPTION: *This is the left figure of a two-column block*
2018-04-02 10:57:06 +02:00
#+ATTR_LATEX: :width 0.9\textwidth :options page=3
[[file:org-mode-poster-4.png]]
**** Right
:PROPERTIES:
:BEAMER_col: 0.48
:BEAMER_opt: [T]
:END:
\captionsetup{justification=justified,width=.8\linewidth}
#+NAME: figclus
2018-04-02 19:40:42 +02:00
#+CAPTION: *This is the right figure.*
2018-04-02 10:57:06 +02:00
#+ATTR_LATEX: :width 0.9\textwidth :options page=9
[[file:org-mode-poster-4.png]]
*** Conclusions :B_block:
:PROPERTIES:
:BEAMER_env: block
:END:
2018-04-02 19:40:42 +02:00
- This little example is meant to show how incredibly versatile
org-mode is
- One can now produce scientific posters with a simple text editor