0

I would like to make a tabular with only 1 column. I want the tabular to have a fixed width and to contain several sentences. As some sentences may be long, several rows may be needed to hold 1 sentence. Here is what a tabular containing 3 sentences looks like (Sorry that I could not draw well the vertical and horizontal lines):

---------------------------
| Sentence 1 is very very |
| very very long.         |
---------------------------
| Sentence 2 is short.    |
---------------------------
| Sentence 3 is very very |
| very very very very ve- |
| -ry very long.          |
---------------------------

So I do not want to manually separate a sentence into several rows, I would like latex to do it, once the width of the tabular is specified. So the height of the tabular is up to the length of all the sentences...

Does anyone know if it is possible?

12
  • 1
    Please provide a minimal working example (MWE) of some kind. You have evidently been using this site for some time so you have some experience with TeX. Why can't you use an ordinary tabular with a p{} column? I'm not seeing the problem. – cfr Oct 26 '14 at 1:56
  • 1
    Well, not every question needs absolutely a MWE... I am asking for a solution to make what I expect (I made effort to draw it)... I am not asking to find a bug in an existing program. If you can explain more about that p{}, that would be much more helpful than a down-vote... – SoftTimur Oct 26 '14 at 2:00
  • 2
    Yes it does, I will provide an answer now, but I will have to type round about ten lines for you, which you could have typed. And maybe after that, you will say "oh no, sorry, I needed that in beamer". That's why we want an MWE. By the way, this topic has many answers here. – LaRiFaRi Oct 26 '14 at 2:04
  • 1
    Well every answer has to start with an MWE. So anybody who wants to help has to begin from scratch. You don't even provide the text you want in a document structure somebody can copy, paste and compile. As Peter Grill says, problems may be fun to solve but they are not fun to set up. You've asked 118 questions prior to this one. You should not need to be asked to provide an MWE. Also, you cannot know who down-voted. I often comment on questions where people down-vote without leaving any explanation. (But I did down-vote in this case, yes, and I stand by that decision.) – cfr Oct 26 '14 at 2:05
  • 1
    No one said we do not understand your question. But you got two answers here with round about 15 lines of code which someone wrote for you, for free. We do not want to set up some maybe-the-OPs-problem-containing-document but solve clearly defined problems. Your problem seemed so easy that we had to expect other problems here. (Side note: I just checked 10 of your questions. None has an MWE. There are very few problems where an MWE does not relieve the strain on volunteers) – LaRiFaRi Oct 26 '14 at 2:23
1

Not too beautiful, but as a starting point...

\documentclass{article}

\begin{document}

\begin{tabular}{|p{5cm}|} % The value that  you need in place of 5cm
\hline
Sentence 1 is very very 
very very long.         \\
\hline
Sentence 2 is short.     \\
\hline
 Sentence 3 is very very 
 very very very very very very
very very very very very very long.    \\   
\hline
\end{tabular} 
\end{document}

enter image description here

2

p columns are made for this:

% arara: pdflatex

\documentclass{article}
\usepackage{booktabs}
\usepackage{microtype} % for nice justifying in narrow columns

\begin{document}
\begin{table}
\begin{tabular}{p{3cm}}\toprule
Sentence 1 is very very very very long.\\\addlinespace
Sentence 2 is short.\\\addlinespace
Sentence 3 is very very
very very very very very very long.\\\bottomrule    
\end{tabular}
\end{table}
\end{document}

enter image description here

Hyphenation will be unnecessary in most cases, if you load microtype. If you need some, load \usepackage[english]{babel}.

If you prefer the column to be ragged right (can look better for short text pieces), you may search this site for the package array and add the \raggedright-command to each column you like.

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