强调:只有当两个单词相互连接时才改变颜色?

强调:只有当两个单词相互连接时才改变颜色?

我想知道是否可以为多个单词的字符串赋予不同的颜色。我想为“proc catalog”使用深蓝色,为“catalog”使用默认蓝色。请在下面找到带有预期输出的代码。

在此处输入图片描述

proc catalog catalog=work.formats;
    contents;
    run;
quit;


\lstnewenvironment{sasproccatalog}{%
\lstset{%
    basicstyle      =\small\ttfamily,%
    language        =SAS,%
    keywords        ={},%
    keywordstyle    =\color{sasblue}\ttfamily\small,%
    commentstyle    =\color{sascomment},%  
    morecomment     =[f]{*},%
    morecomment     =[s]{/*}{*/},%
    morecomment     =[n]{/*}{*/},%
    escapechar      =|,%
    escapeinside    ={(*@}{@*)},
    stringstyle     =\color{sasviolet},%
    showstringspaces=false,%
    keepspaces      =true,%
    sensitive       =false,%
    emph            =[1]{run,{proc catalog},quit}, %
    emphstyle       =[1]\color{sasdarkblue}\textbf, %
    emph            =[2]{catalog,contents},%
    emphstyle       =[2]\color{sasblue}, %
    upquote         =true,%
    literate        ={à}{{\`a}}1 {é}{{\'e}}1  {è}{{\`e}}1,%
    otherkeywords={},%
    alsoother={.}%
}
}{}

相关内容