fix: align display math
This commit is contained in:
@@ -546,3 +546,13 @@ figure.fullwidth figcaption {
|
||||
.latex-fragment
|
||||
{ fill: currentColor
|
||||
}
|
||||
|
||||
.latex-fragment.display-math
|
||||
{ display: block
|
||||
; width: 55%
|
||||
/* Center it — do we want to do that? */
|
||||
; align-items: center
|
||||
; justify-content: center
|
||||
; display: flex
|
||||
; max-width: 55%
|
||||
}
|
||||
|
||||
@@ -81,6 +81,13 @@
|
||||
(when-some [footnotes-headline (first (:children element))]
|
||||
(= "Footnotes" (:raw-value footnotes-headline)))))
|
||||
|
||||
(defn display-math?
|
||||
"Return truthy if `element` should be considered display math."
|
||||
[element]
|
||||
(or (of-type? element "latex-environment")
|
||||
(and (of-type? element "latex-fragment")
|
||||
(-> element :contents (str/starts-with? "\\[")))))
|
||||
|
||||
|
||||
;;; Spec
|
||||
|
||||
|
||||
@@ -361,11 +361,13 @@
|
||||
(str "@" key))
|
||||
|
||||
(defmethod org-element "latex-fragment" [{:keys [contents value] :as e}]
|
||||
[:span.latex-fragment
|
||||
[:span {:class (if (element/display-math? e)
|
||||
"latex-fragment display-math"
|
||||
"latex-fragment")}
|
||||
(-> e ::rendered deref)])
|
||||
|
||||
(defmethod org-element "latex-environment" [{:keys [value] :as e}]
|
||||
[:span.latex-fragment
|
||||
[:span.latex-fragment.display-math
|
||||
(-> e ::rendered deref)])
|
||||
|
||||
(defmethod org-element "example-block" [{:keys [value]}]
|
||||
|
||||
Reference in New Issue
Block a user