Add a custom variable to break consective braces in latex
This commit is contained in:
parent
ded1e14a6e
commit
647df92aec
1 changed files with 14 additions and 6 deletions
|
@ -81,6 +81,11 @@
|
||||||
"deck"
|
"deck"
|
||||||
"Headings with this tag will be considered as decks.")
|
"Headings with this tag will be considered as decks.")
|
||||||
|
|
||||||
|
(defcustom anki-editor-break-consecutive-braces-in-latex
|
||||||
|
nil
|
||||||
|
"If non-nil, consecutive `}' will be automatically separated by spaces to prevent early-closing of cloze.
|
||||||
|
See https://apps.ankiweb.net/docs/manual.html#latex-conflicts.")
|
||||||
|
|
||||||
(defcustom anki-editor-anki-connect-listening-address
|
(defcustom anki-editor-anki-connect-listening-address
|
||||||
"127.0.0.1"
|
"127.0.0.1"
|
||||||
"The network address AnkiConnect is listening.")
|
"The network address AnkiConnect is listening.")
|
||||||
|
@ -477,12 +482,15 @@ CONTENTS is nil. INFO is a plist holding contextual information."
|
||||||
(dolist (map anki-editor--anki-latex-syntax-map)
|
(dolist (map anki-editor--anki-latex-syntax-map)
|
||||||
(setq code (replace-regexp-in-string (car map) (cdr map) code t t)))
|
(setq code (replace-regexp-in-string (car map) (cdr map) code t t)))
|
||||||
|
|
||||||
(if (equal copy code)
|
(when (equal copy code)
|
||||||
(anki-editor--wrap-latex
|
(setq code (anki-editor--wrap-latex
|
||||||
(if (eq (org-element-type latex) 'latex-fragment)
|
(if (eq (org-element-type latex) 'latex-fragment)
|
||||||
code
|
code
|
||||||
(format "\n<pre>\n%s</pre>\n"
|
(format "\n<pre>\n%s</pre>\n"
|
||||||
(org-remove-indentation code))))
|
(org-remove-indentation code))))))
|
||||||
|
|
||||||
|
(if anki-editor-break-consecutive-braces-in-latex
|
||||||
|
(replace-regexp-in-string "}}" "} } " code)
|
||||||
code)))
|
code)))
|
||||||
|
|
||||||
;;; Utilities
|
;;; Utilities
|
||||||
|
|
Loading…
Reference in a new issue