jueves, 20 de diciembre de 2007

HTML y símbolos matemáticos (entre otros)

Hace unos días publiqué un artículo en el que tuve la necesidad de mostrar el símbolo matemático "infinito" (∞).

En la primera versión, me limité a especificar el literal "infinito", tal cual. Vi que en Wikipedia lo mostraban mediante una imagen y no le dí más vueltas.

Pero esta semana he visto que en Microsiervos hablaban del símbolo "al cuadrado" (²) y me ha picado la curiosidad. Después de buscar en w3c.org he comprobado que hay una buena colección de caracteres que se pueden mostrar mediante HTML (si el navegador sabe obtener la fuente apropiada). El link concreto con la información en cuestión (Character entity references for symbols, mathematical symbols, and Greek letters) es éste pero lo que me ha decepcionado un poco es que en w3c.org no acompañan la información de cada símbolo con el símbolo en sí (?!). Estaremos de acuerdo en que cuesta menos entender a qué nos referimos si vemos el carácter en lugar de su descripción. Es aquello de que vale más una imagen...

En la tabla de abajo he incorporado la misma información del link de antes, añadiendo los correspondiente símbolos. Sobre Mozilla y Firefox los muestra todos correctamente en todas las pruebas que hago. Según leo aquí, de Opera y Safari también nos podemos fiar. En cambio en determinadas versiones de otros navegadores de peor reputación, puede que sea necesario instalar la fuente Unicode Symbols para poder ver correctamente algunos caracteres. Esta fuente se puede descargar, por ejemplo, aquí.

Y ésta es la tabla:


