summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2010-03-28 09:48:03 +0200
committerCarsten Dominik <carsten.dominik@gmail.com>2010-04-01 12:44:01 +0200
commitda556cee82f98ced8ba03abd186d3a8886844db0 (patch)
treeb3943c8751ec388a073522f012986d987410cea6
parent31b19b1afcbbb48f38d49b7ac5eb8a0faf3a95b3 (diff)
downloadorg-mode-da556cee82f98ced8ba03abd186d3a8886844db0.tar.gz
Implement new and better support for entities
-rw-r--r--lisp/org-ascii.el26
-rw-r--r--lisp/org-docbook.el8
-rw-r--r--lisp/org-entities.el446
-rw-r--r--lisp/org-exp.el309
-rw-r--r--lisp/org-html.el8
-rw-r--r--lisp/org-latex.el66
-rw-r--r--lisp/org.el8
7 files changed, 526 insertions, 345 deletions
diff --git a/lisp/org-ascii.el b/lisp/org-ascii.el
index 00840fa..8ac5403 100644
--- a/lisp/org-ascii.el
+++ b/lisp/org-ascii.el
@@ -72,6 +72,21 @@ i.e. with \"=>\" as ellipsis."
:group 'org-export-ascii
:type 'boolean)
+(defcustom org-export-ascii-entities 'ascii
+ "The ascii representation to be used during ascii export.
+Possible values are:
+
+ascii Only use plain ASCII characters
+latin1 Include Latin-1 character
+utf8 Use all UTF-8 characters
+coding-system Automatically adapt to the coding system of the output file
+ This setting is not yet implemented."
+ :group 'org-export-ascii
+ :type '(choice
+ (const :tag "Use what the file coding system supports (not yet implemented)" coding-system)
+ (const :tag "Plain ASCII only" ascii)
+ (const :tag "Add Latin-1 characters" latin1)
+ (const :tag "Use utf8 representations" utf8)))
;;; Hooks
(defvar org-export-ascii-final-hook nil
@@ -504,6 +519,8 @@ publishing directory."
(when org-export-ascii-table-widen-columns
(let ((org-table-do-narrow nil))
(goto-char (point-min))
+ (org-ascii-replace-entities)
+ (goto-char (point-min))
(org-table-map-tables
(lambda ()
(org-if-unprotected
@@ -531,6 +548,15 @@ publishing directory."
(setq line (replace-match "" nil nil line))))
line)
+(defun org-ascii-replace-entities ()
+ "Replace entities with the ASCII representation."
+ (let (e)
+ (while (re-search-forward "\\\\\\([a-zA-Z]+[0-9]*\\)" nil t)
+ (org-if-unprotected-at (match-beginning 1)
+ (setq e (org-entity-get-representation (match-string 1 line)
+ org-export-ascii-entities))
+ (and e (replace-match e t t))))))
+
(defun org-export-ascii-wrap (line where)
"Wrap LINE at or before WHERE."
(let ((ind (org-get-indentation line))
diff --git a/lisp/org-docbook.el b/lisp/org-docbook.el
index 1449f55..cf4c6f7 100644
--- a/lisp/org-docbook.el
+++ b/lisp/org-docbook.el
@@ -1259,16 +1259,14 @@ string, don't modify these."
(if org-export-with-sub-superscripts
(setq s (org-export-docbook-convert-sub-super s)))
(if org-export-with-TeX-macros
- (let ((start 0) wd ass)
+ (let ((start 0) wd rep)
(while (setq start (string-match "\\\\\\([a-zA-Z]+\\)\\({}\\)?"
s start))
(if (get-text-property (match-beginning 0) 'org-protected s)
(setq start (match-end 0))
(setq wd (match-string 1 s))
- (if (setq ass (assoc wd org-html-entities))
- (setq s (replace-match (or (cdr ass)
- (concat "&" (car ass) ";"))
- t t s))
+ (if (setq ass (org-entity-get-representation wd 'html))
+ (setq s (replace-match rep t t s))
(setq start (+ start (length wd))))))))
s)
diff --git a/lisp/org-entities.el b/lisp/org-entities.el
new file mode 100644
index 0000000..d9e4d5a
--- /dev/null
+++ b/lisp/org-entities.el
@@ -0,0 +1,446 @@
+;;; org-entities.el --- Support for special entities in Org-mode
+
+;; Copyright (C) 2010 Free Software Foundation, Inc.
+
+;; Author: Carsten Dominik <carsten at orgmode dot org>,
+;; Ulf Stegemann <ulf at zeitform dot de>
+;; Keywords: outlines, calendar, wp
+;; Homepage: http://orgmode.org
+;; Version: 6.34trans
+;;
+;; This file is part of GNU Emacs.
+;;
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;; Commentary:
+
+(eval-when-compile
+ (require 'cl))
+
+(defgroup org-entities nil
+ "Options concerning entities in Org-mode."
+ :tag "Org Entities"
+ :group 'org)
+
+(defcustom org-entities-ascii-explanatory nil
+ "Non-nil means replace special entities in ASCII.
+For example, this will replace \"\\nsup\" with \"[not a superset of]\"
+in backends where the corresponding character is not available."
+ :group 'org-entities
+ :type 'boolean)
+
+(defcustom org-entities-user nil
+ "User-defined entities used in Org-mode to preduce special characters.
+Each entry in this list is a list of strings. It associate the name
+of the entity that can be inserted into an Org file as \\name with the
+appropriate replacements for the different export backends. The order
+of the fields is he following
+
+name As a string, without the leading backslash
+LaTeX replacement In ready LaTeX, no further processing will take place
+LaTeX mathp A Boolean, either t or nil. t if this entity needs
+ to be in math mode.
+HTML replacement In ready HTML, no further processing will take place.
+ Usually this will be an &...; entity.
+ASCII replacement Plain ASCII, no extensions. Symbols that cannot be
+ represented will be written out as an explanatory text.
+ But see the variable `org-entities-ascii-keep-macro-form'.
+Latin1 replacement Use the special characters available in latin1.
+utf-8 replacement Use special character available in utf-8."
+ :group 'org-entities
+ :type '(repeat
+ (list
+ (string :tag "name ")
+ (string :tag "LaTeX ")
+ (boolean :tag "Require LaTeX math?")
+ (string :tag "HTML ")
+ (string :tag "ASCII ")
+ (string :tag "Latin1")
+ (string :tag "utf-8 "))))
+
+(defconst org-entities
+ '(("nbsp" "~" nil "&nbsp;" " " " " " ")
+ ("iexcl" "!`" nil "&iexcl;" "!" "¡" "¡")
+ ("cent" "\\textcent" nil "&cent;" "cent" "¢" "¢")
+ ("pound" "\\pounds" nil "&pound;" "pound" "£" "£")
+ ("curren" "\\textcurrency" nil "&curren;" "curr." "¤" "¤")
+ ("yen" "\\textyen" nil "&yen;" "yen" "¥" "¥")
+ ("brvbar" "\\textbrokenbar" nil "&brvbar;" "|" "¦" "¦")
+ ("vert" "\\vert" t "&#124;" "|" "|" "|")
+ ("sect" "\\S" nil "&sect;" "paragraph" "§" "§")
+ ("uml" "\\textasciidieresis" nil "&uml;" "[diaeresis]" "¨" "¨")
+ ("copy" "\\textcopyright" nil "&copy;" "(c)" "©" "©")
+ ("ordf" "\\textordfeminine" nil "&ordf;" "_a_" "ª" "ª")
+ ("laquo" "\\guillemotleft" nil "&laquo;" "<<" "«" "«")
+ ("not" "\\textlnot" nil "&not;" "[angled dash]" "¬" "¬")
+ ("shy" "\\-" nil "&shy;" "" "" "")
+ ("reg" "\\textregistered" nil "&reg;" "(r)" "®" "®")
+ ("macr" "\\textasciimacron" nil "&macr;" "[macron]" "¯" "¯")
+ ("deg" "\\textdegree" nil "deg" "degree" "°" "°")
+ ("pm" "\\textpm" nil "&plusmn;" "+-" "±" "±")
+ ("plusmn" "\\textpm" nil "&plusmn;" "+-" "±" "±")
+ ("sup2" "\\texttwosuperior" nil "&sup2;" "^2" "²" "²")
+ ("sup3" "\\textthreesuperior" nil "&sup3;" "^3" "³" "³")
+ ("acute x" "\\acute x" t "&acute x;" "'x" "'x" "𝑥́")
+ ("micro" "\\textmu" nil "&micro;" "micro" "µ" "µ")
+ ("para" "\\P" nil "&para;" "[pilcrow]" "¶" "¶")
+ ("middot" "\\textperiodcentered" nil "&middot;" "." "·" "·")
+ ("odot" "\\odot" t "o" "[circled dot]" "[circled dot]" "ʘ")
+ ("star" "\\star" t "*" "*" "*" "⋆")
+ ("cedil" "\\c" nil "&cedil;" "[cedilla]" "¸" "¸")
+ ("sup1" "\\textonesuperior" nil "&sup1;" "^1" "¹" "¹")
+ ("ordm" "\\textordmasculine" nil "&ordm;" "_o_" "º" "º")
+ ("raquo" "\\guillemotright" nil "&raquo;" ">>" "»" "»")
+ ("iquest" "?`" nil "&iquest;" "?" "¿" "¿")
+ ("Agrave" "\\`{A}" nil "&Agrave;" "A" "À" "À")
+ ("Aacute" "\\'{A}" nil "&Aacute;" "A" "Á" "Á")
+ ("Acirc" "\\^{A}" nil "&Acirc;" "A" "Â" "Â")
+ ("Atilde" "\\~{A}" nil "&Atilde;" "A" "Ã" "Ã")
+ ("Auml" "\\\"{A}" nil "&Auml;" "Ae" "Ä" "Ä")
+ ("Aring" "\\AA" nil "&Aring;" "A" "Å" "Å")
+ ("AA" "\\AA" nil "&Aring;" "A" "Å" "Å")
+ ("AElig" "\\AE" nil "&AElig;" "AE" "Æ" "Æ")
+ ("Ccedil" "\\c{C}" nil "&Ccedil;" "C" "Ç" "Ç")
+ ("Egrave" "\\`{E}" nil "&Egrave;" "E" "È" "È")
+ ("Eacute" "\\'{E}" nil "&Eacute;" "E" "É" "É")
+ ("Ecirc" "\\^{E}" nil "&Ecirc;" "E" "Ê" "Ê")
+ ("Euml" "\\\"{E}" nil "&Euml;" "E" "Ë" "Ë")
+ ("Igrave" "\\`{I}" nil "&Igrave;" "I" "Ì" "Ì")
+ ("Iacute" "\\'{I}" nil "&Iacute;" "I" "Í" "Í")
+ ("Icirc" "\\^{I}" nil "&Icirc;" "I" "Î" "Î")
+ ("Iuml" "\\\"{I}" nil "&Iuml;" "I" "Ï" "Ï")
+ ("ETH" "\\DH" nil "&ETH;" "D" "Ð" "Ð")
+ ("Ntilde" "\\~{N}" nil "&Ntilde;" "N" "Ñ" "Ñ")
+ ("Ograve" "\\`{O}" nil "&Ograve;" "O" "Ò" "Ò")
+ ("Oacute" "\\'{O}" nil "&Oacute;" "O" "Ó" "Ó")
+ ("Ocirc" "\\^{O}" nil "&Ocirc;" "O" "Ô" "Ô")
+ ("Otilde" "\\~{O}" nil "&Otilde;" "O" "Õ" "Õ")
+ ("Ouml" "\\\"{O}" nil "&Ouml;" "Oe" "Ö" "Ö")
+ ("times" "\\texttimes" nil "&times;" "*" "×" "×")
+ ("Oslash" "\\O" nil "&Oslash;" "O" "Ø" "Ø")
+ ("Ugrave" "\\`{U}" nil "&Ugrave;" "U" "Ù" "Ù")
+ ("Uacute" "\\'{U}" nil "&Uacute;" "U" "Ú" "Ú")
+ ("Ucirc" "\\^{U}" nil "&Ucirc;" "U" "Û" "Û")
+ ("Uuml" "\\\"{U}" nil "&Uuml;" "Ue" "Ü" "Ü")
+ ("Yacute" "\\'{Y}" nil "&Yacute;" "Y" "Ý" "Ý")
+ ("THORN" "\\TH" nil "&THORN;" "TH" "Þ" "Þ")
+ ("szlig" "\\ss" nil "&szlig;" "ss" "ß" "ß")
+ ("agrave" "\\`{a}" nil "&agrave;" "a" "à" "à")
+ ("aacute" "\\'{a}" nil "&aacute;" "a" "á" "á")
+ ("acirc" "\\^{a}" nil "&acirc;" "a" "â" "â")
+ ("atilde" "\\~{a}" nil "&atilde;" "a" "ã" "ã")
+ ("auml" "\\\"{a}" nil "&auml;" "ae" "ä" "ä")
+ ("aring" "\\aa" nil "&aring;" "a" "å" "å")
+ ("aelig" "\\ae" nil "&aelig;" "ae" "æ" "æ")
+ ("ccedil" "\\c{c}" nil "&ccedil;" "c" "ç" "ç")
+ ("checkmark" "\\checkmark" t "&#10003;" "[checkmark]" "[checkmark]" "✓")
+ ("egrave" "\\`{e}" nil "&egrave;" "e" "è" "è")
+ ("eacute" "\\'{e}" nil "&eacute;" "e" "é" "é")
+ ("ecirc" "\\^{e}" nil "&ecirc;" "e" "ê" "ê")
+ ("euml" "\\\"{e}" nil "&euml;" "e" "ë" "ë")
+ ("igrave" "\\`{i}" nil "&igrave;" "i" "ì" "ì")
+ ("iacute" "\\'{i}" nil "&iacute;" "i" "í" "í")
+ ("icirc" "\\^{i}" nil "&icirc;" "i" "î" "î")
+ ("iuml" "\\\"{i}" nil "&iuml;" "i" "ï" "ï")
+ ("eth" "\\dh" nil "&eth;" "dh" "ð" "ð")
+ ("ntilde" "\\~{n}" nil "&ntilde;" "n" "ñ" "ñ")
+ ("ograve" "\\`{o}" nil "&ograve;" "o" "ò" "ò")
+ ("oacute" "\\'{o}" nil "&oacute;" "o" "ó" "ó")
+ ("ocirc" "\\^{o}" nil "&ocirc;" "o" "ô" "ô")
+ ("otilde" "\\~{o}" nil "&otilde;" "o" "õ" "õ")
+ ("ouml" "\\\"{o}" nil "&ouml;" "oe" "ö" "ö")
+ ("oslash" "\\o" nil "&oslash;" "o" "ø" "ø")
+ ("ugrave" "\\`{u}" nil "&ugrave;" "u" "ù" "ù")
+ ("uacute" "\\'{u}" nil "&uacute;" "u" "ú" "ú")
+ ("ucirc" "\\^{u}" nil "&ucirc;" "u" "û" "û")
+ ("uuml" "\\\"{u}" nil "&uuml;" "ue" "ü" "ü")
+ ("yacute" "\\'{y}" nil "&yacute;" "y" "ý" "ý")
+ ("thorn" "\\th" nil "&thorn;" "th" "þ" "þ")
+ ("yuml" "\\\"{y}" nil "&yuml;" "y" "ÿ" "ÿ")
+ ("fnof" "\\textit{f}" nil "&fnof;" "f" "f" "ƒ")
+ ("Alpha" "A" nil "&Alpha;" "Alpha" "Alpha" "Α")
+ ("Beta" "B" nil "&Beta;" "Beta" "Beta" "Β")
+ ("Gamma" "\\Gamma" t "&Gamma;" "Gamma" "Gamma" "Γ")
+ ("Delta" "\\Delta" t "&Delta;" "Delta" "Gamma" "Δ")
+ ("Epsilon" "E" nil "&Epsilon;" "Epsilon" "Epsilon" "Ε")
+ ("Zeta" "Z" nil "&Zeta;" "Zeta" "Zeta" "Ζ")
+ ("Eta" "H" nil "&Eta;" "Eta" "Eta" "Η")
+ ("Theta" "\\Theta" t "&Theta;" "Theta" "Theta" "Θ")
+ ("Iota" "I" nil "&Iota;" "Iota" "Iota" "Ι")
+ ("Kappa" "K" nil "&Kappa;" "Kappa" "Kappa" "Κ")
+ ("Lambda" "\\Lambda" t "&Lambda;" "Lambda" "Lambda" "Λ")
+ ("Mu" "M" nil "&Mu;" "Mu" "Mu" "Μ")
+ ("Nu" "N" nil "&Nu;" "Nu" "Nu" "Ν")
+ ("Xi" "\\Xi" t "&Xi;" "Xi" "Xi" "Ξ")
+ ("Omicron" "O" nil "&Omicron;" "Omicron" "Omicron" "Ο")
+ ("Pi" "\\Pi" t "&Pi;" "Pi" "Pi" "Π")
+ ("Rho" "P" nil "&Rho;" "Rho" "Rho" "Ρ")
+ ("Sigma" "\\Sigma" t "&Sigma;" "Sigma" "Sigma" "Σ")
+ ("Tau" "T" nil "&Tau;" "Tau" "Tau" "Τ")
+ ("Upsilon" "\\Upsilon" t "&Upsilon;" "Upsilon" "Upsilon" "Υ")
+ ("Phi" "\\Phi" t "&Phi;" "Phi" "Phi" "Φ")
+ ("Chi" "X" nil "&Chi;" "Chi" "Chi" "Χ")
+ ("Psi" "\\Psi" t "&Psi;" "Psi" "Psi" "Ψ")
+ ("Omega" "\\Omega" t "&Omega;" "Omega" "Omega" "Ω")
+ ("alpha" "\\alpha" t "&alpha;" "alpha" "alpha" "α")
+ ("beta" "\\beta" t "&beta;" "beta" "beta" "β")
+ ("gamma" "\\gamma" t "&gamma;" "gamma" "gamma" "γ")
+ ("delta" "\\delta" t "&delta;" "delta" "delta" "δ")
+ ("epsilon" "\\epsilon" t "&epsilon;" "epsilon" "epsilon" "ε")
+ ("varepsilon" "\\varepsilon" t "&epsilon;" "varepsilon" "varepsilon" "ε")
+ ("zeta" "\\zeta" t "&zeta;" "zeta" "zeta" "ζ")
+ ("eta" "\\eta" t "&eta;" "eta" "eta" "η")
+ ("theta" "\\theta" t "&theta;" "theta" "theta" "θ")
+ ("iota" "\\iota" t "&iota;" "iota" "iota" "ι")
+ ("kappa" "\\kappa" t "&kappa;" "kappa" "kappa" "κ")
+ ("lambda" "\\lambda" t "&lambda;" "lambda" "lambda" "λ")
+ ("mu" "\\mu" t "&mu;" "mu" "mu" "μ")
+ ("nu" "\\nu" t "&nu;" "nu" "nu" "ν")
+ ("xi" "\\xi" t "&xi;" "xi" "xi" "ξ")
+ ("omicron" "\\textit{o}" nil "&omicron;" "omicron" "omicron" "ο")
+ ("pi" "\\pi" t "&pi;" "pi" "pi" "π")
+ ("rho" "\\rho" t "&rho;" "rho" "rho" "ρ")
+ ("sigmaf" "\\varsigma" t "&sigmaf;" "sigmaf" "sigmaf" "ς")
+ ("varsigma" "\\varsigma" t "&sigmaf;" "varsigma" "varsigma" "ς")
+ ("sigma" "\\sigma" t "&sigma;" "sigma" "sigma" "σ")
+ ("tau" "\\tau" t "&tau;" "tau" "tau" "τ")
+ ("upsilon" "\\upsilon" t "&upsilon;" "upsilon" "upsilon" "υ")
+ ("phi" "\\phi" t "&phi;" "phi" "phi" "φ")
+ ("chi" "\\chi" t "&chi;" "chi" "chi" "χ")
+ ("psi" "\\psi" t "&psi;" "psi" "psi" "ψ")
+ ("omega" "\\omega" t "&omega;" "omega" "omega" "ω")
+ ("thetasym" "\\vartheta" t "&thetasym;" "theta" "theta" "ϑ")
+ ("vartheta" "\\vartheta" t "&thetasym;" "theta" "theta" "ϑ")
+ ("upsih" "\\Upsilon" t "&upsih;" "upsilon" "upsilon" "ϒ")
+ ("piv" "\\varpi" t "&piv;" "omega-pi" "omega-pi" "ϖ")
+ ("bull" "\\textbullet" nil "&bull;" "*" "*" "•")
+ ("bullet" "\\textbullet" nil "&bull;" "*" "*" "•")
+ ("hellip" "\\dots" nil "&hellip;" "..." "..." "…")
+ ("dots" "\\dots" nil "&hellip;" "..." "..." "…")
+ ("prime" "\\prime" t "&prime;" "'" "'" "′")
+ ("Prime" "\\prime{}\\prime" t "&Prime;" "''" "''" "″")
+ ("oline" "\\overline{~}" t "&oline;" "[overline]" "¯" "‾")
+ ("frasl" "/" nil "&frasl;" "/" "/" "⁄")
+ ("weierp" "\\wp" t "&weierp;" "P" "P" "℘")
+ ("image" "\\Im" t "&image;" "I" "I" "ℑ")
+ ("real" "\\Re" t "&real;" "R" "R" "ℜ")
+ ("trade" "\\texttrademark" nil "&trade;" "TM" "TM" "™")
+ ("alefsym" "\\aleph" t "&alefsym;" "aleph" "aleph" "ℵ")
+ ("larr" "\\leftarrow" t "&larr;" "<-" "<-" "←")
+ ("leftarrow" "\\leftarrow" t "&larr;" "<-" "<-" "←")
+ ("gets" "\\gets" t "&larr;" "<-" "<-" "←")
+ ("uarr" "\\uparrow" t "&uarr;" "[uparrow]" "[uparrow]" "↑")
+ ("uparrow" "\\uparrow" t "&uarr;" "[uparrow]" "[uparrow]" "↑")
+ ("rarr" "\\rightarrow" t "&rarr;" "->" "->" "→")
+ ("to" "\\to" t "&rarr;" "->" "->" "→")
+ ("rightarrow" "\\rightarrow" t "&rarr;" "->" "->" "→")
+ ("darr" "\\downarrow" t "&darr;" "[downarrow]" "[downarrow]" "↓")
+ ("downarrow" "\\downarrow" t "&darr;" "[downarrow]" "[downarrow]" "↓")
+ ("harr" "\\leftrightarrow" t "&harr;" "<->" "<->" "↔")
+ ("leftrightarrow" "\\leftrightarrow" t "&harr;" "<->" "<->" "↔")
+ ("crarr" "\\hookleftarrow" t "&crarr;" "<-'" "<-'" "↵")
+ ("hookleftarrow" "\\hookleftarrow" t "&crarr;" "<-'" "<-'" "↵")
+ ("lArr" "\\Leftarrow" t "&lArr;" "<=" "<=" "⇐")
+ ("Leftarrow" "\\Leftarrow" t "&lArr;" "<=" "<=" "⇐")
+ ("uArr" "\\Uparrow" t "&uArr;" "[dbluparrow]" "[dbluparrow]" "⇑")
+ ("Uparrow" "\\Uparrow" t "&uArr;" "[dbluparrow]" "[dbluparrow]" "⇑")
+ ("rArr" "\\Rightarrow" t "&rArr;" "=>" "=>" "⇒")
+ ("Rightarrow" "\\Rightarrow" t "&rArr;" "=>" "=>" "⇒")
+ ("dArr" "\\Downarrow" t "&dArr;" "[dbldownarrow]" "[dbldownarrow]" "⇓")
+ ("Downarrow" "\\Downarrow" t "&dArr;" "[dbldownarrow]" "[dbldownarrow]" "⇓")
+ ("hArr" "\\Leftrightarrow" t "&hArr;" "<=>" "<=>" "⇔")
+ ("Leftrightarrow" "\\Leftrightarrow" t "&hArr;" "<=>" "<=>" "⇔")
+ ("forall" "\\forall" t "&forall;" "[for all]" "[for all]" "∀")
+ ("partial" "\\partial" t "&part;" "[partial differential]" "[partial differential]" "∂")
+ ("exist" "\\exists" t "&exist;" "[there exists]" "[there exists]" "∃")
+ ("exists" "\\exists" t "&exist;" "[there exists]" "[there exists]" "∃")
+ ("empty" "\\empty" t "&empty;" "[empty set]" "[empty set]" "∅")
+ ("emptyset" "\\emptyset" t "&empty;" "[empty set]" "[empty set]" "∅")
+ ("nabla" "\\nabla" t "&nabla;" "[nabla]" "[nabla]" "∇")
+ ("isin" "\\in" t "&isin;" "[element of]" "[element of]" "∈")
+ ("in" "\\in" t "&isin;" "[element of]" "[element of]" "∈")
+ ("notin" "\\notin" t "&notin;" "[not an element of]" "[not an element of]" "∉")
+ ("ni" "\\ni" t "&ni;" "[contains as member]" "[contains as member]" "∋")
+ ("prod" "\\prod" t "&prod;" "[product]" "[n-ary product]" "∏")
+ ("sum" "\\sum" t "&sum;" "[sum]" "[sum]" "∑")
+; ("minus" "\\minus" t "&minus;" "-" "-" "−")
+ ("minus" "-" t "&minus;" "-" "-" "−")
+ ("lowast" "\\ast" t "&lowast;" "*" "*" "∗")
+ ("ast" "\\ast" t "&lowast;" "*" "*" "*")
+ ("radic" "\\sqrt{\,}" t "&radic;" "[square root]" "[square root]" "√")
+ ("prop" "\\propto" t "&prop;" "[proportional to]" "[proportional to]" "∝")
+ ("proptp" "\\propto" t "&prop;" "[proportional to]" "[proportional to]" "∝")
+ ("infin" "\\propto" t "&infin;" "[infinity]" "[infinity]" "∞")
+ ("infty" "\\infty" t "&infin;" "[infinity]" "[infinity]" "∞")
+ ("ang" "\\angle" t "&ang;" "[angle]" "[angle]" "∠")
+ ("angle" "\\angle" t "&ang;" "[angle]" "[angle]" "∠")
+ ("and" "\\wedge" t "&and;" "[logical and]" "[logical and]" "∧")
+ ("wedge" "\\wedge" t "&and;" "[logical and]" "[logical and]" "∧")
+ ("or" "\\vee" t "&or;" "[logical or]" "[logical or]" "∨")
+ ("vee" "\\vee" t "&or;" "[logical or]" "[logical or]" "∨")
+ ("cap" "\\cap" t "&cap;" "[intersection]" "[intersection]" "∩")
+ ("cup" "\\cup" t "&cup;" "[union]" "[union]" "∪")
+ ("int" "\\int" t "&int;" "[integral]" "[integral]" "∫")
+; ("there4" "\\uptherefore" t "&there4;" "[therefore]" "[therefore]" "∴")
+ ("there4" "\\therefore" t "&there4;" "[therefore]" "[therefore]" "∴")
+ ("sim" "\\sim" t "&sim;" "~" "~" "∼")
+ ("cong" "\\cong" t "&cong;" "[approx. equal to]" "[approx. equal to]" "≅")
+ ("simeq" "\\simeq" t "&cong;" "[approx. equal to]" "[approx. equal to]" "≅")
+ ("asymp" "\\asymp" t "&asymp;" "[almost equal to]" "[almost equal to]" "≈")
+ ("approx" "\\approx" t "&asymp;" "[almost equal to]" "[almost equal to]" "≈")
+ ("ne" "\\ne" t "&ne;" "[not equal to]" "[not equal to]" "≠")
+ ("neq" "\\neq" t "&ne;" "[not equal to]" "[not equal to]" "≠")
+ ("equiv" "\\equiv" t "&equiv;" "[identical to]" "[identical to]" "≡")
+ ("le" "\\le" t "&le;" "<=" "<=" "≤")
+ ("ge" "\\ge" t "&ge;" ">=" ">=" "≥")
+ ("sub" "\\subset" t "&sub;" "[subset of]" "[subset of]" "⊂")
+ ("subset" "\\subset" t "&sub;" "[subset of]" "[subset of]" "⊂")
+ ("sup" "\\supset" t "&sup;" "[superset of]" "[superset of]" "⊃")
+ ("supset" "\\supset" t "&sup;" "[superset of]" "[superset of]" "⊃")
+ ("nsub" "\\not\\subset" t "&nsub;" "[not a subset of]" "[not a subset of" "⊄")
+ ("sube" "\\subseteq" t "&sube;" "[subset of or equal to]" "[subset of or equal to]" "⊆")
+ ("supe" "\\supseteq" t "&supe;" "[superset of or equal to]" "[superset of or equal to]" "⊇")
+ ("oplus" "\\oplus" t "&oplus;" "[circled plus]" "[circled plus]" "⊕")
+ ("otimes" "\\otimes" t "&otimes;" "[circled times]" "[circled times]" "⊗")
+ ("perp" "\\perp" t "&perp;" "[up tack]" "[up tack]" "⊥")
+ ("sdot" "\\cdot" t "&sdot;" "[dot]" "[dot]" "⋅")
+ ("cdot" "\\cdot" t "&sdot;" "[dot]" "[dot]" "⋅")
+ ("lceil" "\\lceil" t "&lceil;" "[left ceiling]" "[left ceiling]" "⌈")
+ ("rceil" "\\rceil" t "&rceil;" "[right ceiling]" "[right ceiling]" "⌉")
+ ("lfloor" "\\lfloor" t "&lfloor;" "[left floor]" "[left floor]" "⌊")
+ ("rfloor" "\\rfloor" t "&rfloor;" "[right floor]" "[right floor]" "⌋")
+ ("lang" "\\langle" t "&lang;" "<" "<" "⟨")
+ ("rang" "\\rangle" t "&rang;" ">" ">" "⟩")
+ ("loz" "\\diamond" t "&loz;" "[lozenge]" "[lozenge]" "◊")
+ ("Diamond" "\\diamond" t "&diamond;" "[diamond]" "[diamond]" "⋄")
+ ("spades" "\\spadesuit" t "&spades;" "[spades]" "[spades]" "♠")
+ ("spadesuit" "\\spadesuit" t "&spades;" "[spades]" "[spades]" "♠")
+ ("clubs" "\\clubsuit" t "&clubs;" "[clubs]" "[clubs]" "♣")
+ ("clubsuit" "\\clubsuit" t "&clubs;" "[clubs]" "[clubs]" "♣")
+ ("hearts" "\\heartsuit" t "&hearts;" "[hearts]" "[hearts]" "♥")
+ ("heartsuit" "\\heartsuit" t "&heartsuit;" "[hearts]" "[hearts]" "♥")
+ ("diamondsuit" "\\diamondsuit" t "&diams;" "[diamonds]" "[diamonds]" "♦")
+ ("diams" "\\diamondsuit" t "&diams;" "[diamonds]" "[diamonds]" "♦")
+ ("smile" "\\smile" t "&#9786;" ":-)" ":-)" "⌣")
+ ("blacksmile" "\\blacksmiley" nil "&#9787;" ":-)" ":-)" "☻")
+ ("sad" "\\frownie" nil "&#9785;" ":-(" ":-(" "☹")
+ ("quot" "\\textquotedbl" nil "&quot;" "\"" "\"" "\"")
+ ("amp" "\\&" nil "&amp;" "&" "&" "&")
+ ("lt" "\\textless" nil "&lt;" "<" "<" "<")
+ ("gt" "\\textgreater" nil "&gt;" ">" ">" ">")
+ ("OElig" "\\OE" nil "&OElig;" "OE" "OE" "Œ")
+ ("oelig" "\\oe" nil "&oelig;" "oe" "oe" "œ")
+ ("Scaron" "\\v{S}" nil "&Scaron;" "S" "S" "Š")
+ ("scaron" "\\v{s}" nil "&scaron;" "s" "s" "š")
+ ("Yuml" "\\\"{Y}" nil "&Yuml;" "Y" "Y" "Ÿ")
+ ("circ" "\\circ" t "&circ;" "^" "^" "ˆ")
+ ("tilde" "\~{}" nil "&tilde;" "~" "~" "~")
+ ("ensp" "\\hspace*{.5em}" nil "&ensp;" " " " " " ")
+ ("emsp" "\\hspace*{1em}" nil "&emsp;" " " " " " ")
+ ("thinsp" "\\hspace*{.2em}" nil "&thinsp;" " " " " " ")
+ ("zwnj" "\\/{}" nil "&zwnj;" "" "" "‌")
+ ("zwj" "" nil "&zwj;" "" "" "‍")
+ ("lrm" "" nil "&lrm;" "" "" "‎")
+ ("rlm" "" nil "&rlm;" "" "" "‏")
+ ("ndash" "--" nil "&ndash;" "-" "-" "–")
+ ("mdash" "---" nil "&mdash;" "--" "--" "—")
+ ("lsquo" "\\textquoteleft" nil "&lsquo;" "`" "`" "‘")
+ ("rsquo" "\\textquoteright" nil "&rsquo;" "'" "'" "’")
+ ("sbquo" "\\quotesinglbase" nil "&sbquo;" "," "," "‚")
+ ("ldquo" "\\textquotedblleft" nil "&ldquo;" "\"" "\"" "“")
+ ("rdquo" "\\textquotedblright" nil "&rdquo;" "\"" "\"" "”")
+ ("bdquo" "\\quotedblbase" nil "&bdquo;" "\"" "\"" "„")
+ ("dagger" "\\textdagger" nil "&dagger;" "[dagger]" "[dagger]" "†")
+ ("Dagger" "\\textdaggerdbl" nil "&Dagger;" "[doubledagger]" "[doubledagger]" "‡")
+ ("permil" "\\textperthousand" nil "&permil;" "per thousand" "per thousand" "‰")
+ ("lsaquo" "\\guilsinglleft" nil "&lsaquo;" "<" "<" "‹")
+ ("rsaquo" "\\guilsinglright" nil "&rsaquo;" ">" ">" "›")
+ ("euro" "\\texteuro" nil "&euro;" "EUR" "EUR" "€")
+ ("EUR" "\\EUR" nil "&euro;" "EUR" "EUR" "€")
+ ("EURdig" "\\EURdig" nil "&euro;" "EUR" "EUR" "€")
+ ("EURhv" "\\EURhv" nil "&euro;" "EUR" "EUR" "€")
+ ("EURcr" "\\EURcr" nil "&euro;" "EUR" "EUR" "€")
+ ("EURtm" "\\EURtm" nil "&euro;" "EUR" "EUR" "€")
+ ("arccos" "\\arccos" t "arccos" "arccos" "arccos" "arccos")
+ ("arcsin" "\\arcsin" t "arcsin" "arcsin" "arcsin" "arcsin")
+ ("arctan" "\\arctan" t "arctan" "arctan" "arctan" "arctan")
+ ("arg" "\\arg" t "arg" "arg" "arg" "arg")
+ ("cos" "\\cos" t "cos" "cos" "cos" "cos")
+ ("cosh" "\\cosh" t "cosh" "cosh" "cosh" "cosh")
+ ("cot" "\\cot" t "cot" "cot" "cot" "cot")
+ ("coth" "\\coth" t "coth" "coth" "coth" "coth")
+ ("csc" "\\csc" t "csc" "csc" "csc" "csc")
+ ("deg" "\\deg" t "&deg;" "deg" "deg" "deg")
+ ("det" "\\det" t "det" "det" "det" "det")
+ ("dim" "\\dim" t "dim" "dim" "dim" "dim")
+ ("exp" "\\exp" t "exp" "exp" "exp" "exp")
+ ("gcd" "\\gcd" t "gcd" "gcd" "gcd" "gcd")
+ ("hom" "\\hom" t "hom" "hom" "hom" "hom")
+ ("inf" "\\inf" t "inf" "inf" "inf" "inf")
+ ("ker" "\\ker" t "ker" "ker" "ker" "ker")
+ ("lg" "\\lg" t "lg" "lg" "lg" "lg")
+ ("lim" "\\lim" t "lim" "lim" "lim" "lim")
+ ("liminf" "\\liminf" t "liminf" "liminf" "liminf" "liminf")
+ ("limsup" "\\limsup" t "limsup" "limsup" "limsup" "limsup")
+ ("ln" "\\ln" t "ln" "ln" "ln" "ln")
+ ("log" "\\log" t "log" "log" "log" "log")
+ ("max" "\\max" t "max" "max" "max" "max")
+ ("min" "\\min" t "min" "min" "min" "min")
+ ("Pr" "\\Pr" t "Pr" "Pr" "Pr" "Pr")
+ ("sec" "\\sec" t "sec" "sec" "sec" "sec")
+ ("sin" "\\sin" t "sin" "sin" "sin" "sin")
+ ("sinh" "\\sinh" t "sinh" "sinh" "sinh" "sinh")
+ ("sup" "\\sup" t "&sup;" "sup" "sup" "sup")
+ ("tan" "\\tan" t "tan" "tan" "tan" "tan")
+ ("tanh" "\\tanh" t "tanh" "tanh" "tanh" "tanh")
+ ("frac12" "\\textonehalf" nil "&frac12;" "1/2" "½" "½")
+ ("frac14" "\\textonequarter" nil "&frac14;" "1/4" "¼" "¼")
+ ("frac34" "\\textthreequarters" nil "&frac34;" "3/4" "¾" "¾")
+ ("div" "\\textdiv" nil "&divide;" "/" "÷" "÷")
+ ("acute" "\\textasciiacute" nil "&acute;" "'" "´" "´")
+ ("nsup" "\\not\\supset" t "&nsup;" "[not a superset of]" "[not a superset of]" "⊅")
+ ("smiley" "\\smiley" nil "&#9786;" ":-)" ":-)" "☺")
+ )
+ "Default entities used in Org-mode to preduce special characters.
+For details see `org-entities-user'.")
+
+(defsubst org-entity-get (name)
+ "Get the proper association for NAME from the entity lists.
+This first checks the user list, then the built-in list."
+ (or (assoc name org-entities-user)
+ (assoc name org-entities)))
+
+(defun org-entity-get-representation (name kind)
+ "Get the correct representation of entity NAME for export type KIND.
+Kind can be any of `latex', `html', `ascii', `latin1', or `utf8'."
+ (let* ((e (org-entity-get name))
+ (n (cdr (assq kind '((latex . 1) (html . 3) (ascii . 4)
+ (latin1 . 5) (utf8 . 6)))))
+ (r (and e n (nth n e))))
+ (if (and (not org-entities-ascii-explanatory)
+ (memq kind '(ascii latin1 utf8))
+ (= (string-to-char r) ?\[))
+ (concat "\\" name)
+ r)))
+
+(defsubst org-entity-latex-math-p (name)
+ "Does entity NAME require math mode in LaTeX?"
+ (nth 2 (org-entity-get name)))
+
+(provide 'org-entities)
+
+;; arch-tag: e6bd163f-7419-4009-9c93-a74623016424
+
+;;; org-entities.el ends here
diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index 0add47f..07f0b05 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -480,7 +480,8 @@ This option can also be set with the +OPTIONS line, e.g. \"^:nil\"."
For example, HTML export converts \\alpha to &alpha; and \\AA to &Aring;.
Not only real TeX macros will work here, but the standard HTML entities
for math can be used as macro names as well. For a list of supported
-names in HTML export, see the constant `org-html-entities'.
+names in HTML export, see the constant `org-entities' and the user option
+`org-entities-user'.
Not all export backends support this.
This option can also be set with the +OPTIONS line, e.g. \"TeX:nil\"."
@@ -989,312 +990,6 @@ value of `org-export-run-in-background'."
(setq status (substring status 0 -1)))
(message "Background process \"%s\": %s" process status))
-(defconst org-html-entities
- '(("nbsp")
- ("iexcl")
- ("cent")
- ("pound")
- ("curren")
- ("yen")
- ("brvbar")
- ("vert" . "&#124;")
- ("sect")
- ("uml")
- ("copy")
- ("ordf")
- ("laquo")
- ("not")
- ("shy")
- ("reg")
- ("macr")
- ("deg")
- ("pm" . "&plusmn;")
- ("plusmn")
- ("sup2")
- ("sup3")
- ("acute")
- ("micro")
- ("para")
- ("middot")
- ("odot"."o")
- ("star"."*")
- ("cedil")
- ("sup1")
- ("ordm")
- ("raquo")
- ("frac14")
- ("frac12")
- ("frac34")
- ("iquest")
- ("Agrave")
- ("Aacute")
- ("Acirc")
- ("Atilde")
- ("Auml")
- ("Aring") ("AA"."&Aring;")
- ("AElig")
- ("Ccedil")
- ("Egrave")
- ("Eacute")
- ("Ecirc")
- ("Euml")
- ("Igrave")
- ("Iacute")
- ("Icirc")
- ("Iuml")
- ("ETH")
- ("Ntilde")
- ("Ograve")
- ("Oacute")
- ("Ocirc")
- ("Otilde")
- ("Ouml")
- ("times")
- ("Oslash")
- ("Ugrave")
- ("Uacute")
- ("Ucirc")
- ("Uuml")
- ("Yacute")
- ("THORN")
- ("szlig")
- ("agrave")
- ("aacute")
- ("acirc")
- ("atilde")
- ("auml")
- ("aring")
- ("aelig")
- ("ccedil")
- ("checkmark" . "&#10003;")
- ("egrave")
- ("eacute")
- ("ecirc")
- ("euml")
- ("igrave")
- ("iacute")
- ("icirc")
- ("iuml")
- ("eth")
- ("ntilde")
- ("ograve")
- ("oacute")
- ("ocirc")
- ("otilde")
- ("ouml")
- ("divide")
- ("oslash")
- ("ugrave")
- ("uacute")
- ("ucirc")
- ("uuml")
- ("yacute")
- ("thorn")
- ("yuml")
- ("fnof")
- ("Alpha")
- ("Beta")
- ("Gamma")
- ("Delta")
- ("Epsilon")
- ("Zeta")
- ("Eta")
- ("Theta")
- ("Iota")
- ("Kappa")
- ("Lambda")
- ("Mu")
- ("Nu")
- ("Xi")
- ("Omicron")
- ("Pi")
- ("Rho")
- ("Sigma")
- ("Tau")
- ("Upsilon")
- ("Phi")
- ("Chi")
- ("Psi")
- ("Omega")
- ("alpha")
- ("beta")
- ("gamma")
- ("delta")
- ("epsilon")
- ("varepsilon"."&epsilon;")
- ("zeta")
- ("eta")
- ("theta")
- ("iota")
- ("kappa")
- ("lambda")
- ("mu")
- ("nu")
- ("xi")
- ("omicron")
- ("pi")
- ("rho")
- ("sigmaf") ("varsigma"."&sigmaf;")
- ("sigma")
- ("tau")
- ("upsilon")
- ("phi")
- ("chi")
- ("psi")
- ("omega")
- ("thetasym") ("vartheta"."&thetasym;")
- ("upsih")
- ("piv")
- ("bull") ("bullet"."&bull;")
- ("hellip") ("dots"."&hellip;")
- ("prime")
- ("Prime")
- ("oline")
- ("frasl")
- ("weierp")
- ("image")
- ("real")
- ("trade")
- ("alefsym")
- ("larr") ("leftarrow"."&larr;") ("gets"."&larr;")
- ("uarr") ("uparrow"."&uarr;")
- ("rarr") ("to"."&rarr;") ("rightarrow"."&rarr;")
- ("darr")("downarrow"."&darr;")
- ("harr") ("leftrightarrow"."&harr;")
- ("crarr") ("hookleftarrow"."&crarr;") ; has round hook, not quite CR
- ("lArr") ("Leftarrow"."&lArr;")
- ("uArr") ("Uparrow"."&uArr;")
- ("rArr") ("Rightarrow"."&rArr;")
- ("dArr") ("Downarrow"."&dArr;")
- ("hArr") ("Leftrightarrow"."&hArr;")
- ("forall")
- ("part") ("partial"."&part;")
- ("exist") ("exists"."&exist;")
- ("empty") ("emptyset"."&empty;")
- ("nabla")
- ("isin") ("in"."&isin;")
- ("notin")
- ("ni")
- ("prod")
- ("sum")
- ("minus")
- ("lowast") ("ast"."&lowast;")
- ("radic")
- ("prop") ("proptp"."&prop;")
- ("infin") ("infty"."&infin;")
- ("ang") ("angle"."&ang;")
- ("and") ("wedge"."&and;")
- ("or") ("vee"."&or;")
- ("cap")
- ("cup")
- ("int")
- ("there4")
- ("sim")
- ("cong") ("simeq"."&cong;")
- ("asymp")("approx"."&asymp;")
- ("ne") ("neq"."&ne;")
- ("equiv")
- ("le")
- ("ge")
- ("sub") ("subset"."&sub;")
- ("sup") ("supset"."&sup;")
- ("nsub")
- ("sube")
- ("supe")
- ("oplus")
- ("otimes")
- ("perp")
- ("sdot") ("cdot"."&sdot;")
- ("lceil")
- ("rceil")
- ("lfloor")
- ("rfloor")
- ("lang")
- ("rang")
- ("loz") ("Diamond"."&loz;")
- ("spades") ("spadesuit"."&spades;")
- ("clubs") ("clubsuit"."&clubs;")
- ("hearts")
- ("diams") ("diamondsuit"."&diams;")
- ("smile"."&#9786;") ("blacksmile"."&#9787;") ("sad"."&#9785;")
- ("quot")
- ("amp")
- ("lt")
- ("gt")
- ("OElig")
- ("oelig")
- ("Scaron")
- ("scaron")
- ("Yuml")
- ("circ")
- ("tilde")
- ("ensp")
- ("emsp")
- ("thinsp")
- ("zwnj")
- ("zwj")
- ("lrm")
- ("rlm")
- ("ndash")
- ("mdash")
- ("lsquo")
- ("rsquo")
- ("sbquo")
- ("ldquo")
- ("rdquo")
- ("bdquo")
- ("dagger")
- ("Dagger")
- ("permil")
- ("lsaquo")
- ("rsaquo")
- ("euro")
- ("EUR"."&euro;")
- ("EURdig"."&euro;")
- ("EURhv"."&euro;")
- ("EURcr"."&euro;")
- ("EURtm"."&euro;")
- ("arccos"."arccos")
- ("arcsin"."arcsin")
- ("arctan"."arctan")
- ("arg"."arg")
- ("cos"."cos")
- ("cosh"."cosh")
- ("cot"."cot")
- ("coth"."coth")
- ("csc"."csc")
- ("deg"."deg")
- ("det"."det")
- ("dim"."dim")
- ("exp"."exp")
- ("gcd"."gcd")
- ("hom"."hom")
- ("inf"."inf")
- ("ker"."ker")
- ("lg"."lg")
- ("lim"."lim")
- ("liminf"."liminf")
- ("limsup"."limsup")
- ("ln"."ln")
- ("log"."log")
- ("max"."max")
- ("min"."min")
- ("Pr"."Pr")
- ("sec"."sec")
- ("sin"."sin")
- ("sinh"."sinh")
- ("sup"."sup")
- ("tan"."tan")
- ("tanh"."tanh")
- )
- "Entities for TeX->HTML translation.
-Entries can be like (\"ent\"), in which case \"\\ent\" will be translated to
-\"&ent;\". An entry can also be a dotted pair like (\"ent\".\"&other;\").
-In that case, \"\\ent\" will be translated to \"&other;\".
-The list contains HTML entities for Latin-1, Greek and other symbols.
-It is supplemented by a number of commonly used TeX macros with appropriate
-translations. There is currently no way for users to extend this.")
-
;;; General functions for all backends
(defvar org-export-target-aliases nil
diff --git a/lisp/org-html.el b/lisp/org-html.el
index 8b1f8d1..787240f 100644
--- a/lisp/org-html.el
+++ b/lisp/org-html.el
@@ -1911,16 +1911,14 @@ If there are links in the string, don't modify these."
(if org-export-with-sub-superscripts
(setq s (org-export-html-convert-sub-super s)))
(if org-export-with-TeX-macros
- (let ((start 0) wd ass)
+ (let ((start 0) wd rep)
(while (setq start (string-match "\\\\\\([a-zA-Z]+\\)\\({}\\)?"
s start))
(if (get-text-property (match-beginning 0) 'org-protected s)
(setq start (match-end 0))
(setq wd (match-string 1 s))
- (if (setq ass (assoc wd org-html-entities))
- (setq s (replace-match (or (cdr ass)
- (concat "&" (car ass) ";"))
- t t s))
+ (if (setq rep (org-entity-get-representation wd 'html))
+ (setq s (replace-match rep t t s))
(setq start (+ start (length wd))))))))
s)
diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index 03c30a6..d167b5c 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -99,6 +99,10 @@
\\usepackage{float}
\\usepackage{wrapfig}
\\usepackage{soul}
+\\usepackage{t1enc}
+\\usepackage{textcomp}
+\\usepackage{marvosym}
+\\usepackage{wasysym}
\\usepackage{latexsym}
\\usepackage{amssymb}
\\usepackage{hyperref}"
@@ -116,6 +120,10 @@
\\usepackage{float}
\\usepackage{wrapfig}
\\usepackage{soul}
+\\usepackage{t1enc}
+\\usepackage{textcomp}
+\\usepackage{marvosym}
+\\usepackage{wasysym}
\\usepackage{latexsym}
\\usepackage{amssymb}
\\usepackage{hyperref}"
@@ -133,6 +141,10 @@
\\usepackage{float}
\\usepackage{wrapfig}
\\usepackage{soul}
+\\usepackage{t1enc}
+\\usepackage{textcomp}
+\\usepackage{marvosym}
+\\usepackage{wasysym}
\\usepackage{latexsym}
\\usepackage{amssymb}
\\usepackage{hyperref}"
@@ -150,6 +162,10 @@
\\usepackage{float}
\\usepackage{wrapfig}
\\usepackage{soul}
+\\usepackage{t1enc}
+\\usepackage{textcomp}
+\\usepackage{marvosym}
+\\usepackage{wasysym}
\\usepackage{latexsym}
\\usepackage{amssymb}
\\usepackage{hyperref}"
@@ -1489,31 +1505,31 @@ Convert CHAR depending on STRING-BEFORE and STRING-AFTER."
(defun org-export-latex-treat-backslash-char (string-before string-after)
"Convert the \"$\" special character to LaTeX.
The conversion is made depending of STRING-BEFORE and STRING-AFTER."
- (cond ((member (list string-after) org-html-entities)
- ;; backslash is part of a special entity (like "\alpha")
- (concat string-before "$\\"
- (or (cdar (member (list string-after) org-html-entities))
- string-after) "$"))
- ((and (not (string-match "^[ \n\t]" string-after))
- (not (string-match "[ \t]\\'\\|^" string-before)))
- ;; backslash is inside a word
- (concat string-before
- (org-export-latex-protect-string
- (concat "\\textbackslash{}" string-after))))
- ((not (or (equal string-after "")
- (string-match "^[ \t\n]" string-after)))
- ;; backslash might escape a character (like \#) or a user TeX
- ;; macro (like \setcounter)
- (concat string-before
- (org-export-latex-protect-string (concat "\\" string-after))))
- ((and (string-match "^[ \t\n]" string-after)
- (string-match "[ \t\n]\\'" string-before))
- ;; backslash is alone, convert it to $\backslash$
- (org-export-latex-protect-string
- (concat string-before "\\textbackslash{}" string-after)))
- (t (org-export-latex-protect-string
- (concat string-before "\\textbackslash{}" string-after)))))
-
+ (let ((ass (org-entity-get string-after)))
+ (cond
+ (ass (if (nth 2 ass)
+ (concat string-before "$" (nth 1 ass) "$")
+ (concat "\\" string-after)))
+ ((and (not (string-match "^[ \n\t]" string-after))
+ (not (string-match "[ \t]\\'\\|^" string-before)))
+ ;; backslash is inside a word
+ (concat string-before
+ (org-export-latex-protect-string
+ (concat "\\textbackslash{}" string-after))))
+ ((not (or (equal string-after "")
+ (string-match "^[ \t\n]" string-after)))
+ ;; backslash might escape a character (like \#) or a user TeX
+ ;; macro (like \setcounter)
+ (concat string-before
+ (org-export-latex-protect-string (concat "\\" string-after))))
+ ((and (string-match "^[ \t\n]" string-after)
+ (string-match "[ \t\n]\\'" string-before))
+ ;; backslash is alone, convert it to $\backslash$
+ (org-export-latex-protect-string
+ (concat string-before "\\textbackslash{}" string-after)))
+ (t (org-export-latex-protect-string
+ (concat string-before "\\textbackslash{}" string-after))))))
+
(defun org-export-latex-keywords ()
"Convert special keywords to LaTeX."
(goto-char (point-min))
diff --git a/lisp/org.el b/lisp/org.el
index 1eb5a3f..988dab1 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -85,6 +85,7 @@
(require 'easymenu)
(require 'org-macs)
+(require 'org-entities)
(require 'org-compat)
(require 'org-faces)
(require 'org-list)
@@ -4222,7 +4223,7 @@ This is for getting out of special buffers like remember.")
(defvar date)
;; Defined somewhere in this file, but used before definition.
-(defvar org-html-entities)
+(defvar org-entities) ;; defined in org-entities.el
(defvar org-struct-menu)
(defvar org-org-menu)
(defvar org-tbl-menu)
@@ -4887,7 +4888,8 @@ will be prompted for."
(if org-export-with-TeX-macros
(list (concat "\\\\"
(regexp-opt
- (append (mapcar 'car org-html-entities)
+ (append (mapcar 'car (append org-entities-user
+ org-entities))
(if (boundp 'org-latex-entities)
(mapcar (lambda (x)
(or (car-safe x) x))
@@ -9987,7 +9989,7 @@ At all other locations, this simply calls the value of
org-link-abbrev-alist))
(texp
(setq type :tex)
- org-html-entities)
+ (append org-entities-user org-entities))
((string-match "\\`\\*+[ \t]+\\'"
(buffer-substring (point-at-bol) beg))
(setq type :todo)