文字参照と実体参照

文字参照

文字参照は、文字を直接記述するのではなく、文字コード(Unicode)の形式で記述することです。 「アンパサンド記号」+「シャープ記号」+10進数の文字コード+「セミコロン記号」の形式で指定します。

実体参照

文字コードでは覚えづらいため、DTD で実体(エンティティ)定義を行ったものが実体参照です。 文字コードの代わりに文字列で指定できます。 「アンパサンド記号」+文字列+「セミコロン記号」の形式で指定します。

特殊文字

SGMLの応用言語であるHTMLXML、XHTMLでは、2重引用符 (") やアンパサンド (&)、不等号 (< >) は特別な意味を持つ特殊文字として扱われるため、そのままでは文字データとして使えません。そこで、文字参照または実体参照という方法でこれらの文字を表します。

特殊文字の文字参照と実体参照の一覧を次に示します。

文字参照 実体参照 文字 備考
&#34; &quot; " クォーテーションマーク (quotation mark)
&#38; &amp; & アンパサンド (ampersand)
&#60; &lt; < 小なり (less-than)
&#62; &gt; > 大なり (greater-than)

HTMLで「Jack & Betty」と表示させる例を次に示します。

<p>Jack &amp; Betty</p>

ハイフン

ダッシュ
文字 実体参照 説明
&hyphen; hyphen
­ &shy; soft hyphen

hyphen は2つ以上の単語を組み合わせるときに使用する。

well‐known

英単語は途中で改行してもよい切れ目が決まっています(英和辞典に載っています)。ソフトハイフンは、このつづり字の切れ目を指定します。英単語が途中で改行されるときは、このソフトハイフンの位置で改行されます。また、単語の切れ目に、単語が続くことを表すハイフンが表示されます。単語の途中で改行されないときは、ハイフンは表示されません。

ソフトハイフンの使用例を次に示します。

<p>ref&shy;er&shy;ence</p>

ref­er­ence ref­er­ence ref­er­ence ref­er­ence ref­er­ence ref­er­ence ref­er­ence ref­er­ence ref­er­ence

ダッシュ

ダッシュ
文字 文字参照 実体参照 説明
&#8211; &ndash; en dash
&#8212; &mdash; em dash

n-dash は数値の範囲を表すときに使用する。

1940–2024

m-dash は2つの文章を接続するときに使用する。

チェックマーク

Unicode にはチェックマークを表す文字が複数種用意されている。

チェックマーク
文字 文字参照 説明
&#x2713; CHECK MARK
&#x2714; HEAVY CHECK MARK
&#x2611; BALLOT BOX WITH CHECK
&#x2705; WHITE HEAVY CHECK MARK
🗸 &#x1F5F8; LIGHT CHECK MARK
🗹 &#x1F5F9; BALLOT BOX WITH BOLD CHECK

バツ印

Unicode にはバツ印を表す文字が複数種用意されている。

バツ印
文字 文字参照 説明
&#x2717; BALLOT X
&#x2718; HEAVY BALLOT X
&#x274C; CROSS MARK
&#x274E; NEGATIVE SQUARED CROSS MARK

文字参照と実体参照の一覧

特殊文字だけでなく普通の文字も文字参照や実体参照で表すことができます。

HTMLspecial
文字参照 実体参照 文字 備考
&#35; # ナンバー
&#338; &OElig; Œ latin capital ligature OE
&#339; &oelig; œ latin small ligature oe
&#352; &Scaron; Š latin capital letter S with caron
&#353; &scaron; š latin small letter s with caron
&#376; &Yuml; Ÿ latin capital letter Y with diaeresis
&#710; &circ; ˆ modifier letter circumflex accent
&#732; &tilde; ˜ small tilde
&#8194; &ensp; en space
&#8195; &emsp; em space
&#8201; &thinsp; thin space
&#8204; &zwnj; zero width non-joiner
&#8205; &zwj; zero width joiner
&#8206; &lrm; left-to-right mark
&#8207; &rlm; right-to-left mark
&#8216; &lsquo; left single quotation mark
&#8217; &rsquo; right single quotation mark
&#8218; &sbquo; single low-9 quotation mark
&#8220; &ldquo; left double quotation mark
&#8221; &rdquo; right double quotation mark
&#8222; &bdquo; double low-9 quotation mark
&#8224; &dagger; dagger
&#8225; &Dagger; double dagger
&#8240; &permil; per mille sign
&#8249; &lsaquo; single left-pointing angle quotation mark
&#8250; &rsaquo; single right-pointing angle quotation mark
&#8364; &euro; euro sign

Latin-1 characters

HTMLlat1
文字参照 実体参照 文字 備考
&#160; &nbsp;   スペースの前及び後の位置での自動的な改行を防ぐ特殊なスペース (no-break space)
&#161; &iexcl; ¡ inverted exclamation mark
&#162; &cent; ¢ cent sign
&#163; &pound; £ pound sign
&#164; &curren; ¤ currency sign
&#165; &yen; ¥ yen sign
&#166; &brvbar; ¦ broken vertical bar
&#167; &sect; § section sign
&#168; &uml; ¨ diaeresis = spacing diaeresis
&#169; &copy; © コピーライト
&#170; &ordf; ª feminine ordinal indicator
&#171; &laquo; « left-pointing double angle quotation mark = left pointing guillemet
&#172; &not; ¬ not sign
&#173; &shy; ­ soft hyphen = discretionary hyphen 1
&#174; &reg; ® registered sign = registered trade mark sign
&#175; &macr; ¯ macron = spacing macron = overline = APL overbar
&#176; &deg; ° degree sign
&#177; &plusmn; ± plus-minus sign = plus-or-minus sign
&#178; &sup2; ² superscript two = superscript digit two = squared
&#179; &sup3; ³ superscript three = superscript digit three = cubed
&#180; &acute; ´ acute accent = spacing acute
&#181; &micro; µ micro sign
&#182; &para; 段落記号 (paragraph sign)
&#183; &middot; · middle dot = Georgian comma = Greek middle dot
&#184; &cedil; ¸ cedilla = spacing cedilla
&#185; &sup1; ¹ superscript one = superscript digit one
&#186; &ordm; º masculine ordinal indicator
&#187; &raquo; » right-pointing double angle quotation mark = right pointing guillemet
&#188; &frac14; ¼ vulgar fraction one quarter = fraction one quarter
&#189; &frac12; ½ vulgar fraction one half = fraction one half
&#190; &frac34; ¾ vulgar fraction three quarters = fraction three quarters
&#191; &iquest; ¿ inverted question mark = turned question mark
&#192; &Agrave; À latin capital letter A with grave = latin capital letter A grave
&#193; &Aacute; Á latin capital letter A with acute
&#194; &Acirc; Â latin capital letter A with circumflex
&#195; &Atilde; Ã latin capital letter A with tilde
&#196; &Auml; Ä latin capital letter A with diaeresis
&#197; &Aring; Å latin capital letter A with ring above = latin capital letter A ring
&#198; &AElig; Æ latin capital letter A with acute = latin capital ligature AE
&#199; &Ccedil; Ç latin capital letter C with cedilla
&#200; &Egrave; È latin capital letter E with grave
&#201; &Eacute; É latin capital letter E with acute
&#202; &Ecirc; Ê latin capital letter E with circumflex
&#203; &Euml; Ë latin capital letter E with diaeresis
&#204; &Igrave; Ì latin capital letter I with grave
&#205; &Iacute; Í latin capital letter I with acute
&#206; &Icirc; Î latin capital letter I with circumflex
&#207; &Iuml; Ï latin capital letter I with diaeresis
&#208; &ETH; Ð latin capital letter ETH
&#209; &Ntilde; Ñ latin capital letter N with tilde
&#210; &Ograve; Ò latin capital letter O with grave
&#211; &Oacute; Ó latin capital letter O with acute
&#212; &Ocirc; Ô latin capital letter O with circumflex
&#213; &Otilde; Õ latin capital letter O with tilde
&#214; &Ouml; Ö latin capital letter O with diaeresis
&#215; &times; × multiplication sign
&#216; &Oslash; Ø latin capital letter O with stroke = latin capital letter O slash
&#217; &Ugrave; Ù latin capital letter U with grave
&#218; &Uacute; Ú latin capital letter U with acute
&#219; &Ucirc; Û latin capital letter U with circumflex
&#220; &Uuml; Ü latin capital letter U with diaeresis
&#221; &Yacute; Ý latin capital letter Y with acute
&#222; &THORN; Þ latin capital letter THORN
&#223; &szlig; ß latin small letter sharp s = ess-zed
&#224; &agrave; à latin small letter a with grave = latin small letter a grave
&#225; &aacute; á latin small letter a with acute
&#226; &acirc; â latin small letter a with circumflex
&#227; &atilde; ã latin small letter a with tilde
&#228; &auml; ä latin small letter a with diaeresis
&#229; &aring; å latin small letter a with ring above = latin small letter a ring
&#230; &aelig; æ latin small letter ae = latin small ligature ae
&#231; &ccedil; ç latin small letter c with cedilla
&#232; &egrave; è latin small letter e with grave
&#233; &eacute; é latin small letter e with acute
&#234; &ecirc; ê latin small letter e with circumflex
&#235; &euml; ë latin small letter e with diaeresis
&#236; &igrave; ì latin small letter i with grave
&#237; &iacute; í latin small letter i with acute
&#238; &icirc; î latin small letter i with circumflex
&#239; &iuml; ï latin small letter i with diaeresis
&#240; &eth; ð latin small letter eth
&#241; &ntilde; ñ latin small letter n with tilde
&#242; &ograve; ò latin small letter o with grave
&#243; &oacute; ó latin small letter o with acute
&#244; &ocirc; ô latin small letter o with circumflex
&#245; &otilde; õ latin small letter o with tilde
&#246; &ouml; ö latin small letter o with diaeresis
&#247; &divide; ÷ division sign
&#248; &oslash; ø latin small letter o with stroke = latin small letter o slash
&#249; &ugrave; ù latin small letter u with grave
&#250; &uacute; ú latin small letter u with acute
&#251; &ucirc; û latin small letter u with circumflex
&#252; &uuml; ü latin small letter u with diaeresis
&#253; &yacute; ý latin small letter y with acute
&#254; &thorn; þ latin small letter thorn
&#255; &yuml; ÿ latin small letter y with diaeresis
HTMLsymbol
文字参照 実体参照 文字 備考
&#402; &fnof; ƒ latin small f with hook = function = florin
&#913; &Alpha; Α greek capital letter alpha
&#914; &Beta; Β greek capital letter beta
&#915; &Gamma; Γ greek capital letter gamma
&#916; &Delta; Δ greek capital letter delta
&#917; &Epsilon; Ε greek capital letter epsilon
&#918; &Zeta; Ζ greek capital letter zeta
&#919; &Eta; Η greek capital letter eta
&#920; &Theta; Θ greek capital letter theta
&#921; &Iota; Ι greek capital letter iota
&#922; &Kappa; Κ greek capital letter kappa
&#923; &Lambda; Λ greek capital letter lambda
&#924; &Mu; Μ greek capital letter mu
&#925; &Nu; Ν greek capital letter nu
&#926; &Xi; Ξ greek capital letter xi
&#927; &Omicron; Ο greek capital letter omicron
&#928; &Pi; Π greek capital letter pi
&#929; &Rho; Ρ greek capital letter rho
&#931; &Sigma; Σ greek capital letter sigma
&#932; &Tau; Τ greek capital letter tau
&#933; &Upsilon; Υ greek capital letter upsilon
&#934; &Phi; Φ greek capital letter phi
&#935; &Chi; Χ greek capital letter chi
&#936; &Psi; Ψ greek capital letter psi
&#937; &Omega; Ω greek capital letter omega
&#945; &alpha; α greek small letter alpha
&#946; &beta; β greek small letter beta
&#947; &gamma; γ greek small letter gamma
&#948; &delta; δ greek small letter delta
&#949; &epsilon; ε greek small letter epsilon
&#950; &zeta; ζ greek small letter zeta
&#951; &eta; η greek small letter eta
&#952; &theta; θ greek small letter theta
&#953; &iota; ι greek small letter iota
&#954; &kappa; κ greek small letter kappa
&#955; &lambda; λ greek small letter lambda
&#956; &mu; μ greek small letter mu
&#957; &nu; ν greek small letter nu
&#958; &xi; ξ greek small letter xi
&#959; &omicron; ο greek small letter omicron
&#960; &pi; π greek small letter pi
&#961; &rho; ρ greek small letter rho
&#962; &sigmaf; ς greek small letter final sigma
&#963; &sigma; σ greek small letter sigma
&#964; &tau; τ greek small letter tau
&#965; &upsilon; υ greek small letter upsilon
&#966; &phi; φ greek small letter phi
&#967; &chi; χ greek small letter chi
&#968; &psi; ψ greek small letter psi
&#969; &omega; ω greek small letter omega
&#977; &thetasym; ϑ greek small letter theta symbol
&#978; &upsih; ϒ greek upsilon with hook symbol
&#982; &piv; ϖ greek pi symbol
&#8226; &bull; bullet = black small circle
&#8230; &hellip; horizontal ellipsis = three dot leader
&#8242; &prime; prime = minutes = feet
&#8243; &Prime; double prime = seconds = inches
&#8254; &oline; overline = spacing overscore
&#8260; &frasl; fraction slash
&#8472; &weierp; script capital P = power set = Weierstrass p
&#8465; &image; blackletter capital I = imaginary part
&#8476; &real; blackletter capital R = real part symbol
&#8482; &trade; trade mark sign
&#8501; &alefsym; alef symbol = first transfinite cardinal
&#8592; &larr; leftwards arrow
&#8593; &uarr; upwards arrow
&#8594; &rarr; rightwards arrow
&#8595; &darr; downwards arrow
&#8596; &harr; left right arrow
&#8629; &crarr; downwards arrow with corner leftwards = carriage return
&#8656; &lArr; leftwards double arrow
&#8657; &uArr; upwards double arrow
&#8658; &rArr; rightwards double arrow
&#8659; &dArr; downwards double arrow
&#8660; &hArr; left right double arrow
&#8704; &forall; for all
&#8706; &part; partial differential
&#8707; &exist; there exists
&#8709; &empty; empty set = null set = diameter
&#8711; &nabla; nabla = backward difference
&#8712; &isin; element of
&#8713; &notin; not an element of
&#8715; &ni; contains as member
&#8719; &prod; n-ary product = product sign
&#8721; &sum; n-ary sumation
&#8722; &minus; minus sign
&#8727; &lowast; asterisk operator
&#8730; &radic; square root = radical sign
&#8733; &prop; proportional to
&#8734; &infin; infinity
&#8736; &ang; angle
&#8743; &and; logical and = wedge
&#8744; &or; logical or = vee
&#8745; &cap; intersection = cap
&#8746; &cup; union = cup
&#8747; &int; integral
&#8756; &there4; therefore
&#8764; &sim; tilde operator = varies with = similar to
&#8773; &cong; approximately equal to
&#8776; &asymp; almost equal to = asymptotic to
&#8800; &ne; not equal to
&#8801; &equiv; identical to
&#8804; &le; 小なりイコール (less-than or equal to)
&#8805; &ge; 大なりイコール (greater than or equal to)
&#8834; &sub; subset of
&#8835; &sup; superset of
&#8836; &nsub; not a subset of
&#8838; &sube; subset of or equal to
&#8839; &supe; superset of or equal to
&#8853; &oplus; circled plus = direct sum
&#8855; &otimes; circled times = vector product
&#8869; &perp; up tack = orthogonal to = perpendicular
&#8901; &sdot; dot operator
&#8968; &lceil; left ceiling = apl upstile
&#8969; &rceil; right ceiling
&#8970; &lfloor; left floor = apl downstile
&#8971; &rfloor; right floor
&#9001; &lang; left-pointing angle bracket = bra
&#9002; &rang; right-pointing angle bracket = ket
&#9674; &loz; lozenge
&#9824; &spades; スペード
&#9827; &clubs; クラブ(クローバー)
&#9829; &hearts; ハート
&#9830; &diams; ダイヤ(ダイヤモンド)
&#9839; シャープ

参考文献

Thomas, Ken 2024. How to use the en dash, em dash and hyphen (also ndash, mdash)