<!-- Mathematical, Greek and Symbolic characters for HTML -->
<!-- Character entity set. Typical invocation: <!ENTITY % HTMLsymbol PUBLIC "-//W3C//ENTITIES Symbols//EN//HTML"> %HTMLsymbol; -->
<!-- Portions © International Organization for Standardization 1986: Permission to copy in any form is granted for use with conforming SGML systems and applications as defined in ISO 8879, provided this notice is included in all copies. -->
<!-- Relevant ISO entity set is given unless names are newly introduced. New names (i.e., not in ISO 8879 list) do not clash with any existing ISO 8879 entity names. ISO 10646 character numbers are given for each character, in hex. CDATA values are decimal conversions of the ISO 10646 values and refer to the document character set. Names are ISO 10646 names. -->
<!-- Latin Extended-B -->
<!ENTITY fnof CDATA "&#402;" -- latin small f with hook = function = florin, U+0192 ISOtech -->ƒ
<!-- Greek -->
<!ENTITY Alpha CDATA "&#913;" -- greek capital letter alpha, U+0391 -->Α
<!ENTITY Beta CDATA "&#914;" -- greek capital letter beta, U+0392 -->Β
<!ENTITY Gamma CDATA "&#915;" -- greek capital letter gamma, U+0393 ISOgrk3 -->Γ
<!ENTITY Delta CDATA "&#916;" -- greek capital letter delta, U+0394 ISOgrk3 -->Δ
<!ENTITY Epsilon CDATA "&#917;" -- greek capital letter epsilon, U+0395 -->Ε
<!ENTITY Zeta CDATA "&#918;" -- greek capital letter zeta, U+0396 -->Ζ
<!ENTITY Eta CDATA "&#919;" -- greek capital letter eta, U+0397 -->Η
<!ENTITY Theta CDATA "&#920;" -- greek capital letter theta, U+0398 ISOgrk3 -->Θ
<!ENTITY Iota CDATA "&#921;" -- greek capital letter iota, U+0399 -->Ι
<!ENTITY Kappa CDATA "&#922;" -- greek capital letter kappa, U+039A -->Κ
<!ENTITY Lambda CDATA "&#923;" -- greek capital letter lambda, U+039B ISOgrk3 -->Λ
<!ENTITY Mu CDATA "&#924;" -- greek capital letter mu, U+039C -->Μ
<!ENTITY Nu CDATA "&#925;" -- greek capital letter nu, U+039D -->Ν
<!ENTITY Xi CDATA "&#926;" -- greek capital letter xi, U+039E ISOgrk3 -->Ξ
<!ENTITY Omicron CDATA "&#927;" -- greek capital letter omicron, U+039F -->Ο
<!ENTITY Pi CDATA "&#928;" -- greek capital letter pi, U+03A0 ISOgrk3 -->Π
<!ENTITY Rho CDATA "&#929;" -- greek capital letter rho, U+03A1 -->Ρ
<!-- there is no Sigmaf, and no U+03A2 character either -->
<!ENTITY Sigma CDATA "&#931;" -- greek capital letter sigma, U+03A3 ISOgrk3 -->Σ
<!ENTITY Tau CDATA "&#932;" -- greek capital letter tau, U+03A4 -->Τ
<!ENTITY Upsilon CDATA "&#933;" -- greek capital letter upsilon, U+03A5 ISOgrk3 -->Υ
<!ENTITY Phi CDATA "&#934;" -- greek capital letter phi, U+03A6 ISOgrk3 -->Φ
<!ENTITY Chi CDATA "&#935;" -- greek capital letter chi, U+03A7 -->Χ
<!ENTITY Psi CDATA "&#936;" -- greek capital letter psi, U+03A8 ISOgrk3 -->Ψ
<!ENTITY Omega CDATA "&#937;" -- greek capital letter omega, U+03A9 ISOgrk3 -->Ω
<!ENTITY alpha CDATA "&#945;" -- greek small letter alpha, U+03B1 ISOgrk3 -->α
<!ENTITY beta CDATA "&#946;" -- greek small letter beta, U+03B2 ISOgrk3 -->β
<!ENTITY gamma CDATA "&#947;" -- greek small letter gamma, U+03B3 ISOgrk3 -->γ
<!ENTITY delta CDATA "&#948;" -- greek small letter delta, U+03B4 ISOgrk3 -->δ
<!ENTITY epsilon CDATA "&#949;" -- greek small letter epsilon, U+03B5 ISOgrk3 -->ε
<!ENTITY zeta CDATA "&#950;" -- greek small letter zeta, U+03B6 ISOgrk3 -->ζ
<!ENTITY eta CDATA "&#951;" -- greek small letter eta, U+03B7 ISOgrk3 -->η
<!ENTITY theta CDATA "&#952;" -- greek small letter theta, U+03B8 ISOgrk3 -->θ
<!ENTITY iota CDATA "&#953;" -- greek small letter iota, U+03B9 ISOgrk3 -->ι
<!ENTITY kappa CDATA "&#954;" -- greek small letter kappa, U+03BA ISOgrk3 -->κ
<!ENTITY lambda CDATA "&#955;" -- greek small letter lambda, U+03BB ISOgrk3 -->λ
<!ENTITY mu CDATA "&#956;" -- greek small letter mu, U+03BC ISOgrk3 -->μ
<!ENTITY nu CDATA "&#957;" -- greek small letter nu, U+03BD ISOgrk3 -->ν
<!ENTITY xi CDATA "&#958;" -- greek small letter xi, U+03BE ISOgrk3 -->ξ
<!ENTITY omicron CDATA "&#959;" -- greek small letter omicron, U+03BF NEW -->ο
<!ENTITY pi CDATA "&#960;" -- greek small letter pi, U+03C0 ISOgrk3 -->π
<!ENTITY rho CDATA "&#961;" -- greek small letter rho, U+03C1 ISOgrk3 -->ρ
<!ENTITY sigmaf CDATA "&#962;" -- greek small letter final sigma, U+03C2 ISOgrk3 -->ς
<!ENTITY sigma CDATA "&#963;" -- greek small letter sigma, U+03C3 ISOgrk3 -->σ
<!ENTITY tau CDATA "&#964;" -- greek small letter tau, U+03C4 ISOgrk3 -->τ
<!ENTITY upsilon CDATA "&#965;" -- greek small letter upsilon, U+03C5 ISOgrk3 -->υ
<!ENTITY phi CDATA "&#966;" -- greek small letter phi, U+03C6 ISOgrk3 -->φ
<!ENTITY chi CDATA "&#967;" -- greek small letter chi, U+03C7 ISOgrk3 -->χ
<!ENTITY psi CDATA "&#968;" -- greek small letter psi, U+03C8 ISOgrk3 -->ψ
<!ENTITY omega CDATA "&#969;" -- greek small letter omega, U+03C9 ISOgrk3 -->ω
<!ENTITY thetasym CDATA "&#977;" -- greek small letter theta symbol, U+03D1 NEW -->ϑ
<!ENTITY upsih CDATA "&#978;" -- greek upsilon with hook symbol, U+03D2 NEW -->ϒ
<!ENTITY piv CDATA "&#982;" -- greek pi symbol, U+03D6 ISOgrk3 -->ϖ
<!-- General Punctuation -->
<!ENTITY bull CDATA "&#8226;" -- bullet = black small circle, U+2022 ISOpub -->
<!-- bullet is NOT the same as bullet operator, U+2219 -->
<!ENTITY hellip CDATA "&#8230;" -- horizontal ellipsis = three dot leader, U+2026 ISOpub -->
<!ENTITY prime CDATA "&#8242;" -- prime = minutes = feet, U+2032 ISOtech -->
<!ENTITY Prime CDATA "&#8243;" -- double prime = seconds = inches, U+2033 ISOtech -->
<!ENTITY oline CDATA "&#8254;" -- overline = spacing overscore, U+203E NEW -->
<!ENTITY frasl CDATA "&#8260;" -- fraction slash, U+2044 NEW -->
<!-- Letterlike Symbols -->
<!ENTITY weierp CDATA "&#8472;" -- script capital P = power set = Weierstrass p, U+2118 ISOamso -->
<!ENTITY image CDATA "&#8465;" -- blackletter capital I = imaginary part, U+2111 ISOamso -->
<!ENTITY real CDATA "&#8476;" -- blackletter capital R = real part symbol, U+211C ISOamso -->
<!ENTITY trade CDATA "&#8482;" -- trade mark sign, U+2122 ISOnum -->
<!ENTITY alefsym CDATA "&#8501;" -- alef symbol = first transfinite cardinal, U+2135 NEW -->
<!-- alef symbol is NOT the same as hebrew letter alef, U+05D0 although the same glyph could be used to depict both characters -->
<!-- Arrows -->
<!ENTITY larr CDATA "&#8592;" -- leftwards arrow, U+2190 ISOnum -->
<!ENTITY uarr CDATA "&#8593;" -- upwards arrow, U+2191 ISOnum-->
<!ENTITY rarr CDATA "&#8594;" -- rightwards arrow, U+2192 ISOnum -->
<!ENTITY darr CDATA "&#8595;" -- downwards arrow, U+2193 ISOnum -->
<!ENTITY harr CDATA "&#8596;" -- left right arrow, U+2194 ISOamsa -->
<!ENTITY crarr CDATA "&#8629;" -- downwards arrow with corner leftwards = carriage return, U+21B5 NEW -->
<!ENTITY lArr CDATA "&#8656;" -- leftwards double arrow, U+21D0 ISOtech -->
<!-- ISO 10646 does not say that lArr is the same as the 'is implied by' arrow but also does not have any other character for that function. So ? lArr can be used for 'is implied by' as ISOtech suggests -->
<!ENTITY uArr CDATA "&#8657;" -- upwards double arrow, U+21D1 ISOamsa -->
<!ENTITY rArr CDATA "&#8658;" -- rightwards double arrow, U+21D2 ISOtech -->
<!-- ISO 10646 does not say this is the 'implies' character but does not have another character with this function so ? rArr can be used for 'implies' as ISOtech suggests -->
<!ENTITY dArr CDATA "&#8659;" -- downwards double arrow, U+21D3 ISOamsa -->
<!ENTITY hArr CDATA "&#8660;" -- left right double arrow, U+21D4 ISOamsa -->
<!-- Mathematical Operators -->
<!ENTITY forall CDATA "&#8704;" -- for all, U+2200 ISOtech -->
<!ENTITY part CDATA "&#8706;" -- partial differential, U+2202 ISOtech -->
<!ENTITY exist CDATA "&#8707;" -- there exists, U+2203 ISOtech -->
<!ENTITY empty CDATA "&#8709;" -- empty set = null set = diameter, U+2205 ISOamso -->
<!ENTITY nabla CDATA "&#8711;" -- nabla = backward difference, U+2207 ISOtech -->
<!ENTITY isin CDATA "&#8712;" -- element of, U+2208 ISOtech -->
<!ENTITY notin CDATA "&#8713;" -- not an element of, U+2209 ISOtech -->
<!ENTITY ni CDATA "&#8715;" -- contains as member, U+220B ISOtech -->
<!-- should there be a more memorable name than 'ni'? -->
<!ENTITY prod CDATA "&#8719;" -- n-ary product = product sign, U+220F ISOamsb -->
<!-- prod is NOT the same character as U+03A0 'greek capital letter pi' though the same glyph might be used for both -->
<!ENTITY sum CDATA "&#8721;" -- n-ary sumation, U+2211 ISOamsb -->
<!-- sum is NOT the same character as U+03A3 'greek capital letter sigma' though the same glyph might be used for both -->
<!ENTITY minus CDATA "&#8722;" -- minus sign, U+2212 ISOtech -->
<!ENTITY lowast CDATA "&#8727;" -- asterisk operator, U+2217 ISOtech -->
<!ENTITY radic CDATA "&#8730;" -- square root = radical sign, U+221A ISOtech -->
<!ENTITY prop CDATA "&#8733;" -- proportional to, U+221D ISOtech -->
<!ENTITY infin CDATA "&#8734;" -- infinity, U+221E ISOtech -->
<!ENTITY ang CDATA "&#8736;" -- angle, U+2220 ISOamso -->
<!ENTITY and CDATA "&#8743;" -- logical and = wedge, U+2227 ISOtech -->
<!ENTITY or CDATA "&#8744;" -- logical or = vee, U+2228 ISOtech -->
<!ENTITY cap CDATA "&#8745;" -- intersection = cap, U+2229 ISOtech -->
<!ENTITY cup CDATA "&#8746;" -- union = cup, U+222A ISOtech -->
<!ENTITY int CDATA "&#8747;" -- integral, U+222B ISOtech -->
<!ENTITY there4 CDATA "&#8756;" -- therefore, U+2234 ISOtech -->
<!ENTITY sim CDATA "&#8764;" -- tilde operator = varies with = similar to, U+223C ISOtech -->
<!-- tilde operator is NOT the same character as the tilde, U+007E, although the same glyph might be used to represent both -->
<!ENTITY cong CDATA "&#8773;" -- approximately equal to, U+2245 ISOtech -->
<!ENTITY asymp CDATA "&#8776;" -- almost equal to = asymptotic to, U+2248 ISOamsr -->
<!ENTITY ne CDATA "&#8800;" -- not equal to, U+2260 ISOtech -->
<!ENTITY equiv CDATA "&#8801;" -- identical to, U+2261 ISOtech -->
<!ENTITY le CDATA "&#8804;" -- less-than or equal to, U+2264 ISOtech -->
<!ENTITY ge CDATA "&#8805;" -- greater-than or equal to, U+2265 ISOtech -->
<!ENTITY sub CDATA "&#8834;" -- subset of, U+2282 ISOtech -->
<!ENTITY sup CDATA "&#8835;" -- superset of, U+2283 ISOtech -->
<!-- note that nsup, 'not a superset of, U+2283' is not covered by the Symbol font encoding and is not included. Should it be, for symmetry? It is in ISOamsn -->
<!ENTITY nsub CDATA "&#8836;" -- not a subset of, U+2284 ISOamsn -->
<!ENTITY sube CDATA "&#8838;" -- subset of or equal to, U+2286 ISOtech -->
<!ENTITY supe CDATA "&#8839;" -- superset of or equal to, U+2287 ISOtech -->
<!ENTITY oplus CDATA "&#8853;" -- circled plus = direct sum, U+2295 ISOamsb -->
<!ENTITY otimes CDATA "&#8855;" -- circled times = vector product, U+2297 ISOamsb -->
<!ENTITY perp CDATA "&#8869;" -- up tack = orthogonal to = perpendicular, U+22A5 ISOtech -->
<!ENTITY sdot CDATA "&#8901;" -- dot operator, U+22C5 ISOamsb -->
<!-- dot operator is NOT the same character as U+00B7 middle dot -->
<!-- Miscellaneous Technical -->
<!ENTITY lceil CDATA "&#8968;" -- left ceiling = apl upstile, U+2308 ISOamsc -->
<!ENTITY rceil CDATA "&#8969;" -- right ceiling, U+2309 ISOamsc -->
<!ENTITY lfloor CDATA "&#8970;" -- left floor = apl downstile, U+230A ISOamsc -->
<!ENTITY rfloor CDATA "&#8971;" -- right floor, U+230B ISOamsc -->
<!ENTITY lang CDATA "&#9001;" -- left-pointing angle bracket = bra, U+2329 ISOtech -->
<!-- lang is NOT the same character as U+003C 'less than' or U+2039 'single left-pointing angle quotation mark' -->
<!ENTITY rang CDATA "&#9002;" -- right-pointing angle bracket = ket, U+232A ISOtech -->
<!-- rang is NOT the same character as U+003E 'greater than' or U+203A 'single right-pointing angle quotation mark' -->
<!-- Geometric Shapes -->
<!ENTITY loz CDATA "&#9674;" -- lozenge, U+25CA ISOpub -->
<!-- Miscellaneous Symbols -->
<!ENTITY spades CDATA "&#9824;" -- black spade suit, U+2660 ISOpub -->
<!-- black here seems to mean filled as opposed to hollow -->
<!ENTITY clubs CDATA "&#9827;" -- black club suit = shamrock, U+2663 ISOpub -->
<!ENTITY hearts CDATA "&#9829;" -- black heart suit = valentine, U+2665 ISOpub -->
<!ENTITY diams CDATA "&#9830;" -- black diamond suit, U+2666 ISOpub -->

2 Comentarios:

Anónimo dijo...

Gracias por el aporte!! muchas veces solo insertamos símbolos... pero nunca tomamos en cuenta consideraciones de la W3C. Saludos!!!

Pere Moltó Agut dijo...

Gracias tambien a ti por el comentario.