[Tugindia] Text wrapping in table

Kannan Moudgalya kannan at iitb.ac.in
Tue Jun 28 08:53:39 CEST 2011


Asha G wrote:
> I am creating a table and want some of the text to go to another line within
> the same column eg - Aerospace Engineering to be Aerospace
>
> Engineering
>
> I have tried to give column dimension p{2cm}
> and also tried Aerospace \\ Engineering
>
> Nothing is working.
> Is there any package to be used for this ?
You may wish to try the tabularx package.  Given below is a sample code.

Kannan

\documentclass[12pt]{article}
\usepackage{tabularx}
\begin{document}
\begin{tabularx}{\linewidth}%
      {|>{\setlength{\hsize}{0.2\hsize}}X|%
        >{\setlength{\hsize}{2.0\hsize}}X|%
        >{\setlength{\hsize}{0.8\hsize}}X|} \hline
No. & What is to be done & Why it needs to be done \\ \hline
1. & Completion of civil work in the dining hall.  This includes
changing the windows. & \\ \hline
2. & Electrical work in the dining hall, TV and lounge areas,
including permanent speakers, mike systems, large screens and
dimmerstat.
& To make the halls multi-utility infrastructure. \\ \hline
\end{tabularx}
\end{document}



More information about the tugindia mailing list