Exporting accented characters to latex from org-mode
Posted October 03, 2013 at 12:49 PM | categories: uncategorized | tags:
Updated October 03, 2013 at 01:36 PM
Table of Contents
I noticed recently in writing a technical paper in org-mode that I had some trouble exporting some accented characters to LaTeX.
Here are 5 words that render correctly in LaTeX
1. Jos\'{e} 2. peque\~{n}o 3. Gro\ss 4. Gr\"{u}neisen 5. N\o{}rskov
Here we wrap these words in a LaTeX block so it exports verbatim to see how they look in a PDF.
Note to see this in LaTeX, you must view the exporting-accented-characters.pdf. Now, we use the same characters in org-mode.
- Jos\'{e}
- peque\~{n}o
- Gro\ss
- Gr\"{u}neisen
- N\o{}rskov
The exported LaTeX code looks like:
\begin{enumerate} \item Jos$\backslash$'\{e\} \item peque$\backslash$\textasciitilde{}\{n\}o \item Gro\ss \item Gr$\backslash$"\{u\}neisen \item N\o{}rskov \end{enumerate}
The exporter does not handle all of them correctly. Org-mode is its own system, and it is not, and won't be a total replacement for LaTeX. Nevertheless, these are pretty common characters for me, and We need a solution! A clunky way we found to solve this is to add a LATEXHEADER line that defines a new LaTeX command like this:
#+LATEX_HEADER: \newcommand{\gruneisen}{Gr\"{u}neisen}
Then you can use the new command in org-mode. So this text:
We use \gruneisen in a sentence.
Renders like this:
We use \gruneisen in a sentence.
That is not too ideal, since some journals do not like you to define new commands. It turns out that org-mode has its own commands to solve this problem! There is a list of these commands stored in a variable called org-entities
.
Here we print these entities for "the record". I add an extra star to the data in org-entities so they will all be nested in this post.
(mapcar (lambda(x) "print element x. If it is a heading, add an extra star" (interactive) (if (and (stringp x) (string= (substring x 0 1) "*")) (princ (format "*%s\n" x)) (princ (format "%s\n" x)))) org-entities)
1 Letters
1.1 Latin
(Agrave \`{A} nil À A À À) (agrave \`{a} nil à a à à) (Aacute \'{A} nil Á A Á Á) (aacute \'{a} nil á a á á) (Acirc \A nil  A  Â) (acirc \a nil â a â â) (Atilde \~{A} nil à A à Ã) (atilde \~{a} nil ã a ã ã) (Auml \"{A} nil Ä Ae Ä Ä) (auml \"{a} nil ä ae ä ä) (Aring Å nil Å A Å Å) (AA Å nil Å A Å Å) (aring \aa{} nil å a å å) (AElig \AE{} nil Æ AE Æ Æ) (aelig \ae{} nil æ ae æ æ) (Ccedil \c{C} nil Ç C Ç Ç) (ccedil \c{c} nil ç c ç ç) (Egrave \`{E} nil È E È È) (egrave \`{e} nil è e è è) (Eacute \'{E} nil É E É É) (eacute \'{e} nil é e é é) (Ecirc \E nil Ê E Ê Ê) (ecirc \e nil ê e ê ê) (Euml \"{E} nil Ë E Ë Ë) (euml \"{e} nil ë e ë ë) (Igrave \`{I} nil Ì I Ì Ì) (igrave \`{i} nil ì i ì ì) (Iacute \'{I} nil Í I Í Í) (iacute \'{i} nil í i í í) (Icirc \I nil Î I Î Î) (icirc \i nil î i î î) (Iuml \"{I} nil Ï I Ï Ï) (iuml \"{i} nil ï i ï ï) (Ntilde \~{N} nil Ñ N Ñ Ñ) (ntilde \~{n} nil ñ n ñ ñ) (Ograve \`{O} nil Ò O Ò Ò) (ograve \`{o} nil ò o ò ò) (Oacute \'{O} nil Ó O Ó Ó) (oacute \'{o} nil ó o ó ó) (Ocirc \O nil Ô O Ô Ô) (ocirc \o nil ô o ô ô) (Otilde \~{O} nil Õ O Õ Õ) (otilde \~{o} nil õ o õ õ) (Ouml \"{O} nil Ö Oe Ö Ö) (ouml \"{o} nil ö oe ö ö) (Oslash \O nil Ø O Ø Ø) (oslash \o{} nil ø o ø ø) (OElig \OE{} nil Œ OE OE Œ) (oelig \oe{} nil œ oe oe œ) (Scaron \v{S} nil Š S S Š) (scaron \v{s} nil š s s š) (szlig \ss{} nil ß ss ß ß) (Ugrave \`{U} nil Ù U Ù Ù) (ugrave \`{u} nil ù u ù ù) (Uacute \'{U} nil Ú U Ú Ú) (uacute \'{u} nil ú u ú ú) (Ucirc \U nil Û U Û Û) (ucirc \u nil û u û û) (Uuml \"{U} nil Ü Ue Ü Ü) (uuml \"{u} nil ü ue ü ü) (Yacute \'{Y} nil Ý Y Ý Ý) (yacute \'{y} nil ý y ý ý) (Yuml \"{Y} nil Ÿ Y Y Ÿ) (yuml \"{y} nil ÿ y ÿ ÿ)
1.2 Latin (special face)
(fnof \textit{f} nil ƒ f f ƒ) (real \Re t ℜ R R ℜ) (image \Im t ℑ I I ℑ) (weierp \wp t ℘ P P ℘)
1.3 Greek
(Alpha A nil Α Alpha Alpha Α) (alpha α t α alpha alpha α) (Beta B nil Β Beta Beta Β) (beta β t β beta beta β) (Gamma Γ t Γ Gamma Gamma Γ) (gamma γ t γ gamma gamma γ) (Delta Δ t Δ Delta Gamma Δ) (delta δ t δ delta delta δ) (Epsilon E nil Ε Epsilon Epsilon Ε) (epsilon ε t ε epsilon epsilon ε) (varepsilon ε t ε varepsilon varepsilon ε) (Zeta Z nil Ζ Zeta Zeta Ζ) (zeta ζ t ζ zeta zeta ζ) (Eta H nil Η Eta Eta Η) (eta η t η eta eta η) (Theta Θ t Θ Theta Theta Θ) (theta θ t θ theta theta θ) (thetasym ϑ t ϑ theta theta ϑ) (vartheta ϑ t ϑ theta theta ϑ) (Iota I nil Ι Iota Iota Ι) (iota ι t ι iota iota ι) (Kappa K nil Κ Kappa Kappa Κ) (kappa κ t κ kappa kappa κ) (Lambda Λ t Λ Lambda Lambda Λ) (lambda λ t λ lambda lambda λ) (Mu M nil Μ Mu Mu Μ) (mu μ t μ mu mu μ) (nu ν t ν nu nu ν) (Nu N nil Ν Nu Nu Ν) (Xi Ξ t Ξ Xi Xi Ξ) (xi ξ t ξ xi xi ξ) (Omicron O nil Ο Omicron Omicron Ο) (omicron \textit{o} nil ο omicron omicron ο) (Pi Π t Π Pi Pi Π) (pi π t π pi pi π) (Rho P nil Ρ Rho Rho Ρ) (rho ρ t ρ rho rho ρ) (Sigma Σ t Σ Sigma Sigma Σ) (sigma σ t σ sigma sigma σ) (sigmaf ς t ς sigmaf sigmaf ς) (varsigma ς t ς varsigma varsigma ς) (Tau T nil Τ Tau Tau Τ) (Upsilon Υ t Υ Upsilon Upsilon Υ) (upsih Υ t ϒ upsilon upsilon ϒ) (upsilon υ t υ upsilon upsilon υ) (Phi Φ t Φ Phi Phi Φ) (phi φ t φ phi phi φ) (Chi X nil Χ Chi Chi Χ) (chi χ t χ chi chi χ) (acutex ´ x t ´x 'x 'x 𝑥́) (Psi Ψ t Ψ Psi Psi Ψ) (psi ψ t ψ psi psi ψ) (tau τ t τ tau tau τ) (Omega Ω t Ω Omega Omega Ω) (omega ω t ω omega omega ω) (piv \varpi t ϖ omega-pi omega-pi ϖ) (partial ∂ t ∂ [partial differential] [partial differential] ∂)
1.4 Hebrew
(alefsym \aleph t ℵ aleph aleph ℵ)
1.5 Dead languages
(ETH \DH{} nil Ð D Ð Ð) (eth \dh{} nil ð dh ð ð) (THORN \TH{} nil Þ TH Þ Þ) (thorn \th{} nil þ th þ þ)
2 Punctuation
2.1 Dots and Marks
(dots … nil … … … …) (hellip … nil … … … …) (middot \textperiodcentered{} nil · . · ·) (iexcl !` nil ¡ ! ¡ ¡) (iquest ?` nil ¿ ? ¿ ¿)
2.2 Dash-like
(shy nil ­ ) (ndash – nil – - - –) (mdash — nil — – – —)
2.3 Quotations
(quot \textquotedbl{} nil " " " ") (acute \textasciiacute{} nil ´ ' ´ ´) (ldquo \textquotedblleft{} nil “ " " “) (rdquo \textquotedblright{} nil ” " " ”) (bdquo \quotedblbase{} nil „ " " „) (lsquo \textquoteleft{} nil ‘ ` ` ‘) (rsquo \textquoteright{} nil ’ ' ' ’) (sbquo \quotesinglbase{} nil ‚ , , ‚) (laquo \guillemotleft{} nil « << « «) (raquo \guillemotright{} nil » >> » ») (lsaquo \guilsinglleft{} nil ‹ < < ‹) (rsaquo \guilsinglright{} nil › > > ›)
3 Other
3.1 Misc. (often used)
(circ \nil nil ˆ ^ ^ ˆ) (vert | t | | | |) (brvbar \textbrokenbar{} nil ¦ | ¦ ¦) (sect \S nil § paragraph § §) (amp \& nil & & & &) (lt \textless{} nil < < < <) (gt \textgreater{} nil > > > >) (tilde \~{} nil ˜ ~ ~ ~) (slash / nil / / / /) (plus + nil + + + +) (under \_ nil _ _ _ _) (equal = nil = = = =) (asciicirc \textasciicircum{} nil ^ ^ ^ ^) (dagger \textdagger{} nil † [dagger] [dagger] †) (Dagger \textdaggerdbl{} nil ‡ [doubledagger] [doubledagger] ‡)
3.2 Whitespace
(nbsp ~ nil ) (ensp \hspace*{.5em} nil   ) (emsp \hspace*{1em} nil   ) (thinsp \hspace*{.2em} nil   )
3.3 Currency
(curren \textcurrency{} nil ¤ curr. ¤ ¤) (cent \textcent{} nil ¢ cent ¢ ¢) (pound \pounds{} nil £ pound £ £) (yen \textyen{} nil ¥ yen ¥ ¥) (euro \texteuro{} nil € EUR EUR €) (EUR € nil € EUR EUR €) (EURdig € nil € EUR EUR €) (EURhv € nil € EUR EUR €) (EURcr € nil € EUR EUR €) (EURtm € nil € EUR EUR €)
3.4 Property Marks
(copy \textcopyright{} nil © (c) © ©) (reg \textregistered{} nil ® (r) ® ®) (trade \texttrademark{} nil ™ TM TM ™)
3.5 Science et al.
(minus − t − - - −) (pm \textpm{} nil ± +- ± ±) (plusmn \textpm{} nil ± +- ± ±) (times \texttimes{} nil × * × ×) (frasl / nil ⁄ / / ⁄) (div \textdiv{} nil ÷ / ÷ ÷) (frac12 \textonehalf{} nil ½ 1/2 ½ ½) (frac14 \textonequarter{} nil ¼ 1/4 ¼ ¼) (frac34 \textthreequarters{} nil ¾ 3/4 ¾ ¾) (permil \textperthousand{} nil ‰ per thousand per thousand ‰) (sup1 \textonesuperior{} nil ¹ ^1 ¹ ¹) (sup2 \texttwosuperior{} nil ² ^2 ² ²) (sup3 \textthreesuperior{} nil ³ ^3 ³ ³) (radic \sqrt{\,} t √ [square root] [square root] √) (sum ∑ t ∑ [sum] [sum] ∑) (prod ∏ t ∏ [product] [n-ary product] ∏) (micro \textmu{} nil µ micro µ µ) (macr \textasciimacron{} nil ¯ [macron] ¯ ¯) (deg \textdegree{} nil ° degree ° °) (prime ′ t ′ ' ' ′) (Prime ′′ t ″ '' '' ″) (infin \propto t ∞ [infinity] [infinity] ∞) (infty ∞ t ∞ [infinity] [infinity] ∞) (prop \propto t ∝ [proportional to] [proportional to] ∝) (proptp \propto t ∝ [proportional to] [proportional to] ∝) (not \textlnot{} nil ¬ [angled dash] ¬ ¬) (neg ¬ t ¬ [angled dash] ¬ ¬) (land ∧ t ∧ [logical and] [logical and] ∧) (wedge ∧ t ∧ [logical and] [logical and] ∧) (lor ∨ t ∨ [logical or] [logical or] ∨) (vee ∨ t ∨ [logical or] [logical or] ∨) (cap ∩ t ∩ [intersection] [intersection] ∩) (cup ∪ t ∪ [union] [union] ∪) (int ∫ t ∫ [integral] [integral] ∫) (there4 \therefore t ∴ [therefore] [therefore] ∴) (sim ∼ t ∼ ~ ~ ∼) (cong ≅ t ≅ [approx. equal to] [approx. equal to] ≅) (simeq ≅ t ≅ [approx. equal to] [approx. equal to] ≅) (asymp ≈ t ≈ [almost equal to] [almost equal to] ≈) (approx ≈ t ≈ [almost equal to] [almost equal to] ≈) (ne ≠ t ≠ [not equal to] [not equal to] ≠) (neq ≠ t ≠ [not equal to] [not equal to] ≠) (equiv ≡ t ≡ [identical to] [identical to] ≡) (le ≤ t ≤ <= <= ≤) (ge ≥ t ≥ >= >= ≥) (sub ⊂ t ⊂ [subset of] [subset of] ⊂) (subset ⊂ t ⊂ [subset of] [subset of] ⊂) (sup ⊃ t ⊃ [superset of] [superset of] ⊃) (supset ⊃ t ⊃ [superset of] [superset of] ⊃) (nsub ¬⊂ t ⊄ [not a subset of] [not a subset of ⊄) (sube \subseteq t ⊆ [subset of or equal to] [subset of or equal to] ⊆) (nsup ¬⊃ t ⊅ [not a superset of] [not a superset of] ⊅) (supe \supseteq t ⊇ [superset of or equal to] [superset of or equal to] ⊇) (forall ∀ t ∀ [for all] [for all] ∀) (exist ∃ t ∃ [there exists] [there exists] ∃) (exists ∃ t ∃ [there exists] [there exists] ∃) (empty ∅ t ∅ [empty set] [empty set] ∅) (emptyset ∅ t ∅ [empty set] [empty set] ∅) (isin ∈ t ∈ [element of] [element of] ∈) (in ∈ t ∈ [element of] [element of] ∈) (notin ∉ t ∉ [not an element of] [not an element of] ∉) (ni ∋ t ∋ [contains as member] [contains as member] ∋) (nabla ∇ t ∇ [nabla] [nabla] ∇) (ang ∠ t ∠ [angle] [angle] ∠) (angle ∠ t ∠ [angle] [angle] ∠) (perp ⊥ t ⊥ [up tack] [up tack] ⊥) (sdot ⋅ t ⋅ [dot] [dot] ⋅) (cdot ⋅ t ⋅ [dot] [dot] ⋅) (lceil ⌈ t ⌈ [left ceiling] [left ceiling] ⌈) (rceil ⌉ t ⌉ [right ceiling] [right ceiling] ⌉) (lfloor ⌊ t ⌊ [left floor] [left floor] ⌊) (rfloor ⌋ t ⌋ [right floor] [right floor] ⌋) (lang \langle t ⟨ < < ⟨) (rang \rangle t ⟩ > > ⟩) (hbar ℏ t ℏ hbar hbar ℏ)
3.6 Arrows
(larr ← t ← <- <- ←) (leftarrow ← t ← <- <- ←) (gets ← t ← <- <- ←) (lArr ⇐ t ⇐ <= <= ⇐) (Leftarrow ⇐ t ⇐ <= <= ⇐) (uarr ↑ t ↑ [uparrow] [uparrow] ↑) (uparrow ↑ t ↑ [uparrow] [uparrow] ↑) (uArr ⇑ t ⇑ [dbluparrow] [dbluparrow] ⇑) (Uparrow ⇑ t ⇑ [dbluparrow] [dbluparrow] ⇑) (rarr → t → -> -> →) (to → t → -> -> →) (rightarrow → t → -> -> →) (rArr ⇒ t ⇒ => => ⇒) (Rightarrow ⇒ t ⇒ => => ⇒) (darr ↓ t ↓ [downarrow] [downarrow] ↓) (downarrow ↓ t ↓ [downarrow] [downarrow] ↓) (dArr ⇓ t ⇓ [dbldownarrow] [dbldownarrow] ⇓) (Downarrow ⇓ t ⇓ [dbldownarrow] [dbldownarrow] ⇓) (harr ↔ t ↔ <-> <-> ↔) (leftrightarrow ↔ t ↔ <-> <-> ↔) (hArr ⇔ t ⇔ <=> <=> ⇔) (Leftrightarrow ⇔ t ⇔ <=> <=> ⇔) (crarr ↵ t ↵ <-' <-' ↵) (hookleftarrow ↵ t ↵ <-' <-' ↵)
3.7 Function names
(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 ° t ° 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 ⊃ t ⊃ sup sup sup) (tan tan t tan tan tan tan) (tanh tanh t tanh tanh tanh tanh)
3.8 Signs & Symbols
(bull \textbullet{} nil • * * •) (bullet \textbullet{} nil • * * •) (star * t * * * ⋆) (lowast ∗ t ∗ * * ∗) (ast ∗ t ∗ * * *) (odot o t o [circled dot] [circled dot] ʘ) (oplus ⊕ t ⊕ [circled plus] [circled plus] ⊕) (otimes ⊗ t ⊗ [circled times] [circled times] ⊗) (checkmark ✓ t ✓ [checkmark] [checkmark] ✓)
3.9 Miscellaneous (seldom used)
(para \P{} nil ¶ [pilcrow] ¶ ¶) (ordf \textordfeminine{} nil ª a ª ª) (ordm \textordmasculine{} nil º o º º) (cedil \c{} nil ¸ [cedilla] ¸ ¸) (oline \overline{~} t ‾ [overline] ¯ ‾) (uml \textasciidieresis{} nil ¨ [diaeresis] ¨ ¨) (zwnj \/{} nil ‌ ) (zwj nil ‍ ) (lrm nil ‎ ) (rlm nil ‏ )
3.10 Smilies
(smile ☺ t ☺ :-) :-) ⌣) (smiley ☺ nil ☺ :-) :-) ☺) (blacksmile \blacksmiley{} nil ☻ :-) :-) ☻) (sad \frownie{} nil ☹ :-( :-( ☹)
3.11 Suits
(clubs ♣ t ♣ [clubs] [clubs] ♣) (clubsuit ♣ t ♣ [clubs] [clubs] ♣) (spades ♠ t ♠ [spades] [spades] ♠) (spadesuit ♠ t ♠ [spades] [spades] ♠) (hearts ♥ t ♥ [hearts] [hearts] ♥) (heartsuit ♥ t ♥ [hearts] [hearts] ♥) (diams ♦ t ♦ [diamonds] [diamonds] ♦) (diamondsuit ♦ t ♦ [diamonds] [diamonds] ♦) (Diamond \diamond t ⋄ [diamond] [diamond] ⋄) (loz \diamond t ◊ [lozenge] [lozenge] ◊)
4 Summary.
Wow, there are a lot of commands ☺. We just need to use them. For example, I can write Grüneisen, and it finally renders the way it should!
Copyright (C) 2013 by John Kitchin. See the License for information about copying.