Prevent Blackfriday/smartParens from running inside equations

Fixes https://github.com/kaushalmodi/ox-hugo/issues/104
master
Kaushal Modi 8 years ago
parent 06687c3f40
commit 39be5829a9
  1. 8
      ox-blackfriday.el
  2. 30
      test/site/content-org/all-posts.org
  3. 32
      test/site/content/posts/equations-with-r-c.md
  4. 18
      test/site/content/real-examples/multifractals-in-ecology-using-r.md

@ -375,7 +375,13 @@ INFO is a plist holding contextual information."
;; Need to escape the backslash in "\(", "\)", .. to
;; make Blackfriday happy. So \( -> \\(, \) -> \\),
;; \[ -> \\[ and \] -> \\].
(frag (replace-regexp-in-string "\\(\\\\[]()[]\\)" "\\\\\\1" frag)))
(frag (replace-regexp-in-string "\\(\\\\[]()[]\\)" "\\\\\\1" frag))
;; Insert an extra space to trick Blackfriday/smartParens
;; from activating inside equations. That extra space
;; anyways doesn't matter in equations.
;; https://github.com/kaushalmodi/ox-hugo/issues/104
;; (c) -> ( c), (r) -> ( r), (tm) -> ( tm)
(frag (replace-regexp-in-string "(\\(c\\|r\\|tm\\))" "( \\1)" frag)))
frag))
((assq processing-type org-preview-latex-process-alist)
(let ((formula-link

@ -1781,6 +1781,34 @@ If $a^2=b$ and \( b=2 \), then the solution must be either
$$ a=+\sqrt{2} $$ or \[ a=-\sqrt{2} \]
(Note that the last two equations show up on their own lines.)
** Equations with (r), (c), .. :@upstream:
:PROPERTIES:
:EXPORT_FILE_NAME: equations-with-r-c
:END:
{{{oxhugoissue(104)}}}
Below, =(r)= or =(R)= should not get converted to ®, =(c)= or
=(C)= should not get converted to ©, and =(tm)= or =(TM)= should
not get converted to ™:
- $(r)$ $(R)$
- $(c)$ $(C)$
- $(tm)$ $(TM)$
- \( (r) \) \( (R) \)
- \( (c) \) \( (C) \)
- \( (tm) \) \( (TM) \)
Same as above but in /Block Math equations/:
$$ (r) (R) $$
$$ (c) (C) $$
$$ (tm) (TM) $$
\[ (r) (R) \]
\[ (c) (C) \]
\[ (tm) (TM) \]
* Lists :lists:
** List following a list
:PROPERTIES:
@ -2626,7 +2654,7 @@ auto-prefixed with the section for the current post.
*** Multifractal definition
- Consider a given object $\Omega$, its multifractal nature is
practically determined by covering the system with a set of boxes
$\{B_i(r)\}$ with $(i=1,..., N(r))$ of side lenght $r$
$\{B_i(r)\}$ with $(i=1,..., N(r))$ of side length $r$
- These boxes are nonoverlaping and such that
$$\Omega = \bigcup_{i=1}^{N(r)} B_i(r)$$

@ -0,0 +1,32 @@
+++
title = "Equations with (r), (c), .."
tags = ["equations"]
categories = ["upstream"]
draft = false
+++
`ox-hugo` Issue #[104](https://github.com/kaushalmodi/ox-hugo/issues/104)
Below, `(r)` or `(R)` should not get converted to ®, `(c)` or
`(C)` should not get converted to ©, and `(tm)` or `(TM)` should
not get converted to ™:
- \\(( r)\\) \\(( R)\\)
- \\(( c)\\) \\(( C)\\)
- \\(( tm)\\) \\(( TM)\\)
<!--listend-->
- \\( ( r) \\) \\( ( R) \\)
- \\( ( c) \\) \\( ( C) \\)
- \\( ( tm) \\) \\( ( TM) \\)
Same as above but in _Block Math equations_:
\\[ ( r) ( R) \\]
\\[ ( c) ( C) \\]
\\[ ( tm) ( TM) \\]
\\[ ( r) ( R) \\]
\\[ ( c) ( C) \\]
\\[ ( tm) ( TM) \\]

@ -28,10 +28,10 @@ source = "https://github.com/lsaravia/MultifractalsInR/blob/master/Curso3.md"
- Consider a given object \\(\Omega\\), its multifractal nature is
practically determined by covering the system with a set of boxes
\\(\{B\_i(r)\}\\) with \\((i=1,..., N(r))\\) of side lenght \\(r\\)
\\(\{B\_i( r)\}\\) with \\((i=1,..., N( r))\\) of side length \\(r\\)
- These boxes are nonoverlaping and such that
\\[\Omega = \bigcup\_{i=1}^{N(r)} B\_i(r)\\]
\\[\Omega = \bigcup\_{i=1}^{N( r)} B\_i( r)\\]
This is the box-counting method but now a measure \\(\mu(B\_n)\\) for each
box is computed. This measure corresponds to the total population or
@ -51,16 +51,16 @@ source = "https://github.com/lsaravia/MultifractalsInR/blob/master/Curso3.md"
infinite spectrum of so-called correlation dimension of order \\(q\\) or
also called Renyi entropies.
\\[D\_q = \lim\_{r \to 0} \frac{1}{q-1}\frac{log \left[ \sum\_{i=1}^{N(r)}p\_i^q \right]}{\log r}\\]
\\[D\_q = \lim\_{r \to 0} \frac{1}{q-1}\frac{log \left[ \sum\_{i=1}^{N( r)}p\_i^q \right]}{\log r}\\]
where \\(p\_i=\mu(B\_i)\\) and a normalization is assumed:
\\[\sum\_{i=1}^{N(r)}p\_i=1\\]
\\[\sum\_{i=1}^{N( r)}p\_i=1\\]
- For \\(q=0\\) we have the familiar definition of fractal dimension. To see
this we replace \\(q=0\\)
\\[D\_0 = -\lim\_{r \to 0}\frac{N(r)}{\log r}\\]
\\[D\_0 = -\lim\_{r \to 0}\frac{N( r)}{\log r}\\]
## Generalized dimensions 1 {#generalized-dimensions-1}
@ -69,7 +69,7 @@ source = "https://github.com/lsaravia/MultifractalsInR/blob/master/Curso3.md"
\\(q' \geq q\\)
- The sum
\\[M\_q(r) = \sum\_{i=1}^{N(r)}[\mu(B\_i(r))]^q = \sum\_{i=1}^{N(r)}p\_i^q\\]
\\[M\_q( r) = \sum\_{i=1}^{N( r)}[\mu(B\_i( r))]^q = \sum\_{i=1}^{N( r)}p\_i^q\\]
is the so-called moment or partition function of order \\(q\\).
- Varying q allows to measure the non-homogeneity of the pattern. The
@ -94,11 +94,11 @@ source = "https://github.com/lsaravia/MultifractalsInR/blob/master/Curso3.md"
the Shannon entropy or also called by ecologist the Shannon's index of
diversity.
\\[D\_1 = -\lim\_{r \to 0}\sum\_{i=1}^{N(r)} p\_i \log p\_i\\]
\\[D\_1 = -\lim\_{r \to 0}\sum\_{i=1}^{N( r)} p\_i \log p\_i\\]
and the second is the so-called correlation dimension:
\\[D\_2 = -\lim\_{r \to 0} \frac{\log \left[ \sum\_{i=1}^{N(r)} p\_i^2 \right]}{\log r} \\]
\\[D\_2 = -\lim\_{r \to 0} \frac{\log \left[ \sum\_{i=1}^{N( r)} p\_i^2 \right]}{\log r} \\]
the numerator is the log of the Simpson index.
@ -125,7 +125,7 @@ source = "https://github.com/lsaravia/MultifractalsInR/blob/master/Curso3.md"
- The same information contained in the generalized dimensions can be
expressed using mass exponents:
\\[M\_q(r) \propto r^{-\tau\_q}\\]
\\[M\_q( r) \propto r^{-\tau\_q}\\]
This is the scaling of the partition function. For monofractals
\\(\tau\_q\\) is linear and related to the Hurst exponent:

Loading…
Cancel
Save