Espaciado horizontal y vertical en un entorno 'sombreado*' usando el paquete 'framed.sty'

Espaciado horizontal y vertical en un entorno 'sombreado*' usando el paquete 'framed.sty'

Al usar el framed.stypaquete para dibujar cuadros sombreados alrededor del texto con el shaded*entorno, solo hay un parámetro para establecer el espaciado alrededor del texto. \FrameSepajusta simultáneamente el espaciado horizontal y vertical del texto desde los límites del cuadro sombreado. Al ser incómodo, colocar \FrameSep=1emproporciona los márgenes izquierdo/derecho que quiero, mientras que \FrameSep=0.75emproporciona el espacio superior/inferior que quiero.

¿Hay alguna forma de excavar en el interior framed.stypara establecer el espaciado izquierda/derecha y superior/inferior de forma independiente?

Si (como sospecho) lo que hay que hacer es pasar a una opción mucho más flexible mdframed.sty, ¿cómo se puede producir un entorno simple shaded*con eso? -- Confieso que la documentación me resulta difícil de descifrar.

Respuesta1

Aquí hay un ejemplo simple:

\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}

ingrese la descripción de la imagen aquí

No creo que la documentación sea complicada; consulte, por ejemplo, la página 6, donde puede encontrar la mayoría de las configuraciones para longitudes ajustables de mdframed:

ingrese la descripción de la imagen aquí

Respuesta2

Aquí hay una solución con framed: Redefiní el shaded*entorno para incorporar valores para \leftskipy rightskip. Tenga en cuenta que requiere una línea en blanco antes del siguiente texto.

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{ebgaramond}
\usepackage[showframe]{geometry}
\usepackage[svgnames]{xcolor}
\usepackage{lettrine}
\usepackage{framed}
\renewenvironment{shaded*}{%
\def\FrameCommand{\fboxsep=\FrameSep\colorbox{shadecolor}}%
\MakeFramed{\advance\hsize-\width\FrameRestore}%
\leftskip 1.5em \rightskip 1.5em}%
{\endMakeFramed}%
\colorlet{shadecolor}{Gainsboro!60!MistyRose}

\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.’
\begin{shaded*}
  \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.
\end{shaded*}

‘Some people,’ said Humpty Dumpty, looking away from her as usual, ‘have
no more sense than a baby!’


\end{document} 

ingrese la descripción de la imagen aquí

información relacionada