I have had the problem of compiling my document with the following table in it:
\begin{table}[!h]
\centering\small
\caption{Thickness measurements on the two tubes.}
\label{tab:Thickness_measurement}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}lll}
\toprule
Tube & Avareage thickness (mm) & Standard deviation (mm) \\
\midrule
[89$^\circ$$_2$/12.7$^\circ$$_1$/89$^\circ$$_2$] & 2.08 & 0.034 \\
\midrule
[55$^\circ$$_n$] & 0.254 & 0.027 \\
\bottomrule
\end{tabular*}
\end{table}
I'm using MiKTeX and I don't get any error messages or anything peculiar in my log, I just click the compile button and it just starts working and keeps at it forever until I abort it.
I've managed to make it work by replacing [89$^\circ$$_2$/12.7$^\circ$$_1$/89$^\circ$$_2$]
with some random text, say f
as in this table:
\begin{table}[!h]
\centering\small
\caption{Thickness measurements on the two tubes.}
\label{tab:Thickness_measurement}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}lll}
\toprule
Tube & Avareage thickness (mm) & Standard deviation (mm) \\
\midrule
f & 2.08 & 0.034 \\
\midrule
[55$^\circ$$_n$] & 0.254 & 0.027 \\
\bottomrule
\end{tabular*}
\end{table}
This is probably rather vague, but does anyone know what can be wrong?
Best Answer
The problem you're encountering is caused by the fact that
\midrule
can take an optional argument which indicates the thickness of the line to be drawn. Thus, LaTeX scans the string[89$^\circ$$_2$/12.7$^\circ$$_1$/89$^\circ$$_2$]
for a unit of measurement, and an error message is generated because no legal unit of measurement (such aspt
,cm
, etc) is found.The easiest solution, I think, is to add a blank line after each
\midrule
instruction, i.e., to writeInstead of inserting a blank line, you could also insert
\null
or\relax
immediately after\midrule
. (See the posting What is the difference between\relax
and{}
? for a discussion of the differences between\relax
and\null
.) A separate solution, already proposed in the answer by @ChristianHupfer, is to exchange the order or[
...]
and$
...$
; that way, the first "item" that's scanned after\midrule
is a$
rather than a\[
symbol, and no confusion arises.Here's a full MWE that incorporates these thoughts: