Steve Litt wrote:
Hi all,
After Richard Heck talked about LatexType=Command in the LyX Title environment
thread, I started experimenting and got it to work. I have a LyX and LaTeX
breakout environment (breakout is the name of the environment) which prints
in a shaded box, with a label. However, the label isn't hard coded, but
instead is contained in a variable called breakoutstring.
I had previously been setting breakoutstring with ERT before the section of
breakout environment, but I don't like ERT. So, taking Richard Heck's advice,
I made a BreakoutTitle LyX environment whose LatexType is command, and whose
LatexName is setBreakoutstring. setBreakoutstring is simply a LaTeX (actually
TeX) command to set the variable breakoutstring:
\def\setBreakoutstring#1{\def\breakoutstring{#1}}
I tried first to do it with \newcommand, but couldn't get it to compile. If
anyone can show me how, please do.
Anyway, the following is the code for BreakoutTitle:
# Breakout title style definition
Style BreakoutTitle
Margin Static
LatexType Command
InTitle 1
LatexName setBreakoutstring
ParSkip 0.4
ItemSep 0
TopSep 1
BottomSep 0.0
ParSep 1
Align Center
AlignPossible Center
LabelType No_Label
# standard font definition
Font
Size Large
EndFont
Preamble
\def\setBreakoutstring#1{\def\breakoutstring{#1}}
EndPreamble
End
And in case anyone wants to see it, here's the code for Breakout:
# ### Labeled shadowed box for Breakouts ###
Style Breakout
LatexType Environment
LatexName breakout_l
AlignPossible Left
LeftMargin "MMMMM"
RightMargin "MMMMM"
ParSkip 0.7
ParSep 0.7
TopSep 0.7
BottomSep 0.7
Font
EndFont
Preamble
\newenvironment{breakout_l}{\begin{shadowbox}{\breakoutstring}}
{\end{shadowbox}}%
EndPreamble
End
In the preceding, shadowbox is just a home grown LaTeX environment to put the
text in shading, and bring its borders in.
Obviously, now that I've done this, doing subtitles with an environment
instead of ERT is pretty easy. Hope some of you can use this.
Richard -- thanks for the tip. I've been trying to do this since 2001.
Thanks
SteveT
Steve,
Thanks for sharing this. I'll beat Christian to the punch :-) and
suggest putting on the wiki as a tip.
/Paul