Graphics, Figures & Tablesarticle | Place a Table

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
upani1982
Posts: 43
Joined: Wed May 12, 2010 11:42 am

article | Place a Table

Post by upani1982 »

Hi All,

When i am inserting a table in my document, I am getting lot of space and not able to write exactly below the table. Please guide me how to place tables in Article document class.

Code: Select all

\documentclass[12pt,a4paper]{article}
\usepackage[british]{babel}
\usepackage[top=1.5cm,bottom=1.5cm,left=2.5cm,right=1.5cm]{geometry}
\usepackage{microtype}
\usepackage[none]{hyphenat}
\hyphenpenalty=2000 \tolerance=1000
\usepackage[fleqn]{amsmath}
\usepackage[T1]{fontenc}
\usepackage{txfonts}
\usepackage{titlesec}
\titlelabel{\thetitle.\quad}
\titleformat{\section}[hang]{\bfseries \large}{\thesection.}{0.5em}{}
\titlespacing*{\section}{0pt}{1pt}{1pt}
\titleformat{\subsection}[hang]{\bfseries}{\thesubsection.}{0.5em}{}
\titlespacing*{\subsection}{0pt}{1pt}{1pt}
\titleformat{\subsubsection}[hang]{\bfseries}{\thesubsubsection.}{0.5em}{}
\titlespacing*{\subsubsection}{0pt}{1pt}{1pt}
\usepackage[sort&compress]{natbib}
\setlength{\bibsep}{0pt}
\bibpunct{(}{)}{;}{a}{,}{;}
\usepackage{graphicx}
\usepackage{setspace}
\usepackage{booktabs}
\usepackage{ctable}
\usepackage{multirow}
\usepackage{threeparttable}
\usepackage{appendix}
%\renewcommand\appendix{\par
%\setcounter{section}{0}%
%\setcounter{subsection}{0}%
%\setcounter{table}{0} \setcounter{figure}{0}
%\gdef\thetable{\Alph{table}} \gdef\thefigure{\Alph{figure}}
%\section*{Appendix}
%\gdef\thesection{\Alph{section}} \setcounter{section}{1}}
%\hbadness=10000 \hfuzz=50pt
\usepackage{caption}
\captionsetup{margin=10pt,font=normal,labelfont=normal}
%\usepackage{amsmath} \newenvironment{smatrix}{\begin{pmatrix}}{\end{pmatrix}} %USUAL
\usepackage{amsmath} \newenvironment{smatrix}{\left(\begin{smallmatrix}}{\end{smallmatrix}\right)} %SMALL
%\usepackage{nccmath}
This is my preamble of the article i am working on.

Waiting for your suggestion

With regards,
Upananda

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
Stefan Kottwitz
Site Admin
Posts: 10348
Joined: Mon Mar 10, 2008 9:44 pm

Re: article | Place a Table

Post by Stefan Kottwitz »

Hi Upananda,

your preamble is as start, however I suggest you post a complete example, which can be tested and which shows the problem with the table.

Only the preamble doesn't tell much about how you produce that table.

Stefan
LaTeX.org admin
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

article | Place a Table

Post by localghost »

Your promises regarding a minimal example seem to be only empty words. Since float placement is a continual discussed issue, I think a search in the forum will yield many useful solutions.


Thorsten
upani1982
Posts: 43
Joined: Wed May 12, 2010 11:42 am

Re: article | Place a Table

Post by upani1982 »

Hi Stefan and Localghost,

I am sorry for not posting in the prescribed format. I learned that i have to post with all the explanation for the packages used for my document. I have a simple question how to reduce space before and after table environment.

Please excuse me as i am beginner and a social science student.

With regards,
Upananda
User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

article | Place a Table

Post by sommerfee »

upani1982 wrote:I learned that i have to post with all the explanation for the packages used for my document.
This is wrong since a minimal example will show the problem, all further packages are usually irrelevant.
I have a simple question how to reduce space before and after table environment.
This may sound like a simple question, but to answer it we need to know several details, how do you typeset/place your tables, what environments do you use for tables (table, longtable, tabular, tabularx, threeparttable, ctable, ...) etc. For example this is the first time you are mentioning that you are using the table environment, we didn't know this before.

