LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 05-22-2005, 04:13 AM   #1
fei
Member
 
Registered: Jun 2003
Distribution: Ubuntu, Debian
Posts: 40

Rep: Reputation: 15
Latex, width of a tabular table?


I have a tabular table, but it's too wild. I want to know how to narrow
the width of the tabular table. Can anyone help me with this? Thanks!

the code is like:

\begin{table}
\begin{tabular}{|c|c|}
.....
.....
\begin{tabular}
\caption{..........}
\end{table}
 
Old 05-22-2005, 05:29 AM   #2
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 50
I've always put tables in figures, I didn't know about the table environment. Does it do anything better than the figure environment?

Anyway, what you want is the tabular* envirnment, it takes a mandatory width argument, something like

Code:
\begin{table}
\begin{tabular*}{8cm}{|c|c|}
.....
.....
\end{tabular*}
\caption{..........}
\end{table}
 
Old 05-22-2005, 06:28 AM   #3
fei
Member
 
Registered: Jun 2003
Distribution: Ubuntu, Debian
Posts: 40

Original Poster
Rep: Reputation: 15
Image can be scaled quite easily. The problem of scaling tabular is that the words in the tabular are not scaled.. I need to change the font size in order to narrow down the tabular width.
 
Old 05-22-2005, 09:36 AM   #4
enemorales
Member
 
Registered: Jul 2004
Location: Santiago, Chile
Distribution: Ubuntu
Posts: 410

Rep: Reputation: 30
Hi, I think that the advantage is that they are numerated independently, so you can use commands like \tableoftables intead of \tableoffigures (don't remember the exact commands, but that's the idea).

About the question itself, you can use p{10cm} to define a column of fixed width. LaTeX will put the content of a cell in different lines when needed.
 
Old 05-22-2005, 08:16 PM   #5
fei
Member
 
Registered: Jun 2003
Distribution: Ubuntu, Debian
Posts: 40

Original Poster
Rep: Reputation: 15
Sorry. I don't quite get what you said. So, what's the command \tableoftables? I cann't find that knd of command. And how do I use the command p{10cm}? Where should I put it in the tabular table?
 
Old 05-23-2005, 09:11 AM   #6
enemorales
Member
 
Registered: Jul 2004
Location: Santiago, Chile
Distribution: Ubuntu
Posts: 410

Rep: Reputation: 30
Sorry, I think I didn't explain myself properly.

First, I answered kev82. I said that he puts always tables inside the figure environment because he finds no advantage in using the table environment. AFAIK, the good thing about using the table environment is that the numbers of tables and figures are independent: if you habe several figures in a document, you can use the comand \listoffigures and LaTeX will create the table of figures, ie something like

Figure 1 ................. 3
Figure 2 ................ 5
...

If you put tabulars inside figures and you want to use this feature, tables and figures will share the numbers and a table will appear in the table of figures, which is not very nice. At the moment I wrote the other post I didn't have the time to check the command name to do this, which is \listoffigures (and not \tableoffigures, as i guessed). A analogous table of tables can be obtained with the \listoftables command (and not \tableoftables, which doesn't exist).

About your original question, the p{10cm} is used to define a tabular column, so you can write something like this:

Code:
\begin{table}
  \begin{tabular}{|p{10cm}|p{5cm}|}
   ...
  \end{tabular}
  \caption{This is a table with two columns.}
  \label{tbl:TWTC}
\end{table}
Then LaTeX will create the table with fixed colum widths of size 10cm and 5cm, resp. and, as I wrote before, it will put the content of a cell in differents rows of the table automatically if the size of the text is two big.

One important thing is that, unless you have some particular reason to have your table as a floating body and you don't use the \listoftables command, you don't need to use the table environment and can omit the \begin{table} and \end{table} commands.

I hope I made myself clearer now. Sorry for the last post...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
table alignment in LaTeX thelonius Programming 1 10-04-2005 07:41 AM
stretching a table in LaTeX trutnev Linux - Software 1 08-01-2005 06:42 PM
latex -- table alignment kaon Linux - Software 2 04-04-2005 02:25 PM
LaTeX commands: texi2pdf, latex, dvipdf kaon Linux - Software 7 01-23-2005 03:32 PM
Latex Help - Tabular creating vertical holes in table maneeshsethi Linux - Software 3 08-20-2004 08:13 PM


All times are GMT -5. The time now is 06:08 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration