Graphics, Figures & TablesTable with merged Cells

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
ankhi
Posts: 32
Joined: Sun Aug 26, 2012 6:07 pm

Table with merged Cells

Post by ankhi »

Well another look question.... or style I dont know.... :?

I wrote this code:

Code: Select all

% !TEX TS-program = pdflatex
% !TEX encoding = UTF-8 Unicode

% This is a simple template for a LaTeX document using the "article" class.
% See "book", "report", "letter" for other types of document.

\documentclass[12pt,twoside,twocolumn,a4paper,fleqn]{article} % use larger type; default would be 10pt

\usepackage[utf8]{inputenc} % set input encoding (not needed with XeLaTeX)

%%% Examples of Article customizations
% These packages are optional, depending whether you want the features they provide.
% See the LaTeX Companion or other references for full information.

%%% PAGE DIMENSIONS
\usepackage{geometry} % to change the page dimensions
\geometry{a4paper} % or letterpaper (US) or a5paper or....
\geometry{margin=0.8in} % for example, change the margins to 2 inches all round
% \geometry{landscape} % set up the page for landscape
%   read geometry.pdf for detailed page layout information

\usepackage{graphicx} % support the \includegraphics command and options
\usepackage{caption}
\usepackage{subcaption}
% \usepackage[parfill]{parskip} % Activate to begin paragraphs with an empty line rather than an indent

%%% PACKAGES
\usepackage{booktabs} % for much better looking tables
\usepackage{array} % for better arrays (eg matrices) in maths
\usepackage{paralist} % very flexible & customisable lists (eg. enumerate/itemize, etc.)
\usepackage{verbatim} % adds environment for commenting out blocks of text & for better verbatim
\usepackage{subfig} % make it possible to include more than one captioned figure/table in a single float
% These packages are all incorporated in the memoir class to one degree or another...

%%% HEADERS & FOOTERS
\usepackage{fancyhdr} % This should be set AFTER setting up the page geometry
\pagestyle{fancy} % options: empty , plain , fancy
\renewcommand{\headrulewidth}{0pt} % customise the layout...
\lhead{}\chead{}\rhead{}
\lfoot{}\cfoot{\thepage}\rfoot{}

%%% SECTION TITLE APPEARANCE
\usepackage{sectsty}
\allsectionsfont{\sffamily\mdseries\upshape} % (See the fntguide.pdf for font help)
% (This matches ConTeXt defaults)

%%% ToC (table of contents) APPEARANCE
\usepackage[nottoc,notlof,notlot]{tocbibind} % Put the bibliography in the ToC
\usepackage[titles,subfigure]{tocloft} % Alter the style of the Table of Contents
\renewcommand{\cftsecfont}{\rmfamily\mdseries\upshape}
\renewcommand{\cftsecpagefont}{\rmfamily\mdseries\upshape} % No bold!

