Skip to content
Permalink
Browse files
add org example
  • Loading branch information
James Brusey committed Mar 25, 2022
1 parent 432b5df commit 97296a8a85da9cbba871913648facc553641c815
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 0 deletions.
@@ -0,0 +1,120 @@
#+title: Example research paper written with org mode
#+author: James Brusey
#+options: toc:nil
#+property: header-args:ipython :session eg-sess :results output raw drawer :exports results
#+latex_class: IEEEtran
#+latex_header: \input{header}
#+begin_abstract
Every abstract should have 4 parts: motive, method, results, conclusions.
Use no more than 3 sentences for each.
Aim for about 100 words.
#+end_abstract
* Introduction
The introduction should not just repeat the abstract but should properly introduce the topic.

Towards the end of the introduction, there should be a statement about what the contribution of the paper.
In computer science these days, it is common to use a bullet pointed list with forward references to sections where that contribution can be found.
* Related work
When it comes to citing references, org-ref is pretty cool. For example, I can cite a work [[cite:&kitchinExamplesEffectiveData2015]], and this will then show up in the references [[cite:&wilkinsModellingUncontrolledSolar2018]].
* Methods and materials
In the method section, you might have a diagram.

#+caption: By putting a caption on the diagram, org-mode automatically changes it to a floating figure.
#+attr_latex: :width 0.3\columnwidth
[[file:heartbeat-0.pdf]]

* Results
While you can manually enter tables in org-mode, such as in autoref:table1.
#+latex: \sisetup{round-mode=places}

#+caption: Tables also can be floats. This example shows the power of using siunitx. label:table1
#+attr_latex: :align lSS
| Class | \protect{Mean} | \protect{Std} |
|-------+----------------+---------------|
| a | 0.2 | 1.203030 |
| b | 1.234e-1 | 3.8e-3 |
| | | |

A similar table can be produced using code, as in autoref:table2.

#+BEGIN_SRC ipython
import pandas as pd
import numpy as np
import tabulate

df = pd.read_csv("../all.csv")
result = pd.melt(df).groupby("variable").agg(["mean", "std"])
print("""
#+caption: This table was produced from the all.csv data-set. label:table2
#+attr_latex: :align lSS""")

print(
tabulate.tabulate(result, tablefmt="orgtbl", headers=["Class", "\protect{mean}", "\protect{std}"]),
)
#+END_SRC

#+RESULTS:
:results:

#+caption: This table was produced from the all.csv data-set. label:table2
#+attr_latex: :align lSS
| Class | \protect{mean} | \protect{std} |
|---------+------------------+-----------------|
| a | 4.3 | 3.16394 |
| b | -0.114247 | 1.00812 |
| c | 4.72661 | 3.85745 |
:end:

#+BEGIN_SRC ipython
%matplotlib inline
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
df = pd.read_csv("../all.csv")
plt.figure()
plt.plot(df['a'], df['b'], '.')
plt.show()

#+END_SRC

#+RESULTS:
:results:
# Out [2]:
# text/plain
: <Figure size 432x288 with 1 Axes>

# image/png
[[file:obipy-resources/2abc833ac46639e8c3c3db1b162ed52c45494cc7/2b10c27d7fec897b3ebf8364b6da6e8b674ac4e0.png]]
:end:


* Conclusions
In conclusion, there are many interesting tools for helping with increasing automation and thus reducing errors.

bibliography:~/Documents/zotero-export.bib
bibliographystyle:plain
* Needed for adding IEEEtran class :noexport:

#+BEGIN_SRC emacs-lisp
(add-to-list 'org-latex-classes
'("IEEEtran"
"\\documentclass\[10pt\]\{IEEEtran\}"
("\\section\{%s\}" . "\\section*\{%s\}")
("\\subsection\{%s\}" . "\\subsection*\{%s\}")
("\\subsubsection\{%s\}" . "\\subsubsection*\{%s\}")
("\\paragraph\{%s\}" . "\\paragraph*\{%s\}")
))

#+END_SRC

#+RESULTS:
| IEEEtran | \documentclass[10pt]{IEEEtran} | (\section{%s} . \section*{%s}) | (\subsection{%s} . \subsection*{%s}) | (\subsubsection{%s} . \subsubsection*{%s}) | (\paragraph{%s} . \paragraph*{%s}) | |
| scrartcl | \documentclass[10pt]{scrartcl} | (\section{%s} . \section*{%s}) | (\subsection{%s} . \subsection*{%s}) | (\subsubsection{%s} . \subsubsection*{%s}) | (\paragraph{%s} . \paragraph*{%s}) | |
| scrreprt | \documentclass[10pt,DIV=11]{scrreprt} | (\chapter{%s} . \chapter*{%s}) | (\section{%s} . \section*{%s}) | (\subsection{%s} . \subsection*{%s}) | (\subsubsection{%s} . \subsubsection*{%s}) | (\paragraph{%s} . \paragraph*{%s}) |
| beamer | \documentclass[presentation]{beamer} | (\section{%s} . \section*{%s}) | (\subsection{%s} . \subsection*{%s}) | (\subsubsection{%s} . \subsubsection*{%s}) | | |
| default-koma-letter | \documentclass[11pt]{scrlttr2} | | | | | |
| article | \documentclass[11pt]{article} | (\section{%s} . \section*{%s}) | (\subsection{%s} . \subsection*{%s}) | (\subsubsection{%s} . \subsubsection*{%s}) | (\paragraph{%s} . \paragraph*{%s}) | (\subparagraph{%s} . \subparagraph*{%s}) |
| report | \documentclass[11pt]{report} | (\part{%s} . \part*{%s}) | (\chapter{%s} . \chapter*{%s}) | (\section{%s} . \section*{%s}) | (\subsection{%s} . \subsection*{%s}) | (\subsubsection{%s} . \subsubsection*{%s}) |
| book | \documentclass[11pt]{book} | (\part{%s} . \part*{%s}) | (\chapter{%s} . \chapter*{%s}) | (\section{%s} . \section*{%s}) | (\subsection{%s} . \subsection*{%s}) | (\subsubsection{%s} . \subsubsection*{%s}) |

[[elisp:(org-latex-export-to-pdf)]]
@@ -0,0 +1,10 @@
\usepackage{xcolor}

\usepackage{tikz}

\definecolor{Blues1}{HTML}{eff3ff}
\definecolor{Blues2}{HTML}{bdd7e7}
\definecolor{Blues3}{HTML}{6baed6}
\definecolor{Blues4}{HTML}{2171b5}

\usepackage{siunitx}
Binary file not shown.

0 comments on commit 97296a8

Please sign in to comment.