That's one of the many purposes of a minimal example: We don't have to pull every word out of someones mouth (which can last many days or even weeks), the example code has every information build-in we need to help.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

article | Place a Table

Post by localghost »

upani1982 wrote:[…] I learned that i have to post with all the explanation for the packages used for my document. […]
I wonder where you learned that. Certainly not here.
upani1982 wrote:[…] Please excuse me as i am beginner and a social science student. […]
You don't need to be an expert to follow the link regarding the minimal example and obey the instructions to build one.
upani1982
Posts: 43
Joined: Wed May 12, 2010 11:42 am

article | Place a Table

Post by upani1982 »

Hi all,

Here is the preamble of my document.

Code: Select all

\documentclass[12pt,a4paper]{article}
\usepackage[british]{babel}
\usepackage[top=1.5cm,bottom=1.5cm,left=2.5cm,right=1.5cm]{geometry}
\usepackage{microtype}
\usepackage[none]{hyphenat}
\hyphenpenalty=2000 \tolerance=1000
\usepackage[fleqn]{amsmath}
\usepackage[T1]{fontenc}
\usepackage{txfonts}
\usepackage{titlesec}
\titlelabel{\thetitle.\quad}
\titleformat{\section}[hang]{\bfseries \large}{\thesection.}{0.5em}{}
\titlespacing*{\section}{0pt}{1pt}{1pt}
\titleformat{\subsection}[hang]{\bfseries}{\thesubsection.}{0.5em}{}
\titlespacing*{\subsection}{0pt}{1pt}{1pt}
\titleformat{\subsubsection}[hang]{\bfseries}{\thesubsubsection.}{0.5em}{}
\titlespacing*{\subsubsection}{0pt}{1pt}{1pt}
\usepackage[sort&compress]{natbib}
\setlength{\bibsep}{0pt}
\bibpunct{(}{)}{;}{a}{,}{;}
\usepackage{graphicx}
\usepackage{setspace}
% For tables
\usepackage{booktabs,caption,ctable,arydshln,multirow,siunitx,threeparttable}
\usepackage{appendix}
%\renewcommand\appendix{\par
%\setcounter{section}{0}%
%\setcounter{subsection}{0}%
%\setcounter{table}{0} \setcounter{figure}{0}
%\gdef\thetable{\Alph{table}} \gdef\thefigure{\Alph{figure}}
%\section*{Appendix}
%\gdef\thesection{\Alph{section}} \setcounter{section}{1}}
%\hbadness=10000 \hfuzz=50pt
\usepackage{caption}
\captionsetup{margin=10pt,font=normal,labelfont=normal}
%\usepackage{amsmath} \newenvironment{smatrix}{\begin{pmatrix}}{\end{pmatrix}} %USUAL
\usepackage{amsmath} \newenvironment{smatrix}{\left(\begin{smallmatrix}}{\end{smallmatrix}\right)} %SMALL
%\usepackage{nccmath} \newenvironment{smatrix}{\left(\begin{mmatrix}}{\end{mmatrix}\right)} %MEDIUM
This is the section (tables are placed in the Appendix), where i want to reduce the vertical space between the tables:

Code: Select all

\newpage
\appendix
\newgeometry{top=1cm,bottom=1 cm,left=2.5cm,right=1.5cm}
\begin{center}
{\bf Appendix}
 \end{center}\begin{table}[htbp]
