LoginSignup
8
7

More than 5 years have passed since last update.

テキストの装飾の指定: CSSとLaTeXの比較

Last updated at Posted at 2013-12-19

これは「TeX/LaTeX Advent Caleandar 2013」の 19 日目の記事です。
(18 日目は k16shikano さん (2回目)です。)
(20 日目は k16shikano さん (3回目)です。)

「HTML と LaTeX の比較」は何度か見たことがあるが、CSS との比較は見かけないので作ってみた。

CSS LaTeX 適用例 備考
font-style プロパティ (フォントシェープ指定) ※1
italic (イタリック体) \textit{...} or {\itshape ...} cssvs01.png
oblique (斜体) \textsl{...} or {\slshape ...} cssvs02.png
normal (直立体) \textup{...} or {\upshape ...} cssvs03.png ※1
font-variant プロパティ (フォントシェープ指定) ※1
small-caps (スモールキャプス) \textsc{...} or {\scshape ...} cssvs04.png
font-weight プロパティ (フォントシリーズ指定)
bold (太字) \textbf{...} or {\bfseries ...} cssvs05.png
normal (通常) \textmd{...} or {\mdseries ...} cssvs06.png
font-size プロパティ (フォントサイズ指定)
x-large (極大) {\Large ...} cssvs07.png
large (大) {\large ...} cssvs08.png
medium (通常) {\normalsize ...} cssvs09.png
small (小) {\small ...} cssvs10.png
x-small (極小) {\footnotesize ...} cssvs11.png
15pt (寸法指定) {\fontsize{15}{15}\selectfont ...} cssvs23.png ※2
font-family プロパティ (フォントファミリ指定)
serif (セリフ) \textrm{...} or {\rmfamily ...} cssvs12.png ※3
sans-serif (サンセリフ) \textsf{...} or {\sffamily ...} cssvs13.png ※3
monospace (等幅) \texttt{...} or {\ttfamily ...} cssvs14.png ※3
'Times' {\fontfamily{ptm}\selectfont ...} cssvs15.png ※4
'Helvetica' {\fontfamily{phv}\selectfont ...} cssvs16.png ※4
color プロパティ (要 color パッケージ)
red (名前指定) {\color{red}...} cssvs17.png ※5
rgb(0%,40%,20%) (値指定) {\color[rgb]{0,0.4,0.2}...} cssvs18.png ※6
text-decoration プロパティ
underline (下線) \uline{...} (要 ulem cssvs19.png ※7
overline (上線) \Overline{...} (要 umoline cssvs20.png
line-through (取消線) \sout{...} (要 ulem cssvs21.png ※7
blink (点滅) \textblink{...} (要 bxblink cssvs22.gif ※8

注釈

※1 font-shape と font-variant は CSS では別の区分となるが、LaTeX では同じ区分(シェープ)に属する。
だから、LaTeX で {\scshape\slshape Text} としても通常は「スモールキャプスの斜体」ではなく(\slshape\scshape を打ち消して)「単なる斜体」になってしまう。
同様に、\upshape は斜体やイタリックだけでなくスモールキャプスも打ち消す。
※2 \fontsize の第 2引数は行送りの長さ(CSS では line-height プロパティ)を表す。
※3 これらの“総称”のファミリの実体は既定では Computer Modern フォントであるが、この設定は文書ごとに変更できる。
※4 LaTeX ではフォントファミリに英字からなる短い識別子を付けて管理していて、例えば、Times → ptm、Helvetica → phv、Palatino → ppl、Computer Modern Roman → cmr
※5 既定で利用できる色名は black, white, red, green, blue, cyan, magenta, yellow。
※6 \definecolor{mygreen}{rgb}{0,0.4,0.2} と色名を定義してそれを使うのが通例。
なお、印刷物ではCMYKモデルの使用が望ましい。
※7 umoline パッケージにも下線(\Underline)と取消線(\Midline)の機能があるが、ulem パッケージの方が有名。
※8 PDF 出力でのみ利用可能。残念ながら紙に印刷した場合は機能しない。

極めてどうでもよい補足

8
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
7