
具体的には、次の表を完成できるようにしたいと思います。
symbol html entity LaTeX command
\deg ° \begin{alltt}\deg{alltt}
こうすることで、リストされているすべてのHTML名前付きエンティティのエントリが公式仕様。
すべてにマッピングがあるわけではないことは承知していますが、多ければ多いほど良いです。
HTML と LaTeX の両方で公開される予定のソース ドキュメントの適合性をチェックするためにこれが必要です。ソース ドキュメントには、HTML の名前付きエンティティがすでに含まれている可能性があります。したがって、変換を提供するマッピング チャート、またはマッピングされていないものに対して適合性警告を発行するためのマッピング チャートが必要です。
答え1
ConTeXt では、char-ent.lua
ファイルにはすべての HTML エンティティのリストが含まれています。characters.entities
テーブルを使用してそれらにアクセスできます。たとえば、次のコードはすべてのエンティティとその値を画面に出力します。
\starttext
\startluacode
local entities = characters.entities
for name, value in next, entities do
print(name,value)
end
\stopluacode
\stoptext
エンティティは対応するTeXコマンドに変換されるのではなく、対応するUnicodeシンボルに変換されます。シンボルに対応するTeX名が必要な場合は、テーブルcharacters.data
(で定義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
結果のリストはここLaTeX がすべてのコマンドに対して同じ命名規則に従うかどうかはわかりません。
答え2
これを締めくくるにあたり、私の最初の質問は HTML 4.0 エンティティを LaTeX にマッピングするためのものでした。Aditya の回答では、はるかに広範囲の名前付き文字エンティティをマッピングする機能が提供されています。
私は Aditya のデータ セットを使用して、以下のように HTML 4.0 専用のマッピングを作成しました。リストにない場合は、マッピングがありません (または、データ セットの縮小を間違えています)。
コメントを参照してください。この表は 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
答え3
ここにチャートがあります:ISO 文字エンティティとそれに相当する LATEX著者:Vidar Bronken Gundersen および Rune Mathisen。ソース資料はこちらです:http://www.bitjungle.com/isoent/- さまざまな形式間のマッピングを含む大きな XML ファイルが含まれます。
同じ人たちがこれを Perl プログラムに変換しました。こちらから入手できます:http://llg.cubic.org/docs/ent2latex.html(からこの答えに記号を検索したり、数学記号や文字を識別するにはどうすればよいですか?。
もう一つのリストがこちらです:http://www.w3.org/Math/characters/unicode.xml同じデータを Python にコンパイルすると次のようになります。https://gist.github.com/piquadrat/798549
答え4
このようなもので、最も一般的なケースをカバーできるはずです。
\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}