tcolorbox 围绕 exsheets 标题

tcolorbox 围绕 exsheets 标题

我想用一个方框来装饰我的 ExSheets 问题标题,但我做不到。我做到了这一点:

\documentclass[a4paper,11pt,oneside]{memoir}

\usepackage{tcolorbox}

\usepackage{exsheets}
\DeclareInstance{exsheets-heading}{boxed}{default}{
     pre-code=\begin{tcolorbox},
     post-code=\end{tcolorbox},
     join = {title[r,B]number[l,B](.333em,0pt) },
     attach =
        {
          main[l,vc]title[l,vc](0pt,0pt) ;
          main[r,vc]points[l,vc](\marginparsep,0pt)
        }
 }
 \SetupExSheets[question]{headings={boxed}}
 \SetupExSheets[solution]{headings={runin-nr}}

 \begin{document}


 \begin{question}
 First question.
 \end{question}
 \end{document}

我对框的位置不太满意。我该如何改进,让框围绕标题居中?

答案1

使用钩子更简单:

\documentclass[a4paper,11pt,oneside]{memoir}

\usepackage{tcolorbox}
\usepackage{exsheets}    

\SetupExSheets{
%  question/headings = {boxed} ,
  question/pre-hook = \begin{tcolorbox} ,
  question/pre-body-hook = \end{tcolorbox}\noindent ,
  solution/headings = {runin-nr}
}

\usepackage{lipsum}

\begin{document}

\begin{question}
  \lipsum[1]
\end{question}

\lipsum[2]

\end{document}

在此处输入图片描述

相关内容