LaTeXでの色の使い方: xcolorパッケージ
📂論文作成LaTeXでの色の使い方: xcolorパッケージ
説明
\usepackage{color}
LATEXで色を使用できる最も基本的なパッケージはcolor
だ。プレアミブルに\usepackage{color}
を追加し、{\color{色}内容}
のように使用する。使用可能な色は以下の通り。
colorboxblackcolorboxgreencolorboxwhitecolorboxbluecolorboxmagentacolorboxyellowcolorboxcyancolorboxred
\documentclass{article}
\usepackage{color}
\begin{document}
This is {\color{red}red} text.
\end{document}
This is red text.
\usepackage{xcolor}
xcolor
を使用すると、より多くの色を使用できる。
colorboxblackcolorboxdarkgraycolorboxlimecolorboxpinkcolorboxvioletcolorboxbluecolorboxgraycolorboxmagentacolorboxpurplecolorboxwhitecolorboxbrowncolorboxgreencolorboxolivecolorboxredcolorboxyellowcolorboxcyancolorboxlightgraycolorboxorangecolorboxteal
\documentclass{article}
\usepackage{xcolor}
\begin{document}
This is {\color{olive}olive} text.\\
This is {\color{orange}orange} text.\\
\end{document}
This is olive text.This is orange text.
\usepackage[dvipsnames]{xcolor}
オプションに[dvipsnames]
を追加すると、さらに多くの色を使用できる。オプションと使用可能な色の数は次の通り。
[dvipsnames]
: CMYK色 68個[svgnames]
: RGB色 151個[x11names]
: RGB色 317個
[dvipsnames]
で使用できる色は以下の通りで、残りは公式文書で確認できる。
