0

I'm currently having an issue with the \exercise environment of the Legrand Orange Book template. After inserting a table into the exercise environment, I get an error which says !LaTeX Error: Float(s) lost.

How do I format the environment to allow for tables and figures to be inserted into it without the error? Below is what causes the error.

\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}

Below are the specifications for the exercise environment:

\newenvironment{exercise}{\begin{eBox}\begin{exerciseT}}
{\hfill{\color{ocre}\tiny\ensuremath{\blacksquare}}\end{exerciseT}\end{eBox}}

And the box for this environment is drawn with:

% 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}
3
  • Welcome to TeX.SX! Could you expand your code to a minimal working example (MWE),starting with \documentclass and ending with \end{document}.
    – Bobyandbob
    Nov 13, 2017 at 12:02
  • you don't want that to float so don't put it in a figure, just replace \begin{table}[h!] \centering ..\end{table} by \begin{center}..\end{center} Nov 13, 2017 at 12:04
  • Thanks, David! That definitely works and is such an easy fix. Cheers! Nov 13, 2017 at 12:09

1 Answer 1

1

You don't want that to float so don't put it in a figure, just replace \begin{table}[h!] \centering ..\end{table} by \begin{center}..\end{center}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .