![我如何更改包含 ExSheets 问题的 mdframed 框的边距?](https://linux22.com/image/324508/%E6%88%91%E5%A6%82%E4%BD%95%E6%9B%B4%E6%94%B9%E5%8C%85%E5%90%AB%20ExSheets%20%E9%97%AE%E9%A2%98%E7%9A%84%20mdframed%20%E6%A1%86%E7%9A%84%E8%BE%B9%E8%B7%9D%EF%BC%9F.png)
我成功附上了我的成绩表问题框架使用以下代码行:
\SetupExSheets{question/pre-body-hook=\mdframed,question/post-body-hook=\endmdframed}
现在,我想添加以下选项:
innermargin =+1cm
outermargin =+1cm
但我不知道怎么做。我知道
\begin{mdframed}[innermargin=+1cm,outermargin=+1cm]
\lipsum[2]
\end{mdframed}
但\mdframed
用\begin{mdframed}
和\endmdframed
用\end{mdframed}
替换
\SetupExSheets{%
question/pre-body-hook={\begin{mdframed}[innermargin=+1cm,outermargin=+1cm]},
question/post-body-hook={\end{mdframed}}
}
不起作用。
版本:已添加代码。我想要的是改变 lipsum[2] 和 box 的宽度,而不改变 lipsum[1] 和 lipsum[3] 部分的宽度:
\documentclass[a4paper,10pt]{book}
\usepackage{mdframed}
\usepackage{exsheets}
\usepackage{lipsum}
\newlength{\exercisespace}
\newenvironment{exercicioComEspaco}[1][0pt]
{\setlength{\exercisespace}{#1}\question}
{\endquestion
\ifdim\exercisespace>0pt
\mdframed\vspace{\exercisespace}\endmdframed
\fi}
\begin{document}
\lipsum[1]
\begin{exercicioComEspaco}[3cm]
\lipsum[2]
\end{exercicioComEspaco}
\lipsum[3]
\end{document}
答案1
可能是您的尝试遗漏了括号,因此逗号使解析器感到困惑。
\documentclass[a4paper,10pt]{book}
\usepackage{mdframed}
\usepackage{exsheets}
\usepackage{lipsum}
\SetupExSheets{
question/pre-body-hook={\mdframed[innermargin=+1cm,outermargin=+1cm]},
question/post-body-hook=\endmdframed
}
\newlength{\exercisespace}
\newenvironment{exercicioComEspaco}[1][0pt]
{\setlength{\exercisespace}{#1}\question}
{\endquestion
\ifdim\exercisespace>0pt
\mdframed\vspace{\exercisespace}\endmdframed
\fi}
\begin{document}
\lipsum[1]
\begin{exercicioComEspaco}[3cm]
\lipsum[2]
\end{exercicioComEspaco}
\lipsum[3]
\end{document}