org-entities.el 29 KB

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