0

I am admittedly a complete novice when it comes to using Latex but I'm really enjoying its practicality when it comes to note taking in science and math courses. However I am now trying to insert a table into a shaded region but receive an error that says"!LaTeX Error:Float(s) lost."

Would someone please explain to me what is wrong with my coding. Originally I had created a table, but thinking I had done a typo I googled a table from a tutorial and pasted it in and still receive the error.

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amsthm,amsfonts,amssymb,amscd}
\usepackage{multirow,booktabs}
\usepackage[table]{xcolor}
\usepackage{fullpage}
\usepackage{lastpage}
\usepackage{enumitem}
\usepackage{fancyhdr}
\usepackage{mathrsfs}
\usepackage{wrapfig}
\usepackage{setspace}
\usepackage{calc}
\usepackage{gensymb}
\usepackage{multicol}
\usepackage{cancel}
\usepackage[retainorgcmds]{IEEEtrantools}
\usepackage[margin=3cm]{geometry}
\usepackage{amsmath}
\newlength{\tabcont}
\setlength{\parindent}{0.0in}
\setlength{\parskip}{0.05in}
\usepackage{empheq}
\usepackage{framed}
\usepackage[most]{tcolorbox}
\usepackage{xcolor}
\colorlet{shadecolor}{orange!15}
\parindent 0in
\parskip 12pt
\geometry{margin=1in, headsep=0.25in}
\theoremstyle{definition}
\newtheorem{defn}{Definition}
\newtheorem{reg}{Rule}
\newtheorem{exer}{Exercise}
\newtheorem{note}{Note}
\begin{document}
\setcounter{section}{0}
\title{Lecture 9 Notes}

\thispagestyle{empty}

\begin{center}
{\LARGE \bf Lecture 9}\\
\section{Chemical Equilibrium - Chapter 6}
\subsection{Calculating Equilibrium Constant}
\begin{shaded}
\textbf{Example 4}\\
In order to study hydrogen halide decomposition, a researcher fills an evacuated 2.00L flask with 0.200mol of $HI$ gas and allows the reaction to proceed at 453$\degree$C.\\
At equilibrium, $[HI]=0.078$mol. Calculate $K_c$.\\
$2HI(g)\rightleftharpoons H_2(g)+I_2(g)$\\
First we need to convert mol to concentration: $[HI]=\frac{0.200mol}{2.00L}=0.100M$
Now we need to use an ICE table:
\begin{table}[h!]
  \begin{center}
    \caption{Your first table.}
    \label{tab:table1}
    \begin{tabular}{l|c|r} % <-- Alignments: 1st column left, 2nd middle and 3rd right, with vertical lines in between
      \textbf{Value 1} & \textbf{Value 2} & \textbf{Value 3}\\
      $\alpha$ & $\beta$ & $\gamma$ \\
      \hline
      1 & 1110.1 & a\\
      2 & 10.1 & b\\
      3 & 23.113231 & c\\
    \end{tabular}
  \end{center}
\end{table}

\end{shaded}



\end{document}
  • (i) float table (figure etc ) had not to be enclosed in other environments like minipage, shade` etc. (ii) your code is not compilable, you have errors in determining of center, (iii) do you really need so many packages? (iv) it is sufficient to load each package only ones, ... welcome to tex.se! – Zarko Feb 8 '18 at 14:52
0

Use the [H] option from float, which makes the table not float (however, this may produce large white spaces) or replace the table environment + \vation with center +\captionof[table{...}`.

I loaded the caption package to have a sensible spacing between caption and table, titlesec with option [center]to avoid typing all those center environments, siunitx to have a correct spacing when typing units.

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amsthm,amsfonts,amssymb,amscd}
\usepackage{nccmath}
\usepackage{multirow,booktabs, caption, float}
\usepackage{siunitx}
\usepackage[table]{xcolor}
\usepackage{fullpage}
\usepackage{lastpage}
\usepackage{enumitem}
\usepackage{fancyhdr}
\usepackage{mathrsfs}
\usepackage{wrapfig}
\usepackage{setspace}
\usepackage{calc}
\usepackage{gensymb}
\usepackage{multicol}
\usepackage{cancel}
%\usepackage[retainorgcmds]{IEEEtrantools}
\usepackage[margin=3cm]{geometry}
\usepackage{amsmath}
\newlength{\tabcont}
\setlength{\parindent}{0.0in}
\setlength{\parskip}{0.05in}
\usepackage{empheq}
\usepackage{framed}
\usepackage[most]{tcolorbox}
\colorlet{shadecolor}{orange!15}
\parindent 0in
\parskip 12pt
\geometry{margin=1in, headsep=0.25in}
\theoremstyle{definition}
\newtheorem{defn}{Definition}
\newtheorem{reg}{Rule}
\newtheorem{exer}{Exercise}
\newtheorem{note}{Note}
\usepackage[center]{titlesec}

\begin{document}

\setcounter{section}{0}
\title{Lecture 9 Notes}

\thispagestyle{empty}

{\LARGE \bfseries Lecture 9}\\
\section{Chemical Equilibrium – Chapter 6}
\subsection{Calculating Equilibrium Constant}
\begin{shaded}
\leavevmode\centerline{\textbf{Example 4}}
In order to study hydrogen halide decomposition, a researcher fills an evacuated \SI{2.00}{\L} flask with \SI{0.200}{\mol } of $HI$ gas and allows the reaction to proceed at \SI{453}{\celsius}.\\
At equilibrium, $[HI]=\SI{0.078}{\mol}$. Calculate $K_c$.\\
$2HI(g)\rightleftharpoons H_2(g)+I_2(g)$\\
First we need to convert mol to concentration: $[HI]=\mfrac{\SI{0.200}{\mol}}{2.00L}=\SI{0.100}{M}$.
Now we need to use an ICE table:
\begin{table}[H]
  \centering
    \caption{Your first table.}
    \label{tab:table1}
    \begin{tabular}{l|c|r} % <-- Alignments: 1st column left, 2nd middle and 3rd right, with vertical lines in between
      \textbf{Value 1} & \textbf{Value 2} & \textbf{Value 3}\\
      $\alpha$ & $\beta$ & $\gamma$ \\
      \hline
      1 & 1110.1 & a\\
      2 & 10.1 & b\\
      3 & 23.113231 & c\\
    \end{tabular}
\end{table}
\end{shaded}

\end{document} 

enter image description here

  • Thanks so much for the help! That's exactly what I wanted!! – SvenskTacoma Feb 9 '18 at 8:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.