我目前正在寻找模板中的错误,阅读日志并研究后,我无法解决这两个错误:
第一的:
! Argument of \strip@prefix has an extra }.
<inserted text>
\par
l.60 postheadspace=\newline]{mystyle}
第二:
! Paragraph ended before \strip@prefix was complete.
<to be read again>
\par
l.60 postheadspace=\newline]{mystyle}
最小示例:
\documentclass[a4paper, 12pt, oneside]{book}
\usepackage{amsthm}
\usepackage[unq]{unique}
\usepackage{thmtools}
\declaretheoremstyle[
numbered=unless unique,
%within=chapter,
headpunct={},
shaded,
spacebelow=\parsep,
spaceabove=\parsep,
notefont=\normalfont\itshape,
bodyfont=\itshape,
postheadspace=\newline]{mystyle}
\declaretheorem[
style=mystyle,
name=Theorem,
refname={theorem,theorems},
Refname={Theorem,Theorems}
]{FF}
\usepackage{hyperref}
\usepackage{cleveref}
\crefname{FF}{Theorem}{Theorems}
\Crefname{FF}{Theorem}{Theorems}
\begin{document}
\begin{FF}\label{ff1}
Test
\end{FF}
Link to \Cref{ff1}.
\begin{FF}\label{ff2}
Test2
\end{FF}
\end{document}
答案1
该shaded
键需要一个键值列表(参见thmtools
文档的第 15 页);此外,该unless unique
选项似乎需要该unique
包:
\documentclass[a4paper, 12pt, oneside]{book}
\usepackage{amsthm}
\usepackage[unq]{unique}
\usepackage{thmtools}
\usepackage[unq]{unique}
\usepackage{xcolor}
\declaretheoremstyle[
numbered=unless unique,
within=chapter,
headpunct={},
shaded={bgcolor=blue!20},
spacebelow=\parsep,
spaceabove=\parsep,
notefont=\normalfont\itshape,
bodyfont=\itshape,
postheadspace=\newline
]{mystyle}
\declaretheorem[
style=mystyle,
name=Theorem,
refname={theorem,theorems},
Refname={Theorem,Theorems}
]{FF}
\usepackage{hyperref}
\usepackage{cleveref}
\crefname{FF}{Theorem}{Theorems}
\Crefname{FF}{Theorem}{Theorems}
\begin{document}
\begin{FF}\label{ff1}
Test
\end{FF}
Link to \Cref{ff1}.
\begin{FF}\label{ff2}
Test2
\end{FF}
\end{document}