
Especificamente, gostaria de poder completar esta tabela:
symbol html entity LaTeX command
\deg ° \begin{alltt}\deg{alltt}
Para que eu tenha uma entrada para cada entidade nomeada em HTML listada noespecificações oficiais.
Compreendo que pode não haver mapeamentos para todos eles, mas quanto mais, melhor.
Preciso disso para verificar a conformidade de um documento fonte destinado a ser publicado em HTML e LaTeX; o documento de origem já pode conter entidades nomeadas em HTML. Portanto, preciso de um gráfico de mapeamentos para fornecer as conversões ou emitir avisos de conformidade para aqueles que não mapeiam.
Responder1
No ConTeXt, o char-ent.lua
arquivo contém a lista de todas as entidades HTML. Você pode acessá-los usando a characters.entities
tabela. Por exemplo, o código a seguir imprime todas as entidades e seus valores na tela.
\starttext
\startluacode
local entities = characters.entities
for name, value in next, entities do
print(name,value)
end
\stopluacode
\stoptext
As entidades não são traduzidas para o comando TeX correspondente, mas sim para o símbolo Unicode correspondente. Se você quiser o nome TeX correspondente para o símbolo, você pode pesquisar na characters.data
tabela (definida em char-def.lua
)
\starttext
\startluacode
local data = characters.data
local function context_name(value)
value = data[value]
if value then
if value.contextname then
return value.contextname
elseif value.mathname then
return value.mathname
elseif value.mathspec then
return value.mathspec[1].name
else
return "not defined"
end
else
return "not defined"
end
end
local entities = characters.entities
for name, value in next, entities do
print(name,value, context_name(value))
end
\stopluacode
\stoptext
A lista resultante éaqui. Não sei se o LaTeX segue a mesma convenção de nomenclatura para todos os comandos.
Responder2
Apenas para encerrar isso, minha pergunta original era sobre o mapeamento de entidades HTML 4.0 para LaTeX. A resposta de Aditya oferece a capacidade de mapear uma gama muito mais ampla de entidades de personagens nomeadas.
Usei o conjunto de dados do Aditya para produzir os mapeamentos apenas para HTML 4.0 conforme abaixo. Se não estiver na lista, não há mapeamento (ou estraguei a redução do conjunto de dados).
Por favor, veja os comentários - esta tabela tem muito valor apenas no ConTeXt.
HTML 4.0 / LaTeX
Aacute / Aacute
aacute / aacute
Acirc / Acircumflex
acirc / acircumflex
acute / textacute
AElig / AEligature
aelig / aeligature
Agrave / Agrave
agrave / agrave
alefsym / aleph
Alpha / greekAlpha
alpha / greekalpha
and / wedge
ang / angle
Aring / Aring
aring / aring
asymp / approx
Atilde / Atilde
atilde / atilde
Auml / Adiaeresis
auml / adiaeresis
bdquo / quotedblbase
Beta / greekBeta
beta / greekbeta
brvbar / textbrokenbar
bull / textbullet
cap / cap
Ccedil / Ccedilla
ccedil / ccedilla
cedil / textcedilla
cent / textcent
Chi / greekChi
chi / greekchi
circ / textcircumflex
clubs / clubsuit
cong / approxEq
copy / copyright
crarr / carriagereturn
cup / cup
curren / textcurrency
dagger / textdag
Dagger / textddag
darr / downarrow
dArr / Downarrow
deg / textdegree
Delta / greekDelta
delta / greekdelta
diams / blacklozenge
divide / textdiv
Eacute / Eacute
eacute / eacute
Ecirc / Ecircumflex
ecirc / ecircumflex
Egrave / Egrave
egrave / egrave
empty / emptyset
emsp / emspace
ensp / enspace
Epsilon / greekEpsilon
epsilon / greekepsilon
equiv / equiv
Eta / greekEta
eta / greeketa
ETH / Eth
eth / eth
Euml / Ediaeresis
euml / ediaeresis
exist / exists
fnof / fhook
forall / forall
frac12 / onehalf
frac14 / onequarter
frac34 / threequarter
frasl / textfraction
Gamma / greekGamma
gamma / greekgamma
ge / geq
gt / gt
harr / leftrightarrow
hArr / Leftrightarrow
hellip / textellipsis
Iacute / Iacute
iacute / iacute
Icirc / Icircumflex
icirc / icircumflex
iexcl / exclamdown
Igrave / Igrave
igrave / igrave
image / Im
infin / infty
int / intop
Iota / greekIota
iota / greekiota
iquest / questiondown
isin / in
Iuml / Idiaeresis
iuml / idiaeresis
Kappa / greekKappa
kappa / greekkappa
Lambda / greekLambda
lambda / greeklambda
lang / langle
laquo / leftguillemot
larr / leftarrow
lArr / Leftarrow
lceil / lceiling
ldquo / quotedblleft
le / leq
lfloor / lfloor
lowast / ast
loz / lozenge
lsaquo / guilsingleleft
lsquo / quoteleft
lt / lt
macr / textmacron
mdash / emdash
micro / textmu
middot / periodcentered
Mu / greekMu
mu / greekmu
nbsp / nobreakspace
ndash / endash
ne / neq
ni / ni
not / textlognot
notin / nin
nsub / nsubset
Ntilde / Ntilde
ntilde / ntilde
Nu / greekNu
nu / greeknu
Oacute / Oacute
oacute / oacute
Ocirc / Ocircumflex
ocirc / ocircumflex
OElig / OEligature
oelig / oeligature
Ograve / Ograve
ograve / ograve
Omega / greekOmega
omega / greekomega
Omicron / greekOmicron
omicron / greekomicron
oplus / oplus
or / vee
ordf / ordfeminine
ordm / ordmasculine
Oslash / Ostroke
oslash / ostroke
Otilde / Otilde
otilde / otilde
otimes / otimes
Ouml / Odiaeresis
ouml / odiaeresis
para / paragraphmark
part / partial
permil / perthousand
perp / bot
Phi / greekPhi
phi / greekphi
Pi / greekPi
pi / greekpi
piv / greekpialt
plusmn / textpm
pound / textsterling
prime / prime
Prime / doubleprime
prod / prod
prop / propto
Psi / greekPsi
psi / greekpsi
radic / surd
rang / rangle
raquo / rightguillemot
rarr / rightarrow
rArr / Rightarrow
rceil / rceiling
rdquo / quotedblright
real / Re
reg / registered
rfloor / rfloor
Rho / greekRho
rho / greekrho
rsaquo / guilsingleright
rsquo / quoteright
sbquo / quotesinglebase
Scaron / Scaron
scaron / scaron
sdot / cdot
sect / sectionmark
shy / softhyphen
Sigma / greekSigma
sigma / greeksigma
sigmaf / greekfinalsigma
sim / sim
spades / spadesuit
sub / subset
sube / subseteq
sum / sum
sup / supset
sup1 / onesuperior
sup2 / twosuperior
sup3 / threesuperior
supe / supseteq
szlig / ssharp
Tau / greekTau
tau / greektau
there4 / therefore
Theta / greekTheta
theta / greektheta
thetasym / greekthetaalt
thinsp / breakablethinspace
THORN / Thorn
thorn / thorn
tilde / texttilde
times / textmultiply
trade / trademark
Uacute / Uacute
uacute / uacute
uarr / uparrow
uArr / Uparrow
Ucirc / Ucircumflex
ucirc / ucircumflex
Ugrave / Ugrave
ugrave / ugrave
uml / textdiaeresis
Upsilon / greekUpsilon
upsilon / greekupsilon
Uuml / Udiaeresis
uuml / udiaeresis
weierp / wp
Xi / greekXi
xi / greekxi
Yacute / Yacute
yacute / yacute
yen / textyen
yuml / ydiaeresis
Yuml / Ydiaeresis
Zeta / greekZeta
zeta / greekzeta
zwj / zwj
zwnj / zwnj
Responder3
Há um gráfico aqui:Entidades de caracteres ISO e seus equivalentes em LATEXpor Vidar Bronken Gundersen e Rune Mathisen. O material de origem está aqui:http://www.bitjungle.com/isoent/- incluindo um grande arquivo XML com mapeamentos entre vários formatos.
As mesmas pessoas transformaram isso em um programa Perl, disponível aqui:http://llg.cubic.org/docs/ent2latex.html(deesta respostaparaComo procurar um símbolo ou identificar um símbolo ou caractere matemático?.)
E aqui está outra lista:http://www.w3.org/Math/characters/unicode.xmle os mesmos dados compilados em python:https://gist.github.com/piquadrat/798549
Responder4
Algo assim deve abranger os casos mais comuns.
\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage{array,booktabs}
\newcommand{\entity}[2]{#1 & \ & \verb}
\begin{document}
\begin{tabular}{l>{\ttfamily}ll}
\toprule
Symbol &\multicolumn{1}{l}{HTML entity} & \LaTeX\ command \\
\midrule
\entity{\'e}{eacute}|\'e| \\
\entity{\TH}{THORN}|\TH| \\
\bottomrule
\end{tabular}
\end{document}