Text FormattingAlignment of Math Expression in a Table

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
sachinrajsharma
Posts: 35
Joined: Sun Apr 08, 2012 5:48 am

Alignment of Math Expression in a Table

Post by sachinrajsharma »

Hi,

I am facing the following error :

Code: Select all

! Extra alignment tab has been changed to \cr.
This is the problematic code.

Code: Select all

\begin{tabular}{|c|c|}\hline
  (I) If $\vec{a} =a_1\hat{i}+b_2\hat{j}+a_3\hat{k}; \vec{b}=b_1\hat{i}+b_2\hat{j}+b_3\hat{k}; \vec{c} =c_1\hat{i}+c_2\hat{j}+c_3\hat{k}$ then $[a b c ] $ &
  (B) $\begin{vmatrix}
        a_1 & a_2 & a_3 \\
        b_1 & b_2 & b_3\\
        \hat{i} & \hat{j} & \hat{k}\\
      \end{vmatrix}$
\end{tabular}
I am unable to locate the error please help thanks.

Sachin Sharmaa

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

hugovdberg
Posts: 133
Joined: Sat Feb 25, 2012 6:12 pm

Alignment of Math Expression in a Table

Post by hugovdberg »

Please post a Infominimal working example that actually compiles and reproduces the problem. When I expand your snippet to the minimal working code (as below) it works fine, except it throws an overfull hbox warning because your table is very wide.

Code: Select all

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{tabular}{|c|c|}\hline
  (I) If $\vec{a} =a_1\hat{i}+b_2\hat{j}+a_3\hat{k}; \vec{b}=b_1\hat{i}+b_2\hat{j}+b_3\hat{k}; \vec{c} =c_1\hat{i}+c_2\hat{j}+c_3\hat{k}$ then $[a b c ] $ &
  (B) $\begin{vmatrix}
        a_1 & a_2 & a_3 \\
        b_1 & b_2 & b_3\\
        \hat{i} & \hat{j} & \hat{k}\\
      \end{vmatrix}$
\end{tabular}
\end{document}
Ubuntu 13.10 + Tex Live 2013 + Texmaker / Windows 7 Pro + MikTex 2.9 + TexnicCenter / Android 4.3 + TexPortal + DroidEdit
sachinrajsharma
Posts: 35
Joined: Sun Apr 08, 2012 5:48 am

Re: Alignment of Math Expression in a Table

Post by sachinrajsharma »

Thanks a lot ...
Post Reply