我的最小(不)工作示例如下。只有当我注释掉\begin{gather}
和\end{gather}
行时它才有效。
\documentclass[a4paper,10pt]{book}
\usepackage{exsheets}
\usepackage{mdframed}
\usepackage{siunitx}
\usepackage[brazilian]{babel}
\usepackage{amsmath}
\SetupExSheets{
headings = block-subtitle ,
subtitle-format = \sc ,
counter-within = {chapter} , % Contar dentro dos capítulos.
counter-format = ch.qu[1] , % Formato 1.1, 1.2, 1.3, etc.
label-format = ch.qu[1] , % Formato 1.1, 1.2, 1.3, etc.
headings-format = \bfseries ,
question/pre-hook = \vspace{1ex} ,
question/post-hook = \vspace{1ex} ,
question/pre-body-hook = {\vspace{1ex} \mdframed[innermargin=+1cm,outermargin=+1cm]},
question/post-body-hook=\endmdframed ,
solution/pre-hook = \vspace{1ex} \mdframed ,
solution/post-hook = \vspace{1ex} \endmdframed ,
solution/pre-body-hook = \newline \vspace{1ex} ,
solution/print = false ,
solution/headings = inline
}
\begin{document}
\begin{question}[subtitle = Erro da área de um retângulo]
Calcule a área de um retângulo de lados \SI{3.4(2)}{\meter} e \SI{6.2(3)}{\meter}, com o erro correspondente.
\vspace{5\baselineskip}
\end{question}
\begin{solution}
\begin{gather}
\SI{3.4(2)}{\meter} $\times$ \SI{6.2(3)}{\meter} \\
$ = \left[ \right.$
( \SI{3.4}{}$\times$\SI{6.2}{} )
$\pm$ ( \SI{3.4}{}$\times$\SI{0.3}{} )
$\pm$ ( \SI{0.2}{}$\times$\SI{3.4}{} )
$\pm$ ( \SI{0.2}{}$\times$\SI{0.3}{} )
$\left. \right]$ \si{\square\meter} \\
$ = \left[ \right.$
( \SI{21.08}{} )
$\pm$ ( \SI{1.74}{} )
$\left. \right]$ \si{\square\meter} \\
$ = $ \SI{21.08(174)}{\square\meter} \\
$ = $ \SI{2.108(174)e1}{\square\meter} \\
\end{gather}
\end{solution}
\section*{Soluções dos exercícios}
\printsolutions[chapter]
\end{document}
答案1
一旦让gather
环境在环境外部无错误运行,solution
它也可以在环境内部正常运行。
- 删除
$
里面的所有gather
内容 – 环境的内容gather
已经处于数学模式。 - 也许会
\SI{...}{}
变成\num{...}
\\
删除最后一行之后的最后一个。
\documentclass[a4paper,10pt]{book}
\usepackage[utf8]{inputenc}
\usepackage{exsheets}
\usepackage{mdframed}
\usepackage{siunitx}
\usepackage[brazilian]{babel}
\usepackage{amsmath}
\SetupExSheets{
headings = block-subtitle ,
subtitle-format = \scshape , % USE \scshape INSTEAD OF \sc
counter-within = {chapter} , % Contar dentro dos capítulos.
counter-format = ch.qu[1] , % Formato 1.1, 1.2, 1.3, etc.
% label-format = ch.qu[1] , % <= THIS IS NOT WHAT THIS OPTION IS MEANT FOR!
}
\begin{document}
\begin{question}[subtitle = Erro da área de um retângulo]
Calcule a área de um retângulo de lados \SI{3.4(2)}{\meter} e
\SI{6.2(3)}{\meter}, com o erro correspondente.
\vspace{5\baselineskip}
\end{question}
\begin{solution}
\begin{gather}
\SI{3.4(2)}{\meter} \times \SI{6.2(3)}{\meter} \\
= \bigl[
( \num{3.4} \times \num{6.2} )
\pm ( \num{3.4} \times \num{0.3} )
\pm ( \num{0.2} \times \num{3.4} )
\pm ( \num{0.2} \times \num{0.3} )
\bigr] \si{\square\meter} \\
= \bigl[
( \num{21.08} )
\pm ( \num{1.74} )
\bigr] \si{\square\meter} \\
= \SI{21.08(174)}{\square\meter} \\
= \SI{2.108(174)e1}{\square\meter}
\end{gather}
\end{solution}
\section*{Soluções dos exercícios}
\printsolutions[chapter]
\end{document}