Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer
    
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 4: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 tex.stackexchange.com/questions/2063/… should help you –  Ronny Mar 23 '13 at 6: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 7:00
    
Ok, then you didn't choose “complete installation” and the package is missing. You can see here tex.ac.uk/cgi-bin/texfaq2html?label=inst-miktex* how to install packages, that are missing. –  Ronny Mar 23 '13 at 7: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 7:23

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}
share|improve this answer
    
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. –  zeroth Mar 22 '13 at 8:34
    
@zeroth sorry, I am lost: what do you refer to as link ? –  Federico Mar 22 '13 at 8: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. :) –  zeroth Mar 22 '13 at 8:49
3  
@zeroth thank you. I will now edit my answer. –  Federico Mar 22 '13 at 8:50
1  
This post in TeX Meta meta.tex.stackexchange.com/questions/1852/… might help you accepting the corresponding answer, that helped most/fitted best. –  Ronny Mar 25 '13 at 9:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.