开发者

Latex: reset font style

Is there a way I can reset the style of a certain character sequence? I'm using the listings package to display source code and the prebreak property to display a escape character \ to indicate that the current lines was broken. The problem is that sometimes the backslash is colored because of the syntax highlighting used.

So I need basically something like a resetstyle statement, as in the following imaginary example:

\textbf{Some bold text \resetstyle{not bold, no color} foo bar}

EDIT: Here are the settings that I'm using via lstset:

\lstset{
        extendedchars           = \true,
        inputencoding           = utf8,
        basicstyle              = \scriptsize\ttfamily,
        breaklines              = true,
        breakindent             = 10pt,
        breakatwhitespace       = true,
        breakautoindent         = true,                         
        prebreak                = \\,
        frame                   = leftline,
        showtabs                = true,                                                                                                    
        numbers                 = left,                                                                                                                                                
        stepnumber              = 2,
        numberstyle             = \footnotesize,
        numbersep               = 10pt,
        keywordstyle            = \color[RGB]{0,0,255},
        commentstyle            = \itshape\color[RGB]{120,120,120},
        stringstyle             = \color[rgb]{0.627,0.126,0.941},
        emphstyle               = {[0]\color[RGB]{236,0,168}},
        emphstyle    开发者_JAVA技巧           = {[1]\color[RGB]{34,139,34}\underbar},
        emphstyle               = {[2]\textbf}
}


You could try putting the text inside an mbox (untested, but works for math mode):

\textbf{Some bold text \mbox{not bold, no color} foo bar}

You will lose the ability for line breaks inside the text, but in this case that seems to be no problem.


\def\resetstyle#1{{\normalsize\rm\color[rgb]{0,0,0}\noindent#1}}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