Banner

Donate

You find LaTeX Community useful? Please donate! Learn why!

Amount:

Partner Sites

goLaTeX
TeXblog
TeXnicCenter

Who is online

In total there are 2 users online :: 0 registered, 0 hidden and 2 guests (based on users active over the past 5 minutes)
Most users ever online was 108 on Tue Jun 08, 2010 3:33 pm

Users browsing this forum: No registered users and 2 guests

How to fixed table into margin ??

Information and discussion about graphics, figures & tables in LaTeX documents.

How to fixed table into margin ??

Postby thundeng on Sat Jan 24, 2009 6:38 pm

I have a table that spread and acroos
My table is fixed in the left margin, but spread and through at the right margin.
I use standart LaTeX article template.
Please, Help me. How to fixed the table at the left and right margin AUTOMATICALLY.

This my tables code
Code: Select all
\documentclass[11pt, a4paper]{article}
\usepackage{mhchem}
\begin{document}

\begin{table}
\begin{tabular}{clll}
\hline
No. & Nama Reaksi & Persamaan Reaksi & $K_{p,j}$\\ \hline
1 &Pembakaran &$\ce{Biomassa + pO_2 -> $x$CO_2 + $y/2$H_2O}$ &-\\
2 &Boudard   &$\ce{C + CO_2->2CO}$ &$K_{p,B}$\\
3      &Heterogenous water shift&$\ce{C + 2H_2O -> CO_2 + 2H_2}$            &$K_{p,W}$\\
4      &Homogenous water shift&$\ce{CO + H_2O -> CO_2 + H_2O}$               &$K_{p,S}$\\
5      &Metanasi&      $\ce{C + 2H_2 -> CH_4}$                                 &$K_{p,M}$\\
\hline
\end{tabular}
\end{table}





Best Regard...
thundeng
 
Posts: 2
Joined: Wed Jan 21, 2009 7:03 pm

Re: How to fixed table into margin ??

Postby localghost on Sat Jan 24, 2009 7:16 pm

There are two possible solutions. The first one is changing the page geometry with the geometry package.
Code: Select all
\usepackage[centering,includeheadfoot,margin=2cm]{geometry}

The second one is building the table with the tabularx package and fix the width of some columns.
Code: Select all
\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{babel}
\usepackage[centering,includeheadfoot,margin=2cm]{geometry}
\usepackage{booktabs,tabularx}
\usepackage[font=small,labelfont=bf]{caption}
\usepackage[version=3]{mhchem}
\usepackage{lmodern}

\begin{document}
  \begin{table}[!ht]
    \centering
    \caption{A Table}\label{tab:table}
    \begin{tabularx}{\textwidth}{cXXc} \toprule
      No. & Nama Reaksi & Persamaan Reaksi & $K_{p,j}$ \\ \midrule[0.8pt]
      1 & Pembakaran & $\ce{Biomassa + pO_2 -> $x$CO_2 + $y/2$H_2O}$ & --- \\
      2 & Boudard & $\ce{C + CO_2 -> 2CO}$ & $K_{p,B}$ \\
      3 & Heterogenous water shift&$\ce{C + 2H_2O -> CO_2 + 2H_2}$ & $K_{p,W}$ \\
      4 & Homogenous water shift & $\ce{CO + H_2O -> CO_2 + H_2O}$ & $K_{p,S}$ \\
      5 & Metanasi & $\ce{C + 2H_2 -> CH_4}$ & $K_{p,M}$ \\ \bottomrule
    \end{tabularx}
  \end{table}
\end{document}

Note that this is only an example. The choice of suitable means is up to you, especially which column of the table is to be fixed. An alternative could be to fix width of a column by using a p{5cm} column type instead.


Best regards
Thorsten¹
¹ I'm sorry. My responses are limited. You must ask the right questions.
² Systems: openSUSE 11.3, TeX Live 2009, TeXworks 0.3 | Windows XP (SP3), MiKTeX 2.8, TeXworks 0.3
³ Learning TeX.
User avatar
localghost
Site Moderator
 
Posts: 4769
Joined: Fri Feb 02, 2007 11:06 am
Location: Braunschweig, Germany

Re: How to fixed table into margin ??

Postby murph636 on Wed Apr 08, 2009 8:46 pm

Hello~

I am having a similar problem but with a rotated table, so fixing the column widths would help in this case. Any other ideas?

Code: Select all
\newpage
\clearpage
\section{Tables}
\bigskip\bigskip
\begin{sideways}
\begin{minipage}{0.9\textheight}
\centering
\captionof{table}{Error matrix from 2001 NLCD classification of Level 1 classes.}\label{tab:NLCDLevel1Table}
\begin{tabular}[!h]{m{1in}rrrrrrrr}
\toprule
           &    \multicolumn{ 6}{c}{2005 Aerial Photo Interpretation Reference Data} &            &            \\ [1ex]           
\cline{2-7}
&      &       &       &       &       &       &            &            \\
NLCD 2001 & Agriculture &     Forest &  Grassland &      Urban &      Water &    Wetland &     Totals & User's  \\
Classified Data &  &      &   &       &       &     &      & Accuracy (\%) \\ [1ex]
\hline
&      &       &       &       &       &       &            &            \\
Agriculture &       161 &          7 &          6 &         13 &          0 &          0 &        187 &      86.1 \\[1ex]
    Forest &          7 &         25 &          6 &          8 &          2 &         10 &         58 &      43.1 \\[1ex]
Grassland &         36 &         16 &         21 &         14 &          1 &          1 &         89 &      23.6 \\[1ex]
     Urban &         12 &          8 &          8 &         94 &          1 &          3 &        126 &      74.6 \\[1ex]
     Water &          1 &          3 &          2 &          1 &         17 &          2 &         26 &      65.4 \\[1ex]
   Wetland &          1 &          1 &          2 &          1 &          1 &          8 &         14 &      57.1 \\[1ex]
    Totals &        218 &         30 &         45 &        131 &         22 &         24 &        500 &            \\[1ex]
Producer's &      &       &       &       &       &       &            &            \\
Accuracy (\%) &      73.9 &      41.7 &      46.7 &      71.8 &      77.3 &      33.3 &            &            \\[1ex]
\hline
&      &       &       &       &       &       &            &            \\
\multicolumn{ 9}{l}{Overall accuracy = 65.2$\%$; Overall Kappa coefficient = 0.53; Overall Kappa Z Statistic = 19.5$^*$} \\
\bottomrule
\label{NLCDLevel1Table}
\end{tabular}
\end{minipage}
\end{sideways}

murph636
 
Posts: 22
Joined: Sun Mar 15, 2009 2:54 am


Return to Graphics, Figures & Tables

Who is online

Users browsing this forum: No registered users and 2 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group