Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  Christian Hupfer Apr 21 at 7:46
    
There is a missing \usepackage{booktabs} in the preamble and the lines starting with [ fails due to wrong math mode. Can you provide a screen shot showing the format of that 89 etc. rows? Where should those subscripts "2" and "n" appear? –  Christian Hupfer Apr 21 at 7:55
1  
@ChristianHupfer - The error message is generated not so much because of "wrong math mode", but because \midrule can take an optional argument that indicates the width of the rule. Obviously that's not the intent here. –  Mico Apr 21 at 8:15
    
@Mico: Thanks for that information, I learned again some important issues. I removed my comment on that. –  Christian Hupfer Apr 21 at 8:19

2 Answers 2

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 as pt, cm, etc) is found.

The easiest solution, I think, is to add a blank line after each \midrule instruction, i.e., to write

    \midrule % insert a blank line

    [89$^\circ$$_2$/12.7$^\circ$$_1$/89$^\circ$$_2$] & 2.08 & 0.034 \\
    \midrule % insert a blank line

    [55$^\circ$$_n$] & 0.254 & 0.027 \\

Instead 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:

enter image description here

\documentclass{article}
\usepackage{booktabs}
\begin{document}
\begin{table}[!h]
%\centering\small  %% \centering has no effect because tabular* takes up the full text block
\caption{Thickness measurements on the two tubes.}
\label{tab:Thickness_measurement}
\smallskip % probably a good idea to have a bit of space between caption and tabular
\begin{tabular*}{\textwidth}{@{} l @{\extracolsep{\fill}} ll @{}}
\toprule
Tube & Average thickness (mm) & Standard deviation (mm) \\
\midrule\relax
[89$^\circ$$_2$/12.7$^\circ$$_1$/89$^\circ$$_2$] & 2.08 & 0.034 \\
\midrule\relax
[55$^\circ$$_n$] & 0.254 & 0.027 \\
\bottomrule
\end{tabular*}
\end{table}
\end{document}
share|improve this answer
    
i'm kind of surprised that there's no complaint about the double dollar signs between the super- and subscripts. since i believe that they're to be offset (as they appear here), {} would be a better way of indicating that. –  barbara beeton Apr 21 at 17:27
    
@barbarabeeton - I was puzzling over the consecutive single-$ instructions as well. I must confess I didn't raise this issue because I can't tell what the intended look is. –  Mico Apr 21 at 18:31

I am not sure if this the correct formatting of that lines enclosed by [...], but I give it a try ;-)

\documentclass{scrbook}

\usepackage{booktabs}
\begin{document}

\begin{table}[h]
\centering\small
\caption{Thickness measurements on the two tubes.}
\label{tab:Thickness_measurement}
    \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}lll}
        \toprule
        Tube & Average 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}

\end{document}

enter image description here

share|improve this answer
    
i'm pretty sure the superscript "degree" is meant not to overlap the subscripts. they can be "separated" by {} (i think that method is recommended in the texbook). –  barbara beeton Apr 21 at 17:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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