Graphics, Figures & Tableshow to make table obey normal article margins??

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
exactos
Posts: 8
Joined: Sat Jul 24, 2010 10:47 pm

how to make table obey normal article margins??

Post by exactos »

I cannot bring my tables within the margins as preset by the article document class. Ideas, anyone?

Code: Select all

\documentclass[11pt]{article}
\usepackage{graphicx,latexsym,amsfonts,amssymb,amsmath,verbatim,theapa,lscape, multirow,
xcolor, booktabs, upgreek, caption}

\begin{document}

\begin{table}
\caption{ATC of Production at Max Cap. by Type}


\vspace{3pt} \noindent
\begin{tabular}{p{72pt}|p{31pt}|p{31pt}|p{40pt}|p{40pt}|p{49pt}|p{58pt}}
\hline

{\footnotesize Type}
 &
{\footnotesize Min}
 &
{\footnotesize Max}
 &
{\footnotesize Total Cost}
 &
{\footnotesize Unit Cost}
 &
{\footnotesize ATC}
 &
{\footnotesize Total}
 \\
\cline{2-7}

{\footnotesize (Quantity)}
 &
{\footnotesize Units}
 &
{\footnotesize Units}
 &
{\footnotesize \$}
 &
{\footnotesize \$/Unit}
 &
{\footnotesize \$/Unit}
 &
{\footnotesize Units}
 \\
\hline

{\footnotesize \begin{math}A\end{math} (2)}
 &
{\footnotesize 0}
 &
{\footnotesize 2}
 &
{\footnotesize 0}
 &
{\footnotesize 20}
 &
{\footnotesize 20}
 &
{\footnotesize 4}
 \\
\hline

{\footnotesize \begin{math}I\end{math} (1)}
 &
{\footnotesize 0}
 &
{\footnotesize 2}
 &
{\footnotesize 0}
 &
{\footnotesize 255}
 &
{\footnotesize 255}
 &
{\footnotesize 2}
 \\
\hline \multicolumn{6}{r|}{ {\footnotesize Total} } & {\footnotesize
6}
 \\
\hline
\end{tabular}
\vspace{2pt}
\end{table}

\end{document}
Last edited by exactos on Thu Sep 23, 2010 2:35 am, edited 1 time in total.

Recommended reading 2024:

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

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

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

how to make table obey normal article margins??

Post by localghost »

Code: Select all

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}

\begin{document}
  \begin{table}[!ht]
    \caption{ATC of Production at Max Cap. by Type}
    \label{tab:atc}
    \centering
    \footnotesize
    \begin{tabular}{*7{l}}\hline
      Type & Min & Max & Total Cost & Unit Cost & ATC & Total \\ \cline{2-7}
      (Quantity) & Units & Units & \$ & \$/Unit & \$/Unit & Units \\ \hline
      $A$ (2) & 0 & 2 & 0 & 20 & 20 & 4 \\ \hline
      $I$ (1) & 0 & 2 & 0 & 255 & 255 & 2 \\ \hline
      \multicolumn{6}{r|}{Total} & 6 \\ \hline
    \end{tabular}
  \end{table}
\end{document}
By the way, it is bad style to load all packages within one \usepackage command. Remember that some of them accept options which can only be passed when they are included individually. One example is the caption package (see example above).


Thorsten
Post Reply