1

I create a table,but some rows are very long.Because of that table could't set on page...What is a solution for that?my code is,

\begin{table}[!ht]
\renewcommand{\arraystretch}{1.5}
\caption[Set of Reports]{ Set of Reports}
\label{Set of Reports}\centering

\begin{tabular}{|l|l|l|}
\hline
\bfseries Document/Report & \bfseries tbBOSS & \bfseries Remarks \\ \hline
aaaaaaa  & bbbbb  & ccccccccccc  \\ \hline
ddddd & eeeee & fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff \\ \hline
gggg  & hhhh & iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii \\ \hline
\end{tabular}
\end{table}
JLDiaz
  • 55,732
Emalka
  • 1,651
  • 3
  • 22
  • 23

2 Answers2

3

Use a tabu environment and set the maximum width of the table to \textwidth

\begin{table}[!ht]
\caption[Set of Reports]{ Set of Reports}
\label{Set of Reports}
\begin{tabu} to \textwidth {| >{\centering\arraybackslash}m{2cm}| >{\centering\arraybackslash}m{2cm} | X[1,m,j] |} % WARNING: customize the alignment options
\hline
\bfseries Document /Report & \bfseries tbBOSS & \bfseries Remarks \\ \hline
aaaaaaa  & bbbbb  & ccccccccccc  \\ \hline
ddddd & eeeee & fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff \\ \hline
gggg  & hhhh & iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii \\ \hline
\end{tabu}
\end{table}
Federico
  • 873
  • 1
  • 7
  • 21
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. – nickpapior Mar 22 '13 at 08:34
  • @zeroth sorry, I am lost: what do you refer to as link ? – Federico Mar 22 '13 at 08:42
  • 1
    sorry about that, it is because your answer does not provide an exact answer, I know that you are correct. However, this site works best if one posts a full answer, i.e. an example of how to use the tabu package. (otherwise, every question here could be redirected to the TeX book and various manuals, which is not the intention of the site). We welcome you here, and hope that you will enjoy your stay. :) – nickpapior Mar 22 '13 at 08:49
  • 3
    @zeroth thank you. I will now edit my answer. – Federico Mar 22 '13 at 08:50
  • @zeroth and Federico thank u for helping me....I could finish it as my wish... :) – Emalka Mar 23 '13 at 08:45
  • @Emalka if this was helpful and solved your problem, then please mark the answer as accepted, thanks :) – Federico Mar 23 '13 at 09:05
  • very sorry ,i am new to the this site..how i accept the answer?using comment or other mechanism.... – Emalka Mar 23 '13 at 13:07
  • @Emalka there is a tick next to the answer (on the left side, just below the vote). click it and you're done. – Federico Mar 23 '13 at 16:47
  • 1
    This post in TeX Meta http://meta.tex.stackexchange.com/questions/1852/how-do-you-accept-an-answer might help you accepting the corresponding answer, that helped most/fitted best. – Ronny Mar 25 '13 at 09:03
  • @Emalka see the link of Ronny – Federico Mar 25 '13 at 12:03
1

One possibility would be to use tabularx. In my MWE i took your table and the package booktabs additionally (and removed the vertical lines and some horizontal ones according to the booktabs manual which resultet in

\documentclass{scrartcl}
\usepackage[fleqn]{amsmath}
\usepackage{booktabs}
\usepackage{tabularx}
\begin{document}
    \begin{table}[!ht]
        \renewcommand{\arraystretch}{1.5}
        \caption[Set of Reports]{ Set of Reports}
        \label{Set of Reports}\centering
        \begin{tabularx}{\textwidth}{llX}
            \toprule
            \bfseries Document/Report & \bfseries tbBOSS & \bfseries Remarks \\ \midrule
            aaaaaaa  & bbbbb  & ccccccccccc\\
            ddddd & eeeee & ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff fffffffffffffffff\\
            gggg  & hhhh & iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii \\\bottomrule
    \end{tabularx}
    \end{table}
\end{document}

Where i further introduced a space in the ffs such that LaTeX can break that (there was no hyphenation available - of course - for ffff... but for your remarks that should work anyways).

which the resulted in the table

TabluarX-MWE

The table covers the whole \textwidth according to the first argument of tabularx and while l acts as usual for the first columns, the remaining space is divided equally into the x columns, which is only the last one here.

David Carlisle
  • 757,742
Ronny
  • 6,110
  • thank u very much for all answers.But hava a problem.In this code produce an error "LaTeX Error: File `booktabs.sty' not found." And also i need to display all vertical and horizontal lines in table. – Emalka Mar 23 '13 at 04:43
  • Then you're missing the booktabs package. Which operating system are you working on? Windows (using MikTeX)? Then the package manager should help you, on Linux or Mac OS the TeX Live Distribution should have that package. On Windows the topic http://tex.stackexchange.com/questions/2063/how-can-i-manually-install-a-package-on-miktex-windows should help you – Ronny Mar 23 '13 at 06:56
  • i used the \usepackage{booktabs} .but have error and no lines.i working on windows 7,using MikTex and WinShellPortable. – Emalka Mar 23 '13 at 07:00
  • Ok, then you didn't choose “complete installation” and the package is missing. You can see here http://www.tex.ac.uk/cgi-bin/texfaq2html?label=inst-miktex* how to install packages, that are missing. – Ronny Mar 23 '13 at 07:08
  • thanx ,package manager help me for the error....It create table like above one...but i need to add horizantal and verticlal all lines to table...what is a solution for that – Emalka Mar 23 '13 at 07:23
  • Same as before. For vertical lines add | in the definition of the columns, for example by specifying {ll|X} (though vertical lines are really deprecated, see the booktabs manual http://ftp.fernuni-hagen.de/ftp-dir/pub/mirrors/www.ctan.org/macros/latex/contrib/booktabs/booktabs.pdf) and horizontal lines: use \midline as I used for the line between head and body. – Ronny Mar 23 '13 at 07:36
  • And you should think about acceptiong answers, otherwise you might discourage getting answers to new questions. – Ronny Mar 23 '13 at 07:42
  • It worked..thank u very much for your help... :) – Emalka Mar 23 '13 at 08:19