我成功附上了我的成绩表问题框架使用以下代码行:
\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}