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

374 lines
12 KiB
Org Mode
Raw Normal View History

2018-04-02 10:57:06 +02:00
#+startup: beamer
2018-04-03 15:37:28 +02:00
#+TITLE: Using org-mode for scientific posters
2018-04-02 10:57:06 +02:00
* 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
# ----------------------------------------------------------------------
2018-04-03 15:37:28 +02:00
** Specific comments for this manuscript :ignore:
2018-04-02 10:57:06 +02:00
# ----------------------------------------------------------------------
2018-04-03 15:37:28 +02:00
# This is a comment
# ----------------------------------------------------------------------
** org specific settings :ignore:
2018-04-02 10:57:06 +02:00
# ----------------------------------------------------------------------
#+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)}}}
# ----------------------------------------------------------------------
2018-04-03 15:37:28 +02:00
** Latex header :ignore:
2018-04-02 10:57:06 +02:00
# ----------------------------------------------------------------------
#+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-04 11:51:27 +02:00
#+LATEX_HEADER: \date{}
# ----------------------------------------------------------------------
** Latex macros :ignore:
# ----------------------------------------------------------------------
2018-04-03 15:37:28 +02:00
#+LATEX_HEADER: \newcommand{\auth}{Philipp Homan, MD, PhD}
#+LATEX_HEADER: \newcommand{\authemail}{phoman1@northwell.edu}
#+LATEX_HEADER: \newcommand{\authtwitter}{@philipphoman}
#+LATEX_HEADER: \newcommand{\authgithub}{github.com/philipphoman}
2018-04-02 10:57:06 +02:00
# ----------------------------------------------------------------------
2018-04-03 15:37:28 +02:00
** Authors and affiliations :ignore:
2018-04-02 10:57:06 +02:00
# ----------------------------------------------------------------------
#+LATEX_HEADER: \author{
2018-04-03 15:37:28 +02:00
#+LATEX_HEADER: Philipp Homan$^{1}$
2018-04-02 10:57:06 +02:00
#+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: }
# ----------------------------------------------------------------------
2018-04-03 15:37:28 +02:00
** Buffer-wide source code blocks :ignore:
2018-04-02 10:57:06 +02:00
# ----------------------------------------------------------------------
# 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)
2018-04-04 11:51:27 +02:00
'(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"))))
2018-04-02 19:40:42 +02:00
(setq org-latex-minted-options
2018-04-03 04:17:52 +02:00
'(("linenos=true") ("bgcolor=lightgray")))
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
#
#
#
# ----------------------------------------------------------------------
2018-04-04 11:51:27 +02:00
** End preamble :ignore:
2018-04-02 10:57:06 +02:00
# ----------------------------------------------------------------------
* The poster
:PROPERTIES:
:BEGIN:
:BEAMER_env: fullframe
:END:
** Code :ignore:
2018-04-03 02:00:34 +02:00
# Babel code can go here to populate the poster with dynamic output
2018-04-02 10:57:06 +02:00
2018-04-03 02:00:34 +02:00
** Left column :BMCOL:
2018-04-02 10:57:06 +02:00
: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 02:00:34 +02:00
*** Background :B_block:
2018-04-02 10:57:06 +02:00
:PROPERTIES:
:BEAMER_env: block
:END:
2018-04-03 15:37:28 +02:00
- Here we show how org-mode (version src_elisp{org-version}
2018-04-04 11:51:27 +02:00
{{{results(9.1.7)}}}) and emacs (version src_elisp{emacs-version}
{{{results(25.2.2)}}}) can be used to make decent looking scientific
posters
2018-04-03 15:37:28 +02:00
- With org-mode we can populate the poster with code, graphs and numbers
from inline code in languages such as R, python, Matlab and even shell
scripting
2018-04-04 11:51:27 +02:00
- For example, this poster was created on {{{time(%Y-%m-%d %H:%M)}}} on
src_bash{lsb_release -sd} {{{results(Ubuntu 17.10)}}}.
2018-04-03 15:37:28 +02:00
- Inline code could 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-03 04:17:52 +02:00
:BEAMER_col: 0.68
2018-04-02 19:40:42 +02:00
:BEAMER_opt: [T]
2018-04-02 10:57:06 +02:00
:END:
2018-04-02 19:40:42 +02:00
#+NAME: code1
2018-04-03 02:00:34 +02:00
#+BEGIN_SRC R :file 3.png :session :exports both :results graphics
set.seed(20180402)
x1 <- rnorm(100, 0, 1)
x2 <- rnorm(100, 0.5, 1)
hist(x1, col="red")
hist(x2, col="blue", add=TRUE)
2018-04-02 19:40:42 +02:00
#+END_SRC
#+NAME: figcode1
#+CAPTION: This is the output.
2018-04-03 02:00:34 +02:00
#+RESULTS: code1
2018-04-02 19:40:42 +02:00
[[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
2018-04-03 02:00:34 +02:00
- Some code to process the first vector from above to make a table out
of its summary could look like this, which would result in a little
table (Table [[tabcode2]]) :
2018-04-02 19:40:42 +02:00
**** Block
:PROPERTIES:
2018-04-03 04:17:52 +02:00
:BEAMER_col: 0.78
2018-04-02 19:40:42 +02:00
:BEAMER_opt: [T]
:END:
#+NAME: code2
#+BEGIN_SRC R :session :exports both :results value :colnames yes :cache yes
2018-04-03 02:00:34 +02:00
library(broom)
library(dplyr)
t1 <- tidy(round(summary(x1), 2))
t2 <- tidy(round(summary(x2), 2))
# This will export as a table
rbind(t1, t2) %>%
mutate(name=c("x1", "x2"))
2018-04-02 19:40:42 +02:00
#+END_SRC
\vspace{2cm}
2018-04-03 02:00:34 +02:00
#+CAPTION: A table summarizing the two distributions.
2018-04-02 19:40:42 +02:00
#+NAME: tabcode2
2018-04-03 02:00:34 +02:00
#+RESULTS[9d0ec7348265a5cb6de39440ff06a8dbb8e5ecf1]: code2
|---------+-------+--------+------+------+---------+------|
| minimum | q1 | median | mean | q3 | maximum | name |
|---------+-------+--------+------+------+---------+------|
| -2.29 | -0.49 | 0.11 | 0.14 | 0.8 | 2.47 | x1 |
| -2.17 | -0.45 | 0.07 | 0.13 | 0.85 | 2.23 | x2 |
|---------+-------+--------+------+------+---------+------|
** Right column :BMCOL:
2018-04-02 10:57:06 +02:00
: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 02:00:34 +02:00
*** Graphics :B_block:
2018-04-02 10:57:06 +02:00
:PROPERTIES:
:BEAMER_env: block
:END:
2018-04-03 02:00:34 +02:00
- We can use shell scripting to grab an image with curl from the
2018-04-02 19:40:42 +02:00
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-03 02:00:34 +02:00
# Download emacs icon from gnu.org
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 02:00:34 +02:00
*** Math :B_block:
2018-04-03 00:45:58 +02:00
:PROPERTIES:
:BEAMER_env: block
:END:
2018-04-03 02:00:34 +02:00
- We can easily include math
- For example, let's describe how to compute the distance between the
two simulated distributions $x1$ and $x2$ from before:
2018-04-03 00:45:58 +02:00
**** 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}
2018-04-03 02:00:34 +02:00
*** 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:
2018-04-03 02:00:34 +02:00
#+NAME: codeleft
2018-04-03 04:17:52 +02:00
#+BEGIN_SRC R :file 4l.png :session :exports results :results graphics
2018-04-03 02:00:34 +02:00
d1 <- density(x1)
plot(d1, col="red", lwd=3)
#+END_SRC
\captionsetup{justification=justified,width=.85\linewidth}
#+NAME: figcodeleft
#+CAPTION: This is the left figure of a two-column block, showing
#+CAPTION: the density of $x1$.
#+RESULTS: codeleft
[[file:4l.png]]
2018-04-02 10:57:06 +02:00
**** Right
:PROPERTIES:
:BEAMER_col: 0.48
:BEAMER_opt: [T]
:END:
2018-04-03 02:00:34 +02:00
#+NAME: coderight
2018-04-03 04:17:52 +02:00
#+BEGIN_SRC R :file 4r.png :session :exports results :results graphics
2018-04-03 02:00:34 +02:00
d2 <- density(x2)
plot(d2, col="blue", lwd=3)
#+END_SRC
\captionsetup{justification=justified,width=.85\linewidth}
#+NAME: figcoderight
#+CAPTION: This is the right figure. It shows the density of $x2$.
#+RESULTS: coderight
[[file:4r.png]]
2018-04-02 10:57:06 +02:00
2018-04-03 02:00:34 +02:00
*** Conclusions :B_block:
2018-04-02 10:57:06 +02:00
:PROPERTIES:
:BEAMER_env: block
:END:
2018-04-03 15:37:28 +02:00
- This little example is meant to show how versatile org-mode is
2018-04-03 02:00:34 +02:00
- Scientific posters can be produced with a simple text editor
2018-04-03 15:37:28 +02:00