%made commands
\newcommand{\superscript}[1]{\ensuremath{^{\textrm{#1}}}}
\newcommand{\subscript}[1]{\ensuremath{_{\textrm{#1}}}}
\newcommand{\alp}[1]{\ensuremath{\alpha}}
\newcommand{\del}[1]{\ensuremath{\delta}}
\newcommand{\lrarw}[1]{\ensuremath{\longrightarrow}}

%bibliography
\usepackage[square,numbers]{natbib}

%Maths
\usepackage{amsmath, amsthm, amssymb}

%for permil
\usepackage{wasysym}

%for selective landscape
\usepackage{pdflscape}

% for chemical formatting
\usepackage[version=3]{mhchem}
%%% END Article customizations

%%% The "real" document content comes below...

\begin{document}

\begin{landscape}
% Table generated by Excel2LaTeX from sheet 'Sheet2'
\begin{table}[htbp]
  \centering
    \begin{tabular}{rrrrrrrrrrrrrrrrrrrrrrrrrr}
    \addlinespace
    \toprule
    \textbf{Slope positive AND Significance 95\textbackslash \% =1, rest =0} &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &  \\
    \midrule
          &       &       & \textbf{Temperature} & \textbf{} & \textbf{} & \textbf{} & \textbf{} & \textbf{} & \textbf{} & \textbf{} & \textbf{} & \textbf{} & \textbf{} & \textbf{} & \textbf{} & \textbf{Typical Pressure} & \textbf{} & \textbf{} &       &       &       &       &       &       &  \\
    \multicolumn{1}{c}{\textbf{}} & J     & F     & M     & A     & M     & J     & J     & A     & S     & O     & N     & D     &       & J     & F     & M     & A     & M     & J     & J     & A     & S     & O     & N     & D \\
    KLSR01 & 1     & 1     & 1     & 1     & 1     & 0     & 0     & 0     & 1     & 1     & 1     & 1     &       & 1     & 1     & 1     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 1     & 1 \\
    CCOP01 & 1     & 1     & 0     & 0     & 0     & 1     & 1     & 1     & 1     & 1     & 1     & 0     &       & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 1     & 1     & 0     & 0     & 0 \\
    DGHPOE & 0     & 0     & 1     & 1     & 1     & 1     & 1     & 1     & 0     & 0     & 0     & 1     &       & 0     & 0     & 0     & 0     & 1     & 1     & 0     & 0     & 0     & 0     & 0     & 0 \\
    COPYNS & 1     & 1     & 0     & 0     & 0     & 1     & 1     & 1     & 1     & 1     & 1     & 1     &       & 1     & 1     & 0     & 0     & 0     & 0     & 0     & 1     & 1     & 1     & 1     & 1 \\
    BBYISN & 0     & 0     & 1     & 1     & 1     & 1     & 1     & 1     & 1     & 1     & 0     & 1     &       & 0     & 0     & 0     & 0     & 1     & 1     & 1     & 1     & 1     & 0     & 0     & 0 \\
    JHLJKB & 1     & 1     & 1     & 1     & 1     & 1     & 1     & 1     & 1     & 1     & 1     & 1     &       & 0     & 1     & 1     & 1     & 1     & 1     & 0     & 0     & 0     & 0     & 1     & 1 \\
    LKHLKD & 1     & 1     & 1     & 1     & 1     & 0     & 1     & 1     & 1     & 1     & 1     & 1     &       & 1     & 1     & 1     & 0     & 0     & 0     & 0     & 1     & 1     & 1     & 1     & 1 \\
    KHLHLK & 1     & 1     & 0     & 0     & 1     & 1     & 1     & 1     & 1     & 1     & 1     & 0     &       & 0     & 0     & 0     & 0     & 1     & 1     & 1     & 1     & 1     & 0     & 0     & 0 \\
    BHKLHB & 0     & 0     & 1     & 1     & 1     & 1     & 1     & 1     & 0     & 0     & 0     & 1     &       & 0     & 0     & 1     & 1     & 1     & 1     & 0     & 0     & 0     & 0     & 0     & 0 \\
    JKGKKK & 0     & 0     & 1     & 1     & 1     & 1     & 1     & 1     & 0     & 0     & 0     & 1     &       & 0     & 0     & 1     & 1     & 1     & 1     & 0     & 0     & 0     & 0     & 0     & 0 \\
    \bottomrule
    \end{tabular}%
  \label{tab:addlabel}%
\end{table}%
\end{landscape}

\end{document}
and got the lower table in pic, where I wanted to have the top one in pic....

Image

please please help... :shock:

Recommended reading 2024:

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

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

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

Table with merged Cells

Post by localghost »

Your example can for sure be reduced to a real minimal example. Just a friendly advice for future questions.

For the present you should try your luck with the \multicolumn (←Link!) command.


Thorsten
ankhi
Posts: 32
Joined: Sun Aug 26, 2012 6:07 pm

Re: Table with merged Cells

Post by ankhi »

Thanks!!

Well that worked but I want also to decrease spaces between the 0 1 1 1 0 values so that it doesnt go beyond the page hence I dont have to make it landscape. Also is there a way to make it go both columns if the class has twocolmun decleared???? 8-)
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Table with merged Cells

Post by localghost »

ankhi wrote:[…] I want also to decrease spaces between the 0 1 1 1 0 values so that it doesnt go beyond the page hence I dont have to make it landscape. […]
Modify the length \tabcolsep (default 6pt) correspondingly.
ankhi wrote:[…] Also is there a way to make it go both columns if the class has twocolmun decleared? […]
There also exist starred versions of the float environments (figure*, table*).
Post Reply