Code Monkey home page Code Monkey logo

Comments (17)

amake avatar amake commented on June 21, 2024 1

No, there is currently no way to influence the available entities.

from orgro.

amake avatar amake commented on June 21, 2024 1

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 #84 (comment)

from orgro.

amake avatar amake commented on June 21, 2024 1

v1.34.2 is now available on F-Droid as well.

from orgro.

vitaminace33 avatar vitaminace33 commented on June 21, 2024

I hope this feature can be included in a near future. Nice app in any case.

from orgro.

amake avatar amake commented on June 21, 2024

Can you give an example entry or your org-entities-user setting?

from orgro.

vitaminace33 avatar vitaminace33 commented on June 21, 2024

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 "&hArr;" "<=>" "<=>" "")
  ("from" "\\leftarrow" t "&larr;" "<-" "<-" "")
  ("mapsto" "\\mapsto" t "&x21A6;" "->" "->" "")
  ("leadsto" "\\leadsto" t "&x21DD;" "->" "->" "")
  ("pm" "\\mp" nil "&pm;" "+-" "±" "±")
  ("mp" "\\pm" nil "&mp;" "-+" "" "")
  ("sqrt" "\\sqrt" t "&Sqrt;" "sqrt" "sqrt" "")
  ("cbrt" "\\sqrt[3]" t "&#x221B;" "cbrt" "cbrt" "")
  ("frrt" "\\sqrt[4]" t "&#x221C;" "frrt" "frrt" "")
))

I believe only the first and last "columns" are of interest to Orgro.

I hope it is of help.

from orgro.

amake avatar amake commented on June 21, 2024

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 "&primes;" "P" "P" "ℙ") ("naturals" "\\mathbb{N}" t "&naturals;" "N" "P" "ℕ") ("integers" "\\mathbb{Z}" t "&integers;" "Z" "Z" "ℤ") ("rationals" "\\mathbb{Q}" t "&rationals;" "Q" "Q" "ℚ") ("irrationals" "\\mathbb{I}" t "&Iopf;" "I" "I" "𝕀") ("reals" "\\mathbb{R}" t "&reals;" "R" "R" "ℝ") ("complexes" "\\mathbb{C}" t "&complexes;" "C" "C" "ℂ") ("quaternions" "\\mathbb{H}" t "&quaternions;" "H" "H" "ℍ") ("scalars" "\\mathbb{K}" t "&Kopf;" "K" "K" "𝕂") ("coloneq" "\\coloneqq" t "&coloneq;" ":=" ":=" "≔") ("eqcolon" "\\eqqcolon" t "&eqcolon;" "=:" "=:" "≕") ("then" "\\Rightarrow" t "&rArr;" "=>" "=>" "⇒") ("iff" "\\Leftrightarrow" t "&hArr;" "<=>" "<=>" "⇔") ("from" "\\leftarrow" t "&larr;" "<-" "<-" "←") ("mapsto" "\\mapsto" t "&x21A6;" "->" "->" "↦") ("leadsto" "\\leadsto" t "&x21DD;" "->" "->" "⇝") ("pm" "\\mp" nil "&pm;" "+-" "±" "±") ("mp" "\\pm" nil "&mp;" "-+" "-±" "∓") ("sqrt" "\\sqrt" t "&Sqrt;" "sqrt" "sqrt" "√") ("cbrt" "\\sqrt[3]" t "&#x221B;" "cbrt" "cbrt" "∛") ("frrt" "\\sqrt[4]" t "&#x221C;" "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.)

Line-by-line version
* COMMENT Local Variables
# Local Variables:
# org-entities-user: (
#   ("primes" "\\mathbb{P}" t "&primes;" "P" "P" "ℙ")
#   ("naturals" "\\mathbb{N}" t "&naturals;" "N" "P" "ℕ")
#   ("integers" "\\mathbb{Z}" t "&integers;" "Z" "Z" "ℤ")
#   ("rationals" "\\mathbb{Q}" t "&rationals;" "Q" "Q" "ℚ")
#   ("irrationals" "\\mathbb{I}" t "&Iopf;" "I" "I" "𝕀")
#   ("reals" "\\mathbb{R}" t "&reals;" "R" "R" "ℝ")
#   ("complexes" "\\mathbb{C}" t "&complexes;" "C" "C" "ℂ")
#   ("quaternions" "\\mathbb{H}" t "&quaternions;" "H" "H" "ℍ")
#   ("scalars" "\\mathbb{K}" t "&Kopf;" "K" "K" "𝕂")
#   ("coloneq" "\\coloneqq" t "&coloneq;" ":=" ":=" "≔")
#   ("eqcolon" "\\eqqcolon" t "&eqcolon;" "=:" "=:" "≕")
#   ("then" "\\Rightarrow" t "&rArr;" "=>" "=>" "⇒")
#   ("iff" "\\Leftrightarrow" t "&hArr;" "<=>" "<=>" "⇔")
#   ("from" "\\leftarrow" t "&larr;" "<-" "<-" "←")
#   ("mapsto" "\\mapsto" t "&x21A6;" "->" "->" "↦")
#   ("leadsto" "\\leadsto" t "&x21DD;" "->" "->" "⇝")
#   ("pm" "\\mp" nil "&pm;" "+-" "±" "±")
#   ("mp" "\\pm" nil "&mp;" "-+" "-±" "∓")
#   ("sqrt" "\\sqrt" t "&Sqrt;" "sqrt" "sqrt" "√")
#   ("cbrt" "\\sqrt[3]" t "&#x221B;" "cbrt" "cbrt" "∛")
#   ("frrt" "\\sqrt[4]" t "&#x221C;" "frrt" "frrt" "∜"))
# End:

from orgro.

vitaminace33 avatar vitaminace33 commented on June 21, 2024

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 "&Cscr;" "C" "C" "𝒞")
#           ("neigh" "\\mathcal{E}" t "&Escr;" "E" "E" "")
#       )) (add-to-list 'org-entities-user org-entity-local t))
# End:

Thank you for pointing me to the solution. Cheerios.

from orgro.

amake avatar amake commented on June 21, 2024

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 with dolist. 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.

from orgro.

vitaminace33 avatar vitaminace33 commented on June 21, 2024

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.

from orgro.

amake avatar amake commented on June 21, 2024

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.

from orgro.

vitaminace33 avatar vitaminace33 commented on June 21, 2024

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.

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.

from orgro.

amake avatar amake commented on June 21, 2024

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

from orgro.

amake avatar amake commented on June 21, 2024

Support for org-entities-user and org-entities-local will be available for testing in 1.34.0:

from orgro.

vitaminace33 avatar vitaminace33 commented on June 21, 2024

Nice! I'm gonna give it a try.

from orgro.

vitaminace33 avatar vitaminace33 commented on June 21, 2024

I've just tried it and it seems to work correctly. Thanks for the implementation!

from orgro.

amake avatar amake commented on June 21, 2024

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

from orgro.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.