\small \sisetup{table-number-alignment=right,table-figures-integer
= 3,table-figures-decimal = 2} \centering
 \begin{threeparttable}
  \centering
  \caption{Total Value of Trade of MCX ( in \si{\percent})}
    \sisetup{table-format = 3.2}
  {
 \renewcommand{\arraystretch}{1.2}
    \begin{tabular}{lSSSSS}
    \toprule
    {\textbf {Commodity}} & \multicolumn{1}{c}{\textbf{2006}} & \multicolumn{1}{c}{\textbf{2007}} & \multicolumn{1}{c}{\textbf{2008}} & \multicolumn{1}{c}{\textbf{2009}} & \multicolumn{1}{c}{\textbf{2010}} \\
    \midrule
    Gold  & 88.83 & 94.58 & 100.00 & 99.40 & 97.15 \\
    Silver & 87.28 & 97.48 & 98.75 & 99.79 & 100.00 \\
    Aluminium & 75.83 & 100.00 & 91.97 & 85.22 & 89.37 \\
    Copper & 99.98 & 100.00 & 100.00 & 99.31 & 99.80 \\
    Lead  & 0.00  & 100.00 & 99.21 & 98.06 & 96.73 \\
    Zinc  & 99.62 & 100.00 & 99.72 & 97.00 & 97.65 \\
    Crude Oil & 100.00 & 100.00 & 98.46 & 99.72 & 90.16 \\
    Natural Gas & 100.00 & 100.00 & 100.00 & 100.00 & 100.00 \\
    \bottomrule
    \end{tabular}%
    }
  \label{tab:mcx}%
 \begin{tablenotes}[footnotesize,flushleft]\setlength{\itemsep}{-4mm}
        \item [1] {Source: Economic Survey of India (2007-2010).}\\
        \item [2] {Note: Share of other commodity exchanges is not reported}\\
        \end{tablenotes}
         \end{threeparttable}
         \end{table}
\begin{table}[htbp]
\small
  \centering
  \begin{threeparttable}
  \caption{Sample Details}
  {
 \renewcommand{\arraystretch}{1.2}
    \begin{tabular}{clcccccl}
    \toprule
     Group & Commodity & Contracts & Observations & Start Date & End Date & Q/B   & Trading Unit \\
     \midrule
    \multirow{2}[4]{*}{Bullion} & Gold  & 31    & 1496  & 6-Feb-06 & 31-Dec-10 & 10 Gm & 1 Kg \\
          & Silver & 28    & 1525  & 2-Jan-06 & 31-Dec-10 & 1 Kg  &  30 Kg \\
    \hdashline
    \multirow{5}[10]{*}{Metal} & Aluminum & 62    & 1519  & 3-Jan-06 & 31-Dec-10 & 1 Kg  & 5 Tons \\
          & Copper & 27    & 1499  & 2-Jan-06 & 30-Nov-10 & 1 Kg  & 1 Mt \\
          & Lead  & 44    & 1067  & 26-Jun-07 & 31-Dec-10 & 1 Kg  & 5 Tons \\
          & Nickel & 43    & 1220  & 1-Jan-07 & 31-Dec-10 & 1 Kg  & 250 Kg \\
          & Zinc  & 58    & 1406  & 1-May-06 & 31-Dec-10 & 1 Kg  & 5 Tons \\
    \hdashline
    \multirow{2}[4]{*}{Energy} & Crude Oil & 62    & 1515  & 2-Jan-06 & 18-Dec-10 & 1 Barrel & 100 Barrel \\
          & Natural Gas & 55    & 1362  & 10-Jul-06 & 28-Dec-10 & MMBtu & 1250 MMBtu \\
    \bottomrule
    \end{tabular}%
    }
  \label{tab:sample}%
  \begin{tablenotes}[footnotesize,flushleft]\setlength{\itemsep}{-4mm}
        \item [1] {Note:Q/B refers quotation per Base Value}\\
        \end{tablenotes}
         \end{threeparttable}
 \end{table}%
\end{document}
Please give any suggestion to do the above.

With regards,
Upananda
User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

article | Place a Table

Post by sommerfee »

upani1982 wrote:Here is the preamble of my document.
We are not interested in your full preamble. A minimal working example (MWE) fulfills two needs:
  1. It contains all the information we need to reproduce and solve the problem. It does not contain the stuff which is not necessary to show the problem. By eliminating the not-necessary-stuff (by simply trying out what is necessary to reproduce the problem and what is not) one is able to isolate the problem. One can either start with a new document and copy the relevant parts into this new document, or one can shrink a copy of the existing document.

    This is a step which can easily done by the questioner. If the questioner is not doing it, every user who is willing to help have to do it.
  2. Every user who is willing to help needs a working(!) example document, so he can reproduce the problem and play around with it. If the questioner is not offering such document, every user who is willing to help must build such document first.

If you have any questions about a minimal working example, just ask. Since this procedure is the standard procedure to isolate and examine a LaTeX problem this is especially useful for LaTeX beginners.
Post Reply