org-entities.el 29 KB

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