自动变色文字

自动变色文字

我希望一些文本以red彩色显示。例如,paragraph文本需要以red彩色显示。我的 MWE 是:

\documentclass{article}
\usepackage{times}
\usepackage{amsmath,amssymb}
\begin{document}
This is the sample paragraph text here. This is the sample paragraph text here. This is the sample paragraph text here. This is the sample paragraph text here.This is the sample paragraph text here. This is the sample paragraph text here.This is the sample paragraph text here. This is the sample paragraph text here.This is the sample paragraph text here. This is the sample paragraph text here.This is the sample paragraph text here. This is the sample paragraph text here.This is the sample paragraph text here. This is the sample paragraph text here.This is the sample paragraph text here. This is the sample paragraph text here.This is the sample paragraph text here. This is the sample paragraph text here.

This is the sample paragraph text here. This is the sample paragraph text here. This is the sample paragraph text here. This is the sample paragraph text here.This is the sample paragraph text here. This is the sample paragraph text here.This is the sample paragraph text here. This is the sample paragraph text here.This is the sample paragraph text here. This is the sample paragraph text here.This is the sample paragraph text here. This is the sample paragraph text here.This is the sample paragraph text here. This is the sample paragraph text here.This is the sample paragraph text here. This is the sample paragraph text here.This is the sample paragraph text here. This is the sample paragraph text here.

This is the sample paragraph text here. This is the sample paragraph text here. This is the sample paragraph text here. This is the sample paragraph text here.This is the sample paragraph text here. This is the sample paragraph text here.This is the sample paragraph text here. This is the sample paragraph text here.This is the sample paragraph text here. This is the sample paragraph text here.This is the sample paragraph text here. This is the sample paragraph text here.This is the sample paragraph text here. This is the sample paragraph text here.This is the sample paragraph text here. This is the sample paragraph text here.This is the sample paragraph text here. This is the sample paragraph text here.

This is the sample paragraph text here. This is the sample paragraph text here. This is the sample paragraph text here. This is the sample paragraph text here.This is the sample paragraph text here. This is the sample paragraph text here.This is the sample paragraph text here. This is the sample paragraph text here.This is the sample paragraph text here. This is the sample paragraph text here.This is the sample paragraph text here. This is the sample paragraph text here.This is the sample paragraph text here. This is the sample paragraph text here.This is the sample paragraph text here. This is the sample paragraph text here.This is the sample paragraph text here. This is the sample paragraph text here.

This is the sample paragraph text here. This is the sample paragraph text here. This is the sample paragraph text here. This is the sample paragraph text here.This is the sample paragraph text here. This is the sample paragraph text here.This is the sample paragraph text here. This is the sample paragraph text here.This is the sample paragraph text here. This is the sample paragraph text here.This is the sample paragraph text here. This is the sample paragraph text here.This is the sample paragraph text here. This is the sample paragraph text here.This is the sample paragraph text here. This is the sample paragraph text here.This is the sample paragraph text here. This is the sample paragraph text here.
\end{document}

如何实现这个目标?

答案1

如果您不想使用颜色package并且想要启动自动着色,那么您可以使用pdfcsplainOPmac 而不是 LaTeX 的格式:

\input opmac \localcolor

\def\registerword#1{\sdef{w:#1}{{\Red#1}}%
   \expandafter\mubyte\csname w:#1\endcsname \space#1\endmubyte}

\mubytein=0
\registerword { is }
\registerword {paragraph}
\registerword {text}
\mubytein=1

This is the sample paragraph text here. 
Other text is tested. How are you?
This is the sample paragraph text here. 
Other text is tested. How are you?

\bye

色彩词

答案2

当我想让部分文本显示为红色时,我通常会在序言中放入这个宏:

 \newcommand{\red}[1]{\textcolor{red}{#1}}

在文中我使用:

Some normal (black) text \red{the part of the text that I want to be red} some other text.

答案3

\documentclass{article}
\usepackage{color}
\begin{document}

    This is the sample \verb!!\textcolor{red}{paragraph}\verb!! text here.

\end{document}

在此处输入图片描述

相关内容