On 12/28/2009 11:02 AM, Steve Litt wrote:
On Monday 28 December 2009 06:18:25 Pieter Claassen wrote:
I am trying to build a custom style/minipage environment for
comments/warnings/tips. However, many other collaborators in the
documentation project are not Lyx/Latex boffins so I cannot really ask them
to install custom extensions to Lyx/Latex.
Currently I use a Box with a minipage environment, but this has to be
customised based on whether it is a tip/warning or note that I am
producing.
What is the easiest way to achieve this?
Thanks,
Pieter
Hi Pieter,
I've done it numerous ways. The best way I did it was to create a basic LaTeX
command called "callouttitleL" converted to LyX command CalloutTitle and LaTeX
environment callouttextL converted to LyX environment CalloutText. Using
these, you can have a text with an arbitrary title. Three such arbitrary
titles are "Note", "Tip" and "Warning". I created custom LaTeX and LyX
environments for those special cases.
Here's the code:
You can put the preamble code into the layout, and then you only have to
deal with one file: the module.
rh
=================================================================
Preamble
% #################### CALLOUTS, WARNINGS, TIPS, ETC #####################
% ### Callout title latex
\newcommand{\callouttitleL}[1]{\def\callouttitleT{#1}}
\newenvironment{callouttextL}
{%
~\\[-0.25in]%
\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
}%
\newenvironment{warningL}{\callouttitleL{Warning}\begin{callouttextL}}
{\end{callouttextL}}
\newenvironment{tipL}{\callouttitleL{Tip}\begin{callouttextL}}
{\end{callouttextL}}
\newenvironment{noteL}{\callouttitleL{Note}\begin{callouttextL}}
{\end{callouttextL}}
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
Style Warning
LatexType Environment
LatexName warningL
LeftMargin MMMMMM
RightMargin MMMMMM
ParIndent MMM
TopSep 1.4
ItemSep 0.7
ParSep 0.7
BottomSep 0.7
Align Block
AlignPossible Block
LabelType Centered_Top_Environment
LabelString "Warning"
Font
Series Medium
Size Normal
Shape Italic
EndFont
End
Style Tip
LatexType Environment
LatexName tipL
LeftMargin MMMMMM
RightMargin MMMMMM
ParIndent MMM
TopSep 1.4
ItemSep 0.7
ParSep 0.7
BottomSep 0.7
Align Block
AlignPossible Block
LabelType Centered_Top_Environment
LabelString "Tip"
Font
Series Medium
Size Normal
Shape Italic
EndFont
End
Style Note
LatexType Environment
LatexName noteL
LeftMargin MMMMMM
RightMargin MMMMMM
ParIndent MMM
TopSep 1.4
ItemSep 0.7
ParSep 0.7
BottomSep 0.7
Align Block
AlignPossible Block
LabelType Centered_Top_Environment
LabelString "Note"
Font
Series Medium
Size Normal
Shape Italic
EndFont
End
=================================================================
SteveT
Steve Litt
Recession Relief Package
http://www.recession-relief.US
Twitter: http://www.twitter.com/stevelitt