0

I'm trying to make a table with figures in them but LateX keeps giving me the same error over and over again. This is the text I'm using:

\begin{table}[h!]
  \centering
  \begin{tabular}{ | c | m{5cm} | m{5cm} | }
    \hline
    Shape & Area & Moments of Inertia \\ \hline\hline
    \begin{minipage}{.3\textwidth}
      \includegraphics[width=\linewidth, height=60mm]{figure/circle}
    \end{minipage}
    &
    %\begin{minipage}[t]{5cm}
      \begin{itemize}
        \item $A=\piR^2$
      \end{itemize}
    %\end{minipage}
    & 
    %\begin{minipage}{5cm}
      \begin{itemize}
        \item $I_{yy}=I_{zz}=\frac{1}{4}\piR^2$
        \item $I_{yz}=0$
        \item $I_p=\frac{1}{2}\piR^4$
      \end{itemize}
    %\end{minipage}
    \\ 
        \begin{minipage}{.3\textwidth}
      \includegraphics[width=\linewidth, height=60mm]{figure/thincircle}
    \end{minipage}
    &
    %\begin{minipage}[t]{5cm}
      \begin{itemize}
        \item $A=2\piRt$
      \end{itemize}
    %\end{minipage}
    & 
    %\begin{minipage}{5cm}
      \begin{itemize}
        \item $I_{yy}=I_{zz}=\piR^3t$
        \item $I_{yz}=0$
        \item $I_p=2\piR^3t$
      \end{itemize}
    %\end{minipage}     
        \hline
  \end{tabular}
  \caption{Sectional variables for circle and hollow circle}\label{tab:inertiasum}
\end{table}

Hope anyone can help

  • Welcome to TeX.SX! What error? – egreg Sep 30 '13 at 11:02
  • 3
    welcome to tex.sx, you can format code sections using the {} button, see my edit) I assume \piR^4$ should be \pi R^4$ to refer to pi. (Please always post complete small documents not just fragments) – David Carlisle Sep 30 '13 at 11:03
2

There are at least two two errors in your LaTeX. First, in the equations, \pi runs into what follows. You need to either enclose it in brackets {\pi} or leave a space afterwards. Otherwise, TeX thinks you're calling an underfined macro called \piR.

Second, you're missing a line break before your final horizontal rule. You actually want the horizontal rule to start on the next line, but you're calling it in the final column of the final row in the table.

I'm not sure if there are any problems related to the figures. You haven't included them, so I commented out those lines in your code. Here's a working example with the figures lines commented out:

\documentclass{article}
\usepackage{tabu}

\begin{document}
\begin{table}[h!]
  \centering
  \begin{tabular}{ | c | m{5cm} | m{5cm} | }
    \hline
    Shape & Area & Moments of Inertia \\ \hline\hline
    \begin{minipage}{.3\textwidth}
%      \includegraphics[width=\linewidth, height=60mm]{figure/circle}
    \end{minipage}
    &
    %\begin{minipage}[t]{5cm}
      \begin{itemize}
        \item $A={\pi}R^2$
      \end{itemize}
    %\end{minipage}
    & 
    %\begin{minipage}{5cm}
      \begin{itemize}
        \item $I_{yy}=I_{zz}=\frac{1}{4}\pi R^2$
        \item $I_{yz}=0$
        \item $I_p=\frac{1}{2}\pi R^4$
      \end{itemize}
    %\end{minipage}
    \\ \hline
        \begin{minipage}{.3\textwidth}
%      \includegraphics[width=\linewidth, height=60mm]{figure/thincircle}
    \end{minipage}
    &
    %\begin{minipage}[t]{5cm}
      \begin{itemize}
        \item $A=2\pi Rt$
      \end{itemize}
    %\end{minipage}
    & 
    %\begin{minipage}{5cm}
      \begin{itemize}
        \item $I_{yy}=I_{zz}=\pi R^3t$
        \item $I_{yz}=0$
        \item $I_p=2\pi R^3t$
      \end{itemize}
    %\end{minipage}     
       \\ \hline
  \end{tabular}
  \caption{Sectional variables for circle and hollow circle}\label{tab:inertiasum}
\end{table}
\end{document}

And my output:

Output for included code

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.