Joerg Hau wrote:
Hi,
How does one change the font that is used (a) for the "LyX-Code"
environment, (b) for "typewriter" character markup?
I would like to modify the font size, and/or eventually change the font for
these two completely. Maybe I have searched in the wrong places ;-), but I
have not found an answer to this question yet ... ?
Thanks for any hint,
and have a nice day!
This can be done with a small custom .layout, such as
the one at the end of this message. It is a custom document
type (mybook) that simply inherits everything from
scrbook (Koma-script book) and adds a smallcode
paragraph type that provides scriptsized code with no
extra left margin.
Put it in .lyx/layouts, use the "reconfigure" menu option, and
you may then use the "mybook" document class which supports
"smallcode" paragraphs.
If you want "mybook" based on something else than scrbook,
change the "\DeclareLaTeXClass" and "Input scrbook.layout"
in the beginning.
For a different fontsize, replace "scriptsize" with another size.
If you like the extra left/right margins LyX-Code provides,
change to LeftMargin MMM and RightMargin MMM.
Note that this file is for lyx-1.4, but doing the same
for lyx-1.3 is no harder.
The file mybook.layout:
#% Do not delete the line below; configure depends on this
# \DeclareLaTeXClass[scrbook]{book (mybook)}
Format 2
Input scrbook.layout
Columns 1
Sides 1
PageStyle fancy
Classoptions
PageStyle "empty|fancy"
FontSize "12"
End
DefaultStyle "Standard"
Style Code-small
CopyStyle LyX-Code
LatexType Environment
LatexName codesmall
LeftMargin ""
RightMargin ""
Font
Size Scriptsize
Family Typewriter
EndFont
Preamble
\newenvironment{codesmall}
{\begin{scriptsize}\begin{list}{}{
\setlength{\leftmargin}{0pt}
\setlength{\rightmargin}{0pt}
\setlength{\listparindent}{0pt}% needed for AMS classes
\raggedright
\setlength{\itemsep}{0pt}
\setlength{\parsep}{0pt}
\normalfont\ttfamily}%
\item[]}
{\end{list}\end{scriptsize}}
EndPreamble
End
Preamble
EndPreamble