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