Closed vitaminace33 closed 7 months ago
No, there is currently no way to influence the available entities.
I hope this feature can be included in a near future. Nice app in any case.
Can you give an example entry or your org-entities-user
setting?
Sure.
The Emacs variable description of org-entities-user
is
The order of the fields is the following
name As a string, without the leading backslash.
LaTeX replacement In ready LaTeX, no further processing will take place.
LaTeX mathp Either t or nil. When t this entity needs to be in
math mode.
HTML replacement In ready HTML, no further processing will take place.
Usually this will be an &...; entity.
ASCII replacement Plain ASCII, no extensions.
Latin1 replacement Use the special characters available in latin1.
utf-8 replacement Use the special characters available in utf-8.
At the moment, mine has the following value.
(setq org-entities-user '(
("primes" "\\mathbb{P}" t "ℙ" "P" "P" "ℙ")
("naturals" "\\mathbb{N}" t "ℕ" "N" "P" "ℕ")
("integers" "\\mathbb{Z}" t "ℤ" "Z" "Z" "ℤ")
("rationals" "\\mathbb{Q}" t "ℚ" "Q" "Q" "ℚ")
("irrationals" "\\mathbb{I}" t "𝕀" "I" "I" "𝕀")
("reals" "\\mathbb{R}" t "ℝ" "R" "R" "ℝ")
("complexes" "\\mathbb{C}" t "ℂ" "C" "C" "ℂ")
("quaternions" "\\mathbb{H}" t "ℍ" "H" "H" "ℍ")
("scalars" "\\mathbb{K}" t "𝕂" "K" "K" "𝕂")
("coloneq" "\\coloneqq" t "≔" ":=" ":=" "≔")
("eqcolon" "\\eqqcolon" t "≕" "=:" "=:" "≕")
("then" "\\Rightarrow" t "⇒" "=>" "=>" "⇒")
("iff" "\\Leftrightarrow" t "⇔" "<=>" "<=>" "⇔")
("from" "\\leftarrow" t "←" "<-" "<-" "←")
("mapsto" "\\mapsto" t "&x21A6;" "->" "->" "↦")
("leadsto" "\\leadsto" t "&x21DD;" "->" "->" "⇝")
("pm" "\\mp" nil "±" "+-" "±" "±")
("mp" "\\pm" nil "∓" "-+" "-±" "∓")
("sqrt" "\\sqrt" t "√" "sqrt" "sqrt" "√")
("cbrt" "\\sqrt[3]" t "∛" "cbrt" "cbrt" "∛")
("frrt" "\\sqrt[4]" t "∜" "frrt" "frrt" "∜")
))
I believe only the first and last "columns" are of interest to Orgro.
I hope it is of help.
I've strenuously avoided adding settings to Orgro itself, and I'd prefer to keep it that way for this as well.
What I'm thinking now is to support parsing and interpreting org-entities-user
set via the local variables list.
You could hide such a section from export via the noexport
tag or the COMMENT
keyword.
Your setting would look like this at the bottom of your file:
* COMMENT Local Variables
# Local Variables:
# org-entities-user: (("primes" "\\mathbb{P}" t "ℙ" "P" "P" "ℙ") ("naturals" "\\mathbb{N}" t "ℕ" "N" "P" "ℕ") ("integers" "\\mathbb{Z}" t "ℤ" "Z" "Z" "ℤ") ("rationals" "\\mathbb{Q}" t "ℚ" "Q" "Q" "ℚ") ("irrationals" "\\mathbb{I}" t "𝕀" "I" "I" "𝕀") ("reals" "\\mathbb{R}" t "ℝ" "R" "R" "ℝ") ("complexes" "\\mathbb{C}" t "ℂ" "C" "C" "ℂ") ("quaternions" "\\mathbb{H}" t "ℍ" "H" "H" "ℍ") ("scalars" "\\mathbb{K}" t "𝕂" "K" "K" "𝕂") ("coloneq" "\\coloneqq" t "≔" ":=" ":=" "≔") ("eqcolon" "\\eqqcolon" t "≕" "=:" "=:" "≕") ("then" "\\Rightarrow" t "⇒" "=>" "=>" "⇒") ("iff" "\\Leftrightarrow" t "⇔" "<=>" "<=>" "⇔") ("from" "\\leftarrow" t "←" "<-" "<-" "←") ("mapsto" "\\mapsto" t "&x21A6;" "->" "->" "↦") ("leadsto" "\\leadsto" t "&x21DD;" "->" "->" "⇝") ("pm" "\\mp" nil "±" "+-" "±" "±") ("mp" "\\pm" nil "∓" "-+" "-±" "∓") ("sqrt" "\\sqrt" t "√" "sqrt" "sqrt" "√") ("cbrt" "\\sqrt[3]" t "∛" "cbrt" "cbrt" "∛") ("frrt" "\\sqrt[4]" t "∜" "frrt" "frrt" "∜"))
# End:
(The single-line form I got from doing M-x add-file-local-variable
and pasting in your value. You can also have it written item-by-item like below.)
I've strenuously avoided adding settings to Orgro itself, and I'd prefer to keep it that way for this as well.
I understand.
Your solution overwrites org-entities-user
. I propose do append a local list by looping add-to-list
with dolist
. It is perhaps not the best/fastest solution, but I think it is quite safe.
# Local Variables:
# eval: (dolist (org-entity-local '(
# ("cont" "\\mathcal{C}" t "𝒞" "C" "C" "𝒞")
# ("neigh" "\\mathcal{E}" t "ℰ" "E" "E" "ℰ")
# )) (add-to-list 'org-entities-user org-entity-local t))
# End:
Thank you for pointing me to the solution. Cheerios.
Your solution overwrites
org-entities-user
.
Ah yes, that would be a problem if you don't want to include your entire value in every document.
I propose do append a local list by looping
add-to-list
withdolist
. It is perhaps not the best/fastest solution, but I think it is quite safe.
Now Orgro can't just parse the value; it needs to be able to run arbitrary Elisp. This is a much bigger task, and may not even be allowed on the App Store.
Now Orgro can't just parse the value; it needs to be able to run arbitrary Elisp. This is a much bigger task, and may not even be allowed on the App Store.
Does Orgro get updates from Emacs? I could contact upstream to see if it is feasible to add a new variable, org-entities-local
, to be set locally per file.
Orgro doesn't use any Emacs or org-mode code; I've reimplemented the relevant bits in Dart. So in principle I can just decide to support org-entities-local
or even orgro-entities-user
.
In general I would prefer to not invent new things here; in other words ideally org-mode would add org-entities-local
and I would support that.
Orgro doesn't use any Emacs or org-mode code; I've reimplemented the relevant bits in Dart. So in principle I can just decide to support
org-entities-local
or evenorgro-entities-user
.
You should definitely give support to either org-entities-user
or org-entities-local
. Currently org-entities-user
is the official way to extend org-entities
. I assume that, if you decide to give support to orgro-entities-user
, supporting afterwards org-entities-local
should be a piece of cake. But I can also understand that you prefer to wait and see if the Emacs/Orgmode developers decide to implement a local solution such as org-entities-local
(I let you know if it is the case).
Just to know, what is the set of entities Orgro supports? The one from org-entities
? I'll be pushing a pull request to Emacs/Orgmode to update the default set of org-entities
which lacks of many basic symbols such as the numeric sets I gave above.
Just to know, what is the set of entities Orgro supports? The one from
org-entities
?
Yes, I generate the default list from org-entities
:
https://github.com/amake/org_flutter/blob/d30d0091124fc66b2b181ab5b9ef798fafe2b2e6/lib/src/entity.dart
v1.34.2 is out on the App Store and Google Play; it supports local var list definitions for org-entities-user
, org-entities-local
, and the formulation in https://github.com/amake/orgro/issues/84#issuecomment-1774132523
Nice! I'm gonna give it a try.
v1.34.2 is now available on F-Droid as well.
I've just tried it and it seems to work correctly. Thanks for the implementation!
Incidentally the "safe" predicate for org-entities-user
is incorrect as of Org 9.6.13, so if you set the value via local variables Emacs will bug you to accept it.
I submitted a fix that should be in the next release. https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=1ec18b8ebcbfc6d3ad98535f80157307ccea911d
Orgro supports pretty entities. Does it allow to set new
org-entities
throughorg-entities-user
?