On Friday 18 May 2007 06:53, Daniel Lohmann wrote:
> Steve Litt wrote:
> > Oh never mind, I already solved this problem and forgot I'd solved it. I
> > made the title LyX environment with a LatexType of command, and had that
> > command set a variable, and then the box text environment used that
> > variable.
>
> Steve,
>
> Would you mind sharing the relevant parts of your layout file / preamble
> for this? I am just trying to get something like this working for my
> thesis.
>
> Thanks!
>
> Daniel
Hi Daniel,
I've put it in the body of this email below my sig. Let me explain:
I've named the two LyX environments CalloutTitle and CalloutText. CalloutTitle
has latextype "command", and calls the LaTeX command callouttitleL, which
simply sets command callouttitleT to the text to which CalloutTitle was
applied. The LyX parameters of LyX environment CalloutTitle are set to an
appropriately big font etc, so it shows up realistically in the LyX GUI.
LyX environment CalloutText is applied to the text of the centered box. Its
latextype is Environment, and it calls LaTeX environment callouttextL. Its
LyX parameters are set to make it narrower than the body text.
That brings us to LaTeX command callouttextL, which does most of the work.
%%%% ENVIRONMENT INITIALIZATION %%%%
CalouttextL prints its contents within a shaded box (\begin{shaded}). As
mentioned, this shaded box is contributed by package framed. I basically tore
this environment out of the layout of my 2001 book "Troubleshooting
Techniques of the Successful Troubleshooter", so bear in mind that it was
written by a (then) LyX newbie.
Using package framed, callouttextL moves the box up .45 inch to narrow what
would otherwise be its oceanic separation from the text above, then sets 4pt
margins within the highlighted box, defines the box's background color, then
starts the box.
Within the box it center-Large prints the contents of callouttitleT, which is
the title stored by LyX environemnt CalloutTitle. It then raggedrights and
creates a rather large 16 point paragraph indentation. That concludes the
environment initialization.
%%%% TEXT PRINTING %%%%
Then the text to which CalloutText has been applied prints within the box and
styles declared in the initialization.
%%%% ENVIRONMENT FINALIZATION %%%%
The environment is finalized by ending the shaded box, and then starting a new
paragraph so the first paragraph of the next text doesn't start within the
shaded box.
HTH
SteveT
Steve Litt
Author: Universal Troubleshooting Process books and courseware
http://www.troubleshooters.com/
========================================
#% Do not delete the line below; configure depends on this
# \DeclareLaTeXClass[book]{mybook}
Input stdclass.inc
Input numreport.inc
Preamble
\usepackage{framed}% Frames for notes, tips, etc
% ### Callout title and text latex
\newcommand{\callouttitleL}[1]{\def\callouttitleT{#1}}
\newenvironment{callouttextL}
{%
~\\[-0.45in]%
\setlength\fboxsep{4pt}%
\definecolor{shadecolor}{rgb}{1.00,0.90,0.90}%
\begin{shaded}%
\addtolength{\hsize}{-0.20\columnwidth}%
{\centering\Large\callouttitleT\\[0.2cm]}%
\raggedright%
\setlength\parindent{16pt}%
}%
{%
\end{shaded}%
\par
}%
EndPreamble
### CALLOUT LYX STYLES
Style CalloutTitle
Font
Series Bold
Size Larger
EndFont
LatexName callouttitleL
LatexType Command
Align Center
End
Style CalloutText
LatexType Environment
LatexName callouttextL
LeftMargin MMMMMM
RightMargin MMMMMM
ParIndent MMM
TopSep 1.4
ItemSep 0.7
ParSep 0.7
BottomSep 0.7
Align Block
AlignPossible Block
Font
Series Medium
Size Normal
Shape Italic
EndFont
End