Colour and links
このページには最新のブラウザ(SharedArrayBuffer対応)が必要です。Chrome、Edge、Firefox、Safariを最新バージョンに更新してください。
カラーの追加
xcolorパッケージを使用すれば、テキストに色を付けられます。ロードしてから、文字を囲んでください:
\usepackage{xcolor}
...
\textcolor{red}{This is red} and \textcolor{blue}{this is blue}.
- 標準名として、
red、blue、green、orange、grayなどが利用可能です。
ハイライトと独自の色
\colorbox{yellow}{text}は文字の背景にハイライト色を適用します。- 独自の色を組み合わせることも可能です:
\textcolor{red!60}{...}は60%の赤(明るい色)です。
クリック可能なリンク
hyperrefパッケージを使用すれば、内部参照やWebアドレスをクリック可能なリンクに変換できます:
\usepackage{hyperref}
...
Visit \href{https://ctan.org}{CTAN} for packages.
hyperrefはプレアムブル(冒頭部)で最後にロードしてください — 最終的な優先権を持つことを好みます。
よくあるミス
\textcolorwithoutxcolor. LaTeX stops with! Undefined control sequence.- 誤字のカラー名。
\textcolor{rd}{...}は! Package xcolor Error: Undefined color 'rd'.を出力します。 hyperrefを早期に読み込むと破損する。 他のパッケージがリンクを壊す原因になります。プレアMBルでは 最後に 読み込みます。
難易度 2/5 · 140 コイン + 今日初回達成時の小ボーナス
負荷 xcolor, then make the word warning red with \textcolor{red}{warning}. You need both the package and the command.
コンパイルしてPDFをプレビューするには「実行」をクリックしてください。
難易度 2/5 · 140 コイン + 今日初回達成時の小ボーナス
Make a clickable link. Load hyperref, then turn the word CTAN into a link with \href{https://ctan.org}{CTAN}. Load hyperref last in the preamble.
コンパイルしてPDFをプレビューするには「実行」をクリックしてください。
難易度 2/5 · 140 コイン + 今日初回達成時の小ボーナス
Highlight the word Note with a yellow background using \colorbox{yellow}{Note}. xcolor is already loaded.
コンパイルしてPDFをプレビューするには「実行」をクリックしてください。