Graphics, Figures & TablesWhat's wrong with my table?

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Singularity
Posts: 156
Joined: Sat Jan 22, 2011 9:55 pm

What's wrong with my table?

Post by Singularity »

What's wrong with my table? The build process just hangs and never gives me an error (so I can't even investigate myself).

Even if I comment all but the first line of the table, I still get a "misplaced alignment tab character" error.

Code: Select all

\documentclass[14pt,fleqn,reqno]{extarticle}
\usepackage{amsfonts,amsmath,amssymb,amsthm}
\usepackage{bm,nicefrac}

\usepackage{array}					% Provides for a more flexible array and tabular environment
\usepackage{booktabs}				% For fancy stuff in arrays and tables, like the following column definitions
\newcolumntype{L}{>{\begin{math}}l<{\end{math}}}%
\newcolumntype{C}{>{\begin{math}}c<{\end{math}}}%
\newcolumntype{R}{>{\begin{math}}r<{\end{math}}}%
\usepackage{multirow}

                                 
\begin{document}

\begin{tabular}{lLL}}
	Derivative & Newton notation                                              & Liebnitz notation \\
	\hrule
	First      & y^\prime \text{ or } f^\prime(x)                             & \frac{\dif y}{\dif x}     \\
	Second     & y^{\prime\prime} \text{ or } f^{\prime\prime}(x)             & \frac{\dif^2 y}{\dif x^2} \\
	Third      & y^{\prime\prime\prime} \text{ or } f^{\prime\prime\prime}(x) & \frac{\dif^3 y}{\dif x^3} \\
	Fourth     & y^{(4)} \text{ or } f^{(4)}(x)                               & \frac{\dif^4 y}{\dif x^4} \\
	\begin{center}
	\ldots
	\end{center} \\
	$n$th      & y^{(n)} \text{ or } f^{(n)}(x)                               & \frac{\dif^n y}{\dif x^n}
\end{tabular}


\end{document}
I've used this type of table before

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

What's wrong with my table?

Post by cgnieder »

First problem: you have an extra closing brace here which you need to delete:

Code: Select all

\begin{tabular}{lLL}}
Second problem: you can't use \hrule. Replace it with \hline or (as you're loading booktabs) \midrule.

Third problem (maybe only in this example): \dif is undefined.

Fourth problem: you can't use the {center} environment here. I'd use \multicolumn for a centred cell (and probably \vdots):

Code: Select all

\multicolumn{1}{c}{\vdots}
I'd also use \text for the headings in the math columns:

Code: Select all

Derivative & \text{Newton notation} & \text{Liebnitz notation} \\

Code: Select all

\begin{tabular}{lLL}
  Derivative & \text{Newton notation} & \text{Liebnitz notation} \\
  \midrule
  First      & y^\prime \text{ or } f^\prime(x) & \frac{\dif y}{\dif x}     \\
  Second     & y^{\prime\prime} \text{ or } f^{\prime\prime}(x)
             & \frac{\dif^2 y}{\dif x^2} \\
  Third      & y^{\prime\prime\prime} \text{ or } f^{\prime\prime\prime}(x)
             & \frac{\dif^3 y}{\dif x^3} \\
  Fourth     & y^{(4)} \text{ or } f^{(4)}(x)  & \frac{\dif^4 y}{\dif x^4} \\
        \multicolumn{1}{c}{\vdots} \\
  $n$th      & y^{(n)} \text{ or } f^{(n)}(x)  & \frac{\dif^n y}{\dif x^n}
\end{tabular}
site moderator & package author
Singularity
Posts: 156
Joined: Sat Jan 22, 2011 9:55 pm

Re: What's wrong with my table?

Post by Singularity »

Whew! :)
Thanks.
Post Reply