
framed.sty
환경 과 함께 텍스트 주위에 음영처리된 상자를 그리는 패키지를 사용하면 shaded*
텍스트 주위의 간격을 설정하는 매개변수가 하나만 있습니다. \FrameSep
음영 처리된 상자의 경계에서 텍스트의 가로 및 세로 간격을 동시에 조정합니다. 어색하게도 퍼팅은 \FrameSep=1em
내가 원하는 왼쪽/오른쪽 여백을 제공하고, \FrameSep=0.75em
내가 원하는 위쪽/아래쪽 간격을 제공합니다.
framed.sty
내부를 파서 왼쪽/오른쪽과 위쪽/아래쪽 간격을 독립적으로 설정하는 방법이 있나요 ?
(내 생각으로는) 해야 할 일이 훨씬 더 유연한 으로 이동하는 것이라면 어떻게 이를 통해 mdframed.sty
간단한 환경을 생성할 수 있습니까 ? shaded*
-- 문서를 해독하기가 어렵다는 것을 고백합니다.
답변1
다음은 간단한 예입니다.
\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}
나는 문서가 어렵지 않다고 생각합니다. 예를 들어 6페이지를 참조하십시오. 여기에서 조정 가능한 길이에 대한 대부분의 설정을 찾을 수 있습니다 mdframed
.
답변2
다음은 다음과 같은 솔루션입니다 . 및 에 대한 값을 통합하도록 환경을 framed
재정의했습니다 . 다음 텍스트 앞에는 빈 줄이 필요합니다.shaded*
\leftskip
rightskip
\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}