I'm beginner in LyX and I have a problem. In 'LyX: box' the option "allow page breaks' is not available. What can I do?
1 Answers
LyX's Insert > Box options all set unbreakable boxes. You'll have to create a custom inset to manage something the provides breakable boxes. One package that provides this is mdframed. So, let's set up a custom inset that uses mdframed:
Set up the environment that you're going to use. For this, add the following to your Document > Settings... > LaTeX Preamble:
\usepackage[framemethod=tikz]{mdframed} \newmdenv[ hidealllines=true, backgroundcolor=blue!20, innerleftmargin=3pt, innerrightmargin=3pt, leftmargin=-3pt, rightmargin=-3pt ]{shadedbox}The above code loads the
mdframedpackage and also sets up an environment calledshadedboxwith the given parameters. You can read themdframeddocumentation to see exactly the meaning of them all, and redefine it to make it your own. I chose an example from How to highlight an entire paragraph?.Now set up Document > Settings... > Local Layout that uses the environment defined above:
Format 60 InsetLayout Flex:Shaded_Box LyXType custom LabelString "Shaded Box" LatexType Environment LatexName shadedbox Decoration Classic MultiPar true CustomPars true ResetsFont true LabelFont Color foreground Size Small EndFont EndThis adds "Shaded Box" to your Insert > Custom Inset menu item:
Use it like you mean it!
You'll have to understand how to change the settings of the environment to make it suit your needs. One could also add an optional argument to make small, local modifications if needed.

