About this site / and more

By Alexandre Allauzen

\(\newcommand{\myvqeqn}{y = 2(x-1)^2+1}\) \(\newcommand{\mat}[1]{\mathbf{#1}}\)

This site is generated by Jekyll (3.5.1), using org-mode (9.0.3) with ox-jekyll (included in the org-octopress org-octopress emacs package). The theme derives from the so-simple-theme.

1 emacs Customization

From ox-jekyll, I redefined the function "org-jekyll-insert-export-options-template" as post this way

(defun post
  (&optional title date setupfile categories tags published layout)
  "Insert a settings template for Jekyll exporter."
  (interactive)
  (let ((layout     (or layout org-jekyll-layout))
        (published  (or published org-jekyll-published))
        (tags       (or tags org-jekyll-tags))
        (categories (or categories org-jekyll-categories)))
    (save-excursion
      (insert (format (concat
                       "#+TITLE: "             title
                       "\n#+DATE: "              date
                       "\n#+SETUPFILE: "         setupfile
                       "\n#+JEKYLL_LAYOUT: "     layout
                       "\n#+JEKYLL_CATEGORIES: " categories
                       "\n#+JEKYLL_TAGS: "       tags
                       "\n#+JEKYLL_PUBLISHED: "  published
                       "\n\n* \n\n"))))))

2 Editing and exporting Tricks

2.1 Edition

2.1.1 The date of today

{ { { time(%Y-%m-%d %a %H:%M) } } }

Just remove space between brackets

2.1.2 Verbatim

Start a line with ": "

: Verbatim line 

2.1.3 No export

To skip a sub-tree entry from export, just add the tag noexport.

2.1.4 Templates

To insert template, for instance

#+BEGIN_SRC ... #+END_SRC, 

just type

<s C-i (or tab, M-tab)

The full list of built-in template are here.

s 	#+BEGIN_SRC ... #+END_SRC
e 	#+BEGIN_EXAMPLE ... #+END_EXAMPLE
q 	#+BEGIN_QUOTE ... #+END_QUOTE
v 	#+BEGIN_VERSE ... #+END_VERSE
c 	#+BEGIN_CENTER ... #+END_CENTER
l 	#+BEGIN_LaTeX ... #+END_LaTeX
L 	#+LaTeX:
h 	#+BEGIN_HTML ... #+END_HTML
H 	#+HTML:
a 	#+BEGIN_ASCII ... #+END_ASCII
A 	#+ASCII:
i 	#+INDEX: line
I 	#+INCLUDE: line 

2.1.5 TOC

  • If you want to remove the table of contents, just add in the header:
#+OPTIONS: toc:nil

See this page for more details about table of contents and settings.

  • If you want to disable numbering of headings, add :
#+options: num:nil

  • If you want place the TOC where you want :

First remove it from option

#+OPTIONS: toc:nil

Then add it like that where you want:

#+TOC: headlines 1

2.1.6 Images

  • To insert image, I just insert html code:
#+BEGIN_EXPORT html
<img src="/assets/figs/gauss_err.png" alt="bla" style="width:400px; margin:0px auto;display:block"/>
#+END_EXPORT 

And the image is stored in a subdir of assets.

bla

3 Exporting issue

Try to reload orgmode:

C-c C-x !

Or this solution sometimes:

C-U M-x org-reload

4 Publishing

In the .emacs file I added the following code:

(setq org-publish-project-alist
      '(

  ("org-alex"
          ;; Path to your org files.
          :base-directory "~/Sites/org/homepages"
          :base-extension "org"

          ;; Path to your Jekyll project.
          :publishing-directory "~/Sites/jekyll/homepages"
          :recursive t
          :publishing-function org-jekyll-publish-to-html
          :headline-levels 4 
          :html-extension "html"
    )


    ("org-static-alex"
          :base-directory "~/Sites/org/homepages"
          :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf\\|php"
          :publishing-directory "~/Sites/jekyll"
          :recursive t
          :publishing-function org-publish-attachment)

    ("aa" :components ("org-alex" "org-static-alex"))

))

Then just type :

C-c-e P x aa (where aa is the project name)

The code is derived from org-jekyll page.

Then just another shortcut :

(defun sdf
  ()
"Insert a settings template for Jekyll exporter."
(interactive)
(org-publish-project "aa" )
(compile "cd ~/Sites/jekyll/homepages; bundle exec jekyll build; ")
)  

5 Latex

5.1 Equation

To use MathJax to export latex equation just add the following option:

#+HTML_MATHJAX: align: left indent: 5em tagside: left font: Neo-Euler

Then you can write (and get) things like that:

\begin{equation} x=\sqrt{b} \ \end{equation}

5.2 Latex definition

To use some latex definition (i.e newcommand), you can download the file define.setup from this repository. Then add in the header :

#+SETUPFILE: /path/to/define.setup

Then you can define some newcommand like this to get something like:

\(\mat{M}\) and an equation like \(\myvqeqn\).

5.3 Find the right latex

Add in the .emacs file:

;; to find the right latex install 
(setenv "PATH" (concat ":/usr/local/texlive/2016/bin/universal-darwin/" (getenv "PATH")))