# Horizontal and vertical spacing in 'shaded*' environment using 'framed.sty' package

Using the framed.sty package to draw shaded boxes round text with the shaded* environment, there is only one parameter to set the spacing round the text. \FrameSep simultaneously adjusts both horizontal and vertical spacing of the text from the boundaries of the shaded box. Being awkward, putting \FrameSep=1em gives the left/right margins I want, while \FrameSep=0.75em gives the top/bottom spacing I want.

Is there a way of digging inside framed.sty to set left/right and top/bottom spacing independently?

If (as I suspect) the thing to do is to move to the much more flexible mdframed.sty, how does one produce a simple shaded* environment with that? -- I confess I'm finding the documentation hard to crack.

Here is a simple example:

\documentclass{article}
\usepackage{xcolor}
\usepackage{mdframed}
\begin{document}

\noindent Normal text here ...
\begin{mdframed}[leftmargin=1cm,
skipabove=1cm,
linecolor=blue,
backgroundcolor=red!10,
linewidth=2pt,
innerleftmargin=1em,
innerrightmargin=1em,
innertopmargin=.75em,
innerbottommargin=.75em,
]
If (as I suspect) the thing to do is to move to the much more flexible  mdframed.sty, how does one produce a simple shaded* environment with that? -- I confess I'm finding the documentation hard to crack.
\end{mdframed}

\end{document}


I don't think the documentation is any hard, see for example Page 6, where you can find most of the settings for adjustable lengths of mdframed:

• Many thanks for the template to work from! I was probably having a senior moment ... ;) – Peter Smith Apr 30 '17 at 14:28

Here is a solution with framed: I redefined the shaded* environment to incorporate values for \leftskip and rightskip. Note it requires a blank line before the following text.

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{ebgaramond}
\usepackage[showframe]{geometry}
\usepackage[svgnames]{xcolor}
\usepackage{lettrine}
\usepackage{framed}
\leftskip 1.5em \rightskip 1.5em}%
{\endMakeFramed}%

\begin{document}

\lettrine{H}{owever}, the egg only got larger and larger, and more and more human:
when she had come within a few yards of it, she saw that it had eyes
and a nose and mouth; and when she had come close to it, she saw clearly
that it was HUMPTY DUMPTY himself. ‘It can’t be anybody else!’ she said
to herself. ‘I’m as certain of it, as if his name were written all over
his face.’
\lettrine{I}{t} might have been written a hundred times, easily, on that enormous
face. Humpty Dumpty was sitting with his legs crossed, like a Turk, on
the top of a high wall--such a narrow one that Alice quite wondered how
he could keep his balance--and, as his eyes were steadily fixed in the
opposite direction, and he didn’t take the least notice of her, she
thought he must be a stuffed figure after all.

‘And how exactly like an egg he is!’ she said aloud, standing with her
hands ready to catch him, for she was every moment expecting him to
fall.

‘It’s VERY provoking,’ Humpty Dumpty said after a long silence, looking
away from Alice as he spoke, ‘to be called an egg--VERY!’

‘I said you LOOKED like an egg, Sir,’ Alice gently explained. ‘And some
eggs are very pretty, you know’ she added, hoping to turn her remark
into a sort of a compliment.