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.

In my LaTeX document, I have some simple code for the simplest of tables. But, when I let TeXnicCenter output it to PDF, the text 'height' is suddenly in the first cell and on the first cell in a new row I didn't define. Of course googling for the height and table gives lots of results, but not to this question

\begin{table}[h]
    \begin{tabular}{|l|l|l|l|l|}
        \hline
        ~ & $\theta$      & d   & a  & $\alpha$ \\ \hline
        1 & 0             & 100 & 0  & $\pi$    \\ 
        2 & 0             & 0   & 90 & 0        \\ 
        3 & $\frac{\pi}{2}$ & 50  & 0  & 0      \\
        \hline
    \end{tabular}
\end{table}

Rendered output

share|improve this question
7  
Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem (i.e. not just the table, but the preamble too). –  Joseph Wright Nov 6 '11 at 17:02
add comment

1 Answer

up vote 3 down vote accepted

It seems that you must have something like the following in your code, where you have height instead of \hline:

\documentclass{article}
\begin{document}
\begin{table}[h]
    \begin{tabular}{|l|l|l|l|l|}
        height
        ~ & $\theta$      & d   & a  & $\alpha$ \\ \hline
        1 & 0             & 100 & 0  & $\pi$    \\ 
        2 & 0             & 0   & 90 & 0        \\ 
        3 & $\frac{\pi}{2}$ & 50  & 0  & 0      \\
        height
    \end{tabular}
\end{table}
\end{document}

The above produces the output you provided. With height in the above replaced with \hline (as per your MWE), I get the following. So, your MWE is correct, but check your actual code.

Result

share|improve this answer
4  
If that is not the case, try \show\hline in the tabular. It should stop the compilation and give the following message: > \hline=macro: ->\noalign {\ifnum 0=`}\fi \hrule \@height \arrayrulewidth \futurelet \reserved @a \@xhline . If it says something else (especially height), \hline has been redefined somewhere. –  Stephen Nov 6 '11 at 18:09
    
@Stephen: I thought of that, but the \hline on the second line seems to have worked so don't think that is the case. –  Peter Grill Nov 6 '11 at 20:04
1  
Somehow, pasting in your code, with the 'height' text included, then replacing that by \hline works... I completely los on why that woudld happen, because the code is now again exactly as before, how I posted it in the original question. –  Loy Nov 7 '11 at 8:10
    
Maybe you have some active unicode character in it, which causes trouble. –  Martin Scharrer Nov 7 '11 at 14:57
    
@PeterGrill: Ah, right, I missed that one \hline! –  Stephen Nov 7 '11 at 17:09
add comment

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.