Graphics, Figures & Tablesdifference in alignment between table and tabular

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
chimanrao
Posts: 8
Joined: Mon Mar 01, 2010 8:39 am

difference in alignment between table and tabular

Post by chimanrao »

hi

Please take a look at snippet below:

Code: Select all

\documentclass[10pt,a4paper,openany]{book}
\usepackage[pdftex]{hyperref}
\begin{document}

\begin{itemize}
\item This gets aligned outside the items
\begin{table}[h]
\begin{tabular}{ccc}
& Portfolio 1 & Portfolio 2 \\
$S_T \le X$ & X & $S_T$ \\
$S_T \geq X$ & $S_T$ & $S_T$
\end{tabular}
\end{table}

\item This gets aligned inside the items

\begin{tabular}{ccc}
& Portfolio 1 & Portfolio 2 \\
$S_T \le X$ & X & $S_T$ \\
$S_T \geq X$ & $S_T$ & $S_T$
\end{tabular}

\end{itemize}

\end{document}
The alignment with table + tabular and only tabular is different.
I have two questions:
a. How can I get table + tabular to align like tabular?
b. How can I add a caption and label to tabular and make it appear in list of tables using only the tabular tag?

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

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

difference in alignment between table and tabular

Post by localghost »

The caption package allows to assign caption to figures without a figure environment.


Best regards
Thorsten
Post Reply