我目前遇到了 Legrand Orange Book 模板的 \exercise 环境问题。在练习环境中插入表格后,我收到一条错误消息,提示“!LaTeX 错误:浮点数丢失”。
我该如何格式化环境以允许将表格和图形插入其中而不会出现错误?以下是导致错误的原因。
\documentclass[11pt,fleqn]{book} % Default font size and left-justified equations
\begin{document}
\section*{Exercises}
\begin{exercise}
The following measurements have been recorded by a student in their notebook. However, this particular student has not kept a consistent notation scheme and has made a few errors. Comment where you find an error and correct errors where possible:
\begin{table}[h!]
\centering
\begin{tabular}{lll}
10 $\rightarrow$ 23 & 33 $\rightarrow$ 000 & 015$\rightarrow$ 14 \\
240/77 W & 21/60 W & 000/11 E
\end{tabular}
\end{table}
\end{exercise}
\end{document}
以下是演习环境的规格:
\newenvironment{exercise}{\begin{eBox}\begin{exerciseT}}
{\hfill{\color{ocre}\tiny\ensuremath{\blacksquare}}\end{exerciseT}\end{eBox}}
此环境的框绘制如下:
% Exercise box
\newmdenv[skipabove=7pt,
skipbelow=7pt,
rightline=false,
leftline=true,
topline=false,
bottomline=false,
backgroundcolor=ocre!10,
linecolor=ocre,
innerleftmargin=5pt,
innerrightmargin=5pt,
innertopmargin=5pt,
innerbottommargin=5pt,
leftmargin=0cm,
rightmargin=0cm,
linewidth=4pt]{eBox}
答案1
你不想让它浮动,所以不要把它放在图中,只需替换\begin{table}[h!] \centering ..\end{table}
为\begin{center}..\end{center}