
특히 저는 다음 표를 완성하고 싶습니다.
symbol html entity LaTeX command
\deg ° \begin{alltt}\deg{alltt}
그래서 나는공식 사양.
모든 항목에 대한 매핑이 없을 수도 있지만, 많을수록 더 즐겁습니다.
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 명령으로 변환되지 않고 해당 유니코드 기호로 변환됩니다. 기호에 해당하는 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}