config

Personal configuration.
git clone git://code.dwrz.net/config
Log | Files | Refs

org-entities.el (30191B)


      1 ;;; org-entities.el --- Support for Special Entities -*- lexical-binding: t; -*-
      2 
      3 ;; Copyright (C) 2010-2024 Free Software Foundation, Inc.
      4 
      5 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>,
      6 ;;         Ulf Stegemann <ulf at zeitform dot de>
      7 ;; Keywords: outlines, calendar, text
      8 ;; URL: https://orgmode.org
      9 ;;
     10 ;; This file is part of GNU Emacs.
     11 ;;
     12 ;; GNU Emacs is free software: you can redistribute it and/or modify
     13 ;; it under the terms of the GNU General Public License as published by
     14 ;; the Free Software Foundation, either version 3 of the License, or
     15 ;; (at your option) any later version.
     16 
     17 ;; GNU Emacs is distributed in the hope that it will be useful,
     18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
     19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     20 ;; GNU General Public License for more details.
     21 
     22 ;; You should have received a copy of the GNU General Public License
     23 ;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
     24 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     25 ;;
     26 ;;; Commentary:
     27 
     28 ;;; Code:
     29 
     30 (require 'org-macs)
     31 (org-assert-version)
     32 (require 'seq) ; Emacs 27 does not preload seq.el; for `seq-every-p'.
     33 
     34 (declare-function org-mode "org" ())
     35 (declare-function org-toggle-pretty-entities "org"       ())
     36 (declare-function org-table-align            "org-table" ())
     37 
     38 (defgroup org-entities nil
     39   "Options concerning entities in Org mode."
     40   :tag "Org Entities"
     41   :group 'org)
     42 
     43 (defun org-entities--user-safe-p (v)
     44   "Non-nil if V is a safe value for `org-entities-user'."
     45   (cond
     46    ((not v) t)
     47    ((listp v)
     48     (seq-every-p
     49      (lambda (e)
     50        (pcase e
     51          (`(,(and (pred stringp)
     52 	              (pred (string-match-p "\\`[a-zA-Z][a-zA-Z0-9]*\\'")))
     53             ,(pred stringp) ,(pred booleanp) ,(pred stringp)
     54             ,(pred stringp) ,(pred stringp) ,(pred stringp))
     55           t)
     56          (_ nil)))
     57      v))))
     58 
     59 (defcustom org-entities-user nil
     60   "User-defined entities used in Org to produce special characters.
     61 Each entry in this list is a list of strings.  It associates the name
     62 of the entity that can be inserted into an Org file as \\name with the
     63 appropriate replacements for the different export backends.  The order
     64 of the fields is the following
     65 
     66 name                 As a string, without the leading backslash.
     67 LaTeX replacement    In ready LaTeX, no further processing will take place.
     68 LaTeX mathp          Either t or nil.  When t this entity needs to be in
     69                      math mode.
     70 HTML replacement     In ready HTML, no further processing will take place.
     71                      Usually this will be an &...; entity.
     72 ASCII replacement    Plain ASCII, no extensions.
     73 Latin1 replacement   Use the special characters available in latin1.
     74 utf-8 replacement    Use the special characters available in utf-8.
     75 
     76 If you define new entities here that require specific LaTeX
     77 packages to be loaded, add these packages to `org-latex-packages-alist'."
     78   :group 'org-entities
     79   :version "24.1"
     80   :type '(repeat
     81 	  (list
     82 	   (string :tag "name  ")
     83 	   (string :tag "LaTeX ")
     84 	   (boolean :tag "Require LaTeX math?")
     85 	   (string :tag "HTML  ")
     86 	   (string :tag "ASCII ")
     87 	   (string :tag "Latin1")
     88 	   (string :tag "utf-8 ")))
     89   :safe #'org-entities--user-safe-p)
     90 
     91 (defconst org-entities
     92   (append
     93    '("* Letters"
     94      "** Latin"
     95      ("Agrave" "\\`{A}" nil "&Agrave;" "A" "À" "À")
     96      ("agrave" "\\`{a}" nil "&agrave;" "a" "à" "à")
     97      ("Aacute" "\\'{A}" nil "&Aacute;" "A" "Á" "Á")
     98      ("aacute" "\\'{a}" nil "&aacute;" "a" "á" "á")
     99      ("Acirc" "\\^{A}" nil "&Acirc;" "A" "Â" "Â")
    100      ("acirc" "\\^{a}" nil "&acirc;" "a" "â" "â")
    101      ("Amacr" "\\={A}" nil "&Amacr;" "A" "Ã" "Ã")
    102      ("amacr" "\\={a}" nil "&amacr;" "a" "ã" "ã")
    103      ("Atilde" "\\~{A}" nil "&Atilde;" "A" "Ã" "Ã")
    104      ("atilde" "\\~{a}" nil "&atilde;" "a" "ã" "ã")
    105      ("Auml" "\\\"{A}" nil "&Auml;" "Ae" "Ä" "Ä")
    106      ("auml" "\\\"{a}" nil "&auml;" "ae" "ä" "ä")
    107      ("Aring" "\\AA{}" nil "&Aring;" "A" "Å" "Å")
    108      ("AA" "\\AA{}" nil "&Aring;" "A" "Å" "Å")
    109      ("aring" "\\aa{}" nil "&aring;" "a" "å" "å")
    110      ("AElig" "\\AE{}" nil "&AElig;" "AE" "Æ" "Æ")
    111      ("aelig" "\\ae{}" nil "&aelig;" "ae" "æ" "æ")
    112      ("Ccedil" "\\c{C}" nil "&Ccedil;" "C" "Ç" "Ç")
    113      ("ccedil" "\\c{c}" nil "&ccedil;" "c" "ç" "ç")
    114      ("Egrave" "\\`{E}" nil "&Egrave;" "E" "È" "È")
    115      ("egrave" "\\`{e}" nil "&egrave;" "e" "è" "è")
    116      ("Eacute" "\\'{E}" nil "&Eacute;" "E" "É" "É")
    117      ("eacute" "\\'{e}" nil "&eacute;" "e" "é" "é")
    118      ("Ecirc" "\\^{E}" nil "&Ecirc;" "E" "Ê" "Ê")
    119      ("ecirc" "\\^{e}" nil "&ecirc;" "e" "ê" "ê")
    120      ("Euml" "\\\"{E}" nil "&Euml;" "E" "Ë" "Ë")
    121      ("euml" "\\\"{e}" nil "&euml;" "e" "ë" "ë")
    122      ("Igrave" "\\`{I}" nil "&Igrave;" "I" "Ì" "Ì")
    123      ("igrave" "\\`{i}" nil "&igrave;" "i" "ì" "ì")
    124      ("Iacute" "\\'{I}" nil "&Iacute;" "I" "Í" "Í")
    125      ("iacute" "\\'{i}" nil "&iacute;" "i" "í" "í")
    126      ("Idot" "\\.{I}" nil "&idot;" "I" "İ" "İ")
    127      ("inodot" "\\i" nil "&inodot;" "i" "ı" "ı")
    128      ("Icirc" "\\^{I}" nil "&Icirc;" "I" "Î" "Î")
    129      ("icirc" "\\^{i}" nil "&icirc;" "i" "î" "î")
    130      ("Iuml" "\\\"{I}" nil "&Iuml;" "I" "Ï" "Ï")
    131      ("iuml" "\\\"{i}" nil "&iuml;" "i" "ï" "ï")
    132      ("Ntilde" "\\~{N}" nil "&Ntilde;" "N" "Ñ" "Ñ")
    133      ("ntilde" "\\~{n}" nil "&ntilde;" "n" "ñ" "ñ")
    134      ("Ograve" "\\`{O}" nil "&Ograve;" "O" "Ò" "Ò")
    135      ("ograve" "\\`{o}" nil "&ograve;" "o" "ò" "ò")
    136      ("Oacute" "\\'{O}" nil "&Oacute;" "O" "Ó" "Ó")
    137      ("oacute" "\\'{o}" nil "&oacute;" "o" "ó" "ó")
    138      ("Ocirc" "\\^{O}" nil "&Ocirc;" "O" "Ô" "Ô")
    139      ("ocirc" "\\^{o}" nil "&ocirc;" "o" "ô" "ô")
    140      ("Otilde" "\\~{O}" nil "&Otilde;" "O" "Õ" "Õ")
    141      ("otilde" "\\~{o}" nil "&otilde;" "o" "õ" "õ")
    142      ("Ouml" "\\\"{O}" nil "&Ouml;" "Oe" "Ö" "Ö")
    143      ("ouml" "\\\"{o}" nil "&ouml;" "oe" "ö" "ö")
    144      ("Oslash" "\\O" nil "&Oslash;" "O" "Ø" "Ø")
    145      ("oslash" "\\o{}" nil "&oslash;" "o" "ø" "ø")
    146      ("OElig" "\\OE{}" nil "&OElig;" "OE" "OE" "Œ")
    147      ("oelig" "\\oe{}" nil "&oelig;" "oe" "oe" "œ")
    148      ("Scaron" "\\v{S}" nil "&Scaron;" "S" "S" "Š")
    149      ("scaron" "\\v{s}" nil "&scaron;" "s" "s" "š")
    150      ("szlig" "\\ss{}" nil "&szlig;" "ss" "ß" "ß")
    151      ("Ugrave" "\\`{U}" nil "&Ugrave;" "U" "Ù" "Ù")
    152      ("ugrave" "\\`{u}" nil "&ugrave;" "u" "ù" "ù")
    153      ("Uacute" "\\'{U}" nil "&Uacute;" "U" "Ú" "Ú")
    154      ("uacute" "\\'{u}" nil "&uacute;" "u" "ú" "ú")
    155      ("Ucirc" "\\^{U}" nil "&Ucirc;" "U" "Û" "Û")
    156      ("ucirc" "\\^{u}" nil "&ucirc;" "u" "û" "û")
    157      ("Uuml" "\\\"{U}" nil "&Uuml;" "Ue" "Ü" "Ü")
    158      ("uuml" "\\\"{u}" nil "&uuml;" "ue" "ü" "ü")
    159      ("Yacute" "\\'{Y}" nil "&Yacute;" "Y" "Ý" "Ý")
    160      ("yacute" "\\'{y}" nil "&yacute;" "y" "ý" "ý")
    161      ("Yuml" "\\\"{Y}" nil "&Yuml;" "Y" "Y" "Ÿ")
    162      ("yuml" "\\\"{y}" nil "&yuml;" "y" "ÿ" "ÿ")
    163 
    164      "** Latin (special face)"
    165      ("fnof" "\\textit{f}" nil "&fnof;" "f" "f" "ƒ")
    166      ("real" "\\Re" t "&real;" "R" "R" "ℜ")
    167      ("image" "\\Im" t "&image;" "I" "I" "ℑ")
    168      ("weierp" "\\wp" t "&weierp;" "P" "P" "℘")
    169      ("ell" "\\ell" t "&ell;" "ell" "ell" "ℓ")
    170      ("imath" "\\imath" t "&imath;" "[dotless i]" "dotless i" "ı")
    171      ("jmath" "\\jmath" t "&jmath;" "[dotless j]" "dotless j" "ȷ")
    172 
    173      "** Greek"
    174      ("Alpha" "A" nil "&Alpha;" "Alpha" "Alpha" "Α")
    175      ("alpha" "\\alpha" t "&alpha;" "alpha" "alpha" "α")
    176      ("Beta" "B" nil "&Beta;" "Beta" "Beta" "Β")
    177      ("beta" "\\beta" t "&beta;" "beta" "beta" "β")
    178      ("Gamma" "\\Gamma" t "&Gamma;" "Gamma" "Gamma" "Γ")
    179      ("gamma" "\\gamma" t "&gamma;" "gamma" "gamma" "γ")
    180      ("Delta" "\\Delta" t "&Delta;" "Delta" "Delta" "Δ")
    181      ("delta" "\\delta" t "&delta;" "delta" "delta" "δ")
    182      ("Epsilon" "E" nil "&Epsilon;" "Epsilon" "Epsilon" "Ε")
    183      ("epsilon" "\\epsilon" t "&epsilon;" "epsilon" "epsilon" "ε")
    184      ("varepsilon" "\\varepsilon" t "&epsilon;" "varepsilon" "varepsilon" "ε")
    185      ("Zeta" "Z" nil "&Zeta;" "Zeta" "Zeta" "Ζ")
    186      ("zeta" "\\zeta" t "&zeta;" "zeta" "zeta" "ζ")
    187      ("Eta" "H" nil "&Eta;" "Eta" "Eta" "Η")
    188      ("eta" "\\eta" t "&eta;" "eta" "eta" "η")
    189      ("Theta" "\\Theta" t "&Theta;" "Theta" "Theta" "Θ")
    190      ("theta" "\\theta" t "&theta;" "theta" "theta" "θ")
    191      ("thetasym" "\\vartheta" t "&thetasym;" "theta" "theta" "ϑ")
    192      ("vartheta" "\\vartheta" t "&thetasym;" "theta" "theta" "ϑ")
    193      ("Iota" "I" nil "&Iota;" "Iota" "Iota" "Ι")
    194      ("iota" "\\iota" t "&iota;" "iota" "iota" "ι")
    195      ("Kappa" "K" nil "&Kappa;" "Kappa" "Kappa" "Κ")
    196      ("kappa" "\\kappa" t "&kappa;" "kappa" "kappa" "κ")
    197      ("Lambda" "\\Lambda" t "&Lambda;" "Lambda" "Lambda" "Λ")
    198      ("lambda" "\\lambda" t "&lambda;" "lambda" "lambda" "λ")
    199      ("Mu" "M" nil "&Mu;" "Mu" "Mu" "Μ")
    200      ("mu" "\\mu" t "&mu;" "mu" "mu" "μ")
    201      ("nu" "\\nu" t "&nu;" "nu" "nu" "ν")
    202      ("Nu" "N" nil "&Nu;" "Nu" "Nu" "Ν")
    203      ("Xi" "\\Xi" t "&Xi;" "Xi" "Xi" "Ξ")
    204      ("xi" "\\xi" t "&xi;" "xi" "xi" "ξ")
    205      ("Omicron" "O" nil "&Omicron;" "Omicron" "Omicron" "Ο")
    206      ("omicron" "\\textit{o}" nil "&omicron;" "omicron" "omicron" "ο")
    207      ("Pi" "\\Pi" t "&Pi;" "Pi" "Pi" "Π")
    208      ("pi" "\\pi" t "&pi;" "pi" "pi" "π")
    209      ("Rho" "P" nil "&Rho;" "Rho" "Rho" "Ρ")
    210      ("rho" "\\rho" t "&rho;" "rho" "rho" "ρ")
    211      ("Sigma" "\\Sigma" t "&Sigma;" "Sigma" "Sigma" "Σ")
    212      ("sigma" "\\sigma" t "&sigma;" "sigma" "sigma" "σ")
    213      ("sigmaf" "\\varsigma" t "&sigmaf;" "sigmaf" "sigmaf" "ς")
    214      ("varsigma" "\\varsigma" t "&sigmaf;" "varsigma" "varsigma" "ς")
    215      ("Tau" "T" nil "&Tau;" "Tau" "Tau" "Τ")
    216      ("Upsilon" "\\Upsilon" t "&Upsilon;" "Upsilon" "Upsilon" "Υ")
    217      ("upsih" "\\Upsilon" t "&upsih;" "upsilon" "upsilon" "ϒ")
    218      ("upsilon" "\\upsilon" t "&upsilon;" "upsilon" "upsilon" "υ")
    219      ("Phi" "\\Phi" t "&Phi;" "Phi" "Phi" "Φ")
    220      ("phi" "\\phi" t "&phi;" "phi" "phi" "ɸ")
    221      ("varphi" "\\varphi" t "&varphi;" "varphi" "varphi" "φ")
    222      ("Chi" "X" nil "&Chi;" "Chi" "Chi" "Χ")
    223      ("chi" "\\chi" t "&chi;" "chi" "chi" "χ")
    224      ("acutex" "\\acute x" t "&acute;x" "'x" "'x" "𝑥́")
    225      ("Psi" "\\Psi" t "&Psi;" "Psi" "Psi" "Ψ")
    226      ("psi" "\\psi" t "&psi;" "psi" "psi" "ψ")
    227      ("tau" "\\tau" t "&tau;" "tau" "tau" "τ")
    228      ("Omega" "\\Omega" t "&Omega;" "Omega" "Omega" "Ω")
    229      ("omega" "\\omega" t "&omega;" "omega" "omega" "ω")
    230      ("piv" "\\varpi" t "&piv;" "omega-pi" "omega-pi" "ϖ")
    231      ("varpi" "\\varpi" t "&piv;" "omega-pi" "omega-pi" "ϖ")
    232      ("partial" "\\partial" t "&part;" "[partial differential]" "[partial differential]" "∂")
    233 
    234      "** Hebrew"
    235      ("alefsym" "\\aleph" t "&alefsym;" "aleph" "aleph" "ℵ")
    236      ("aleph" "\\aleph" t "&aleph;" "aleph" "aleph" "ℵ")
    237      ("gimel" "\\gimel" t "&gimel;" "gimel" "gimel" "ℷ")
    238      ("beth" "\\beth" t "&beth;" "beth" "beth" "ב")
    239      ("dalet" "\\daleth" t "&daleth;" "dalet" "dalet" "ד")
    240 
    241      "** Icelandic"
    242      ("ETH" "\\DH{}" nil "&ETH;" "D" "Ð" "Ð")
    243      ("eth" "\\dh{}" nil "&eth;" "dh" "ð" "ð")
    244      ("THORN" "\\TH{}" nil "&THORN;" "TH" "Þ" "Þ")
    245      ("thorn" "\\th{}" nil "&thorn;" "th" "þ" "þ")
    246 
    247      "* Punctuation"
    248      "** Dots and Marks"
    249      ("dots" "\\dots{}" nil "&hellip;" "..." "..." "…")
    250      ("cdots" "\\cdots{}" t "&ctdot;" "..." "..." "⋯")
    251      ("hellip" "\\dots{}" nil "&hellip;" "..." "..." "…")
    252      ("middot" "\\textperiodcentered{}" nil "&middot;" "." "·" "·")
    253      ("iexcl" "!`" nil "&iexcl;" "!" "¡" "¡")
    254      ("iquest" "?`" nil "&iquest;" "?" "¿" "¿")
    255 
    256      "** Dash-like"
    257      ("shy" "\\-" nil "&shy;" "" "" "")
    258      ("ndash" "--" nil "&ndash;" "-" "-" "–")
    259      ("mdash" "---" nil "&mdash;" "--" "--" "—")
    260 
    261      "** Quotations"
    262      ("quot" "\\textquotedbl{}" nil "&quot;" "\"" "\"" "\"")
    263      ("acute" "\\textasciiacute{}" nil "&acute;" "'" "´" "´")
    264      ("ldquo" "\\textquotedblleft{}" nil "&ldquo;" "\"" "\"" "“")
    265      ("rdquo" "\\textquotedblright{}" nil "&rdquo;" "\"" "\"" "”")
    266      ("bdquo" "\\quotedblbase{}" nil "&bdquo;" "\"" "\"" "„")
    267      ("lsquo" "\\textquoteleft{}" nil "&lsquo;" "`" "`" "‘")
    268      ("rsquo" "\\textquoteright{}" nil "&rsquo;" "'" "'" "’")
    269      ("sbquo" "\\quotesinglbase{}" nil "&sbquo;" "," "," "‚")
    270      ("laquo" "\\guillemotleft{}" nil "&laquo;" "<<" "«" "«")
    271      ("raquo" "\\guillemotright{}" nil "&raquo;" ">>" "»" "»")
    272      ("lsaquo" "\\guilsinglleft{}" nil "&lsaquo;" "<" "<" "‹")
    273      ("rsaquo" "\\guilsinglright{}" nil "&rsaquo;" ">" ">" "›")
    274 
    275      "* Other"
    276      "** Misc. (often used)"
    277      ("circ" "\\^{}" nil "&circ;" "^" "^" "∘")
    278      ("vert" "\\vert{}" t "&vert;" "|" "|" "|")
    279      ("vbar" "|" nil "|" "|" "|" "|")
    280      ("brvbar" "\\textbrokenbar{}" nil "&brvbar;" "|" "¦" "¦")
    281      ("S" "\\S" nil "&sect;" "section" "§" "§")
    282      ("sect" "\\S" nil "&sect;" "section" "§" "§")
    283      ("P" "\\P{}" nil "&para;" "paragraph" "¶" "¶")
    284      ("para" "\\P{}" nil "&para;" "paragraph" "¶" "¶")
    285      ("amp" "\\&" nil "&amp;" "&" "&" "&")
    286      ("lt" "\\textless{}" nil "&lt;" "<" "<" "<")
    287      ("gt" "\\textgreater{}" nil "&gt;" ">" ">" ">")
    288      ("tilde" "\\textasciitilde{}" nil "~" "~" "~" "~")
    289      ("slash" "/" nil "/" "/" "/" "/")
    290      ("plus" "+" nil "+" "+" "+" "+")
    291      ("under" "\\_" nil "_" "_" "_" "_")
    292      ("equal" "=" nil "=" "=" "=" "=")
    293      ("asciicirc" "\\textasciicircum{}" nil "^" "^" "^" "^")
    294      ("dagger" "\\textdagger{}" nil "&dagger;" "[dagger]" "[dagger]" "†")
    295      ("dag" "\\dag{}" nil "&dagger;" "[dagger]" "[dagger]" "†")
    296      ("Dagger" "\\textdaggerdbl{}" nil "&Dagger;" "[doubledagger]" "[doubledagger]" "‡")
    297      ("ddag" "\\ddag{}" nil "&Dagger;" "[doubledagger]" "[doubledagger]" "‡")
    298 
    299      "** Whitespace"
    300      ("nbsp" "~" nil "&nbsp;" " " "\x00A0" "\x00A0")
    301      ("ensp" "\\hspace*{.5em}" nil "&ensp;" " " " " " ")
    302      ("emsp" "\\hspace*{1em}" nil "&emsp;" " " " " " ")
    303      ("thinsp" "\\hspace*{.2em}" nil "&thinsp;" " " " " " ")
    304 
    305      "** Currency"
    306      ("curren" "\\textcurrency{}" nil "&curren;" "curr." "¤" "¤")
    307      ("cent" "\\textcent{}" nil "&cent;" "cent" "¢" "¢")
    308      ("pound" "\\pounds{}" nil "&pound;" "pound" "£" "£")
    309      ("yen" "\\textyen{}" nil "&yen;" "yen" "¥" "¥")
    310      ("euro" "\\texteuro{}" nil "&euro;" "EUR" "EUR" "€")
    311      ("EUR" "\\texteuro{}" nil "&euro;" "EUR" "EUR" "€")
    312      ("dollar" "\\$" nil "$" "$" "$" "$")
    313      ("USD" "\\$" nil "$" "$" "$" "$")
    314 
    315      "** Property Marks"
    316      ("copy" "\\textcopyright{}" nil "&copy;" "(c)" "©" "©")
    317      ("reg" "\\textregistered{}" nil "&reg;" "(r)" "®" "®")
    318      ("trade" "\\texttrademark{}" nil "&trade;" "TM" "TM" "™")
    319 
    320      "** Science et al."
    321      ("minus" "-" t "&minus;" "-" "-" "−")
    322      ("pm" "\\textpm{}" nil "&plusmn;" "+-" "±" "±")
    323      ("plusmn" "\\textpm{}" nil "&plusmn;" "+-" "±" "±")
    324      ("times" "\\texttimes{}" nil "&times;" "*" "×" "×")
    325      ("frasl" "/" nil "&frasl;" "/" "/" "⁄")
    326      ("colon" "\\colon" t ":" ":" ":" ":")
    327      ("div" "\\textdiv{}" nil "&divide;" "/" "÷" "÷")
    328      ("frac12" "\\textonehalf{}" nil "&frac12;" "1/2" "½" "½")
    329      ("frac14" "\\textonequarter{}" nil "&frac14;" "1/4" "¼" "¼")
    330      ("frac34" "\\textthreequarters{}" nil "&frac34;" "3/4" "¾" "¾")
    331      ("permil" "\\textperthousand{}" nil "&permil;" "per thousand" "per thousand" "‰")
    332      ("sup1" "\\textonesuperior{}" nil "&sup1;" "^1" "¹" "¹")
    333      ("sup2" "\\texttwosuperior{}" nil "&sup2;" "^2" "²" "²")
    334      ("sup3" "\\textthreesuperior{}" nil "&sup3;" "^3" "³" "³")
    335      ("radic" "\\sqrt{\\,}" t "&radic;" "[square root]" "[square root]" "√")
    336      ("sum" "\\sum" t "&sum;" "[sum]" "[sum]" "∑")
    337      ("prod" "\\prod" t "&prod;" "[product]" "[n-ary product]" "∏")
    338      ("micro" "\\textmu{}" nil "&micro;" "micro" "µ" "µ")
    339      ("macr" "\\textasciimacron{}" nil "&macr;" "[macron]" "¯" "¯")
    340      ("deg" "\\textdegree{}" nil "&deg;" "degree" "°" "°")
    341      ("prime" "\\prime" t "&prime;" "'" "'" "′")
    342      ("Prime" "\\prime{}\\prime" t "&Prime;" "''" "''" "″")
    343      ("infin" "\\infty" t "&infin;" "[infinity]" "[infinity]" "∞")
    344      ("infty" "\\infty" t "&infin;" "[infinity]" "[infinity]" "∞")
    345      ("prop" "\\propto" t "&prop;" "[proportional to]" "[proportional to]" "∝")
    346      ("propto" "\\propto" t "&prop;" "[proportional to]" "[proportional to]" "∝")
    347      ("not" "\\textlnot{}" nil "&not;" "[angled dash]" "¬" "¬")
    348      ("neg" "\\neg{}" t "&not;" "[angled dash]" "¬" "¬")
    349      ("land" "\\land" t "&and;" "[logical and]" "[logical and]" "∧")
    350      ("wedge" "\\wedge" t "&and;" "[logical and]" "[logical and]" "∧")
    351      ("lor" "\\lor" t "&or;" "[logical or]" "[logical or]" "∨")
    352      ("vee" "\\vee" t "&or;" "[logical or]" "[logical or]" "∨")
    353      ("cap" "\\cap" t "&cap;" "[intersection]" "[intersection]" "∩")
    354      ("cup" "\\cup" t "&cup;" "[union]" "[union]" "∪")
    355      ("smile" "\\smile" t "&smile;" "[cup product]" "[cup product]" "⌣")
    356      ("frown" "\\frown" t "&frown;" "[Cap product]" "[cap product]" "⌢")
    357      ("int" "\\int" t "&int;" "[integral]" "[integral]" "∫")
    358      ("therefore" "\\therefore" t "&there4;" "[therefore]" "[therefore]" "∴")
    359      ("there4" "\\therefore" t "&there4;" "[therefore]" "[therefore]" "∴")
    360      ("because" "\\because" t "&because;" "[because]" "[because]" "∵")
    361      ("sim" "\\sim" t "&sim;" "~" "~" "∼")
    362      ("cong" "\\cong" t "&cong;" "[approx. equal to]" "[approx. equal to]" "≅")
    363      ("simeq" "\\simeq" t "&cong;"  "[approx. equal to]" "[approx. equal to]" "≅")
    364      ("asymp" "\\asymp" t "&asymp;" "[almost equal to]" "[almost equal to]" "≈")
    365      ("approx" "\\approx" t "&asymp;" "[almost equal to]" "[almost equal to]" "≈")
    366      ("ne" "\\ne" t "&ne;" "[not equal to]" "[not equal to]" "≠")
    367      ("neq" "\\neq" t "&ne;" "[not equal to]" "[not equal to]" "≠")
    368      ("equiv" "\\equiv" t "&equiv;" "[identical to]" "[identical to]" "≡")
    369 
    370      ("triangleq" "\\triangleq" t "&triangleq;" "[defined to]" "[defined to]" "≜")
    371      ("le" "\\le" t "&le;" "<=" "<=" "≤")
    372      ("leq" "\\le" t "&le;" "<=" "<=" "≤")
    373      ("ge" "\\ge" t "&ge;" ">=" ">=" "≥")
    374      ("geq" "\\ge" t "&ge;" ">=" ">=" "≥")
    375      ("lessgtr" "\\lessgtr" t "&lessgtr;" "[less than or greater than]" "[less than or greater than]" "≶")
    376      ("lesseqgtr" "\\lesseqgtr" t "&lesseqgtr;" "[less than or equal or greater than or equal]" "[less than or equal or greater than or equal]" "⋚")
    377      ("ll" "\\ll" t  "&Lt;" "<<" "<<" "≪")
    378      ("Ll" "\\lll" t "&Ll;" "<<<" "<<<" "⋘")
    379      ("lll" "\\lll" t "&Ll;" "<<<" "<<<" "⋘")
    380      ("gg" "\\gg" t  "&Gt;" ">>" ">>" "≫")
    381      ("Gg" "\\ggg" t "&Gg;" ">>>" ">>>" "⋙")
    382      ("ggg" "\\ggg" t "&Gg;" ">>>" ">>>" "⋙")
    383      ("prec" "\\prec" t "&pr;" "[precedes]" "[precedes]" "≺")
    384      ("preceq" "\\preceq" t "&prcue;" "[precedes or equal]" "[precedes or equal]" "≼")
    385      ("preccurlyeq" "\\preccurlyeq" t "&prcue;" "[precedes or equal]" "[precedes or equal]" "≼")
    386      ("succ" "\\succ" t "&sc;" "[succeeds]" "[succeeds]" "≻")
    387      ("succeq" "\\succeq" t "&sccue;" "[succeeds or equal]" "[succeeds or equal]" "≽")
    388      ("succcurlyeq" "\\succcurlyeq" t "&sccue;" "[succeeds or equal]" "[succeeds or equal]" "≽")
    389      ("sub" "\\subset" t "&sub;" "[subset of]" "[subset of]" "⊂")
    390      ("subset" "\\subset" t "&sub;" "[subset of]" "[subset of]" "⊂")
    391      ("sup" "\\supset" t "&sup;" "[superset of]" "[superset of]" "⊃")
    392      ("supset" "\\supset" t "&sup;" "[superset of]" "[superset of]" "⊃")
    393      ("nsub" "\\not\\subset" t "&nsub;" "[not a subset of]" "[not a subset of" "⊄")
    394      ("sube" "\\subseteq" t "&sube;" "[subset of or equal to]" "[subset of or equal to]" "⊆")
    395      ("nsup" "\\not\\supset" t "&nsup;" "[not a superset of]" "[not a superset of]" "⊅")
    396      ("supe" "\\supseteq" t "&supe;" "[superset of or equal to]" "[superset of or equal to]" "⊇")
    397      ("setminus" "\\setminus" t "&setminus;" "\" "\" "⧵")
    398      ("forall" "\\forall" t "&forall;" "[for all]" "[for all]" "∀")
    399      ("exist" "\\exists" t "&exist;" "[there exists]" "[there exists]" "∃")
    400      ("exists" "\\exists" t "&exist;" "[there exists]" "[there exists]" "∃")
    401      ("nexist" "\\nexists" t "&exist;" "[there does not exists]" "[there does not  exists]" "∄")
    402      ("nexists" "\\nexists" t "&exist;" "[there does not exists]" "[there does not  exists]" "∄")
    403      ("empty" "\\emptyset" t "&empty;" "[empty set]" "[empty set]" "∅")
    404      ("emptyset" "\\emptyset" t "&empty;" "[empty set]" "[empty set]" "∅")
    405      ("isin" "\\in" t "&isin;" "[element of]" "[element of]" "∈")
    406      ("in" "\\in" t "&isin;" "[element of]" "[element of]" "∈")
    407      ("notin" "\\notin" t "&notin;" "[not an element of]" "[not an element of]" "∉")
    408      ("ni" "\\ni" t "&ni;" "[contains as member]" "[contains as member]" "∋")
    409      ("nabla" "\\nabla" t "&nabla;" "[nabla]" "[nabla]" "∇")
    410      ("ang" "\\angle" t "&ang;" "[angle]" "[angle]" "∠")
    411      ("angle" "\\angle" t "&ang;" "[angle]" "[angle]" "∠")
    412      ("perp" "\\perp" t "&perp;" "[up tack]" "[up tack]" "⊥")
    413      ("parallel" "\\parallel" t "&parallel;" "||" "||" "∥")
    414      ("sdot" "\\cdot" t "&sdot;" "[dot]" "[dot]" "⋅")
    415      ("cdot" "\\cdot" t "&sdot;" "[dot]" "[dot]" "⋅")
    416      ("lceil" "\\lceil" t "&lceil;" "[left ceiling]" "[left ceiling]" "⌈")
    417      ("rceil" "\\rceil" t "&rceil;" "[right ceiling]" "[right ceiling]" "⌉")
    418      ("lfloor" "\\lfloor" t "&lfloor;" "[left floor]" "[left floor]" "⌊")
    419      ("rfloor" "\\rfloor" t "&rfloor;" "[right floor]" "[right floor]" "⌋")
    420      ("lang" "\\langle" t "&lang;" "<" "<" "⟨")
    421      ("rang" "\\rangle" t "&rang;" ">" ">" "⟩")
    422      ("langle" "\\langle" t "&lang;" "<" "<" "⟨")
    423      ("rangle" "\\rangle" t "&rang;" ">" ">" "⟩")
    424      ("hbar" "\\hbar" t "&hbar;" "hbar" "hbar" "ℏ")
    425      ("mho" "\\mho" t "&mho;" "mho" "mho" "℧")
    426 
    427      "** Arrows"
    428      ("larr" "\\leftarrow" t "&larr;" "<-" "<-" "←")
    429      ("leftarrow" "\\leftarrow" t "&larr;"  "<-" "<-" "←")
    430      ("gets" "\\gets" t "&larr;"  "<-" "<-" "←")
    431      ("lArr" "\\Leftarrow" t "&lArr;" "<=" "<=" "⇐")
    432      ("Leftarrow" "\\Leftarrow" t "&lArr;" "<=" "<=" "⇐")
    433      ("uarr" "\\uparrow" t "&uarr;" "[uparrow]" "[uparrow]" "↑")
    434      ("uparrow" "\\uparrow" t "&uarr;" "[uparrow]" "[uparrow]" "↑")
    435      ("uArr" "\\Uparrow" t "&uArr;" "[dbluparrow]" "[dbluparrow]" "⇑")
    436      ("Uparrow" "\\Uparrow" t "&uArr;" "[dbluparrow]" "[dbluparrow]" "⇑")
    437      ("rarr" "\\rightarrow" t "&rarr;" "->" "->" "→")
    438      ("to" "\\to" t "&rarr;" "->" "->" "→")
    439      ("rightarrow" "\\rightarrow" t "&rarr;"  "->" "->" "→")
    440      ("rArr" "\\Rightarrow" t "&rArr;" "=>" "=>" "⇒")
    441      ("Rightarrow" "\\Rightarrow" t "&rArr;" "=>" "=>" "⇒")
    442      ("darr" "\\downarrow" t "&darr;" "[downarrow]" "[downarrow]" "↓")
    443      ("downarrow" "\\downarrow" t "&darr;" "[downarrow]" "[downarrow]" "↓")
    444      ("dArr" "\\Downarrow" t "&dArr;" "[dbldownarrow]" "[dbldownarrow]" "⇓")
    445      ("Downarrow" "\\Downarrow" t "&dArr;" "[dbldownarrow]" "[dbldownarrow]" "⇓")
    446      ("harr" "\\leftrightarrow" t "&harr;" "<->" "<->" "↔")
    447      ("leftrightarrow" "\\leftrightarrow" t "&harr;"  "<->" "<->" "↔")
    448      ("hArr" "\\Leftrightarrow" t "&hArr;" "<=>" "<=>" "⇔")
    449      ("Leftrightarrow" "\\Leftrightarrow" t "&hArr;" "<=>" "<=>" "⇔")
    450      ("crarr" "\\hookleftarrow" t "&crarr;" "<-'" "<-'" "↵")
    451      ("hookleftarrow" "\\hookleftarrow" t "&crarr;"  "<-'" "<-'" "↵")
    452 
    453      "** Function names"
    454      ("arccos" "\\arccos" t "arccos" "arccos" "arccos" "arccos")
    455      ("arcsin" "\\arcsin" t "arcsin" "arcsin" "arcsin" "arcsin")
    456      ("arctan" "\\arctan" t "arctan" "arctan" "arctan" "arctan")
    457      ("arg" "\\arg" t "arg" "arg" "arg" "arg")
    458      ("cos" "\\cos" t "cos" "cos" "cos" "cos")
    459      ("cosh" "\\cosh" t "cosh" "cosh" "cosh" "cosh")
    460      ("cot" "\\cot" t "cot" "cot" "cot" "cot")
    461      ("coth" "\\coth" t "coth" "coth" "coth" "coth")
    462      ("csc" "\\csc" t "csc" "csc" "csc" "csc")
    463      ("deg" "\\deg" t "&deg;" "deg" "deg" "deg")
    464      ("det" "\\det" t "det" "det" "det" "det")
    465      ("dim" "\\dim" t "dim" "dim" "dim" "dim")
    466      ("exp" "\\exp" t "exp" "exp" "exp" "exp")
    467      ("gcd" "\\gcd" t "gcd" "gcd" "gcd" "gcd")
    468      ("hom" "\\hom" t "hom" "hom" "hom" "hom")
    469      ("inf" "\\inf" t "inf" "inf" "inf" "inf")
    470      ("ker" "\\ker" t "ker" "ker" "ker" "ker")
    471      ("lg" "\\lg" t "lg" "lg" "lg" "lg")
    472      ("lim" "\\lim" t "lim" "lim" "lim" "lim")
    473      ("liminf" "\\liminf" t "liminf" "liminf" "liminf" "liminf")
    474      ("limsup" "\\limsup" t "limsup" "limsup" "limsup" "limsup")
    475      ("ln" "\\ln" t "ln" "ln" "ln" "ln")
    476      ("log" "\\log" t "log" "log" "log" "log")
    477      ("max" "\\max" t "max" "max" "max" "max")
    478      ("min" "\\min" t "min" "min" "min" "min")
    479      ("Pr" "\\Pr" t "Pr" "Pr" "Pr" "Pr")
    480      ("sec" "\\sec" t "sec" "sec" "sec" "sec")
    481      ("sin" "\\sin" t "sin" "sin" "sin" "sin")
    482      ("sinh" "\\sinh" t "sinh" "sinh" "sinh" "sinh")
    483      ("sup" "\\sup" t "&sup;" "sup" "sup" "sup")
    484      ("tan" "\\tan" t "tan" "tan" "tan" "tan")
    485      ("tanh" "\\tanh" t "tanh" "tanh" "tanh" "tanh")
    486 
    487      "** Signs & Symbols"
    488      ("bull" "\\textbullet{}" nil "&bull;" "*" "*" "•")
    489      ("bullet" "\\textbullet{}" nil "&bull;" "*" "*" "•")
    490      ("star" "\\star" t "*" "*" "*" "⋆")
    491      ("lowast" "\\ast" t "&lowast;" "*" "*" "∗")
    492      ("ast" "\\ast" t "&lowast;" "*" "*" "*")
    493      ("odot" "\\odot" t "o" "[circled dot]" "[circled dot]" "ʘ")
    494      ("oplus" "\\oplus" t "&oplus;" "[circled plus]" "[circled plus]" "⊕")
    495      ("otimes" "\\otimes" t "&otimes;" "[circled times]" "[circled times]" "⊗")
    496      ("check" "\\checkmark" t "&checkmark;" "[checkmark]" "[checkmark]" "✓")
    497      ("checkmark" "\\checkmark" t "&check;" "[checkmark]" "[checkmark]" "✓")
    498 
    499      "** Miscellaneous (seldom used)"
    500      ("ordf" "\\textordfeminine{}" nil "&ordf;" "_a_" "ª" "ª")
    501      ("ordm" "\\textordmasculine{}" nil "&ordm;" "_o_" "º" "º")
    502      ("cedil" "\\c{}" nil "&cedil;" "[cedilla]" "¸" "¸")
    503      ("oline" "\\overline{~}" t "&oline;" "[overline]" "¯" "‾")
    504      ("uml" "\\textasciidieresis{}" nil "&uml;" "[diaeresis]" "¨" "¨")
    505      ("zwnj" "\\/{}" nil "&zwnj;" "" "" "‌")
    506      ("zwj" "" nil "&zwj;" "" "" "‍")
    507      ("lrm" "" nil "&lrm;" "" "" "‎")
    508      ("rlm" "" nil "&rlm;" "" "" "‏")
    509 
    510      "** Smilies"
    511      ("smiley" "\\ddot\\smile" t "&#9786;" ":-)" ":-)" "☺")
    512      ("blacksmile" "\\ddot\\smile" t "&#9787;" ":-)" ":-)" "☻")
    513      ("sad" "\\ddot\\frown" t "&#9785;" ":-(" ":-(" "☹")
    514      ("frowny" "\\ddot\\frown" t "&#9785;" ":-(" ":-(" "☹")
    515 
    516      "** Suits"
    517      ("clubs" "\\clubsuit" t "&clubs;" "[clubs]" "[clubs]" "♣")
    518      ("clubsuit" "\\clubsuit" t "&clubs;" "[clubs]" "[clubs]" "♣")
    519      ("spades" "\\spadesuit" t "&spades;" "[spades]" "[spades]" "♠")
    520      ("spadesuit" "\\spadesuit" t "&spades;" "[spades]" "[spades]" "♠")
    521      ("hearts" "\\heartsuit" t "&hearts;" "[hearts]" "[hearts]" "♥")
    522      ("heartsuit" "\\heartsuit" t "&heartsuit;" "[hearts]" "[hearts]" "♥")
    523      ("diams" "\\diamondsuit" t "&diams;" "[diamonds]" "[diamonds]" "◆")
    524      ("diamondsuit" "\\diamondsuit" t "&diams;" "[diamonds]" "[diamonds]" "◆")
    525      ("diamond" "\\diamondsuit" t "&diamond;" "[diamond]" "[diamond]" "◆")
    526      ("Diamond" "\\diamondsuit" t "&diamond;" "[diamond]" "[diamond]" "◆")
    527      ("loz" "\\lozenge" t "&loz;" "[lozenge]" "[lozenge]" "⧫"))
    528    ;; Add "\_ "-entity family for spaces.
    529    (let (space-entities html-spaces (entity "_"))
    530      (dolist (n (number-sequence 1 20) (nreverse space-entities))
    531        (let ((spaces (make-string n ?\s)))
    532 	 (push (list (setq entity (concat entity " "))
    533 		     (format "\\hspace*{%sem}" (* n .5))
    534 		     nil
    535 		     (setq html-spaces (concat "&ensp;" html-spaces))
    536 		     spaces
    537 		     spaces
    538 		     (make-string n ?\x2002))
    539 	       space-entities)))))
    540   "Default entities used in Org mode to produce special characters.
    541 For details see `org-entities-user'.")
    542 
    543 (defsubst org-entity-get (name)
    544   "Get the proper association for NAME from the entity lists.
    545 This first checks the user list, then the built-in list."
    546   (or (assoc name org-entities-user)
    547       (assoc name org-entities)))
    548 
    549 ;; Helpfunctions to create a table for orgmode.org/worg/org-symbols.org
    550 
    551 (defun org-entities-create-table ()
    552   "Create an Org mode table with all entities."
    553   (interactive)
    554   (let ((pos (point)))
    555     (insert "|Name|LaTeX code|LaTeX|HTML code |HTML|ASCII|Latin1|UTF-8\n|-\n")
    556     (dolist (e org-entities)
    557       (pcase e
    558 	(`(,name ,latex ,mathp ,html ,ascii ,latin ,utf8)
    559 	 (when (equal ascii "|") (setq ascii "\\vert"))
    560 	 (when (equal latin "|") (setq latin "\\vert"))
    561 	 (when (equal utf8  "|") (setq utf8  "\\vert"))
    562 	 (when (equal ascii "=>") (setq ascii "= >"))
    563 	 (when (equal latin "=>") (setq latin "= >"))
    564 	 (insert "|" name
    565 		 "|" (format "=%s=" latex)
    566 		 "|" (format (if mathp "$%s$" "$\\mbox{%s}$") latex)
    567 		 "|" (format "=%s=" html) "|" html
    568 		 "|" ascii "|" latin "|" utf8
    569 		 "|\n"))))
    570     (goto-char pos)
    571     (org-table-align)))
    572 
    573 (defvar org-pretty-entities) ;; declare defcustom from org
    574 (defun org-entities-help ()
    575   "Create a Help buffer with all available entities."
    576   (interactive)
    577   (with-output-to-temp-buffer "*Org Entity Help*"
    578     (princ "Org mode entities\n=================\n\n")
    579     (let ((ll (append '("* User-defined additions (variable org-entities-user)")
    580 		      org-entities-user
    581 		      org-entities))
    582 	  (lastwasstring t)
    583 	  (head (concat
    584 		 "\n"
    585 		 "   Symbol   Org entity        LaTeX code             HTML code\n"
    586 		 "   -----------------------------------------------------------\n")))
    587       (dolist (e ll)
    588 	(pcase e
    589 	  (`(,name ,latex ,_ ,html ,_ ,_ ,utf8)
    590 	   (when lastwasstring
    591 	     (princ head)
    592 	     (setq lastwasstring nil))
    593 	   (princ (format "   %-8s \\%-16s %-22s %-13s\n"
    594 			  utf8 name latex html)))
    595 	  ((pred stringp)
    596 	   (princ e)
    597 	   (princ "\n")
    598 	   (setq lastwasstring t))))))
    599   (with-current-buffer "*Org Entity Help*"
    600     (org-mode)
    601     (when org-pretty-entities
    602       (org-toggle-pretty-entities)))
    603   (select-window (get-buffer-window "*Org Entity Help*")))
    604 
    605 
    606 (provide 'org-entities)
    607 
    608 ;; Local variables:
    609 ;; coding: utf-8
    610 ;; End:
    611 
    612 ;;; org-entities.el ends here