Latex中设置字体颜色(三种方式)

admin2025-09-08 18:50:54世界杯比赛视频

目录

参考链接

1.直接使用定义好的颜色

例子:

效果如下:

2.组合red、green和blue的值合成我们想要的颜色

例子:

效果如下:

3.定义一种颜色,直接调用

参考链接

Latex学习(1)——latex中的字体颜色_latex textcolor-CSDN博客

Latex中设置字体颜色_latex ppt里的文字颜色-CSDN博客

1.直接使用定义好的颜色

\usepackage{color} %引入包

\textcolor{red/blue/green/black/white/cyan/magenta/yellow}{text}

其中textcolor{...}中包含的是系统定义好的颜色,{text}是你的文本内容。

例子:

\textcolor{white}{白色}\

\textcolor{linen}{亚麻色}\​

\textcolor{black}{黑色}\

\textcolor{grey}{灰色}\

\textcolor{lightgrey}{浅灰色}\

\textcolor{darkgrey}{深灰色}\​

\textcolor{red}{红色}\

\textcolor{crimson}{深红色}\

\textcolor{darkred}{暗红色}\

\textcolor{brown}{褐色}\

\textcolor{maroon}{褐红色}\

\textcolor{salmon}{鲑红色}\

\textcolor{pink}{粉色}\

\textcolor{coral}{珊瑚色}\

\textcolor{orangered}{橙红色}\

\textcolor{orange}{橙色}\

​\textcolor{blue}{蓝色}\

\textcolor{skyblue}{天蓝色}\

\textcolor{aquamarine}{海蓝色}\

\textcolor{navy}{深蓝色}\​

\textcolor{green}{绿色}\

\textcolor{darkgreen}{深绿色}\

\textcolor{seagreen}{海绿色}\

\textcolor{springgreen}{春绿色}\

\textcolor{forestgreen}{森林绿色}\

\textcolor{greenyellow}{绿黄色}\

\textcolor{yellowgreen}{黄绿色}\

​\textcolor{yellow}{黄色}\

\textcolor{khaki}{卡其色}\

\textcolor{gold}{金色}\

\textcolor{beige}{米黄色}\

​\textcolor{olive}{橄榄色}\

\textcolor{purple}{紫色}\

\textcolor{indigo}{靛青色}\

\textcolor{plum}{紫红色}\

\textcolor{violet}{紫罗兰色}\

\textcolor{blueviolet}{蓝紫色}\

\textcolor{magenta}{洋红色}\

​\textcolor{cyan}{青色}\

\textcolor{turquoise}{青绿色}\

\textcolor{teal}{蓝绿色}\

\textcolor{tan}{棕褐色}\

效果如下:

2.组合red、green和blue的值合成我们想要的颜色

\usepackage{color}

\textcolor[rgb]{r,g,b}{text}

其中{r,g,b}代表red、green和blue三种颜色的组合,取值范围为[0-1]

\textcolor[RGB]{R,G,B}{text}

其中{R,G,B}代表red、green和blue三种颜色的组合,取值范围为[0-255]

例子:

\textcolor[rgb]{0.25, 0.5, 0.75}{自定义颜色1}\

\textcolor[rgb]{0.75, 0.5, 0.25}{自定义颜色2}\

效果如下:

3.定义一种颜色,直接调用

\usepackage{color}

\definecolor{ColorName}{rgb}{r,g,b} 这时r/g/b的定义域就在[0-1]。

\definecolor{ColorName}{RGB}{R,G,B} 这时R/G/B的定义域就在[0-255]。

这里为颜色定义了名称ColorName,下面可以直接调用这个颜色方案

\textcolor{ColorName}{text}

友情链接