Skip to content

Latest commit

 

History

History
86 lines (76 loc) · 3.55 KB

README.md

File metadata and controls

86 lines (76 loc) · 3.55 KB

org-mode-tricks

Explore Org-mode in Emacs

Org Tables to Generate State Diagrams and Derivation Trees

The author of the original code is Rick Frankel.
I have referred to the tutorial on Org's Worg and another one by jcs.
I'm trying Org-mode in the Introduction to Theoretical Computer Science course, which teaches automata and how do they work. I need to create finite state diagrams and derivation trees; I think Org-mode might help with that instead of drawing them manually.

Setup

  1. Install Graphviz on your local machine;
  2. Install graphviz-dot-mode for your Emacs;
  3. Open this org file with Emacs in Org-mode to generate graphs.

Simple Use

Place cursor on #+CALL statement and press C-c C-c to run the script, the output will be an image file in specified format located in :file LOCATION.

Notes

Special characters can be used as label using UTF-8 encoding and the HTML UTF-8 character entities can be found on Graphviz.org or on Quackit.com.
Some LISP knowledge prove helpful.

Org Tables to Generate Prolog Declarative Database for an EFSM.

In Formal Methods course, the assignment required a formal description of an efsm (Extended finite state machine). This description shall be translated into a state diagram and a Prolog database for logical queries.
Since the process for translating a formal description of automata into a diagram is defined above, its translation to Prolog language seems spontaneous.
So here it is, a simple script in emacs-lisp to transform Org table content into Prolog facts.

Org Export

LATEX HEADERS

No Indent

#+LATEX: \setlength\parindent{0pt}

Specify Margin

\usepackage{geometry}
\geometry{left=1.0in,right=1.0in,top=1.2in,bottom=1.2in}

Change Font Size

\usepackage{extsizes} in header
#+latex_class_options: [10pt] in org file

The sizes available are 8pt, 9pt, 10pt, 11pt, 12pt, 14pt, 17pt, and 20pt. - The extsizes classes

INTERNAL LINKS (must contain no space to render properly in PDF)

Add Custom Link

Using

* Section One
:PROPERTIES:
:CUSTOM_ID: sec:one
:END:

or

* Section One
  <<sec:one>>

* Section Two
  <<sec:two>>

then

I can reference Section One with  [[sec:one]] and [[sec:one][Custom Text]],
but I can get the actual section number (1) to resolve.

Use Heading as Link

Using * SectionOne then [[*SectionOne][Custom Text]] (no space for the link).
After org-store-link, use org-insert-link.

Org-Tables as Spreadsheets

Keys

Key Function
M-S-← (org-table-delete-column)
M-S-→ (org-table-insert-column)
M-S-↑ (org-table-kill-row)
M-S-↓ (org-table-insert-row)

https://orgmode.org/org.html#Advanced-features

Field references

Keyword Reference
@< 1st row
@> last row
@>>> 3rd row from bottom
@0 current row
@+1 next row
@1 row #1
@I 1st hline
@II+3 3rd line below the 2nd hline