1 基本配置

  • 博客系统: hugo
1
2
3
4
(with-eval-after-load 'ox
  (require 'ox-hugo))
(setq org-hugo-export-with-section-numbers t)
(setq org-latex-create-formula-image-program 'imagemagick)

安装了ox-hugo之后,我们就可以用C-c C-e H h

2 LaTeX

为了在LaTeX中写中文,我们需要在org文件中加入

1
2
#+LATEX_HEADER: \usepackage{ctex}
#+LATEX_COMPILER: xelatex

另外要支持LaTeX,我们需要安装TeX套件,这里我们选择texlive.

1
sudo pacman -S texlive-most texlive-latexextra texlive-langchinese

2.1 公式

我们可以直接输入行间公式

1
\[f(x)=a+b\]

即可得到

\[f(x)=a+b\]

2.2 画图

tikz画图感觉很强大,可以画很多感觉很复杂图。

需要在org文件中加入

1
#+LATEX_HEADER: \usepackage{tikz}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
\usetikzlibrary{shapes,arrows,chains}
\begin{tikzpicture}[
  >=triangle 60,              % Nice arrows; your taste may be different
  start chain=going below,    % General flow is top-to-bottom
  node distance=6mm and 60mm, % Global setup of box spacing
  every join/.style={norm},   % Default linetype for connecting boxes
  ]
  \tikzset{
    base/.style={draw, on chain, on grid, align=center, minimum height=6ex},
    proc/.style={base, rectangle, text width=8em},
    test/.style={base, diamond, aspect=2, text width=3em},
    term/.style={base, ellipse},
    % coord node style is used for placing corners of connecting lines
    coord/.style={coordinate, on chain, on grid, node distance=6mm and 10cm},
    % -------------------------------------------------
    norm/.style={->, draw},
  }
  \node [term] (problem) {problem};
  \node [proc, join] (identification) {Identification of required data};
  \node [proc, join] (pre-process) {Data pre-processing};
  \node [proc, join] (training-set) {Definition of training
    set};
  \node [proc, join, fill=grey!30] (algorithm) {Algorithm selection};
  \node [proc, join] (training) {Training};

  \node [proc, join] (evaluation) {Evaluation with test set};
  \node [test, join] (is-ok) {OK?};
  \node [proc, right=of is-ok, fill=grey!30] (classifier) {Classifier};
  \node [proc, left=of training] (tunning) {Parameter tuning};

  \node [coord, left=of algorithm] (co-algorithm)  {};
  \node [coord, left=of training-set] (co-training-set)  {};
  \node [coord, left=of pre-process] (co-pre-process)  {};
  \node [coord, left=of identification] (co-identification)  {};

  \path (is-ok.east) to node [very near start, yshift=1em] {YES} (classifier.west);
  \path (is-ok.west) to node [very near start] {No} (tunning.south);

  \draw [->] (is-ok.east) -- (classifier);
  \draw [->] (is-ok.west) -| (tunning);
  \draw [->] (tunning.east) -- (training);
  \draw [->] (is-ok.west) -| (co-algorithm) |- (algorithm);
  \draw [->] (is-ok.west) -- ++(-7cm, 0) |- (training-set);
  \draw [->] (is-ok.west) -- ++(-8cm, 0) |- (pre-process);
  \draw [->] (is-ok.west) -- ++(-10cm, 0) |- (identification);
\end{tikzpicture}