On Sun, May 21, 2017 at 11:03:36AM -0400, Paul A. Rubin wrote:
> On 05/19/2017 06:31 PM, Paul Johnson wrote:
> > Can you help me make output of \code{} in inline logical markup look
> > similar to the listings output for code sections? I'd like to do this
> > in a Beamer slideshow.
> >
> > The \code{} result is typewriter font, but not colorized like the
> > listings output I'm using.
> >
> > I found out here:
> >
> > https://tex.stackexchange.com/questions/28179/colored-background-in-inline-listings
> >
> > that I can insert
> >
> > \usepackage{realbox}
> > \definecolor{light-gray}{gray}{0.95}
> >
> > in the preamble and get more-or less what I want from \Colorbox, with
> > ERT like this
> >
> > \Colorbox{light-gray}{\lstinline{A=@#$%^&*()1}}
> >
> > I don't want to manually type that (or something like it) every place
> > where I've used the LyX right-click code logical markup. Would you
> > tell me if I can redefine \code{} in preamble?
> >
> The easiest solution is probably to hack the module file. Copy the original
> file (/usr/share/lyx/layouts/logicalmkup.module on my system; YMMV) to your
> personal layout directory (~/.lyx/layouts on my system; again, YMMV). If you
> want the gray background whenever you use the code markup, you can keep the
> same name (so that selecting the logical markup module always grabs your
> hacked version); otherwise, you'll need to give it a new name and also
> change the first line to give it a distinctive name (e.g.,
> #\DeclareLyXModule{PJ's Logical Markup}).
>
> I've attached a version I hacked. All the changes are near the end of the
> file. I used a darker version of "light gray" than you did, because I was
> having trouble seeing the lighter version in my PDF viewer. Feel free to
> adjust that to taste.
>
> Paul
>
> #\DeclareLyXModule{Logical Markup}
> #DescriptionBegin
> #Defines some character styles for logical markup: noun, emph, strong, and
> code.
> #DescriptionEnd
> #Category: charstyles
>
> # Author : Martin vermeer <[email protected]>
>
> Format 60
>
> InsetLayout Flex:Noun
> LyxType charstyle
> LabelString noun
> LatexType command
> LatexName noun
> Font
> Shape Smallcaps
> EndFont
> Requires noun
> InToc true
> HTMLTag span
> HTMLAttr class='noun'
> HTMLStyle
> span.noun {
> font-family: sans-serif;
> }
> EndHTMLStyle
> ResetsFont true
> End
>
>
> InsetLayout Flex:Emph
> LyxType charstyle
> LabelString emph
> LatexType command
> LatexName emph
> Font
> Shape Italic
> EndFont
> InToc true
> HTMLTag em
> ResetsFont true
> End
>
>
> InsetLayout Flex:Strong
> LyxType charstyle
> LabelString strong
> LatexType command
> LatexName strong
> Font
> Series Bold
> EndFont
> Preamble
> \providecommand*{\strong}[1]{\textbf{#1}}
> EndPreamble
> InToc true
> HTMLTag strong
> ResetsFont true
> End
>
>
> InsetLayout Flex:Code
> LyxType charstyle
> LabelString code
> LatexType command
> LatexName code
> Font
> Family Typewriter
> EndFont
> Preamble
> \RequirePackage{xcolor, realboxes}
> \definecolor{light-gray}{gray}{0.85}
> \providecommand*{\code}[1]{\Colorbox{light-gray}{\texttt{#1}}}
> EndPreamble
> InToc true
> HTMLTag code
> ResetsFont true
> Spellcheck false
> End
Hi Paul (Johnson),
I just wanted to make sure you saw the post by Paul (Rubin). Did it
help you do what you needed to solve?
Scott