说实话,在使用 Latex 方面我完全是个新手,但我真的很享受它在科学和数学课程中做笔记时的实用性。然而,我现在试图将表格插入阴影区域,但收到一条错误消息,提示“!LaTeX 错误:浮点数丢失。”
有人能解释一下我的编码哪里错了吗?我本来创建了一个表格,但以为我打错了,于是我谷歌了一下教程中的表格并将其粘贴进去,但仍然收到错误。
\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}
答案1
使用[H]
来自的选项float
,使表格不浮动(然而,这可能会产生大的空白)或者用\captionof[table{...}`替换table
环境 + 。\vation
center +
我加载了caption
包以便在标题和表格之间留出合理的间距,titlesec
并选择[center]
避免输入所有这些center
环境,siunitx
以便在输入单位时有正确的间距。
\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}